OpenDDS::DCPS::InfoRepoDiscovery Class Reference

Discovery Strategy class that implements InfoRepo discovery. More...

#include <InfoRepoDiscovery.h>

Inheritance diagram for OpenDDS::DCPS::InfoRepoDiscovery:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::InfoRepoDiscovery:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 InfoRepoDiscovery (const RepoKey &key, const std::string &ior)
 InfoRepoDiscovery (const RepoKey &key, const DCPSInfo_var &info)
virtual ~InfoRepoDiscovery ()
std::string get_stringified_dcps_info_ior ()
DCPSInfo_var get_dcps_info ()
virtual bool active ()
int bit_transport_port () const
void bit_transport_port (int port)
std::string bit_transport_ip () const
void bit_transport_ip (const std::string &ip)
bool set_ORB (CORBA::ORB_ptr orb)
virtual DDS::Subscriber_ptr init_bit (DomainParticipantImpl *participant)
virtual void fini_bit (DCPS::DomainParticipantImpl *participant)
virtual RepoId bit_key_to_repo_id (DomainParticipantImpl *participant, const char *bit_topic_name, const DDS::BuiltinTopicKey_t &key) const
virtual bool attach_participant (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId)
virtual OpenDDS::DCPS::AddDomainStatus add_domain_participant (DDS::DomainId_t domain, const DDS::DomainParticipantQos &qos)
virtual bool remove_domain_participant (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId)
virtual bool ignore_domain_participant (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &myParticipantId, const OpenDDS::DCPS::RepoId &ignoreId)
virtual bool update_domain_participant_qos (DDS::DomainId_t domain, const OpenDDS::DCPS::RepoId &participantId, const DDS::DomainParticipantQos &qos)
virtual OpenDDS::DCPS::TopicStatus assert_topic (OpenDDS::DCPS::RepoId_out topicId, DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const char *topicName, const char *dataTypeName, const DDS::TopicQos &qos, bool hasDcpsKey)
virtual OpenDDS::DCPS::TopicStatus find_topic (DDS::DomainId_t domainId, const char *topicName, CORBA::String_out dataTypeName, DDS::TopicQos_out qos, OpenDDS::DCPS::RepoId_out topicId)
virtual OpenDDS::DCPS::TopicStatus remove_topic (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const OpenDDS::DCPS::RepoId &topicId)
virtual bool ignore_topic (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &myParticipantId, const OpenDDS::DCPS::RepoId &ignoreId)
virtual bool update_topic_qos (const OpenDDS::DCPS::RepoId &topicId, DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const DDS::TopicQos &qos)
virtual OpenDDS::DCPS::RepoId add_publication (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const OpenDDS::DCPS::RepoId &topicId, OpenDDS::DCPS::DataWriterCallbacks *publication, const DDS::DataWriterQos &qos, const OpenDDS::DCPS::TransportLocatorSeq &transInfo, const DDS::PublisherQos &publisherQos)
virtual bool remove_publication (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const OpenDDS::DCPS::RepoId &publicationId)
virtual bool ignore_publication (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &myParticipantId, const OpenDDS::DCPS::RepoId &ignoreId)
virtual bool update_publication_qos (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &partId, const OpenDDS::DCPS::RepoId &dwId, const DDS::DataWriterQos &qos, const DDS::PublisherQos &publisherQos)
virtual OpenDDS::DCPS::RepoId add_subscription (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const OpenDDS::DCPS::RepoId &topicId, OpenDDS::DCPS::DataReaderCallbacks *subscription, const DDS::DataReaderQos &qos, const OpenDDS::DCPS::TransportLocatorSeq &transInfo, const DDS::SubscriberQos &subscriberQos, const char *filterClassName, const char *filterExpression, const DDS::StringSeq &exprParams)
virtual bool remove_subscription (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const OpenDDS::DCPS::RepoId &subscriptionId)
virtual bool ignore_subscription (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &myParticipantId, const OpenDDS::DCPS::RepoId &ignoreId)
virtual bool update_subscription_qos (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &partId, const OpenDDS::DCPS::RepoId &drId, const DDS::DataReaderQos &qos, const DDS::SubscriberQos &subscriberQos)
virtual bool update_subscription_params (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const OpenDDS::DCPS::RepoId &subscriptionId, const DDS::StringSeq &params)
virtual void association_complete (DDS::DomainId_t domainId, const OpenDDS::DCPS::RepoId &participantId, const OpenDDS::DCPS::RepoId &localId, const OpenDDS::DCPS::RepoId &remoteId)

Private Member Functions

TransportConfig_rch bit_config ()
void removeDataReaderRemote (const RepoId &subscriptionId)
void removeDataWriterRemote (const RepoId &publicationId)
typedef OPENDDS_MAP_CMP (RepoId, DataReaderRemote_var, DCPS::GUID_tKeyLessThan) DataReaderMap
typedef OPENDDS_MAP_CMP (RepoId, DataWriterRemote_var, DCPS::GUID_tKeyLessThan) DataWriterMap

Private Attributes

std::string ior_
DCPSInfo_var info_
std::string bit_transport_ip_
 The builtin topic transport address.
int bit_transport_port_
 The builtin topic transport port number.
bool use_local_bit_config_
TransportConfig_rch bit_config_
FailoverListenerfailoverListener_
 Listener to initiate failover with.
