summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-12 22:24:16 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-12 22:24:16 +0000
commit04500f0f70496686c9c316c169f1648e06427cfc (patch)
treecd8c138ddb7ace6cf73e717ca3bbdaea22271bea
parentf5a5e479a712bef0eb49ebb62ba0f2804a978935 (diff)
downloadATCD-04500f0f70496686c9c316c169f1648e06427cfc.tar.gz
Added the new Nestea Bookshelf test.
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/Nestea.idl16
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_client.cpp21
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_client.dsp208
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp155
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_client_i.h69
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp105
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_server.cpp37
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_server.dsp224
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp175
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h80
10 files changed, 1090 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/ImplRepo/Nestea.idl b/TAO/orbsvcs/tests/ImplRepo/Nestea.idl
new file mode 100644
index 00000000000..0be9ee1e792
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/Nestea.idl
@@ -0,0 +1,16 @@
+// $Id$
+
+interface Nestea_Bookshelf
+{
+ void drink (in long cans);
+ // Add a number of cans to the bookshelf.
+
+ void crush (in long cans);
+ // Crush some of those cans.
+
+ long bookshelf_size ();
+ // How many cans are in the collection?
+
+ string get_praise ();
+ // What does the server think of your collection?
+};
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_client.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_client.cpp
new file mode 100644
index 00000000000..03e00c6bdd6
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_client.cpp
@@ -0,0 +1,21 @@
+// $Id$
+
+#include "nestea_client_i.h"
+
+ACE_RCSID(ImplRepo, nestea_client, "$Id$")
+
+// This function runs the test.
+
+int
+main (int argc, char **argv)
+{
+ Nestea_Client_i client;
+
+ ACE_DEBUG ((LM_DEBUG, "\n\tNestea Bookshelf Client\n\n"));
+
+ if (client.init (argc, argv) == -1)
+ return 1;
+ else
+ return client.run ();
+}
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_client.dsp b/TAO/orbsvcs/tests/ImplRepo/nestea_client.dsp
new file mode 100644
index 00000000000..88780a43145
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_client.dsp
@@ -0,0 +1,208 @@
+# Microsoft Developer Studio Project File - Name="Nestea Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Nestea Client - Win32 Debug
+!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 "nestea_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 "nestea_client.mak" CFG="Nestea Client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Nestea Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Nestea Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Nestea Client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# 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 ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /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 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)" == "Nestea Client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /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 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 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Nestea Client - Win32 Release"
+# Name "Nestea Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\nestea_client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\nestea_client_i.cpp
+# End Source File
+# End Group
+# Begin Group "Generated Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\NesteaC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NesteaS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\nestea_client_i.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\Nestea.idl
+
+!IF "$(CFG)" == "Nestea Client - Win32 Release"
+
+USERDEP__AIRPL="..\..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Nestea.idl
+InputName=Nestea
+
+BuildCmds= \
+ ..\..\..\..\bin\Release\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
+
+!ELSEIF "$(CFG)" == "Nestea Client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__AIRPL="..\..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Nestea.idl
+InputName=Nestea
+
+BuildCmds= \
+ ..\..\..\..\bin\tao_idl -Gi $(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/nestea_client_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp
new file mode 100644
index 00000000000..b8b47a28d8b
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp
@@ -0,0 +1,155 @@
+// $Id$
+
+#include "nestea_client_i.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+
+ACE_RCSID(ImplRepo, nestea_client_i, "$Id$")
+
+// Constructor.
+Nestea_Client_i::Nestea_Client_i (void)
+ : server_key_ (ACE_OS::strdup ("key0")),
+ server_ (Nestea_Bookshelf::_nil ())
+{
+}
+
+// Reads the Server factory ior from a file
+
+int
+Nestea_Client_i::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 (f_handle_);
+ return 0;
+}
+
+// Parses the command line arguments and returns an error status.
+
+int
+Nestea_Client_i::parse_args (void)
+{
+ ACE_Get_Opt get_opts (argc_, argv_, "dn:k:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd': // debug flag
+ TAO_debug_level++;
+ break;
+ case 'k': // ior provide on command line
+ this->server_key_ = ACE_OS::strdup (get_opts.optarg);
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " [-d]"
+ " [-n loopcount]"
+ " [-k server-object-key]"
+ "\n",
+ this->argv_ [0]),
+ -1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+// Execute client example code.
+
+int
+Nestea_Client_i::run ()
+{
+ this->server_->drink (40);
+ this->server_->drink (100);
+
+ ACE_DEBUG ((LM_DEBUG, "Cans: %d\n"
+ "Praise: %s\n",
+ this->server_->bookshelf_size (),
+ this->server_->get_praise ()));
+
+ this->server_->drink (500);
+ this->server_->crush (200);
+
+ ACE_DEBUG ((LM_DEBUG, "Cans: %d\n"
+ "Praise: %s\n",
+ this->server_->bookshelf_size (),
+ this->server_->get_praise ()));
+
+ return 0;
+}
+
+Nestea_Client_i::~Nestea_Client_i (void)
+{
+ // Free resources
+ // Close the ior files
+ CORBA::release (this->server_);
+
+ if (this->server_key_ != 0)
+ delete this->server_key_;
+}
+
+
+int
+Nestea_Client_i::init (int argc, char **argv)
+{
+ this->argc_ = argc;
+ this->argv_ = argv;
+
+ ACE_TRY_NEW_ENV
+ {
+ // Retrieve the ORB.
+ this->orb_ = CORBA::ORB_init (this->argc_,
+ this->argv_,
+ "internet",
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // 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_, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ this->server_ = Nestea_Bookshelf::_narrow (server_object.in(), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid server key <%s>\n",
+ this->server_key_),
+ -1);
+ }
+ ACE_CATCHANY
+ {
+ ACE_TRY_ENV.print_exception ("Nestea_Client_i::init");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.h b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.h
new file mode 100644
index 00000000000..5a428183d36
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.h
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests/ImplRepo
+//
+// = FILENAME
+// nestea_client_i.h
+//
+// = DESCRIPTION
+// This class implements a simple CORBA client which controls a Nestea
+// can database
+//
+// = AUTHORS
+// Darrell Brunsch <brunsch@cs.wustl.edu>
+//
+// ============================================================================
+
+#if !defined (NESTEA_CLIENT_I_H)
+#define NESTEA_CLIENT_I_H
+
+#include "tao/corba.h"
+#include "NesteaC.h"
+
+class Nestea_Client_i
+{
+ // = TITLE
+ // Nestea Bookshelf Client Implementation
+ //
+ // = DESCRIPTION
+ // Class wrapper for a client which gets the server IOR and then makes
+ // a couple of calls to the server.
+public:
+ // = Constructor and destructor.
+ Nestea_Client_i (void);
+ ~Nestea_Client_i (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.
+
+ 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.
+
+ Nestea_Bookshelf_ptr server_;
+ // Server object ptr.
+
+ CORBA::ORB_var orb_;
+ // Remember our orb.
+};
+
+#endif /* Nestea_CLIENT_I_H */
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp
new file mode 100644
index 00000000000..f3a3e842654
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp
@@ -0,0 +1,105 @@
+// $Id$
+
+#include "time.h"
+#include "nestea_i.h"
+#include "tao/corba.h"
+
+ACE_RCSID(ImplRepo, nestea_i, "$Id$")
+
+// Constructor
+
+Nestea_i::Nestea_i (int shutdown)
+: shutdown_ (shutdown),
+ cans_ (0)
+{
+}
+
+
+// Destructor
+
+Nestea_i::~Nestea_i (void)
+{
+ // Nothing
+}
+
+
+// Add <cans> number of cans to the bookshelf.
+
+void
+Nestea_i::drink (CORBA::Long cans,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::drink %d cans\n", cans));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ this->cans_ += cans;
+}
+
+
+// Removes <cans> number of cans from the bookshelf.
+
+void
+Nestea_i::crush (CORBA::Long cans,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::crush %d cans\n", cans));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ this->cans_ -= cans;
+
+ // Don't go below 0.
+ if (this->cans_ < 0)
+ this->cans_ = 0;
+}
+
+
+// Returns the number of cans in the bookshelf.
+
+CORBA::Long
+Nestea_i::bookshelf_size (CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::bookshelf_size\n"));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ return this->cans_;
+}
+
+// Returns comments about your collection.
+
+char *
+Nestea_i::get_praise (CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::get_praise\n"));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ if (this->cans_ > 500)
+ return CORBA::string_dup ("Man, that is one excellent Nestea Collection!");
+ else if (this->cans_ > 250)
+ return CORBA::string_dup ("We are getting into the big leagues now!");
+ else if (this->cans_ > 100)
+ return CORBA::string_dup ("Things are looking up!");
+ else if (this->cans_ > 0)
+ return CORBA::string_dup ("Well, it is a start. Drink more Nestea!");
+ else
+ return CORBA::string_dup ("No cans, no praise.");
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_server.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_server.cpp
new file mode 100644
index 00000000000..e78110f1e48
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_server.cpp
@@ -0,0 +1,37 @@
+// $Id$
+
+#include "nestea_server_i.h"
+
+ACE_RCSID(ImplRepo, nestea_server, "$Id$")
+
+int
+main (int argc, char *argv[])
+{
+ Nestea_Server_i server;
+
+ ACE_DEBUG ((LM_DEBUG, "\n\tPaper Nestea 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/nestea_server.dsp b/TAO/orbsvcs/tests/ImplRepo/nestea_server.dsp
new file mode 100644
index 00000000000..72be10ec8c5
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_server.dsp
@@ -0,0 +1,224 @@
+# Microsoft Developer Studio Project File - Name="Nestea Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Nestea Server - Win32 Debug
+!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 "nestea_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 "nestea_server.mak" CFG="Nestea Server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Nestea Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Nestea Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Nestea Server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# 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 ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\..\\" /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /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 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 orbsvcs.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\orbsvcs" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ELSEIF "$(CFG)" == "Nestea Server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\\" /I "..\..\..\\" /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /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 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 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib orbsvcsd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\orbsvcs" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Nestea Server - Win32 Release"
+# Name "Nestea Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\nestea_i.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\nestea_server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\nestea_server_i.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\IR_Helper.cpp
+# End Source File
+# End Group
+# Begin Group "Generated Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\NesteaC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NesteaS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\nestea_i.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nestea_server_i.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\IR_Helper.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\Nestea.idl
+
+!IF "$(CFG)" == "Nestea Server - Win32 Release"
+
+USERDEP__AIRPL="..\..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Nestea.idl
+InputName=Nestea
+
+BuildCmds= \
+ ..\..\..\..\bin\Release\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
+
+!ELSEIF "$(CFG)" == "Nestea Server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__AIRPL="..\..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\Nestea.idl
+InputName=Nestea
+
+BuildCmds= \
+ ..\..\..\..\bin\tao_idl -Gi $(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/nestea_server_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp
new file mode 100644
index 00000000000..bb1f5982972
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.cpp
@@ -0,0 +1,175 @@
+// $Id$
+
+#include "nestea_server_i.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+
+ACE_RCSID(ImplRepo, nestea_server_i, "$Id$")
+
+Nestea_Server_i::Nestea_Server_i (void)
+ : server_impl_ (0),
+ ior_output_file_ (0),
+ ir_helper_ (0),
+ register_with_ir_ (0),
+ use_ir_ (0)
+{
+ // Nothing
+}
+
+int
+Nestea_Server_i::parse_args (void)
+{
+ ACE_Get_Opt get_opts (this->argc_, this->argv_, "do:ir");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd': // debug flag.
+ TAO_debug_level++;
+ break;
+ case 'r': // Register restart information with the IR.
+ this->register_with_ir_ = 1;
+ break;
+ case 'i': // Use the IR
+ this->use_ir_ = 1;
+ 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]"
+ " [-i]"
+ " [-r]"
+ " [-o] <ior_output_file>"
+ "\n",
+ argv_ [0]),
+ 1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+int
+Nestea_Server_i::init (int argc, char** argv, CORBA::Environment& TAO_IN_ENV)
+{
+ char poa_name[] = "nestea_server";
+
+ TAO_TRY
+ {
+ // 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, poa_name, TAO_TRY_ENV) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "init_child_poa"), -1);
+
+ TAO_CHECK_ENV;
+
+ this->argc_ = argc;
+ this->argv_ = argv;
+
+ int retval = this->parse_args ();
+
+ if (retval != 0)
+ return retval;
+
+ ACE_NEW_RETURN (this->server_impl_, Nestea_i (this->use_ir_), -1);
+
+ CORBA::String_var server_str =
+ this->orb_manager_.activate_under_child_poa ("server",
+ this->server_impl_,
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ if (this->use_ir_ == 1)
+ {
+ ACE_NEW_RETURN (this->ir_helper_, IR_Helper (poa_name,
+ this->orb_manager_.child_poa (),
+ this->orb_manager_.orb (),
+ TAO_debug_level),
+ -1);
+
+ if (this->register_with_ir_ == 1)
+ this->ir_helper_->register_server ("nestea_server -i");
+ }
+
+ PortableServer::ObjectId_var id =
+ PortableServer::string_to_ObjectId ("server");
+
+ CORBA::Object_var server_obj =
+ this->orb_manager_.child_poa ()->id_to_reference (id.in (),
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ if (this->use_ir_ == 1)
+ {
+ this->ir_helper_->change_object (server_obj, TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ }
+
+ server_str =
+ this->orb_manager_.orb ()->object_to_string (server_obj.in (),
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "The IOR is: <%s>\n", server_str.in ()));
+
+ if (this->ior_output_file_)
+ {
+ ACE_OS::fprintf (this->ior_output_file_, "%s", server_str.in ());
+ ACE_OS::fclose (this->ior_output_file_);
+ }
+ }
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("Nestea_i::init");
+ TAO_RETHROW_RETURN (-1);
+ }
+ TAO_ENDTRY;
+
+ return 0;
+}
+
+int
+Nestea_Server_i::run (CORBA::Environment& env)
+{
+ TAO_TRY
+ {
+ if (this->use_ir_ == 1)
+ {
+ this->ir_helper_->notify_startup (TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ }
+
+ this->orb_manager_.run (TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ if (this->use_ir_ == 1)
+ {
+ this->ir_helper_->notify_shutdown (TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ }
+ }
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("Nestea_Server_i::run");
+ return -1;
+ }
+ TAO_ENDTRY;
+
+ return 0;
+}
+
+Nestea_Server_i::~Nestea_Server_i (void)
+{
+ delete this->ir_helper_;
+ delete this->server_impl_;
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h
new file mode 100644
index 00000000000..d62bd9e0fc3
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_server_i.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests/ImplRepo
+//
+// = FILENAME
+// nestea_server_i.h
+//
+// = DESCRIPTION
+// Server that sets up the ORB and handles the registration and execution
+// of the Paper Nestea Server.
+//
+// = AUTHORS
+// Darrell Brunsch <brunsch@cs.wustl.edu>
+//
+// ============================================================================
+
+#if !defined (NESTEA_SERVER_I_H)
+#define NESTEA_SERVER_I_H
+
+#include "tao/TAO.h"
+#include "nestea_i.h"
+#include "IR_Helper.h"
+
+class Nestea_Server_i
+{
+ // = TITLE
+ // Paper Nestea Server Implementation Class
+ //
+ // = DESCRIPTION
+ // Sets up everything necessary to get the Paper Nestea Server
+ // running.
+ //
+public:
+ // = Initialization and termination methods.
+ Nestea_Server_i (void);
+ // Default constructor
+
+ ~Nestea_Server_i (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:
+ int parse_args (void);
+ // Parses the commandline arguments.
+
+ int argc_;
+ // Number of command line arguments.
+
+ char **argv_;
+ // The command line arguments.
+
+ TAO_ORB_Manager orb_manager_;
+ // The ORB manager.
+
+ Nestea_i *server_impl_;
+ // The Paper Nestea Server Implementation.
+
+ FILE *ior_output_file_;
+ // File where the IOR of the server object is stored.
+
+ IR_Helper *ir_helper_;
+ // Helper class for using the IR.
+
+ int register_with_ir_;
+ // Flag for whether or not to register startup with the IR.
+
+ int use_ir_;
+ // Flag for whether or not to use the IR.
+};
+
+#endif /* NESTEA_SERVER_I_H */