summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-05-14 22:04:48 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-05-14 22:04:48 +0000
commit7fc95e2c87a32e2b6c87bdd5bbf88a649733412d (patch)
treeb085fbc496401bcd13fa99563b2f777712213cb6
parent0fb4fcb279e596e2dcf3b043662b706e1f642e4b (diff)
downloadATCD-7fc95e2c87a32e2b6c87bdd5bbf88a649733412d.tar.gz
ChangeLogTag:Wed May 14 17:02:29 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r--TAO/CIAO/ChangeLog17
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl22
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.mpc86
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/ECE.idl68
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/ECEI.idl32
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.cpp279
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.h182
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec_export.h50
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_stub_export.h50
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.cpp879
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.h391
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt_export.h50
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/client.cpp61
-rw-r--r--TAO/CIAO/examples/handcrafted/BasicSP/EC/controller.cpp110
14 files changed, 2270 insertions, 7 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog
index c4a23d09934..d0d99803af9 100644
--- a/TAO/CIAO/ChangeLog
+++ b/TAO/CIAO/ChangeLog
@@ -1,3 +1,20 @@
+Wed May 14 17:02:29 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+ * examples/handcrafted/BasicSP/EC/EC.idl:
+ * examples/handcrafted/BasicSP/EC/EC.mpc:
+ * examples/handcrafted/BasicSP/EC/ECE.idl:
+ * examples/handcrafted/BasicSP/EC/ECEI.idl:
+ * examples/handcrafted/BasicSP/EC/EC_exec.cpp:
+ * examples/handcrafted/BasicSP/EC/EC_exec.h:
+ * examples/handcrafted/BasicSP/EC/EC_exec_export.h:
+ * examples/handcrafted/BasicSP/EC/EC_stub_export.h:
+ * examples/handcrafted/BasicSP/EC/EC_svnt.cpp:
+ * examples/handcrafted/BasicSP/EC/EC_svnt.h:
+ * examples/handcrafted/BasicSP/EC/EC_svnt_export.h:
+ * examples/handcrafted/BasicSP/EC/client.cpp:
+ * examples/handcrafted/BasicSP/EC/controller.cpp: Implementation
+ for the EC component.
+
Wed May 14 15:50:12 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl
index d2096e707d8..053ac2d2085 100644
--- a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl
@@ -5,7 +5,7 @@
*
* Definition of events, and common interfaces used in the BasicSP module.
*
- * @author Balachandran Natarajan <nanbor@cs.wustl.edu>
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
*/
//=============================================================================
@@ -16,12 +16,20 @@
module BasicSP
{
- component EventChannel {
- publishes TimeOut timeOut;
- };
-
- home EventChannelHome manages EventChannel
+ component EC
{
+ publishes TimeOut timeout;
+
+ /// The attribute can be configured via the home or the
+ /// component property file.
+ attribute long hertz;
};
+
+ home ECHome manages EC
+ {
+ // Explicit operations
+ factory new_EC (in long hertz);
+ };
};
-#endif /*CIAO_EC_IDL*/
+
+#endif /* CIAO_EC_IDL*/
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.mpc b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.mpc
new file mode 100644
index 00000000000..58f2fe3c271
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.mpc
@@ -0,0 +1,86 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl -l .. -p BasicSP -i -c EC"
+
+project(EC_stub): ciao_client {
+ depends += BasicSP_stub
+ sharedname = EC_stub
+ idlflags += -Wb,stub_export_macro=EC_STUB_Export -Wb,stub_export_include=EC_stub_export.h -Wb,skel_export_macro=EC_SVNT_Export -Wb,skel_export_include=EC_svnt_export.h
+ dllflags = EC_STUB_BUILD_DLL
+
+ IDL_Files {
+ EC.idl
+ }
+
+ Source_Files {
+ ECC.cpp
+ }
+}
+
+project(EC_svnt) : ciao_server {
+ depends += BasicSP_svnt EC_stub
+ sharedname = EC_svnt
+ libs += EC_stub BasicSP_stub BasicSP_svnt TAO_Valuetype
+ libpaths += .. $(TAO_ROOT)/tao/Valuetype
+ idlflags += -Wb,export_macro=EC_SVNT_Export -Wb,export_include=EC_svnt_export.h
+ dllflags = EC_SVNT_BUILD_DLL
+
+ IDL_Files {
+ ECE.idl
+ }
+
+ Source_Files {
+ ECEC.cpp
+ ECS.cpp
+ EC_svnt.cpp
+ }
+}
+
+
+project(EC_exec) : ciao_server {
+ depends += EC_svnt
+ sharedname = EC_exec
+ libs += EC_stub BasicSP_stub EC_svnt
+ libpaths += ..
+ idlflags += -Wb,export_macro=EC_EXEC_Export -Wb,export_include=EC_exec_export.h
+ dllflags = EC_EXEC_BUILD_DLL
+
+ IDL_Files {
+ ECEI.idl
+ }
+
+ Source_Files {
+ ECEIC.cpp
+ EC_exec.cpp
+ }
+}
+
+
+
+project (EC_client) : ciao_client {
+ exename = client
+ depends += EC_stub
+ libs += EC_stub BasicSP_stub TAO_Valuetype
+ libpaths += .. $(TAO_ROOT)/tao/Valuetype
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ client.cpp
+ }
+}
+
+
+project (controller) : ciao_client {
+ exename = controller
+ depends += EC_stub
+ libs += EC_stub BasicSP_stub TAO_Valuetype
+ libpaths += .. $(TAO_ROOT)/tao/Valuetype
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ controller.cpp
+ }
+}
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/ECE.idl b/TAO/CIAO/examples/handcrafted/BasicSP/EC/ECE.idl
new file mode 100644
index 00000000000..bb30be71973
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/ECE.idl
@@ -0,0 +1,68 @@
+// $Id$
+//=============================================================================
+/**
+ * @file ECE.idl
+ *
+ * Executor definition of the EC (a rate generator) component.
+ * This file should be auto-generated by the CCIDL compiler when it
+ * becomes available.
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef CIAO_ECE_IDL
+#define CIAO_ECE_IDL
+
+#include "CCM_Container.idl"
+#include "EC.idl"
+#include "../BasicSP.idl"
+
+module BasicSP
+{
+ local interface CCM_EC_Executor
+ : Components::EnterpriseComponent
+ {
+ attribute long hertz;
+ };
+
+ local interface CCM_EC
+ : Components::EnterpriseComponent
+ {
+ attribute long hertz;
+ };
+
+ /**
+ * Context interface. This interface defines the mapping. The
+ * container framework provides the implmentation.
+ *
+ * Notice that we are taking a shortcut here to inherit the
+ * component-specific context from SessionContext directly instead
+ * of CCMContext.
+ */
+ local interface CCM_EC_Context
+ : Components::SessionContext
+ {
+ void push_timeout (in TimeOut ev);
+ };
+
+ local interface CCM_ECHomeExplicit
+ : Components::HomeExecutorBase
+ {
+ Components::EnterpriseComponent new_EC (in long hertz)
+ raises (Components::CCMException);
+ };
+
+ local interface CCM_ECHomeImplicit
+ {
+ Components::EnterpriseComponent create ()
+ raises (Components::CCMException);
+ };
+
+ local interface CCM_ECHome
+ : CCM_ECHomeExplicit,
+ CCM_ECHomeImplicit
+ {
+ };
+};
+
+#endif /* CIAO_ECE_IDL */
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/ECEI.idl b/TAO/CIAO/examples/handcrafted/BasicSP/EC/ECEI.idl
new file mode 100644
index 00000000000..9b48d5c74dd
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/ECEI.idl
@@ -0,0 +1,32 @@
+// $Id$
+
+//=============================================================================
+/**
+ * @file ECEI.idl
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef CIAO_ECEI_IDL
+#define CIAO_ECEI_IDL
+
+#include "ECE.idl"
+
+module BasicSP
+{
+ /**
+ * @interface EC_Exec
+ *
+ * The actually EC executor need to support
+ * Components::SessionComponent interface. Therefore, we need to
+ * define the component executor interface explicitly here.
+ */
+ local interface EC_Exec : CCM_EC,
+ Components::SessionComponent
+ {
+ };
+
+};
+
+#endif /* RATEGENEI_IDL */
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.cpp b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.cpp
new file mode 100644
index 00000000000..e8266f4d3f6
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.cpp
@@ -0,0 +1,279 @@
+// $Id$
+
+#include "EC_exec.h"
+#include "ace/Timer_Queue.h"
+#include "ace/Reactor.h"
+
+//=================================================================
+
+MyImpl::timeout_Handler::timeout_Handler (MyImpl::EC_exec_i *cb)
+ : active_ (0),
+ done_ (0),
+ tid_ (0),
+ pulse_callback_ (cb)
+{
+ // Nothing
+ this->reactor (new ACE_Reactor);
+}
+
+MyImpl::timeout_Handler::~timeout_Handler ()
+{
+ delete this->reactor ();
+ this->reactor (0);
+}
+
+int
+MyImpl::timeout_Handler::open ()
+{
+ return this->activate ();
+}
+
+int
+MyImpl::timeout_Handler::close ()
+{
+ this->done_ = 1;
+ this->reactor ()->notify ();
+
+ ACE_DEBUG ((LM_DEBUG, "Waiting\n"));
+ return this->wait ();
+}
+
+int
+MyImpl::timeout_Handler::start (CORBA::Long hertz)
+{
+ if (hertz == 0 || this->active_ != 0) // Not valid
+ return -1;
+
+ long usec = 1000000 / hertz;
+
+ this->tid_ = this->reactor ()->schedule_timer (this,
+ 0,
+ ACE_Time_Value (0, usec),
+ ACE_Time_Value (0, usec));
+
+ this->active_ = 1;
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::stop (void)
+{
+ if (this->active_ == 0) // Not valid.
+ return -1;
+
+ this->reactor ()->cancel_timer (this);
+
+ this->active_ = 0;
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::active (void)
+{
+ return this->active_;
+}
+
+int
+MyImpl::timeout_Handler::handle_close (ACE_HANDLE handle,
+ ACE_Reactor_Mask close_mask)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"),
+ this,
+ handle,
+ close_mask));
+
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ this->pulse_callback_->pulse ();
+
+// ACE_DEBUG ((LM_DEBUG,
+// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"),
+// this,
+// tv.sec (),
+// tv.usec ()));
+
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::svc (void)
+{
+ this->reactor ()->owner (ACE_OS::thr_self ());
+
+ while (!this->done_)
+ this->reactor ()->handle_events ();
+
+ return 0;
+}
+
+//=================================================================
+
+MyImpl::EC_exec_i::EC_exec_i ()
+ : hertz_ (0),
+ pulser_ (this)
+{
+
+}
+
+MyImpl::EC_exec_i::EC_exec_i (CORBA::Long hz)
+ : hertz_ (hz),
+ pulser_ (this)
+{
+}
+
+MyImpl::EC_exec_i::~EC_exec_i ()
+{
+}
+
+CORBA::Long
+MyImpl::EC_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->hertz_;
+}
+
+void
+MyImpl::EC_exec_i::hertz (CORBA::Long hertz
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->hertz_ = hertz;
+}
+
+// Operations from supported interface(s)
+
+void
+MyImpl::EC_exec_i::start (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->hertz_ == 0 || this->pulser_.active())
+ ACE_THROW (CORBA::BAD_INV_ORDER ());
+
+ // @@ Start the rate generator
+ this->pulser_.start (this->hertz_);
+}
+
+void
+MyImpl::EC_exec_i::stop (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (! this->pulser_.active ())
+ ACE_THROW (CORBA::BAD_INV_ORDER ());
+
+ // @@ stop the rate generator
+ this->pulser_.stop ();
+}
+
+CORBA::Boolean
+MyImpl::EC_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->pulser_.active ();
+}
+
+// Operations from Components::SessionComponent
+
+void
+MyImpl::EC_exec_i::set_session_context (Components::SessionContext_ptr ctx
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::set_session_context\n"));
+
+ this->context_ =
+ BasicSP::CCM_EC_Context::_narrow (ctx
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (this->context_.in ()))
+ ACE_THROW (CORBA::INTERNAL ());
+ // Urm, we actually discard exceptions thown from this operation.
+
+}
+
+void
+MyImpl::EC_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_activate\n"));
+
+ this->pulser_.open ();
+}
+
+void
+MyImpl::EC_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_passivate\n"));
+ this->pulser_.close ();
+}
+
+void
+MyImpl::EC_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_remove\n"));
+}
+
+void
+MyImpl::EC_exec_i::pulse (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Pushing BasicSP::TimeOut event!\n")));
+
+ BasicSP::TimeOut_var ev = new OBV_BasicSP::TimeOut ();
+
+ this->context_->push_timeout (ev.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+ ACE_CATCHANY
+ {
+ // @@ do nothing?
+ }
+ ACE_ENDTRY;
+
+}
+
+MyImpl::ECHome_exec_i::ECHome_exec_i ()
+{
+}
+
+MyImpl::ECHome_exec_i::~ECHome_exec_i ()
+{
+}
+
+::Components::EnterpriseComponent_ptr
+MyImpl::ECHome_exec_i::new_EC (CORBA::Long hertz
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ return new MyImpl::EC_exec_i (hertz);
+}
+
+::Components::EnterpriseComponent_ptr
+MyImpl::ECHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ return new MyImpl::EC_exec_i ();
+}
+
+
+extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr
+createECHome_Impl (void)
+{
+ return new MyImpl::ECHome_exec_i ();
+}
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.h b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.h
new file mode 100644
index 00000000000..457ec447e68
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec.h
@@ -0,0 +1,182 @@
+// $Id$
+
+//============================================================
+/**
+ * @file EC_exec.h
+ *
+ * Header file for the actualy EC and ECHome component
+ * implementation.
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//============================================================
+
+#ifndef EC_EXEC_H
+#define EC_EXEC_H
+
+#include "ECEIC.h"
+#include "tao/LocalObject.h"
+#include "ace/Thread_Manager.h"
+#include "ace/Task.h"
+
+namespace MyImpl
+{
+ // Forward decl.
+ class EC_exec_i;
+
+ /**
+ * @brief Active pulse generater
+ */
+ class timeout_Handler : public ACE_Task_Base
+ {
+ public:
+ // Default constructor
+ timeout_Handler (EC_exec_i *cb);
+ ~timeout_Handler ();
+
+ int open (void);
+
+ int close (void);
+
+ int start (CORBA::Long hertz);
+
+ int stop (void);
+
+ int active (void);
+
+ // Handle the timeout.
+ virtual int handle_timeout (const ACE_Time_Value &tv,
+ const void *arg);
+
+ // Called when <Time_Handler> is removed.
+ virtual int handle_close (ACE_HANDLE handle,
+ ACE_Reactor_Mask close_mask);
+
+ virtual int svc (void);
+
+ private:
+ /// Tracking whether we are actively generating pulse or not.
+ long active_;
+
+ /// Flag to indicate completion of this active object.
+ int done_;
+
+ /// The timer id we are waiting.
+ int tid_;
+
+ EC_exec_i *pulse_callback_;
+
+ ACE_Thread_Manager thr_mgr_;
+ };
+
+ /**
+ * @class EC_exec_i
+ *
+ * EC executor implementation class.
+ */
+ class EC_EXEC_Export EC_exec_i :
+ public virtual BasicSP::EC_Exec,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ /// Default constructor.
+ EC_exec_i ();
+
+ /// Initialize with a default frequency.
+ EC_exec_i (CORBA::Long hz);
+
+ /// Default destructor.
+ ~EC_exec_i ();
+
+ // Attribute operations.
+
+ virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void hertz (CORBA::Long hertz
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Operations from supported interface(s)
+
+ virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Boolean active (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Operations from Components::SessionComponent
+
+ virtual void set_session_context (Components::SessionContext_ptr ctx
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ /// Helper function to be called back by timeout_Handler
+ void pulse (void);
+
+ protected:
+ /// Frequency
+ CORBA::Long hertz_;
+
+ /// Copmponent specific context
+ BasicSP::CCM_EC_Context_var context_;
+
+ /// An active object that actually trigger the generation of
+ /// periodic events.
+ timeout_Handler pulser_;
+ };
+
+ /**
+ * @class ECHome_exec_i
+ *
+ * EC home executor implementation class.
+ */
+ class EC_EXEC_Export ECHome_exec_i :
+ public virtual BasicSP::CCM_ECHome,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ /// Default ctor.
+ ECHome_exec_i ();
+
+ /// Default dtor.
+ ~ECHome_exec_i ();
+
+ // Explicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ new_EC (CORBA::Long hertz
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ // Implicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+ };
+
+}
+
+extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr
+createECHome_Impl (void);
+
+#endif /* CIAO_ECGEN_EXEC_H */
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec_export.h b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec_export.h
new file mode 100644
index 00000000000..c979debf129
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_exec_export.h
@@ -0,0 +1,50 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl EC_EXEC
+// ------------------------------
+#ifndef EC_EXEC_EXPORT_H
+#define EC_EXEC_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (EC_EXEC_HAS_DLL)
+# define EC_EXEC_HAS_DLL 1
+#endif /* ! EC_EXEC_HAS_DLL */
+
+#if defined (EC_EXEC_HAS_DLL) && (EC_EXEC_HAS_DLL == 1)
+# if defined (EC_EXEC_BUILD_DLL)
+# define EC_EXEC_Export ACE_Proper_Export_Flag
+# define EC_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* EC_EXEC_BUILD_DLL */
+# define EC_EXEC_Export ACE_Proper_Import_Flag
+# define EC_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* EC_EXEC_BUILD_DLL */
+#else /* EC_EXEC_HAS_DLL == 1 */
+# define EC_EXEC_Export
+# define EC_EXEC_SINGLETON_DECLARATION(T)
+# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* EC_EXEC_HAS_DLL == 1 */
+
+// Set EC_EXEC_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (EC_EXEC_NTRACE)
+# if (ACE_NTRACE == 1)
+# define EC_EXEC_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define EC_EXEC_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !EC_EXEC_NTRACE */
+
+#if (EC_EXEC_NTRACE == 1)
+# define EC_EXEC_TRACE(X)
+#else /* (EC_EXEC_NTRACE == 1) */
+# define EC_EXEC_TRACE(X) ACE_TRACE_IMPL(X)
+#endif /* (EC_EXEC_NTRACE == 1) */
+
+#endif /* EC_EXEC_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_stub_export.h b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_stub_export.h
new file mode 100644
index 00000000000..2ad9df9cf12
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_stub_export.h
@@ -0,0 +1,50 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl EC_STUB
+// ------------------------------
+#ifndef EC_STUB_EXPORT_H
+#define EC_STUB_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (EC_STUB_HAS_DLL)
+# define EC_STUB_HAS_DLL 1
+#endif /* ! EC_STUB_HAS_DLL */
+
+#if defined (EC_STUB_HAS_DLL) && (EC_STUB_HAS_DLL == 1)
+# if defined (EC_STUB_BUILD_DLL)
+# define EC_STUB_Export ACE_Proper_Export_Flag
+# define EC_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* EC_STUB_BUILD_DLL */
+# define EC_STUB_Export ACE_Proper_Import_Flag
+# define EC_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* EC_STUB_BUILD_DLL */
+#else /* EC_STUB_HAS_DLL == 1 */
+# define EC_STUB_Export
+# define EC_STUB_SINGLETON_DECLARATION(T)
+# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* EC_STUB_HAS_DLL == 1 */
+
+// Set EC_STUB_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (EC_STUB_NTRACE)
+# if (ACE_NTRACE == 1)
+# define EC_STUB_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define EC_STUB_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !EC_STUB_NTRACE */
+
+#if (EC_STUB_NTRACE == 1)
+# define EC_STUB_TRACE(X)
+#else /* (EC_STUB_NTRACE == 1) */
+# define EC_STUB_TRACE(X) ACE_TRACE_IMPL(X)
+#endif /* (EC_STUB_NTRACE == 1) */
+
+#endif /* EC_STUB_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.cpp
new file mode 100644
index 00000000000..dd1c22b7fa8
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.cpp
@@ -0,0 +1,879 @@
+// $Id$
+
+#include "EC_svnt.h"
+#include "Cookies.h"
+
+void
+CIAO_GLUE_BasicSP::EC_Context::push_timeout (BasicSP::TimeOut *ev
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_Active_Map_Manager<BasicSP::TimeOutConsumer_var>::iterator
+ end = this->ciao_publishes_timeout_map_.end ();
+ for (ACE_Active_Map_Manager<BasicSP::TimeOutConsumer_var>::iterator
+ iter = this->ciao_publishes_timeout_map_.begin ();
+ iter != end;
+ ++iter)
+ {
+ ACE_Active_Map_Manager<BasicSP::TimeOutConsumer_var>::ENTRY &entry = *iter;
+ entry.int_id_->push_TimeOut (ev
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+// Operations for publishes interfaces.
+::Components::Cookie *
+CIAO_GLUE_BasicSP::EC_Context::subscribe_timeout (BasicSP::TimeOutConsumer_ptr c
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::ExceededConnectionLimit))
+{
+ if (CORBA::is_nil (c))
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);
+
+ BasicSP::TimeOutConsumer_var sub = BasicSP::TimeOutConsumer::_duplicate (c);
+
+ ACE_Active_Map_Manager_Key key;
+ this->ciao_publishes_timeout_map_.bind (sub.in (),
+ key);
+
+ sub._retn (); // Release ownership.
+
+ ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key);
+ return retv._retn ();
+}
+
+BasicSP::TimeOutConsumer_ptr
+CIAO_GLUE_BasicSP::EC_Context::unsubscribe_timeout (::Components::Cookie *ck
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::InvalidConnection))
+{
+ BasicSP::TimeOutConsumer_var retv;
+
+ ACE_Active_Map_Manager_Key key;
+ if (ck == 0 ||
+ CIAO::Map_Key_Cookie::extract (ck, key) == -1)
+ ACE_THROW_RETURN (::Components::InvalidConnection (), 0);
+
+ if (this->ciao_publishes_timeout_map_.unbind (key,
+ retv) != 0)
+ ACE_THROW_RETURN (::Components::InvalidConnection (), 0);
+
+ return retv._retn ();
+}
+
+// Operations for ::Components::SessionContext interface
+CORBA::Object_ptr
+CIAO_GLUE_BasicSP::EC_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState))
+{
+ // @@ How do I check for IllegalState here? When it's not in a
+ // callback operation...
+ // ACE_THROW_RETURN (::Components::IllegalState (), 0);
+
+ if (CORBA::is_nil (this->component_.in ()))
+ {
+ CORBA::Object_var obj = this->container_->get_objref (this->servant_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ this->component_ = BasicSP::EC::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (this->component_.in ()))
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen...
+ }
+ return BasicSP::EC::_duplicate (this->component_.in ());
+}
+
+
+CIAO_GLUE_BasicSP::EC_Context::EC_Context (::Components::CCMHome_ptr home,
+ ::CIAO::Session_Container *c,
+ CIAO_GLUE_BasicSP::EC_Servant *sv)
+ : home_ (::Components::CCMHome::_duplicate (home)),
+ container_ (c),
+ servant_ (sv)
+{
+
+}
+
+
+CIAO_GLUE_BasicSP::EC_Context::~EC_Context ()
+{
+}
+
+// Operations for emits interfaces.
+
+// Operations for ::Components::CCMContext
+ ::Components::Principal_ptr
+CIAO_GLUE_BasicSP::EC_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // @@ We don't support Security in CIAO yet.
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+ ::Components::CCMHome_ptr
+CIAO_GLUE_BasicSP::EC_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return ::Components::CCMHome::_duplicate (this->home_.in ());
+}
+
+ CORBA::Boolean
+CIAO_GLUE_BasicSP::EC_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState))
+{
+ // @@ We don't support Transaction in CIAO yet.
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+ ::Components::Transaction::UserTransaction_ptr
+CIAO_GLUE_BasicSP::EC_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState))
+{
+ // @@ We don't support Transaction in CIAO yet.
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+ CORBA::Boolean
+CIAO_GLUE_BasicSP::EC_Context::is_caller_in_role (const char * role
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_UNUSED_ARG (role);
+
+ // @@ We don't support Transaction in CIAO yet.
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+ void
+CIAO_GLUE_BasicSP::EC_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState))
+{
+ // @@ We don't support Transaction in CIAO yet.
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+}
+
+/***********************************************************/
+
+CIAO_GLUE_BasicSP::EC_Servant::EC_Servant (BasicSP::CCM_EC_ptr exe,
+ ::Components::CCMHome_ptr h,
+ ::CIAO::Session_Container *c)
+ : executor_ (BasicSP::CCM_EC::_duplicate (exe)),
+ container_ (c)
+{
+ this->context_ = new CIAO_GLUE_BasicSP::EC_Context (h, c, this);
+
+ ACE_TRY_NEW_ENV
+ {
+ Components::SessionComponent_var scom =
+ Components::SessionComponent::_narrow (exe
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (! CORBA::is_nil (scom.in ()))
+ scom->set_session_context (this->context_
+ ACE_ENV_ARG_PARAMETER);
+ }
+ ACE_CATCHANY
+ {
+ // @@ Ignore any exceptions? What happens if
+ // set_session_context throws an CCMException?
+ }
+ ACE_ENDTRY;
+}
+
+CIAO_GLUE_BasicSP::EC_Servant::~EC_Servant (void)
+{
+ ACE_TRY_NEW_ENV;
+ {
+ Components::SessionComponent_var temp =
+ Components::SessionComponent::_narrow (this->executor_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (! CORBA::is_nil (temp.in ()))
+ temp->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ ACE_CATCHANY
+ {
+ // @@ Ignore any exceptions? What happens if
+ // set_session_context throws an CCMException?
+ }
+ ACE_ENDTRY;
+ this->context_->_remove_ref ();
+}
+
+// Operations for provides interfaces.
+
+// Operations for consumers interfaces.
+
+// Operations for Navigation interface
+CORBA::Object_ptr
+CIAO_GLUE_BasicSP::EC_Servant::provide_facet (const char * name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException ,
+ Components::InvalidName))
+{
+ if (name == 0)
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);
+
+ // We simply iterate thru all the facets this component provides
+ // now. We can also use a hash map along with perfect hashing
+ // (i.e., gperf) if we need faster performance since all the provided
+ // interfaces are static to a component definition.
+
+ ACE_THROW_RETURN (::Components::InvalidName (), 0);
+}
+
+::Components::FacetDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::Components::FacetDescriptions_var collection
+ = new ::Components::FacetDescriptions; // #99 = number of all provided
+ // facets including those inherited
+ // from parent component(s).
+
+ return collection._retn ();
+
+}
+
+::Components::FacetDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_named_facets (const Components::NameList & names
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName))
+{
+ ::Components::FacetDescriptions_var collection
+ = new ::Components::FacetDescriptions (names.length ());
+
+ CORBA::ULong i = 0;
+ for (; i < names.length (); ++i)
+ {
+ ACE_THROW_RETURN (::Components::InvalidName (), 0);
+ }
+ return collection._retn ();
+}
+
+CORBA::Boolean
+CIAO_GLUE_BasicSP::EC_Servant::same_component (CORBA::Object_ptr object_ref
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (CORBA::is_nil (object_ref))
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);
+
+ CORBA::Object_var the_other
+ = object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Object_var me
+ = this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return me->_is_equivalent (object_ref
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// Operations for Receptacles interface
+::Components::Cookie *
+CIAO_GLUE_BasicSP::EC_Servant::connect (const char *,
+ CORBA::Object_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection,
+ Components::AlreadyConnected,
+ Components::ExceededConnectionLimit))
+{
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+}
+
+/*
+##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate:
+## if [receptacle name] is a simplex receptacle ('uses')
+## else ([receptacle name] is a multiplex ('uses multiple') receptacle)
+## endif [receptacle name]
+##end foreach [receptacle name] with [uses type]
+*/
+
+CORBA::Object_ptr
+CIAO_GLUE_BasicSP::EC_Servant::disconnect (const char *,
+ Components::Cookie *
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection,
+ Components::CookieRequired,
+ Components::NoConnection))
+{
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+}
+
+::Components::ConnectionDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_connections (const char *
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName))
+{
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+}
+
+::Components::ReceptacleDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::Components::ReceptacleDescriptions_var retv =
+ new ::Components::ReceptacleDescriptions; // #99 is number of receptacles
+ // this component has.
+ return retv._retn ();
+}
+
+::Components::ReceptacleDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_named_receptacles (const Components::NameList & names
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName))
+{
+ ::Components::ReceptacleDescriptions_var retv =
+ new ::Components::ReceptacleDescriptions (names.length ());
+
+ CORBA::ULong i = 0;
+ for (; i < names.length (); ++i)
+ {
+ ACE_THROW_RETURN (::Components::InvalidName (), 0);
+ }
+ return retv._retn ();
+}
+
+// Operations for Events interface
+::Components::EventConsumerBase_ptr
+CIAO_GLUE_BasicSP::EC_Servant::get_consumer (const char *
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName))
+{
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+}
+
+::Components::Cookie *
+CIAO_GLUE_BasicSP::EC_Servant::subscribe (const char * publisher_name,
+ Components::EventConsumerBase_ptr subscriber
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection,
+ Components::ExceededConnectionLimit))
+{
+ // @@ We can omit this if clause if there's no publisher in this component.
+ if (publisher_name == 0)
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+
+ if (ACE_OS_String::strcmp (publisher_name, "timeout") == 0)
+ {
+ BasicSP::TimeOutConsumer_var _ciao_consumer =
+ BasicSP::TimeOutConsumer::_narrow (subscriber
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (_ciao_consumer.in ()))
+ ACE_THROW_RETURN (::Components::InvalidConnection (), 0);
+
+ return this->subscribe_timeout (_ciao_consumer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+}
+
+::Components::EventConsumerBase_ptr
+CIAO_GLUE_BasicSP::EC_Servant::unsubscribe (const char * publisher_name,
+ Components::Cookie *ck
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection))
+{
+ // @@ We can omit this if clause if there's no publisher in this component.
+ if (publisher_name == 0)
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+
+ if (ACE_OS_String::strcmp (publisher_name, "timeout") == 0)
+ {
+ return this->unsubscribe_timeout (ck
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+}
+
+void
+CIAO_GLUE_BasicSP::EC_Servant::connect_consumer (const char *,
+ Components::EventConsumerBase_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::AlreadyConnected,
+ Components::InvalidConnection))
+{
+ ACE_THROW (Components::InvalidName ());
+}
+
+::Components::EventConsumerBase_ptr
+CIAO_GLUE_BasicSP::EC_Servant::disconnect_consumer (const char *
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::NoConnection))
+{
+ ACE_THROW_RETURN (Components::InvalidName (), 0);
+}
+
+::Components::ConsumerDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::Components::ConsumerDescriptions_var retv =
+ new ::Components::ConsumerDescriptions; // #99 is the number of consumers
+ // this component has.
+ return retv._retn ();
+}
+
+::Components::ConsumerDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_named_consumers (const Components::NameList & names
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName))
+{
+ ::Components::ConsumerDescriptions_var retv =
+ new ::Components::ConsumerDescriptions (names.length ());
+
+ CORBA::ULong i = 0;
+ for (; i < names.length (); ++i)
+ {
+ ACE_THROW_RETURN (::Components::InvalidName (), 0);
+ }
+ return retv._retn ();
+}
+
+::Components::EmitterDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::Components::EmitterDescriptions_var retv =
+ new ::Components::EmitterDescriptions; // #99 is the number of emitters
+ // this component has.
+ return retv._retn ();
+}
+
+::Components::EmitterDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_named_emitters (const Components::NameList & names
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName))
+{
+ ::Components::EmitterDescriptions_var retv =
+ new ::Components::EmitterDescriptions (names.length ());
+
+ CORBA::ULong i = 0;
+ for (; i < names.length (); ++i)
+ {
+ ACE_THROW_RETURN (::Components::InvalidName (), 0);
+ }
+ return retv._retn ();
+}
+
+::Components::PublisherDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // @@ to-do
+
+ // Need to add interfaces in the Context class to gather the information.
+ // Or we can just relay it to the Context object.
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+::Components::PublisherDescriptions *
+CIAO_GLUE_BasicSP::EC_Servant::get_named_publishers (const Components::NameList &
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName))
+{
+ // @@ to-do
+
+ // Need to add interfaces in the Context class to gather the information.
+ // Or we can just relay it to the Context object.
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+// Operations for CCMObject interface
+::CORBA::IRObject_ptr
+CIAO_GLUE_BasicSP::EC_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // @@ to-do: Connect to an IfR?
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+::Components::CCMHome_ptr
+CIAO_GLUE_BasicSP::EC_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+::Components::PrimaryKeyBase *
+CIAO_GLUE_BasicSP::EC_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::NoKeyAvailable))
+{
+ // This is a keyless component.
+ ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0);
+}
+
+void
+CIAO_GLUE_BasicSP::EC_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidConfiguration))
+{
+ // @@ to-do
+ // No-op. Don't know how to pass this info to monolithic executor.
+}
+
+void
+CIAO_GLUE_BasicSP::EC_Servant::remove (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::RemoveFailure))
+{
+ // @@ to-do
+ // Need to figure out what to do here. E.g., tear down the all the connections
+ // this component has?
+}
+
+::Components::ComponentPortDescription *
+CIAO_GLUE_BasicSP::EC_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::Components::ComponentPortDescription_var retv =
+ new OBV_Components::ComponentPortDescription;
+
+ ::Components::FacetDescriptions_var facets_desc
+ = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ::Components::ReceptacleDescriptions_var receptacle_desc
+ = get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ::Components::ConsumerDescriptions_var consumer_desc
+ = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ::Components::EmitterDescriptions_var emitter_desc
+ = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ::Components::PublisherDescriptions_var publisher_desc
+ = this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ retv->facets (facets_desc.in());
+ retv->receptacles (receptacle_desc.in());
+ retv->consumers (consumer_desc.in());
+ retv->emitters (emitter_desc.in());
+ retv->publishers (publisher_desc.in());
+
+ return retv._retn();
+}
+
+// get_component implementation.
+CORBA::Object_ptr
+CIAO_GLUE_BasicSP::EC_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::Components::SessionContext_var sc =
+ ::Components::SessionContext::_narrow (this->context_);
+
+ if (! CORBA::is_nil(sc.in ()))
+ return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ // @@ Do we need to try the following case here? We are afterall implementing
+ // a session component here.
+ ::Components::EntityContext_var ec =
+ ::Components::EntityContext::_narrow (this->context_);
+
+ if (! CORBA::is_nil(ec.in ()))
+ return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+}
+
+void
+CIAO_GLUE_BasicSP::EC_Servant::_ciao_activate (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ Components::SessionComponent_var temp =
+ Components::SessionComponent::_narrow (this->executor_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (! CORBA::is_nil (temp.in ()))
+ temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+CIAO_GLUE_BasicSP::EC_Servant::_ciao_passivate (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ Components::SessionComponent_var temp =
+ Components::SessionComponent::_narrow (this->executor_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (! CORBA::is_nil (temp.in ()))
+ temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+
+ CORBA::Long
+CIAO_GLUE_BasicSP::EC_Servant::hertz (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Simply relay to executor. May not need to return the result...
+ return this->executor_->hertz (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ void
+CIAO_GLUE_BasicSP::EC_Servant::hertz (CORBA::Long hertz
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Simply relay to executor. May not need to return the result...
+ this->executor_->hertz (hertz
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// Operations for publishes interfaces.
+ ::Components::Cookie *
+CIAO_GLUE_BasicSP::EC_Servant::subscribe_timeout (BasicSP::TimeOutConsumer_ptr c
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::ExceededConnectionLimit))
+{
+ return this->context_->subscribe_timeout (c
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ BasicSP::TimeOutConsumer_ptr
+CIAO_GLUE_BasicSP::EC_Servant::unsubscribe_timeout (::Components::Cookie *ck
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::InvalidConnection))
+{
+ return this->context_->unsubscribe_timeout (ck
+ ACE_ENV_ARG_PARAMETER);
+}
+
+/*********************************************************/
+
+BasicSP::EC_ptr
+CIAO_GLUE_BasicSP::ECHome_Servant::_ciao_activate_component (BasicSP::CCM_EC_ptr exe
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Object_var hobj= this->container_->get_objref (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ ::Components::CCMHome_var home = ::Components::CCMHome::_narrow (hobj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CIAO_GLUE_BasicSP::EC_Servant *svt =
+ new CIAO_GLUE_BasicSP::EC_Servant (exe,
+ home.in (),
+ this->container_);
+ PortableServer::ServantBase_var safe (svt);
+ PortableServer::ObjectId_var oid;
+
+ CORBA::Object_var objref
+ = this->container_->install_component (svt,
+ oid.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ BasicSP::EC_var ho
+ = BasicSP::EC::_narrow (objref.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->component_map_.bind (oid.in (), svt) == 0)
+ {
+ // @@ what should happen if bind fail?
+ safe._retn ();
+ }
+ return ho._retn ();
+}
+
+void
+CIAO_GLUE_BasicSP::ECHome_Servant::_ciao_passivate_component (BasicSP::EC_ptr comp
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::ObjectId_var oid;
+
+ this->container_->uninstall_component (comp,
+ oid.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CIAO_GLUE_BasicSP::EC_Servant *servant = 0;
+ if (this->component_map_.unbind (oid.in (), servant) == 0)
+ {
+ PortableServer::ServantBase_var safe (servant);
+ servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ // What happen if unbind failed?
+
+}
+
+// Operations for Implicit Home interface
+BasicSP::EC_ptr
+CIAO_GLUE_BasicSP::ECHome_Servant::create (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure))
+{
+ if (this->executor_.in () == 0)
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+
+ Components::EnterpriseComponent_var _ciao_ec =
+ this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ BasicSP::CCM_EC_var _ciao_comp
+ = BasicSP::CCM_EC::_narrow (_ciao_ec.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->_ciao_activate_component (_ciao_comp.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// Operations for CCMHome interface
+void
+CIAO_GLUE_BasicSP::ECHome_Servant::remove_component (Components::CCMObject_ptr comp
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::RemoveFailure))
+{
+ BasicSP::EC_var _ciao_comp
+ = BasicSP::EC::_narrow (comp
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (_ciao_comp.in ()))
+ ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here?
+
+ // @@ It seems to me that we need to make sure this is a component
+ // generated by this home before calling remove on this component.
+ _ciao_comp->remove (ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+
+ // Removing the object reference? get the servant from the POA with
+ // the objref, and call remove() on the component, deactivate the
+ // component, and then remove-ref the servant?
+ this->_ciao_passivate_component (_ciao_comp.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+
+
+CIAO_GLUE_BasicSP::ECHome_Servant::ECHome_Servant (BasicSP::CCM_ECHome_ptr exe,
+ CIAO::Session_Container *c)
+ : executor_ (BasicSP::CCM_ECHome::_duplicate (exe)),
+ container_ (c)
+{
+}
+
+
+CIAO_GLUE_BasicSP::ECHome_Servant::~ECHome_Servant (void)
+{
+}
+
+// for factory operations inherit from parent home(s), they should return
+// the corresponding component types their homes manage
+ BasicSP::EC_ptr
+CIAO_GLUE_BasicSP::ECHome_Servant::new_EC (CORBA::Long hertz
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::CreateFailure))
+{
+ Components::EnterpriseComponent_var _ciao_ec =
+ this->executor_->new_EC (hertz
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ BasicSP::CCM_EC_var _ciao_comp
+ = BasicSP::CCM_EC::_narrow (_ciao_ec.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->_ciao_activate_component (_ciao_comp.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// Operations for KeylessHome interface
+ ::Components::CCMObject_ptr
+CIAO_GLUE_BasicSP::ECHome_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure))
+{
+ // Simply forward to the create method.
+ return this->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+// Operations for CCMHome interface
+ ::CORBA::IRObject_ptr
+CIAO_GLUE_BasicSP::ECHome_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // @@ TO-DO. Contact IfR?
+
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+ CORBA::IRObject_ptr
+CIAO_GLUE_BasicSP::ECHome_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // @@ TO-DO. Contact IfR?
+
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+
+extern "C" EC_SVNT_Export ::PortableServer::Servant
+createECHome_Servant (::Components::HomeExecutorBase_ptr p,
+ CIAO::Session_Container *c
+ ACE_ENV_ARG_DECL)
+{
+ if (p == 0)
+ return 0;
+
+ BasicSP::CCM_ECHome_var x
+ = BasicSP::CCM_ECHome::_narrow (p
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (x.in ()))
+ return 0;
+
+ return new CIAO_GLUE_BasicSP::ECHome_Servant (x.in (),
+ c);
+}
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.h
new file mode 100644
index 00000000000..17f9fd113f9
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt.h
@@ -0,0 +1,391 @@
+// $Id$
+
+// ===========================================================
+//
+// @file EC_svnt.h
+//
+// This is a pseudo-meta generic servant implementations template
+// for CIAO's CIDL compiler. It demonstrates how a servant
+// implementation for a session component should look like.
+//
+// @author Balachandran Natarajan
+//
+// ===========================================================
+
+#ifndef CIAO_GLUE_SESSION_EC_SVNT_H
+#define CIAO_GLUE_SESSION_EC_SVNT_H
+#include "ace/pre.h"
+
+#include "ECS.h" // Source in the skeletons for component
+ // client-view equivalent interfaces
+#include "ECEC.h" // Source in the executor mapping
+ // that component implementations use
+#include "ciao/Container_Base.h" //Source in the container interface definitions
+#include "tao/LocalObject.h"
+#include "tao/PortableServer/Key_Adapters.h"
+#include "ace/Active_Map_Manager_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace CIAO_GLUE_BasicSP
+{
+ //////////////////////////////////////////////////////////////////
+ // Component specific context implementation
+ class EC_SVNT_Export EC_Context :
+ public virtual BasicSP::CCM_EC_Context,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ // We will allow the the servant glue code we generate to access
+ // our states.
+ friend class EC_Servant;
+
+ // Ctor.
+ EC_Context (::Components::CCMHome_ptr home,
+ ::CIAO::Session_Container *c,
+ EC_Servant *sv);
+
+ // Dtor.
+ virtual ~EC_Context ();
+
+ void push_timeout (BasicSP::TimeOut *ev
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Operations for ::Components::CCMContext
+ virtual ::Components::Principal_ptr get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::Components::CCMHome_ptr get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Boolean get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ virtual ::Components::Transaction::UserTransaction_ptr get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ virtual CORBA::Boolean is_caller_in_role (const char * role
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ // Operations for ::Components::SessionContext interface
+ virtual CORBA::Object_ptr get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::IllegalState));
+
+ protected:
+ // We need to generate, in protected section, stuff that manage
+ // connections and consumers of this component.
+
+ // Operations for publishes interfaces.
+ ::Components::Cookie *
+ subscribe_timeout (BasicSP::TimeOutConsumer_ptr c
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::ExceededConnectionLimit));
+
+ BasicSP::TimeOutConsumer_ptr
+ unsubscribe_timeout (::Components::Cookie *ck
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::InvalidConnection));
+
+ ACE_Active_Map_Manager<BasicSP::TimeOutConsumer_var> ciao_publishes_timeout_map_;
+
+ protected:
+ /// Cached component home reference.
+ ::Components::CCMHome_var home_;
+
+ /// session container
+ ::CIAO::Session_Container *container_;
+
+ /// Reference back to owner.
+ EC_Servant *servant_;
+
+ /// @@ Cached component reference.
+ BasicSP::EC_var component_;
+ };
+
+ //////////////////////////////////////////////////////////////////
+ // Component Servant Glue code implementation
+ class EC_SVNT_Export EC_Servant
+ : public virtual POA_BasicSP::EC, // full skeleton name here
+ public virtual PortableServer::RefCountServantBase
+ {
+ public:
+ // Ctor.
+ EC_Servant (BasicSP::CCM_EC_ptr executor,
+ ::Components::CCMHome_ptr home,
+ ::CIAO::Session_Container *c);
+
+ // Dtor.
+ ~EC_Servant (void);
+
+ // Operations from supported interfaces and inherited components
+
+ virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void hertz (CORBA::Long hertz
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Operations for provides interfaces.
+
+ // Operations for receptacles interfaces.
+
+ // Operations for consumers interfaces.
+
+ // Operations for emits interfaces.
+
+ // Operations for publishes interfaces.
+ virtual ::Components::Cookie *
+ subscribe_timeout (BasicSP::TimeOutConsumer_ptr c
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::ExceededConnectionLimit));
+
+ virtual BasicSP::TimeOutConsumer_ptr
+ unsubscribe_timeout (::Components::Cookie *ck
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::InvalidConnection));
+
+ // Operations for Navigation interface
+ virtual CORBA::Object_ptr provide_facet (const char * name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException ,
+ Components::InvalidName)) ;
+ virtual ::Components::FacetDescriptions * get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Components::FacetDescriptions * get_named_facets (const Components::NameList & names
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException ,
+ Components::InvalidName));
+ virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Operations for Receptacles interface
+ virtual ::Components::Cookie *connect (const char * name,
+ CORBA::Object_ptr connection
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection,
+ Components::AlreadyConnected,
+ Components::ExceededConnectionLimit));
+ virtual CORBA::Object_ptr disconnect (const char * name,
+ Components::Cookie *ck
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection,
+ Components::CookieRequired,
+ Components::NoConnection));
+ virtual ::Components::ConnectionDescriptions * get_connections (const char * name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName));
+
+ virtual ::Components::ReceptacleDescriptions * get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Components::ReceptacleDescriptions * get_named_receptacles (const Components::NameList & names
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName));
+
+ // Operations for Events interface
+ virtual ::Components::EventConsumerBase_ptr get_consumer (const char * sink_name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName));
+ virtual ::Components::Cookie *subscribe (const char * publisher_name,
+ Components::EventConsumerBase_ptr subscriber
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection,
+ Components::ExceededConnectionLimit));
+ virtual ::Components::EventConsumerBase_ptr unsubscribe (const char * publisher_name,
+ Components::Cookie *ck
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::InvalidConnection));
+ virtual void connect_consumer (const char * emitter_name,
+ Components::EventConsumerBase_ptr consumer
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::AlreadyConnected,
+ Components::InvalidConnection));
+ virtual ::Components::EventConsumerBase_ptr disconnect_consumer (const char * source_name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName,
+ Components::NoConnection));
+ virtual ::Components::ConsumerDescriptions * get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Components::ConsumerDescriptions * get_named_consumers (const Components::NameList & names
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName));
+ virtual ::Components::EmitterDescriptions * get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Components::EmitterDescriptions * get_named_emitters (const Components::NameList & names
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName));
+ virtual ::Components::PublisherDescriptions * get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Components::PublisherDescriptions * get_named_publishers (const Components::NameList & names
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidName));
+
+ // Operations for CCMObject interface
+ virtual ::CORBA::IRObject_ptr get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Components::CCMHome_ptr get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual ::Components::PrimaryKeyBase * get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::NoKeyAvailable));
+ virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::InvalidConfiguration));
+ virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::RemoveFailure));
+ virtual ::Components::ComponentPortDescription * get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // get_component implementation.
+ virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // CIAO specific operations.
+
+ // Activate the object in the container_
+ void
+ _ciao_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void
+ _ciao_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ protected:
+ // My Executor.
+ BasicSP::CCM_EC_var executor_;
+
+ // My Run-time Context.
+ EC_Context *context_;
+
+ // Managing container.
+ ::CIAO::Session_Container *container_;
+ };
+
+ //////////////////////////////////////////////////////////////////
+ // Component Home Glue code implementation
+
+ // Foreach component home
+ class EC_SVNT_Export ECHome_Servant :
+ public virtual POA_BasicSP::ECHome, // full skeleton name here
+ public virtual PortableServer::RefCountServantBase
+ {
+ public:
+ // Ctor.
+ ECHome_Servant (BasicSP::CCM_ECHome_ptr exe,
+ CIAO::Session_Container *c);
+
+ // Dtor.
+ ~ECHome_Servant (void);
+
+ // User defined and inherited operations
+
+ // Factory operations.
+ virtual BasicSP::EC_ptr new_EC (CORBA::Long hertz
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::Components::CreateFailure));
+
+ // Finder operations.
+
+
+ // Operations for KeylessHome interface
+ virtual ::Components::CCMObject_ptr
+ create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure));
+
+ // Operations for Implicit Home interface
+ virtual BasicSP::EC_ptr
+ create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CreateFailure));
+
+ // Operations for CCMHome interface
+ virtual ::CORBA::IRObject_ptr
+ get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::CORBA::IRObject_ptr
+ get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void
+ remove_component (Components::CCMObject_ptr comp
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::RemoveFailure));
+
+ protected:
+ // Helper method for factory operations.
+ BasicSP::EC_ptr
+ _ciao_activate_component (BasicSP::CCM_EC_ptr exe
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void
+ _ciao_passivate_component (BasicSP::EC_ptr comp
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // My Executor.
+ BasicSP::CCM_ECHome_var executor_;
+
+ // My Container
+ CIAO::Session_Container *container_;
+
+ // Components this home manages.
+ ACE_Hash_Map_Manager_Ex <PortableServer::ObjectId,
+ EC_Servant*,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ ACE_SYNCH_MUTEX> component_map_;
+ };
+}
+
+extern "C" EC_SVNT_Export ::PortableServer::Servant
+createECHome_Servant (::Components::HomeExecutorBase_ptr p,
+ CIAO::Session_Container *c
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#if defined (__ACE_INLINE__)
+# include "EC_svnt.inl"
+#endif /* __ACE_INLINE__ */
+
+
+#include "ace/post.h"
+#endif /* CIAO_GLUE_SESSION_EC_SVNT_H */
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt_export.h b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt_export.h
new file mode 100644
index 00000000000..41da2dfc871
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC_svnt_export.h
@@ -0,0 +1,50 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl EC_SVNT
+// ------------------------------
+#ifndef EC_SVNT_EXPORT_H
+#define EC_SVNT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (EC_SVNT_HAS_DLL)
+# define EC_SVNT_HAS_DLL 1
+#endif /* ! EC_SVNT_HAS_DLL */
+
+#if defined (EC_SVNT_HAS_DLL) && (EC_SVNT_HAS_DLL == 1)
+# if defined (EC_SVNT_BUILD_DLL)
+# define EC_SVNT_Export ACE_Proper_Export_Flag
+# define EC_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* EC_SVNT_BUILD_DLL */
+# define EC_SVNT_Export ACE_Proper_Import_Flag
+# define EC_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* EC_SVNT_BUILD_DLL */
+#else /* EC_SVNT_HAS_DLL == 1 */
+# define EC_SVNT_Export
+# define EC_SVNT_SINGLETON_DECLARATION(T)
+# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* EC_SVNT_HAS_DLL == 1 */
+
+// Set EC_SVNT_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (EC_SVNT_NTRACE)
+# if (ACE_NTRACE == 1)
+# define EC_SVNT_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define EC_SVNT_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !EC_SVNT_NTRACE */
+
+#if (EC_SVNT_NTRACE == 1)
+# define EC_SVNT_TRACE(X)
+#else /* (EC_SVNT_NTRACE == 1) */
+# define EC_SVNT_TRACE(X) ACE_TRACE_IMPL(X)
+#endif /* (EC_SVNT_NTRACE == 1) */
+
+#endif /* EC_SVNT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/client.cpp b/TAO/CIAO/examples/handcrafted/BasicSP/EC/client.cpp
new file mode 100644
index 00000000000..366131f28d9
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/client.cpp
@@ -0,0 +1,61 @@
+// $Id$
+
+//==============================================================
+/**
+ * @file client.cpp
+ *
+ * This is a simple client test program that interact with the EC
+ * component implementation. This test uses the explicit factory
+ * operation in the home interface to create a EC component
+ * instance, run it for a while, and destroy the component instance.
+ */
+//==============================================================
+
+#include "ECC.h"
+
+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);
+
+ // Resolve HomeFinder interface
+
+ CORBA::Object_var obj
+ = orb->string_to_object ("file://ECHome.ior" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ BasicSP::ECHome_var home
+ = BasicSP::ECHome::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (home.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire ECHome objref\n"), -1);
+
+ BasicSP::EC_var pulser
+ = home->new_EC (8
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_OS::sleep (45);
+ home->remove_component (pulser.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ 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;
+}
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/controller.cpp b/TAO/CIAO/examples/handcrafted/BasicSP/EC/controller.cpp
new file mode 100644
index 00000000000..3714b6ab7fd
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/controller.cpp
@@ -0,0 +1,110 @@
+// $Id$
+/**
+ * @file controller.cpp
+ *
+ * This program interact with a EC component, and set the rate of the
+ * EC.
+ */
+
+
+#include "ECC.h"
+#include "ace/Get_Opt.h"
+
+
+char *rategen_ior_ = 0;
+int rate = 2;
+int turn_on = 1;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "k:r:of");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ turn_on = 1;
+ break;
+
+ case 'f':
+ turn_on = 0;
+ break;
+
+ case 'k':
+ rategen_ior_ = get_opts.opt_arg ();
+ break;
+
+ case 'r':
+ rate = atoi (get_opts.opt_arg ());
+ break;
+
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s\n"
+ "-o (Turn on the rate generator)\n"
+ "-f (Turn off the rate generator)\n"
+ "-k <EC IOR> (default is file://rategen.ior)\n"
+ "-r <rate in hertz> (default is 3)\n"
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ if (rategen_ior_ == 0)
+ rategen_ior_ = "file://rategen.ior";
+
+ if (rate == 0)
+ rate = 3;
+
+ 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 (rategen_ior_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ BasicSP::EC_var pulser
+ = BasicSP::EC::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (pulser.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'EC' objref\n"), -1);
+
+ pulser->hertz (rate
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Start up the Rate Generator\n"));
+
+
+ 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;
+}