CORBA::ORB_var orb_
bool orb_from_user_
DataReaderMap dataReaderMap_
DataWriterMap dataWriterMap_
ACE_Thread_Mutex lock_

Static Private Attributes

static OrbRunnerorb_runner_
static ACE_Thread_Mutex mtx_orb_runner_

Classes

class  Config
struct  OrbRunner
class  StaticInitializer

Detailed Description

Discovery Strategy class that implements InfoRepo discovery.

This class implements the Discovery interface for InfoRepo-based discovery.

Definition at line 44 of file InfoRepoDiscovery.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::InfoRepoDiscovery::InfoRepoDiscovery ( const RepoKey key,
const std::string &  ior 
)

Definition at line 95 of file InfoRepoDiscovery.cpp.

Referenced by OpenDDS::DCPS::InfoRepoDiscovery::Config::discovery_config().

00097   : Discovery(key),
00098     ior_(ior),
00099     bit_transport_port_(0),
00100     use_local_bit_config_(false),
00101     failoverListener_(0),
00102     orb_from_user_(false)
00103 {
00104 }

OpenDDS::DCPS::InfoRepoDiscovery::InfoRepoDiscovery ( const RepoKey key,
const DCPSInfo_var &  info 
)

Definition at line 106 of file InfoRepoDiscovery.cpp.

00108   : Discovery(key),
00109     info_(info),
00110     bit_transport_port_(0),
00111     use_local_bit_config_(false),
00112     failoverListener_(0),
00113     orb_from_user_(false)
00114 {
00115 }

OpenDDS::DCPS::InfoRepoDiscovery::~InfoRepoDiscovery (  )  [virtual]

Definition at line 117 of file InfoRepoDiscovery.cpp.

References failoverListener_, orb_from_user_, orb_runner_, OpenDDS::DCPS::InfoRepoDiscovery::OrbRunner::shutdown(), and OpenDDS::DCPS::InfoRepoDiscovery::OrbRunner::use_count_.

00118 {
00119   delete this->failoverListener_;
00120   if (!orb_from_user_ && orb_runner_) {
00121     if (0 == --orb_runner_->use_count_) {
00122       orb_runner_->shutdown();
00123       delete orb_runner_;
00124       orb_runner_ = 0;
00125     }
00126   }
00127 }


Member Function Documentation

bool OpenDDS::DCPS::InfoRepoDiscovery::active (  )  [virtual]

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 365 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00366 {
00367   try {
00368     // invoke a CORBA call, if we are active then there will be no exception
00369     get_dcps_info()->_is_a("Not_An_IDL_Type");
00370     return true;
00371   } catch (const CORBA::Exception&) {
00372     return false;
00373   }
00374 }

DCPS::AddDomainStatus OpenDDS::DCPS::InfoRepoDiscovery::add_domain_participant ( DDS::DomainId_t  domain,
const DDS::DomainParticipantQos qos 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 391 of file InfoRepoDiscovery.cpp.

References get_dcps_info(), and OpenDDS::DCPS::GUID_UNKNOWN.

00393 {
00394   try {
00395     const DCPSInfo_var info = get_dcps_info();
00396     if (!CORBA::is_nil(info)) {
00397       return info->add_domain_participant(domainId, qos);
00398     }
00399   } catch (const CORBA::Exception& ex) {
00400     ex._tao_print_exception("ERROR: InfoRepoDiscovery::add_domain_participant: ");
00401   }
00402   const DCPS::AddDomainStatus ads = {OpenDDS::DCPS::GUID_UNKNOWN, false /*federated*/};
00403   return ads;
00404 }

RepoId OpenDDS::DCPS::InfoRepoDiscovery::add_publication ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const OpenDDS::DCPS::RepoId topicId,
OpenDDS::DCPS::DataWriterCallbacks publication,
const DDS::DataWriterQos qos,
const OpenDDS::DCPS::TransportLocatorSeq transInfo,
const DDS::PublisherQos publisherQos 
) [virtual]

add the passed in publication into discovery. Discovery does not participate in memory management for the publication pointer, so it requires that the publication pointer remain valid until remove_publication is called.

Implements OpenDDS::DCPS::Discovery.

Definition at line 517 of file InfoRepoDiscovery.cpp.

References dataWriterMap_, get_dcps_info(), OpenDDS::DCPS::GUID_UNKNOWN, orb_, and servant_to_remote_reference().

00524 {
00525   RepoId pubId;
00526 
00527   try {
00528     DCPS::DataWriterRemoteImpl* writer_remote_impl = 0;
00529     ACE_NEW_RETURN(writer_remote_impl,
00530                    DataWriterRemoteImpl(publication),
00531                    DCPS::GUID_UNKNOWN);
00532 
00533     //this is taking ownership of the DataWriterRemoteImpl (server side) allocated above
00534     PortableServer::ServantBase_var writer_remote(writer_remote_impl);
00535 
00536     //this is the client reference to the DataWriterRemoteImpl
00537     OpenDDS::DCPS::DataWriterRemote_var dr_remote_obj =
00538       servant_to_remote_reference(writer_remote_impl, orb_);
00539 
00540     pubId = get_dcps_info()->add_publication(domainId, participantId, topicId,
00541       dr_remote_obj, qos, transInfo, publisherQos);
00542 
00543     ACE_GUARD_RETURN(ACE_Thread_Mutex, g, this->lock_, DCPS::GUID_UNKNOWN);
00544     // take ownership of the client allocated above
00545     dataWriterMap_[pubId] = dr_remote_obj;
00546 
00547   } catch (const CORBA::Exception& ex) {
00548     ex._tao_print_exception("ERROR: InfoRepoDiscovery::add_publication: ");
00549     pubId = DCPS::GUID_UNKNOWN;
00550   }
00551 
00552   return pubId;
00553 }

