Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

TAO_IMR_Op_Shutdown Class Reference

Shutdown Operation. More...

#include <tao_imr_i.h>

Inheritance diagram for TAO_IMR_Op_Shutdown:

Inheritance graph
[legend]
Collaboration diagram for TAO_IMR_Op_Shutdown:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_IMR_Op_Shutdown (void)
 ~TAO_IMR_Op_Shutdown (void)
virtual int parse (int argc, ACE_TCHAR **argv)
 Parse arguments. More...

virtual int run (void)
 Do the work. More...


Protected Methods

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


Protected Attributes

ACE_CString server_name_
 POA server name. More...

ACE_CString location_

Detailed Description

Shutdown Operation.

Shutdown is used to shutdown a server through the IMR.

Definition at line 300 of file tao_imr_i.h.


Constructor & Destructor Documentation

TAO_IMR_Op_Shutdown::TAO_IMR_Op_Shutdown void   
 

Definition at line 236 of file tao_imr_i.cpp.

00237   : location_ ("")
00238 {
00239   // Nothing
00240 }

TAO_IMR_Op_Shutdown::~TAO_IMR_Op_Shutdown void   
 

Definition at line 290 of file tao_imr_i.cpp.

00291 {
00292   // Nothing
00293 }


Member Function Documentation

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

Parse arguments.

Implements TAO_IMR_Op.

Definition at line 527 of file tao_imr_i.cpp.

References ACE_TCHAR, location_, ACE_Get_Opt::optarg, print_usage, and server_name_.

00528 {
00529   // Check for enough arguments (we need at least one for the server name)
00530   if (argc < 1)
00531     {
00532       this->print_usage ();
00533       return -1;
00534     }
00535 
00536   // Skip both the program name and the "shutdown" command
00537   ACE_Get_Opt get_opts (argc, argv, "l:h");
00538 
00539   this->server_name_ = argv[0];
00540   int c;
00541 
00542   while ((c = get_opts ()) != -1)
00543     switch (c)
00544       {
00545       case 'l':
00546         this->location_ = get_opts.optarg;
00547         break;
00548       case 'h':  // display help
00549       default:
00550         this->print_usage ();
00551         return -1;
00552       }
00553 
00554   // Success
00555   return 0;
00556 }

void TAO_IMR_Op_Shutdown::print_usage void    [protected]
 

Prints a message about the usage.

Definition at line 1189 of file tao_imr_i.cpp.

References ACE_ERROR, and LM_ERROR.

Referenced by parse.

01190 {
01191   ACE_ERROR ((LM_ERROR, "Shuts down a server\n"
01192                         "\n"
01193                         "Usage: tao_imr [options] shutdown <name> [command-arguments]\n"
01194                         "  where [options] are ORB options\n"
01195                         "  where <name> is the POA name used by the server object\n"
01196                         "  where [command-arguments] can be\n"
01197                         "    -h            Displays this\n"));
01198 }

int TAO_IMR_Op_Shutdown::run void    [virtual]
 

Do the work.

Implements TAO_IMR_Op.

Definition at line 1009 of file tao_imr_i.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_DEBUG, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ERROR, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, TAO_IMR_Op::imr_locator_, LM_DEBUG, LM_ERROR, location_, NORMAL, NOT_FOUND, ACE_OS_String::strcmp, and UNKNOWN.

01010 {
01011   ACE_DECLARE_NEW_CORBA_ENV;
01012   ACE_TRY
01013     {
01014       if (ACE_OS::strcmp (this->location_.c_str (), "") == 0)
01015         {
01016           this->imr_locator_->shutdown_server (this->server_name_.c_str ()
01017                                                ACE_ENV_ARG_PARAMETER);
01018           ACE_TRY_CHECK;
01019         }
01020       else
01021         {
01022           this->imr_locator_->shutdown_server_in_location (
01023                 this->server_name_.c_str (),
01024                 this->location_.c_str ()
01025                 ACE_ENV_ARG_PARAMETER);
01026           ACE_TRY_CHECK;
01027         }
01028 
01029       ACE_DEBUG ((LM_DEBUG,
01030                   "Successfully shut down server <%s>\n",
01031                   this->server_name_.c_str ()));
01032     }
01033   ACE_CATCH (ImplementationRepository::NotFound, ex)
01034     {
01035       ACE_ERROR ((LM_ERROR, "Could not find server <%s>!\n", this->server_name_.c_str ()));
01036       return NOT_FOUND;
01037     }
01038   ACE_CATCHANY
01039     {
01040       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Shutting Down Server");
01041       return UNKNOWN;
01042     }
01043   ACE_ENDTRY;
01044 
01045   // Success
01046   return NORMAL;
01047 }


Member Data Documentation

ACE_CString TAO_IMR_Op_Shutdown::location_ [protected]
 

Definition at line 316 of file tao_imr_i.h.

Referenced by parse, and run.

ACE_CString TAO_IMR_Op_Shutdown::server_name_ [protected]
 

POA server name.

Definition at line 314 of file tao_imr_i.h.

Referenced by parse.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 20:04:36 2003 for TAO_Implementation_Repository by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002