summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-02 19:14:56 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-02 19:14:56 +0000
commitdede7aefed0ba12b66823a7d25002ed8b8ccee5e (patch)
tree382528c786b33522b5045efc1f08dbba53abe020
parent03efc4b64e7dab974a348afc9844de678f0d3514 (diff)
downloadATCD-dede7aefed0ba12b66823a7d25002ed8b8ccee5e.tar.gz
Fixed to work with new ImplRepo.idl, and also started working on the
iterator functionality.
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp292
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h57
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/tao_ir_i.cpp44
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/tao_ir_i.h3
4 files changed, 231 insertions, 165 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
index dbdc859ac86..50219ceebdc 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
@@ -16,73 +16,10 @@ ImplRepo_i::ImplRepo_i (void)
// Nothing
}
-// Starts up the server associated with the object pointer and returns
-// an updated pointer.
-
-CORBA::Object_ptr
-ImplRepo_i::activate_object (CORBA::Object_ptr obj,
- CORBA::Environment &ACE_TRY_ENV)
-{
- Implementation_Repository::INET_Addr *new_addr;
- TAO_Stub *new_stub_obj = 0;
-
- if (OPTIONS::instance()->debug () >= 1)
- ACE_DEBUG ((LM_DEBUG,
- "Activating Object: %s\n",
- this->orb_manager_.orb ()->object_to_string (obj)));
-
- ACE_TRY
- {
- // @@ Where to get the poa name from?
- new_addr = this->activate_server (0, ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- // @@ Use auto_ptr<> to avoid memory leaks!
- TAO_Stub *stub_obj = obj->_stubobj ();
- TAO_IIOP_Profile *iiop_pfile =
- ACE_dynamic_cast (TAO_IIOP_Profile *,
- stub_obj->profile_in_use ());
-
- TAO_MProfile *mp;
- ACE_NEW_THROW_EX (mp,
- TAO_MProfile (1),
- CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
- ACE_CHECK_RETURN (CORBA::Object::_nil ());
-
- TAO_Profile *new_pfile;
- // @@ Would new_addr->host_ be different from object_addr()?
- // if so I will add another ctor fred
- ACE_NEW_RETURN (new_pfile,
- TAO_IIOP_Profile (iiop_pfile->object_addr (),
- iiop_pfile->object_key ()),
- CORBA::Object::_nil ());
-
- mp->give_profile (new_pfile);
-
- // create new obj, pfile will be copied!
- new_stub_obj = new TAO_Stub (stub_obj->type_id,
- mp,
- stub_obj->orb_core ());
-
- if (new_stub_obj == 0)
- return CORBA::Object::_nil ();
- }
- ACE_CATCHANY
- {
- ACE_RETHROW;
- }
- ACE_ENDTRY;
-
- ACE_CHECK_RETURN (CORBA::Object::_nil ());
-
- return new CORBA_Object (new_stub_obj,
- obj->_servant ());
-}
-
// Starts the server defined by the POA name <server> if it is
// not already started and if it can be started.
-Implementation_Repository::INET_Addr *
+void
ImplRepo_i::activate_server (const char *server,
CORBA::Environment &ACE_TRY_ENV)
{
@@ -90,11 +27,6 @@ ImplRepo_i::activate_server (const char *server,
ACE_TString ping_ior, host;
unsigned short port;
- Implementation_Repository::INET_Addr *address =
- new Implementation_Repository::INET_Addr;
- address->port_ = 0;
- address->host_ = CORBA::string_dup ("");
-
if (OPTIONS::instance()->debug () >= 1)
ACE_DEBUG ((LM_DEBUG, "Activating Server: %s\n", server));
@@ -106,8 +38,7 @@ ImplRepo_i::activate_server (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Cannot find ping IOR for server <%s>\n",
server));
- ACE_THROW_RETURN (Implementation_Repository::Not_Found (),
- address);
+ ACE_THROW (ImplementationRepository::Administration::NotFound ());
}
// Check to see if there is one running (if there is a ping_ior)
@@ -121,8 +52,10 @@ ImplRepo_i::activate_server (const char *server,
ACE_TRY_ENV);
ACE_TRY_CHECK;
- Ping_Object_var ping_object = Ping_Object::_narrow (object.in (),
- ACE_TRY_ENV);
+ // We shouldn't have to narrow.
+
+ ImplementationRepository::ServerObject_var ping_object =
+ ImplementationRepository::ServerObject::_narrow (object.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
if (CORBA::is_nil (ping_object.in ()))
@@ -130,8 +63,7 @@ ImplRepo_i::activate_server (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Invalid Ping Object ior: <%s>\n",
ping_ior));
- ACE_THROW_RETURN (Implementation_Repository::Not_Found (),
- address);
+ ACE_THROW (ImplementationRepository::Administration::NotFound ());
}
// Check to see if we can ping it
@@ -160,8 +92,7 @@ ImplRepo_i::activate_server (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Cannot find startup info for server <%s>\n",
server));
- ACE_THROW_RETURN (Implementation_Repository::Not_Found (),
- address);
+ ACE_THROW(ImplementationRepository::Administration::NotFound ());
}
if (startup_val == 0)
@@ -172,8 +103,7 @@ ImplRepo_i::activate_server (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Cannot find startup info for server <%s>\n",
server));
- ACE_THROW_RETURN (Implementation_Repository::Not_Found (),
- address);
+ ACE_THROW(ImplementationRepository::Administration::NotFound ());
}
if (startup.length () == 0)
@@ -182,7 +112,7 @@ ImplRepo_i::activate_server (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: No startup information for server <%s>\n",
server));
- ACE_THROW_RETURN (CORBA::TRANSIENT (CORBA::COMPLETED_NO), address);
+ ACE_THROW (CORBA::TRANSIENT (CORBA::COMPLETED_NO));
}
@@ -202,8 +132,7 @@ ImplRepo_i::activate_server (const char *server,
"Error: Cannot activate server <%s> using <%s>\n",
server,
startup.c_str ()));
- ACE_THROW_RETURN (Implementation_Repository::Cannot_Activate (CORBA::string_dup ("N/A")),
- address);
+ ACE_THROW (ImplementationRepository::Administration::CannotActivate (CORBA::string_dup ("N/A")));
}
}
@@ -228,8 +157,7 @@ ImplRepo_i::activate_server (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Cannot find startup info for server <%s>\n",
server));
- ACE_THROW_RETURN (Implementation_Repository::Not_Found (),
- address);
+ ACE_THROW (ImplementationRepository::Administration::NotFound ());
}
// Now it should be started.
@@ -241,20 +169,14 @@ ImplRepo_i::activate_server (const char *server,
"ImplRepo_i::activate_server: "
"cannot resolve server <%s>\n",
server));
- return address;
}
-
- address->host_ = CORBA::string_dup (host.c_str ());
- address->port_ = port;
-
- return address;
}
// Adds an entry to the Repository about this <server>
void
ImplRepo_i::register_server (const char *server,
- const Implementation_Repository::Process_Options &options,
+ const ImplementationRepository::StartupOptions &options,
CORBA::Environment &ACE_TRY_ENV)
{
if (OPTIONS::instance()->debug () >= 2)
@@ -262,21 +184,21 @@ ImplRepo_i::register_server (const char *server,
"Command Line: %s\n"
"Working Directory: %s\n\n",
server,
- options.command_line_.in (),
- options.working_directory_.in ()));
+ options.command_line.in (),
+ options.working_directory.in ()));
// Add the server
int status = this->repository_.add (server,
"",
- options.command_line_.in (),
- options.working_directory_.in ());
+ options.command_line.in (),
+ options.working_directory.in ());
if (status == 1)
{
ACE_ERROR ((LM_ERROR,
"Error: Server %s Already Registered!\n",
server));
- ACE_THROW (Implementation_Repository::Already_Registered ());
+ ACE_THROW (ImplementationRepository::Administration::AlreadyRegistered ());
}
else
{
@@ -289,8 +211,8 @@ ImplRepo_i::register_server (const char *server,
"Command Line: %s\n"
"Working Directory: %s\n\n",
server,
- options.command_line_.in (),
- options.working_directory_.in ()));
+ options.command_line.in (),
+ options.working_directory.in ()));
}
}
@@ -299,7 +221,7 @@ ImplRepo_i::register_server (const char *server,
void
ImplRepo_i::reregister_server (const char *server,
- const Implementation_Repository::Process_Options &options,
+ const ImplementationRepository::StartupOptions &options,
CORBA::Environment &ACE_TRY_ENV)
{
ACE_UNUSED_ARG (ACE_TRY_ENV);
@@ -308,8 +230,8 @@ ImplRepo_i::reregister_server (const char *server,
this->repository_.add (server,
"",
- options.command_line_.in (),
- options.working_directory_.in ());
+ options.command_line.in (),
+ options.working_directory.in ());
if (OPTIONS::instance()->debug () >= 1)
ACE_DEBUG ((LM_DEBUG,
@@ -320,8 +242,8 @@ ImplRepo_i::reregister_server (const char *server,
"Command Line: %s\n"
"Working Directory: %s\n\n",
server,
- options.command_line_.in (),
- options.working_directory_.in ()));
+ options.command_line.in (),
+ options.working_directory.in ()));
}
// Remove the server entry from the Repository
@@ -341,20 +263,20 @@ ImplRepo_i::remove_server (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Trying to remove unknown server <%s>\n",
server));
- ACE_THROW (Implementation_Repository::Not_Found ());
+ ACE_THROW (ImplementationRepository::Administration::NotFound ());
}
}
// Register the current location of the server
-Implementation_Repository::INET_Addr *
-ImplRepo_i::server_is_running (const char *server,
- const Implementation_Repository::INET_Addr &addr,
- CORBA::Object_ptr ping,
+ImplementationRepository::Address *
+ImplRepo_i::server_is_running (const char * server,
+ const ImplementationRepository::Address &addr,
+ ImplementationRepository::ServerObject_ptr server_object,
CORBA::Environment &ACE_TRY_ENV)
{
- Implementation_Repository::INET_Addr *new_addr =
- new Implementation_Repository::INET_Addr;
+ ImplementationRepository::Address *new_addr =
+ new ImplementationRepository::Address;
if (OPTIONS::instance()->debug () >= 1)
ACE_DEBUG ((LM_DEBUG,
@@ -364,10 +286,10 @@ ImplRepo_i::server_is_running (const char *server,
// Update the record in the repository
// Get the stringified ping_ior
- ASYS_TCHAR *ping_ior = this->orb_manager_.orb ()->object_to_string (ping, ACE_TRY_ENV);
+ ASYS_TCHAR *ping_ior = this->orb_manager_.orb ()->object_to_string (server_object, ACE_TRY_ENV);
ACE_CHECK_RETURN (0);
- if (this->repository_.update (server, addr.host_.in (), addr.port_, ping_ior) == 0)
+ if (this->repository_.update (server, addr.host.in (), addr.port, ping_ior) == 0)
{
if (OPTIONS::instance()->debug () >= 1)
ACE_DEBUG ((LM_DEBUG,
@@ -379,19 +301,19 @@ ImplRepo_i::server_is_running (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Could not update running information for server <%s>\n",
server));
- ACE_THROW_RETURN (Implementation_Repository::Not_Found (), new_addr);
+ ACE_THROW_RETURN (ImplementationRepository::Administration::NotFound (), new_addr);
}
ACE_INET_Addr my_addr = TAO_ORB_Core_instance ()->orb_params ()->addr ();
- new_addr->host_ = CORBA::string_dup (my_addr.get_host_name ());
- new_addr->port_ = my_addr.get_port_number ();
+ new_addr->host = CORBA::string_dup (my_addr.get_host_name ());
+ new_addr->port = my_addr.get_port_number ();
if (OPTIONS::instance()->debug () >= 2)
ACE_DEBUG ((LM_DEBUG,
"The new host/port is: %Lu:%hu\n",
- new_addr->host_.inout (),
- new_addr->port_));
+ new_addr->host.in (),
+ new_addr->port));
this->repository_.starting_up (server, 0);
@@ -416,7 +338,7 @@ ImplRepo_i::server_is_shutting_down (const char *server,
ACE_ERROR ((LM_ERROR,
"Error: Could not update information for unknown server <%s>\n",
server));
- ACE_THROW (Implementation_Repository::Not_Found ());
+ ACE_THROW (ImplementationRepository::Administration::NotFound ());
}
}
@@ -547,6 +469,125 @@ ImplRepo_i::~ImplRepo_i (void)
delete this->activator_;
}
+
+// Used to access the list of servers registered. May also return an
+// iterator which can be used to access more than <how_many> of them.
+
+void
+ImplRepo_i::list (CORBA::ULong how_many,
+ ImplementationRepository::ServerInformationList_out server_list,
+ ImplementationRepository::ServerInformationIterator_out server_iterator,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ // Initialize the out varaibles, so if we return early, they will
+ // not be dangling.
+ server_iterator =
+ ImplementationRepository::ServerInformationIterator::_nil ();
+
+ ACE_NEW_THROW_EX (server_list,
+ ImplementationRepository::ServerInformationList (0),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ // Dynamically allocate the iterator.
+
+ Server_Repository::HASH_IR_ITER *hash_iter = 0;
+
+ ACE_NEW_THROW_EX (hash_iter,
+ Server_Repository::HASH_IR_ITER (this->repository_),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+
+
+ // Number of bindings that will go into the BindingList.
+ CORBA::ULong n;
+
+ // A pointer to BindingIterator servant.
+ TAO_Hash_Binding_Iterator *bind_iter = 0;
+
+ // Calculate number of bindings that will go into bl.
+ if (this->context_.current_size () > how_many)
+ n = how_many;
+ else
+ n = this->context_.current_size ();
+
+ // Use hash iterator to populate a BindingList with bindings.
+ bl->length (n);
+
+ Server_Repository::HASH_IR_ENTRY *hash_entry;
+
+ for (CORBA::ULong i = 0; i < n; i++)
+ {
+ hash_iter->next (hash_entry);
+ hash_iter->advance ();
+
+ if (populate_binding (hash_entry, bl[i]) == 0)
+ {
+ delete hash_iter;
+ ACE_THROW (CORBA::NO_MEMORY(CORBA::COMPLETED_NO));
+ }
+ }
+
+ // Now we are done with the BindingsList, and we can follow up on
+ // the iterator business.
+
+ // If we do not need to pass back BindingIterator.
+ if (this->context_.current_size () <= how_many)
+ delete hash_iter;
+ else
+ {
+ // Create a BindingIterator for return.
+
+ bind_iter = new TAO_Hash_Binding_Iterator (hash_iter, this->poa_.in (), this->lock_);
+ if (bind_iter == 0)
+ {
+ delete hash_iter;
+ ACE_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ }
+
+ ACE_TRY
+ {
+ char poa_id[BUFSIZ];
+ ACE_OS::sprintf (poa_id,
+ "%s_%ld",
+ this->poa_id_.c_str (),
+ this->counter_++);
+
+ PortableServer::ObjectId_var id =
+ PortableServer::string_to_ObjectId (poa_id);
+
+ this->poa_->activate_object_with_id (id.in (),
+ bind_iter,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ bi = bind_iter->_this (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ delete bind_iter;
+ ACE_RETHROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+}
+
+
+// Attempts to gracefully shut down the server, if that fails, will try
+// to do it ungracefully.
+
+void
+ImplRepo_i::shutdown_server (const char *server,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ // @@ Nothing yet
+}
+
+
IR_Adapter_Activator::IR_Adapter_Activator (IR_Forwarder *servant)
: servant_ (servant)
{
@@ -676,12 +717,10 @@ IR_Forwarder::invoke (CORBA::ServerRequest_ptr /* request */,
// Now FORWARD!!!
- Implementation_Repository::INET_Addr *new_addr = 0;
-
ACE_TRY
{
- new_addr = this->ir_impl_->activate_server (poa->the_name (),
- ACE_TRY_ENV);
+ this->ir_impl_->activate_server (poa->the_name (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
}
ACE_CATCHANY
@@ -702,13 +741,8 @@ IR_Forwarder::invoke (CORBA::ServerRequest_ptr /* request */,
ACE_dynamic_cast (TAO_IIOP_Profile *,
stub_obj->profile_in_use ());
- iiop_pfile->port (new_addr->port_);
- iiop_pfile->host (new_addr->host_);
-
-// if (TAO_debug_level > 0)
-// ACE_DEBUG ((LM_DEBUG,
-// "The forward_to is <%s>\n",
-// this->orb_var_->object_to_string (forward_object, ACE_TRY_ENV)));
+ iiop_pfile->port (this->ir_impl_->get_forward_port (poa->the_name ()));
+ iiop_pfile->host (this->ir_impl_->get_forward_host (poa->the_name ()));
if (!CORBA::is_nil (forward_object))
ACE_TRY_ENV.exception (new PortableServer::ForwardRequest (forward_object));
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h
index cd67c630e7f..53857843dce 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h
+++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h
@@ -57,7 +57,7 @@ private:
// The object to use as the default servant.
};
-class ImplRepo_i : public POA_Implementation_Repository
+class ImplRepo_i : public POA_ImplementationRepository::Administration
{
// = TITLE
// Implementation Repository
@@ -72,52 +72,53 @@ public:
// = Interface methods
- virtual CORBA::Object_ptr activate_object (CORBA::Object_ptr obj,
- CORBA_Environment &ACE_TRY_ENV
- = CORBA_Environment::default_environment ());
- // Starts up the server containing the object <obj> if not already running.
-
- virtual Implementation_Repository::INET_Addr *activate_server (const char *server,
- CORBA::Environment &env);
+ virtual void activate_server (const char * server,
+ CORBA::Environment &ACE_TRY_ENV = CORBA::Environment::default_environment ());
// Starts up the server <server> if not already running.
virtual void register_server (const char *server,
- const Implementation_Repository::Process_Options &options,
- CORBA_Environment &ACE_TRY_ENV
- = CORBA_Environment::default_environment ());
+ const ImplementationRepository::StartupOptions &options,
+ CORBA_Environment &ACE_TRY_ENV = CORBA_Environment::default_environment ());
// Adds the server to the repository and registers the startup information about
// the server <server>.
virtual void reregister_server (const char *server,
- const Implementation_Repository::Process_Options &options,
- CORBA_Environment &ACE_TRY_ENV
- = CORBA_Environment::default_environment ());
+ const ImplementationRepository::StartupOptions &options,
+ CORBA_Environment &ACE_TRY_ENV = CORBA_Environment::default_environment ());
// Updates the startup information about the server <server>.
virtual void remove_server (const char *server,
- CORBA_Environment &ACE_TRY_ENV
- = CORBA_Environment::default_environment ());
+ CORBA_Environment &ACE_TRY_ENV = CORBA_Environment::default_environment ());
// Removes the server <server> from the repository.
- virtual Implementation_Repository::INET_Addr
- *server_is_running (const char *server,
- const Implementation_Repository::INET_Addr &addr,
- CORBA::Object_ptr ping,
- CORBA_Environment &ACE_TRY_ENV
- = CORBA_Environment::default_environment ());
+ virtual void shutdown_server (const char * server,
+ CORBA::Environment &ACE_TRY_ENV = CORBA::Environment::default_environment ());
+ // Attempts to gracefully shut down the server, if that fails, will try
+ // to do it ungracefully.
+
+ virtual ImplementationRepository::Address *
+ server_is_running (const char * server,
+ const ImplementationRepository::Address &addr,
+ ImplementationRepository::ServerObject_ptr server_object,
+ CORBA::Environment &ACE_TRY_ENV = CORBA::Environment::default_environment ());
// Called by the server to update transient information such as current location of
// the <server> and its ping object.
virtual void server_is_shutting_down (const char * server,
- CORBA_Environment &ACE_TRY_ENV
- = CORBA_Environment::default_environment ());
- // What the server should call before it shutsdown.
+ CORBA_Environment &ACE_TRY_ENV = CORBA_Environment::default_environment ());
+ // What the server should call before it shuts down.
+
+ virtual void list (CORBA::ULong how_many,
+ ImplementationRepository::ServerInformationList_out server_list,
+ ImplementationRepository::ServerInformationIterator_out server_iterator,
+ CORBA::Environment &ACE_TRY_ENV = CORBA::Environment::default_environment ());
+ // Used to access the list of servers registered. May also return an
+ // iterator which can be used to access more than <how_many> of them.
// = Other methods
int init (int argc, char **argv,
- CORBA_Environment &ACE_TRY_ENV
- = CORBA_Environment::default_environment ());
+ CORBA_Environment &ACE_TRY_ENV = CORBA_Environment::default_environment ());
// Initialize the Server state - parsing arguments and waiting.
int run (CORBA_Environment &ACE_TRY_ENV = CORBA_Environment::default_environment ());
@@ -171,7 +172,7 @@ public:
CORBA::RepositoryId _primary_interface (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr poa,
- CORBA::Environment &env);
+ CORBA::Environment &env = CORBA_Environment::default_environment ());
// DynamicImplementation stuff
private:
diff --git a/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.cpp b/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.cpp
index 26de6f13104..335d6f005d8 100644
--- a/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.cpp
@@ -1,10 +1,10 @@
// $Id$
-#include "TAO_IR_i.h"
+#include "tao_ir_i.h"
#include "ace/Get_Opt.h"
#include "ace/Read_Buffer.h"
-ACE_RCSID(ImplRepo_Service, TAO_IR_i, "$Id")
+ACE_RCSID(ImplRepo_Service, tao_ir_i, "$Id")
// Constructor
@@ -70,14 +70,19 @@ TAO_IR_i::parse_args (void)
return -1;
}
+ // Figure out which command we are doing
+
if (ACE_OS::strcasecmp (this->argv_[1], ASYS_TEXT ("add")) == 0)
{
+ // Check for enough arguments (we need 3 for program name, "add",
+ // and the server name to add)
if (this->argc_ < 3)
{
this->print_usage (ADD);
return -1;
}
+ // Parse the rest of the arguments
return this->parse_add_args ();
}
else if (ACE_OS::strcasecmp (this->argv_[1], ASYS_TEXT ("remove")) == 0)
@@ -98,12 +103,8 @@ TAO_IR_i::parse_args (void)
}
else if (ACE_OS::strcasecmp (this->argv_[1], ASYS_TEXT ("list")) == 0)
{
- if (this->argc_ > 2)
- {
- ACE_ERROR ((LM_ERROR, "Unrecognized options\n"));
- this->print_usage (LIST);
- return -1;
- }
+ this->parse_list_args ();
+
}
// Indicates successful parsing of command line.
@@ -112,6 +113,7 @@ TAO_IR_i::parse_args (void)
// Look at the arguments assuming that it is an add command.
+
int
TAO_IR_i::parse_add_args ()
{
@@ -141,6 +143,32 @@ TAO_IR_i::parse_add_args ()
return 0;
}
+// Look at the arguments assuming that it is an list command.
+
+int
+TAO_IR_i::parse_list_args ()
+{
+ // Skip both the program name and the "list" command
+ // We specify 0 as the 4th argument so it will look at the first
+ // argv.
+ ACE_Get_Opt get_opts (this->argc_ - 2, this->argv_ + 2, "h", 0);
+
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'h': // display help
+ default:
+ this->print_usage (LIST);
+ return -1;
+ }
+
+ // Success
+ return 0;
+}
+
+
// Print out information about an operation.
void
diff --git a/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.h b/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.h
index eb90ca5e06a..d45e47af58b 100644
--- a/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.h
+++ b/TAO/orbsvcs/ImplRepo_Service/tao_ir_i.h
@@ -56,6 +56,9 @@ private:
int parse_add_args (void);
// Parses arguments specific to the ADD command.
+ int parse_list_args (void);
+ // Parses arguments specific to the LIST command.
+
int argc_;
// # of arguments on the command line.