summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-05-12 18:39:37 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-05-12 18:39:37 +0000
commitf4c67377f8039cd7a5084ff7befde7e5f503dd04 (patch)
treee661e251c2da533e59176854c3bb93a67149c22f
parent64b0f4f2ebdb3ca5f968206eaade2d7798a0c9ec (diff)
downloadATCD-f4c67377f8039cd7a5084ff7befde7e5f503dd04.tar.gz
ChangeLogTag:Mon May 12 13:34:16 2003 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r--TAO/CIAO/ChangeLog19
-rw-r--r--TAO/CIAO/README2
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt8
-rw-r--r--TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h4
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp121
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc39
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/Simple_Server.idl25
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/Simple_Server_Stub_Export.h50
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.cpp56
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.h70
-rw-r--r--TAO/CIAO/tools/Simple_Component_Server/sample_client.cpp81
11 files changed, 411 insertions, 64 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog
index 585acfeb9c4..0d7e01f950a 100644
--- a/TAO/CIAO/ChangeLog
+++ b/TAO/CIAO/ChangeLog
@@ -1,3 +1,22 @@
+Mon May 12 13:34:16 2003 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * README: Updated the list of TAO librearies CIAO depends on.
+
+ * tools/Assembly_Deployer/Assembly_Service_Impl.h: Fixed
+ mismatched comments. :)
+
+ * tools/Simple_Component_Server/Simple_Component_Server.cpp:
+ * tools/Simple_Component_Server/Simple_Component_Server.mpc:
+ * tools/Simple_Component_Server/Simple_Server.idl:
+ * tools/Simple_Component_Server/Simple_Server_Stub_Export.h:
+ * tools/Simple_Component_Server/Simple_Server_i.cpp:
+ * tools/Simple_Component_Server/Simple_Server_i.h:
+ * tools/Simple_Component_Server/sample_client.cpp: Revamped the
+ simple_component_server to make debugging a single component
+ implementation a more direct process. There's also a
+ sample_client that can be used as a blueprint to interfact with
+ the simple component server.
+
Fri May 09 12:51:03 2003 Nanbor Wang <nanbor@cs.wustl.edu>
* README: Updated the list of libraries that CIAO depends on,
diff --git a/TAO/CIAO/README b/TAO/CIAO/README
index 00cde93db06..be0f1e604b7 100644
--- a/TAO/CIAO/README
+++ b/TAO/CIAO/README
@@ -10,6 +10,8 @@ to compile them first. Here is a non-exhaustive list:
ACEXML,
Valuetype
+ IORInterceptor
+ ObjRefTemplate
Security
PortableServer
IFR_Client
diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt
index e09bbb9467b..cbe28a6b459 100644
--- a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt
+++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt
@@ -75,9 +75,9 @@ Step 1:
application is running. Here are some hints on how to start the
daemons:
- $(CIAO_ROOT)/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer
+ ${CIAO_ROOT}/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer
- $(CIAO_ROOT)/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:12000 -n ../../../../tools/ComponentServer/ComponentServer
+ ${CIAO_ROOT}/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:12000 -n ../../../../tools/ComponentServer/ComponentServer
Step 2:
=======
@@ -86,7 +86,7 @@ Step 2:
does the assembly work. This should also be started in a separate
shell window.
- $(CIAO_ROOT)/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat
+ ${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat
Step 3:
=======
@@ -94,7 +94,7 @@ Step 3:
You then need to instruct the Assembly_Manager to deploy a specific
compoennt assembly descriptor. For example:
- $(CIAO_ROOT)/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -a HUDisplay.cad
+ ${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -a HUDisplay.cad
Replace "HUDisplay.cad" with other '.cad' files as you like.
diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h
index 9d66d072c8c..a8dc8a9da92 100644
--- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h
+++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h
@@ -6,10 +6,6 @@
*
* $Id$
*
- * This file contains implementations for
- * Components::Deployment::AssemblyFactory and
- * Components::Deployment::Assembly interface.
- *
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp
index c2137e5314c..a52dbd9c177 100644
--- a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp
+++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp
@@ -1,37 +1,51 @@
// $Id$
+/**
+ * @file Simple_Component_Server.cpp
+ *
+ * This file contains a simple
+ */
+
#include "ciao/Container_Base.h"
#include "ace/SString.h"
#include "ace/Read_Buffer.h"
#include "ace/Get_Opt.h"
-#include "ciao/HomeRegistrar_i.h"
+#include "Simple_Server_i.h"
+
+//#include "ciao/HomeRegistrar_i.h"
-char *ior_file_name_ = 0;
+char *ior_filename = 0;
+//char *home_registrar_ior = 0;
char *component_list_ = 0;
+int create_component = 0; // If we need to create a cached component.
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "i:o:");
+ ACE_Get_Opt get_opts (argc, argv, "ci:o:");
int c;
while ((c = get_opts ()) != -1)
switch (c)
{
- case 'o': // get the file name to write to
- ior_file_name_ = get_opts.opt_arg ();
+ case 'c': // Create cached component
+ create_component = 1;
+ break;
+
+ case 'o': // get the server IOR output filename
+ ior_filename = get_opts.opt_arg ();
break;
- case 'i': // get
+ case 'i': // get component configuration
component_list_ = get_opts.opt_arg ();
break;
case '?': // display help for use of the server.
default:
ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s"
- "-i <config file>"
- "-o <ior_output_file>"
+ "usage: %s\n"
+ "-i <component config file>\n"
+ "-o <server_ior_output_file>"
"\n",
argv [0]),
-1);
@@ -41,21 +55,20 @@ parse_args (int argc, char *argv[])
}
int
-write_IOR(const char *filename
- const char *ior)
+write_IOR(const char *ior)
{
- if (filename == 0 || ior == 0)
+ if (ior_filename == 0 || ior == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"A valid filename and an IOR string are required for saving IOR\n"),
-1);
FILE* ior_output_file_ =
- ACE_OS::fopen (filename, "w");
+ ACE_OS::fopen (ior_filename, "w");
if (ior_output_file_ == NULL)
ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to open <%s> for writing\n", filename),
+ "Unable to open <%s> for writing\n", ior_filename),
-1);
ACE_OS::fprintf (ior_output_file_,
@@ -84,10 +97,10 @@ int breakdown (char *source,
return cntr;
}
-void
+Components::CCMHome_ptr
install_homes (CIAO::Session_Container &container,
- CORBA::ORB_ptr orb,
- ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
{
if (component_list_ == 0)
ACE_THROW (CORBA::BAD_PARAM ());
@@ -99,7 +112,8 @@ install_homes (CIAO::Session_Container &container,
{
ACE_Read_Buffer ior_buffer (config_file);
char *data = 0;
- while ((data = ior_buffer.read ('\n')) != 0)
+
+ if ((data = ior_buffer.read ('\n')) != 0)
{
char *items[10];
auto_ptr<char> an_entry (data);
@@ -107,10 +121,10 @@ install_homes (CIAO::Session_Container &container,
10,
items);
- if (len < 7)
+ if (len < 4) // we only need the first 4 fields now.
{
ACE_DEBUG ((LM_DEBUG, "Error parsing configuration file\n"));
- continue;
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
}
// len should be at least such and such long so we have all
@@ -138,12 +152,14 @@ install_homes (CIAO::Session_Container &container,
if (CORBA::is_nil (home))
{
- ACE_DEBUG ((LM_DEBUG, "Fail to create %s\n", items[6]));
- continue;
+ ACE_DEBUG ((LM_DEBUG, "Fail to create home\n"));
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
}
+ return home._retn ();
}
}
ACE_OS::fclose (config_file);
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
}
int
@@ -179,36 +195,6 @@ main (int argc, char *argv[])
mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
- // Configuring HomeRegistrar.
- obj = orb->resolve_initial_references ("NameService"
- ACE_ENV_ARG_PARAMETER);
- CosNaming::NamingContext_var ns = CosNaming::NamingContext::_narrow (obj);
- if (CORBA::is_nil (ns))
- return -1;
-
- PortableServer::Servant hr_svt = new CIAO::HomeRegistrar_Impl (ns);
- PortableServer::ObjectId_var hr_oid
- = poa->activate_object (hr_svt
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- obj = poa->id_to_reference (hr_oid
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- CIAO::HomeRegistrar_var home_registrar =
- CIAO::HomeRegistrar::_narrow (obj
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (CORBA::is_nil (home_registrar))
- ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire HomeRegistrar interface\n"), -1);
-
- CORBA::String_var str = orb->object_to_string (home_registrar.in ()
- ACE_ENV_ARG_PARAMETER);
- write_IOR (str.in ());
- ACE_DEBUG ((LM_INFO, "HomeFinder IOR: %s\n", str.in ()));
-
// Start Deployment part
CIAO::Session_Container container (orb);
@@ -216,13 +202,38 @@ main (int argc, char *argv[])
// install component
- install_homes (container, orb, home_registrar ACE_ENV_ARG_PARAMETER);
+ Components::CCMHome_var home =
+ install_homes (container,
+ orb
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
- // End Deployment part
+ CIAO::Simple_Server_i *servant = 0;
+ ACE_NEW_RETURN (servant,
+ CIAO::Simple_Server_i (orb.in (),
+ poa.in (),
+ home.in ()),
+ -1);
+ PortableServer::ServantBase_var safe_daemon (servant);
+ // Implicit activation
+ CIAO::Simple_Server_var server = servant->_this ();
+
+ CORBA::String_var str =
+ orb->object_to_string (server.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ write_IOR (str.in ());
+
+ if (create_component != 0)
+ {
+ Components::CCMObject_var temp
+ = server->get_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
ACE_DEBUG ((LM_DEBUG,
- "Running generic server...\n"));
+ "Running the simple generic server...\n"));
// Run the main event loop for the ORB.
orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc
index 10ebccea6a4..81c41c1ed83 100644
--- a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc
+++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc
@@ -1,3 +1,40 @@
+project (Simple_Server_Stub) : taolib_with_idl, ciao_client {
+ sharedname = CIAO_Simple_Server_Stub
+ idlflags += -Wb,stub_export_include=Simple_Server_Stub_Export.h -Wb,stub_export_macro=CIAO_SIMPLE_SERVER_STUB_Export -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h"
+ dllflags = CIAO_SIMPLE_SERVER_STUB_BUILD_DLL
+
+ IDL_Files {
+ Simple_Server.idl
+ }
+
+ Source_Files {
+ Simple_ServerC.cpp
+ }
+}
+
project (Simple_Component_Server) : ciao_server {
+ depends += Simple_Server_Stub
+ libs += CIAO_Simple_Server_Stub
exename = Simple_Component_Server
-} \ No newline at end of file
+
+ Source_Files {
+ Simple_ServerS.cpp
+ Simple_Server_i.cpp
+ Simple_Component_Server.cpp
+ }
+}
+
+// Use the following settings as a blueprint for creating client project.
+project (Simple_Component_Server_test_client) : ciao_server {
+ depends += Simple_Server_Stub
+ libs += CIAO_Simple_Server_Stub
+ libpaths += $(CIAO_ROOT)/tools/Simple_Component_Server
+ exename = sample_client
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ sample_client.cpp
+ }
+}
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Server.idl b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server.idl
new file mode 100644
index 00000000000..608805d5c54
--- /dev/null
+++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server.idl
@@ -0,0 +1,25 @@
+// $Id$
+
+#include "CCM_Component.idl"
+
+module CIAO
+{
+ /**
+ * @interface Simple_Server
+ *
+ * Control interface for Simple_Server
+ */
+ interface Simple_Server
+ {
+ /// Get the installed home interface.
+ Components::CCMHome get_home ();
+
+ /// Get the cached component instantiation.
+ /// This operation can only instantiate using KeylessCCMHome.
+ Components::CCMObject get_component ();
+
+ /// Shutdown the simple component server.
+ oneway void shutdown ();
+ };
+
+};
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_Stub_Export.h b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_Stub_Export.h
new file mode 100644
index 00000000000..153a388691a
--- /dev/null
+++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_Stub_Export.h
@@ -0,0 +1,50 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl CIAO_SIMPLE_SERVER_STUB
+// ------------------------------
+#ifndef CIAO_SIMPLE_SERVER_STUB_EXPORT_H
+#define CIAO_SIMPLE_SERVER_STUB_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (CIAO_SIMPLE_SERVER_STUB_HAS_DLL)
+# define CIAO_SIMPLE_SERVER_STUB_HAS_DLL 1
+#endif /* ! CIAO_SIMPLE_SERVER_STUB_HAS_DLL */
+
+#if defined (CIAO_SIMPLE_SERVER_STUB_HAS_DLL) && (CIAO_SIMPLE_SERVER_STUB_HAS_DLL == 1)
+# if defined (CIAO_SIMPLE_SERVER_STUB_BUILD_DLL)
+# define CIAO_SIMPLE_SERVER_STUB_Export ACE_Proper_Export_Flag
+# define CIAO_SIMPLE_SERVER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SIMPLE_SERVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* CIAO_SIMPLE_SERVER_STUB_BUILD_DLL */
+# define CIAO_SIMPLE_SERVER_STUB_Export ACE_Proper_Import_Flag
+# define CIAO_SIMPLE_SERVER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define CIAO_SIMPLE_SERVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* CIAO_SIMPLE_SERVER_STUB_BUILD_DLL */
+#else /* CIAO_SIMPLE_SERVER_STUB_HAS_DLL == 1 */
+# define CIAO_SIMPLE_SERVER_STUB_Export
+# define CIAO_SIMPLE_SERVER_STUB_SINGLETON_DECLARATION(T)
+# define CIAO_SIMPLE_SERVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* CIAO_SIMPLE_SERVER_STUB_HAS_DLL == 1 */
+
+// Set CIAO_SIMPLE_SERVER_STUB_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (CIAO_SIMPLE_SERVER_STUB_NTRACE)
+# if (ACE_NTRACE == 1)
+# define CIAO_SIMPLE_SERVER_STUB_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define CIAO_SIMPLE_SERVER_STUB_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !CIAO_SIMPLE_SERVER_STUB_NTRACE */
+
+#if (CIAO_SIMPLE_SERVER_STUB_NTRACE == 1)
+# define CIAO_SIMPLE_SERVER_STUB_TRACE(X)
+#else /* (CIAO_SIMPLE_SERVER_STUB_NTRACE == 1) */
+# define CIAO_SIMPLE_SERVER_STUB_TRACE(X) ACE_TRACE_IMPL(X)
+#endif /* (CIAO_SIMPLE_SERVER_STUB_NTRACE == 1) */
+
+#endif /* CIAO_SIMPLE_SERVER_STUB_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.cpp b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.cpp
new file mode 100644
index 00000000000..79323f9652f
--- /dev/null
+++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.cpp
@@ -0,0 +1,56 @@
+// $Id$
+
+#include "Simple_Server_i.h"
+
+/// Constructor
+CIAO::Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr o,
+ PortableServer::POA_ptr p,
+ Components::CCMHome_ptr h)
+ : orb_ (CORBA::ORB::_duplicate (o)),
+ poa_ (PortableServer::POA::_duplicate (p)),
+ home_ (Components::CCMHome::_duplicate (h))
+{
+}
+
+/// Destructor
+CIAO::Simple_Server_i::~Simple_Server_i (void)
+{
+}
+
+PortableServer::POA_ptr
+CIAO::Simple_Server_i::_default_POA (void)
+{
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+}
+
+Components::CCMHome_ptr
+CIAO::Simple_Server_i::get_home (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return Components::CCMHome::_duplicate (this->home_.in ());
+}
+
+Components::CCMObject_ptr
+CIAO::Simple_Server_i::get_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (CORBA::is_nil (this->component_.in ()))
+ {
+ Components::KeylessCCMHome_var h
+ = Components::KeylessCCMHome::_narrow (this->home_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ this->component_ =
+ h->create_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ return Components::CCMObject::_duplicate (this->component_.in ());
+}
+
+void
+CIAO::Simple_Server_i::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->orb_->shutdown ();
+}
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.h b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.h
new file mode 100644
index 00000000000..02100ef83b5
--- /dev/null
+++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Server_i.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Simple_Server_i.h
+ *
+ * $Id$
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef CIAO_SIMPLE_SERVER_I_H
+#define CIAO_SIMPLE_SERVER_I_H
+#include "ace/pre.h"
+
+#include "Simple_ServerS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace CIAO
+{
+ class Simple_Server_i
+ : public virtual POA_CIAO::Simple_Server,
+ public virtual PortableServer::RefCountServantBase
+ {
+ public:
+ /// Constructor
+ Simple_Server_i (CORBA::ORB_ptr o,
+ PortableServer::POA_ptr p,
+ Components::CCMHome_ptr h);
+
+ /// Destructor
+ virtual ~Simple_Server_i (void);
+
+ /// Get the containing POA. This operation does *not*
+ /// increase the reference count of the POA.
+ virtual PortableServer::POA_ptr _default_POA (void);
+
+ virtual Components::CCMHome_ptr
+ get_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual Components::CCMObject_ptr
+ get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ protected:
+ /// Keep a pointer to the managing ORB serving this servant.
+ CORBA::ORB_var orb_;
+
+ /// Keep a pointer to the managing POA.
+ PortableServer::POA_var poa_;
+
+ /// Cached CCMHome reference.
+ Components::CCMHome_var home_;
+
+ /// Cached CCMObject reference.
+ Components::CCMObject_var component_;
+ };
+}
+
+#include "ace/post.h"
+#endif /* CIAO_SIMPLE_SERVER_H */
diff --git a/TAO/CIAO/tools/Simple_Component_Server/sample_client.cpp b/TAO/CIAO/tools/Simple_Component_Server/sample_client.cpp
new file mode 100644
index 00000000000..e9d97bfd81e
--- /dev/null
+++ b/TAO/CIAO/tools/Simple_Component_Server/sample_client.cpp
@@ -0,0 +1,81 @@
+// $Id$
+
+#include "tools/Simple_Component_Server/Simple_ServerC.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+// @@ Include component stub file here:
+//#include "helloC.h"
+
+char *ior = 0;
+int shutdown_server = 0;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "i:s");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 's': // Shutdown server when exit?
+ shutdown_server = 1;
+ break;
+
+ case 'i': // get component configuration
+ ior = get_opts.opt_arg ();
+ break;
+
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s\n"
+ "-i <simple server ior>\n"
+ "-s shutdown server when exit\n"
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ // Initialize orb
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER);
+
+ if (parse_args (argc, argv) != 0)
+ return -1;
+
+ CORBA::Object_var obj
+ = orb->string_to_object (ior ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CIAO::Simple_Server_var cserve
+ = CIAO::Simple_Server::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ /// @@ Narrow the object and do your stuff here.
+
+ if (shutdown_server != 0)
+ cserve->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Who is the culprit \n");
+ cerr << "Uncaught CORBA exception" << endl;
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}