summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-03-21 04:03:41 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-03-21 04:03:41 +0000
commit990dceee7b95cb87c667e38845e52caa8d7a773f (patch)
tree43d5776763994fe28c3dc076d5cd1939b2da210f
parent848a2b66ed290374704819dadcfbbb1cd5b5fd7a (diff)
downloadATCD-990dceee7b95cb87c667e38845e52caa8d7a773f.tar.gz
*** empty log message ***
-rw-r--r--TAO/CIAO/ChangeLog40
-rw-r--r--TAO/CIAO/ciao/ComponentInstallation_Impl.cpp5
-rw-r--r--TAO/CIAO/docs/index.html2
-rw-r--r--TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp20
-rw-r--r--TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h9
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/CIAO_Installation_Data.ini3
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.csd74
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc12
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.ssd52
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_comp.idl14
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp159
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h59
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp20
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h10
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp57
-rw-r--r--TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl108
-rw-r--r--TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp8
17 files changed, 626 insertions, 26 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog
index 325e8fec87e..52d3828e031 100644
--- a/TAO/CIAO/ChangeLog
+++ b/TAO/CIAO/ChangeLog
@@ -1,3 +1,43 @@
+Thu Mar 20 21:50:07 2003 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ciao/ComponentInstallation_Impl.cpp: Added a more comprehensive
+ error printout.
+
+ * docs/index.html: Fixed a broken link.
+
+ * docs/templates/CIAO_Glue_Session_Template.cpp:
+ * docs/templates/CIAO_Glue_Session_Template.h: Added the servant
+ factory entry point function that I missed.
+
+ * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp:
+ * examples/handcrafted/Display/RateGen/RateGen_svnt.h: Fixed up
+ the servant DLL entry point.
+
+ * examples/handcrafted/Display/RateGen/RateGen.mpc:
+ * examples/handcrafted/Display/RateGen/RateGen_comp.idl:
+ * examples/handcrafted/Display/RateGen/RateGen_exec.cpp:
+ * examples/handcrafted/Display/RateGen/RateGen_exec.h: Added the
+ actual implementation for component executor.
+
+ * examples/handcrafted/Display/CIAO_Installation_Data.ini: Added
+ this deployment datafile. This file will contain information
+ describing all the components used in this example.
+
+ * examples/handcrafted/Display/RateGen/RateGen.csd:
+ * examples/handcrafted/Display/RateGen/RateGen.ssd: Added XML
+ component descriptors.
+
+ * examples/handcrafted/Display/RateGen/client.cpp: Added a test
+ client program.
+
+ * examples/handcrafted/Display/RateGen/run_test.pl: Added a test
+ script to test out this single component.
+
+ * tools/ComponentServer/ComponentServer_test_client.cpp: Changed
+ the client program to debug RateGen component. We need to make
+ this test client more robust so we can use it to debug different
+ component implementations more easily.
+
Tue Mar 18 16:36:07 2003 Nanbor Wang <nanbor@cs.wustl.edu>
* bin/generate_component_mpc.pl:
diff --git a/TAO/CIAO/ciao/ComponentInstallation_Impl.cpp b/TAO/CIAO/ciao/ComponentInstallation_Impl.cpp
index 37dfb0b842d..4c8c601316d 100644
--- a/TAO/CIAO/ciao/ComponentInstallation_Impl.cpp
+++ b/TAO/CIAO/ciao/ComponentInstallation_Impl.cpp
@@ -42,7 +42,10 @@ CIAO::ComponentInstallation_Impl::init (const char *fname,
auto_ptr<ACE_Configuration_Heap> config (tmp);
if (config->open () != 0)
- ACE_THROW_RETURN (CORBA::INTERNAL (), -1);
+ {
+ ACE_DEBUG ((LM_ERROR, "Unable to initilize installation datafile\n"));
+ ACE_THROW_RETURN (CORBA::INTERNAL (), -1);
+ }
ACE_Ini_ImpExp import (*config);
diff --git a/TAO/CIAO/docs/index.html b/TAO/CIAO/docs/index.html
index bb6593fbe35..4a6171ffd63 100644
--- a/TAO/CIAO/docs/index.html
+++ b/TAO/CIAO/docs/index.html
@@ -25,7 +25,7 @@ resources for using <i>CIAO</i>.
<li>Project <a href="releasenotes.html">Status (aka. Release
Notes.)</a><p>
- <li>This <a href="new_components">page on implementing new
+ <li>This <a href="new_components.html">page on implementing new
component</a> explains all the user-defined and tool-generated
files when implementing a component.<p>
diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp
index 0b8f01329a8..c0d8f60c2f2 100644
--- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp
+++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp
@@ -1186,3 +1186,23 @@ void
this->_ciao_passivate_component (_ciao_comp.in ()
ACE_ENV_ARG_PARAMETER);
}
+
+extern "C" [SERVANT]_Export ::PortableServer::Servant
+create[home name]_Servant (::Components::HomeExecutorBase_ptr p,
+ CIAO::Session_Container *c
+ ACE_ENV_ARG_DECL);
+{
+ if (p == 0)
+ return 0;
+
+ CCM_[home name]_var x
+ = CCM_[home name]::_narrow (p
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (x.in ()))
+ return 0;
+
+ return new [ciao module name]::[home name]_Servant (x.in (),
+ c);
+}
diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h
index 359d9f367ac..30a744593c0 100644
--- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h
+++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h
@@ -721,12 +721,13 @@ namespace CIAO_GLUE
ACE_SYNCH_MUTEX> component_map_;
};
- extern "C" [SERVANT]_Export ::PortableServer::Servant
- create[home name]_Servant (::Components::HomeExecutorBase_ptr p,
- CIAO::Session_Container *c
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
}
+extern "C" [SERVANT]_Export ::PortableServer::Servant
+create[home name]_Servant (::Components::HomeExecutorBase_ptr p,
+ CIAO::Session_Container *c
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
#if defined (__ACE_INLINE__)
# include "[idl-name]_svnt.inl"
#endif /* __ACE_INLINE__ */
diff --git a/TAO/CIAO/examples/handcrafted/Display/CIAO_Installation_Data.ini b/TAO/CIAO/examples/handcrafted/Display/CIAO_Installation_Data.ini
new file mode 100644
index 00000000000..1a923cb9662
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/Display/CIAO_Installation_Data.ini
@@ -0,0 +1,3 @@
+[ComponentInstallation]
+DCE:82C2B032-37F0-4315-A59F-7020D3264E4D=RateGen_exec
+DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3=RateGen_svnt
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.csd b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.csd
new file mode 100644
index 00000000000..39e88bbdf3e
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.csd
@@ -0,0 +1,74 @@
+<?xml version="1.0"?> <!-- -*- SGML -*- -->
+
+<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) -->
+<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd">
+
+<!-- RateGen's Software Package Descriptor -->
+<!-- This file describes various RateGen executor -->
+<!-- implementations. -->
+
+
+<softpkg name="CIAO-RateGen" version="1.0">
+ <pkgtype>CORBA Component</pkgtype>
+ <title>Rate Generator</title>
+ <author>
+ <company>Washington University in St. Louis</company>
+ <webpage href="http://www.cs.wustl.edu/~doc/"/>
+ </author>
+ <description>A RateGen executor implementation.</description>
+ <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/>
+ <idl id="IDL:HUDisplay/RateGen:1.0" homeid="IDL:HUDisplay/RateGenHome:1.0">
+ <fileinarchive name="RateGen.idl"/>
+ </idl>
+
+ <!-- We don't need a property file for this example. However, -->
+ <!-- what to do with this element? Cache it in ComponentInstallation? -->
+ <!-- A better question maybe, when do we actually read the file and -->
+ <!-- build the attributes defined in the file? By Assembly perhaps? -->
+ <!-- Notice that this property file applies to the implementation itself. -->
+ <!-- Whatever that means. -->
+<!-- <propertyfile> -->
+<!-- <fileinarchive name="empty.cpf"/> -->
+<!-- </propertyfile> -->
+
+ <descriptor type="CORBA Component">
+ <fileinarchive name="RateGen.ccd"/>
+ </descriptor>
+
+ <implementation id="DCE:82C2B032-37F0-4315-A59F-7020D3264E4D">
+ <!-- Perhaps we can list more OS here as ACE knows what to look for? -->
+ <!-- Maybe not... But then selecting the right configuration becomes hard. -->
+ <os name="WinNT" version="4.0"/>
+ <os name="WinXP" version="5.0"/>
+ <processor name="x86"/>
+ <!-- What about configuration? Such as Debug/Release? -->
+ <compile name="MSVC" version="6.0"/>
+ <programminglanguage name="C++"/>
+ <dependency type="ORB">
+ <name>TAO</name>
+ </dependency>
+
+ <!-- CIAO extension -->
+ <dependency type="CIAODLL">
+ <softpkgref>
+ <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension -->
+ <fileinarchive name="RateGen.ssd"/>
+ <implref idref="DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3"/>
+ </softpkgref>
+ </dependency>
+
+ <!-- What happens when one define descriptors for both softpkg and -->
+ <!-- implementations? -->
+
+ <code type="DLL">
+ <!-- No need to specify extension below since ACE takes care of that, -->
+ <fileinarchive name="RateGen_exec"/>
+ <entrypoint>createRateGenHome_Impl</entrypoint>
+ </code>
+
+ </implementation>
+
+ <!-- Let's add more implementation description later when we try to -->
+ <!-- compile this stuff on, say, Solaris and Linux. -->
+
+</softpkg> \ No newline at end of file
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc
index f9a965b03b6..69e0e5b57e7 100644
--- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc
@@ -53,3 +53,15 @@ project(RateGen_exec) : ciao_server {
RateGen_exec.cpp
}
}
+
+project (RateGen_client) : ciao_client {
+ exename = client
+ depends += RateGen_stub
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ client.cpp
+ }
+} \ No newline at end of file
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.ssd b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.ssd
new file mode 100644
index 00000000000..0b0ffcbf352
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.ssd
@@ -0,0 +1,52 @@
+<?xml version="1.0"?> <!-- -*- SGML -*- -->
+
+<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) -->
+<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd">
+
+<!-- RateGen's Servant Software Descriptor -->
+<!-- This file describes various RateGen servant -->
+<!-- implementations. -->
+
+
+<softpkg name="CIAO-RateGen-Servant" version="1.0">
+ <pkgtype>CIAO Servant</pkgtype>
+ <title>HUDisplay::RateGen Servants</title>
+ <author>
+ <company>Washington University in St. Louis</company>
+ <webpage href="http://www.cs.wustl.edu/~doc/"/>
+ </author>
+ <description>A RateGen servant implementation.</description>
+ <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/>
+ <idl id="IDL:HUDisplay/RateGen:1.0" homeid="IDL:HUDisplay/RateGenHome:1.0">
+ <fileinarchive name="RateGen.idl"/>
+ </idl>
+
+ <!-- Duplicate information. We should use the copy in RateGen.csd -->
+ <!-- So, do we really need this one? -->
+ <descriptor type="CORBA Component">
+ <fileinarchive name="RateGen.ccd"/>
+ </descriptor>
+
+ <implementation id="DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3">
+ <!-- The following stuff should match those defined in csd file. -->
+ <os name="WinNT" version="4.0"/>
+ <os name="WinXP" version="5.0"/>
+ <processor name="x86"/>
+ <compile name="MSVC" version="6.0"/>
+ <programminglanguage name="C++"/>
+ <dependency type="ORB">
+ <name>TAO</name>
+ </dependency>
+
+ <code>
+ <!-- No need to specify extension below since ACE takes care of that, -->
+ <fileinarchive name="RateGen_svnt"/>
+ <entrypoint>createRateGenHome_Servant</entrypoint>
+ </code>
+
+ </implementation>
+
+ <!-- Let's add more implementation description later when we try to -->
+ <!-- compile this stuff on, say, Solaris and Linux. -->
+
+</softpkg> \ No newline at end of file
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_comp.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_comp.idl
new file mode 100644
index 00000000000..fcdfdf61c1a
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_comp.idl
@@ -0,0 +1,14 @@
+// $Id$
+
+/**
+ * @file RateGen.idl
+ *
+ * Definition of the RateGen (a rate generator) component.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+
+#ifndef RATEGEN_IDL
+#define RATEGEN_IDL
+
+Component implementation
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp
index c18637240e0..aed3bd30a70 100644
--- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp
@@ -1,17 +1,135 @@
// $Id$
#include "RateGen_exec.h"
+#include "ace/Timer_Queue.h"
+#include "ace/Reactor.h"
-MyImpl::RateGen_exec_impl::RateGen_exec_impl ()
+//=================================================================
+
+MyImpl::Pulse_Handler::Pulse_Handler (MyImpl::RateGen_exec_impl *cb)
: active_ (0),
- hertz_ (0)
+ count_ (0),
+ done_ (0),
+ tid_ (0),
+ pulse_callback_ (cb)
+{
+ // Nothing
+ this->reactor (new ACE_Reactor);
+}
+
+MyImpl::Pulse_Handler::~Pulse_Handler ()
+{
+ delete this->reactor ();
+ this->reactor (0);
+}
+
+int
+MyImpl::Pulse_Handler::open ()
+{
+ return this->thr_mgr_.spawn (Pulse_Handler::svc_run,
+ this);
+}
+
+int
+MyImpl::Pulse_Handler::close ()
+{
+ this->done_ = 1;
+ this->reactor ()->notify ();
+
+ ACE_DEBUG ((LM_DEBUG, "Waiting\n"));
+ return this->thr_mgr_.wait ();
+}
+
+int
+MyImpl::Pulse_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::Pulse_Handler::stop (void)
+{
+ if (this->active_ == 0) // Not valid.
+ return -1;
+
+ this->reactor ()->cancel_timer (this);
+
+ this->active_ = 0;
+ return 0;
+}
+
+int
+MyImpl::Pulse_Handler::active (void)
+{
+ return this->active_;
+}
+
+int
+MyImpl::Pulse_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::Pulse_Handler::handle_timeout (const ACE_Time_Value &tv,
+ const void *arg)
+{
+ this->pulse_callback_->pulse ();
+
+// ACE_DEBUG ((LM_DEBUG,
+// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"),
+// this,
+// this->count_,
+// tv.sec (),
+// tv.usec ()));
+
+ ++this->count_;
+ return 0;
+}
+
+ACE_THR_FUNC_RETURN
+MyImpl::Pulse_Handler::svc_run (void *args)
+{
+ Pulse_Handler *handler = (Pulse_Handler *) args;
+
+ handler->reactor ()->owner (ACE_OS::thr_self ());
+
+ while (!handler->done_)
+ handler->reactor ()->handle_events ();
+
+ return 0;
+}
+
+//=================================================================
+
+MyImpl::RateGen_exec_impl::RateGen_exec_impl ()
+ : hertz_ (0),
+ pulser_ (this)
{
}
MyImpl::RateGen_exec_impl::RateGen_exec_impl (CORBA::Long hz)
- : active_ (0),
- hertz_ (hz)
+ : hertz_ (hz),
+ pulser_ (this)
{
}
@@ -40,28 +158,29 @@ void
MyImpl::RateGen_exec_impl::start (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- if (this->hertz_ == 0 || this->active_)
+ if (this->hertz_ == 0 || this->pulser_.active())
ACE_THROW (CORBA::BAD_INV_ORDER ());
// @@ Start the rate generator
-
+ this->pulser_.start (this->hertz_);
}
void
MyImpl::RateGen_exec_impl::stop (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- if (! this->active_)
+ if (! this->pulser_.active ())
ACE_THROW (CORBA::BAD_INV_ORDER ());
// @@ stop the rate generator
+ this->pulser_.stop ();
}
CORBA::Boolean
MyImpl::RateGen_exec_impl::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return this->active_ != 0;
+ return this->pulser_.active ();
}
// Operations from Components::SessionComponent
@@ -91,6 +210,8 @@ MyImpl::RateGen_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
Components::CCMException))
{
ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_activate\n"));
+
+ this->pulser_.open ();
}
void
@@ -99,6 +220,7 @@ MyImpl::RateGen_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
Components::CCMException))
{
ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_passivate\n"));
+ this->pulser_.close ();
}
void
@@ -109,6 +231,27 @@ MyImpl::RateGen_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_remove\n"));
}
+void
+MyImpl::RateGen_exec_impl::pulse (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Pushing HUDisplay::tick event!\n")));
+
+ HUDisplay::tick_var ev = new OBV_HUDisplay::tick ();
+
+ this->context_->push_Pulse (ev.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+ ACE_CATCHANY
+ {
+ // @@ do nothing?
+ }
+ ACE_ENDTRY;
+
+}
+
MyImpl::RateGenHome_exec_impl::RateGenHome_exec_impl ()
{
}
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h
index f2150aa4c07..a4a9f8939c3 100644
--- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h
@@ -14,9 +14,58 @@
#include "RateGen_ImplC.h"
#include "tao/LocalObject.h"
+#include "ace/Thread_Manager.h"
+#include "ace/Event_Handler.h"
namespace MyImpl
{
+ // Forward decl.
+ class RateGen_exec_impl;
+
+ /**
+ * @brief Active pulse generater
+ */
+ class Pulse_Handler : public ACE_Event_Handler
+ {
+ public:
+ // Default constructor
+ Pulse_Handler (RateGen_exec_impl *cb);
+ ~Pulse_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);
+
+ static ACE_THR_FUNC_RETURN svc_run (void *args);
+
+ private:
+ long active_;
+
+ long count_;
+
+ int done_;
+
+ int tid_;
+
+ RateGen_exec_impl *pulse_callback_;
+
+ ACE_Thread_Manager thr_mgr_;
+ };
+
/**
* @class RateGen_exec_impl
*
@@ -75,15 +124,18 @@ namespace MyImpl
ACE_THROW_SPEC ((CORBA::SystemException,
Components::CCMException));
- protected:
- /// status
- int active_;
+ /// Helper function to be called back by Pulse_Handler
+ void pulse (void);
+ protected:
/// Frequency
CORBA::Long hertz_;
/// Copmponent specific context
HUDisplay::CCM_RateGen_Context_var context_;
+
+ ///
+ Pulse_Handler pulser_;
};
/**
@@ -117,6 +169,7 @@ namespace MyImpl
ACE_THROW_SPEC ((CORBA::SystemException,
Components::CreateFailure));
};
+
}
extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp
index b5e640f3f9e..8351a2c8e37 100644
--- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp
@@ -699,3 +699,23 @@ CIAO_GLUE_HUDisplay::RateGenHome_Servant::remove_component (Components::CCMObjec
this->_ciao_passivate_component (_ciao_comp.in ()
ACE_ENV_ARG_PARAMETER);
}
+
+extern "C" RATEGEN_SVNT_Export ::PortableServer::Servant
+createRateGenHome_Servant (::Components::HomeExecutorBase_ptr p,
+ CIAO::Session_Container *c
+ ACE_ENV_ARG_DECL)
+{
+ if (p == 0)
+ return 0;
+
+ HUDisplay::CCM_RateGenHome_var x
+ = HUDisplay::CCM_RateGenHome::_narrow (p
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (x.in ()))
+ return 0;
+
+ return new CIAO_GLUE_HUDisplay::RateGenHome_Servant (x.in (),
+ c);
+}
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h
index 1c6be65344a..c7100fbbda6 100644
--- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h
@@ -384,13 +384,13 @@ namespace CIAO_GLUE_HUDisplay
ACE_Equal_To<PortableServer::ObjectId>,
ACE_SYNCH_MUTEX> component_map_;
};
-
- extern "C" RATEGEN_SVNT_Export ::PortableServer::Servant
- createRateGenHome_Servant (::Components::HomeExecutorBase_ptr p,
- CIAO::Session_Container *c
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
}
+extern "C" RATEGEN_SVNT_Export ::PortableServer::Servant
+createRateGenHome_Servant (::Components::HomeExecutorBase_ptr p,
+ CIAO::Session_Container *c
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
#if defined (__ACE_INLINE__)
# include "RateGen_svnt.inl"
#endif /* __ACE_INLINE__ */
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp
new file mode 100644
index 00000000000..bb2ba8e9d89
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp
@@ -0,0 +1,57 @@
+// $Id$
+
+#include "RateGenC.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://RateGenHome.ior" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ HUDisplay::RateGenHome_var home
+ = HUDisplay::RateGenHome::_narrow (obj
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (home.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire RateGenHome objref\n"), -1);
+
+ HUDisplay::RateGen_var pulser
+ = home->new_RateGen (8
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_OS::sleep (5);
+
+ pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ 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/Display/RateGen/run_test.pl b/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl
new file mode 100644
index 00000000000..1745a5d8802
--- /dev/null
+++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl
@@ -0,0 +1,108 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "../../../../../../bin";
+use PerlACE::Run_Test;
+
+$status = 0;
+$daemon_ior = PerlACE::LocalFile ("daemon.ior");
+$svr_ior = PerlACE::LocalFile ("server.ior");
+$home_ior = PerlACE::LocalFile ("RateGenHome.ior");
+
+unlink $daemon_ior;
+unlink $svr_ior;
+unlink $home_ior;
+
+# CIAO Daemon command line arguments
+$daemon_args = "-o $daemon_ior -i ../CIAO_Installation_Data.ini -n ../../../../tools/ComponentServer/ComponentServer";
+
+# CIAO Daemon Controller location:
+$controller = "../../../../tools/Daemon/DaemonController";
+
+# Daemon controller common command line arguments
+$common_args = "-ORBInitRef CIAODaemon=file://$daemon_ior";
+
+# Daemon controller start_home command
+$start_args = "start_home -s RateGen.csd -m $home_ior -c $svr_ior";
+
+# Daemon controller end_home command
+$end_args = "end_home -c file://$svr_ior";
+
+# Daemon controller shutdown command
+$shutdown_args = "shutdown";
+
+# Client program command line arguments
+$cl_args = "";
+
+# Naming_Service process definition
+$DS = new PerlACE::Process ("../../../../tools/Daemon/CIAO_Daemon",
+ "$daemon_args");
+
+# Client process definition
+$CL = new PerlACE::Process ("client",
+ "$cl_args");
+
+## Starting up the CIAO daemon
+$DS->Spawn ();
+if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) {
+ print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n";
+ $DS->Kill ();
+ exit 1;
+}
+
+## Starting up a ComponentServer running the RateGen home.
+$DC = new PerlACE::Process ("$controller",
+ "$common_args $start_args");
+
+$DC->SpawnWaitKill (60);
+if (PerlACE::waitforfile_timed ($home_ior, 15) == -1) {
+ print STDERR "ERROR: Could not find home ior file <$home_ior>\n";
+ $DS->Kill ();
+ exit 1;
+}
+
+$client = $CL->SpawnWaitKill (60);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+## Terminating the ComponentServer running the RateGen home.
+$DC = new PerlACE::Process ("$controller",
+ "$common_args $end_args");
+
+$ctrl = $DC->SpawnWaitKill (60);
+if ($ctrl != 0) {
+ print STDERR "ERROR: Fail to end component server\n";
+ $DS->Kill ();
+ exit 1;
+}
+
+## Terminating the ComponentServer running the RateGen home.
+$DC = new PerlACE::Process ("$controller",
+ "$common_args $shutdown_args");
+
+$ctrl = $DC->SpawnWaitKill (60);
+if ($ctrl != 0) {
+ print STDERR "ERROR: Fail to shutdown CIAODaemon\n";
+ $DS->Kill ();
+ exit 1;
+}
+
+$ctrl = $DS->WaitKill (60);
+if ($ctrl != 0) {
+ print STDERR "ERROR: CIAODaemon didn't shutdown gracefully $ctrl\n";
+ $DS->Kill ();
+ exit 1;
+}
+
+unlink $daemon_ior;
+unlink $svr_ior;
+unlink $home_ior;
+
+exit $status;
diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp b/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp
index 380dc27428c..10988b52018 100644
--- a/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp
+++ b/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp
@@ -78,18 +78,18 @@ main (int argc, char *argv[])
Components::ConfigValue_ptr item = new OBV_Components::ConfigValue ();
item->name (CORBA::string_dup ("CIAO-servant-UUID"));
- item->value () <<= CORBA::string_dup ("DCE:05833d92-4783-4b85-ac14-e2575dac26f7");
+ item->value () <<= CORBA::string_dup ("DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3");
com_config[0] = item;
item = new OBV_Components::ConfigValue ();
item->name (CORBA::string_dup ("CIAO-servant-entrypt"));
- item->value () <<= CORBA::string_dup ("createHelloHome_Servant");
+ item->value () <<= CORBA::string_dup ("createRateGenHome_Servant");
com_config[1] = item;
// ACE_OS::sleep (2);
- container->install_home ("DCE:530a6305-8181-47ca-bd82-0b834016db97",
- "createHelloHome_Impl",
+ container->install_home ("DCE:82C2B032-37F0-4315-A59F-7020D3264E4D",
+ "createRateGenHome_Impl",
com_config
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;