#include <tao_imr_i.h>
Collaboration diagram for TAO_IMR_i:
Public Member Functions | |
TAO_IMR_i (void) | |
~TAO_IMR_i (void) | |
int | run (void) |
Execute client code. | |
int | init (int argc, char **argv) |
Initialize the client communication endpoint with server. | |
Private Member Functions | |
void | print_usage (void) |
Print out information about all operations. | |
int | parse_args (void) |
Parses the arguments passed on the command line. | |
Private Attributes | |
int | argc_ |
# of arguments on the command line. | |
ACE_TCHAR ** | argv_ |
Arguments from command line. | |
CORBA::ORB_var | orb_ |
Remember our orb. | |
ImplementationRepository::Administration_var | imr_ |
ACE_Auto_Ptr< TAO_IMR_Op > | op_ |
What we need to do. |
This class talks to the IMR and registers/lists/etc.
Definition at line 33 of file tao_imr_i.h.
TAO_IMR_i::TAO_IMR_i | ( | void | ) |
Definition at line 16 of file tao_imr_i.cpp.
00017 : imr_ (ImplementationRepository::Administration::_nil ()) 00018 { 00019 // Nothing 00020 }
TAO_IMR_i::~TAO_IMR_i | ( | void | ) |
int TAO_IMR_i::init | ( | int | argc, | |
char ** | argv | |||
) |
Initialize the client communication endpoint with server.
Definition at line 39 of file tao_imr_i.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_ERROR, argc_, argv_, imr_, TAO_Pseudo_Var_T< T >::in(), CORBA::is_nil(), LM_ERROR, op_, orb_, and CORBA::ORB_init().
00040 { 00041 this->argc_ = argc; 00042 this->argv_ = argv; 00043 00044 const char *exception_message = "Null Message"; 00045 00046 try 00047 { 00048 // Retrieve the ORB. 00049 this->orb_ = CORBA::ORB_init (this->argc_, this->argv_, "tao_imr_i"); 00050 00051 // Parse command line and verify parameters. 00052 if (this->parse_args () == -1) 00053 return -1; 00054 00055 // Get the ImplRepo object 00056 CORBA::Object_var obj = 00057 orb_->resolve_initial_references ("ImplRepoService"); 00058 00059 if (CORBA::is_nil (obj.in ())) 00060 { 00061 ACE_ERROR ((LM_ERROR, "Unable to resolve the ImR.\n")); 00062 return -1; 00063 } 00064 00065 exception_message = "While narrowing ImR"; 00066 00067 this->imr_ = 00068 ImplementationRepository::Administration::_narrow (obj.in ()); 00069 00070 if (CORBA::is_nil (imr_.in ())) 00071 { 00072 ACE_ERROR ((LM_ERROR, "Unable to narrow the ImR.\n")); 00073 return -1; 00074 } 00075 00076 this->op_->set_imr (this->imr_.in ()); 00077 } 00078 catch (const CORBA::Exception& ex) 00079 { 00080 ACE_ERROR ((LM_ERROR, "TAO_IMR_i::init - %s\n", exception_message)); 00081 ex._tao_print_exception ("Exception"); 00082 return -1; 00083 } 00084 00085 return 0; 00086 }
int TAO_IMR_i::parse_args | ( | void | ) | [private] |
Parses the arguments passed on the command line.
Definition at line 92 of file tao_imr_i.cpp.
References ACE_ERROR, LM_ERROR, TAO_IMR_Op::make_op(), op_, print_usage(), and ACE_Auto_Basic_Ptr< X >::reset().
00093 { 00094 // Make sure one command was given 00095 if (this->argc_ < 2) 00096 { 00097 ACE_ERROR((LM_ERROR, "Error: No operation specified.\n")); 00098 this->print_usage (); 00099 return -1; 00100 } 00101 00102 this->op_.reset (TAO_IMR_Op::make_op (this->argv_[1])); 00103 00104 // Check for unrecognized operation 00105 00106 if (this->op_.get () == 0) 00107 { 00108 ACE_ERROR((LM_ERROR, "Error: Unknown operation '%s'.\n", this->argv_[1])); 00109 this->print_usage (); 00110 return -1; 00111 } 00112 00113 // Adjust argc and argv so only the command specific args are passed 00114 return this->op_->parse (this->argc_ - 1, this->argv_ + 1); 00115 }
void TAO_IMR_i::print_usage | ( | void | ) | [private] |
Print out information about all operations.
Definition at line 121 of file tao_imr_i.cpp.
References ACE_ERROR, and LM_ERROR.
Referenced by parse_args().
00122 { 00123 ACE_ERROR ((LM_ERROR, "Usage: tao_imr [options] command [command-arguments]\n" 00124 " where [options] are ORB options\n" 00125 " where command is one of the following:\n" 00126 " start Start a server through the ImR\n" 00127 " add Add an entry to the ImR\n" 00128 " autostart Activates all AUTO_START servers\n" 00129 " ior Creates a simplified IOR\n" 00130 " list List the entries in the ImR\n" 00131 " remove Remove an entry from the ImR\n" 00132 " shutdown Shut down a server through the ImR\n" 00133 " shutdown-repo Shut down the ImR\n" 00134 " update Update an entry in the ImR\n" 00135 " where [command-arguments] depend on the command\n")); 00136 }
int TAO_IMR_i::run | ( | void | ) |
Execute client code.
Definition at line 27 of file tao_imr_i.cpp.
References ACE_ERROR, LM_ERROR, op_, and TAO_IMR_Op::UNKNOWN.
00028 { 00029 if (this->op_.get () == 0) 00030 { 00031 ACE_ERROR ((LM_ERROR, "Unknown operation")); 00032 return TAO_IMR_Op::UNKNOWN; 00033 } 00034 00035 return this->op_->run (); 00036 }
int TAO_IMR_i::argc_ [private] |
# of arguments on the command line.
Definition at line 55 of file tao_imr_i.h.
Referenced by init().
ACE_TCHAR** TAO_IMR_i::argv_ [private] |
ImplementationRepository::Administration_var TAO_IMR_i::imr_ [private] |
Reference to our Locator interface of implementation repository.
Definition at line 65 of file tao_imr_i.h.
Referenced by init().
ACE_Auto_Ptr<TAO_IMR_Op> TAO_IMR_i::op_ [private] |
What we need to do.
Definition at line 68 of file tao_imr_i.h.
Referenced by init(), parse_args(), and run().
CORBA::ORB_var TAO_IMR_i::orb_ [private] |