RepoId OpenDDS::DCPS::InfoRepoDiscovery::add_subscription ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const OpenDDS::DCPS::RepoId topicId,
OpenDDS::DCPS::DataReaderCallbacks subscription,
const DDS::DataReaderQos qos,
const OpenDDS::DCPS::TransportLocatorSeq transInfo,
const DDS::SubscriberQos subscriberQos,
const char *  filterClassName,
const char *  filterExpression,
const DDS::StringSeq exprParams 
) [virtual]

add the passed in subscription into discovery. Discovery does not participate in memory management for the subscription pointer, so it requires that the subscription pointer remain valid until remove_subscription is called.

Implements OpenDDS::DCPS::Discovery.

Definition at line 609 of file InfoRepoDiscovery.cpp.

References dataReaderMap_, get_dcps_info(), OpenDDS::DCPS::GUID_UNKNOWN, orb_, and servant_to_remote_reference().

00619 {
00620   RepoId subId;
00621 
00622   try {
00623     DCPS::DataReaderRemoteImpl* reader_remote_impl = 0;
00624     ACE_NEW_RETURN(reader_remote_impl,
00625                    DataReaderRemoteImpl(subscription),
00626                    DCPS::GUID_UNKNOWN);
00627 
00628     //this is taking ownership of the DataReaderRemoteImpl (server side) allocated above
00629     PortableServer::ServantBase_var reader_remote(reader_remote_impl);
00630 
00631     //this is the client reference to the DataReaderRemoteImpl
00632     OpenDDS::DCPS::DataReaderRemote_var dr_remote_obj =
00633       servant_to_remote_reference(reader_remote_impl, orb_);
00634 
00635     subId = get_dcps_info()->add_subscription(domainId, participantId, topicId,
00636                                               dr_remote_obj, qos, transInfo, subscriberQos,
00637                                               filterClassName, filterExpr, params);
00638 
00639     ACE_GUARD_RETURN(ACE_Thread_Mutex, g, this->lock_, DCPS::GUID_UNKNOWN);
00640     // take ownership of the client allocated above
00641     dataReaderMap_[subId] = dr_remote_obj;
00642 
00643   } catch (const CORBA::Exception& ex) {
00644     ex._tao_print_exception("ERROR: InfoRepoDiscovery::add_subscription: ");
00645     subId = DCPS::GUID_UNKNOWN;
00646   }
00647   return subId;
00648 }

virtual OpenDDS::DCPS::TopicStatus OpenDDS::DCPS::InfoRepoDiscovery::assert_topic ( OpenDDS::DCPS::RepoId_out  topicId,
DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const char *  topicName,
const char *  dataTypeName,
const DDS::TopicQos qos,
bool  hasDcpsKey 
) [virtual]

void OpenDDS::DCPS::InfoRepoDiscovery::association_complete ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const OpenDDS::DCPS::RepoId localId,
const OpenDDS::DCPS::RepoId remoteId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 720 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00723 {
00724   try {
00725     get_dcps_info()->association_complete(domainId, participantId, localId, remoteId);
00726   } catch (const CORBA::Exception& ex) {
00727     ex._tao_print_exception("ERROR: InfoRepoDiscovery::association_complete: ");
00728   }
00729 }

bool OpenDDS::DCPS::InfoRepoDiscovery::attach_participant ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 379 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00381 {
00382   try {
00383     return get_dcps_info()->attach_participant(domainId, participantId);
00384   } catch (const CORBA::Exception& ex) {
00385     ex._tao_print_exception("ERROR: InfoRepoDiscovery::attach_participant: ");
00386     return false;
00387   }
00388 }

TransportConfig_rch OpenDDS::DCPS::InfoRepoDiscovery::bit_config (  )  [private]

Definition at line 217 of file InfoRepoDiscovery.cpp.

References bit_config_, bit_transport_ip_, bit_transport_port_, OpenDDS::DCPS::TransportRegistry::create_config(), OpenDDS::DCPS::TransportRegistry::create_inst(), OpenDDS::DCPS::TransportRegistry::DEFAULT_INST_PREFIX, OpenDDS::DCPS::TransportRegistry::instance(), OpenDDS::DCPS::RcHandle< T >::is_nil(), OpenDDS::DCPS::Discovery::key(), TheServiceParticipant, and use_local_bit_config_.

Referenced by init_bit().

