summaryrefslogtreecommitdiff
path: root/modules/CIAO/connectors/dds4ccm/examples/Shapes
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/connectors/dds4ccm/examples/Shapes')
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl36
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc26
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl27
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc145
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.idl26
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.mpc139
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.cpp370
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.h151
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.idl28
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.mpc140
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.cpp285
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.h108
-rw-r--r--modules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp464
-rwxr-xr-xmodules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl244
14 files changed, 2189 insertions, 0 deletions
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl
new file mode 100644
index 00000000000..b5d399bda33
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.idl
@@ -0,0 +1,36 @@
+// $Id$
+
+/**
+ * @file Shapes_Base.idl
+ * @author Marcel Smit <msmit@remedy.nl>
+ */
+
+#ifndef SHAPES_BASE_IDL
+#define SHAPES_BASE_IDL
+
+#pragma ndds typesupport "Base/Shapes_BaseSupport.h"
+#pragma opendds typesupport "Base/Shapes_BaseTypeSupportC.h"
+
+#pragma DCPS_DATA_TYPE "ShapeType"
+#pragma DCPS_DATA_KEY "ShapeType color"
+
+struct ShapeType {
+ string color; //@key
+ long x;
+ long y;
+ long shapesize;
+};
+
+#pragma DCPS_DATA_TYPE "Attributes"
+#pragma DCPS_DATA_KEY "Attributes shape"
+#pragma DCPS_DATA_KEY "Attributes color"
+
+struct Attributes {
+ string shape; //@key
+ string color; //@key
+ float speed;
+};
+
+typedef sequence<ShapeType> ShapeTypeSeq;
+
+#endif
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc
new file mode 100644
index 00000000000..5f953ca0731
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Base/Shapes_Base.mpc
@@ -0,0 +1,26 @@
+// $Id$
+
+project (DDS_Shapes_Base_stub) : taoidldefaults, anytypecode, dds4ccm_ts_default {
+ sharedname = DDS_Shapes_Base_stub
+ dynamicflags += SHAPES_BASE_STUB_BUILD_DLL
+ libout = ../lib
+
+ idlflags += -SS -Sci \
+ -Wb,stub_export_macro=SHAPES_BASE_STUB_Export \
+ -Wb,stub_export_include=Shapes_Base_stub_export.h
+
+ IDL_Files {
+ idlflags += -Gxhst
+ Shapes_Base.idl
+ }
+
+ opendds_ts_flags += --export=SHAPES_BASE_STUB_Export
+
+ DDSGenerator_Files {
+ Shapes_Base.idl
+ }
+
+ Source_Files {
+ }
+}
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl
new file mode 100644
index 00000000000..be2a1a348d7
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.idl
@@ -0,0 +1,27 @@
+// $Id$
+
+/**
+ * @file Shapes_Connector.idl
+ * @author Marcel Smit <msmit@remedy.nl>
+ */
+
+#ifndef SHAPES_CONNECTOR_IDL_
+#define SHAPES_CONNECTOR_IDL_
+
+#include <Components.idl>
+#include "Base/Shapes_Base.idl"
+#include "connectors/dds4ccm/idl/ccm_dds.idl"
+
+#pragma ciao lem "Connector/Shapes_ConnectorE.idl"
+
+module Shapes
+{
+ module ::CCM_DDS::Typed < ::ShapeType, ::ShapeTypeSeq> ShapeTypeConn;
+ connector Shapes_Connector : ShapeTypeConn::DDS_Event
+ {
+ };
+};
+
+#endif /* SHAPES_CONNECTOR_IDL_ */
+
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc
new file mode 100644
index 00000000000..b35a729923c
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Connector/Shapes_Connector.mpc
@@ -0,0 +1,145 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl -p DDS_Shapes_Base -l .. -o ../lib -u DDS Shapes_Connector"
+
+project(DDS_Shapes_Connector_idl_gen) : connectoridldefaults, dds4ccm {
+ after += DDS4CCM_idl_gen
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=SHAPES_CONNECTOR_STUB_Export \
+ -Wb,stub_export_include=Shapes_Connector_stub_export.h \
+ -Wb,skel_export_macro=SHAPES_CONNECTOR_SVNT_Export \
+ -Wb,skel_export_include=Shapes_Connector_svnt_export.h \
+ -Wb,svnt_export_macro=SHAPES_CONNECTOR_SVNT_Export \
+ -Wb,svnt_export_include=Shapes_Connector_svnt_export.h \
+ -Wb,conn_export_macro=SHAPES_CONNECTOR_CONN_Export \
+ -Wb,conn_export_include=Shapes_Connector_conn_export.h \
+ -I ..
+
+ IDL_Files {
+ Shapes_Connector.idl
+ }
+}
+
+project(DDS_Shapes_Connector_lem_gen) : ciaoidldefaults, dds4ccm {
+ custom_only = 1
+ after += DDS_Shapes_Connector_idl_gen
+ idlflags += -Wb,stub_export_macro=SHAPES_CONNECTOR_LEM_STUB_Export \
+ -Wb,stub_export_include=Shapes_Connector_lem_stub_export.h \
+ -SS -Gxhst \
+ -I ..
+
+ IDL_Files {
+ Shapes_ConnectorE.idl
+ }
+}
+
+project(DDS_Shapes_Connector_lem_stub) : ccm_svnt, dds4ccm_base {
+ after += DDS_Shapes_Connector_lem_gen DDS_Shapes_Connector_stub DDS_Shapes_Base_stub DDS4CCM_lem_stub
+ libs += DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS4CCM_lem_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ sharedname = DDS_Shapes_Connector_lem_stub
+ dynamicflags = SHAPES_CONNECTOR_LEM_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_ConnectorEC.cpp
+ }
+
+ Header_Files {
+ Shapes_ConnectorEC.h
+ Shapes_Connector_lem_stub_export.h
+ }
+
+ Inline_Files {
+ Shapes_ConnectorEC.inl
+ }
+}
+
+project(DDS_Shapes_Connector_stub) : ccm_stub, dds4ccm_base {
+ after += DDS_Shapes_Connector_idl_gen DDS_Shapes_Base_stub
+ libs += DDS_Shapes_Base_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ sharedname = DDS_Shapes_Connector_stub
+ dynamicflags = SHAPES_CONNECTOR_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_ConnectorC.cpp
+ }
+
+ Header_Files {
+ Shapes_ConnectorC.h
+ Shapes_Connector_stub_export.h
+ }
+
+ Inline_Files {
+ Shapes_ConnectorC.inl
+ }
+}
+
+project(DDS_Shapes_Connector_exec) : ciao_executor, dds4ccm_impl {
+ after += DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_stub DDS4CCM_lem_stub
+ sharedname = DDS_Shapes_Connector_exec
+ libs += DDS_Shapes_Connector_stub DDS_Shapes_Connector_lem_stub DDS_Shapes_Base_stub DDS4CCM_lem_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ dynamicflags = SHAPES_CONNECTOR_CONN_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_Connector_conn.cpp
+ }
+
+ Header_Files {
+ Shapes_Connector_conn.h
+ Shapes_Connector_conn_export.h
+ }
+
+ Inline_Files {
+ }
+}
+
+
+project(DDS_Shapes_Connector_svnt) : ciao_servant, dds4ccm_impl {
+ after += DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_exec DDS_Shapes_Connector_stub DDS4CCM_lem_stub
+ sharedname = DDS_Shapes_Connector_svnt
+ libs += DDS_Shapes_Connector_stub \
+ DDS_Shapes_Connector_lem_stub \
+ DDS_Shapes_Base_stub \
+ DDS_Shapes_Connector_exec \
+ DDS4CCM_lem_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ dynamicflags = SHAPES_CONNECTOR_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_ConnectorS.cpp
+ Shapes_Connector_svnt.cpp
+ }
+
+ Header_Files {
+ Shapes_ConnectorS.h
+ Shapes_Connector_svnt.h
+ Shapes_Connector_svnt_export.h
+ }
+
+ Inline_Files {
+ Shapes_ConnectorS.inl
+ }
+}
+
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.idl b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.idl
new file mode 100644
index 00000000000..527ea2a356b
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.idl
@@ -0,0 +1,26 @@
+// $Id$
+
+/**
+ * @file
+ * @author Marcel Smit <msmit@remedy.nl>
+ */
+
+#ifndef RECEIVER_IDL
+#define RECEIVER_IDL
+
+#include "Connector/Shapes_Connector.idl"
+
+module Shapes
+{
+ component Receiver
+ {
+ port ShapeTypeConn::DDS_Listen info_out;
+ port ShapeTypeConn::DDS_Get info_get;
+ attribute unsigned long rate;
+ attribute boolean get_data; //if true, get_one and get_all are invoked
+ attribute boolean read_data;//if true, read_one and read_all are invoked.
+ attribute boolean raw_listen; //if true, raw listen port is enabled.
+ };
+};
+
+#endif
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.mpc b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.mpc
new file mode 100644
index 00000000000..083de706195
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver.mpc
@@ -0,0 +1,139 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl -l ../lib -o ../lib -u DDS -b dds4ccm_base Receiver"
+
+project(DDS_Shapes_Receiver_idl_gen) : componentidldefaults, dds4ccm {
+ custom_only = 1
+ after += DDS_Shapes_Connector_idl_gen
+ idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \
+ -Wb,stub_export_include=Receiver_stub_export.h \
+ -Wb,skel_export_macro=RECEIVER_SVNT_Export \
+ -Wb,skel_export_include=Receiver_svnt_export.h \
+ -Wb,svnt_export_macro=RECEIVER_SVNT_Export \
+ -Wb,svnt_export_include=Receiver_svnt_export.h \
+ -Wb,exec_export_macro=RECEIVER_EXEC_Export \
+ -Wb,exec_export_include=Receiver_exec_export.h -I..
+
+ IDL_Files {
+ Shapes_Receiver.idl
+ }
+}
+
+project(DDS_Shapes_Receiver_lem_gen) : ciaoidldefaults, dds4ccm {
+ after += DDS_Shapes_Receiver_idl_gen
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \
+ -Wb,stub_export_include=Receiver_lem_stub_export.h \
+ -SS -Gxhst -I..
+
+ IDL_Files {
+ Shapes_ReceiverE.idl
+ }
+}
+
+project(DDS_Shapes_Receiver_lem_stub) : ccm_svnt, dds4ccm_base {
+ after += DDS_Shapes_Receiver_lem_gen DDS_Shapes_Receiver_stub DDS_Shapes_Connector_stub DDS_Shapes_Base_stub
+ libs += Receiver_stub DDS_Shapes_Connector_stub DDS_Shapes_Base_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ sharedname = Receiver_lem_stub
+ dynamicflags = RECEIVER_LEM_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_ReceiverEC.cpp
+ }
+
+ Header_Files {
+ Shapes_ReceiverEC.h
+ Receiver_lem_stub_export.h
+ }
+
+ Inline_Files {
+ Shapes_ReceiverEC.inl
+ }
+}
+
+project(DDS_Shapes_Receiver_stub) : ccm_stub, dds4ccm_base {
+ after += DDS_Shapes_Receiver_idl_gen DDS_Shapes_Connector_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_lem_gen
+ libs += DDS_Shapes_Connector_stub DDS_Shapes_Base_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ sharedname = Receiver_stub
+ dynamicflags = RECEIVER_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_ReceiverC.cpp
+ }
+
+ Header_Files {
+ Shapes_ReceiverC.h
+ Receiver_stub_export.h
+ }
+
+ Inline_Files {
+ Shapes_ReceiverC.inl
+ }
+}
+
+project(DDS_Shapes_Receiver_exec) : ciao_executor, dds4ccm_base {
+ after += DDS_Shapes_Receiver_lem_stub DDS_Shapes_Receiver_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub
+ sharedname = Receiver_exec
+ libs += Receiver_stub Receiver_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ dynamicflags = RECEIVER_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_Receiver_exec.cpp
+ }
+
+ Header_Files {
+ Shapes_Receiver_exec.h
+ Receiver_exec_export.h
+ }
+
+ Inline_Files {
+ }
+}
+
+
+project(DDS_Shapes_Receiver_svnt) : ciao_servant, dds4ccm_base {
+ after += DDS_Shapes_Receiver_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt DDS_Shapes_Receiver_exec DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub DDS4CCM_skel
+ sharedname = Receiver_svnt
+ libs += Receiver_stub Receiver_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt Receiver_exec DDS_Shapes_Connector_lem_stub DDS4CCM_lem_stub DDS4CCM_skel
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ dynamicflags = RECEIVER_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_ReceiverS.cpp
+ Shapes_Receiver_svnt.cpp
+ }
+
+ Header_Files {
+ Shapes_ReceiverS.h
+ Shapes_Receiver_svnt.h
+ Receiver_svnt_export.h
+ }
+
+ Inline_Files {
+ Shapes_ReceiverS.inl
+ }
+}
+
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.cpp b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.cpp
new file mode 100644
index 00000000000..bf24d8f2014
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.cpp
@@ -0,0 +1,370 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "Shapes_Receiver_exec.h"
+#include "ciao/Logger/Log_Macros.h"
+#include "tao/ORB_Core.h"
+
+namespace CIAO_Shapes_Receiver_Impl
+{
+ //============================================================
+ // read_action_Generator
+ //============================================================
+ read_action_Generator::read_action_Generator (Receiver_exec_i &callback)
+ : pulse_callback_ (callback)
+ {
+ }
+
+ read_action_Generator::~read_action_Generator ()
+ {
+ }
+
+ int
+ read_action_Generator::handle_timeout (const ACE_Time_Value &, const void *)
+ {
+ if (pulse_callback_.read_data ())
+ {
+ this->pulse_callback_.read_one();
+ this->pulse_callback_.read_all();
+ }
+ if (pulse_callback_.get_data ())
+ {
+ this->pulse_callback_.get_one ();
+ this->pulse_callback_.get_all ();
+ }
+ return 0;
+ }
+
+ //============================================================
+ // ShapeType_Listener_exec_i
+ //============================================================
+ ShapeType_Listener_exec_i::ShapeType_Listener_exec_i (void)
+ {
+ }
+
+ ShapeType_Listener_exec_i::~ShapeType_Listener_exec_i (void)
+ {
+ }
+
+ // Operations from ::CCM_DDS::ShapeType_Listener
+ void
+ ShapeType_Listener_exec_i::on_many_data (
+ const ShapeTypeSeq & /* an_instance */,
+ const ::CCM_DDS::ReadInfoSeq & /* info */)
+ {
+ }
+
+ void
+ ShapeType_Listener_exec_i::on_one_data (
+ const ShapeType & an_instance ,
+ const ::CCM_DDS::ReadInfo & /* info */)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ShapeType_Listener: ")
+ ACE_TEXT ("received shape_info for <%C> at %u:%u:%u\n"),
+ an_instance.color.in (),
+ an_instance.x,
+ an_instance.y,
+ an_instance.shapesize));
+ }
+
+ //============================================================
+ // PortStatusListener_exec_i
+ //============================================================
+ PortStatusListener_exec_i::PortStatusListener_exec_i (void)
+ {
+ }
+
+ PortStatusListener_exec_i::~PortStatusListener_exec_i (void)
+ {
+ }
+
+ // Operations from ::CCM_DDS::PortStatusListener
+ void
+ PortStatusListener_exec_i::on_requested_deadline_missed (
+ ::DDS::DataReader_ptr /* the_reader */,
+ const ::DDS::RequestedDeadlineMissedStatus & /* status */)
+ {
+ }
+
+ void
+ PortStatusListener_exec_i::on_sample_lost (
+ ::DDS::DataReader_ptr /* the_reader */,
+ const ::DDS::SampleLostStatus & /* status */)
+ {
+ }
+
+ //============================================================
+ // Receiver_exec_i
+ //============================================================
+ Receiver_exec_i::Receiver_exec_i (void)
+ : rate_ (0),
+ get_data_ (true),
+ read_data_ (true),
+ raw_listen_ (false)
+
+ {
+ this->ticker_ = new read_action_Generator (*this);
+ }
+
+ Receiver_exec_i::~Receiver_exec_i (void)
+ {
+ }
+
+ // Supported operations and attributes.
+ void
+ Receiver_exec_i::read_one (void)
+ {
+ ShapeType shape_info;
+ shape_info.color = "GREEN";
+ ::CCM_DDS::ReadInfo readinfo;
+
+ try
+ {
+ this->reader_->read_one_last (shape_info, readinfo, ::DDS::HANDLE_NIL);
+ time_t tim = readinfo.source_timestamp.sec;
+ tm* time = localtime(&tim);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("READ_ONE Read_Info ")
+ ACE_TEXT (" -> date = %02d:%02d:%02d.%d\n"),
+ time->tm_hour,
+ time->tm_min,
+ time->tm_sec,
+ readinfo.source_timestamp.nanosec));
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("READ ON shape info : ")
+ ACE_TEXT ("received shape_info for <%C> at %u:%u:%u\n"),
+ shape_info.color.in (),
+ shape_info.x,
+ shape_info.y,
+ shape_info.shapesize));
+ }
+ catch(CCM_DDS::NonExistent& )
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("ShapeType_Read_One: ")
+ ACE_TEXT ("no shape_info receieved\n")));
+ }
+ }
+
+ void
+ Receiver_exec_i::read_all (void)
+ {
+ ShapeTypeSeq_var shape_infos;
+ ::CCM_DDS::ReadInfoSeq_var readinfoseq;
+ this->reader_->read_all(shape_infos.out(), readinfoseq.out());
+ for(unsigned int i = 0; i < readinfoseq->length(); ++i)
+ {
+ time_t tim = readinfoseq[i].source_timestamp.sec;
+ tm* time = localtime(&tim);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("READ_ALL ReadInfo ")
+ ACE_TEXT ("-> UTC date = %02d:%02d:%02d.%d\n"),
+ time->tm_hour,
+ time->tm_min,
+ time->tm_sec,
+ readinfoseq[i].source_timestamp.nanosec));
+ }
+ for(CORBA::ULong i = 0; i < shape_infos->length(); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("READ_ALL Shape Info : ")
+ ACE_TEXT ("Number <%d> : received shape_info for <%C> at %u:%u:%u\n"),
+ i,
+ shape_infos[i].color.in (),
+ shape_infos[i].x,
+ shape_infos[i].y,
+ shape_infos[i].shapesize));
+ }
+ }
+
+ void
+ Receiver_exec_i::get_one (void)
+ {
+ ShapeType_var shape_info;
+ ::CCM_DDS::ReadInfo_var readinfo;
+
+ try
+ {
+ if (this->getter_->get_one (shape_info.out (), readinfo.out ()))
+ {
+ time_t tim = readinfo->source_timestamp.sec;
+ tm* time = localtime(&tim);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("GET_ONE ReadInfo -> ")
+ ACE_TEXT ("date = %02d:%02d:%02d.%d\n"),
+ time->tm_hour,
+ time->tm_min,
+ time->tm_sec,
+ readinfo->source_timestamp.nanosec));
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("GET_ONE ShapeType : ")
+ ACE_TEXT ("received shape_info for <%C> at %u:%u:%u\n"),
+ shape_info->color.in (),
+ shape_info->x,
+ shape_info->y,
+ shape_info->shapesize));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("GET_ONE No data available for <%C>\n"),
+ shape_info->color.in ()));
+ }
+ }
+ catch(CCM_DDS::NonExistent& )
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("ShapeType_Read_One: no shape_info receieved\n")));
+ }
+ }
+
+ void
+ Receiver_exec_i::get_all (void)
+ {
+ }
+
+ // Component attributes.
+ ::CORBA::ULong
+ Receiver_exec_i::rate (void)
+ {
+ return this->rate_;
+ }
+
+ void
+ Receiver_exec_i::rate (
+ ::CORBA::ULong rate)
+ {
+ this->rate_ = rate;
+ }
+
+ ::CORBA::Boolean
+ Receiver_exec_i::get_data (void)
+ {
+ return this->get_data_;
+ }
+
+ void
+ Receiver_exec_i::get_data (
+ ::CORBA::Boolean get_data)
+ {
+ this->get_data_ = get_data;
+ }
+
+ ::CORBA::Boolean
+ Receiver_exec_i::read_data (void)
+ {
+ return this->read_data_;
+ }
+
+ void
+ Receiver_exec_i::read_data (
+ ::CORBA::Boolean read_data)
+ {
+ this->read_data_ = read_data;
+ }
+
+ ::CORBA::Boolean
+ Receiver_exec_i::raw_listen (void)
+ {
+ return this->raw_listen_;
+ }
+
+ void
+ Receiver_exec_i::raw_listen (
+ ::CORBA::Boolean raw_listen)
+ {
+ this->raw_listen_ = raw_listen;
+ }
+
+ // Port operations.
+ ::Shapes::ShapeTypeConn::CCM_Listener_ptr
+ Receiver_exec_i::get_info_out_data_listener (void)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("new ShapeType RAW listener\n")));
+ return new ShapeType_Listener_exec_i ();
+ }
+
+ ::CCM_DDS::CCM_PortStatusListener_ptr
+ Receiver_exec_i::get_info_out_status (void)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("new PortStatuslistener\n")));
+ return new PortStatusListener_exec_i ();
+ }
+
+ ::CCM_DDS::CCM_PortStatusListener_ptr
+ Receiver_exec_i::get_info_get_status (void)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("new PortStatuslistener\n")));
+ return new PortStatusListener_exec_i ();
+ }
+
+ // Operations from Components::SessionComponent.
+ void
+ Receiver_exec_i::set_session_context (
+ ::Components::SessionContext_ptr ctx)
+ {
+ this->context_ =
+ ::Shapes::CCM_Receiver_Context::_narrow (ctx);
+ if ( ::CORBA::is_nil (this->context_.in ()))
+ {
+ throw ::CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Receiver_exec_i::configuration_complete (void)
+ {
+ if (this->read_data ())
+ {
+ this->reader_ = this->context_->get_connection_info_out_data ();
+ }
+ if (this->get_data ())
+ {
+ this->getter_ = this->context_->get_connection_info_get_fresh_data ();
+ }
+ }
+
+ void
+ Receiver_exec_i::ccm_activate (void)
+ {
+ ::CCM_DDS::DataListenerControl_var lc =
+ this->context_->get_connection_info_out_data_control ();
+
+ if (::CORBA::is_nil (lc.in ()))
+ {
+ ACE_ERROR ((LM_INFO, ACE_TEXT ("Error: Listener control receptacle is null!\n")));
+ throw CORBA::INTERNAL ();
+ }
+
+ lc->mode (this->raw_listen_ ? ::CCM_DDS::ONE_BY_ONE : ::CCM_DDS::NOT_ENABLED);
+
+ // calculate the interval time
+ long const usec = 1000000 / this->rate_;
+ if (this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->schedule_timer (
+ this->ticker_,
+ 0,
+ ACE_Time_Value(0, usec),
+ ACE_Time_Value(0, usec)) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "Unable to schedule Timer\n"));
+ }
+ }
+
+ void
+ Receiver_exec_i::ccm_passivate (void)
+ {
+ this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->cancel_timer (this->ticker_);
+ delete this->ticker_;
+ }
+
+ void
+ Receiver_exec_i::ccm_remove (void)
+ {
+ }
+
+ extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Shapes_Receiver_Impl (void)
+ {
+ ::Components::EnterpriseComponent_ptr retval =
+ ::Components::EnterpriseComponent::_nil ();
+
+ ACE_NEW_NORETURN (
+ retval,
+ Receiver_exec_i);
+
+ return retval;
+ }
+}
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.h b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.h
new file mode 100644
index 00000000000..f98506554bb
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Receiver/Shapes_Receiver_exec.h
@@ -0,0 +1,151 @@
+// -*- C++ -*-
+// $Id$
+
+#ifndef CIAO_RECEIVER_EXEC_H_
+#define CIAO_RECEIVER_EXEC_H_
+
+#include "Shapes_ReceiverEC.h"
+
+#include /**/ "Receiver_exec_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+#include "ace/Task.h"
+#include "ace/Reactor.h"
+
+namespace CIAO_Shapes_Receiver_Impl
+{
+ class Receiver_exec_i;
+ /**
+ * @class reader activity generator
+ *
+ * @brief an active object used by Receiver to perform a periodical read action
+ *
+ */
+ class read_action_Generator
+ : public ACE_Event_Handler
+ {
+ public:
+ read_action_Generator (Receiver_exec_i &callback);
+
+ ~read_action_Generator ();
+
+ virtual int handle_timeout (const ACE_Time_Value &tv,
+ const void *arg);
+
+ private:
+ Receiver_exec_i &pulse_callback_;
+
+ };
+
+ //============================================================
+ // ShapeType_Listener_exec_i
+ //============================================================
+ class RECEIVER_EXEC_Export ShapeType_Listener_exec_i
+ : public virtual ::Shapes::ShapeTypeConn::CCM_Listener,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ ShapeType_Listener_exec_i (void);
+ virtual ~ShapeType_Listener_exec_i (void);
+
+ virtual void
+ on_one_data (
+ const ShapeType & an_instance,
+ const ::CCM_DDS::ReadInfo & info);
+ virtual void
+ on_many_data (
+ const ShapeTypeSeq & an_instance,
+ const ::CCM_DDS::ReadInfoSeq & info);
+ };
+
+ class RECEIVER_EXEC_Export PortStatusListener_exec_i
+ : public virtual ::CCM_DDS::CCM_PortStatusListener,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ PortStatusListener_exec_i (void);
+ virtual ~PortStatusListener_exec_i (void);
+
+ virtual void
+ on_requested_deadline_missed (
+ ::DDS::DataReader_ptr the_reader,
+ const ::DDS::RequestedDeadlineMissedStatus & status);
+
+ virtual void
+ on_sample_lost (
+ ::DDS::DataReader_ptr the_reader,
+ const ::DDS::SampleLostStatus & status);
+ };
+
+ class RECEIVER_EXEC_Export Receiver_exec_i
+ : public virtual Receiver_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Receiver_exec_i (void);
+ virtual ~Receiver_exec_i (void);
+
+ // Supported operations and attributes.
+ void read_one (void);
+ void read_all (void);
+ void get_one (void);
+ void get_all (void);
+
+ // Component attributes.
+ virtual ::CORBA::ULong rate (void);
+
+ virtual void rate (::CORBA::ULong rate);
+
+ virtual ::CORBA::Boolean get_data (void);
+
+ virtual void get_data (::CORBA::Boolean get_data);
+
+ virtual ::CORBA::Boolean read_data (void);
+
+ virtual void read_data (::CORBA::Boolean read_data);
+
+ virtual ::CORBA::Boolean raw_listen (void);
+
+ virtual void raw_listen (::CORBA::Boolean raw_listen);
+
+ // Port operations.
+ virtual ::Shapes::ShapeTypeConn::CCM_Listener_ptr
+ get_info_out_data_listener (void);
+
+ virtual ::CCM_DDS::CCM_PortStatusListener_ptr
+ get_info_out_status (void);
+
+ virtual ::CCM_DDS::CCM_PortStatusListener_ptr
+ get_info_get_status (void);
+
+ // Operations from Components::SessionComponent.
+ virtual void
+ set_session_context (
+ ::Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete (void);
+
+ virtual void ccm_activate (void);
+ virtual void ccm_passivate (void);
+ virtual void ccm_remove (void);
+
+ private:
+ ::Shapes::CCM_Receiver_Context_var context_;
+ ::Shapes::ShapeTypeConn::Reader_var reader_;
+ ::Shapes::ShapeTypeConn::Getter_var getter_;
+
+ read_action_Generator * ticker_;
+ CORBA::ULong rate_;
+ ::CORBA::Boolean get_data_, read_data_, raw_listen_;
+ };
+
+ extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Shape_Receiver_Impl (void);
+}
+
+#endif /* ifndef */
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.idl b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.idl
new file mode 100644
index 00000000000..f6b3622d888
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.idl
@@ -0,0 +1,28 @@
+// $Id$
+
+/**
+ * @file
+ * @author Marcel Smit <msmit@remedy.nl>
+ *
+ * by-hand idl3 translation of sender components.
+ */
+
+#ifndef DDS_SHAPES_SENDER_IDL
+#define DDS_SHAPES_SENDER_IDL
+
+#include "Connector/Shapes_Connector.idl"
+
+module Shapes
+{
+ component Sender
+ {
+ port ShapeTypeConn::DDS_Write info_write;
+ attribute unsigned long rate;
+ attribute unsigned short max_x;
+ attribute unsigned short max_y;
+ attribute unsigned short max_size;
+ attribute boolean resize_shape;
+ };
+};
+
+#endif
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.mpc b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.mpc
new file mode 100644
index 00000000000..c03bbe91e4a
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender.mpc
@@ -0,0 +1,140 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl -p DDS_Shapes_Base -l ../lib -o ../lib -c controller -u DDS Sender"
+
+project(DDS_Shapes_Sender_idl_gen) : componentidldefaults, dds4ccm {
+ after += DDS_Shapes_Connector_idl_gen
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \
+ -Wb,stub_export_include=Sender_stub_export.h \
+ -Wb,skel_export_macro=SENDER_SVNT_Export \
+ -Wb,skel_export_include=Sender_svnt_export.h \
+ -Wb,svnt_export_macro=SENDER_SVNT_Export \
+ -Wb,svnt_export_include=Sender_svnt_export.h \
+ -Wb,exec_export_macro=SENDER_EXEC_Export \
+ -Wb,exec_export_include=Sender_exec_export.h \
+ -I ..
+
+ IDL_Files {
+ Shapes_Sender.idl
+ }
+}
+
+project(DDS_Shapes_Sender_lem_gen) : ciaoidldefaults, dds4ccm {
+ after += DDS_Shapes_Sender_idl_gen
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \
+ -Wb,stub_export_include=Sender_lem_stub_export.h \
+ -SS -Gxhst -I $CIAO_ROOT/connectors -I ..
+
+ IDL_Files {
+ Shapes_SenderE.idl
+ }
+}
+
+project(DDS_Shapes_Sender_lem_stub) : ccm_svnt, dds4ccm_base {
+ after += DDS_Shapes_Sender_lem_gen DDS_Shapes_Sender_stub DDS_Shapes_Base_stub
+ libs += DDS_Shapes_Base_stub Sender_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ sharedname = Sender_lem_stub
+ dynamicflags = SENDER_LEM_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_SenderEC.cpp
+ }
+
+ Header_Files {
+ Shapes_SenderEC.h
+ Sender_lem_stub_export.h
+ }
+
+ Inline_Files {
+ Shapes_SenderEC.inl
+ }
+}
+
+project(DDS_Shapes_Sender_stub) : ccm_stub, dds4ccm_base {
+ after += DDS_Shapes_Sender_idl_gen DDS_Shapes_Base_stub DDS_Shapes_Connector_stub
+ libs += DDS_Shapes_Base_stub DDS_Shapes_Connector_stub
+ includes += ..
+ libpaths += ../lib
+ libout = ../lib
+ sharedname = Sender_stub
+ dynamicflags = SENDER_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_SenderC.cpp
+ }
+
+ Header_Files {
+ Shapes_SenderC.h
+ Sender_stub_export.h
+ }
+
+ Inline_Files {
+ Shapes_SenderC.inl
+ }
+}
+
+project(DDS_Shapes_Sender_exec) : ciao_executor, dds4ccm_base {
+ after += DDS_Shapes_Sender_lem_stub DDS_Shapes_Sender_stub DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_stub
+ sharedname = Sender_exec
+ libs += Sender_stub Sender_lem_stub DDS_Shapes_Base_stub DDS_Shapes_Connector_lem_stub DDS_Shapes_Connector_stub
+ libpaths += ../lib
+ includes += ..
+ libout = ../lib
+ dynamicflags = SENDER_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_Sender_exec.cpp
+ }
+
+ Header_Files {
+ Shapes_Sender_exec.h
+ Sender_exec_export.h
+ }
+
+ Inline_Files {
+ }
+}
+
+
+project(DDS_Shapes_Sender_svnt) : ciao_servant, dds4ccm_base {
+ after += DDS_Shapes_Base_stub DDS_Shapes_Sender_lem_stub DDS4CCM_lem_stub DDS4CCM_skel DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt DDS_Shapes_Connector_lem_stub
+ sharedname = Sender_svnt
+ libs += Sender_stub Sender_lem_stub \
+ DDS_Shapes_Base_stub DDS4CCM_lem_stub DDS4CCM_skel DDS_Shapes_Connector_stub DDS_Shapes_Connector_svnt DDS_Shapes_Connector_lem_stub
+ libpaths += ../lib
+ libout = ../lib
+ includes += ..
+ dynamicflags = SENDER_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Shapes_SenderS.cpp
+ Shapes_Sender_svnt.cpp
+ }
+
+ Header_Files {
+ Shapes_SenderS.h
+ Shapes_Sender_svnt.h
+ Sender_svnt_export.h
+ }
+
+ Inline_Files {
+ Shapes_SenderS.inl
+ }
+}
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.cpp b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.cpp
new file mode 100644
index 00000000000..a1212c54be8
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.cpp
@@ -0,0 +1,285 @@
+// -*- C++ -*-
+// $Id$
+
+#include "Shapes_Sender_exec.h"
+#include "ace/Guard_T.h"
+#include "ciao/Logger/Log_Macros.h"
+#include "tao/ORB_Core.h"
+
+namespace CIAO_Shapes_Sender_Impl
+{
+ //============================================================
+ // pulse_Generator
+ //============================================================
+ pulse_Generator::pulse_Generator (Sender_exec_i &callback)
+ : pulse_callback_ (callback)
+ {
+ }
+
+ pulse_Generator::~pulse_Generator ()
+ {
+ }
+
+ int
+ pulse_Generator::handle_timeout (const ACE_Time_Value &, const void *)
+ {
+ this->pulse_callback_.tick ();
+ return 0;
+ }
+
+ //============================================================
+ // Sender_exec_i
+ //============================================================
+ Sender_exec_i::Sender_exec_i (void)
+ : rate_ (1),
+ max_x_ (100),
+ max_y_ (100),
+ max_size_ (25),
+ resize_ (false),
+ x_increasing_ (false),
+ y_increasing_ (false),
+ size_increasing_ (false)
+ {
+ square_ = new ShapeType;
+ this->ticker_ = new pulse_Generator (*this);
+ }
+
+ Sender_exec_i::~Sender_exec_i (void)
+ {
+ }
+
+ // Supported operations and attributes.
+
+ void
+ Sender_exec_i::tick ()
+ {
+ if (this->x_increasing_)
+ {
+ ++square_->x;
+ this->x_increasing_ = square_->x + 1 <= this->max_x_;
+ }
+ else
+ {
+ --square_->x;
+ this->x_increasing_ = square_->x - 1 < 0;
+ }
+ if (this->y_increasing_)
+ {
+ ++square_->y;
+ this->y_increasing_ = square_->y + 1 <= this->max_y_;
+ }
+ else
+ {
+ --square_->y;
+ this->y_increasing_ = square_->y - 1 < 0;
+ }
+ if (resize_shape ())
+ {
+ if (this->size_increasing_)
+ {
+ ++square_->shapesize;
+ this->size_increasing_ = square_->shapesize + 1 <= this->max_size_;
+ }
+ else
+ {
+ --square_->shapesize;
+ this->size_increasing_ = square_->shapesize - 1 < 0;
+ }
+ }
+ try
+ {
+ this->writer_->write_one (*square_, this->instance_handle_);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("UPDATED Shape_info for <%C> %u:%u:%u\n"),
+ square_->color.in (),
+ square_->x,
+ square_->y,
+ square_->shapesize));
+ }
+ catch (const CCM_DDS::NonExistent& )
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Shape_info for <%C> not updated: <%C> didn't exist.\n"),
+ square_->color.in (), square_->color.in ()));
+ }
+ catch (const CCM_DDS::InternalError& )
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Internal Error while updating Shape_info for <%C>.\n"),
+ square_->color.in ()));
+ }
+ }
+
+ void
+ Sender_exec_i::start (void)
+ {
+ // calculate the interval time
+ long const usec = 1000000 / this->rate_;
+ if (this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->schedule_timer (
+ this->ticker_,
+ 0,
+ ACE_Time_Value (0, usec),
+ ACE_Time_Value (0, usec)) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ")
+ ACE_TEXT ("Error scheduling timer")));
+ }
+ }
+
+ void
+ Sender_exec_i::stop (void)
+ {
+ this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->cancel_timer (this->ticker_);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender_exec_i::stop : Timer canceled.\n")));
+ try
+ {
+ this->writer_->unregister_instance (*this->square_, this->instance_handle_);
+ }
+ catch (const CCM_DDS::NonExistent& )
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Shape_info for <%C> not deleted: <%C> didn't exist.\n"),
+ square_->color.in (), square_->color.in ()));
+ }
+ catch (const CCM_DDS::InternalError& )
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Internal Error while deleting Shape_info for <%C>.\n"),
+ square_->color.in ()));
+ }
+ delete this->ticker_;
+ delete this->square_;
+ }
+
+ ::CORBA::ULong
+ Sender_exec_i::rate (void)
+ {
+ return this->rate_;
+ }
+
+ void
+ Sender_exec_i::rate (::CORBA::ULong rate)
+ {
+ this->rate_ = rate;
+ }
+
+ ::CORBA::UShort
+ Sender_exec_i::max_x (void)
+ {
+ return this->max_x_;
+ }
+
+ void
+ Sender_exec_i::max_x (::CORBA::UShort max_x)
+ {
+ this->max_x_ = max_x;
+ }
+
+ ::CORBA::UShort
+ Sender_exec_i::max_y (void)
+ {
+ return this->max_y_;
+ }
+
+ void
+ Sender_exec_i::max_y (::CORBA::UShort max_y)
+ {
+ this->max_y_ = max_y;
+ }
+
+ ::CORBA::UShort
+ Sender_exec_i::max_size (void)
+ {
+ return this->max_size_;
+ }
+
+ void
+ Sender_exec_i::max_size (::CORBA::UShort max_size)
+ {
+ this->max_size_ = max_size;
+ }
+
+ void
+ Sender_exec_i::resize_shape (::CORBA::Boolean resize)
+ {
+ this->resize_ = resize;
+ }
+
+ ::CORBA::Boolean
+ Sender_exec_i::resize_shape ()
+ {
+ return this->resize_;
+ }
+
+ void
+ Sender_exec_i::set_session_context (::Components::SessionContext_ptr ctx)
+ {
+ this->context_ =
+ ::Shapes::CCM_Sender_Context::_narrow (ctx);
+
+ if ( ::CORBA::is_nil (this->context_.in ()))
+ {
+ throw ::CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Sender_exec_i::configuration_complete (void)
+ {
+ this->writer_ = this->context_->get_connection_info_write_data ();
+ }
+
+ void
+ Sender_exec_i::ccm_activate (void)
+ {
+ this->start ();
+ square_->x = ACE_OS::rand () % this->max_x_;
+ square_->y = ACE_OS::rand () % this->max_y_;
+ square_->shapesize = max_size_;
+ square_->color = CORBA::string_dup("GREEN");
+
+ //Register shape with dds.
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("REGISTER Shape_info for <%C> %u:%u:%u\n"),
+ square_->color.in (),
+ square_->x,
+ square_->y,
+ square_->shapesize));
+ try
+ {
+ this->instance_handle_ = this->writer_->register_instance (*square_);
+ }
+ catch (const CCM_DDS::AlreadyCreated& )
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Shape_info for <%C> already created.\n"),
+ square_->color.in ()));
+ }
+ catch (const CCM_DDS::InternalError& )
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Internal Error while creating Shape_info for <%C>.\n"),
+ square_->color.in ()));
+ }
+ }
+
+ void
+ Sender_exec_i::ccm_passivate (void)
+ {
+ this->stop ();
+ }
+
+ void
+ Sender_exec_i::ccm_remove (void)
+ {
+ }
+
+ extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Shape_Sender_Impl (void)
+ {
+ ::Components::EnterpriseComponent_ptr retval =
+ ::Components::EnterpriseComponent::_nil ();
+
+ ACE_NEW_NORETURN (
+ retval,
+ Sender_exec_i);
+
+ return retval;
+ }
+}
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.h b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.h
new file mode 100644
index 00000000000..9fa93f905a4
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/Sender/Shapes_Sender_exec.h
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+// $Id$
+
+#ifndef CIAO_SENDER_EXEC_H_
+#define CIAO_SENDER_EXEC_H_
+
+#include "Shapes_SenderEC.h"
+
+#include /**/ "Sender_exec_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+#include "ace/Task.h"
+#include "ace/Reactor.h"
+
+namespace CIAO_Shapes_Sender_Impl
+{
+ class Sender_exec_i;
+
+ //============================================================
+ // pulse_Generator
+ //============================================================
+ class pulse_Generator : public ACE_Event_Handler
+ {
+ public:
+ pulse_Generator (Sender_exec_i &callback);
+
+ virtual ~pulse_Generator ();
+
+ virtual int handle_timeout (const ACE_Time_Value &tv,
+ const void *arg);
+ private:
+ Sender_exec_i &pulse_callback_;
+ };
+
+ //============================================================
+ // Sender_exec_i
+ //============================================================
+ class Sender_exec_i
+ : public virtual Sender_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Sender_exec_i (void);
+ virtual ~Sender_exec_i (void);
+
+ virtual ::CORBA::ULong rate (void);
+
+ virtual void rate (::CORBA::ULong rate);
+
+ virtual ::CORBA::UShort max_x (void);
+
+ virtual void max_x (::CORBA::UShort max_x);
+
+ virtual ::CORBA::UShort max_y (void);
+
+ virtual void max_y (::CORBA::UShort max_y);
+
+ virtual ::CORBA::UShort max_size (void);
+
+ virtual void max_size (::CORBA::UShort max_size);
+
+ virtual void resize_shape (::CORBA::Boolean resize);
+
+ virtual ::CORBA::Boolean resize_shape (void);
+
+ virtual void set_session_context (::Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete (void);
+
+ virtual void ccm_activate (void);
+ virtual void ccm_passivate (void);
+ virtual void ccm_remove (void);
+
+ void tick ();
+
+ private:
+ void start (void);
+ void stop (void);
+
+ Shapes::ShapeTypeConn::Writer_var writer_;
+
+ pulse_Generator * ticker_;
+ ::Shapes::CCM_Sender_Context_var context_;
+ CORBA::ULong rate_;
+ CORBA::UShort max_x_;
+ CORBA::UShort max_y_;
+ CORBA::UShort max_size_;
+ CORBA::Boolean resize_;
+
+ bool x_increasing_;
+ bool y_increasing_;
+ bool size_increasing_;
+
+ ShapeType* square_;
+
+ ::DDS::InstanceHandle_t instance_handle_;
+ };
+
+ extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Shape_Sender_Impl (void);
+}
+
+#endif /* ifndef */
+
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp b/modules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp
new file mode 100644
index 00000000000..afe644d93d1
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/Plan.cdp
@@ -0,0 +1,464 @@
+<Deployment:DeploymentPlan
+ xmlns:Deployment="http://www.omg.org/Deployment"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd">
+ <label>Shapes_Depl_1</label>
+ <UUID>Shapes_Depl_1</UUID>
+
+ <implementation xmi:id="ReceiverComponentImplementation">
+ <name>ReceiverComponentImplementation</name>
+ <source/>
+ <artifact xmi:idref="Receiver_ExecArtifact" />
+ <artifact xmi:idref="Receiver_SvntArtifact" />
+ <execParameter>
+ <!-- entrypoint as exec parameter (see 10.6.1) -->
+ <name>component factory</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Shapes_Receiver_Impl</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Shapes_Receiver_Servant</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Receiver_svnt</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Receiver_exec</string>
+ </value>
+ </value>
+ </execParameter>
+ </implementation>
+
+ <implementation xmi:id="Shapes_ConnectorComponentImplementation">
+ <name>Shapes_ConnectorComponentImplementation</name>
+ <source/>
+ <artifact xmi:idref="Shapes_Connector_ExecArtifact" />
+ <artifact xmi:idref="Shapes_Connector_SvntArtifact" />
+ <execParameter>
+ <!-- entrypoint as exec parameter (see 10.6.1) -->
+ <name>component factory</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Shapes_Shapes_Connector_Impl</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Shapes_Shapes_Connector_Servant</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Shapes_Connector_svnt</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Shapes_Connector_exec</string>
+ </value>
+ </value>
+ </execParameter>
+ </implementation>
+ <implementation xmi:id="SenderComponentImplementation">
+ <name>SenderComponentImplementation</name>
+ <source/>
+ <artifact xmi:idref="Sender_ExecArtifact" />
+ <artifact xmi:idref="Sender_SvntArtifact" />
+ <execParameter>
+ <!-- entrypoint as exec parameter (see 10.6.1) -->
+ <name>component factory</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Shape_Sender_Impl</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Shapes_Sender_Servant</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Sender_svnt</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Sender_exec</string>
+ </value>
+ </value>
+ </execParameter>
+ </implementation>
+ <instance xmi:id="ReceiverComponentInstance">
+ <name>ReceiverComponent</name>
+ <node>ReceiverNode</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="ReceiverComponentImplementation" />
+ <configProperty>
+ <name>rate</name>
+ <value>
+ <type>
+ <kind>tk_long</kind>
+ </type>
+ <value>
+ <long>1</long>
+ </value>
+ </value>
+ </configProperty>
+ <configProperty>
+ <name>get_data</name>
+ <value>
+ <type>
+ <kind>tk_boolean</kind>
+ </type>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </value>
+ </configProperty>
+ <configProperty>
+ <name>read_data</name>
+ <value>
+ <type>
+ <kind>tk_boolean</kind>
+ </type>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </value>
+ </configProperty>
+ <configProperty>
+ <name>raw_listen</name>
+ <value>
+ <type>
+ <kind>tk_boolean</kind>
+ </type>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+ <instance xmi:id="Shapes_ConnectorComponentInstance">
+ <name>Shapes_ConnectorComponent</name>
+ <node>SenderNode</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="Shapes_ConnectorComponentImplementation" />
+ <configProperty>
+ <name>topic_name</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Square</string>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+ <instance xmi:id="Shapes_ConnectorComponentInstance2">
+ <name>Shapes_ConnectorComponent2</name>
+ <node>ReceiverNode</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="Shapes_ConnectorComponentImplementation" />
+ <configProperty>
+ <name>topic_name</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>Square</string>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+ <instance xmi:id="SenderComponentInstance">
+ <name>SenderComponent</name>
+ <node>SenderNode</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="SenderComponentImplementation" />
+ <configProperty>
+ <name>rate</name>
+ <value>
+ <type>
+ <kind>tk_long</kind>
+ </type>
+ <value>
+ <long>10</long>
+ </value>
+ </value>
+ </configProperty>
+ <configProperty>
+ <name>max_x</name>
+ <value>
+ <type>
+ <kind>tk_short</kind>
+ </type>
+ <value>
+ <short>225</short>
+ </value>
+ </value>
+ </configProperty>
+ <configProperty>
+ <name>max_y</name>
+ <value>
+ <type>
+ <kind>tk_short</kind>
+ </type>
+ <value>
+ <short>250</short>
+ </value>
+ </value>
+ </configProperty>
+ <configProperty>
+ <name>max_size</name>
+ <value>
+ <type>
+ <kind>tk_short</kind>
+ </type>
+ <value>
+ <short>25</short>
+ </value>
+ </value>
+ </configProperty>
+ <configProperty>
+ <name>resize_shape</name>
+ <value>
+ <type>
+ <kind>tk_boolean</kind>
+ </type>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+
+ <connection>
+ <name>info_out_data</name>
+ <deployRequirement>
+ <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name>
+ <resourceType>Local_Interface</resourceType>
+ </deployRequirement>
+ <internalEndpoint>
+ <portName>info_out_data</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="ReceiverComponentInstance" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>push_consumer_data</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="Shapes_ConnectorComponentInstance2" />
+ </internalEndpoint>
+ </connection>
+ <connection>
+ <name>_listenercontrol</name>
+ <deployRequirement>
+ <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name>
+ <resourceType>Local_Interface</resourceType>
+ </deployRequirement>
+ <internalEndpoint>
+ <portName>info_out_data_control</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="ReceiverComponentInstance" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>push_consumer_data_control</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="Shapes_ConnectorComponentInstance2" />
+ </internalEndpoint>
+ </connection>
+ <connection>
+ <name>_portstatuslistener</name>
+ <deployRequirement>
+ <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name>
+ <resourceType>Local_Interface</resourceType>
+ </deployRequirement>
+ <internalEndpoint>
+ <portName>info_out_status</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="ReceiverComponentInstance" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>push_consumer_status</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="Shapes_ConnectorComponentInstance2" />
+ </internalEndpoint>
+ </connection>
+ <connection>
+ <name>_listener</name>
+ <deployRequirement>
+ <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name>
+ <resourceType>Local_Interface</resourceType>
+ </deployRequirement>
+ <internalEndpoint>
+ <portName>info_out_data_listener</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="ReceiverComponentInstance" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>push_consumer_data_listener</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="Shapes_ConnectorComponentInstance2" />
+ </internalEndpoint>
+ </connection>
+
+ <connection>
+ <name>writer_connection</name>
+ <deployRequirement>
+ <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name>
+ <resourceType>Local_Interface</resourceType>
+ </deployRequirement>
+ <internalEndpoint>
+ <portName>info_write_data</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="SenderComponentInstance" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>supplier_data</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="Shapes_ConnectorComponentInstance" />
+ </internalEndpoint>
+ </connection>
+
+ <artifact xmi:id="Sender_ExecArtifact">
+ <name>Sender_exec</name>
+ <source/>
+ <node/>
+ <location>Sender_exec</location>
+ </artifact>
+ <artifact xmi:id="Sender_SvntArtifact">
+ <name>Sender_svnt</name>
+ <source/>
+ <node/>
+ <location>Sender_svnt</location>
+ </artifact>
+ <artifact xmi:id="Sender_StubArtifact">
+ <name>Sender_stub</name>
+ <source/>
+ <node/>
+ <location>Sender_stub</location>
+ </artifact>
+ <artifact xmi:id="Shapes_Connector_ExecArtifact">
+ <name>Shapes_Connector_exec</name>
+ <source/>
+ <node/>
+ <location>DDS_Shapes_Connector_exec</location>
+ </artifact>
+ <artifact xmi:id="Shapes_Connector_SvntArtifact">
+ <name>Shapes_Connector_svnt</name>
+ <source/>
+ <node/>
+ <location>DDS_Shapes_Connector_svnt</location>
+ </artifact>
+ <artifact xmi:id="Shapes_Connector_StubArtifact">
+ <name>Shapes_Connector_stub</name>
+ <source/>
+ <node/>
+ <location>DDS_Shapes_Connector_stub</location>
+ </artifact>
+ <artifact xmi:id="Receiver_ExecArtifact">
+ <name>Receiver_exec</name>
+ <source/>
+ <node/>
+ <location>Receiver_exec</location>
+ </artifact>
+ <artifact xmi:id="Receiver_SvntArtifact">
+ <name>Receiver_svnt</name>
+ <source/>
+ <node/>
+ <location>Receiver_svnt</location>
+ </artifact>
+ <artifact xmi:id="Receiver_StubArtifact">
+ <name>Receiver_stub</name>
+ <source/>
+ <node/>
+ <location>Receiver_stub</location>
+ </artifact>
+</Deployment:DeploymentPlan>
diff --git a/modules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl b/modules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl
new file mode 100755
index 00000000000..6ab7070d719
--- /dev/null
+++ b/modules/CIAO/connectors/dds4ccm/examples/Shapes/descriptors/run_test.pl
@@ -0,0 +1,244 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{'ACE_ROOT'}/bin";
+use PerlACE::TestTarget;
+
+$CIAO_ROOT = "$ENV{'CIAO_ROOT'}";
+$TAO_ROOT = "$ENV{'TAO_ROOT'}";
+$DANCE_ROOT = "$ENV{'DANCE_ROOT'}";
+
+$daemons_running = 0;
+$em_running = 0;
+$ns_running = 0;
+
+$nr_daemon = 2;
+@ports = ( 60001, 60002 );
+@iorbases = ( "NodeApp1.ior", "NodeApp2.ior" );
+@iorfiles = 0;
+@nodenames = ( "SenderNode", "ReceiverNode" );
+
+# ior files other than daemon
+# ior files other than daemon
+$ior_nsbase = "ns.ior";
+$ior_nsfile = 0;
+$ior_embase = "EM.ior";
+$ior_emfile = 0;
+
+# Processes
+$E = 0;
+$EM = 0;
+$NS = 0;
+@DEAMONS = 0;
+
+# targets
+@tg_daemons = 0;
+$tg_naming = 0;
+$tg_exe_man = 0;
+$tg_executor = 0;
+
+$status = 0;
+$cdp_file = "Plan.cdp";
+
+sub create_targets {
+ # naming service
+ $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n";
+ $tg_naming->AddLibPath ('../lib');
+ # daemon
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for deamon $i failed\n";
+ $tg_daemons[$i]->AddLibPath ('../lib');
+ }
+ # execution manager
+ $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n";
+ $tg_exe_man->AddLibPath ('../lib');
+ # executor (plan_launcher)
+ $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n";
+ $tg_executor->AddLibPath ('../lib');
+}
+
+sub init_ior_files {
+ $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase);
+ $ior_emfile = $tg_exe_man->LocalFile ($ior_embase);
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]);
+ }
+ delete_ior_files ();
+}
+
+# Delete if there are any .ior files.
+sub delete_ior_files {
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $tg_daemons[$i]->DeleteFile ($iorbases[$i]);
+ }
+ $tg_naming->DeleteFile ($ior_nsbase);
+ $tg_exe_man->DeleteFile ($ior_embase);
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]);
+ }
+}
+
+sub kill_node_daemon {
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1);
+ }
+}
+
+sub kill_open_processes {
+ if ($daemons_running == 1) {
+ kill_node_daemon ();
+ }
+
+ if ($em_running == 1) {
+ $EM->Kill (); $EM->TimedWait (1);
+ }
+
+ if ($ns_running == 1) {
+ $NS->Kill (); $NS->TimedWait (1);
+ }
+ # in case shutdown did not perform as expected
+ $tg_executor->KillAll ('ciao_componentserver');
+}
+
+sub run_node_daemons {
+ for ($i = 0; $i < $nr_daemon; ++$i) {
+ $iorbase = $iorbases[$i];
+ $iorfile = $iorfiles[$i];
+ $port = $ports[$i];
+ $nodename = $nodenames[$i];
+ $iiop = "iiop://localhost:$port";
+ $node_app = "$CIAO_ROOT/bin/ciao_componentserver";
+
+ $d_cmd = "$DANCE_ROOT/bin/dance_node_manager";
+ $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService";
+
+ print "Run dance_node_manager with $d_param\n";
+
+ $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param);
+ $DEAMONS[$i]->Spawn ();
+
+ if ($tg_daemons[$i]->WaitForFileTimed($iorbase,
+ $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) {
+ print STDERR
+ "ERROR: The ior $iorfile file of node daemon $i could not be found\n";
+ for (; $i >= 0; --$i) {
+ $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1);
+ }
+ return -1;
+ }
+ }
+ return 0;
+}
+
+create_targets ();
+init_ior_files ();
+
+# Invoke naming service
+
+$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 1 -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile");
+
+$ns_status = $NS->Spawn ();
+
+if ($ns_status != 0) {
+ print STDERR "ERROR: Unable to execute the naming service\n";
+ kill_open_processes ();
+ exit 1;
+}
+
+print STDERR "Starting Naming Service with -m 1 -ORBEndpoint iiop://localhost:60003 -o ns.ior\n";
+
+if ($tg_naming->WaitForFileTimed ($ior_nsbase,
+ $tg_naming->ProcessStartWaitInterval ()) == -1) {
+ print STDERR "ERROR: cannot find naming service IOR file\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+$ns_running = 1;
+# Set up NamingService environment
+$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService";
+
+# Invoke node daemon.
+print "Invoking node daemon\n";
+$status = run_node_daemons ();
+
+if ($status != 0) {
+ print STDERR "ERROR: Unable to execute the node daemon\n";
+ kill_open_processes ();
+ exit 1;
+}
+
+$daemons_running = 1;
+
+# Invoke execution manager.
+print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n";
+$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager",
+ "-e$ior_emfile --domain-nc corbaloc:rir:/NameService");
+$em_status = $EM->Spawn ();
+
+if ($em_status != 0) {
+ print STDERR "ERROR: dance_execution_manager returned $em_status";
+ exit 1;
+}
+
+if ($tg_exe_man->WaitForFileTimed ($ior_embase,
+ $tg_exe_man->ProcessStartWaitInterval ()) == -1) {
+ print STDERR
+ "ERROR: The ior file of execution manager could not be found\n";
+ kill_open_processes ();
+ exit 1;
+}
+
+$em_running = 1;
+
+# Invoke executor - start the application -.
+print "Invoking executor - launch the application -\n";
+
+print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n";
+$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher",
+ "-x $cdp_file -k file://$ior_emfile");
+$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ());
+
+if ($pl_status != 0) {
+ print STDERR "ERROR: dance_plan_launcher returned $pl_status\n";
+ kill_open_processes ();
+ exit 1;
+}
+
+for ($i = 0; $i < $nr_daemon; ++$i) {
+ if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i],
+ $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) {
+ print STDERR "ERROR: The ior file of daemon $i could not be found\n";
+ kill_open_processes ();
+ exit 1;
+ }
+}
+
+print "Sleeping 60 seconds to allow task to complete\n";
+sleep (60);
+
+# Invoke executor - stop the application -.
+print "Invoking executor - stop the application -\n";
+print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file -q\n";
+
+$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher",
+ "-k file://$ior_emfile -x $cdp_file -s");
+$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ());
+
+if ($pl_status != 0) {
+ print STDERR "ERROR: dance_plan_launcher returned $pl_status\n";
+ kill_open_processes ();
+ exit 1;
+}
+
+print "Executor returned.\n";
+print "Shutting down rest of the processes.\n";
+
+delete_ior_files ();
+kill_open_processes ();
+
+exit $status;