summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-30 21:57:38 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-30 21:57:38 +0000
commitda5f4527c69b94473046dc288722bfc7643c18e4 (patch)
treebf3c68994ab5604b31354801008d1e06d5ad1aab
parent9e9d48e8819bb80cce9795d7f8c05ea0dfdf1555 (diff)
downloadATCD-da5f4527c69b94473046dc288722bfc7643c18e4.tar.gz
New Implementation Repository Files
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/ImplRepoTest.dsw53
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/Impl_Repo.idl142
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/README9
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/Simple_Object.idl16
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/client.cpp20
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/client.dsp178
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/client_impl.cpp193
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/client_impl.h75
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/implrepo.dsp206
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/ir_server.cpp35
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/ir_server_impl.cpp145
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/ir_server_impl.h73
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.cpp75
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.h62
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/server.cpp35
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/server.dsp200
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/server_impl.cpp88
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/server_impl.h67
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/simple_object_impl.cpp39
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/simple_object_impl.h56
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/svc.conf49
21 files changed, 1816 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/ImplRepo/ImplRepoTest.dsw b/TAO/orbsvcs/tests/ImplRepo/ImplRepoTest.dsw
new file mode 100644
index 00000000000..b34ca75c1b7
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/ImplRepoTest.dsw
@@ -0,0 +1,53 @@
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "ImplRepoTest Client"=.\client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ImplRepoTest ImplRepo"=.\implrepo.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ImplRepoTest Server"=.\server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/Impl_Repo.idl b/TAO/orbsvcs/tests/ImplRepo/Impl_Repo.idl
new file mode 100644
index 00000000000..780eb7522dd
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/Impl_Repo.idl
@@ -0,0 +1,142 @@
+// $Id$
+
+interface simple_object
+ // = TITLE
+ // Defines an interface that encapsulates operations that cube
+ // numbers.
+ //
+ // = DESCRIPTION
+ // This interface encapsulates an operation that cubes a long.
+{
+ long simple_method (in long l);
+ // cube a long
+
+ oneway void shutdown ();
+ // shutdown the application.
+};
+
+interface Ping_Object
+{
+ oneway void ping ();
+ // Used for checking for liveness of a server. When the server receives
+ // this, it should send back a response indicating it is sill alive.
+ // Depending on the policy specified, a timeout can be reached where the
+ // Implementation Repository will restart the server.
+};
+
+interface Implementation_Repository
+ // = TITLE
+ // Interface for communicating with the Implementation Repository
+ //
+ // = DESCRIPTION
+ // This interface exports all the administration functionality of
+ // the Implementation Repository.
+{
+ exception Already_Registered {};
+ // Object already bound in the Implementation Repository
+
+ exception Cannot_Activate
+ {
+ string reason_;
+ };
+
+ exception Not_Found {};
+ // Object not found in the Implementation Repository
+
+ struct Environment_Variable
+ {
+ string name_;
+ string value_;
+ };
+ // One environment variable
+
+ struct INET_Addr
+ {
+ unsigned short port_;
+ unsigned long host_;
+ };
+ // The location of a server
+
+ typedef sequence<Environment_Variable> Environment;
+ // Complete environment
+
+ typedef sequence<string> Command_Line_Options;
+ // Command line options
+
+ struct Process_Options
+ {
+ string executable_name_;
+ // Executable name
+ Command_Line_Options command_line_options_;
+ // Command line options
+ Environment environment_;
+ // Environment
+ string working_directory_;
+ // Working directory
+ unsigned long creation_flags_;
+ // Creation flags
+ };
+
+// Object activate_object (in Object obj)
+// raises (Not_Found,
+// Cannot_Activate);
+ // Restart server that will contain this persistent object and return the
+ // new Object reference.
+ //
+ // The <Not_Found> exception is raised when <obj> is not found
+ // in the Implementation Repository. The <Cannot_Activate> exception
+ // is raised when <obj> is found in the Repository but could not be
+ // activated.
+
+// INET_Addr activate_server (in string server)
+// raises (Not_Found,
+// Cannot_Activate);
+ // Restart server that is named <server> and return the host/port
+ //
+ // The <Not_Found> exception is raised when <server> is not found
+ // in the Implementation Repository. The <Cannot_Activate> exception
+ // is raised when <server> is found in the Repository but could not be
+ // activated.
+
+
+// void register_server (in string server,
+// in Process_Options options)
+// raises (Already_Registered);
+ // Restart server process when client is looking for <server>.
+ //
+ // The <Already_Registered> exception is raised when <server> has
+ // already been registered with the Implementation Repository.
+ //
+ // The <Object_Not_Persistent> exception is raised when <server> is
+ // not a Persistent Object Reference.
+
+// void reregister_server (in string server,
+// in Process_Options options)
+// raises (Already_Registered);
+ // Restart server process when client is looking for <server>.
+ //
+ // The <Already_Registered> exception is raised when <server> has
+ // already been registered with the Implementation Repository.
+ //
+ // The <Object_Not_Persistent> exception is raised when <server> is
+ // not a Persistent Object Reference.
+
+
+// void remove_server (in string server)
+// raises (Not_Found);
+ // Remove <server> from the Implementation Repository.
+ //
+ // The <Not_Found> exception is raised when <server> is not found
+ // in the Implementation Repository.
+
+// Profile server_is_running (in string server,
+ void server_is_running (in string server,
+ in INET_Addr addr,
+ in Ping_Object ping);
+ // Used to notify the Implementation Repository that <server> is alive and
+ // well at <addr>.
+
+// void server_is_shutting_down (in string server);
+ // Used to tell the Implementation Repository that <server> is shutting
+ // down.
+};
diff --git a/TAO/orbsvcs/tests/ImplRepo/README b/TAO/orbsvcs/tests/ImplRepo/README
new file mode 100644
index 00000000000..d1b16ebf92e
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/README
@@ -0,0 +1,9 @@
+$Id$
+
+In short, stay away for now. This is all work in progress and really
+rough around the edges.
+
+More information about the Implementation Repository can be found in
+TAO/docs.
+
+-Darrell Brunsch <brunsch@cs.wustl.edu> \ No newline at end of file
diff --git a/TAO/orbsvcs/tests/ImplRepo/Simple_Object.idl b/TAO/orbsvcs/tests/ImplRepo/Simple_Object.idl
new file mode 100644
index 00000000000..a6bd9105193
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/Simple_Object.idl
@@ -0,0 +1,16 @@
+// $Id$
+
+interface simple_object
+ // = TITLE
+ // Defines an interface that encapsulates operations that cube
+ // numbers.
+ //
+ // = DESCRIPTION
+ // This interface encapsulates an operation that cubes a long.
+{
+ long simple_method (in long l);
+ // cube a long
+
+ oneway void shutdown ();
+ // shutdown the application.
+};
diff --git a/TAO/orbsvcs/tests/ImplRepo/client.cpp b/TAO/orbsvcs/tests/ImplRepo/client.cpp
new file mode 100644
index 00000000000..2efb54bc69b
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/client.cpp
@@ -0,0 +1,20 @@
+// $Id$
+
+#include "client_impl.h"
+
+// This function runs the test.
+
+int
+main (int argc, char **argv)
+{
+ Client_Impl client;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\n\tSimple_Client\n\n"));
+
+ if (client.init (argc, argv) == -1)
+ return 1;
+ else
+ return client.run ();
+}
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/client.dsp b/TAO/orbsvcs/tests/ImplRepo/client.dsp
new file mode 100644
index 00000000000..bb6b5d30f20
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/client.dsp
@@ -0,0 +1,178 @@
+# Microsoft Developer Studio Project File - Name="ImplRepoTest Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ImplRepoTest Client - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="ImplRepoTest Client - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ImplRepoTest Client - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ImplRepoTest Client - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ImplRepoTest Client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\client\Release"
+# PROP BASE Intermediate_Dir ".\client\Release"
+# PROP BASE Target_Dir ".\client"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ".\client"
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /I "..\..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ELSEIF "$(CFG)" == "ImplRepoTest Client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\client\Debug"
+# PROP BASE Intermediate_Dir ".\client\Debug"
+# PROP BASE Target_Dir ".\client"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ".\client"
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /I "..\..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 aced.lib TAOd.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ImplRepoTest Client - Win32 Release"
+# Name "ImplRepoTest Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\client_impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\client_impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectS_T.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ".idl"
+# Begin Source File
+
+SOURCE=.\Simple_Object.idl
+
+!IF "$(CFG)" == "ImplRepoTest Client - Win32 Release"
+
+# Begin Custom Build
+InputPath=.\Simple_Object.idl
+InputName=Simple_Object
+
+BuildCmds= \
+ ..\..\..\tao_idl\tao_idl $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ImplRepoTest Client - Win32 Debug"
+
+# Begin Custom Build
+InputPath=.\Simple_Object.idl
+InputName=Simple_Object
+
+BuildCmds= \
+ ..\..\..\tao_idl\tao_idl $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/ImplRepo/client_impl.cpp b/TAO/orbsvcs/tests/ImplRepo/client_impl.cpp
new file mode 100644
index 00000000000..c59d8b5c4da
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/client_impl.cpp
@@ -0,0 +1,193 @@
+// $Id$
+
+#include "client_impl.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+
+// Constructor.
+Client_Impl::Client_Impl (void)
+ : server_key_ (ACE_OS::strdup ("key0")),
+ loop_count_ (10),
+ shutdown_ (0),
+ server_ (simple_object::_nil ())
+{
+}
+
+// Reads the Server factory ior from a file
+
+int
+Client_Impl::read_ior (char *filename)
+{
+ // Open the file for reading.
+ ACE_HANDLE f_handle_ = ACE_OS::open (filename, 0);
+
+ if (f_handle_ == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for writing: %p\n",
+ filename),
+ -1);
+ ACE_Read_Buffer ior_buffer (f_handle_);
+ this->server_key_ = ior_buffer.read ();
+
+ if (this->server_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to allocate memory to read ior: %p\n"),
+ -1);
+
+ ACE_OS::close (filename);
+ return 0;
+}
+
+// Parses the command line arguments and returns an error status.
+
+int
+Client_Impl::parse_args (void)
+{
+ ACE_Get_Opt get_opts (argc_, argv_, "dn:f:x");
+ int c;
+ int result;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd': // debug flag
+ TAO_debug_level++;
+ break;
+ case 'n': // loop count
+ this->loop_count_ = (u_int) ACE_OS::atoi (get_opts.optarg);
+ break;
+ case 'f': // read the IOR from the file.
+ result = this->read_ior (get_opts.optarg);
+ if (result < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to read ior from %s : %p\n",
+ get_opts.optarg),
+ -1);
+ break;
+ case 'x':
+ this->shutdown_ = 1;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " [-d]"
+ " [-n loopcount]"
+ " [-f server-obj-ref-key-file]"
+ " [-x]"
+ "\n",
+ this->argv_ [0]),
+ -1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+// calculate the cube from a long
+
+void
+Client_Impl::cube_long (int i)
+{
+ // Cube a long.
+ CORBA::Long ret_long;
+ {
+ ret_long = this->server_->simple_method (i, this->env_);
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "The cube of %d is %d\n", i, ret_long));
+
+ if (this->env_.exception () != 0)
+ {
+ this->env_.print_exception ("from cube_long");
+ }
+ else
+ {
+ CORBA::Long arg_long = i * i * i;
+
+ if (arg_long != ret_long)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "** cube_long (%ld) ERROR (--> %ld)\n",
+ ret_long,
+ arg_long));
+ }
+ }
+}
+
+
+// Execute client example code.
+
+int
+Client_Impl::run ()
+{
+ u_int i;
+
+ for (i = 0; i < this->loop_count_; i++)
+ this->cube_long (i);
+
+ if (this->shutdown_)
+ this->server_->shutdown (this->env_);
+
+ return 0;
+}
+
+Client_Impl::~Client_Impl (void)
+{
+ // Free resources
+ // Close the ior files
+ CORBA::release (this->server_);
+
+ if (this->server_key_ != 0)
+ ACE_OS::free (this->server_key_);
+}
+
+
+int
+Client_Impl::init (int argc, char **argv)
+{
+ this->argc_ = argc;
+ this->argv_ = argv;
+
+ TAO_TRY
+ {
+ // Retrieve the ORB.
+ this->orb_ = CORBA::ORB_init (this->argc_,
+ this->argv_,
+ "internet",
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ // Parse command line and verify parameters.
+ if (this->parse_args () == -1)
+ return -1;
+
+ if (this->server_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s: no server key specified\n",
+ this->argv_[0]),
+ -1);
+
+
+ CORBA::Object_var server_object =
+ this->orb_->string_to_object (this->server_key_, TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ this->server_ = simple_object::_narrow (server_object.in(), TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ if (CORBA::is_nil (server_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid server key <%s>\n",
+ this->server_key_),
+ -1);
+ }
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("Client_Impl::init");
+ return -1;
+ }
+ TAO_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/client_impl.h b/TAO/orbsvcs/tests/ImplRepo/client_impl.h
new file mode 100644
index 00000000000..fc31b78ee86
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/client_impl.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Simple
+//
+// = FILENAME
+// client_impl.h
+//
+// = DESCRIPTION
+// This class implements a simple CORBA client.
+//
+// = AUTHORS
+// Darrell Brunsch <brunsch@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "Simple_ObjectC.h"
+#include "tao/corba.h"
+
+class Client_Impl
+{
+ // = TITLE
+ // Simple Client Implementation
+ //
+ // = DESCRIPTION
+ // Class wrapper for a client which gets the server IOR and then makes
+ // several calls to the server before optionally shutting it down.
+public:
+ // = Constructor and destructor.
+ Client_Impl (void);
+ ~Client_Impl (void);
+
+ int run ();
+ // Execute client example code.
+
+ int init (int argc, char **argv);
+ // Initialize the client communication endpoint with server.
+
+private:
+ int read_ior (char *filename);
+ // Function to read the server ior from a file.
+
+ int parse_args (void);
+ // Parses the arguments passed on the command line.
+
+ void cube_long (int i);
+ // calculate the cube from a long.
+
+ int argc_;
+ // # of arguments on the command line.
+
+ char **argv_;
+ // arguments from command line.
+
+ char *server_key_;
+ // Key of the obj ref of the server.
+
+ u_int loop_count_;
+ // Number of times to do the cube operations.
+
+ int shutdown_;
+ // Flag for server shutdown.
+
+ CORBA::Environment env_;
+ // Environment variable.
+
+ simple_object_ptr server_;
+ // Server object ptr.
+
+ CORBA::ORB_var orb_;
+ // Remember our orb.
+};
diff --git a/TAO/orbsvcs/tests/ImplRepo/implrepo.dsp b/TAO/orbsvcs/tests/ImplRepo/implrepo.dsp
new file mode 100644
index 00000000000..7cafcd8018e
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/implrepo.dsp
@@ -0,0 +1,206 @@
+# Microsoft Developer Studio Project File - Name="ImplRepoTest ImplRepo" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ImplRepoTest ImplRepo - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "implrepo.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "implrepo.mak" CFG="ImplRepoTest ImplRepo - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ImplRepoTest ImplRepo - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ImplRepoTest ImplRepo - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ImplRepoTest ImplRepo - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\implrepo\Release"
+# PROP BASE Intermediate_Dir ".\implrepo\Release"
+# PROP BASE Target_Dir ".\implrepo"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ".\server"
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /I "..\..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib /nologo /subsystem:console /machine:I386 /out:"Impl_Repo.exe" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ELSEIF "$(CFG)" == "ImplRepoTest ImplRepo - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\implrepo\Debug"
+# PROP BASE Intermediate_Dir ".\implrepo\Debug"
+# PROP BASE Target_Dir ".\implrepo"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ".\server"
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /I "..\..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 aced.lib TAOd.lib /nologo /subsystem:console /debug /machine:I386 /out:"Impl_Repo.exe" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+# SUBTRACT LINK32 /profile
+
+!ENDIF
+
+# Begin Target
+
+# Name "ImplRepoTest ImplRepo - Win32 Release"
+# Name "ImplRepoTest ImplRepo - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\Impl_RepoC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Impl_RepoS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ir_server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ir_server_impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ir_simple_object_impl.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\Impl_RepoS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ir_server_impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ir_simple_object_impl.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ".idl"
+# Begin Source File
+
+SOURCE=.\Impl_Repo.idl
+
+!IF "$(CFG)" == "ImplRepoTest ImplRepo - Win32 Release"
+
+# Begin Custom Build
+InputPath=.\Impl_Repo.idl
+InputName=Impl_Repo
+
+BuildCmds= \
+ ..\..\..\tao_idl\tao_idl $(InputName).idl
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ImplRepoTest ImplRepo - Win32 Debug"
+
+# Begin Custom Build
+InputPath=.\Impl_Repo.idl
+InputName=Impl_Repo
+
+BuildCmds= \
+ ..\..\..\tao_idl\tao_idl $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/ImplRepo/ir_server.cpp b/TAO/orbsvcs/tests/ImplRepo/ir_server.cpp
new file mode 100644
index 00000000000..e4e2f11d879
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/ir_server.cpp
@@ -0,0 +1,35 @@
+// $Id$
+
+#include "ir_server_impl.h"
+
+int
+main (int argc, char *argv[])
+{
+ IR_Server_Impl server;
+
+ ACE_DEBUG ((LM_DEBUG, "\n\tImplementation Repository\n\n"));
+ TAO_TRY
+ {
+ if (server.init (argc, argv, TAO_TRY_ENV) == -1)
+ return 1;
+ else
+ {
+ server.run (TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ }
+ }
+ TAO_CATCH (CORBA::SystemException, sysex)
+ {
+ ACE_UNUSED_ARG (sysex);
+ TAO_TRY_ENV.print_exception ("System Exception");
+ return -1;
+ }
+ TAO_CATCH (CORBA::UserException, userex)
+ {
+ ACE_UNUSED_ARG (userex);
+ TAO_TRY_ENV.print_exception ("User Exception");
+ return -1;
+ }
+ TAO_ENDTRY;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/ir_server_impl.cpp b/TAO/orbsvcs/tests/ImplRepo/ir_server_impl.cpp
new file mode 100644
index 00000000000..54df31ad199
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/ir_server_impl.cpp
@@ -0,0 +1,145 @@
+// $Id$
+
+#include "ir_server_impl.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+
+
+IR_Server_Impl::IR_Server_Impl (void)
+ : ior_output_file_ (0),
+ server_key_ (0),
+ server_impl_ (0)
+{
+}
+
+// Reads the Server factory ior from a file
+
+int
+IR_Server_Impl::read_ior (char *filename)
+{
+ // Open the file for reading.
+ ACE_HANDLE f_handle_ = ACE_OS::open (filename, 0);
+
+ if (f_handle_ == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for writing: %p\n",
+ filename),
+ -1);
+ ACE_Read_Buffer ior_buffer (f_handle_);
+ this->server_key_ = ior_buffer.read ();
+
+ if (this->server_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to allocate memory to read ior: %p\n"),
+ -1);
+
+ ACE_OS::close (filename);
+ return 0;
+}
+
+int
+IR_Server_Impl::parse_args (void)
+{
+ ACE_Get_Opt get_opts (this->argc_, this->argv_, "df:o:");
+ int c;
+ int result;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd': // debug flag.
+ TAO_debug_level++;
+ break;
+ case 'o': // output the IOR to a file.
+ this->ior_output_file_ = ACE_OS::fopen (get_opts.optarg, "w");
+ if (this->ior_output_file_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for writing: %p\n",
+ get_opts.optarg), -1);
+ break;
+ case 'f': // read the IOR from the file.
+ result = this->read_ior (get_opts.optarg);
+ if (result < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to read ior from %s : %p\n",
+ get_opts.optarg),
+ -1);
+ break;
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " [-d]"
+ " [-f] <server_ior_file>"
+ " [-o] <ior_output_file>"
+ "\n",
+ argv_ [0]),
+ 1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+int
+IR_Server_Impl::init (int argc, char** argv, CORBA::Environment& env)
+{
+ // Call the init of <TAO_ORB_Manager> to initialize the ORB and
+ // create a child POA under the root POA.
+ if (this->orb_manager_.init_child_poa (argc, argv, "child_poa", env) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "init_child_poa"), -1);
+
+ TAO_CHECK_ENV_RETURN (env, -1);
+
+ this->argc_ = argc;
+ this->argv_ = argv;
+
+ int retval = this->parse_args ();
+
+ if (retval != 0)
+ return retval;
+
+ CORBA::Object_var server_object =
+ this->orb_manager_.orb ()->string_to_object (this->server_key_, env);
+/*
+ this->server_ = simple_object::_narrow (server_object.in(), env);
+
+ if (CORBA::is_nil (server_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid server key <%s>\n",
+ this->server_key_),
+ -1);
+*/
+
+ this->server_impl_ = new IR_Simple_Impl (this->orb_manager_.orb (),
+ this->orb_manager_.child_poa (),
+ server_object.in ());
+
+ CORBA::String_var str =
+ this->orb_manager_.activate_under_child_poa ("server",
+ this->server_impl_,
+ env);
+ ACE_DEBUG ((LM_DEBUG, "The IOR is: <%s>\n", str.in ()));
+
+ if (this->ior_output_file_)
+ {
+ ACE_OS::fprintf (this->ior_output_file_, "%s", str.in ());
+ ACE_OS::fclose (this->ior_output_file_);
+ }
+
+ return 0;
+}
+
+int
+IR_Server_Impl::run (CORBA::Environment& env)
+{
+ if (this->orb_manager_.run (env) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "IR_Server_Impl::run"), -1);
+ return 0;
+}
+
+IR_Server_Impl::~IR_Server_Impl (void)
+{
+ if (this->server_impl_ != 0)
+ delete server_impl_;
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/ir_server_impl.h b/TAO/orbsvcs/tests/ImplRepo/ir_server_impl.h
new file mode 100644
index 00000000000..7e88dd4d0d0
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/ir_server_impl.h
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Simple
+//
+// = FILENAME
+// ir_server_impl.h
+//
+// = DESCRIPTION
+// Class which implements a CORBA server which sets up the simple object
+// implementation and the orb.
+//
+// = AUTHORS
+// Darrell Brunsch <brunsch@cs.wustl.edu>
+//
+// ============================================================================
+
+#if !defined (IR_SERVER_IMPL_H)
+#define IR_SERVER_IMPL_H
+
+#include "ir_simple_object_impl.h"
+#include "tao/TAO.h"
+
+class IR_Server_Impl
+{
+ // = TITLE
+ // CORBA Server Implementation
+ //
+ // = DESCRIPTION
+ //
+public:
+ // = Initialization and termination methods.
+ IR_Server_Impl (void);
+ // Default constructor
+
+ ~IR_Server_Impl (void);
+ // Destructor
+
+ int init (int argc, char **argv, CORBA::Environment& env);
+ // Initialize the Server state - parsing arguments and waiting
+
+ int run (CORBA::Environment& env);
+ // Run the orb
+
+private:
+ IR_Simple_Impl *server_impl_;
+
+ int parse_args (void);
+ // Parses the commandline arguments.
+
+ int read_ior (char *filename);
+ // Reads the IOR of the real server from the file
+
+ TAO_ORB_Manager orb_manager_;
+ // The ORB manager.
+
+ FILE *ior_output_file_;
+ // File where the IOR of the server object is stored.
+
+ char *server_key_;
+ // Key of the obj ref of the server.
+
+ int argc_;
+ // Number of command line arguments.
+
+ char **argv_;
+ // The command line arguments.
+};
+
+#endif /* IR_SERVER_IMPL_H */
diff --git a/TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.cpp b/TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.cpp
new file mode 100644
index 00000000000..eef124d706e
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.cpp
@@ -0,0 +1,75 @@
+// $Id$
+
+#include "ir_simple_object_impl.h"
+#include "tao/corba.h"
+
+// Constructor
+IR_Simple_Impl::IR_Simple_Impl (CORBA::ORB_ptr orb_ptr,
+ PortableServer::POA_ptr poa_ptr,
+ CORBA::Object_ptr forward_to_ptr)
+ : orb_var_ (CORBA::ORB::_duplicate (orb_ptr)),
+ poa_var_ (PortableServer::POA::_duplicate (poa_ptr)),
+ forward_to_var_ (CORBA::Object::_duplicate (forward_to_ptr))
+{
+ if (CORBA::is_nil (this->forward_to_var_))
+ ACE_DEBUG ((LM_DEBUG, "Forward_to is nil!\n"));
+}
+
+// Destructor
+
+IR_Simple_Impl::~IR_Simple_Impl (void)
+{
+}
+
+// Cube a long
+
+CORBA::Long
+IR_Simple_Impl::simple_method (CORBA::Long l, CORBA::Environment &env)
+{
+ if (!CORBA::is_nil (this->forward_to_var_.in ()))
+ {
+ ACE_DEBUG ((LM_DEBUG, "Forwarding...\n"));
+
+ PortableServer::ObjectId_var oid =
+ this->poa_var_->servant_to_id (this, env);
+
+ if (env.exception () != 0)
+ return -1;
+
+ PortableServer::Servant servant = this->poa_var_->_servant ();
+ if (servant == 0)
+ {
+// CORBA::Exception *exception = new Foo::Cannot_Forward;
+// env.exception (exception);
+ return -1;
+ }
+
+ void *ptr = servant->_downcast ("IDL:PortableServer/POA:1.0");
+ POA_PortableServer::POA *poa = (POA_PortableServer::POA *) ptr;
+ TAO_POA *tao_poa = ACE_dynamic_cast (TAO_POA *, poa);
+
+ tao_poa->forward_object (oid.in (),
+ this->forward_to_var_.in (),
+ env);
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "Forward_to refenence is nil.\n"));
+// CORBA::Exception *exception = new Foo::Cannot_Forward;
+// env.exception (exception);
+ return -1;
+ }
+ return 0;
+}
+
+// Shutdown.
+
+void IR_Simple_Impl::shutdown (CORBA::Environment &env)
+{
+ ACE_UNUSED_ARG (env);
+
+ ACE_DEBUG ((LM_DEBUG, "%s\n", "IR_Simple_Impl is shutting down"));
+
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+}
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.h b/TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.h
new file mode 100644
index 00000000000..a310f1476a7
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/ir_simple_object_impl.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Simple
+//
+// = FILENAME
+// simple_object_impl.h
+//
+// = DESCRIPTION
+// This class implements the Simple Object object.
+//
+// = AUTHOR
+// Darrell Brunsch <brunsch@cs.wustl.edu>
+//
+// ============================================================================
+
+#if !defined (IR_SIMPLE_OBJECT_IMPL_H)
+#define IR_SIMPLE_OBJECT_IMPL_H
+
+#include "Impl_RepoS.h"
+
+// Forward declarations.
+class IR_Simple_Impl;
+
+// Typedefs.
+typedef IR_Simple_Impl *IR_Simple_Impl_ptr;
+typedef IR_Simple_Impl_ptr IR_Simple_Impl_ref;
+
+class IR_Simple_Impl: public POA_simple_object
+{
+ // = TITLE
+ // Simple Object Implementation
+ //
+ // = DESCRIPTION
+ // Implementation of a simple object that has two methods, one that
+ // returns the cube of a long, another that shuts down the server.
+public:
+ IR_Simple_Impl (CORBA::ORB_ptr orb_ptr,
+ PortableServer::POA_ptr poa_ptr,
+ CORBA::Object_ptr forward_to_ptr);
+ // Constructor
+
+ ~IR_Simple_Impl (void);
+ // Destructor
+
+ virtual CORBA::Long simple_method (CORBA::Long l,
+ CORBA::Environment &env);
+ // Just cubes the long parameter
+
+ virtual void shutdown (CORBA::Environment &env);
+ // Shutdown routine.
+
+ CORBA::ORB_var orb_var_;
+ PortableServer::POA_var poa_var_;
+ CORBA::Object_var forward_to_var_;
+};
+
+
+#endif /* IR_SIMPLE_OBJECT_IMPL_H */
diff --git a/TAO/orbsvcs/tests/ImplRepo/server.cpp b/TAO/orbsvcs/tests/ImplRepo/server.cpp
new file mode 100644
index 00000000000..7fa1f5130bb
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/server.cpp
@@ -0,0 +1,35 @@
+// $Id$
+
+#include "server_impl.h"
+
+int
+main (int argc, char *argv[])
+{
+ Server_Impl server;
+
+ ACE_DEBUG ((LM_DEBUG, "\n\tSimple_Server\n\n"));
+ TAO_TRY
+ {
+ if (server.init (argc, argv, TAO_TRY_ENV) == -1)
+ return 1;
+ else
+ {
+ server.run (TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ }
+ }
+ TAO_CATCH (CORBA::SystemException, sysex)
+ {
+ ACE_UNUSED_ARG (sysex);
+ TAO_TRY_ENV.print_exception ("System Exception");
+ return -1;
+ }
+ TAO_CATCH (CORBA::UserException, userex)
+ {
+ ACE_UNUSED_ARG (userex);
+ TAO_TRY_ENV.print_exception ("User Exception");
+ return -1;
+ }
+ TAO_ENDTRY;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/server.dsp b/TAO/orbsvcs/tests/ImplRepo/server.dsp
new file mode 100644
index 00000000000..0ff52675d5a
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/server.dsp
@@ -0,0 +1,200 @@
+# Microsoft Developer Studio Project File - Name="ImplRepoTest Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ImplRepoTest Server - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak" CFG="ImplRepoTest Server - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ImplRepoTest Server - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ImplRepoTest Server - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ImplRepoTest Server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\server\Release"
+# PROP BASE Intermediate_Dir ".\server\Release"
+# PROP BASE Target_Dir ".\server"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ".\server"
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /I "..\..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ELSEIF "$(CFG)" == "ImplRepoTest Server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\server\Debug"
+# PROP BASE Intermediate_Dir ".\server\Debug"
+# PROP BASE Target_Dir ".\server"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ".\server"
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /I "..\..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 aced.lib TAOd.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ImplRepoTest Server - Win32 Release"
+# Name "ImplRepoTest Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\server_impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\simple_object_impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\server.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\server_impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\simple_object_impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple_ObjectS.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ".idl"
+# Begin Source File
+
+SOURCE=.\Simple_Object.idl
+
+!IF "$(CFG)" == "ImplRepoTest Server - Win32 Release"
+
+# Begin Custom Build
+InputPath=.\Simple_Object.idl
+InputName=Simple_Object
+
+BuildCmds= \
+ ..\..\..\tao_idl\tao_idl $(InputName).idl
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "ImplRepoTest Server - Win32 Debug"
+
+# Begin Custom Build
+InputPath=.\Simple_Object.idl
+InputName=Simple_Object
+
+BuildCmds= \
+ ..\..\..\tao_idl\tao_idl $(InputName).idl
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/ImplRepo/server_impl.cpp b/TAO/orbsvcs/tests/ImplRepo/server_impl.cpp
new file mode 100644
index 00000000000..9dd72b0f359
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/server_impl.cpp
@@ -0,0 +1,88 @@
+// $Id$
+
+#include "server_impl.h"
+#include "ace/Get_Opt.h"
+
+Server_Impl::Server_Impl (void)
+ : ior_output_file_ (0)
+{
+}
+
+int
+Server_Impl::parse_args (void)
+{
+ ACE_Get_Opt get_opts (this->argc_, this->argv_, "do:f:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd': // debug flag.
+ TAO_debug_level++;
+ break;
+ case 'o': // output the IOR to a file.
+ this->ior_output_file_ = ACE_OS::fopen (get_opts.optarg, "w");
+ if (this->ior_output_file_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for writing: %p\n",
+ get_opts.optarg), -1);
+ break;
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " [-d]"
+ " [-o] <ior_output_file>"
+ "\n",
+ argv_ [0]),
+ 1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+int
+Server_Impl::init (int argc, char** argv, CORBA::Environment& env)
+{
+ // Call the init of <TAO_ORB_Manager> to initialize the ORB and
+ // create a child POA under the root POA.
+ if (this->orb_manager_.init_child_poa (argc, argv, "child_poa", env) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "init_child_poa"), -1);
+
+ TAO_CHECK_ENV_RETURN (env, -1);
+
+ this->argc_ = argc;
+ this->argv_ = argv;
+
+ int retval = this->parse_args ();
+
+ if (retval != 0)
+ return retval;
+
+ CORBA::String_var str =
+ this->orb_manager_.activate_under_child_poa ("server",
+ &this->server_impl,
+ env);
+ ACE_DEBUG ((LM_DEBUG, "The IOR is: <%s>\n", str.in ()));
+
+ if (this->ior_output_file_)
+ {
+ ACE_OS::fprintf (this->ior_output_file_, "%s", str.in ());
+ ACE_OS::fclose (this->ior_output_file_);
+ }
+
+ return 0;
+}
+
+int
+Server_Impl::run (CORBA::Environment& env)
+{
+ if (this->orb_manager_.run (env) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "Server_Impl::run"), -1);
+ return 0;
+}
+
+Server_Impl::~Server_Impl (void)
+{
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/server_impl.h b/TAO/orbsvcs/tests/ImplRepo/server_impl.h
new file mode 100644
index 00000000000..1c279c16416
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/server_impl.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Simple
+//
+// = FILENAME
+// server_impl.h
+//
+// = DESCRIPTION
+// Class which implements a CORBA server which sets up the simple object
+// implementation and the orb.
+//
+// = AUTHORS
+// Darrell Brunsch <brunsch@cs.wustl.edu>
+//
+// ============================================================================
+
+#if !defined (SERVER_IMPL_H)
+#define SERVER_IMPL_H
+
+#include "simple_object_impl.h"
+#include "tao/TAO.h"
+
+class Server_Impl
+{
+ // = TITLE
+ // CORBA Server Implementation
+ //
+ // = DESCRIPTION
+ //
+public:
+ // = Initialization and termination methods.
+ Server_Impl (void);
+ // Default constructor
+
+ ~Server_Impl (void);
+ // Destructor
+
+ int init (int argc, char **argv, CORBA::Environment& env);
+ // Initialize the Server state - parsing arguments and waiting
+
+ int run (CORBA::Environment& env);
+ // Run the orb
+
+private:
+ Simple_Impl server_impl;
+
+ int parse_args (void);
+ // Parses the commandline arguments.
+
+ TAO_ORB_Manager orb_manager_;
+ // The ORB manager.
+
+ FILE *ior_output_file_;
+ // File where the IOR of the server object is stored.
+
+ int argc_;
+ // Number of command line arguments.
+
+ char **argv_;
+ // The command line arguments.
+};
+
+#endif /* SERVER_IMPL_H */
diff --git a/TAO/orbsvcs/tests/ImplRepo/simple_object_impl.cpp b/TAO/orbsvcs/tests/ImplRepo/simple_object_impl.cpp
new file mode 100644
index 00000000000..9305a8d42d6
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/simple_object_impl.cpp
@@ -0,0 +1,39 @@
+// $Id$
+
+#include "simple_object_impl.h"
+#include "tao/corba.h"
+
+// Constructor
+
+Simple_Impl::Simple_Impl (const char *)
+{
+}
+
+
+// Destructor
+
+Simple_Impl::~Simple_Impl (void)
+{
+}
+
+// Cube a long
+
+CORBA::Long
+Simple_Impl::simple_method (CORBA::Long l, CORBA::Environment &env)
+{
+ ACE_DEBUG ((LM_DEBUG, "Simple Method\n"));
+ ACE_UNUSED_ARG (env);
+ return l * l * l;
+}
+
+// Shutdown.
+
+void Simple_Impl::shutdown (CORBA::Environment &env)
+{
+ ACE_UNUSED_ARG (env);
+
+ ACE_DEBUG ((LM_DEBUG, "%s\n", "Simple_Impl is shutting down"));
+
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+}
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/simple_object_impl.h b/TAO/orbsvcs/tests/ImplRepo/simple_object_impl.h
new file mode 100644
index 00000000000..a65523d12dc
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/simple_object_impl.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Simple
+//
+// = FILENAME
+// simple_object_impl.h
+//
+// = DESCRIPTION
+// This class implements the Simple Object object.
+//
+// = AUTHOR
+// Darrell Brunsch <brunsch@cs.wustl.edu>
+//
+// ============================================================================
+
+#if !defined (SIMPLE_OBJECT_IMPL_H)
+#define SIMPLE_OBJECT_IMPL_H
+
+#include "Simple_ObjectS.h"
+
+// Forward declarations.
+class Simple_Impl;
+
+// Typedefs.
+typedef Simple_Impl *Simple_Impl_ptr;
+typedef Simple_Impl_ptr Simple_Impl_ref;
+
+class Simple_Impl: public POA_simple_object
+{
+ // = TITLE
+ // Simple Object Implementation
+ //
+ // = DESCRIPTION
+ // Implementation of a simple object that has two methods, one that
+ // returns the cube of a long, another that shuts down the server.
+public:
+ Simple_Impl (const char *obj_name = 0);
+ // Constructor
+
+ ~Simple_Impl (void);
+ // Destructor
+
+ virtual CORBA::Long simple_method (CORBA::Long l,
+ CORBA::Environment &env);
+ // Just cubes the long parameter
+
+ virtual void shutdown (CORBA::Environment &env);
+ // Shutdown routine.
+};
+
+
+#endif /* SIMPLE_OBJECT_IMPL_H */
diff --git a/TAO/orbsvcs/tests/ImplRepo/svc.conf b/TAO/orbsvcs/tests/ImplRepo/svc.conf
new file mode 100644
index 00000000000..6eee002c688
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/svc.conf
@@ -0,0 +1,49 @@
+# $Id$
+#
+# This file contains a sample ACE_Service_Config configuration
+# file specifying the strategy factories utilized by an application
+# using TAO. There are currently only two possible factories:
+# Client_Strategy_Factory and Server_Strategy_Factory. These names
+# must be used as the second argument to their corresponding line,
+# because that's what the ORB uses to find the desired factory.
+#
+# Note that there are two unordinary characteristics of the way *this*
+# file is set up:
+# - both client and server strategies are specified in the same
+# file, which would only make sense for co-located clients & servers
+# - both of the factories are actually sourced out of libTAO.so
+# (TAO.DLL on Win32), and they would normally be in a separate
+# dll from the TAO ORB Core.
+#
+# The options which can be passed to the Resource Factory are:
+#
+# -ORBresources <which>
+# where <which> can be 'global' to specify globally-held resources,
+# or 'tss' to specify thread-specific resources.
+#
+# The options which can be passed to the Client are:
+# <none currently>
+#
+# The options which can be passed to the Server are:
+#
+# -ORBconcurrency <which>
+# where <which> can be 'thread-per-connection' to specify
+# use of the ACE_Threaded_Strategy concurrency strategy,
+# or 'reactive' to specify use of the ACE_Reactive_Strategy
+# concurrency strategy.
+#
+# -ORBthreadflags <flags>
+# specifies the default thread flags to use, where <flags> is a
+# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP,
+# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid
+# on every platform.
+#
+# -ORBdemuxstrategy <which>
+# where <which> can be one of 'dynamic', 'linear', 'active', or 'user',
+# and specifies the type of object lookup strategy used internally.
+# -ORBtablesize <unsigned>
+# specifies the size of the object table
+#
+dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources tss"
+dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory()
+dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128"