21 #ifndef DDS_HAS_MINIMUM_BIT 27 #include <tao/BiDir_GIOP/BiDirGIOP.h> 28 #include <orbsvcs/Shutdown_Utilities.h> 29 #ifdef ACE_AS_STATIC_LIBS 30 # include <tao/ImR_Client/ImR_Client.h> 43 , listen_address_given_(0)
44 #ifdef DDS_HAS_MINIMUM_BIT
51 , servant_finalized_(false)
52 , federatorConfig_(argc, argv)
53 , federator_(this->federatorConfig_)
56 , shutdown_complete_(false)
58 , dispatch_cleanup_delay_(30,0)
100 if (shutdown_error) {
102 "TheServiceParticipant->shutdown returned: %C\n",
110 this->
orb_->destroy();
125 "InfoRepo_Shutdown: shutting down on signal %d\n",
134 if (shutdown_error) {
136 "TheServiceParticipant->shutdown returned: %C\n",
141 this->
orb_->shutdown(
true);
154 this->
orb_->orb_core()->reactor()->notify(
this);
177 ACE_TEXT(
" -a <address> listening address for Built-In Topics\n")
178 ACE_TEXT(
" -o <file> write ior to file\n")
179 ACE_TEXT(
" -NOBITS disable the Built-In Topics\n")
180 ACE_TEXT(
" -z turn on verbose Transport logging\n")
181 ACE_TEXT(
" -r Resurrect from persistent file\n")
182 ACE_TEXT(
" -FederatorConfig <file> configure federation from <file>\n")
183 ACE_TEXT(
" -FederationId <number> value for this repository\n")
184 ACE_TEXT(
" -FederateWith <ior> federate initially with object at <ior>\n")
185 ACE_TEXT(
" -ReassociateDelay <msec> delay between reassociations\n")
186 ACE_TEXT(
" -DispatchingCheckDelay <sec> delay between checks for cleaning up dispatching connections.\n")
242 this->
usage(argv[0]);
260 bool use_bidir =
true;
262 for (
int i = 0; i < args.
argc() - 1; ++i) {
272 ACE_TEXT(
"static Client_Strategy_Factory \"-ORBWaitStrategy rw ")
273 ACE_TEXT(
"-ORBTransportMuxStrategy exclusive -ORBConnectStrategy blocked ")
274 ACE_TEXT(
"-ORBConnectionHandlerCleanup 1\""),
276 ACE_TEXT(
"static Resource_Factory \"-ORBFlushingStrategy blocking\""),
282 int argc = args.
argc();
293 this->
orb_->resolve_initial_references(
"RootPOA");
296 PortableServer::POAManager_var poa_manager = root_poa->the_POAManager();
301 policies.length(2 + use_bidir);
306 policy <<= BiDirPolicy::BOTH;
308 orb_->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, policy);
316 policies[i]->destroy();
321 info_poa->activate_object_with_id(oid, this->info_servant_.in());
322 obj = info_poa->id_to_reference(oid);
326 OpenDDS::DCPS::DCPSInfo_var info_repo =
327 OpenDDS::DCPS::DCPSInfo::_unchecked_narrow(obj);
330 orb_->object_to_string(info_repo);
333 DDS::DomainParticipantFactory_var dpf =
344 poa_manager->activate();
347 if (this->info_servant_->init_transport(this->listen_address_given_,
348 this->listen_address_str_.c_str())
351 ACE_TEXT(
"Unable to initialize transport.\n")));
352 throw InitError(
"Unable to initialize transport.");
367 if (!ird->set_ORB(
orb_)) {
369 ACE_TEXT(
"Unable to set the ORB in InfoRepoDiscovery.\n")));
370 throw InitError(
"Unable to set the ORB in InfoRepoDiscovery.");
375 if (!this->info_servant_->init_persistence()) {
377 ACE_TEXT(
"Unable to initialize persistence.\n")));
378 throw InitError(
"Unable to initialize persistence.");
383 !this->info_servant_->init_reassociation(this->reassociate_delay_)) {
385 ACE_TEXT(
"Unable to initialize reassociation.\n")));
386 throw InitError(
"Unable to initialize reassociation.");
391 !this->info_servant_->init_dispatchChecking(this->dispatch_cleanup_delay_)) {
393 ACE_TEXT(
"Unable to initialize Dispatch checking.\n")));
394 throw InitError(
"Unable to initialize dispatch checking.");
398 OpenDDS::Federator::Manager_var federator;
403 info_poa->activate_object_with_id(oid, &
federator_);
404 obj = info_poa->id_to_reference(oid);
405 federator = OpenDDS::Federator::Manager::_narrow(obj);
407 federator_ior =
orb_->object_to_string(federator);
432 this->
orb_->resolve_initial_references(
"IORTable");
434 IORTable::Table_var adapter = IORTable::Table::_narrow(table_object);
449 adapter->bind(buffer.str().c_str(), federator_ior);
455 if (output_file == 0) {
458 throw InitError(
"Unable to open IOR file.");
469 ACE_TEXT(
"(%P|%t) INFO: DCPSInfoRepo::init() - ")
470 ACE_TEXT(
"joining federation with repository %s\n"),
474 obj = this->
orb_->string_to_object(
479 ACE_TEXT(
"(%P|%t) ERROR: could not resolve %s for initial federation.\n"),
481 throw InitError(
"Unable to resolve IOR for initial federation.");
484 OpenDDS::Federator::Manager_var peer =
485 OpenDDS::Federator::Manager::_narrow(obj);
489 ACE_TEXT(
"(%P|%t) ERROR: could not narrow %s.\n"),
491 throw InitError(
"Unable to narrow peer for initial federation.");
495 peer = peer->join_federation(federator,
#define ACE_GUARD(MUTEX, OBJ, LOCK)
const char * c_str(void) const
static const char * DEFAULT_REPO
Key value for the default repository IOR.
ACE_TCHAR **& argv()
Access the enhanced argc.
ACE_Time_Value reassociate_delay_
InfoRepo_Shutdown(InfoRepo &ir)
void federationDomain(long domain)
Federation Id value.
const TAO_DDS_DCPSFederationId & id() const
Accessors for the federation Id value.
TAO_DDS_DCPSInfo_i *& info()
Accessors for the DCPSInfo reference.
CORBA::OctetSeq_var ObjectId_var
InfoRepo(int argc, ACE_TCHAR *argv[])
#define ACE_TEXT_ALWAYS_CHAR(STRING)
PortableServer::ObjectId * string_to_ObjectId(const char *string)
int consume_arg(int number=1)
FILE * fopen(const char *filename, const char *mode)
ACE_Guard< ACE_Thread_Mutex > lock_
void set_shutdown_signal(int which_signal)
Discovery Strategy class that implements InfoRepo discovery.
CORBA::ORB_ptr orb()
Accessors for the ORB.
void usage(const ACE_TCHAR *cmd)
void operator()(int which_signal)
int is_anything_left(void) const
bool finalized_
Flag to indicate that finalization has already occurred.
virtual int handle_exception(ACE_HANDLE fd=ACE_INVALID_HANDLE)
Handler for the reactor to dispatch finalization activity to.
void finalize()
Cleanup state for shutdown.
const CHAR_TYPE * get_the_parameter(const CHAR_TYPE *flag)
int wait(const ACE_Time_Value *abstime)
TAO_DDS_DCPSFederationId & federationId()
Federation Id value.
int listen_address_given_
sequence< Policy > PolicyList
void cleanup_all_built_in_topics()
bool set_repo_ior(const char *ior, Discovery::RepoKey key=Discovery::DEFAULT_REPO, bool attach_participant=true)
const string REPOSITORY_IORTABLE_KEY
std::string listen_address_str_
void parse_args(int argc, ACE_TCHAR *argv[])
Implementation of the DCPSInfo.
int strcmp(const char *s, const char *t)
void federateIor(const tstring &ior)
Initial federation IOR value.
PortableServer::Servant_var< TAO_DDS_DCPSInfo_i > info_servant_
void localRepo(::OpenDDS::DCPS::DCPSInfo_ptr repo)
Capture a remote callable reference to the DCPSInfo.
OpenDDS::Federator::ManagerImpl federator_
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
unsigned long msec(void) const
ORB_ptr ORB_init(int &argc, char *argv[], const char *orb_name=0)
const string FEDERATOR_IORTABLE_KEY
const char * retcode_to_string(DDS::ReturnCode_t value)
static const ACE_Time_Value zero
RcHandle< T > static_rchandle_cast(const RcHandle< U > &h)
Discovery_rch get_discovery(const DDS::DomainId_t domain)
Accessor of the Discovery object for a given domain.
void finalize()
Release resources gracefully.
#define TURN_ON_VERBOSE_DEBUG
ACE_Time_Value dispatch_cleanup_delay_
int cur_arg_strncasecmp(const CHAR_TYPE *flag)
const character_type * in(void) const
virtual void shutdown()
ShutdownInterface used to schedule a shutdown.
ACE_Condition_Thread_Mutex cond_
#define TheServiceParticipant
int fprintf(FILE *fp, const char *format,...) ACE_GCC_FORMAT_ATTRIBUTE(printf
int ignore_arg(int number=1)
int add(const CHAR_TYPE *next_arg, bool quote_arg=false)
#define TheParticipantFactoryWithArgs(argc, argv)
OpenDDS::Federator::Config federatorConfig_
Repository Federation behaviors.
void finalize()
Actual finalization of service resources.