summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-01-29 19:39:43 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-01-29 19:39:43 +0000
commit2e19aac7c99969ed4dc344ef56b186a4b1027d0a (patch)
tree76e08e8ce53e211d1a184607ea55017971d0fb02
parent6ce0e89381a42f46e2e1258ff796d757b1058bcd (diff)
downloadATCD-2e19aac7c99969ed4dc344ef56b186a4b1027d0a.tar.gz
*** empty log message ***
-rw-r--r--TAO/tests/POA/Default_Servant/File_i.cpp56
-rw-r--r--TAO/tests/POA/Default_Servant/server.cpp25
-rw-r--r--TAO/tests/POA/On_Demand_Activation/Servant_Activator.cpp18
-rw-r--r--TAO/tests/POA/On_Demand_Activation/Servant_Activator.h14
-rw-r--r--TAO/tests/POA/On_Demand_Activation/Servant_Locator.cpp18
-rw-r--r--TAO/tests/POA/On_Demand_Activation/Servant_Locator.h21
-rw-r--r--TAO/tests/POA/On_Demand_Activation/server.cpp107
-rw-r--r--TAO/tests/POA/RootPOA/RootPOA.cpp22
8 files changed, 169 insertions, 112 deletions
diff --git a/TAO/tests/POA/Default_Servant/File_i.cpp b/TAO/tests/POA/Default_Servant/File_i.cpp
index b291006c63b..6414ac87d27 100644
--- a/TAO/tests/POA/Default_Servant/File_i.cpp
+++ b/TAO/tests/POA/Default_Servant/File_i.cpp
@@ -24,7 +24,9 @@ FileImpl::System::open (const char *file_name,
CORBA::Long flags,
CORBA::Environment &env)
{
- ACE_HANDLE file_descriptor = ACE_OS::open (file_name, flags);
+ ACE_HANDLE file_descriptor = ACE_OS::open (file_name,
+ flags);
+
if (file_descriptor == ACE_INVALID_HANDLE)
{
CORBA::Exception *exception = new File::IOError (errno);
@@ -33,16 +35,23 @@ FileImpl::System::open (const char *file_name,
}
char file_descriptor_buffer[BUFSIZ];
- ACE_OS::sprintf (file_descriptor_buffer, "%ld", (CORBA::Long) file_descriptor);
+ ACE_OS::sprintf (file_descriptor_buffer,
+ "%ld",
+ (CORBA::Long) file_descriptor);
+
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId (file_descriptor_buffer);
- PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId (file_descriptor_buffer);
- CORBA::Object_var obj = this->poa_->create_reference_with_id (oid.in (),
- this->_interface_repository_id (),
- env);
+ CORBA::Object_var obj =
+ this->poa_->create_reference_with_id (oid.in (),
+ this->_interface_repository_id (),
+ env);
if (env.exception () != 0)
return File::Descriptor::_nil ();
- File::Descriptor_var fd = File::Descriptor::_narrow (obj.in (), env);
+ File::Descriptor_var fd =
+ File::Descriptor::_narrow (obj.in (), env);
+
if (env.exception () != 0)
return File::Descriptor::_nil ();
@@ -68,14 +77,19 @@ ACE_HANDLE
FileImpl::Descriptor::fd (CORBA::Environment &env)
{
File::Descriptor_var me = this->_this (env);
+
if (env.exception () != 0)
return ACE_INVALID_HANDLE;
- PortableServer::ObjectId_var oid = this->poa_->reference_to_id (me.in (), env);
+ PortableServer::ObjectId_var oid =
+ this->poa_->reference_to_id (me.in (), env);
+
if (env.exception () != 0)
return ACE_INVALID_HANDLE;
- CORBA::String_var s = PortableServer::ObjectId_to_string (oid.in ());
+ CORBA::String_var s =
+ PortableServer::ObjectId_to_string (oid.in ());
+
return (ACE_HANDLE) ::atol (s.in ());
}
@@ -84,16 +98,17 @@ FileImpl::Descriptor::write (const File::Descriptor::DataBuffer &buffer,
CORBA::Environment &env)
{
ACE_HANDLE file_descriptor = this->fd (env);
+
if (env.exception () != 0)
return 0;
const CORBA::Octet *data = &buffer[0];
- int len = ACE_OS::write (file_descriptor, data, buffer.length ());
+ ssize_t len = ACE_OS::write (file_descriptor,
+ data,
+ buffer.length ());
if (len > 0)
- {
- return len;
- }
+ return len;
else
{
CORBA::Exception *exception = new File::IOError (errno);
@@ -107,6 +122,7 @@ FileImpl::Descriptor::read (CORBA::Long num_bytes,
CORBA::Environment &env)
{
ACE_HANDLE file_descriptor = this->fd (env);
+
if (env.exception () != 0)
return 0;
@@ -114,9 +130,10 @@ FileImpl::Descriptor::read (CORBA::Long num_bytes,
int length = ACE_OS::read (file_descriptor, buffer, num_bytes);
if (length > 0)
- {
- return new File::Descriptor::DataBuffer (length, length, buffer, CORBA::B_TRUE);
- }
+ return new File::Descriptor::DataBuffer (length,
+ length,
+ buffer,
+ CORBA::B_TRUE);
else
{
File::Descriptor::DataBuffer::freebuf (buffer);
@@ -132,10 +149,13 @@ FileImpl::Descriptor::lseek (CORBA::ULong offset,
CORBA::Environment &env)
{
ACE_HANDLE file_descriptor = this->fd (env);
+
if (env.exception () != 0)
return 0;
- CORBA::ULong result = ACE_OS::lseek (file_descriptor, offset, whence);
+ CORBA::ULong result = ACE_OS::lseek (file_descriptor,
+ offset,
+ whence);
if (result == -1)
{
CORBA::Exception *exception = new File::IOError (errno);
@@ -150,10 +170,12 @@ void
FileImpl::Descriptor::destroy (CORBA::Environment &env)
{
ACE_HANDLE file_descriptor = this->fd (env);
+
if (env.exception () != 0)
return;
int result = ACE_OS::close (file_descriptor);
+
if (result != 0)
{
CORBA::Exception *exception = new File::IOError (errno);
diff --git a/TAO/tests/POA/Default_Servant/server.cpp b/TAO/tests/POA/Default_Servant/server.cpp
index 0928f243ff3..517e14f55f9 100644
--- a/TAO/tests/POA/Default_Servant/server.cpp
+++ b/TAO/tests/POA/Default_Servant/server.cpp
@@ -32,11 +32,16 @@ main (int argc, char **argv)
// CORBA::PolicyList policies (5);
PortableServer::PolicyList policies (5);
policies.length (5);
- policies[0] = root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
- policies[1] = root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
- policies[2] = root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT, env);
- policies[3] = root_poa->create_servant_retention_policy (PortableServer::RETAIN, env);
- policies[4] = root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID, env);
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
+ policies[2] =
+ root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT, env);
+ policies[3] =
+ root_poa->create_servant_retention_policy (PortableServer::RETAIN, env);
+ policies[4] =
+ root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID, env);
ACE_CString name = "firstPOA";
PortableServer::POA_var first_poa = root_poa->create_POA (name.c_str (),
@@ -64,7 +69,9 @@ main (int argc, char **argv)
FileImpl::System file_system_impl (first_poa.in ());
- PortableServer::ObjectId_var file_system_oid = PortableServer::string_to_ObjectId ("FileSystem");
+ PortableServer::ObjectId_var file_system_oid =
+ PortableServer::string_to_ObjectId ("FileSystem");
+
first_poa->activate_object_with_id (file_system_oid.in (),
&file_system_impl,
env);
@@ -74,14 +81,16 @@ main (int argc, char **argv)
return -1;
}
- CORBA::Object_var file_system = first_poa->id_to_reference (file_system_oid, env);
+ CORBA::Object_var file_system =
+ first_poa->id_to_reference (file_system_oid, env);
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::id_to_reference");
return -1;
}
- CORBA::String_var file_system_ior = orb->object_to_string (file_system.in (), env);
+ CORBA::String_var file_system_ior =
+ orb->object_to_string (file_system.in (), env);
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB::object_to_string");
diff --git a/TAO/tests/POA/On_Demand_Activation/Servant_Activator.cpp b/TAO/tests/POA/On_Demand_Activation/Servant_Activator.cpp
index e6141640c8f..3eeeacd4973 100644
--- a/TAO/tests/POA/On_Demand_Activation/Servant_Activator.cpp
+++ b/TAO/tests/POA/On_Demand_Activation/Servant_Activator.cpp
@@ -1,5 +1,5 @@
// $Id$
-//
+
//================================================================================
//
// = LIBRARY
@@ -9,8 +9,8 @@
// Servant_Activator.cpp
//
// = DESCRIPTION
-// Implementation of MyFooServantActivator , which is used by a POA with a
-// RETAIN policy.
+// Implementation of MyFooServantActivator , which is used by a
+// POA with a RETAIN policy.
//
// = AUTHOR
// Irfan Pyarali
@@ -25,16 +25,15 @@ MyFooServantActivator::incarnate (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr poa,
CORBA::Environment &env)
{
- // Convert ObjectId to String
+ // Convert ObjectId to String.
CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
- // If ObjectId string has a Foo Substring, create and return a MyFooServant
+ // If ObjectId string has a Foo Substring, create and return a
+ // MyFooServant.
if (ACE_OS::strstr (s.in (), "Foo") != 0)
- {
- return new MyFooServant (poa, 27);
- }
+ return new MyFooServant (poa, 27);
else
{
CORBA::Exception *exception = new CORBA::OBJECT_NOT_EXIST (CORBA::COMPLETED_NO);
@@ -52,7 +51,8 @@ MyFooServantActivator::etherealize (const PortableServer::ObjectId &oid,
CORBA::Boolean remaining_activations,
CORBA::Environment &env)
{
- // If there are no remaining activations i.e ObjectIds associated with MyFooServant delete it.
+ // If there are no remaining activations i.e ObjectIds associated
+ // with MyFooServant delete it.
if (remaining_activations == CORBA::B_FALSE)
delete servant;
diff --git a/TAO/tests/POA/On_Demand_Activation/Servant_Activator.h b/TAO/tests/POA/On_Demand_Activation/Servant_Activator.h
index d6d605204a2..21da251c7ac 100644
--- a/TAO/tests/POA/On_Demand_Activation/Servant_Activator.h
+++ b/TAO/tests/POA/On_Demand_Activation/Servant_Activator.h
@@ -1,5 +1,5 @@
// $Id$
-//
+
//=================================================================================
//
// = LIBRARY
@@ -16,7 +16,6 @@
//
//==================================================================================
-
#include "tao/corba.h"
class MyFooServantActivator : public POA_PortableServer::ServantActivator
@@ -25,10 +24,9 @@ public:
virtual PortableServer::Servant incarnate (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr poa,
CORBA::Environment &env);
-
- // This method is invoked by a POA with USE_SERVANT_MANAGER and RETAIN
- // policies , whenever it receives a request for a MyFoo object that is not
- // currently active.
+ // This method is invoked by a POA with USE_SERVANT_MANAGER and
+ // RETAIN policies , whenever it receives a request for a MyFoo
+ // object that is not currently active.
virtual void etherealize (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr adapter,
@@ -36,6 +34,6 @@ public:
CORBA::Boolean cleanup_in_progress,
CORBA::Boolean remaining_activations,
CORBA::Environment &env);
-
- // This method is invoked whenever a MyFooServant for a MyFoo object is deactivated.
+ // This method is invoked whenever a MyFooServant for a MyFoo object
+ // is deactivated.
};
diff --git a/TAO/tests/POA/On_Demand_Activation/Servant_Locator.cpp b/TAO/tests/POA/On_Demand_Activation/Servant_Locator.cpp
index a128e976227..8ca1ee9e0fb 100644
--- a/TAO/tests/POA/On_Demand_Activation/Servant_Locator.cpp
+++ b/TAO/tests/POA/On_Demand_Activation/Servant_Locator.cpp
@@ -1,5 +1,5 @@
// $Id$
-//
+
//================================================================================
//
// = LIBRARY
@@ -9,15 +9,14 @@
// Servant_Locator.cpp
//
// = DESCRIPTION
-// Implementation of MyFooServantLocator class , used with a POA having
-// a NON_RETAIN policy
+// Implementation of MyFooServantLocator class , used with a POA
+// having a NON_RETAIN policy.
//
// = AUTHOR
// Irfan Pyarali
//
//==================================================================================
-
#include "Servant_Locator.h"
#include "MyFooServant.h"
@@ -34,17 +33,18 @@ MyFooServantLocator::preinvoke (const PortableServer::ObjectId &oid,
PortableServer::ServantLocator::Cookie &cookie,
CORBA::Environment &env)
{
- // Convert ObjectID to String
+ // Convert ObjectID to String.
CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
- // If ObjectID string has a Foo Substring create and return a MyFooServant.
+ // If ObjectID string has a Foo Substring create and return a
+ // MyFooServant.
if (ACE_OS::strstr (s.in (), "Foo") != 0)
{
PortableServer::Servant servant = new MyFooServant (poa, ++this->counter_);
- // Return the servant as the cookie , used as a check when postinvoke
- // is called on this MyFooServantLocator
+ // Return the servant as the cookie , used as a check when
+ // postinvoke is called on this MyFooServantLocator.
cookie = servant;
return servant;
@@ -65,7 +65,7 @@ MyFooServantLocator::postinvoke (const PortableServer::ObjectId &oid,
PortableServer::Servant servant,
CORBA::Environment &env)
{
- // Check the passed servant with the cookie
+ // Check the passed servant with the cookie.
PortableServer::Servant my_servant = (PortableServer::Servant) cookie;
ACE_ASSERT (servant == my_servant);
diff --git a/TAO/tests/POA/On_Demand_Activation/Servant_Locator.h b/TAO/tests/POA/On_Demand_Activation/Servant_Locator.h
index 1c0923b2131..d40d758d154 100644
--- a/TAO/tests/POA/On_Demand_Activation/Servant_Locator.h
+++ b/TAO/tests/POA/On_Demand_Activation/Servant_Locator.h
@@ -1,5 +1,5 @@
// $Id$
-//
+
//================================================================================
//
// = LIBRARY
@@ -20,14 +20,12 @@
#include "tao/corba.h"
class MyFooServantLocator : public POA_PortableServer::ServantLocator
-
-// This class is used by a POA with USE_SERVANT_MANAGER and NON_RETAIN
-// policy.
-
{
+ // = TITLE
+ // This class is used by a POA with USE_SERVANT_MANAGER and
+ // NON_RETAIN policy.
public:
MyFooServantLocator (void);
-
// constructor
virtual PortableServer::Servant preinvoke (const PortableServer::ObjectId &oid,
@@ -35,9 +33,8 @@ public:
const char *operation,
PortableServer::ServantLocator::Cookie &the_cookie,
CORBA::Environment &env);
-
- // This method is invoked by a POA whenever it receives a request for
- // MyFoo object that is not currently active.
+ // This method is invoked by a POA whenever it receives a request
+ // for MyFoo object that is not currently active.
virtual void postinvoke (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr adapter,
@@ -45,12 +42,10 @@ public:
PortableServer::ServantLocator::Cookie the_cookie,
PortableServer::Servant the_servant,
CORBA::Environment &env);
-
- // This method is invoked whenever a MyFooServant completes a request.
+ // This method is invoked whenever a MyFooServant completes a
+ // request.
private:
-
int counter_;
-
// Counter for number of invocations of this.
};
diff --git a/TAO/tests/POA/On_Demand_Activation/server.cpp b/TAO/tests/POA/On_Demand_Activation/server.cpp
index acdddf5f45a..a093d5d29b5 100644
--- a/TAO/tests/POA/On_Demand_Activation/server.cpp
+++ b/TAO/tests/POA/On_Demand_Activation/server.cpp
@@ -1,5 +1,5 @@
// $Id$
-//
+
//============================================================================
//
// =FILENAME
@@ -13,8 +13,6 @@
//
//=============================================================================
-
-
#include "ace/streams.h"
#include "Servant_Activator.h"
#include "Servant_Locator.h"
@@ -24,22 +22,21 @@ main (int argc, char **argv)
{
CORBA::Environment env;
- // Initialize the ORB
-
+ // Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, env);
+
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB_init");
return -1;
}
- // Get an Object reference to RootPOA
-
+ // Get an Object reference to RootPOA.
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
// Narrow the Object reference to a POA reference
-
PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj, env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::_narrow");
@@ -47,8 +44,8 @@ main (int argc, char **argv)
}
// Get the POAManager of RootPOA
-
PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::the_POAManager");
@@ -60,16 +57,19 @@ main (int argc, char **argv)
// CORBA::PolicyList policies (4);
PortableServer::PolicyList policies (4);
policies.length (4);
- policies[0] = root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
- policies[1] = root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
- policies[2] = root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER, env);
- policies[3] = root_poa->create_servant_retention_policy (PortableServer::RETAIN, env);
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
+ policies[2] =
+ root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER, env);
+ policies[3] =
+ root_poa->create_servant_retention_policy (PortableServer::RETAIN, env);
ACE_CString name = "firstPOA";
- // create firstPOA as the child of RootPOA with the above policies
- // firstPOA will use SERVANT_ACTIVATOR because of RETAIN policy
-
+ // Create firstPOA as the child of RootPOA with the above policies
+ // firstPOA will use SERVANT_ACTIVATOR because of RETAIN policy.
first_poa = root_poa->create_POA (name.c_str (),
poa_manager.in (),
policies,
@@ -80,7 +80,8 @@ main (int argc, char **argv)
return -1;
}
- // Destroy the policy objects as they have been passed to create_POA and no longer needed
+ // Destroy the policy objects as they have been passed to
+ // create_POA and no longer needed.
for (CORBA::ULong i = 0;
i < policies.length () && env.exception () == 0;
@@ -89,6 +90,7 @@ main (int argc, char **argv)
PortableServer::Policy_ptr policy = policies[i];
policy->destroy (env);
}
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::create_POA");
@@ -101,16 +103,20 @@ main (int argc, char **argv)
// CORBA::PolicyList policies (4);
PortableServer::PolicyList policies (4);
policies.length (4);
- policies[0] = root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
- policies[1] = root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
- policies[2] = root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER, env);
- policies[3] = root_poa->create_servant_retention_policy (PortableServer::NON_RETAIN, env);
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
+ policies[2] =
+ root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER, env);
+ policies[3] =
+ root_poa->create_servant_retention_policy (PortableServer::NON_RETAIN, env);
ACE_CString name = "secondPOA";
// Create secondPOA as child of RootPOA with the above policies
- // secondPOA will use a SERVANT_LOCATOR because of NON_RETAIN policy
-
+ // secondPOA will use a SERVANT_LOCATOR because of NON_RETAIN
+ // policy.
second_poa = root_poa->create_POA (name.c_str (),
poa_manager.in (),
policies,
@@ -121,7 +127,8 @@ main (int argc, char **argv)
return -1;
}
- // Destroy the policy objects as they have been passed to create_POA and no longer needed.
+ // Destroy the policy objects as they have been passed to
+ // create_POA and no longer needed.
for (CORBA::ULong i = 0;
i < policies.length () && env.exception () == 0;
@@ -130,6 +137,7 @@ main (int argc, char **argv)
PortableServer::Policy_ptr policy = policies[i];
policy->destroy (env);
}
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::create_POA");
@@ -145,7 +153,8 @@ main (int argc, char **argv)
return -1;
}
- // Set MyFooServantActivator object as the servant_manager of firstPOA
+ // Set MyFooServantActivator object as the servant_manager of
+ // firstPOA.
first_poa->set_servant_manager (servant_activator.in (), env);
if (env.exception () != 0)
@@ -154,10 +163,14 @@ main (int argc, char **argv)
return -1;
}
- // create a reference with user created ID in firstPOA which uses the MyFooServantActivator
+ // Create a reference with user created ID in firstPOA which uses
+ // the MyFooServantActivator.
+
+ PortableServer::ObjectId_var first_foo_oid =
+ PortableServer::string_to_ObjectId ("firstFoo");
+ CORBA::Object_var first_foo =
+ first_poa->create_reference_with_id (first_foo_oid.in (), "IDL:Foo:1.0", env);
- PortableServer::ObjectId_var first_foo_oid = PortableServer::string_to_ObjectId ("firstFoo");
- CORBA::Object_var first_foo = first_poa->create_reference_with_id (first_foo_oid.in (), "IDL:Foo:1.0", env);
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::create_reference_with_id");
@@ -165,60 +178,78 @@ main (int argc, char **argv)
}
MyFooServantLocator servant_locator_impl;
- PortableServer::ServantLocator_var servant_locator = servant_locator_impl._this (env);
+ PortableServer::ServantLocator_var servant_locator =
+ servant_locator_impl._this (env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POAManager::_this");
return -1;
}
- // Set MyFooServantLocator object as the servant Manager of secondPOA
+
+ // Set MyFooServantLocator object as the servant Manager of
+ // secondPOA.
second_poa->set_servant_manager (servant_locator.in (), env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POAManager::set_servant_manager");
return -1;
}
- // Try to create a reference with user created ID in second_poa which uses MyFooServantLocator
- PortableServer::ObjectId_var second_foo_oid = PortableServer::string_to_ObjectId ("secondFoo");
- CORBA::Object_var second_foo = second_poa->create_reference_with_id (second_foo_oid.in (), "IDL:Foo:1.0", env);
+ // Try to create a reference with user created ID in second_poa
+ // which uses MyFooServantLocator.
+
+ PortableServer::ObjectId_var second_foo_oid =
+ PortableServer::string_to_ObjectId ("secondFoo");
+
+ CORBA::Object_var second_foo =
+ second_poa->create_reference_with_id (second_foo_oid.in (),
+ "IDL:Foo:1.0", env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::create_reference_with_id");
return -1;
}
- // Invoke object_to_string on the references created in firstPOA and secondPOA
+ // Invoke object_to_string on the references created in firstPOA and
+ // secondPOA
+
+ CORBA::String_var first_foo_ior =
+ orb->object_to_string (first_foo, env);
- CORBA::String_var first_foo_ior = orb->object_to_string (first_foo, env);
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB::object_to_string");
return -1;
}
- CORBA::String_var second_foo_ior = orb->object_to_string (second_foo, env);
+ CORBA::String_var second_foo_ior =
+ orb->object_to_string (second_foo, env);
+
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB::object_to_string");
return -1;
}
- // Print the ior's of first_foo and second_foo
+ // Print the ior's of first_foo and second_foo.
cout << first_foo_ior.in () << endl;
cout << second_foo_ior.in () << endl;
// Set the poa_manager state to active, ready to process requests
poa_manager->activate (env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POAManager::activate");
return -1;
}
- // Run the ORB
+ // Run the ORB.
if (orb->run () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "CORBA::ORB::run"), -1);
diff --git a/TAO/tests/POA/RootPOA/RootPOA.cpp b/TAO/tests/POA/RootPOA/RootPOA.cpp
index 7215223440a..b79bc0d7a97 100644
--- a/TAO/tests/POA/RootPOA/RootPOA.cpp
+++ b/TAO/tests/POA/RootPOA/RootPOA.cpp
@@ -1,4 +1,5 @@
// $Id$
+
//==================================================================================
//
// = LIBRARY
@@ -9,7 +10,7 @@
// RootPOA.cpp
//
// = DESCRIPTION
-// This program gets the name of the Root POA and prints it out on
+// This program gets the name of the Root POA and prints it out on
// the standard output.
//
// = AUTHOR
@@ -17,7 +18,6 @@
//
//==================================================================================
-
#include "ace/streams.h"
#include "tao/corba.h"
@@ -34,21 +34,23 @@ main (int argc, char **argv)
return -1;
}
- // Resolve the initial references for the name RootPOA
- // thus getting an object of type CORBA::Object
+ // Resolve the initial references for the name RootPOA thus getting
+ // an object of type CORBA::Object.
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
- // apply _narrow on the object of type CORBA::Object,
- // to make it a POA class Object
+ // apply _narrow on the object of type CORBA::Object, to make it a
+ // POA class Object.
PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in (), env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::_narrow");
return -1;
}
- // Get the name of the root POA
+ // Get the name of the root POA.
CORBA::String_var poa_name = root_poa->the_name (env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::_narrow");
@@ -57,9 +59,9 @@ main (int argc, char **argv)
cout << "The RootPOA is : " << poa_name.in () << endl;
- //destroy the POA object,also destroys the child POAs if any.
- root_poa->destroy (CORBA::B_TRUE,
- CORBA::B_TRUE,
+ // destroy the POA object,also destroys the child POAs if any.
+ root_poa->destroy (CORBA::B_TRUE,
+ CORBA::B_TRUE,
env);
if (env.exception () != 0)
{