From dde07b1df377bdbb64bfc6bf260e375f68fc82d9 Mon Sep 17 00:00:00 2001 From: mxiong Date: Wed, 25 May 2005 07:58:44 +0000 Subject: added the Quoter example --- TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cidl | 22 + TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cpp | 123 ++++ TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.idl | 35 + TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.mpc | 75 ++ .../DAnCE/examples/Quoter/Broker/Broker_exec.cpp | 216 ++++++ .../DAnCE/examples/Quoter/Broker/Broker_exec.h | 151 ++++ .../examples/Quoter/Broker/Broker_exec_export.h | 54 ++ .../examples/Quoter/Broker/Broker_stub_export.h | 54 ++ .../examples/Quoter/Broker/Broker_svnt_export.h | 54 ++ .../examples/Quoter/Distributor/Distributor.cidl | 21 + .../examples/Quoter/Distributor/Distributor.cpp | 126 ++++ .../examples/Quoter/Distributor/Distributor.idl | 42 ++ .../examples/Quoter/Distributor/Distributor.mpc | 76 ++ .../Quoter/Distributor/Distributor_exec.cpp | 360 ++++++++++ .../examples/Quoter/Distributor/Distributor_exec.h | 272 +++++++ .../Quoter/Distributor/Distributor_exec_export.h | 54 ++ .../Quoter/Distributor/Distributor_stub_export.h | 54 ++ .../Quoter/Distributor/Distributor_svnt_export.h | 54 ++ TAO/CIAO/DAnCE/examples/Quoter/README.html | 171 +++++ .../examples/Quoter/Stock_Base/Stock_Base.idl | 40 ++ .../examples/Quoter/Stock_Base/Stock_Base.mpc | 38 + .../Quoter/Stock_Base/Stock_Base_exec_export.h | 54 ++ .../Quoter/Stock_Base/Stock_Base_stub_export.h | 54 ++ .../Quoter/Stock_Base/Stock_Base_svnt_export.h | 54 ++ .../DAnCE/examples/Quoter/descriptors/Broker.ccd | 33 + .../DAnCE/examples/Quoter/descriptors/Broker.cid | 35 + .../DAnCE/examples/Quoter/descriptors/Broker.cpd | 14 + .../DAnCE/examples/Quoter/descriptors/Broker.ior | 1 + .../examples/Quoter/descriptors/Broker_Exec.iad | 29 + .../examples/Quoter/descriptors/Broker_Stub.iad | 14 + .../examples/Quoter/descriptors/Broker_Svnt.iad | 29 + .../examples/Quoter/descriptors/Deployment.xsd | 776 ++++++++++++++++++++ .../examples/Quoter/descriptors/Distributor.ccd | 41 ++ .../examples/Quoter/descriptors/Distributor.cid | 35 + .../examples/Quoter/descriptors/Distributor.cpd | 14 + .../examples/Quoter/descriptors/Distributor.ior | 1 + .../Quoter/descriptors/Distributor_Exec.iad | 29 + .../Quoter/descriptors/Distributor_Stub.iad | 14 + .../Quoter/descriptors/Distributor_Svnt.iad | 29 + .../DAnCE/examples/Quoter/descriptors/Domain.cdd | 17 + .../examples/Quoter/descriptors/Libraries.iad | 8 + .../Quoter/descriptors/Modified_Deployment.xsd | 790 +++++++++++++++++++++ .../DAnCE/examples/Quoter/descriptors/Stock.cdp | 16 + .../DAnCE/examples/Quoter/descriptors/Stock.cid | 41 ++ .../DAnCE/examples/Quoter/descriptors/Stock.cpd | 13 + .../DAnCE/examples/Quoter/descriptors/Stock.dat | 3 + .../DAnCE/examples/Quoter/descriptors/Stock.pcd | 10 + TAO/CIAO/DAnCE/examples/Quoter/descriptors/XMI.xsd | 35 + .../descriptors/flattened_deploymentplan.cdp | 185 +++++ TAO/CIAO/DAnCE/examples/Quoter/descriptors/ior | 1 + .../DAnCE/examples/Quoter/descriptors/package.tpd | 8 + .../examples/Quoter/descriptors/runNodeDaemons.pl | 40 ++ TAO/CIAO/DAnCE/examples/Quoter/images/quoter.jpg | Bin 0 -> 15027 bytes 53 files changed, 4515 insertions(+) create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cidl create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cpp create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.idl create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.mpc create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.cpp create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_stub_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_svnt_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cidl create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cpp create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.idl create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.mpc create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.cpp create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_stub_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_svnt_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/README.html create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.idl create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.mpc create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_exec_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_stub_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_svnt_export.h create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ccd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cid create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cpd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ior create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Exec.iad create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Stub.iad create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Svnt.iad create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Deployment.xsd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ccd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cid create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cpd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ior create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Exec.iad create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Stub.iad create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Svnt.iad create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Domain.cdd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Libraries.iad create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Modified_Deployment.xsd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cdp create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cid create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cpd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.dat create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.pcd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/XMI.xsd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/flattened_deploymentplan.cdp create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/ior create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/package.tpd create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/descriptors/runNodeDaemons.pl create mode 100644 TAO/CIAO/DAnCE/examples/Quoter/images/quoter.jpg diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cidl b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cidl new file mode 100644 index 00000000000..e34ee017920 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cidl @@ -0,0 +1,22 @@ +//$Id$ + +//Stock.cidl,v 1.0 +/** + * @file Stock.cidl + * + * @author ming xiong + */ + +#ifndef STOCK_CIDL +#define STOCK_CIDL + +#include "Broker.idl" + +composition session StockBroker_Impl { + home executor StockBrokerHome_Exec { + implements Stock::StockBrokerHome; + manages StockBroker_Exec; + } +}; + +#endif /* STOCK_CIDL */ diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cpp b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cpp new file mode 100644 index 00000000000..9f8abd6e8c2 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.cpp @@ -0,0 +1,123 @@ +//$Id$ +/* + * @file broker.h + * + * @author Ming Xiong + */ + +#include "BrokerC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const char *broker_ior = "file://Broker.ior"; +const char *subscribe_name = 0; +const char *unsubscribe_name = 0; + + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:s:u:"); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + broker_ior = get_opts.opt_arg (); + break; + + case 's': + subscribe_name = get_opts.opt_arg (); + break; + + case 'u': + unsubscribe_name = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k (default is file:\\broker.ior) \n" + "-s \n" + "-u \n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + +int main (int argc, char* argv[]) +{ + ACE_TRY_NEW_ENV + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv,"" + ACE_ENV_ARG_PARAMETER); + + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return -1; + + // create the factory object reference of StockBrokerHome + CORBA::Object_var broker_obj = + orb->string_to_object (broker_ior + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // downcast the object reference to the appropriate type + Stock::StockBroker_var broker = + Stock::StockBroker::_narrow (broker_obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (broker.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Broker' objref\n"), + -1); + } + + + if (subscribe_name != 0) + { + broker->stock_subscribe (subscribe_name + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Subscribe successful!\n")); + } + + if (unsubscribe_name != 0) + { + broker->stock_unsubscribe (unsubscribe_name + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Unsubscribe successful!\n")); + } + + // Finally destroy the ORB + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Who is the culprit \n"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.idl b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.idl new file mode 100644 index 00000000000..dbe9a04364a --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.idl @@ -0,0 +1,35 @@ +//$Id$ + +#include "../Stock_Base/Stock_Base.idl" + +module Stock +{ + interface StockSubscriber { + /// subscribe to an interested stock + void stock_subscribe (in string stock_name) + raises (Invalid_Stock); + /// unsubscribe to an stock + void stock_unsubscribe (in string stock_name) + raises (Invalid_Stock); + }; + + /** + * @class StockBroker + * + * @brief component + */ + component StockBroker supports StockSubscriber + { + consumes StockName notify_in; + uses StockQuoter read_quoter; + }; + + /** + * @class StockBrokerHome + * + * @brief home for StockBroker component + */ + home StockBrokerHome manages StockBroker + { + }; +}; diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.mpc b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.mpc new file mode 100644 index 00000000000..724277307ed --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker.mpc @@ -0,0 +1,75 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Stock_Base Broker" + +project(Stock_Base_Broker_stub): ciao_client_dnc { + after += Stock_Base_stub + sharedname = Broker_stub + idlflags += -Wb,stub_export_macro=BROKER_STUB_Export -Wb,stub_export_include=Broker_stub_export.h -Wb,skel_export_macro=BROKER_SVNT_Export -Wb,skel_export_include=Broker_svnt_export.h + dynamicflags = BROKER_STUB_BUILD_DLL + libs += Stock_Base_stub + + IDL_Files { + Broker.idl + } + + Source_Files { + BrokerC.cpp + } +} + +project(Stock_Base_Broker_svnt) : ciao_servant_dnc { + after += Stock_Base_svnt Stock_Base_Broker_stub + sharedname = Broker_svnt + libs += Broker_stub Stock_Base_stub Stock_Base_svnt + + idlflags += -Wb,export_macro=BROKER_SVNT_Export -Wb,export_include=Broker_svnt_export.h + dynamicflags = BROKER_SVNT_BUILD_DLL + + CIDL_Files { + Broker.cidl + } + + IDL_Files { + BrokerE.idl + } + + Source_Files { + BrokerEC.cpp + BrokerS.cpp + Broker_svnt.cpp + } +} + + +project(Stock_Base_Broker_exec) : ciao_component_dnc { + after += Stock_Base_Broker_svnt + sharedname = Broker_exec + libs += Broker_stub Broker_svnt Stock_Base_stub Stock_Base_svnt + + idlflags += -Wb,export_macro=BROKER_EXEC_Export -Wb,export_include=Broker_exec_export.h + dynamicflags = BROKER_EXEC_BUILD_DLL + + IDL_Files { + + } + + Source_Files { + + Broker_exec.cpp + } +} + + +project (Stock_Broker) : ciao_client_dnc, valuetype{ + exename = Broker + after += Stock_Base_Broker_stub + libs += Broker_stub Stock_Base_stub + + IDL_Files { + } + + Source_Files { + Broker.cpp + } +} + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.cpp b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.cpp new file mode 100644 index 00000000000..c79b5ff8df0 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.cpp @@ -0,0 +1,216 @@ +//$Id$ +/* + * @file Broker_exec.cpp + * + * @author Ming Xiong + */ + +#include "Broker_exec.h" +#include "ciao/CIAO_common.h" + + +namespace StockBroker_Impl +{ + //================================================================== + // Component Executor Implementation Class: StockBroker_exec_i + //================================================================== + + StockBroker_exec_i::StockBroker_exec_i (void) + { + } + + StockBroker_exec_i::~StockBroker_exec_i (void) + { + } + + + // Supported or inherited operations. + + void + StockBroker_exec_i::stock_subscribe ( + const char * stock_name + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Stock::Invalid_Stock)) + { + if ((strcmp (stock_name, "MSFT") == 0) || (strcmp (stock_name, "IBM") == 0)) + { + std::set::iterator iter = this->subscribed_stock_list_.find (stock_name); + if (iter == this->subscribed_stock_list_.end ()) + { + this->subscribed_stock_list_.insert (stock_name); + } + } + else + { + throw Stock::Invalid_Stock (); + } + + } + + void + StockBroker_exec_i::stock_unsubscribe ( + const char * stock_name + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Stock::Invalid_Stock)) + { + if ((strcmp (stock_name, "MSFT") == 0) || (strcmp (stock_name, "IBM") == 0)) + { + std::set::iterator iter = this->subscribed_stock_list_.find (stock_name); + if (iter != this->subscribed_stock_list_.end ()) + { + this->subscribed_stock_list_.erase (iter); + } + + } + else + { + throw Stock::Invalid_Stock (); + } + + } + + + void + StockBroker_exec_i::push_notify_in (Stock::StockName *ev + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + + ACE_DEBUG ((LM_INFO, + "Broker - Got message from Distributor\n")); + + CORBA::String_var stock_name = CORBA::string_dup (ev->name ()); + + // Retrieve stock information if the stock name is in the subscribed_stock_list + if (this->subscribed_stock_list_.find (stock_name.in ()) != this->subscribed_stock_list_.end ()) + { + Stock::StockQuoter_var quoter_obj = this->context_->get_connection_read_quoter (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (quoter_obj.in ())) + ACE_THROW (CORBA::BAD_PARAM ()); + + Stock::StockInfo_var info = quoter_obj->get_stock_info (stock_name.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "Quoter - Current value of %s is %d\n", + stock_name.in (), + info->last)); + } + } + + // Operations from Components::SessionComponent + + void + StockBroker_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + this->context_ = + CIAO_GLUE_Stock::StockBroker_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (0 == this->context_) + { + ACE_THROW (CORBA::INTERNAL ()); + } + } + + void + StockBroker_exec_i::ciao_preactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + void + StockBroker_exec_i::ciao_postactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + void + StockBroker_exec_i::ccm_activate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + void + StockBroker_exec_i::ccm_passivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + void + StockBroker_exec_i::ccm_remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + //================================================================== + // Home Executor Implementation Class: StockBrokerHome_exec_i + //================================================================== + + StockBrokerHome_exec_i::StockBrokerHome_exec_i (void) + { + } + + StockBrokerHome_exec_i::~StockBrokerHome_exec_i (void) + { + } + + ::Components::EnterpriseComponent_ptr + StockBrokerHome_exec_i::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + StockBroker_exec_i, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (::Components::EnterpriseComponent::_nil ()); + + return retval; + } + + extern "C" BROKER_EXEC_Export ::Components::HomeExecutorBase_ptr + createStockBrokerHome_Impl (void) + { + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + StockBrokerHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.h b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.h new file mode 100644 index 00000000000..7d80d32033d --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec.h @@ -0,0 +1,151 @@ +//$Id$ +/* + * @file Broker_exec.h + * + * @author Ming Xiong + */ + + +#ifndef CIAO_BROKER_EXEC_H +#define CIAO_BROKER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "Broker_svnt.h" +#include "BrokerEC.h" +#include "Broker_exec_export.h" + +#include +#include + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" + +namespace StockBroker_Impl +{ + + /** + * @class StockBroker_exec_i + * + * @brief Executor implementation + * + * This class implements Stock::StockBroker component + */ + class BROKER_EXEC_Export StockBroker_exec_i + : public virtual StockBroker_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + StockBroker_exec_i (void); + virtual ~StockBroker_exec_i (void); + + + // Supported or inherited operations. + + virtual void + stock_subscribe ( + const char * stock_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Stock::Invalid_Stock)); + + virtual void + stock_unsubscribe ( + const char * stock_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Stock::Invalid_Stock)); + + virtual void + push_notify_in ( + ::Stock::StockName *ev + ACE_ENV_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 + ciao_preactivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)); + + virtual void + ciao_postactivate ( + ACE_ENV_SINGLE_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)); + + protected: + CIAO_GLUE_Stock::StockBroker_Context *context_; + + private: + std::set subscribed_stock_list_; + }; + + + /** + * @class StockBrokerHome_exec_i + * + * @brief Executor implementation + * + * This class implements Stock::StockBrokerHome component + */ + class BROKER_EXEC_Export StockBrokerHome_exec_i + : public virtual StockBrokerHome_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + StockBrokerHome_exec_i (void); + virtual ~StockBrokerHome_exec_i (void); + + virtual ::Components::EnterpriseComponent_ptr + create ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)); + }; + + extern "C" BROKER_EXEC_Export ::Components::HomeExecutorBase_ptr + createStockBrokerHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_BROKER_EXEC_H */ + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec_export.h new file mode 100644 index 00000000000..cb7229d833e --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BROKER_EXEC +// ------------------------------ +#ifndef BROKER_EXEC_EXPORT_H +#define BROKER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BROKER_EXEC_HAS_DLL) +# define BROKER_EXEC_HAS_DLL 1 +#endif /* ! BROKER_EXEC_HAS_DLL */ + +#if defined (BROKER_EXEC_HAS_DLL) && (BROKER_EXEC_HAS_DLL == 1) +# if defined (BROKER_EXEC_BUILD_DLL) +# define BROKER_EXEC_Export ACE_Proper_Export_Flag +# define BROKER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BROKER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BROKER_EXEC_BUILD_DLL */ +# define BROKER_EXEC_Export ACE_Proper_Import_Flag +# define BROKER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BROKER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BROKER_EXEC_BUILD_DLL */ +#else /* BROKER_EXEC_HAS_DLL == 1 */ +# define BROKER_EXEC_Export +# define BROKER_EXEC_SINGLETON_DECLARATION(T) +# define BROKER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BROKER_EXEC_HAS_DLL == 1 */ + +// Set BROKER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BROKER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define BROKER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BROKER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BROKER_EXEC_NTRACE */ + +#if (BROKER_EXEC_NTRACE == 1) +# define BROKER_EXEC_TRACE(X) +#else /* (BROKER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define BROKER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (BROKER_EXEC_NTRACE == 1) */ + +#endif /* BROKER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_stub_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_stub_export.h new file mode 100644 index 00000000000..1d7c2c5fc2b --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BROKER_STUB +// ------------------------------ +#ifndef BROKER_STUB_EXPORT_H +#define BROKER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BROKER_STUB_HAS_DLL) +# define BROKER_STUB_HAS_DLL 1 +#endif /* ! BROKER_STUB_HAS_DLL */ + +#if defined (BROKER_STUB_HAS_DLL) && (BROKER_STUB_HAS_DLL == 1) +# if defined (BROKER_STUB_BUILD_DLL) +# define BROKER_STUB_Export ACE_Proper_Export_Flag +# define BROKER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BROKER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BROKER_STUB_BUILD_DLL */ +# define BROKER_STUB_Export ACE_Proper_Import_Flag +# define BROKER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BROKER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BROKER_STUB_BUILD_DLL */ +#else /* BROKER_STUB_HAS_DLL == 1 */ +# define BROKER_STUB_Export +# define BROKER_STUB_SINGLETON_DECLARATION(T) +# define BROKER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BROKER_STUB_HAS_DLL == 1 */ + +// Set BROKER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BROKER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define BROKER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BROKER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BROKER_STUB_NTRACE */ + +#if (BROKER_STUB_NTRACE == 1) +# define BROKER_STUB_TRACE(X) +#else /* (BROKER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define BROKER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (BROKER_STUB_NTRACE == 1) */ + +#endif /* BROKER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_svnt_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_svnt_export.h new file mode 100644 index 00000000000..18f606e5539 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Broker/Broker_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BROKER_SVNT +// ------------------------------ +#ifndef BROKER_SVNT_EXPORT_H +#define BROKER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BROKER_SVNT_HAS_DLL) +# define BROKER_SVNT_HAS_DLL 1 +#endif /* ! BROKER_SVNT_HAS_DLL */ + +#if defined (BROKER_SVNT_HAS_DLL) && (BROKER_SVNT_HAS_DLL == 1) +# if defined (BROKER_SVNT_BUILD_DLL) +# define BROKER_SVNT_Export ACE_Proper_Export_Flag +# define BROKER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BROKER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BROKER_SVNT_BUILD_DLL */ +# define BROKER_SVNT_Export ACE_Proper_Import_Flag +# define BROKER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BROKER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BROKER_SVNT_BUILD_DLL */ +#else /* BROKER_SVNT_HAS_DLL == 1 */ +# define BROKER_SVNT_Export +# define BROKER_SVNT_SINGLETON_DECLARATION(T) +# define BROKER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BROKER_SVNT_HAS_DLL == 1 */ + +// Set BROKER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BROKER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define BROKER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BROKER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BROKER_SVNT_NTRACE */ + +#if (BROKER_SVNT_NTRACE == 1) +# define BROKER_SVNT_TRACE(X) +#else /* (BROKER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define BROKER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (BROKER_SVNT_NTRACE == 1) */ + +#endif /* BROKER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cidl b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cidl new file mode 100644 index 00000000000..fe64c844339 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cidl @@ -0,0 +1,21 @@ +//$Id$ +//Distributor.cidl,v 1.0 +/** + * @file Distributor.cidl + * + * @author ming xiong + */ + +#ifndef DISTRIBUTOR_CIDL +#define DISTRIBUTOR_CIDL + +#include "Distributor.idl" + +composition session StockDistributor_Impl { + home executor StockDistributorHome_Exec { + implements Stock::StockDistributorHome; + manages StockDistributor_Exec; + } +}; + +#endif /* DISTRIBUTOR_CIDL */ diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cpp b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cpp new file mode 100644 index 00000000000..91ac59406da --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.cpp @@ -0,0 +1,126 @@ +//$Id$ +/* + * @file Distributor.cpp + * + * @author Ming Xiong + */ + + +#include "DistributorC.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" + +const char *distributor_ior = "file://Distributor.ior"; +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 'k': + distributor_ior = get_opts.opt_arg (); + break; + + case 'o': + turn_on = 1; + break; + + case 'f': + turn_on = 0; + break; + + case 'r': + rate = atoi (get_opts.opt_arg ()); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-o (Start the distribution service)\n" + "-f (Stop the distribution service)\n" + "-k (default is file:\\distributor.ior) \n" + "-r (default is 2)\n" + "\n", + argv [0]), + -1); + } + } + + return 0; +} + + +int main (int argc, char* argv[]) +{ + ACE_TRY_NEW_ENV + { + // initialize the ORB + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv,"" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return -1; + + // create the factory object reference, + CORBA::Object_var distributor_obj = + orb->string_to_object (distributor_ior + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // downcast the object reference to the appropriate type + Stock::StockDistributor_var distributor = + Stock::StockDistributor::_narrow (distributor_obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (distributor.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'Distributor' objref\n"), + -1); + } + + if (turn_on) + { + distributor->rate (rate + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Start up the Distribution service\n")); + + distributor->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + ACE_DEBUG ((LM_DEBUG, "Stop the Distribution service\n")); + + distributor->stop (ACE_ENV_SINGLE_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"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.idl b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.idl new file mode 100644 index 00000000000..10f2b477231 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.idl @@ -0,0 +1,42 @@ +//$Id$ + +#include "../Stock_Base/Stock_Base.idl" + +module Stock +{ + /** + * @class Trigger + * + * @brief supported interface + */ + interface Trigger { + /// Start the real-time monitoring service + void start (); + /// Stop the real-time monitoring service + void stop (); + }; + + + /** + * @class StockDistributor + * + * @brief component + */ + component StockDistributor supports Trigger + { + publishes StockName notify_out; + provides StockQuoter push_quoter; + attribute long rate; + }; + + + /** + * @class StockDistributorHome + * + * @brief home for StockDistributor component + */ + home StockDistributorHome manages StockDistributor + { + }; + +}; diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.mpc b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.mpc new file mode 100644 index 00000000000..014838a3b5a --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor.mpc @@ -0,0 +1,76 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Stock_Base Distributor" + +project(Stock_Base_Distributor_stub): ciao_client_dnc { + after += Stock_Base_stub + sharedname = Distributor_stub + idlflags += -Wb,stub_export_macro=DISTRIBUTOR_STUB_Export -Wb,stub_export_include=Distributor_stub_export.h -Wb,skel_export_macro=DISTRIBUTOR_SVNT_Export -Wb,skel_export_include=Distributor_svnt_export.h + dynamicflags = DISTRIBUTOR_STUB_BUILD_DLL + + libs += Stock_Base_stub + + IDL_Files { + Distributor.idl + } + + Source_Files { + DistributorC.cpp + } +} + +project(Stock_Base_Distributor_svnt) : ciao_servant_dnc { + after += Stock_Base_svnt Stock_Base_Distributor_stub + sharedname = Distributor_svnt + libs += Distributor_stub Stock_Base_stub Stock_Base_svnt + + idlflags += -Wb,export_macro=DISTRIBUTOR_SVNT_Export -Wb,export_include=Distributor_svnt_export.h + dynamicflags = DISTRIBUTOR_SVNT_BUILD_DLL + + CIDL_Files { + Distributor.cidl + } + + IDL_Files { + DistributorE.idl + } + + Source_Files { + DistributorEC.cpp + DistributorS.cpp + Distributor_svnt.cpp + } +} + + +project(Stock_Base_Distributor_exec) : ciao_component_dnc { + after += Stock_Base_Distributor_svnt + sharedname = Distributor_exec + libs += Distributor_stub Distributor_svnt Stock_Base_stub Stock_Base_svnt + + idlflags += -Wb,export_macro=DISTRIBUTOR_EXEC_Export -Wb,export_include=Distributor_exec_export.h + dynamicflags = DISTRIBUTOR_EXEC_BUILD_DLL + + IDL_Files { + + } + + Source_Files { + + Distributor_exec.cpp + } +} + + +project (Stock_Distributor) : ciao_client_dnc, valuetype{ + exename = Distributor + after += Stock_Base_Distributor_stub + libs += Distributor_stub Stock_Base_stub + + IDL_Files { + } + + Source_Files { + Distributor.cpp + } +} + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.cpp b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.cpp new file mode 100644 index 00000000000..f95f1c57b36 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.cpp @@ -0,0 +1,360 @@ +//$Id$ + +//Distributor_exec.cpp,v 1.1 +/* + * @file Distributor_exec.cpp + * + * @author Ming Xiong + */ + +#include "Distributor_exec.h" +#include "ciao/CIAO_common.h" +#include "ace/Reactor.h" + + +namespace StockDistributor_Impl +{ + + // initialze the stock values + + CORBA::Long + StockDistributor_exec_i::ibm_ = 100; + + CORBA::Long + StockDistributor_exec_i::msft_ = 101; + + //================================================================== + // C L A S S: pulse_Generator + //================================================================== + + pulse_Generator::pulse_Generator (StockDistributor_exec_i *callback) + : active_ (0), + pulse_callback_ (callback) + { + // initialize the reactor + this->reactor (ACE_Reactor::instance ()); + } + + pulse_Generator::~pulse_Generator () + { + } + + int + pulse_Generator::open () + { + return this->activate (); // convert the task into a active object that runs in separate thread + } + + int + pulse_Generator::close () + { + this->reactor ()->end_reactor_event_loop (); + + return this->wait (); // wait for all threads in the task to exit before it returns + } + + int + pulse_Generator::start (CORBA::Long hertz) + { + // return if not valid + if (hertz == 0 || this->active_ != 0) + return -1; + + // calculate the interval time + long usec = 1000000 / hertz; + + if (this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to setup Timer\n"), + -1); + + } + + this->active_ = 1; + return 0; + } + + int + pulse_Generator::stop (void) + { + // return if not valid. + if (this->active_ == 0) + return -1; + // cancle the timer + this->reactor ()->cancel_timer (this); + this->active_ = 0; + return 0; + } + + int + pulse_Generator::active (void) + { + return this->active_; + } + + int + pulse_Generator::handle_close (ACE_HANDLE handle,ACE_Reactor_Mask close_mask) + { + return 0; + } + + int + pulse_Generator::handle_timeout (const ACE_Time_Value &, + const void *) + { + // Notify the subscribers + this->pulse_callback_->push_notify_out (); + return 0; + } + + int + pulse_Generator::svc (void) + { + // define the owner of the reactor thread + this->reactor ()->owner (ACE_OS::thr_self ()); + + // run event loop to wait for event, and then dispatch them to corresponding handlers + this->reactor ()->run_reactor_event_loop (); + + return 0; + } + + + + //================================================================== + // Facet Executor Implementation Class: StockQuoter_exec_i + //================================================================== + + ::Stock::StockInfo * + StockQuoter_exec_i::get_stock_info (const char *stock_name + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Stock::Invalid_Stock)) + { + if (strcmp (stock_name, "MSFT") == 0) + { + Stock::StockInfo_var info = new Stock::StockInfo; + info->name = CORBA::string_dup ("MSFT"); + info->high = 10000; + info->low = 0; + info->last = this->distributor_.msft_; // retrieve the current stock value + return info._retn (); + } + else if (strcmp (stock_name, "IBM") == 0) + { + Stock::StockInfo_var info = new Stock::StockInfo; + info->name = CORBA::string_dup ("IBM"); + info->high = 10000; + info->low = 0; + info->last = this->distributor_.ibm_; // retrieve the current stock value + return info._retn (); + } + else + { + ACE_THROW_RETURN (Stock::Invalid_Stock (), 0); + } + } + + //================================================================== + // Component Executor Implementation Class: StockDistributor_exec_i + //================================================================== + + StockDistributor_exec_i::StockDistributor_exec_i (void) + :rate_ (0), pulser_ (this) + { + } + + StockDistributor_exec_i::~StockDistributor_exec_i (void) + { + } + + // Supported or inherited operations. + + void + StockDistributor_exec_i::start ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (this->rate_ == 0 || this->pulser_.active()) + ACE_THROW (CORBA::BAD_PARAM ()); + + this->pulser_.start (this->rate_); + } + + void + StockDistributor_exec_i::stop ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! this->pulser_.active ()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + this->pulser_.stop (); + } + + // Attribute operations. + + ::CORBA::Long + StockDistributor_exec_i::rate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->rate_; + } + + void + StockDistributor_exec_i::rate ( + ::CORBA::Long rate + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->rate_ = rate; + } + + // Port operations. + + ::Stock::CCM_StockQuoter_ptr + StockDistributor_exec_i::get_push_quoter (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return new StockQuoter_exec_i (*this); + } + + void + StockDistributor_exec_i::push_notify_out () + ACE_THROW_SPEC (( + CORBA::SystemException + )) + { + this->msft_++; + this->ibm_++; + + Stock::StockName_var ev_msft = new OBV_Stock::StockName; + ev_msft->name (CORBA::string_dup ("MSFT")); + this->context_->push_notify_out (ev_msft.in ()); + + Stock::StockName_var ev_ibm = new OBV_Stock::StockName; + ev_ibm->name (CORBA::string_dup ("IBM")); + this->context_->push_notify_out (ev_ibm.in ()); + } + + // Operations from Components::SessionComponent + + void + StockDistributor_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + this->context_ = + CIAO_GLUE_Stock::StockDistributor_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (this->context_ == 0) + { + ACE_THROW (CORBA::INTERNAL ()); + } + } + + void + StockDistributor_exec_i::ciao_preactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + void + StockDistributor_exec_i::ciao_postactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + void + StockDistributor_exec_i::ccm_activate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + // Start the active object + this->pulser_.open (); + } + + void + StockDistributor_exec_i::ccm_passivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + // Deactivate the active object + this->pulser_.close (); + } + + void + StockDistributor_exec_i::ccm_remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + } + + //================================================================== + // Home Executor Implementation Class: StockDistributorHome_exec_i + //================================================================== + + StockDistributorHome_exec_i::StockDistributorHome_exec_i (void) + { + } + + StockDistributorHome_exec_i::~StockDistributorHome_exec_i (void) + { + } + + ::Components::EnterpriseComponent_ptr + StockDistributorHome_exec_i::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + StockDistributor_exec_i, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (::Components::EnterpriseComponent::_nil ()); + return retval; + } + + extern "C" DISTRIBUTOR_EXEC_Export ::Components::HomeExecutorBase_ptr + createStockDistributorHome_Impl (void) + { + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + StockDistributorHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.h b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.h new file mode 100644 index 00000000000..5a2a3aa408c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec.h @@ -0,0 +1,272 @@ +//$Id$ + +//Distributor_exec.h,v 1.1 +/* + * @file Distributor_exec.h + * + * @author Ming Xiong + */ + + + +#ifndef CIAO_DISTRIBUTOR_EXEC_H +#define CIAO_DISTRIBUTOR_EXEC_H + +#include /**/ "ace/pre.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + + +#include "Distributor_svnt.h" +#include "DistributorEC.h" +#include "Distributor_exec_export.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" + +namespace StockDistributor_Impl +{ + class StockDistributor_exec_i; + + /** + * @class StockQuoter_exec_i + * + * @brief Executor implementation + * + * This class implements Stock::StockQuoter interface. We use this interface + * to acquire the information of the stock + */ + class DISTRIBUTOR_EXEC_Export StockQuoter_exec_i + : public virtual ::Stock::CCM_StockQuoter, + public virtual TAO_Local_RefCounted_Object + { + public: + StockQuoter_exec_i (StockDistributor_exec_i &distributor) + :distributor_ (distributor) + { + } + + // Operations from ::Stock::StockQuoter + + virtual ::Stock::StockInfo * + get_stock_info ( + const char * stock_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Stock::Invalid_Stock)); + + /// User defined + private: + /// Maintains a handle to the distributor so that the quoter can refer to it for latest quote + StockDistributor_exec_i &distributor_; + }; + + class StockDistributor_exec_i; + + /** + * @class pulse generator + * + * @brief an active object used by StockDistributor to perform periodical pulse generation + * + */ + class pulse_Generator : public ACE_Task_Base + { + public: + pulse_Generator (StockDistributor_exec_i *callback); + + ~pulse_Generator (); + + /// Hook method that performs application-defined initialization activities + int open (void); + + /// Hook method that performs application-defined destruction activites + int close (void); + + /// appliation-defined method for starting the pulse-generation service + int start (CORBA::Long hertz); + + /// application-defined method for stopping the pulse-generation service + int stop (void); + + /// Indicate whether the current object is active + int active (void); + + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + /// Called when timer handler is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + /// Hook methods implemnting the task's service processing, + /// invoked by all threads activated by activate () method + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + int active_; + + /// Maintains a handle that actually process the event + StockDistributor_exec_i *pulse_callback_; + + }; + + + /** + * @class StockDistributor_exec_i + * + * @brief Executor implementation + * + * This class implements Stock::StockDistributor component + */ + class DISTRIBUTOR_EXEC_Export StockDistributor_exec_i + : public virtual StockDistributor_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + StockDistributor_exec_i (void); + virtual ~StockDistributor_exec_i (void); + + // Supported or inherited operations. + + 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)); + + // Attribute operations. + + virtual ::CORBA::Long + rate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + rate ( + ::CORBA::Long + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Port operations. + + virtual ::Stock::CCM_StockQuoter_ptr + get_push_quoter ( + 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 + ciao_preactivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)); + + virtual void + ciao_postactivate ( + ACE_ENV_SINGLE_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)); + + protected: + CIAO_GLUE_Stock::StockDistributor_Context *context_; + + /// User defined members + public: + + /// push event to all subscribers + void push_notify_out () + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + private: + /// pulse generation rate + CORBA::Long rate_; + + /// pulser object + pulse_Generator pulser_; + + /// "real-time" stock value + static CORBA::Long msft_; + + /// "real-tiime" stock value + static CORBA::Long ibm_; + + friend class StockQuoter_exec_i; + }; + + + /** + * @class StockDistributorHome_exec_i + * + * @brief Executor implementation + * + * This class implements Stock::StockDistributorHome + */ + class DISTRIBUTOR_EXEC_Export StockDistributorHome_exec_i + : public virtual StockDistributorHome_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + StockDistributorHome_exec_i (void); + virtual ~StockDistributorHome_exec_i (void); + + virtual ::Components::EnterpriseComponent_ptr + create ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CCMException)); + }; + + extern "C" DISTRIBUTOR_EXEC_Export ::Components::HomeExecutorBase_ptr + createStockDistributorHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_DISTRIBUTOR_EXEC_H */ + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec_export.h new file mode 100644 index 00000000000..a3509e015da --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DISTRIBUTOR_EXEC +// ------------------------------ +#ifndef DISTRIBUTOR_EXEC_EXPORT_H +#define DISTRIBUTOR_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (DISTRIBUTOR_EXEC_HAS_DLL) +# define DISTRIBUTOR_EXEC_HAS_DLL 1 +#endif /* ! DISTRIBUTOR_EXEC_HAS_DLL */ + +#if defined (DISTRIBUTOR_EXEC_HAS_DLL) && (DISTRIBUTOR_EXEC_HAS_DLL == 1) +# if defined (DISTRIBUTOR_EXEC_BUILD_DLL) +# define DISTRIBUTOR_EXEC_Export ACE_Proper_Export_Flag +# define DISTRIBUTOR_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DISTRIBUTOR_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DISTRIBUTOR_EXEC_BUILD_DLL */ +# define DISTRIBUTOR_EXEC_Export ACE_Proper_Import_Flag +# define DISTRIBUTOR_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DISTRIBUTOR_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DISTRIBUTOR_EXEC_BUILD_DLL */ +#else /* DISTRIBUTOR_EXEC_HAS_DLL == 1 */ +# define DISTRIBUTOR_EXEC_Export +# define DISTRIBUTOR_EXEC_SINGLETON_DECLARATION(T) +# define DISTRIBUTOR_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DISTRIBUTOR_EXEC_HAS_DLL == 1 */ + +// Set DISTRIBUTOR_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DISTRIBUTOR_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define DISTRIBUTOR_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DISTRIBUTOR_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DISTRIBUTOR_EXEC_NTRACE */ + +#if (DISTRIBUTOR_EXEC_NTRACE == 1) +# define DISTRIBUTOR_EXEC_TRACE(X) +#else /* (DISTRIBUTOR_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DISTRIBUTOR_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DISTRIBUTOR_EXEC_NTRACE == 1) */ + +#endif /* DISTRIBUTOR_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_stub_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_stub_export.h new file mode 100644 index 00000000000..1126c5bc355 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DISTRIBUTOR_STUB +// ------------------------------ +#ifndef DISTRIBUTOR_STUB_EXPORT_H +#define DISTRIBUTOR_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (DISTRIBUTOR_STUB_HAS_DLL) +# define DISTRIBUTOR_STUB_HAS_DLL 1 +#endif /* ! DISTRIBUTOR_STUB_HAS_DLL */ + +#if defined (DISTRIBUTOR_STUB_HAS_DLL) && (DISTRIBUTOR_STUB_HAS_DLL == 1) +# if defined (DISTRIBUTOR_STUB_BUILD_DLL) +# define DISTRIBUTOR_STUB_Export ACE_Proper_Export_Flag +# define DISTRIBUTOR_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DISTRIBUTOR_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DISTRIBUTOR_STUB_BUILD_DLL */ +# define DISTRIBUTOR_STUB_Export ACE_Proper_Import_Flag +# define DISTRIBUTOR_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DISTRIBUTOR_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DISTRIBUTOR_STUB_BUILD_DLL */ +#else /* DISTRIBUTOR_STUB_HAS_DLL == 1 */ +# define DISTRIBUTOR_STUB_Export +# define DISTRIBUTOR_STUB_SINGLETON_DECLARATION(T) +# define DISTRIBUTOR_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DISTRIBUTOR_STUB_HAS_DLL == 1 */ + +// Set DISTRIBUTOR_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DISTRIBUTOR_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define DISTRIBUTOR_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DISTRIBUTOR_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DISTRIBUTOR_STUB_NTRACE */ + +#if (DISTRIBUTOR_STUB_NTRACE == 1) +# define DISTRIBUTOR_STUB_TRACE(X) +#else /* (DISTRIBUTOR_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DISTRIBUTOR_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DISTRIBUTOR_STUB_NTRACE == 1) */ + +#endif /* DISTRIBUTOR_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_svnt_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_svnt_export.h new file mode 100644 index 00000000000..78debd1c32b --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Distributor/Distributor_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DISTRIBUTOR_SVNT +// ------------------------------ +#ifndef DISTRIBUTOR_SVNT_EXPORT_H +#define DISTRIBUTOR_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (DISTRIBUTOR_SVNT_HAS_DLL) +# define DISTRIBUTOR_SVNT_HAS_DLL 1 +#endif /* ! DISTRIBUTOR_SVNT_HAS_DLL */ + +#if defined (DISTRIBUTOR_SVNT_HAS_DLL) && (DISTRIBUTOR_SVNT_HAS_DLL == 1) +# if defined (DISTRIBUTOR_SVNT_BUILD_DLL) +# define DISTRIBUTOR_SVNT_Export ACE_Proper_Export_Flag +# define DISTRIBUTOR_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DISTRIBUTOR_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DISTRIBUTOR_SVNT_BUILD_DLL */ +# define DISTRIBUTOR_SVNT_Export ACE_Proper_Import_Flag +# define DISTRIBUTOR_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DISTRIBUTOR_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DISTRIBUTOR_SVNT_BUILD_DLL */ +#else /* DISTRIBUTOR_SVNT_HAS_DLL == 1 */ +# define DISTRIBUTOR_SVNT_Export +# define DISTRIBUTOR_SVNT_SINGLETON_DECLARATION(T) +# define DISTRIBUTOR_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DISTRIBUTOR_SVNT_HAS_DLL == 1 */ + +// Set DISTRIBUTOR_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DISTRIBUTOR_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define DISTRIBUTOR_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DISTRIBUTOR_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DISTRIBUTOR_SVNT_NTRACE */ + +#if (DISTRIBUTOR_SVNT_NTRACE == 1) +# define DISTRIBUTOR_SVNT_TRACE(X) +#else /* (DISTRIBUTOR_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DISTRIBUTOR_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DISTRIBUTOR_SVNT_NTRACE == 1) */ + +#endif /* DISTRIBUTOR_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/README.html b/TAO/CIAO/DAnCE/examples/Quoter/README.html new file mode 100644 index 00000000000..e841ffa57da --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/README.html @@ -0,0 +1,171 @@ + + + + + + +Quoter example README +

