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 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_

Detailed Description

Shutdown Operation.

Shutdown is used to shutdown a server through the IMR.

Definition at line 244 of file tao_imr_i.h.


Member Function Documentation

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

Parse arguments.

Implements TAO_IMR_Op.

Definition at line 502 of file tao_imr_i.cpp.

References ACE_ERROR, LM_ERROR, and print_usage().

00503 {
00504   // Check for enough arguments (we need at least one for the server name)
00505   if (argc < 2)
00506     {
00507       this->print_usage ();
00508       return -1;
00509     }
00510 
00511   // Skip both the program name and the "shutdown" command
00512   ACE_Get_Opt get_opts (argc, argv, "h");
00513 
00514   this->server_name_ = argv[1];
00515   int c;
00516 
00517   while ((c = get_opts ()) != -1)
00518     {
00519       switch (c)
00520       {
00521       case 'h':
00522         this->print_usage ();
00523         return -1;
00524       default:
00525         ACE_ERROR((LM_ERROR, "ERROR : Unknown option '%c'\n", (char) c));
00526         this->print_usage ();
00527         return -1;
00528       }
00529     }
00530   return 0;
00531 }

void TAO_IMR_Op_Shutdown::print_usage void   )  [protected]
 

Prints a message about the usage.

Definition at line 491 of file tao_imr_i.cpp.

References ACE_ERROR, and LM_ERROR.

Referenced by parse().

00492 {
00493   ACE_ERROR ((LM_ERROR, "Shuts down a server\n"
00494     "\n"
00495     "Usage: tao_imr [options] shutdown <name>\n"
00496     "  where [options] are ORB options\n"
00497     "  where <name> is the name of the server object\n"
00498     "  -h Displays this\n"));
00499 }

int TAO_IMR_Op_Shutdown::run void   )  [virtual]
 

Do the work.

Implements TAO_IMR_Op.

Definition at line 957 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_TRY, ACE_TRY_CHECK, LM_DEBUG, and LM_ERROR.

00958 {
00959   ACE_ASSERT (! CORBA::is_nil(imr_));
00960 
00961   ACE_DECLARE_NEW_CORBA_ENV;
00962   ACE_TRY
00963     {
00964       this->imr_->shutdown_server (this->server_name_.c_str () ACE_ENV_ARG_PARAMETER);
00965       ACE_TRY_CHECK;
00966 
00967       ACE_DEBUG ((LM_DEBUG, "Successfully shut down server <%s>\n",
00968         this->server_name_.c_str ()));
00969     }
00970   ACE_CATCH (ImplementationRepository::NotFound, ex)
00971     {
00972       ACE_ERROR ((LM_ERROR, "Server <%s> already shut down.\n", this->server_name_.c_str ()));
00973       return TAO_IMR_Op::NOT_FOUND;
00974     }
00975   ACE_CATCH(CORBA::TIMEOUT, ex)
00976     {
00977       ACE_DEBUG ((LM_DEBUG, "Timeout waiting for <%s> to shutdown.\n",
00978         this->server_name_.c_str ()));
00979     }
00980   ACE_CATCHANY
00981     {
00982       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Shutting Down Server");
00983       return TAO_IMR_Op::UNKNOWN;
00984     }
00985   ACE_ENDTRY;
00986 
00987   return TAO_IMR_Op::NORMAL;
00988 }


Member Data Documentation

ACE_CString TAO_IMR_Op_Shutdown::server_name_ [protected]
 

Definition at line 254 of file tao_imr_i.h.


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