summaryrefslogtreecommitdiff
path: root/TAO/examples/POA/Adapter_Activator/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/examples/POA/Adapter_Activator/server.cpp')
-rw-r--r--TAO/examples/POA/Adapter_Activator/server.cpp134
1 files changed, 37 insertions, 97 deletions
diff --git a/TAO/examples/POA/Adapter_Activator/server.cpp b/TAO/examples/POA/Adapter_Activator/server.cpp
index 550f5082ff8..8ef9b338672 100644
--- a/TAO/examples/POA/Adapter_Activator/server.cpp
+++ b/TAO/examples/POA/Adapter_Activator/server.cpp
@@ -60,8 +60,7 @@ public:
CORBA::ORB_ptr orb);
CORBA::Boolean unknown_adapter (PortableServer::POA_ptr parent,
- const char *name
- ACE_ENV_ARG_DECL)
+ const char *name)
ACE_THROW_SPEC ((CORBA::SystemException));
CORBA::PolicyList first_poa_policies_;
@@ -82,43 +81,34 @@ Adapter_Activator::Adapter_Activator (PortableServer::POAManager_ptr poa_manager
CORBA::Boolean
Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent,
- const char *name
- ACE_ENV_ARG_DECL)
+ const char *name)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (ACE_OS::strcmp (name, "firstPOA") == 0)
{
PortableServer::POA_var child = parent->create_POA (name,
this->poa_manager_.in (),
- this->first_poa_policies_
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ this->first_poa_policies_);
// Creation of firstPOA is over. Destroy the Policy objects.
for (CORBA::ULong i = 0;
i < this->first_poa_policies_.length ();
++i)
{
- this->first_poa_policies_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ this->first_poa_policies_[i]->destroy ();
}
- child->the_activator (this
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ child->the_activator (this);
reference_counted_test_i *servant =
new reference_counted_test_i (this->orb_.in (),
child.in ());
- child->set_servant (servant
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ child->set_servant (servant);
// This means that the ownership of <servant> now belongs to the
// POA.
- servant->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ servant->_remove_ref ();
// Finally everything is fine
return 1;
@@ -127,17 +117,14 @@ Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent,
{
PortableServer::POA_var child = parent->create_POA (name,
this->poa_manager_.in (),
- this->second_poa_policies_
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ this->second_poa_policies_);
// Creation of secondPOA is over. Destroy the Policy objects.
for (CORBA::ULong i = 0;
i < this->second_poa_policies_.length ();
++i)
{
- this->second_poa_policies_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ this->second_poa_policies_[i]->destroy ();
}
reference_counted_test_i *servant =
@@ -148,14 +135,11 @@ Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent,
PortableServer::string_to_ObjectId ("third test");
child->activate_object_with_id (oid.in (),
- servant
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ servant);
// This means that the ownership of <servant> now belongs to the
// POA.
- servant->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
+ servant->_remove_ref ();
// Finally everything is fine
return 1;
@@ -264,16 +248,13 @@ write_iors_to_file (const char *first_ior,
int
main (int argc, char **argv)
{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
+ try
{
// Initialize the ORB first.
CORBA::ORB_var orb = CORBA::ORB_init (argc,
argv,
- 0
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ 0);
int result = parse_args (argc, argv);
if (result != 0)
@@ -281,20 +262,15 @@ main (int argc, char **argv)
// Obtain the RootPOA.
CORBA::Object_var obj =
- orb->resolve_initial_references ("RootPOA"
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ orb->resolve_initial_references ("RootPOA");
// Get the POA_var object from Object_var.
PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (obj.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ PortableServer::POA::_narrow (obj.in ());
// Get the POAManager of the RootPOA.
PortableServer::POAManager_var poa_manager =
- root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->the_POAManager ();
Adapter_Activator *adapter_activator =
new Adapter_Activator (poa_manager.in (),
@@ -303,9 +279,7 @@ main (int argc, char **argv)
PortableServer::AdapterActivator_var adapter_activator_var =
adapter_activator;
- root_poa->the_activator (adapter_activator_var.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->the_activator (adapter_activator_var.in ());
PortableServer::POA_var first_poa;
PortableServer::POA_var second_poa;
@@ -317,34 +291,24 @@ main (int argc, char **argv)
// Id Assignment Policy
policies[0] =
- root_poa->create_id_assignment_policy (PortableServer::SYSTEM_ID
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->create_id_assignment_policy (PortableServer::SYSTEM_ID);
// Lifespan policy
policies[1] =
- root_poa->create_lifespan_policy (PortableServer::PERSISTENT
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT);
// Request Processing policy
policies[2] =
- root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT);
// Id Uniqueness
policies[3] =
- root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID);
// Create the firstPOA under the RootPOA.
first_poa = root_poa->create_POA ("firstPOA",
poa_manager.in (),
- policies
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ policies);
}
{
@@ -354,22 +318,16 @@ main (int argc, char **argv)
// Id Assignment Policy
policies[0] =
- root_poa->create_id_assignment_policy (PortableServer::USER_ID
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID);
// Lifespan policy
policies[1] =
- root_poa->create_lifespan_policy (PortableServer::PERSISTENT
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT);
// Create the secondPOA under the firstPOA.
second_poa = first_poa->create_POA ("secondPOA",
poa_manager.in (),
- policies
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ policies);
}
// Create a servant.
@@ -377,42 +335,30 @@ main (int argc, char **argv)
root_poa.in ());
PortableServer::ObjectId_var first_oid =
- root_poa->activate_object (&first_servant
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ root_poa->activate_object (&first_servant);
// Get Object Reference for the first_servant object.
- test_var first_test = first_servant._this (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ test_var first_test = first_servant._this ();
CORBA::Object_var second_test =
- first_poa->create_reference ("IDL:test:1.0"
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ first_poa->create_reference ("IDL:test:1.0");
PortableServer::ObjectId_var third_oid =
PortableServer::string_to_ObjectId ("third test");
CORBA::Object_var third_test =
second_poa->create_reference_with_id (third_oid.in (),
- "IDL:test:1.0"
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ "IDL:test:1.0");
// Stringyfy all the object references and print them out.
CORBA::String_var first_ior =
- orb->object_to_string (first_test.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ orb->object_to_string (first_test.in ());
CORBA::String_var second_ior =
- orb->object_to_string (second_test.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ orb->object_to_string (second_test.in ());
CORBA::String_var third_ior =
- orb->object_to_string (third_test.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ orb->object_to_string (third_test.in ());
ACE_DEBUG ((LM_DEBUG,
"%s\n%s\n%s\n",
@@ -427,24 +373,18 @@ main (int argc, char **argv)
return write_result;
first_poa->destroy (1,
- 1
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ 1);
- poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ poa_manager->activate ();
- orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ orb->run ();
}
- ACE_CATCHANY
+ catch (const CORBA::Exception& ex)
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught");
+ ex._tao_print_exception ("Exception caught");
return -1;
}
- ACE_ENDTRY;
- ACE_CHECK_RETURN (-1);
return 0;
}