00218 {
00219 #if !defined (DDS_HAS_MINIMUM_BIT)
00220   if (bit_config_.is_nil()) {
00221     const std::string cfg_name = TransportRegistry::DEFAULT_INST_PREFIX +
00222                                  std::string("_BITTransportConfig_") + key();
00223     bit_config_ = TransportRegistry::instance()->create_config(cfg_name);
00224 
00225     const std::string inst_name = TransportRegistry::DEFAULT_INST_PREFIX +
00226                                   std::string("_BITTCPTransportInst_") + key();
00227     TransportInst_rch inst =
00228       TransportRegistry::instance()->create_inst(inst_name, "tcp");
00229     bit_config_->instances_.push_back(inst);
00230 
00231     if (!use_local_bit_config_) {
00232       bit_transport_ip_ = TheServiceParticipant->bit_transport_ip();
00233       bit_transport_port_ = TheServiceParticipant->bit_transport_port();
00234     }
00235 
00236     // Use a static cast to avoid dependency on the Tcp library
00237     TcpInst_rch tcp_inst = static_rchandle_cast<TcpInst>(inst);
00238 
00239     tcp_inst->datalink_release_delay_ = 0;
00240     tcp_inst->local_address(bit_transport_port_,
00241                             bit_transport_ip_.c_str());
00242   }
00243   return bit_config_;
00244 #else
00245   return 0;
00246 #endif
00247 }

