#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.
|
Definition at line 16 of file tao_imr_i.cpp.
00017 : imr_ (ImplementationRepository::Administration::_nil ()) 00018 { 00019 // Nothing 00020 } |
|
Definition at line 22 of file tao_imr_i.cpp.
00023 { 00024 } |
|
Initialize the client communication endpoint with server.
Definition at line 39 of file tao_imr_i.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ERROR, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, CORBA::is_nil(), LM_ERROR, op_, CORBA::ORB_init(), and parse_args().
00040 { 00041 this->argc_ = argc; 00042 this->argv_ = argv; 00043 00044 const char *exception_message = "Null Message"; 00045 00046 ACE_DECLARE_NEW_CORBA_ENV; 00047 ACE_TRY 00048 { 00049 // Retrieve the ORB. 00050 this->orb_ = CORBA::ORB_init (this->argc_, this->argv_, "tao_imr_i" ACE_ENV_ARG_PARAMETER); 00051 ACE_TRY_CHECK; 00052 00053 // Parse command line and verify parameters. 00054 if (this->parse_args () == -1) 00055 return -1; 00056 00057 // Get the ImplRepo object 00058 CORBA::Object_var obj = 00059 orb_->resolve_initial_references ("ImplRepoService" ACE_ENV_ARG_PARAMETER); 00060 ACE_TRY_CHECK; 00061 00062 if (CORBA::is_nil (obj.in ())) 00063 { 00064 ACE_ERROR ((LM_ERROR, "Unable to resolve the ImR.\n")); 00065 return -1; 00066 } 00067 00068 exception_message = "While narrowing ImR"; 00069 00070 this->imr_ = 00071 ImplementationRepository::Administration::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); 00072 ACE_TRY_CHECK; 00073 00074 if (CORBA::is_nil (imr_.in ())) 00075 { 00076 ACE_ERROR ((LM_ERROR, "Unable to narrow the ImR.\n")); 00077 return -1; 00078 } 00079 00080 this->op_->set_imr (this->imr_.in ()); 00081 } 00082 ACE_CATCHANY 00083 { 00084 ACE_ERROR ((LM_ERROR, "TAO_IMR_i::init - %s\n", exception_message)); 00085 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception"); 00086 return -1; 00087 } 00088 ACE_ENDTRY; 00089 00090 return 0; 00091 } |
|
Parses the arguments passed on the command line.
Definition at line 97 of file tao_imr_i.cpp. References ACE_ERROR, ACE_Auto_Basic_Ptr< X >::get(), LM_ERROR, op_, print_usage(), and ACE_Auto_Basic_Ptr< X >::reset(). Referenced by init().
00098 { 00099 // Make sure one command was given 00100 if (this->argc_ < 2) 00101 { 00102 ACE_ERROR((LM_ERROR, "Error: No operation specified.\n")); 00103 this->print_usage (); 00104 return -1; 00105 } 00106 00107 this->op_.reset (TAO_IMR_Op::make_op (this->argv_[1])); 00108 00109 // Check for unrecognized operation 00110 00111 if (this->op_.get () == 0) 00112 { 00113 ACE_ERROR((LM_ERROR, "Error: Unknown operation '%s'.\n", this->argv_[1])); 00114 this->print_usage (); 00115 return -1; 00116 } 00117 00118 // Adjust argc and argv so only the command specific args are passed 00119 return this->op_->parse (this->argc_ - 1, this->argv_ + 1); 00120 } |
|
Print out information about all operations.
Definition at line 126 of file tao_imr_i.cpp. References ACE_ERROR, and LM_ERROR. Referenced by parse_args().
00127 { 00128 ACE_ERROR ((LM_ERROR, "Usage: tao_imr [options] command [command-arguments]\n" 00129 " where [options] are ORB options\n" 00130 " where command is one of the following:\n" 00131 " start Start a server through the ImR\n" 00132 " add Add an entry to the ImR\n" 00133 " autostart Activates all AUTO_START servers\n" 00134 " ior Creates a simplified IOR\n" 00135 " list List the entries in the ImR\n" 00136 " remove Remove an entry from the ImR\n" 00137 " shutdown Shut down a server through the ImR\n" 00138 " shutdown-repo Shut down the ImR\n" 00139 " update Update an entry in the ImR\n" 00140 " where [command-arguments] depend on the command\n")); 00141 } |
|
Execute client code.
Definition at line 27 of file tao_imr_i.cpp. References ACE_ERROR, ACE_Auto_Basic_Ptr< X >::get(), LM_ERROR, and op_.
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 } |
|
# of arguments on the command line.
Definition at line 55 of file tao_imr_i.h. |
|
Arguments from command line.
Definition at line 58 of file tao_imr_i.h. |
|
Reference to our Locator interface of implementation repository. Definition at line 65 of file tao_imr_i.h. |
|
What we need to do.
Definition at line 68 of file tao_imr_i.h. Referenced by init(), parse_args(), and run(). |
|
Remember our orb.
Definition at line 61 of file tao_imr_i.h. |