To download the source codes of this example please refer to the CVS +repository at $CIAO_ROOT/DAnCE/examples/Quoter. +

+
+

Example Description

+
+The StockDistributor +component would be monitoring a real-time stock database. When the +values of particular stocks change, it pushes a CCM eventtype +that contains the stock's name via a CCM event source to the +corresponding CCM +
+
+event sink implemented by one or +more StockBroker components. If these components are interested +in the stock they can obtain more information about it by invoking a +request/response operation via their CCM receptacle on a CCM facet +exported by the StockDistributor component. The diagram of this +example is shown in fig 1. +
+


+figure 1
+

+

This example +is based on a series of  CORBA Component Model columns +written by Douglas +Schmidt and Steve +Vinoskiand, and has been consistently used as a example for TAO. Please +refer to TAO +online tutorial for details.
+

+

The files you will find

+
  • The interfaces, data types and exceptions used by the components of +this +application are specified in the Stock_Base.idl +file, placed +in this example root directory ($CIAO_ROOT/examples/Quoter/Stock_Base). +The lib +generated +from Stock_Base.idl is linked to all the components of this example.
  • +
  •  mpc files for each of the components are available in the +components +directories. We use the  MPC +to +generate makefiles and Visual C++ project/solutions files for all ACE, TAO and CIAO +libraries.
  • +
  •  idl and cidl files for each component are placed in +components directory. +
  • +
  •  The _exec.h and _exec.cpp files +are the actual +implementation of the components.
  • +
    +

    Make

    +Navigate to  the directory $CIAO_ROOT/DAnCE/examples/Quoter +and do:
    +$ACE_ROOT/bin/mwc.pl (use -type option if you are using +a +compiler/IDE other than gnuace -which by default generates GNU +makefiles)
    +For example, use %ACE_ROOT%/bin/mwc.pl -type vc71 if you +are using +Visual C++ 7.1 IDE.
    +
    +Then build/make the generated project/make files. Correct errors in the +source codes if necessary.
    +
    +

    Assemble

    +

    Now we can step forward to build the assembly.

    +
  • In the descriptor subdirectory, you'll find a XML descriptor file +that +describes your deployment plan, the +flattened_deploymentplan.cdp. This file declaratively specifies how the +component assembly is +constructed. +Specifically, it defines the component types, component instances, +component +connections and implementation artifact descriptions.
    +
  • +
  • Please make sure that the Modified_Deployment.xsd and XMI.xsd +files +are in the Display/descriptors directory. The former file could be +found in $CIAO_ROOT/docs/schema +directory.
    +
    +Note: Creating the deployment plan descriptor is a tedious and +error-prone job, +you can download CoSMIC +to +assist you in this step. +

     

    +
  • +
    +

    Running the program

    +>From different shells in $CIAO_ROOT/DAnCE/examples/Quoter/descriptors/ +directory: +
      +
    • Start NodeManagers (NodeDameon) by running runNodeDaemon.pl
    • +
    • Start the execution manager +$CIAO_ROOT/DAnCE/ExecutionManager/Execution_Manager -o ior -i +Stock.dat 
    • +
    +

    The Stock.dat file describes the deployment daemons CIAO's +Execution_Manager +will contact to instantiate ComponentServer's, home's, and component +instances. +Each line specify the name of a installation "destination" and the +corresponding corbaloc IOR for the CIAO_Daemon.

    +
      +
    • NOTE: As one can see, we use the "Stock.dat" file to +instruct the Execution_Manager how to find the endpoint of each +individual NodeManager (i.e., Node Daemon) where component(s) will be +deployed, so this is non-standard. We plan to use Naming Service to do +this in the future.
    • +
    +
      +
    • Start the plan_launcher by running +$CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p +flattened_deploymentplan.cdp -k file://ior
    • +
    • By now the components should be successfully deployed. You may +run the driver program to start the application. Open a new shell, keep +in the /Quoter/descriptors directory,  and try the following +commands, see what happens in the component server
      +
    • +
    +       
    +        Start the distributor +service at a frequency of  3 hertz:
    +       ../Distributor/Distributor.exe +-o   -r3
    +
    +        Use the broker program to +subscribe to MSFT stock
    +        ../Broker/Broker.exe -s MSFT
    +
    +        Subscribe to IBM stock
    +        ../Broker/Broker.exe -s IBM
    +
    +        Unsubscribe to MSFT stock
    +        ../Broker/Broker -u MSFT
    +
    +        Turn off the distribution +service:
    +        ../Distributor/Distributor -f
    +
    +Please contact mxiong@dre.vanderbilt.edu if you have any questions. +       
    + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.idl b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.idl new file mode 100644 index 00000000000..a107b070529 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.idl @@ -0,0 +1,40 @@ +//$Id$ + +#include + +module Stock +{ + exception Invalid_Stock {}; + + /** + * @struct StockInfo + */ + struct StockInfo { + string name; + long high; + long low; + long last; + }; + + /** + * @interface: StockQuoter + * + * @brief: component facet + */ + interface StockQuoter { + /// Returns the current stock info + StockInfo get_stock_info (in string stock_name) + raises (Invalid_Stock); + }; + + + /** + * @event StockName + * + * @brief component event + */ + eventtype StockName { + // Name of the stock. + public string name; + }; +}; diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.mpc b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.mpc new file mode 100644 index 00000000000..b294d5db74e --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base.mpc @@ -0,0 +1,38 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n Stock_Base" + +project(Stock_Base_stub): ciao_client_dnc { + + sharedname = Stock_Base_stub + idlflags += -Wb,stub_export_macro=STOCK_BASE_STUB_Export -Wb,stub_export_include=Stock_Base_stub_export.h -Wb,skel_export_macro=STOCK_BASE_SVNT_Export -Wb,skel_export_include=Stock_Base_svnt_export.h + dynamicflags = STOCK_BASE_STUB_BUILD_DLL + + IDL_Files { + Stock_Base.idl + } + + Source_Files { + Stock_BaseC.cpp + } +} + +project(Stock_Base_svnt) : ciao_servant_dnc { + after += Stock_Base_stub + sharedname = Stock_Base_svnt + libs += Stock_Base_stub + + idlflags += -Wb,export_macro=STOCK_BASE_SVNT_Export -Wb,export_include=Stock_Base_svnt_export.h + dynamicflags = STOCK_BASE_SVNT_BUILD_DLL + + IDL_Files { + Stock_Base.idl + } + + Source_Files { + Stock_BaseS.cpp + } +} + + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_exec_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_exec_export.h new file mode 100644 index 00000000000..ef8dc9c1f99 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl STOCK_BASE_EXEC +// ------------------------------ +#ifndef STOCK_BASE_EXEC_EXPORT_H +#define STOCK_BASE_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (STOCK_BASE_EXEC_HAS_DLL) +# define STOCK_BASE_EXEC_HAS_DLL 1 +#endif /* ! STOCK_BASE_EXEC_HAS_DLL */ + +#if defined (STOCK_BASE_EXEC_HAS_DLL) && (STOCK_BASE_EXEC_HAS_DLL == 1) +# if defined (STOCK_BASE_EXEC_BUILD_DLL) +# define STOCK_BASE_EXEC_Export ACE_Proper_Export_Flag +# define STOCK_BASE_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define STOCK_BASE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* STOCK_BASE_EXEC_BUILD_DLL */ +# define STOCK_BASE_EXEC_Export ACE_Proper_Import_Flag +# define STOCK_BASE_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define STOCK_BASE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* STOCK_BASE_EXEC_BUILD_DLL */ +#else /* STOCK_BASE_EXEC_HAS_DLL == 1 */ +# define STOCK_BASE_EXEC_Export +# define STOCK_BASE_EXEC_SINGLETON_DECLARATION(T) +# define STOCK_BASE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* STOCK_BASE_EXEC_HAS_DLL == 1 */ + +// Set STOCK_BASE_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (STOCK_BASE_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define STOCK_BASE_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define STOCK_BASE_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !STOCK_BASE_EXEC_NTRACE */ + +#if (STOCK_BASE_EXEC_NTRACE == 1) +# define STOCK_BASE_EXEC_TRACE(X) +#else /* (STOCK_BASE_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define STOCK_BASE_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (STOCK_BASE_EXEC_NTRACE == 1) */ + +#endif /* STOCK_BASE_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_stub_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_stub_export.h new file mode 100644 index 00000000000..1b73531da37 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl STOCK_BASE_STUB +// ------------------------------ +#ifndef STOCK_BASE_STUB_EXPORT_H +#define STOCK_BASE_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (STOCK_BASE_STUB_HAS_DLL) +# define STOCK_BASE_STUB_HAS_DLL 1 +#endif /* ! STOCK_BASE_STUB_HAS_DLL */ + +#if defined (STOCK_BASE_STUB_HAS_DLL) && (STOCK_BASE_STUB_HAS_DLL == 1) +# if defined (STOCK_BASE_STUB_BUILD_DLL) +# define STOCK_BASE_STUB_Export ACE_Proper_Export_Flag +# define STOCK_BASE_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define STOCK_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* STOCK_BASE_STUB_BUILD_DLL */ +# define STOCK_BASE_STUB_Export ACE_Proper_Import_Flag +# define STOCK_BASE_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define STOCK_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* STOCK_BASE_STUB_BUILD_DLL */ +#else /* STOCK_BASE_STUB_HAS_DLL == 1 */ +# define STOCK_BASE_STUB_Export +# define STOCK_BASE_STUB_SINGLETON_DECLARATION(T) +# define STOCK_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* STOCK_BASE_STUB_HAS_DLL == 1 */ + +// Set STOCK_BASE_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (STOCK_BASE_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define STOCK_BASE_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define STOCK_BASE_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !STOCK_BASE_STUB_NTRACE */ + +#if (STOCK_BASE_STUB_NTRACE == 1) +# define STOCK_BASE_STUB_TRACE(X) +#else /* (STOCK_BASE_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define STOCK_BASE_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (STOCK_BASE_STUB_NTRACE == 1) */ + +#endif /* STOCK_BASE_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_svnt_export.h b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_svnt_export.h new file mode 100644 index 00000000000..b3dfe948823 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/Stock_Base/Stock_Base_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl STOCK_BASE_SVNT +// ------------------------------ +#ifndef STOCK_BASE_SVNT_EXPORT_H +#define STOCK_BASE_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (STOCK_BASE_SVNT_HAS_DLL) +# define STOCK_BASE_SVNT_HAS_DLL 1 +#endif /* ! STOCK_BASE_SVNT_HAS_DLL */ + +#if defined (STOCK_BASE_SVNT_HAS_DLL) && (STOCK_BASE_SVNT_HAS_DLL == 1) +# if defined (STOCK_BASE_SVNT_BUILD_DLL) +# define STOCK_BASE_SVNT_Export ACE_Proper_Export_Flag +# define STOCK_BASE_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define STOCK_BASE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* STOCK_BASE_SVNT_BUILD_DLL */ +# define STOCK_BASE_SVNT_Export ACE_Proper_Import_Flag +# define STOCK_BASE_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define STOCK_BASE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* STOCK_BASE_SVNT_BUILD_DLL */ +#else /* STOCK_BASE_SVNT_HAS_DLL == 1 */ +# define STOCK_BASE_SVNT_Export +# define STOCK_BASE_SVNT_SINGLETON_DECLARATION(T) +# define STOCK_BASE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* STOCK_BASE_SVNT_HAS_DLL == 1 */ + +// Set STOCK_BASE_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (STOCK_BASE_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define STOCK_BASE_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define STOCK_BASE_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !STOCK_BASE_SVNT_NTRACE */ + +#if (STOCK_BASE_SVNT_NTRACE == 1) +# define STOCK_BASE_SVNT_TRACE(X) +#else /* (STOCK_BASE_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define STOCK_BASE_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (STOCK_BASE_SVNT_NTRACE == 1) */ + +#endif /* STOCK_BASE_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ccd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ccd new file mode 100644 index 00000000000..c2a0630b87b --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ccd @@ -0,0 +1,33 @@ + + + + + 803f8fc7-55de-4a20-81eb-ae951d85b7f4 + IDL:Stock/StockBroker:1.0 + IDL:Stock/StockBroker:1.0 + + notify_in + false + false + false + false + IDL:Stock/StockName:1.0 + IDL:Stock/StockName:1.0 + EventConsumer + + + read_quoter + false + false + false + false + IDL:Stock/StockQuoter:1.0 + IDL:Stock/StockQuoter:1.0 + SimplexReceptacle + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cid b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cid new file mode 100644 index 00000000000..47f49102136 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cid @@ -0,0 +1,35 @@ + + + + 789e1be2-703f-4bd3-af50-b400eef91fd0 + + + + Broker_stub + + + + Broker_svnt + + + + Broker_exec + + + + + ComponentIOR + + + tk_string + + + Broker.ior + + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cpd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cpd new file mode 100644 index 00000000000..cc6381b658a --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.cpd @@ -0,0 +1,14 @@ + + + + 07ebf947-2174-4a3b-bd37-bcb92986eaf4 + + + Broker + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ior b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ior new file mode 100644 index 00000000000..6ef06e3db23 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker.ior @@ -0,0 +1 @@ +IOR:010000001a00000049444c3a53746f636b2f53746f636b42726f6b65723a312e30000000010000000000000074000000010102cd0f0000003132392e35392e3132392e32303000cd0507cdcd2300000014010f004e5354336b93420ad40d0001000000010000000100000001000000020000000002000000000000000800000001cdcdcd004f4154010000001400000001cdcdcd01000100000000000901010000000000 \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Exec.iad b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Exec.iad new file mode 100644 index 00000000000..724a5b2c6bb --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Exec.iad @@ -0,0 +1,29 @@ + + + + 5e4f2366-3810-4d4c-a269-5788a525cbe1 + Broker_exec + + ACE + + + + Broker_Stub + + + + entryPoint + + + tk_string + + + createStockBrokerHome_Impl + + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Stub.iad b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Stub.iad new file mode 100644 index 00000000000..ac1f0834e19 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Stub.iad @@ -0,0 +1,14 @@ + + + + 93bbdf7d-d3f7-4227-bb75-b0562ac15b92 + Broker_stub + + ACE + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Svnt.iad b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Svnt.iad new file mode 100644 index 00000000000..176cb624872 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Broker_Svnt.iad @@ -0,0 +1,29 @@ + + + + 04e4d246-e6eb-4b0e-8e32-60b996497cea + Broker_svnt + + ACE + + + + Broker_Stub + + + + entryPoint + + + tk_string + + + createStockBrokerHome_Servant + + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Deployment.xsd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Deployment.xsd new file mode 100644 index 00000000000..c8a6399730b --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Deployment.xsd @@ -0,0 +1,776 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ccd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ccd new file mode 100644 index 00000000000..7557e143c56 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ccd @@ -0,0 +1,41 @@ + + + + + 803f8fc7-55de-4a20-81eb-ae951d85b7f4 + IDL:Stock/StockDistributor:1.0 + IDL:Stock/StockDistributor:1.0 + + supports + false + false + false + true + IDL:Stock/Trigger:1.0 + Facet + + + notify_out + false + false + false + true + IDL:Stock/StockName:1.0 + IDL:Stock/StockName:1.0 + EventPublisher + + + push_quoter + false + false + false + true + IDL:Stock/StockQuoter:1.0 + IDL:Stock/StockQuoter:1.0 + Facet + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cid b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cid new file mode 100644 index 00000000000..b5eac80c543 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cid @@ -0,0 +1,35 @@ + + + + 789e1be2-703f-4bd3-af50-b400eef91fd0 + + + + Distributor_Stub + + + + Distributor_Svnt + + + + Distributor_Exec + + + + + ComponentIOR + + + tk_string + + + Distributor.ior + + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cpd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cpd new file mode 100644 index 00000000000..c451a5637e8 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.cpd @@ -0,0 +1,14 @@ + + + + 07ebf947-2174-4a3b-bd37-bcb92986eaf4 + + + Distributor + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ior b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ior new file mode 100644 index 00000000000..3aaaf82492d --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor.ior @@ -0,0 +1 @@ +IOR:010000001f00000049444c3a53746f636b2f53746f636b4469737472696275746f723a312e300000010000000000000074000000010102cd0f0000003132392e35392e3132392e32303000cd0007cdcd2300000014010f004e5354336b9342c2eb0b0001000000010000000100000001000000020000000002000000000000000800000001cdcdcd004f4154010000001400000001cdcdcd01000100000000000901010000000000 \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Exec.iad b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Exec.iad new file mode 100644 index 00000000000..784e11b99bf --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Exec.iad @@ -0,0 +1,29 @@ + + + + 5e4f2366-3810-4d4c-a269-5788a525cbe1 + Distributor_exec + + ACE + + + + Distributor_Stub + + + + entryPoint + + + tk_string + + + createStockDistributorHome_Impl + + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Stub.iad b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Stub.iad new file mode 100644 index 00000000000..c55a74916ef --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Stub.iad @@ -0,0 +1,14 @@ + + + + 93bbdf7d-d3f7-4227-bb75-b0562ac15b92 + Distributor_stub + + ACE + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Svnt.iad b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Svnt.iad new file mode 100644 index 00000000000..bb253b468d7 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Distributor_Svnt.iad @@ -0,0 +1,29 @@ + + + + 04e4d246-e6eb-4b0e-8e32-60b996497cea + Distributor_svnt + + ACE + + + + Distributor_Stub + + + + entryPoint + + + tk_string + + + createStockDistributorHome_Servant + + + + \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Domain.cdd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Domain.cdd new file mode 100644 index 00000000000..b4dd3c729ef --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Domain.cdd @@ -0,0 +1,17 @@ + + + +effd4bd0-6db0-4c50-9bb7-db9decebae1c + + Distributor + + + + Broker + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Libraries.iad b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Libraries.iad new file mode 100644 index 00000000000..720a7ce8219 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Libraries.iad @@ -0,0 +1,8 @@ + + + + 6bae4fcd-c71c-44b4-a0d4-0e4199ce1a49 + $ACE_ROOT/lib/libACE + $ACE_ROOT/lib/libTAO + $ACE_ROOT/lib/libCIAO_Client + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Modified_Deployment.xsd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Modified_Deployment.xsd new file mode 100644 index 00000000000..b73077b0980 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Modified_Deployment.xsd @@ -0,0 +1,790 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cdp b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cdp new file mode 100644 index 00000000000..4d327f991c2 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cdp @@ -0,0 +1,16 @@ + + + + + Distributor_Instance + Distributor + + + Broker_Instance_01 + Broker01 + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cid b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cid new file mode 100644 index 00000000000..2d2160bba7d --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cid @@ -0,0 +1,41 @@ + + + + effd4bd0-6db0-4c50-9bb7-db9decebae1c + + + Distributor_Instance + + + + Broker_Instance_01 + + + + quoter_conn + + read_quoter + + + + push_quoter + + + + + StockName_event + + notify_in + + + + notify_out + + + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cpd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cpd new file mode 100644 index 00000000000..6b2ece8e164 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.cpd @@ -0,0 +1,13 @@ + + + + 823e4287-f53c-4caa-8619-f3dfda4c4998 + + Stock + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.dat b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.dat new file mode 100644 index 00000000000..6079555046c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.dat @@ -0,0 +1,3 @@ +DistributorNode corbaloc:iiop:localhost:30000/NodeManager +BrokerNode corbaloc:iiop:localhost:40000/NodeManager + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.pcd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.pcd new file mode 100644 index 00000000000..d65c2d9f86b --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/Stock.pcd @@ -0,0 +1,10 @@ + + + + 559d65e8-0407-48c0-a158-dafe21360fef + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/XMI.xsd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/XMI.xsd new file mode 100644 index 00000000000..f4adac91934 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/XMI.xsd @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/flattened_deploymentplan.cdp b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/flattened_deploymentplan.cdp new file mode 100644 index 00000000000..3b9915c177f --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/flattened_deploymentplan.cdp @@ -0,0 +1,185 @@ + + + + + + + c0965470-7b83-11d9-9669-0800200c9a66 + + IDL:Quoter/EC:1.0 + + read_quoter + IDL:Quoter/Read_Quoter:1.0 + IDL:Quoter/Read_Quoter:1.0 + false> + false + true + false + SimplexReceptacle + + + + + Quoter-Distributor-mdd + + Quoter-Distributor_exec + Quoter-Distributor_svnt + + + + + Quoter-Broker-mdd + + Quoter-Broker_exec + Quoter-Broker_svnt + + + + + Quoter-Distributor-idd + DistributorNode + + Quoter-Distributor-mdd + + ComponentIOR + + + tk_string + + + Distributor.ior + + + + + + + Quoter-Broker-idd + BrokerNode + + Quoter-Broker-mdd + + ComponentIOR + + + tk_string + + + Broker.ior + + + + + + + + Quoter_event_connection + + notify_out + EventPublisher + Quoter-Distributor-idd + + + notify_in + EventConsumer + Quoter-Broker-idd + + + + + Quoter_facet_connection + + push_quoter + Facet + Quoter-Distributor-idd + + + read_quoter + SimplexReceptacle + Quoter-Broker-idd + + + + + + Distributor_exec + + + Distributor_exec + + entryPoint + + + tk_string + + + createStockDistributorHome_Impl + + + + + + + Distributor_svnt + + + Distributor_svnt + + entryPoint + + + tk_string + + + createStockDistributorHome_Servant + + + + + + + Broker_exec + + + Broker_exec + + entryPoint + + + tk_string + + + createStockBrokerHome_Impl + + + + + + + Broker_svnt + + + Broker_svnt + + entryPoint + + + tk_string + + + createStockBrokerHome_Servant + + + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/ior b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/ior new file mode 100644 index 00000000000..9eb6b861131 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/ior @@ -0,0 +1 @@ +IOR:010000002400000049444c3a4349414f2f457865637574696f6e4d616e616765724461656d6f6e3a312e300001000000000000006c000000010102cd0f0000003132392e35392e3132392e32303000cdf606cdcd1b00000014010f005253542d6b9342d4650c00000000000100000001000000cd02000000000000000800000001cdcdcd004f4154010000001400000001cdcdcd01000100000000000901010000000000 \ No newline at end of file diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/package.tpd b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/package.tpd new file mode 100644 index 00000000000..b753de7b7ff --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/package.tpd @@ -0,0 +1,8 @@ + + + + diff --git a/TAO/CIAO/DAnCE/examples/Quoter/descriptors/runNodeDaemons.pl b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/runNodeDaemons.pl new file mode 100644 index 00000000000..81eb9204afc --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Quoter/descriptors/runNodeDaemons.pl @@ -0,0 +1,40 @@ +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; +$iorfile1 = PerlACE::LocalFile ("NodeApp1.ior"); +$iorfile2 = PerlACE::LocalFile ("NodeApp2.ior"); + +#for ($iter = 0; $iter <= $#ARGV; $iter++) { +# if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") { +# print "Run_Test Perl script for NodeApplicationTest \n\n"; +# print "run_test \n"; +# print "\n"; +# print "-h -- prints this information\n"; +# exit 0; +# } +#} + + +unlink $iorfile1; +unlink $iorfile2; + +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; + +$SV1 = new PerlACE::Process ("$CIAO_ROOT/DAnCE/NodeManager/Node_Daemon", + "-ORBEndpoint iiop://localhost:30000 -s $CIAO_ROOT/DAnCE/NodeApplication/NodeApplication"); + +$SV2 = new PerlACE::Process ("$CIAO_ROOT/DAnCE/NodeManager/Node_Daemon", + "-ORBEndpoint iiop://localhost:40000 -s $CIAO_ROOT/DAnCE/NodeApplication/NodeApplication"); + +$SV1->Spawn (); +$SV2->Spawn (); + +sleep (99999999999); diff --git a/TAO/CIAO/DAnCE/examples/Quoter/images/quoter.jpg b/TAO/CIAO/DAnCE/examples/Quoter/images/quoter.jpg new file mode 100644 index 00000000000..2f3edd11329 Binary files /dev/null and b/TAO/CIAO/DAnCE/examples/Quoter/images/quoter.jpg differ -- cgit v1.2.1