diff options
author | sergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-12-02 09:51:19 +0000 |
---|---|---|
committer | sergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-12-02 09:51:19 +0000 |
commit | 39d1d7a553b4302f9c737f515c8bb2101a6f5840 (patch) | |
tree | e0bef71edfca3e364ff80b77513254542fc0ac8e /TAO/tests | |
parent | 7f0abcdd832b7b099bc08a633fe15eca2210f90a (diff) | |
download | ATCD-39d1d7a553b4302f9c737f515c8bb2101a6f5840.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Cubit/CORBAplus/IDL_Cubit/README | 33 | ||||
-rw-r--r-- | TAO/tests/Cubit/CORBAplus/IDL_Cubit/clnt.cpp | 2 | ||||
-rw-r--r-- | TAO/tests/Cubit/CORBAplus/IDL_Cubit/svr.cpp | 141 |
3 files changed, 169 insertions, 7 deletions
diff --git a/TAO/tests/Cubit/CORBAplus/IDL_Cubit/README b/TAO/tests/Cubit/CORBAplus/IDL_Cubit/README index 0934a9af493..7e3219a7d4c 100644 --- a/TAO/tests/Cubit/CORBAplus/IDL_Cubit/README +++ b/TAO/tests/Cubit/CORBAplus/IDL_Cubit/README @@ -14,20 +14,41 @@ The server cubit factory maintained num_of_cubit objects (default = 1). They are assigned keys that look like "key0", "key1", ... When the server is started and you have used the -d flag, you should -see as the first line of output something that looks like -pbkr://128.252.165.140:35158/repid=IDL:Cubit_Factory:1.0;uid=80FCA58C00004F49348220C300000000; +see a line of output that looks something like: +XpsIiopServerProfileFactory::XpsIiopServerProfileFactory() : new tcp server listening at port 45372 Using -d turns on debugging messages. It is additive, i.e., the more -d options provided, the more debugging you can get. At the moment, only 2 levels of debugging are implemented, and more than 2 -d options are ignored. +NOTE: + +0. $PBHOME is the directory where CORBAplus is installed. + +1. Set the appropriate environment variables for CORBAplus to work. Look at the example script at +$PBHOME/.cshrc_pb You can append this script to your .cshrc.mine file assuming you run a csh shell. +You can also execute it, like: + + source $PBHOME/.cshrc_pb + +2. Make sure the CORBAplus BOA server is running, before trying to run the server example. + + To run the BOA server execute: + + $PBHOME/bin/pbboad -pbtrace + client: ------- -% clnt [-d] [-k <cubit key>] [-n <iterations>] -pbinit Cubit_Factory <Object_Reference> +% clnt [-d] [-k <cubit key>] [-n <iterations>] -pbinit Cubit_Factory iiop://<host>:<port>/cubit_factory + + where + <host> is the machine where the server is running. + <port> is the port number that was displayed when the server was run. See example output above. + +<cubit_key> corresponds to "key0", "key1", ... -Object_Reference corresponds to the output from the server that might look like this: -pbkr://128.252.165.140:35158/repid=IDL:Cubit_Factory:1.0;uid=80FCA58C00004F49348220C300000000; +<iterations> are the number of times you want to execute a call. -cubit_key corresponds to "key0", "key1", ... +-d : see same option for server above.
\ No newline at end of file diff --git a/TAO/tests/Cubit/CORBAplus/IDL_Cubit/clnt.cpp b/TAO/tests/Cubit/CORBAplus/IDL_Cubit/clnt.cpp index 81cecfa96ac..3a18184fea3 100644 --- a/TAO/tests/Cubit/CORBAplus/IDL_Cubit/clnt.cpp +++ b/TAO/tests/Cubit/CORBAplus/IDL_Cubit/clnt.cpp @@ -56,7 +56,7 @@ Cubit_Client::func (u_int i) int Cubit_Client::parse_args (void) { - ACE_Get_Opt get_opts (argc_, argv_, "dn:k:x"); + ACE_Get_Opt get_opts (argc_, argv_, "dn:k:xp:"); int c; while ((c = get_opts ()) != -1) diff --git a/TAO/tests/Cubit/CORBAplus/IDL_Cubit/svr.cpp b/TAO/tests/Cubit/CORBAplus/IDL_Cubit/svr.cpp new file mode 100644 index 00000000000..28d0d5da22f --- /dev/null +++ b/TAO/tests/Cubit/CORBAplus/IDL_Cubit/svr.cpp @@ -0,0 +1,141 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Cubit/CORBAplus/IDL_Cubit +// +// = FILENAME +// svr.cpp +// +// = AUTHOR +// Andy Gokhale, Sumedh Mungee and Sergio Flores-Gaitan +// +// ============================================================================ + +#include "ace/Get_Opt.h" +#include "ace/Log_Msg.h" +#include "pbroker/corba/orb.h" +#include "pbroker/corba/environ.h" +#include "pbroker/pberr.h" +#include <pbroker/corba/xpsorb.h> +#include <pbroker/corba/xpsboa.h> +#include "pbroker/corba/boad/boafull.h" // will force usage of "Full" BOA API + +#include <pbroker/unixsvc/unixsvc.h> + +#include "cubit_i.h" + +// Global Variables +static int num_of_objs = 1; +static pbbool killSelf = pbfalse; + +// Declare the server activation policy +XPS_DECLARE_SERVER(Cubit_Factory,"Cubit_Factory",SHARED_SERVER) + +// Parses the command line arguments and returns an error status + +static int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "dn:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'd': // debug flag + break; + case 'n': // number of cubit objects we hold + num_of_objs = ACE_OS::atoi (get_opts.optarg); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-d]" + " [-n] <num of cubit objects>" + "\n", argv [0]), 1); + } + + return 0; // Indicates successful parsing of command line +} + +// Standard command line parsing utilities used. + +int +main (int argc, char *argv[]) +{ + CORBA_Environment env; + // char *orb_name = "internet"; + + XpsORB_ptr orb_ptr = XpsORB::_nil(); + XpsBOA * oa_ptr = XpsBOA::_nil (); + CORBA_Object_ptr obj_ptr = CORBA_Object::_nil(); + + try + { + // Initialize the ORB pointer + orb_ptr = XpsORB::init (argc, argv); + + // Initialize the Object Adapter + oa_ptr = XpsBOA::init (argc, argv); + + if (CORBA::is_nil(orb_ptr) || CORBA::is_nil(oa_ptr)) + { + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the ORB and/or the BOA\n"), + 1); + } + + + // Parse remaining command line and verify parameters. + // parse_args (argc, argv); + + // create a factory implementation + Cubit_Factory_ptr factory; + + ACE_NEW_RETURN (factory, Cubit_Factory_i ("factory", num_of_objs), 1); + + // Stringify the objref we'll be implementing, and print it to + // stdout. Someone will take that string and give it to a + // client. Then release the object. + + CORBA::String str = 0; + + str = orb_ptr->object_to_url (factory); + + ACE_DEBUG ((LM_DEBUG, "listening as object '%s'\n", str)); + CORBA_string_free (str); + + oa_ptr->obj_is_ready (factory, nil); + oa_ptr->registerAlias (factory, "cubit_factory"); + + XpsEventService eventService; + eventService.mainloop(); // control will not return to this point + } + catch(const CORBA::SystemException& exc) + { + ACE_DEBUG ((LM_DEBUG, + "CORBA::SystemException caught: %s (minor: %d): svr.cpp\n\n", + exc._repository_id (), + exc.minor ())); + } + catch(const CORBA::UserException& exc) + { + ACE_DEBUG ((LM_DEBUG, + "CORBA::UserException caught: %s: svr.cpp\n\n", + exc._repository_id ())); + } + catch(...) + { + ACE_DEBUG ((LM_DEBUG, + "Exception caught: svr.cpp\n\n")); + } + + // Free resources + CORBA::release (oa_ptr); + CORBA::release (orb_ptr); + + return 0; +} |