summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-01-29 19:31:30 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-01-29 19:31:30 +0000
commita0698bf53db8afd65bd6dd426a83c8615f86f44d (patch)
tree5ddae772f94366f8c4feff55dc6af6ecc5317122
parenta66563ea95e4ceaa73beb0f19c73c0a0150b79aa (diff)
downloadATCD-a0698bf53db8afd65bd6dd426a83c8615f86f44d.tar.gz
*** empty log message ***
-rw-r--r--TAO/tests/POA/Explicit_Activation/README1
-rw-r--r--TAO/tests/POA/Explicit_Activation/server.cpp71
-rw-r--r--TAO/tests/POA/FindPOA/FindPOA.cpp27
-rw-r--r--TAO/tests/POA/Generic_Servant/README30
-rw-r--r--TAO/tests/POA/Generic_Servant/client.cpp24
-rw-r--r--TAO/tests/POA/NewPOA/NewPOA.cpp12
-rw-r--r--TAO/tests/POA/NewPOA/README4
-rw-r--r--TAO/tests/POA/On_Demand_Activation/README133
-rw-r--r--TAO/tests/POA/README38
9 files changed, 184 insertions, 156 deletions
diff --git a/TAO/tests/POA/Explicit_Activation/README b/TAO/tests/POA/Explicit_Activation/README
index 27fda721074..c167476cc8b 100644
--- a/TAO/tests/POA/Explicit_Activation/README
+++ b/TAO/tests/POA/Explicit_Activation/README
@@ -8,7 +8,6 @@ server fails.
It will be fixed soon.
!!!!!!!!!!!! BUG !!!!!!!!!!!
-
This application demostrates various operations that can be used for
explicit activation of Servant objects.
diff --git a/TAO/tests/POA/Explicit_Activation/server.cpp b/TAO/tests/POA/Explicit_Activation/server.cpp
index f9c4f4321d8..d5e2efd6047 100644
--- a/TAO/tests/POA/Explicit_Activation/server.cpp
+++ b/TAO/tests/POA/Explicit_Activation/server.cpp
@@ -1,4 +1,5 @@
// $Id$
+
// ===========================================================================================
// = LIBRARY
// TAO/tests/POA/Explicit_Activation
@@ -8,16 +9,15 @@
//
// = DESCRIPTION
// In this example,
-// - A new POA ( firstPOA) is created, and the different functions for the explicit
-// activation of objects are demonstrated.
-// - The Foo application class objects (defined in ./../Generic_Servant/MyFooSerVant) are
-// used as sample objects.
+// - A new POA ( firstPOA) is created, and the different functions
+// for the explicit activation of objects are demonstrated.
+// - The Foo application class objects (defined in
+// ./../Generic_Servant/MyFooSerVant) are used as sample objects.
//
// = AUTHOR
// Irfan Pyarali
// ===========================================================================================
-
#include "ace/streams.h"
#include "MyFooServant.h"
@@ -28,16 +28,19 @@ main (int argc, char **argv)
// Initialize the ORB first.
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, env);
+//
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB_init");
return -1;
}
+ // Obtain the RootPOA.
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
- // Get the POA_var object from Object_var
+ // Get the POA_var object from Object_var.
PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj, env);
+//
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::_narrow");
@@ -46,19 +49,23 @@ main (int argc, char **argv)
// Get the POAManager of the RootPOA.
PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (env);
+//
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::the_POAManager");
return -1;
}
- // CORBA::PolicyList policies (2); Policies for the firstPOA to be created.
+ // CORBA::PolicyList policies (2); Policies for the firstPOA to be
+ // created.
PortableServer::PolicyList policies (2);
policies.length (2);
- policies[0] = root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
- policies[1] = root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
- // Create the firstPOA under the RootPOA
+ // Create the firstPOA under the RootPOA.
ACE_CString name = "firstPOA";
PortableServer::POA_var first_poa = root_poa->create_POA (name.c_str (),
poa_manager.in (),
@@ -71,6 +78,7 @@ main (int argc, char **argv)
}
// Creation of firstPOA is over. Destroy the Policy objects.
+
for (CORBA::ULong i = 0;
i < policies.length () && env.exception () == 0;
++i)
@@ -78,23 +86,26 @@ 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");
return -1;
}
- // Create two Objects of Class MyFooServant (defined in ./../GenericServant/MyFooServant.h)
- // Create one object at RootPOA and the other at firstPOA.
+ // Create two Objects of Class MyFooServant (defined in
+ // ./../GenericServant/MyFooServant.h) Create one object at RootPOA
+ // and the other at firstPOA.
MyFooServant first_foo_impl (root_poa, 27);
MyFooServant second_foo_impl (first_poa, 28);
- // Do "activate_object" to activate the first_foo_impl object.
- // It returns ObjectId for that object.
- // Operation Used :
+ // Do "activate_object" to activate the first_foo_impl object. It
+ // returns ObjectId for that object. Operation Used :
// ObjectId activate_object( in Servant p_servant)
// raises (ServantAlreadyActive, WrongPolicy);
- PortableServer::ObjectId_var first_oid = root_poa->activate_object (&first_foo_impl, env);
+ PortableServer::ObjectId_var first_oid =
+ root_poa->activate_object (&first_foo_impl, env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::activate_object");
@@ -103,18 +114,21 @@ main (int argc, char **argv)
// Get Object Reference for the first_foo_impl object.
Foo_var first_foo = first_foo_impl._this (env);
+
if (env.exception () != 0)
{
env.print_exception ("POA_Foo::_this");
return -1;
}
- // Get ObjectId for object secondFoo and use that ObjectId to activate the second_foo_impl
- // object.
+ // Get ObjectId for object secondFoo and use that ObjectId to
+ // activate the second_foo_impl object.
// Operation Used :
// void activate_object_with_id( in ObjectId oid, in Servant p_servant)
// raises (ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy);
- PortableServer::ObjectId_var second_oid = PortableServer::string_to_ObjectId ("secondFoo");
+ PortableServer::ObjectId_var second_oid =
+ PortableServer::string_to_ObjectId ("secondFoo");
+
first_poa->activate_object_with_id (second_oid.in (),
&second_foo_impl,
env);
@@ -132,14 +146,16 @@ main (int argc, char **argv)
return -1;
}
- // Get ObjectId for the string thirdPOA
- // Create the object reference for thirdPOA using that ObjectId.
- // Operation Used :
+ // Get ObjectId for the string thirdPOA Create the object reference
+ // for thirdPOA using that ObjectId. Operation Used :
// Object create_reference_with_id ( in ObjectId oid, in CORBA::RepositoryId intf );
- // This operation creates an object reference that encapsulates the specified Object Id and interface
- // repository Id values.
- PortableServer::ObjectId_var third_oid = PortableServer::string_to_ObjectId ("thirdFoo");
- CORBA::Object_var third_foo = first_poa->create_reference_with_id (third_oid.in (), "IDL:Foo:1.0", env);
+ // This operation creates an object reference that encapsulates the
+ // specified Object Id and interface repository Id values.
+ PortableServer::ObjectId_var third_oid =
+ PortableServer::string_to_ObjectId ("thirdFoo");
+ CORBA::Object_var third_foo =
+ first_poa->create_reference_with_id (third_oid.in (), "IDL:Foo:1.0", env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::create_reference_with_id");
@@ -148,6 +164,7 @@ main (int argc, char **argv)
// Stringyfy all the object references and print them out.
CORBA::String_var first_ior = orb->object_to_string (first_foo, env);
+
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB::object_to_string");
@@ -155,6 +172,7 @@ main (int argc, char **argv)
}
CORBA::String_var second_ior = orb->object_to_string (second_foo, env);
+
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB::object_to_string");
@@ -162,6 +180,7 @@ main (int argc, char **argv)
}
CORBA::String_var third_ior = orb->object_to_string (third_foo, env);
+
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB::object_to_string");
diff --git a/TAO/tests/POA/FindPOA/FindPOA.cpp b/TAO/tests/POA/FindPOA/FindPOA.cpp
index a43ba0a4fc7..fdb1df78813 100644
--- a/TAO/tests/POA/FindPOA/FindPOA.cpp
+++ b/TAO/tests/POA/FindPOA/FindPOA.cpp
@@ -1,5 +1,5 @@
// $Id$
-//
+
//===============================================================================
//
// = LIBRARY
@@ -33,13 +33,12 @@ main (int argc, char **argv)
return -1;
}
- // Get Object reference to RootPOA
-
+ // Get Object reference to RootPOA.
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
- // Narrow Object reference to RootPOA to a POA reference
-
+ // Narrow Object reference to RootPOA to a POA reference.
PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in(), env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::_narrow");
@@ -47,16 +46,18 @@ main (int argc, char **argv)
}
// Get a TAO_Adapter_Activator reference
-
TAO_Adapter_Activator activator_impl;
+
PortableServer::AdapterActivator_var activator = activator_impl._this (env);
+
if (env.exception () != 0)
{
env.print_exception ("TAO_Adapter_Activator::_this");
return -1;
}
- // Register the TAO_Adapter_Activator reference to be the RootPOA's Adapter Activator
+ // Register the TAO_Adapter_Activator reference to be the RootPOA's
+ // Adapter Activator.
root_poa->the_activator (activator.in (), env);
if (env.exception () != 0)
@@ -66,7 +67,6 @@ main (int argc, char **argv)
}
// Try to find a childPOA of RootPOA named firstPOA
-
ACE_CString name = "firstPOA";
PortableServer::POA_var first_poa = root_poa->find_POA (name.c_str (),
CORBA::B_TRUE,
@@ -77,8 +77,8 @@ main (int argc, char **argv)
return -1;
}
- // Use the TAO_POA name_separator (which is '/') to find a childPOA of
- // firstPOA named secondPOA
+ // Use the TAO_POA name_separator (which is '/') to find a childPOA
+ // of firstPOA named secondPOA.
name += TAO_POA::name_separator ();
name += "secondPOA";
@@ -91,9 +91,10 @@ main (int argc, char **argv)
return -1;
}
- // Create a hierarchical string of POA names eg. thirdPOA/forthPOA/fifthPOA
- // thirdPOA being the root of the hierarchy with forthPOA as its child
- // and fifthPOA as its grandchild.
+ // Create a hierarchical string of POA names
+ // eg. thirdPOA/forthPOA/fifthPOA thirdPOA being the root of the
+ // hierarchy with forthPOA as its child and fifthPOA as its
+ // grandchild.
name = "thirdPOA";
name += TAO_POA::name_separator ();
diff --git a/TAO/tests/POA/Generic_Servant/README b/TAO/tests/POA/Generic_Servant/README
index 0d5b8372d25..05ee0f2a18e 100644
--- a/TAO/tests/POA/Generic_Servant/README
+++ b/TAO/tests/POA/Generic_Servant/README
@@ -3,24 +3,22 @@
Generic Servant:
===============
- File Name
- ---------
-
- Foo.idl Simple Foo idl interface
- MyFooServant.h Servant definition for the Foo interface
- MyFooServant.cpp Servant implementation for the FOO interface
- client.cpp A simple Foo client
+File Name
+---------
- Typing
+Foo.idl Simple Foo idl interface
+MyFooServant.h Servant definition for the Foo interface
+MyFooServant.cpp Servant implementation for the FOO interface
+client.cpp A simple Foo client
- % Make
-
- creates an executable client and server library libserver.a.
+Typing
- To run the client , type
+% Make
- %client [-ORBport port] -k IOR
-
- where IOR can be got from the server output.
+ creates an executable client and server library libserver.a.
-
+To run the client, type
+
+% client [-ORBport port] -k IOR
+
+where IOR can be got from the server output.
diff --git a/TAO/tests/POA/Generic_Servant/client.cpp b/TAO/tests/POA/Generic_Servant/client.cpp
index 1d988f86bea..0c3beca4e44 100644
--- a/TAO/tests/POA/Generic_Servant/client.cpp
+++ b/TAO/tests/POA/Generic_Servant/client.cpp
@@ -1,5 +1,5 @@
// $Id$
-//
+
//===============================================================================
//
//
@@ -7,7 +7,7 @@
// client.cpp
//
// = DESCRIPTION
-// This is a simple foo client implementation
+// This is a simple foo client implementation.
//
// = AUTHOR
// Irfan Pyarali
@@ -18,7 +18,7 @@
#include "ace/Get_Opt.h"
#include "FooC.h"
-static char *ior = 0;
+static char *IOR = 0;
static int
parse_args (int argc, char **argv)
@@ -30,7 +30,7 @@ parse_args (int argc, char **argv)
switch (c)
{
case 'k':
- ior = get_opts.optarg;
+ IOR = get_opts.optarg;
break;
case '?':
default:
@@ -42,7 +42,7 @@ parse_args (int argc, char **argv)
-1);
}
- if (ior == 0)
+ if (IOR == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Please specify the IOR for the servant"), -1);
@@ -63,33 +63,37 @@ main (int argc, char **argv)
return -1;
}
+ // Initialize options based on command-line arguments.
parse_args (argc, argv);
- // Get an object reference from the argument string
- CORBA::Object_var object = orb->string_to_object (ior, env);
+ // Get an object reference from the argument string.
+ CORBA::Object_var object = orb->string_to_object (IOR, env);
+
if (env.exception () != 0)
{
env.print_exception ("CORBA::ORB::string_to_object");
return -1;
}
- // Try to narrow the object reference to a Foo reference
+ // Try to narrow the object reference to a Foo reference.
Foo_var foo = Foo::_narrow (object.in (), env);
+
if (env.exception () != 0)
{
env.print_exception ("Foo::_narrow");
return -1;
}
- // Invoke the doit method of the foo reference
+ // Invoke the doit() method of the foo reference.
CORBA::Long result = foo->doit (env);
+
if (env.exception () != 0)
{
env.print_exception ("Foo::doit");
return -1;
}
- // Print the result of doit () method of the foo reference
+ // Print the result of doit () method of the foo reference.
cout << result << endl;
return 0;
diff --git a/TAO/tests/POA/NewPOA/NewPOA.cpp b/TAO/tests/POA/NewPOA/NewPOA.cpp
index f36c42b236b..dfae317ebbc 100644
--- a/TAO/tests/POA/NewPOA/NewPOA.cpp
+++ b/TAO/tests/POA/NewPOA/NewPOA.cpp
@@ -1,4 +1,5 @@
// $Id$
+
// ===========================================================================================
// = LIBRARY
// TAO/tests/POA/NewPOA
@@ -36,10 +37,12 @@ main (int argc, char **argv)
return -1;
}
+ // Obtain the object reference to the RootPOA.
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
- // _narrow() the Object to get the POA object, i.e., the root_poa
+ // _narrow() the Object to get the POA object, i.e., the root_poa.
PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in(), env);
+
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::_narrow");
@@ -49,8 +52,10 @@ main (int argc, char **argv)
// CORBA::PolicyList policies (2); Policies for the new POAs
PortableServer::PolicyList policies (2);
policies.length (2);
- policies[0] = root_poa->create_thread_policy (PortableServer::ORB_CTRL_MODEL, env);
- policies[1] = root_poa->create_lifespan_policy (PortableServer::TRANSIENT, env);
+ policies[0] =
+ root_poa->create_thread_policy (PortableServer::ORB_CTRL_MODEL, env);
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::TRANSIENT, env);
// Creation of the firstPOA
ACE_CString name = "firstPOA";
@@ -103,6 +108,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");
diff --git a/TAO/tests/POA/NewPOA/README b/TAO/tests/POA/NewPOA/README
index c8b10ab94f7..8a47ed95cfc 100644
--- a/TAO/tests/POA/NewPOA/README
+++ b/TAO/tests/POA/NewPOA/README
@@ -1,5 +1,5 @@
-This application explains the usage scenario, where new POAs will
-have to be created.
+This application explains the usage scenario, where new POAs will have
+to be created.
Run this example as follows.
diff --git a/TAO/tests/POA/On_Demand_Activation/README b/TAO/tests/POA/On_Demand_Activation/README
index 11a0167bf30..97e57170061 100644
--- a/TAO/tests/POA/On_Demand_Activation/README
+++ b/TAO/tests/POA/On_Demand_Activation/README
@@ -6,87 +6,88 @@ On_Demand_Activation Tests:
Description:
===========
- ServantManagers:
- ===============
-
- Servant managers are associated with POAs. A servant manager supplies
- a POA with the ability to objects on demand when the POA receives a
- request targeted at an inactive object. A servant manager is
- registered with a POA as a callback object, to be invoked by the POA
- when necessary.An application server that activates all its needed
- objects at the beginning of execution does not need to use a servant
- manager; it is used only for the case in which an object must be
- activated during request processing.
-
- When the POA has the RETAIN policy it uses servant managers that are
- ServantActivators. When the POA has the NON_RETAIN policy it uses
- servant managers that are ServantLocators.
-
- server:
- ======
- The test program server creates 2 POAs firstPOA and secondPOA.
- firstPOA is created with a RETAIN,USER_ID,USE_SERVANT_MANAGER policy
- and MyFooServantActivator is registered as its servant Manager.
- secondPOA is created with a NON_RETAIN,USER_ID,USE_SERVANT_MANAGER
- policy and MyFooServantLocator is registered as it servant Manager.
-
- It then creates an object reference from the string "firstFoo"
- in firstPOA and prints its IOR.Similarly it creates an object
- reference from the string "secondFoo" in secondPOA and prints its
- IOR. Finally it changes the state of the POA_Manager to 'active' and
- runs the ORB.
-
- USAGE:
- ======
-
- %server [-ORBhost host ] [-ORBport port] [-ORBobjrefstyle URL ]
-
-
- client:
- ======
- The Foo client program is in the path
-
- TAO/tests/POA/Generic_Servant/client
- i.e ../Generic_Servant/client
-
- %client -k IOR
-
- where IOR is got from the server output.
+ServantManagers:
+===============
+
+Servant managers are associated with POAs. A servant manager supplies
+a POA with the ability to objects on demand when the POA receives a
+request targeted at an inactive object. A servant manager is
+registered with a POA as a callback object, to be invoked by the POA
+when necessary.An application server that activates all its needed
+objects at the beginning of execution does not need to use a servant
+manager; it is used only for the case in which an object must be
+activated during request processing.
+
+When the POA has the RETAIN policy it uses servant managers that are
+ServantActivators. When the POA has the NON_RETAIN policy it uses
+servant managers that are ServantLocators.
+
+server:
+======
+
+ The test program server creates 2 POAs firstPOA and secondPOA.
+firstPOA is created with a RETAIN,USER_ID,USE_SERVANT_MANAGER policy
+and MyFooServantActivator is registered as its servant Manager.
+secondPOA is created with a NON_RETAIN,USER_ID,USE_SERVANT_MANAGER
+policy and MyFooServantLocator is registered as it servant Manager.
+
+ It then creates an object reference from the string "firstFoo"
+in firstPOA and prints its IOR.Similarly it creates an object
+reference from the string "secondFoo" in secondPOA and prints its
+IOR. Finally it changes the state of the POA_Manager to 'active' and
+runs the ORB.
+
+USAGE:
+======
+
+%server [-ORBhost host ] [-ORBport port] [-ORBobjrefstyle URL ]
+
+client:
+======
+ The Foo client program is in the path
+
+ TAO/tests/POA/Generic_Servant/client
+ i.e ../Generic_Servant/client
+
+% client -k IOR
+
+where IOR is got from the server output.
To Test:
=======
- 1. Run the server
- Servant Activator:
+1. Run the server
+
+Servant Activator:
===================
- 2. Get the IOR for "firstFOO" from the server output .
+2. Get the IOR for "firstFOO" from the server output .
- 3. Run client -k IOR
+3. Run client -k IOR
- 4. You should get an output
-
- 27
-
- alongwith some diagnostic messages.
+4. You should get an output
- Servant Locator:
+ 27
+
+along with some diagnostic messages.
+
+Servant Locator:
=================
-
- 2. Get the IOR for "secondFoo" from the server output
- 3. Run client -k IOR
+2. Get the IOR for "secondFoo" from the server output
+
+3. Run client -k IOR
+
+4. The first time a client is run you should get an output
- 4. The first time a client is run you should get an output
-
- 2
+ 2
- alongwith some diagnostic messages.
+along with some diagnostic messages.
- 5. Subsequent runs of the client program results in the output
- incremented by 2.
+5. Subsequent runs of the client program results in the output
+ incremented by 2.
- 6. Thus, the second run of client should give you an output 4.
+6. Thus, the second run of client should give you an output 4.
diff --git a/TAO/tests/POA/README b/TAO/tests/POA/README
index 613c9f06645..3572ebd9f33 100644
--- a/TAO/tests/POA/README
+++ b/TAO/tests/POA/README
@@ -1,13 +1,15 @@
// $Id$
-The following TAO applications explain the various POA interfaces and
-their usage scenarios.
- Individual README files in the respective directories explain
+The following TAO applications illustate various Portable Object
+Adapter (POA) interfaces and their usage scenarios.
+
+ Individual README files in the respective directories explain
these applications further.
. RootPOA
- This example explains how to obtain the name of the RootPOA.
+ This example explains how to obtain the name of the
+ RootPOA.
. NewPOA
@@ -24,28 +26,26 @@ these applications further.
A simple interface (Foo) is defined here and its
implementations, server and client programs are
availabale, which can be used for testing POA
- applications.
- Several servers for that interface are implemented
- using different POA policies; a common client for all
- the servers is also provided.
+ applications. Several servers for that interface are
+ implemented using different POA policies; a common
+ client for all the servers is also provided.
. On_Demand_Activation
-
- Contains programs that test the POA's 2 types of activation
- of objects on demand, namely , Servant Activator approach
- and Servant Locator , which depend on the RETAIN/NON-RETAIN
- policy of a POA.
+
+ Contains programs that test the POA's 2 types of
+ activation of objects on demand, namely , Servant
+ Activator approach and Servant Locator , which depend
+ on the RETAIN/NON-RETAIN policy of a POA.
. Default_Servant
. Explicit_Activation
- This application explains various operations
- involved in the explicit activation of objects;
- including the creation of objects without servants
- (the servant is created on demand).
- NOTE: Currently the example does not work.
- < It compiles; but at runtime, _narrow()
+ This application explains various operations involved
+ in the explicit activation of objects; including the
+ creation of objects without servants (the servant is
+ created on demand). NOTE: Currently the example does
+ not work. < It compiles; but at runtime, _narrow()
raises an exception on the client. >