TAO_IMR_Op_Activate Class Reference

Activation Operation. More...

#include <tao_imr_i.h>

Inheritance diagram for TAO_IMR_Op_Activate:

Inheritance graph
[legend]
Collaboration diagram for TAO_IMR_Op_Activate:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual int parse (int argc, ACE_TCHAR **argv)
 Parse arguments.

virtual int run (void)
 Do the work.


Protected Member Functions

void print_usage (void)
 Prints a message about the usage.


Protected Attributes

ACE_CString server_name_
 POA server name.


Detailed Description

Activation Operation.

Activation is used to start servers via the Implementation Repository

Definition at line 124 of file tao_imr_i.h.


Member Function Documentation

int TAO_IMR_Op_Activate::parse int  argc,
ACE_TCHAR **  argv
[virtual]
 

Parse arguments.

Implements TAO_IMR_Op.

Definition at line 278 of file tao_imr_i.cpp.

References ACE_ERROR, LM_ERROR, and print_usage().

00279 {
00280   // Check for enough arguments (we need at least one for the server name)
00281   if (argc < 2)
00282     {
00283       this->print_usage ();
00284       return -1;
00285     }
00286 
00287   // Skip both the program name and the "activate" command
00288   ACE_Get_Opt get_opts (argc, argv, "h");
00289 
00290   this->server_name_ = argv[1];
00291   int c;
00292 
00293   while ((c = get_opts ()) != -1)
00294     {
00295       switch (c)
00296       {
00297       case 'h':
00298         this->print_usage ();
00299         return -1;
00300       default:
00301         ACE_ERROR((LM_ERROR, "ERROR : Unknown option '%c'\n", (char) c));
00302         this->print_usage ();
00303         return -1;
00304       }
00305     }
00306   return 0;
00307 }

void TAO_IMR_Op_Activate::print_usage void   )  [protected]
 

Prints a message about the usage.

Definition at line 267 of file tao_imr_i.cpp.

References ACE_ERROR, and LM_ERROR.

Referenced by parse().

00268 {
00269   ACE_ERROR ((LM_ERROR, "Starts a server using its registered Activator.\n"
00270     "\n"
00271     "Usage: tao_imr [options] start <name>\n"
00272     "  where [options] are ORB options\n"
00273     "  where <name> is the name of a registered POA.\n"
00274     "  -h Displays this\n"));
00275 }

int TAO_IMR_Op_Activate::run void   )  [virtual]
 

Do the work.

Implements TAO_IMR_Op.

Definition at line 698 of file tao_imr_i.cpp.

References ACE_ANY_EXCEPTION, ACE_ASSERT, ACE_CATCH, ACE_CATCHANY, ACE_DEBUG, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ERROR, ACE_PRINT_EXCEPTION, ACE_RE_THROW, ACE_TRY, ACE_TRY_CHECK, LM_DEBUG, and LM_ERROR.

00699 {
00700   ACE_ASSERT(! CORBA::is_nil(imr_));
00701   ACE_DECLARE_NEW_CORBA_ENV;
00702   ACE_TRY
00703     {
00704       this->imr_->activate_server (this->server_name_.c_str () ACE_ENV_ARG_PARAMETER);
00705       ACE_TRY_CHECK;
00706       ACE_DEBUG ((LM_DEBUG,
00707         "Successfully Activated server <%s>\n",
00708         this->server_name_.c_str ()));
00709     }
00710   ACE_CATCH (ImplementationRepository::CannotActivate, ex)
00711     {
00712       ACE_ERROR ((LM_ERROR, "Cannot activate server <%s>, reason: <%s>\n",
00713         this->server_name_.c_str (),
00714         ex.reason.in ()));
00715       return TAO_IMR_Op::CANNOT_ACTIVATE;
00716     }
00717   ACE_CATCH (ImplementationRepository::NotFound, ex)
00718     {
00719       ACE_ERROR ((LM_ERROR, "Could not find server <%s>.\n", this->server_name_.c_str ()));
00720       return TAO_IMR_Op::NOT_FOUND;
00721     }
00722   ACE_CATCH (PortableServer::ForwardRequest, ex)
00723     {
00724       ACE_RE_THROW;
00725     }
00726   ACE_CATCHANY
00727     {
00728       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Activating Server");
00729       return TAO_IMR_Op::UNKNOWN;
00730     }
00731   ACE_ENDTRY;
00732 
00733   return TAO_IMR_Op::NORMAL;
00734 }


Member Data Documentation

ACE_CString TAO_IMR_Op_Activate::server_name_ [protected]
 

POA server name.

Definition at line 135 of file tao_imr_i.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:37:27 2006 for TAO_Implementation_Repository by doxygen 1.3.6