RepoId OpenDDS::DCPS::InfoRepoDiscovery::bit_key_to_repo_id ( DomainParticipantImpl participant,
const char *  bit_topic_name,
const DDS::BuiltinTopicKey_t key 
) const [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 352 of file InfoRepoDiscovery.cpp.

References OpenDDS::DCPS::GuidBuilder::create(), OpenDDS::DCPS::GuidBuilder::entityId(), OpenDDS::DCPS::RepoIdBuilder::federationId(), OpenDDS::DCPS::Discovery::key(), and OpenDDS::DCPS::RepoIdBuilder::participantId().

00355 {
00356   RepoId id = RepoIdBuilder::create();
00357   RepoIdBuilder builder(id);
00358   builder.federationId(key.value[0]);
00359   builder.participantId(key.value[1]);
00360   builder.entityId(key.value[2]);
00361   return id;
00362 }

void OpenDDS::DCPS::InfoRepoDiscovery::bit_transport_ip ( const std::string &  ip  )  [inline]

Definition at line 63 of file InfoRepoDiscovery.h.

00063                                              {
00064     bit_transport_ip_ = ip;
00065     use_local_bit_config_ = true;
00066   }

std::string OpenDDS::DCPS::InfoRepoDiscovery::bit_transport_ip (  )  const [inline]

Definition at line 62 of file InfoRepoDiscovery.h.

00062 { return bit_transport_ip_; }

void OpenDDS::DCPS::InfoRepoDiscovery::bit_transport_port ( int  port  )  [inline]

Definition at line 57 of file InfoRepoDiscovery.h.

00057                                     {
00058     bit_transport_port_ = port;
00059     use_local_bit_config_ = true;
00060   }

int OpenDDS::DCPS::InfoRepoDiscovery::bit_transport_port (  )  const [inline]

Definition at line 56 of file InfoRepoDiscovery.h.

00056 { return bit_transport_port_; }

virtual OpenDDS::DCPS::TopicStatus OpenDDS::DCPS::InfoRepoDiscovery::find_topic ( DDS::DomainId_t  domainId,
const char *  topicName,
CORBA::String_out  dataTypeName,
DDS::TopicQos_out  qos,
OpenDDS::DCPS::RepoId_out  topicId 
) [virtual]

void OpenDDS::DCPS::InfoRepoDiscovery::fini_bit ( DCPS::DomainParticipantImpl participant  )  [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 346 of file InfoRepoDiscovery.cpp.

00347 {
00348   // nothing to do for DCPSInfoRepo
00349 }

DCPSInfo_var OpenDDS::DCPS::InfoRepoDiscovery::get_dcps_info (  ) 

Definition at line 163 of file InfoRepoDiscovery.cpp.

References OpenDDS::DCPS::DEFAULT_ORB_NAME, OpenDDS::DCPS::get_repo(), info_, OpenDDS::DCPS::Discovery::key(), mtx_orb_runner_, OpenDDS::DCPS::InfoRepoDiscovery::OrbRunner::orb_, orb_, orb_runner_, TheServiceParticipant, and OpenDDS::DCPS::InfoRepoDiscovery::OrbRunner::use_count_.

Referenced by active(), add_domain_participant(), add_publication(), add_subscription(), association_complete(), attach_participant(), ignore_domain_participant(), ignore_publication(), ignore_subscription(), ignore_topic(), remove_domain_participant(), remove_publication(), remove_subscription(), remove_topic(), update_domain_participant_qos(), update_publication_qos(), update_subscription_params(), update_subscription_qos(), and update_topic_qos().

00164 {
00165   if (CORBA::is_nil(this->info_.in())) {
00166 
00167     if (!orb_) {
00168       ACE_GUARD_RETURN(ACE_Thread_Mutex, g, mtx_orb_runner_, 0);
00169       if (!orb_runner_) {
00170         orb_runner_ = new OrbRunner;
00171         ACE_ARGV* argv = TheServiceParticipant->ORB_argv();
00172         int argc = argv->argc();
00173         orb_runner_->orb_ =
00174           CORBA::ORB_init(argc, argv->argv(), DEFAULT_ORB_NAME);
00175         orb_runner_->use_count_ = 1;
00176         orb_runner_->activate();
00177 
00178         CORBA::Object_var rp =
00179           orb_runner_->orb_->resolve_initial_references("RootPOA");
00180         PortableServer::POA_var poa = PortableServer::POA::_narrow(rp);
00181         PortableServer::POAManager_var poa_manager = poa->the_POAManager();
00182         poa_manager->activate();
00183       } else {
00184         ++orb_runner_->use_count_;
00185       }
00186       orb_ = orb_runner_->orb_;
00187     }
00188 
00189     try {
00190       this->info_ = get_repo(this->ior_.c_str(), orb_);
00191 
00192       if (CORBA::is_nil(this->info_.in())) {
00193         ACE_ERROR((LM_ERROR,
00194                    ACE_TEXT("(%P|%t) ERROR: InfoRepoDiscovery::get_dcps_info: ")
00195                    ACE_TEXT("unable to narrow DCPSInfo (%C) for key %C.\n"),
00196                    this->ior_.c_str(),
00197                    this->key().c_str()));
00198         return DCPSInfo::_nil();
00199       }
00200 
00201     } catch (const CORBA::Exception& ex) {
00202       ex._tao_print_exception("ERROR: InfoRepoDiscovery::get_dcps_info: failed to resolve ior - ");
00203       return DCPSInfo::_nil();
00204     }
00205   }
00206 
00207   return this->info_;
00208 }

std::string OpenDDS::DCPS::InfoRepoDiscovery::get_stringified_dcps_info_ior (  ) 

Definition at line 211 of file InfoRepoDiscovery.cpp.

References ior_.

00212 {
00213   return this->ior_;
00214 }

bool OpenDDS::DCPS::InfoRepoDiscovery::ignore_domain_participant ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId myParticipantId,
const OpenDDS::DCPS::RepoId ignoreId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 420 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00423 {
00424   try {
00425     get_dcps_info()->ignore_domain_participant(domainId, myParticipantId, ignoreId);
00426     return true;
00427   } catch (const CORBA::Exception& ex) {
00428     ex._tao_print_exception("ERROR: InfoRepoDiscovery::ignore_domain_participant: ");
00429     return false;
00430   }
00431 }

bool OpenDDS::DCPS::InfoRepoDiscovery::ignore_publication ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId myParticipantId,
const OpenDDS::DCPS::RepoId ignoreId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 576 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00579 {
00580   try {
00581     get_dcps_info()->ignore_publication(domainId, participantId, ignoreId);
00582     return true;
00583   } catch (const CORBA::Exception& ex) {
00584     ex._tao_print_exception("ERROR: InfoRepoDiscovery::ignore_publication: ");
00585     return false;
00586   }
00587 }

bool OpenDDS::DCPS::InfoRepoDiscovery::ignore_subscription ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId myParticipantId,
const OpenDDS::DCPS::RepoId ignoreId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 671 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00674 {
00675   try {
00676     get_dcps_info()->ignore_subscription(domainId, participantId, ignoreId);
00677     return true;
00678   } catch (const CORBA::Exception& ex) {
00679     ex._tao_print_exception("ERROR: InfoRepoDiscovery::ignore_subscription: ");
00680     return false;
00681   }
00682 }

bool OpenDDS::DCPS::InfoRepoDiscovery::ignore_topic ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId myParticipantId,
const OpenDDS::DCPS::RepoId ignoreId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 489 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00491 {
00492   try {
00493     get_dcps_info()->ignore_topic(domainId, myParticipantId, ignoreId);
00494     return true;
00495   } catch (const CORBA::Exception& ex) {
00496     ex._tao_print_exception("ERROR: InfoRepoDiscovery::ignore_topic: ");
00497     return false;
00498   }
00499 }

DDS::Subscriber_ptr OpenDDS::DCPS::InfoRepoDiscovery::init_bit ( DomainParticipantImpl participant  )  [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 250 of file InfoRepoDiscovery.cpp.

References OpenDDS::DCPS::TransportRegistry::bind_config(), bit_config(), OpenDDS::DCPS::BUILT_IN_PARTICIPANT_TOPIC, OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC, OpenDDS::DCPS::BUILT_IN_SUBSCRIPTION_TOPIC, OpenDDS::DCPS::BUILT_IN_TOPIC_TOPIC, OpenDDS::DCPS::Discovery::create_bit_topics(), OpenDDS::DCPS::DEFAULT_STATUS_MASK, DDS::DataReaderQos::durability, failoverListener_, OpenDDS::DCPS::TransportRegistry::instance(), OpenDDS::DCPS::Discovery::key(), DDS::DataReaderQos::liveliness, DDS::RETCODE_OK, SUBSCRIBER_QOS_DEFAULT, TheServiceParticipant, and DDS::TRANSIENT_LOCAL_DURABILITY_QOS.

00251 {
00252 #if defined (DDS_HAS_MINIMUM_BIT)
00253   ACE_UNUSED_ARG(participant);
00254   return 0;
00255 #else
00256   if (!TheServiceParticipant->get_BIT()) {
00257     return 0;
00258   }
00259 
00260   if (create_bit_topics(participant) != DDS::RETCODE_OK) {
00261     return 0;
00262   }
00263 
00264   DDS::Subscriber_var bit_subscriber =
00265     participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT,
00266                                    DDS::SubscriberListener::_nil(),
00267                                    DEFAULT_STATUS_MASK);
00268   try {
00269     TransportConfig_rch config = bit_config();
00270     TransportRegistry::instance()->bind_config(config, bit_subscriber);
00271 
00272   } catch (const Transport::Exception&) {
00273     ACE_ERROR((LM_ERROR, "(%P|%t) InfoRepoDiscovery::init_bit, "
00274                          "exception during transport initialization\n"));
00275     return 0;
00276   }
00277 
00278   // DataReaders
00279   try {
00280     DDS::DataReaderQos participantReaderQos;
00281     bit_subscriber->get_default_datareader_qos(participantReaderQos);
00282     participantReaderQos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
00283 
00284     if (participant->federated()) {
00285       participantReaderQos.liveliness.lease_duration.nanosec = 0;
00286       participantReaderQos.liveliness.lease_duration.sec =
00287         TheServiceParticipant->federation_liveliness();
00288     }
00289 
00290     DDS::TopicDescription_var bit_part_topic =
00291       participant->lookup_topicdescription(BUILT_IN_PARTICIPANT_TOPIC);
00292 
00293     DDS::DataReader_var dr =
00294       bit_subscriber->create_datareader(bit_part_topic,
00295                                         participantReaderQos,
00296                                         DDS::DataReaderListener::_nil(),
00297                                         DEFAULT_STATUS_MASK);
00298 
00299     if (participant->federated()) {
00300       DDS::ParticipantBuiltinTopicDataDataReader* pbit_dr =
00301         DDS::ParticipantBuiltinTopicDataDataReader::_narrow(dr.in());
00302 
00303       // Create and attach the listener.
00304       failoverListener_ = new FailoverListener(key());
00305       pbit_dr->set_listener(failoverListener_, DEFAULT_STATUS_MASK);
00306     }
00307 
00308     DDS::DataReaderQos dr_qos;
00309     bit_subscriber->get_default_datareader_qos(dr_qos);
00310     dr_qos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
00311 
00312     DDS::TopicDescription_var bit_topic_topic =
00313       participant->lookup_topicdescription(BUILT_IN_TOPIC_TOPIC);
00314 
00315     dr = bit_subscriber->create_datareader(bit_topic_topic,
00316                                            dr_qos,
00317                                            DDS::DataReaderListener::_nil(),
00318                                            DEFAULT_STATUS_MASK);
00319 
00320     DDS::TopicDescription_var bit_pub_topic =
00321       participant->lookup_topicdescription(BUILT_IN_PUBLICATION_TOPIC);
00322 
00323     dr = bit_subscriber->create_datareader(bit_pub_topic,
00324                                            dr_qos,
00325                                            DDS::DataReaderListener::_nil(),
00326                                            OpenDDS::DCPS::DEFAULT_STATUS_MASK);
00327 
00328     DDS::TopicDescription_var bit_sub_topic =
00329       participant->lookup_topicdescription(BUILT_IN_SUBSCRIPTION_TOPIC);
00330 
00331     dr = bit_subscriber->create_datareader(bit_sub_topic,
00332                                            dr_qos,
00333                                            DDS::DataReaderListener::_nil(),
00334                                            OpenDDS::DCPS::DEFAULT_STATUS_MASK);
00335 
00336   } catch (const CORBA::Exception&) {
00337     ACE_ERROR((LM_ERROR, "(%P|%t) InfoRepoDiscovery::init_bit, "
00338                          "exception during DataReader initialization\n"));
00339     return 0;
00340   }
00341   return bit_subscriber._retn();
00342 #endif
00343 }

typedef OpenDDS::DCPS::InfoRepoDiscovery::OPENDDS_MAP_CMP ( RepoId  ,
DataWriterRemote_var  ,
DCPS::GUID_tKeyLessThan   
) [private]

typedef OpenDDS::DCPS::InfoRepoDiscovery::OPENDDS_MAP_CMP ( RepoId  ,
DataReaderRemote_var  ,
DCPS::GUID_tKeyLessThan   
) [private]

bool OpenDDS::DCPS::InfoRepoDiscovery::remove_domain_participant ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 407 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00409 {
00410   try {
00411     get_dcps_info()->remove_domain_participant(domainId, participantId);
00412     return true;
00413   } catch (const CORBA::Exception& ex) {
00414     ex._tao_print_exception("ERROR: InfoRepoDiscovery::remove_domain_participant: ");
00415     return false;
00416   }
00417 }

bool OpenDDS::DCPS::InfoRepoDiscovery::remove_publication ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const OpenDDS::DCPS::RepoId publicationId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 556 of file InfoRepoDiscovery.cpp.

References get_dcps_info(), and removeDataWriterRemote().

00559 {
00560   {
00561     ACE_GUARD_RETURN(ACE_Thread_Mutex, g, this->lock_, false);
00562     removeDataWriterRemote(publicationId);
00563   }
00564   bool removed = false;
00565   try {
00566     get_dcps_info()->remove_publication(domainId, participantId, publicationId);
00567     removed = true;
00568   } catch (const CORBA::Exception& ex) {
00569     ex._tao_print_exception("ERROR: InfoRepoDiscovery::remove_publication: ");
00570   }
00571 
00572   return removed;
00573 }

bool OpenDDS::DCPS::InfoRepoDiscovery::remove_subscription ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const OpenDDS::DCPS::RepoId subscriptionId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 651 of file InfoRepoDiscovery.cpp.

References get_dcps_info(), and removeDataReaderRemote().

00654 {
00655   {
00656     ACE_GUARD_RETURN(ACE_Thread_Mutex, g, this->lock_, false);
00657     removeDataReaderRemote(subscriptionId);
00658   }
00659   bool removed = false;
00660   try {
00661     get_dcps_info()->remove_subscription(domainId, participantId, subscriptionId);
00662     removed = true;
00663   } catch (const CORBA::Exception& ex) {
00664     ex._tao_print_exception("ERROR: InfoRepoDiscovery::remove_subscription: ");
00665   }
00666 
00667   return removed;
00668 }

DCPS::TopicStatus OpenDDS::DCPS::InfoRepoDiscovery::remove_topic ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const OpenDDS::DCPS::RepoId topicId 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 477 of file InfoRepoDiscovery.cpp.

References get_dcps_info(), and OpenDDS::DCPS::INTERNAL_ERROR.

00479 {
00480   try {
00481     return get_dcps_info()->remove_topic(domainId, participantId, topicId);
00482   } catch (const CORBA::Exception& ex) {
00483     ex._tao_print_exception("ERROR: InfoRepoDiscovery::remove_topic: ");
00484     return DCPS::INTERNAL_ERROR;
00485   }
00486 }

void OpenDDS::DCPS::InfoRepoDiscovery::removeDataReaderRemote ( const RepoId subscriptionId  )  [private]

Definition at line 732 of file InfoRepoDiscovery.cpp.

References dataReaderMap_, deactivate_remote_object(), OpenDDS::DCPS::DataReaderRemoteImpl::detach_parent(), and orb_.

Referenced by remove_subscription().

00733 {
00734   DataReaderMap::iterator drr = dataReaderMap_.find(subscriptionId);
00735   if (drr == dataReaderMap_.end()) {
00736     ACE_ERROR((LM_ERROR,
00737                ACE_TEXT("(%P|%t) ERROR: InfoRepoDiscovery::removeDataReaderRemote: ")
00738                ACE_TEXT(" could not find DataReader for subscriptionId.\n")));
00739     return;
00740   }
00741 
00742   DataReaderRemoteImpl* impl =
00743     remote_reference_to_servant<DataReaderRemoteImpl>(drr->second.in(), orb_);
00744   impl->detach_parent();
00745   deactivate_remote_object(drr->second.in(), orb_);
00746 
00747   dataReaderMap_.erase(drr);
00748 }

void OpenDDS::DCPS::InfoRepoDiscovery::removeDataWriterRemote ( const RepoId publicationId  )  [private]

Definition at line 751 of file InfoRepoDiscovery.cpp.

References dataWriterMap_, deactivate_remote_object(), OpenDDS::DCPS::DataWriterRemoteImpl::detach_parent(), and orb_.

Referenced by remove_publication().

00752 {
00753   DataWriterMap::iterator dwr = dataWriterMap_.find(publicationId);
00754   if (dwr == dataWriterMap_.end()) {
00755     ACE_ERROR((LM_ERROR,
00756                ACE_TEXT("(%P|%t) ERROR: InfoRepoDiscovery::removeDataWriterRemote: ")
00757                ACE_TEXT(" could not find DataWriter for publicationId.\n")));
00758     return;
00759   }
00760 
00761   DataWriterRemoteImpl* impl =
00762     remote_reference_to_servant<DataWriterRemoteImpl>(dwr->second.in(), orb_);
00763   impl->detach_parent();
00764   deactivate_remote_object(dwr->second.in(), orb_);
00765 
00766   dataWriterMap_.erase(dwr);
00767 }

bool OpenDDS::DCPS::InfoRepoDiscovery::set_ORB ( CORBA::ORB_ptr  orb  ) 

User provides an ORB for OpenDDS to use.

Note:
The user is responsible for running the ORB.
Returns:
true if the operation succeeds

Definition at line 130 of file InfoRepoDiscovery.cpp.

References orb_, and orb_from_user_.

00131 {
00132   if (orb_.in() || !orb) {
00133     return false;
00134   }
00135 
00136   orb_ = CORBA::ORB::_duplicate(orb);
00137   orb_from_user_ = true;
00138   return true;
00139 }

bool OpenDDS::DCPS::InfoRepoDiscovery::update_domain_participant_qos ( DDS::DomainId_t  domain,
const OpenDDS::DCPS::RepoId participantId,
const DDS::DomainParticipantQos qos 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 434 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00437 {
00438   try {
00439     return get_dcps_info()->update_domain_participant_qos(domainId, participant, qos);
00440   } catch (const CORBA::Exception& ex) {
00441     ex._tao_print_exception("ERROR: InfoRepoDiscovery::update_domain_participant_qos: ");
00442     return false;
00443   }
00444 }

bool OpenDDS::DCPS::InfoRepoDiscovery::update_publication_qos ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId partId,
const OpenDDS::DCPS::RepoId dwId,
const DDS::DataWriterQos qos,
const DDS::PublisherQos publisherQos 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 590 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00595 {
00596   try {
00597     return get_dcps_info()->update_publication_qos(domainId, participantId, dwId,
00598       qos, publisherQos);
00599   } catch (const CORBA::Exception& ex) {
00600     ex._tao_print_exception("ERROR: InfoRepoDiscovery::update_publication_qos: ");
00601     return false;
00602   }
00603 }

bool OpenDDS::DCPS::InfoRepoDiscovery::update_subscription_params ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const OpenDDS::DCPS::RepoId subscriptionId,
const DDS::StringSeq params 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 701 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00706 {
00707   try {
00708     return get_dcps_info()->update_subscription_params(domainId, participantId,
00709       subId, params);
00710   } catch (const CORBA::Exception& ex) {
00711     ex._tao_print_exception("ERROR: InfoRepoDiscovery::update_subscription_params: ");
00712     return false;
00713   }
00714 }

bool OpenDDS::DCPS::InfoRepoDiscovery::update_subscription_qos ( DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId partId,
const OpenDDS::DCPS::RepoId drId,
const DDS::DataReaderQos qos,
const DDS::SubscriberQos subscriberQos 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 685 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00690 {
00691   try {
00692     return get_dcps_info()->update_subscription_qos(domainId, participantId,
00693       drId, qos, subQos);
00694   } catch (const CORBA::Exception& ex) {
00695     ex._tao_print_exception("ERROR: InfoRepoDiscovery::update_subscription_qos: ");
00696     return false;
00697   }
00698 }

bool OpenDDS::DCPS::InfoRepoDiscovery::update_topic_qos ( const OpenDDS::DCPS::RepoId topicId,
DDS::DomainId_t  domainId,
const OpenDDS::DCPS::RepoId participantId,
const DDS::TopicQos qos 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 502 of file InfoRepoDiscovery.cpp.

References get_dcps_info().

00504 {
00505   try {
00506     return get_dcps_info()->update_topic_qos(topicId, domainId, participantId, qos);
00507   } catch (const CORBA::Exception& ex) {
00508     ex._tao_print_exception("ERROR: InfoRepoDiscovery::update_topic_qos: ");
00509     return false;
00510   }
00511 }


Member Data Documentation

TransportConfig_rch OpenDDS::DCPS::InfoRepoDiscovery::bit_config_ [private]

Definition at line 231 of file InfoRepoDiscovery.h.

Referenced by bit_config().

std::string OpenDDS::DCPS::InfoRepoDiscovery::bit_transport_ip_ [private]

The builtin topic transport address.

Definition at line 225 of file InfoRepoDiscovery.h.

Referenced by bit_config().

int OpenDDS::DCPS::InfoRepoDiscovery::bit_transport_port_ [private]

The builtin topic transport port number.

Definition at line 228 of file InfoRepoDiscovery.h.

Referenced by bit_config().

DataReaderMap OpenDDS::DCPS::InfoRepoDiscovery::dataReaderMap_ [private]

Definition at line 256 of file InfoRepoDiscovery.h.

Referenced by add_subscription(), and removeDataReaderRemote().

DataWriterMap OpenDDS::DCPS::InfoRepoDiscovery::dataWriterMap_ [private]

Definition at line 260 of file InfoRepoDiscovery.h.

Referenced by add_publication(), and removeDataWriterRemote().

FailoverListener* OpenDDS::DCPS::InfoRepoDiscovery::failoverListener_ [private]

Listener to initiate failover with.

Definition at line 234 of file InfoRepoDiscovery.h.

Referenced by init_bit(), and ~InfoRepoDiscovery().

DCPSInfo_var OpenDDS::DCPS::InfoRepoDiscovery::info_ [private]

Definition at line 222 of file InfoRepoDiscovery.h.

Referenced by get_dcps_info().

std::string OpenDDS::DCPS::InfoRepoDiscovery::ior_ [private]

Definition at line 221 of file InfoRepoDiscovery.h.

Referenced by get_stringified_dcps_info_ior().

ACE_Thread_Mutex OpenDDS::DCPS::InfoRepoDiscovery::lock_ [mutable, private]

Definition at line 262 of file InfoRepoDiscovery.h.

ACE_Thread_Mutex OpenDDS::DCPS::InfoRepoDiscovery::mtx_orb_runner_ [static, private]

Definition at line 252 of file InfoRepoDiscovery.h.

Referenced by get_dcps_info().

CORBA::ORB_var OpenDDS::DCPS::InfoRepoDiscovery::orb_ [private]

Definition at line 236 of file InfoRepoDiscovery.h.

Referenced by add_publication(), add_subscription(), get_dcps_info(), removeDataReaderRemote(), removeDataWriterRemote(), and set_ORB().

bool OpenDDS::DCPS::InfoRepoDiscovery::orb_from_user_ [private]

Definition at line 237 of file InfoRepoDiscovery.h.

Referenced by set_ORB(), and ~InfoRepoDiscovery().

InfoRepoDiscovery::OrbRunner * OpenDDS::DCPS::InfoRepoDiscovery::orb_runner_ [static, private]

Definition at line 251 of file InfoRepoDiscovery.h.

Referenced by get_dcps_info(), and ~InfoRepoDiscovery().

bool OpenDDS::DCPS::InfoRepoDiscovery::use_local_bit_config_ [private]

Definition at line 230 of file InfoRepoDiscovery.h.

Referenced by bit_config().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:18 2016 for OpenDDS by  doxygen 1.4.7