diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-02-11 14:59:08 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-02-11 14:59:08 +0000 |
commit | 1d548515ebcc0fecee1bc83c1a46505f07757170 (patch) | |
tree | 94c4f1e2792532189cf0f536ab4c3d4ea608f21c /CIAO/DAnCE | |
parent | 500fdb3bc07404d9b62f72a84d69f510108168df (diff) | |
download | ATCD-1d548515ebcc0fecee1bc83c1a46505f07757170.tar.gz |
ChangeLogTag: Wed Feb 11 14:46:15 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
Diffstat (limited to 'CIAO/DAnCE')
362 files changed, 28611 insertions, 21789 deletions
diff --git a/CIAO/DAnCE/Deployment.mwc b/CIAO/DAnCE/Deployment.mwc index fcf95d10967..88629dd7dd3 100644 --- a/CIAO/DAnCE/Deployment.mwc +++ b/CIAO/DAnCE/Deployment.mwc @@ -1,4 +1,11 @@ // $Id$ workspace { + $(CIAO_ROOT)/ciao/CCM_Client.mpc + $(CIAO_ROOT)/tools/. + ./. + exclude { + ./Mocks + ./tests/MocksTest + } } diff --git a/CIAO/DAnCE/Deployment/CIAO_NodeApplication_CallBack.idl b/CIAO/DAnCE/Deployment/CIAO_NodeApplication_CallBack.idl deleted file mode 100644 index b68fa81bf78..00000000000 --- a/CIAO/DAnCE/Deployment/CIAO_NodeApplication_CallBack.idl +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -/** - * This IDL file is used to combine the NodeApplication - * interface with the NodeApplicationManager interface. - * - * NodeApplicationManager will be spawn NodeApplication. - * The call back object will be used to get the objectref of - * NodeApplication. - */ - -#include "DAnCE/Deployment/Deployment_NodeApplication.idl" -#include "DAnCE/Deployment/Deployment_NodeApplicationManager.idl" - -module CIAO -{ - interface NodeApplication_Callback - { - Deployment::NodeApplicationManager - register_node_application (in Deployment::NodeApplication na, - out Deployment::Properties properties); - }; -}; diff --git a/CIAO/DAnCE/Deployment/CIAO_ServerResources.idl b/CIAO/DAnCE/Deployment/CIAO_ServerResources.idl deleted file mode 100644 index 75eb8880d07..00000000000 --- a/CIAO/DAnCE/Deployment/CIAO_ServerResources.idl +++ /dev/null @@ -1,266 +0,0 @@ -// $Id$ - -/** - * @file CIAO_ServerResources.idl - * - * @brief A collection of IDL data types for - * - * @author Nanbor Wang - */ - -#if !defined (CIAO_SERVERRESOURCES_IDL) -#define CIAO_SERVERRESOURCES_IDL - -#include <orb.idl> - -module CIAO -{ - module DAnCE - { - /** - * @brief A single command line argument corresponds to a string as - * in the case of "argv". - */ - typedef string CommandlineArg; - /** - * @brief A list of command line arguments which a - * NodeApplicationManager will use to start up the NodeApplication - * this list is associated to. The command line arguments will be - * appended to the command line in order. - */ - typedef sequence<CommandlineArg> CommandlineArgs; - - /** - * @brief A string containing the filename of the svc.conf file the - * NodeApplication uses. The current approach of specifying - * svc.conf filename directly some harder problems such as - * distribution of svc.conf files and the relative/absolute path to - * the svc.conf file (the ServerResrouces xml document will have to - * assume the svc.conf file will be available at specific location.) - */ - typedef string SvcconfURI; - - /** - * @brief enumeration of ORB Resource Types (ORT) supported in RT - * extension. - */ - enum ORBResourceType - { - ORT_THREADPOOL, - ORT_THREADPOOLWITHLANES, - ORT_CONNECTIONBANDS - }; - - typedef short Priority; - - /** - * @brief Define a threadpool resource that an ORB must provide - */ - struct ORS_Threadpool - { - string Id; - unsigned long stacksize; - unsigned long static_threads; - unsigned long dynamic_threads; - Priority default_priority; - boolean allow_request_buffering; - unsigned long max_buffered_requests; - unsigned long max_request_buffer_size; - }; - - typedef sequence<ORS_Threadpool> ORS_ThreadpoolSeq; - - /** - * @brief Defines the configuration of a threadpool lane. We need - * to redefine it here to avoid dependency to RTCORBA library. - */ - struct ORS_ThreadpoolLane - { - Priority lane_priority; - unsigned long static_threads; - unsigned long dynamic_threads; - }; - - /** - * @brief Defines a set of threadpool lanes. We need - * to redefine it here to avoid dependency to RTCORBA library. - */ - typedef sequence<ORS_ThreadpoolLane> ORS_ThreadpoolLanes; - - /** - * @brief Defines a Threadpool with Lanes resource that an ORB - * must provide. - */ - struct ORS_ThreadpoolWithLanes - { - string Id; - unsigned long stacksize; - ORS_ThreadpoolLanes threadpool_lanes; - boolean allow_borrowing; - boolean allow_request_buffering; - unsigned long max_buffered_requests; - unsigned long max_request_buffer_size; - }; - - typedef sequence<ORS_ThreadpoolWithLanes> ORS_ThreadpoolWithLanesSeq; - - /** - * @brief Define a priority band for BandedConnection policies. - */ - struct ORS_PriorityBand - { - Priority low; - Priority high; - }; - /** - * @brief Define a list of priority bands for BandedConnection - * policies. - */ - typedef sequence<ORS_PriorityBand> ORS_PriorityBands; - - /** - * @brief Define the information needed to create a - * BandedConnection policy. This info can be referred to via its - * name (Id). - */ - struct ORS_ConnectionBands - { - string Id; - ORS_PriorityBands bands; - }; - - typedef sequence<ORS_ConnectionBands> ORS_ConnectionBandsSeq; - - /** - * @brief Collection of resources managed by the NodeApplication - * ORB. - */ - struct ORBResource - { - ORS_ThreadpoolSeq threadpool_list; - - ORS_ThreadpoolWithLanesSeq threadpool_with_lanes_list; - - ORS_ConnectionBandsSeq connection_bands_list; - }; - - typedef sequence<ORBResource, 1> ORBResources; - - // ================================================================= - - /** - * @brief PolicyType supported by DAnCE extension. Again, we are - * redefining these value to avoid dependencies to various ORB - * modules such as RTCORBA and DiffServ policy libraries. - */ - const CORBA::PolicyType PRIORITY_MODEL_POLICY_TYPE = 40; - const CORBA::PolicyType THREADPOOL_POLICY_TYPE = 41; - const CORBA::PolicyType PRIORITY_BANDED_CONNECTION_POLICY_TYPE = 45; - const CORBA::PolicyType CLIENT_NETWORK_PRIORITY_TYPE = 86; - const CORBA::PolicyType NETWORK_PRIORITY_TYPE = 87; - - enum PriorityModel - { - CLIENT_PROPAGATED, - SERVER_DECLARED - }; - - enum NWPriorityModel - { - CLIENT_PROPAGATED_NWPRIORITY, - SERVER_DECLARED_NWPRIORITY - }; - - /** - * @brief Defines data required for creating a PriorityModel Policy - */ - struct PriorityModelPolicyDef - { - PriorityModel priority_model; - Priority server_priority; - }; - - /** - * @brief Defines data required for creating a server side DiffServ policy - */ - struct NWPriorityModelPolicyDef - { - NWPriorityModel nw_priority_model; - long request_dscp; - long reply_dscp; - }; - - /** - * @brief Defines data required for creating a client side DiffServ policy - */ - struct CNWPriorityModelPolicyDef - { - long request_dscp; - long reply_dscp; - }; - - /** - * @brief Define data required for creating a Threadpool policy - */ - struct ThreadpoolPolicyDef - { - string Id; // Threadpool name defined in - // ORBResource - }; - - /** - * @brief Define data required for creating a PriorityBandedConnection - * policy - */ - struct PriorityBandedConnectionPolicyDef - { - string Id; // PriorityBands name defined in - // ORBResource - }; - - union PolicyDef switch (CORBA::PolicyType) - { - case 40: PriorityModelPolicyDef PriorityModelDef; - case 41: ThreadpoolPolicyDef ThreadpoolDef; - case 45: PriorityBandedConnectionPolicyDef PriorityBandedConnectionDef; - case 86: CNWPriorityModelPolicyDef CNWPriorityModelDef; - case 87: NWPriorityModelPolicyDef NWPriorityModelDef; - }; - - /** - * @brief Define a set of policy definitions. - */ - typedef sequence<PolicyDef> PolicyDefs; - - /** - * @brief A policy set is named. - */ - struct PolicySet - { - string Id; // Name of this policy set - PolicyDefs policies; - }; - - /** - * @brief A list of all policy sets. - */ - typedef sequence<PolicySet> PolicySets; - - struct ORBConfigs - { - ORBResources orb_resources; - PolicySets policy_set; - }; - - struct ServerResource - { - string Id; - - CommandlineArgs args; - SvcconfURI svcconf; - ORBConfigs orb_config; - }; - }; -}; - -#endif /* CIAO_SERVERRESOURCES_IDL */ diff --git a/CIAO/DAnCE/Deployment/DAnCE_Core.mpc b/CIAO/DAnCE/Deployment/DAnCE_Core.mpc index 092cddb0526..579f948acce 100644 --- a/CIAO/DAnCE/Deployment/DAnCE_Core.mpc +++ b/CIAO/DAnCE/Deployment/DAnCE_Core.mpc @@ -1,26 +1,19 @@ // -*- MPC -*- // $Id$ - -// Valuetype library must be linked for this project. -// Please don't remove. -project(Deployment_stub) : taolib_with_idl, tao_output, valuetype, ifr_client, ciao_events_base_dnc, ciao_client_dnc, messaging { - sharedname = CIAO_Deployment_stub - - // This is necessary for MPC to pull in rules.ciao.GNU - includes += $(CIAO_ROOT) - +project(Deployment_IDL) : taolib_with_idl, tao_output, valuetype, gen_ostream { + custom_only = 1 idlflags += -Wb,stub_export_macro=Deployment_stub_Export idlflags += -Wb,stub_export_include=Deployment_stub_export.h idlflags += -Wb,skel_export_macro=Deployment_svnt_Export idlflags += -Wb,skel_export_include=Deployment_svnt_export.h - - dynamicflags = DEPLOYMENT_STUB_BUILD_DLL + idlflags += -I$(CIAO_ROOT) IDL_Files { idlflags += -SS -Sci Deployment_Packaging_Data.idl Deployment_PlanError.idl + DAnCE_Properties.idl } IDL_Files { @@ -30,8 +23,6 @@ project(Deployment_stub) : taolib_with_idl, tao_output, valuetype, ifr_client, c Deployment_Data.idl Deployment_DeploymentPlan.idl Deployment_TargetData.idl - Deployment_Events.idl - CIAO_ServerResources.idl } IDL_Files { @@ -41,25 +32,35 @@ project(Deployment_stub) : taolib_with_idl, tao_output, valuetype, ifr_client, c } IDL_Files { - idlflags += -GH - Deployment_DomainApplicationManager.idl - } - - IDL_Files { Deployment_ResourceCommitmentManager.idl Deployment_TargetManager.idl - CIAO_NodeApplication_CallBack.idl Deployment_Core.idl Deployment_NodeApplication.idl Deployment_Application.idl - Deployment_Container.idl Deployment.idl Deployment_NodeManager.idl + Deployment_DomainApplicationManager.idl Deployment_DomainApplication.idl Deployment_ExecutionManager.idl Deployment_RepositoryManager.idl } +} + +// Valuetype library must be linked for this project. +// Please don't remove. +//project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client, ciao_events_base_dnc, ccm_stub, messaging, ciao_lib { +project(Deployment_stub) : taolib_with_idl, tao_output, valuetype, ifr_client, messaging, dance_lib, dance_logger, gen_ostream { + sharedname = DAnCE_Deployment_stub + after += Deployment_IDL + + // This is necessary for MPC to pull in rules.ciao.GNU + includes += $(CIAO_ROOT) + + dynamicflags = DEPLOYMENT_STUB_BUILD_DLL + + IDL_Files { + } Source_Files { Deployment_CoreC.cpp Deployment_BaseC.cpp @@ -69,7 +70,6 @@ project(Deployment_stub) : taolib_with_idl, tao_output, valuetype, ifr_client, c Deployment_TargetDataC.cpp Deployment_NodeApplicationC.cpp Deployment_ApplicationC.cpp - Deployment_ContainerC.cpp Deployment_Packaging_DataC.cpp Deployment_PlanErrorC.cpp DeploymentC.cpp @@ -82,22 +82,17 @@ project(Deployment_stub) : taolib_with_idl, tao_output, valuetype, ifr_client, c Deployment_ExecutionManagerC.cpp Deployment_RepositoryManagerC.cpp Deployment_ResourceCommitmentManagerC.cpp - CIAO_NodeApplication_CallBackC.cpp - CIAO_ServerResourcesC.cpp - Deployment_EventsC.cpp + DAnCE_PropertiesC.cpp } } // CIAO_DnC_Client library must be linked for this project. -// Please don't remove. -project(Deployment_svnt) : taolib_with_idl, tao_output, portableserver, valuetype, ifr_client, ciao_deployment_stub, ciao_events_dnc, ciao_client_dnc, naming { - sharedname = CIAO_Deployment_svnt +// Please don't remove. dance_deployment_stub, +project(Deployment_svnt) : dance_deployment_stub, tao_output, taolib_with_idl, portableserver, valuetype, ifr_client, naming, dance_lib, dance_logger, messaging, gen_ostream { + sharedname = DAnCE_Deployment_svnt dynamicflags = DEPLOYMENT_SVNT_BUILD_DLL - idlflags += -Wb,stub_export_macro=Deployment_stub_Export - idlflags += -Wb,stub_export_include=Deployment_stub_export.h - idlflags += -Wb,skel_export_macro=Deployment_svnt_Export - idlflags += -Wb,skel_export_include=Deployment_svnt_export.h + after += Deployment_IDL // This is necessary for MPC to pull in rules.ciao.GNU includes += $(CIAO_ROOT) @@ -109,7 +104,6 @@ project(Deployment_svnt) : taolib_with_idl, tao_output, portableserver, valuetyp Deployment_CoreS.cpp Deployment_ApplicationS.cpp Deployment_NodeApplicationS.cpp - Deployment_ContainerS.cpp DeploymentS.cpp Deployment_RepositoryManagerS.cpp Deployment_NodeManagerS.cpp @@ -118,11 +112,8 @@ project(Deployment_svnt) : taolib_with_idl, tao_output, portableserver, valuetyp Deployment_DomainApplicationManagerS.cpp Deployment_DomainApplicationS.cpp Deployment_ExecutionManagerS.cpp - NodeApp_CB_Impl.cpp Deployment_TargetManagerS.cpp - CIAO_NodeApplication_CallBackS.cpp Deployment_ResourceCommitmentManagerS.cpp } } - diff --git a/CIAO/DAnCE/Deployment/DAnCE_Loader.h b/CIAO/DAnCE/Deployment/DAnCE_Loader.h new file mode 100644 index 00000000000..cf40a32c288 --- /dev/null +++ b/CIAO/DAnCE/Deployment/DAnCE_Loader.h @@ -0,0 +1,26 @@ +// $Id$ + +/** + * @file DAnCE_Loader.h + * Abstract class for DAnCE object loaders. + */ + +#ifndef DANCE_LOADDER_H_ +#define DANCE_LOADDER_H_ + +namespace DAnCE +{ + class DAnCE_Object_Loader : public TAO_Object_Loader + { + public: + /// Deliver a usage statement about the object. + virtual const char * usage (void) = 0; + + /// Parse args passed to it; is not destructive + virtual bool parse_args (int argc, ACE_TCHAR *argv []) = 0; + }; + + +} + +#endif diff --git a/CIAO/DAnCE/Deployment/DAnCE_Properties.idl b/CIAO/DAnCE/Deployment/DAnCE_Properties.idl new file mode 100644 index 00000000000..a93fcdc40af --- /dev/null +++ b/CIAO/DAnCE/Deployment/DAnCE_Properties.idl @@ -0,0 +1,43 @@ +/** + * $Id$ + * + * @file DAnCE_Properties.idl + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * Codifies properties used to configure the deployment engine. + */ + +module DAnCE +{ + // Home Configuration Properties + /// Describes the entrypoint for the home executor. Property value is string. + const string HOME_FACTORY = "home factory"; + + // Component Configuration Properties + /// Describes the entrypoint for the component executor. Property value is string. + const string COMPONENT_FACTORY = "component factory"; + /// Indicates that the component instance should be deployed using specified home ID. + /// Property value is string. + const string EXPLICIT_HOME = "edu.vanderbilt.dre.DAnCE.ExplicitHome"; + + // Instance (i.e., Home or Component) Properties + /// Indicates that the instance object reference should be registered in the + /// Instance naming context using a specified name. Property value is string. + const string REGISTER_NAMING = "edu.vanderbilt.dre.DAnCE.RegisterNaming"; + /// Indicates that the instance object reference should be printed to a specifid + /// file. Property value is string. + const string INSTANCE_IOR_FILE = "edu.vanderbilt.dre.DAnCE.InstanceIOR"; + // const string REGISTER_PORT_NAMING = "edu.vanderbilt.dre.DAnCE.RegisterPortNaming"; + + // Node Infrastructure Configuration + /// Indicates that the NodeManager is running as a standalone entity. + const string STANDALONE_NM = "edu.vanderbilt.dre.DAnCE.StandaloneNM"; + /// Indicates the naming context for domain objects, which includes infrastructure + /// and redirection. + const string DOMAIN_NC = "edu.vanderbilt.dre.DAnCE.DomainNC"; + /// Indicates the naming context used for instance objects. + const string INSTANCE_NC = "edu.vanderbilt.dre.DAnCE.InstanceNC"; + + +}; + diff --git a/CIAO/DAnCE/Deployment/Deployment.idl b/CIAO/DAnCE/Deployment/Deployment.idl index ee3ea4df782..dabf69a0662 100644 --- a/CIAO/DAnCE/Deployment/Deployment.idl +++ b/CIAO/DAnCE/Deployment/Deployment.idl @@ -7,46 +7,31 @@ #include "DAnCE/Deployment/Deployment_PlanError.idl" module Deployment { - - exception InvalidProperty { - string name; - string reason; - }; - - // @@added - exception InvalidNodeExecParameter { - string name; - string reason; - }; - - // @@added - exception InvalidComponentExecParameter { - string name; - string reason; - }; - - // @@added - exception LastConfiguration { - }; - - exception NoSuchName { - }; - - exception InvalidReference { - }; - - /// Below exception types are CIAO specific - exception PlanNotExist { - }; - - /// CIAO specific struct type used for shared component management - /// mapping the name of component to its plan_uuid - struct ComponentPlan - { - string name; - string plan_uuid; - }; - typedef sequence < ComponentPlan > ComponentPlans; + exception InvalidProperty { + string name; + string reason; + }; + + exception InvalidNodeExecParameter { + string name; + string reason; + }; + + exception InvalidComponentExecParameter { + string name; + string reason; + }; + + exception NoSuchName { + }; + + exception LastConfiguration { + }; + + exception InvalidReference { + }; + //@! in DOCGroup added 1 additional exception and one structure }; #endif /* DEPLOYMENT_IDL */ + diff --git a/CIAO/DAnCE/Deployment/Deployment_Application.idl b/CIAO/DAnCE/Deployment/Deployment_Application.idl index e045d0ca849..4ef117a6546 100644 --- a/CIAO/DAnCE/Deployment/Deployment_Application.idl +++ b/CIAO/DAnCE/Deployment/Deployment_Application.idl @@ -1,39 +1,32 @@ // $Id$ -#if !defined (DEPLOYMENT_APPLICATION_IDL) +#ifndef DEPLOYMENT_APPLICATION_IDL #define DEPLOYMENT_APPLICATION_IDL #include "DAnCE/Deployment/Deployment_Connection.idl" module Deployment { - exception StartError - { - string name; - string reason; - }; + exception StartError { + string name; + string reason; + }; - exception InvalidConnection - { - string name; - string reason; - }; + exception InvalidConnection { + string name; + string reason; + }; - interface Application - { - // @@changed - // void finishLaunch (in Connections providedReference, - // in boolean start) - // raises (StartError, InvalidConnection); - - void finishLaunch (in Connections providedReference, - in boolean start, - in boolean is_ReDAC) - raises (StartError, InvalidConnection); - void start () - raises (StartError); - }; - typedef sequence < Application > Applications; + interface Application { + //@! in DOCGroup has additional parameter + void finishLaunch (in Connections providedReference, in boolean start) + raises (StartError, InvalidConnection); + + void start () + raises (StartError); + }; + + typedef sequence < Application > Applications; }; #endif /* DEPLOYMENT_APPLICATION_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_ApplicationManager.idl b/CIAO/DAnCE/Deployment/Deployment_ApplicationManager.idl index c7f5a1957d1..6f35ae0bcb7 100644 --- a/CIAO/DAnCE/Deployment/Deployment_ApplicationManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_ApplicationManager.idl @@ -6,6 +6,7 @@ #include "DAnCE/Deployment/Deployment.idl" module Deployment { + exception ResourceNotAvailable { string name; string resourceType; @@ -15,13 +16,15 @@ module Deployment { }; interface ApplicationManager { - /// @todo Spec mentions another few exceptions in the raises cluase - // @@changed - Application startLaunch (in Properties configProperty, - out Connections providedReference, - in boolean start) - raises (ResourceNotAvailable, StartError, InvalidProperty, - InvalidNodeExecParameter, InvalidComponentExecParameter); + //@! in DOCGroup has additional parameter + Application startLaunch ( in Properties configProperty, + out Connections providedReference) + raises (ResourceNotAvailable, + StartError, + InvalidProperty, + InvalidNodeExecParameter, + InvalidComponentExecParameter); + void destroyApplication (in Application app) raises (StopError); }; diff --git a/CIAO/DAnCE/Deployment/Deployment_Base.idl b/CIAO/DAnCE/Deployment/Deployment_Base.idl index 0ae4a2748f6..c0db10ecb14 100644 --- a/CIAO/DAnCE/Deployment/Deployment_Base.idl +++ b/CIAO/DAnCE/Deployment/Deployment_Base.idl @@ -5,38 +5,38 @@ module Deployment { - struct Property - { - string name; - any value; - }; - typedef sequence < Property > Properties; - - // @@changed element order - struct Requirement { - string name; - string resourceType; - Properties property; - }; - - typedef sequence < Requirement > Requirements; - - enum SatisfierPropertyKind { - Quantity, - Capacity, - Minimum, - Maximum, - _Attribute, - Selection - }; - - struct SatisfierProperty { - string name; - SatisfierPropertyKind kind; - boolean dynamic; - any value; - }; - typedef sequence < SatisfierProperty > SatisfierProperties; + struct Property { + string name; + any value; + }; + + typedef sequence < Property > Properties; + + struct Requirement { + string name; + string resourceType; + Properties property; + }; + + typedef sequence < Requirement > Requirements; + + enum SatisfierPropertyKind { + Quantity, + Capacity, + Minimum, + Maximum, + _Attribute, + Selection + }; + + struct SatisfierProperty { + string name; + SatisfierPropertyKind kind; + boolean dynamic; + any value; + }; + + typedef sequence < SatisfierProperty > SatisfierProperties; }; #endif /* DEPLOYMENT_BASE_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_Connection.idl b/CIAO/DAnCE/Deployment/Deployment_Connection.idl index 0d6ac886ef1..d054e7e4602 100644 --- a/CIAO/DAnCE/Deployment/Deployment_Connection.idl +++ b/CIAO/DAnCE/Deployment/Deployment_Connection.idl @@ -1,50 +1,21 @@ // $Id$ -#if !defined (DEPLOYMENT_CONNECTION_IDL) +#ifndef DEPLOYMENT_CONNECTION_IDL #define DEPLOYMENT_CONNECTION_IDL #include "DAnCE/Deployment/Deployment_DeploymentPlan.idl" -#include <ciaosvcs/Events/CIAO_Events_Base/CIAO_Events.idl> +//@! From DOCGroup source +//#include "ciaosvcs/Events/CIAO_Events_Base/CIAO_Events.idl" -// *************** Packaging and Deployment *************** module Deployment { - typedef sequence < Object > Endpoints; - //typedef Object Endpoint; - - // @@changed - // struct Connection - // { - // string name; - // Endpoints endpoint; - // }; - - // CIAO's specific <Connection> type defition. - // To avoid the connection info in the plan being passed to the - // local node and to make the implementation not very cumbersome - // I changed the connection struct to include some extra informations. - struct Connection - { - string instanceName; - string portName; - CCMComponentPortKind kind; - - string endpointInstanceName; // CIAO specific extension - string endpointPortName; // CIAO specific extension - - // the endpoints member is change to endpoint. - // Since we will not have more than 1 objref in there. - Object endpoint; - - // A wrapper facade interface to provision different event - // communication mechanisms, including RTEC, etc. - CIAO::CIAO_Event_Service event_service; - - // The properties of this connection, particularly useful - // to speicfy QoS properties of pub/sub service connections. - Properties config; - }; - - typedef sequence < Connection > Connections; + typedef sequence < Object > Endpoints; + //@! in DOCGroup this struct seriously extended + struct Connection { + string name; + Endpoints endpoint; + }; + + typedef sequence < Connection > Connections; }; #endif /* DEPLOYMENT_CONNECTION_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_Container.idl b/CIAO/DAnCE/Deployment/Deployment_Container.idl deleted file mode 100644 index 3e35cbae5b3..00000000000 --- a/CIAO/DAnCE/Deployment/Deployment_Container.idl +++ /dev/null @@ -1,93 +0,0 @@ -// $Id$ - -#if !defined (DEPLOYMENT_CONTAINER_IDL) -#define DEPLOYMENT_CONTAINER_IDL - -#include "DAnCE/Deployment/Deployment_Application.idl" -#include "DAnCE/Deployment/Deployment_Core.idl" - -// *************** Packaging and Deployment *************** -module Deployment -{ - interface NodeApplication; // Forward decl. - - /// CIAO specific - struct Component_Info - { - string component_instance_name; - Components::CCMObject component_ref; - }; - - /// CIAO specific - typedef sequence < Component_Info > ComponentInfos; - - /// CIAO specific - struct ComponentImplementationInfo - { - string component_instance_name; - string executor_dll; - string executor_entrypt; - string servant_dll; - string servant_entrypt; - Properties component_config; - // Properties home_config; //ignored for now. - }; - - /// CIAO specific - typedef sequence <ComponentImplementationInfo> ComponentImplementationInfos; - - // ContainerImplementationInfo contains a list of components to be installed and - // policy configuration for the container which hosts these components - /// CIAO specific - struct ContainerImplementationInfo - { - ComponentImplementationInfos impl_infos; - Properties container_config; - }; - - /// CIAO specific - typedef sequence <ContainerImplementationInfo> ContainerImplementationInfos; - - /// CIAO specific interface, which could deal with installing multiple - /// containers into a single NodeApplication. - interface Container - { - readonly attribute ::Deployment::Properties properties; - - /// Get the NodeApplication which created us - NodeApplication get_node_application (); - - /// Initialize the container with policies - // long init (in ::CORBA::PolicyList policies); - - // NW: The following should be component specific info because the - // container has already been created and initialized at this - // time. So there's not much container configuration to be done - // at this stage. - //@@ The container_impl_info will contain - //1 component instance name as the key. - //2 dll/so name of the exec - //3 entry point of the exec - //4 dll/so name of the svnt - //5 entry point of the svnt - //6 Poosible other configuration for container/home/component - - /// Install all homes and components - Deployment::ComponentInfos install (in ContainerImplementationInfo container_impl_info) - raises (UnknownImplId, - ImplEntryPointNotFound, - InstallationFailure, - ::Components::InvalidConfiguration); - - /// Remove all homes and components - void remove () - raises (::Components::RemoveFailure); - - /// Remove a component instance - void remove_component (in string inst_name) - raises (::Components::RemoveFailure); - }; - - typedef sequence<Container> Containers; -}; -#endif /* DEPLOYMENT_CONTAINER_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_Core.idl b/CIAO/DAnCE/Deployment/Deployment_Core.idl index d6c32e010a9..1c1dcddc9ad 100644 --- a/CIAO/DAnCE/Deployment/Deployment_Core.idl +++ b/CIAO/DAnCE/Deployment/Deployment_Core.idl @@ -1,49 +1,20 @@ // $Id$ -#if !defined (DEPLOYMENT_CORE_IDL) +#ifndef DEPLOYMENT_CORE_IDL #define DEPLOYMENT_CORE_IDL -#include "ciao/CCM_Component.idl" +//#include "ciao/CCM_Component.idl" #include "DAnCE/Deployment/Deployment_TargetData.idl" #include "DAnCE/Deployment/Deployment_Data.idl" #include "DAnCE/Deployment/Deployment_Application.idl" -// *************** Packaging and Deployment *************** -module Deployment -{ - // Typeprefix Components "omg.org"; - // OMG threw these things away, didn't it. +module Deployment { - /// CIAO specific - exception UnknownImplId - { - string name; - string reason; - }; - - /// CIAO specific - exception InstallationFailure - { - string name; - string reason; - }; - - /// CIAO specific - exception ImplEntryPointNotFound - { - string name; - string reason; - }; - - /** - * The StopError exception is raised if a problem occurred while terminating - * an application, either during the terminate operation of the - * ApplicationManager or during the destroyManager operation of the - * ExecutionManager. - */ - exception StopError { - string name; - string reason; - }; + //@! in DOCGroup three additional exceptions specified + exception StopError { + string name; + string reason; + }; }; #endif /* DEPLOYMENT_CORE_IDL */ + diff --git a/CIAO/DAnCE/Deployment/Deployment_Data.idl b/CIAO/DAnCE/Deployment/Deployment_Data.idl index b452ebe3ad4..84fa9de5a42 100644 --- a/CIAO/DAnCE/Deployment/Deployment_Data.idl +++ b/CIAO/DAnCE/Deployment/Deployment_Data.idl @@ -6,40 +6,38 @@ #include "DAnCE/Deployment/Deployment_DeploymentPlan.idl" module Deployment { + //@! in DOCGroup requiredType has type string + struct ComponentPackageReference { + string requiredUUID; + string requiredName; + ComponentInterfaceDescription requiredType; + }; + + typedef sequence < ComponentPackageReference > ComponentPackageReferences; + + typedef sequence < ResourceUsageKind > ResourceUsageKinds; + + struct ImplementationRequirement { + ResourceUsageKinds resourceUsage; + string resourcePort; + string componentPort; + string name; + string resourceType; + Properties property; + }; + + typedef sequence < ImplementationRequirement > ImplementationRequirements; + + struct Capability { + string name; + ::CORBA::StringSeq resourceType; + SatisfierProperties property; + }; + + typedef sequence < Capability > Capabilities; - struct ComponentPackageReference { - string requiredUUID; - string requiredName; - - // @@changed - //ComponentInterfaceDescription requiredType; - - string requiredType; - }; - - typedef sequence < ComponentPackageReference > ComponentPackageReferences; - - typedef sequence < ResourceUsageKind > ResourceUsageKinds; - - struct ImplementationRequirement { - ResourceUsageKinds resourceUsage; - string resourcePort; - string componentPort; - // @@ changed: order of name and resourceType - string name; - string resourceType; - Properties property; - }; - - typedef sequence < ImplementationRequirement > ImplementationRequirements; - - struct Capability { - string name; - ::CORBA::StringSeq resourceType; - SatisfierProperties property; - }; - - typedef sequence < Capability > Capabilities; }; #endif /* DEPLOYMENT_DATA_IDL */ + + diff --git a/CIAO/DAnCE/Deployment/Deployment_DeploymentPlan.idl b/CIAO/DAnCE/Deployment/Deployment_DeploymentPlan.idl index 248a61b75d2..e56d00f99e8 100644 --- a/CIAO/DAnCE/Deployment/Deployment_DeploymentPlan.idl +++ b/CIAO/DAnCE/Deployment/Deployment_DeploymentPlan.idl @@ -9,220 +9,200 @@ #include "tao/Typecode_types.pidl" module Deployment { - - enum CCMComponentPortKind - { - Facet, - SimplexReceptacle, - MultiplexReceptacle, - EventEmitter, - EventPublisher, - EventConsumer - }; - - struct ComponentPortDescription { - string name; - string specificType; - ::CORBA::StringSeq supportedType; - boolean provider; - boolean exclusiveProvider; - boolean exclusiveUser; - boolean optional; - CCMComponentPortKind kind; - }; - - typedef sequence < ComponentPortDescription > ComponentPortDescriptions; - - struct ComponentPropertyDescription { - string name; - CORBA::TypeCode type; - }; - - typedef sequence < ComponentPropertyDescription > ComponentPropertyDescriptions; - - struct ComponentInterfaceDescription { - string label; - string UUID; - string specificType; - ::CORBA::StringSeq supportedType; - ::CORBA::StringSeq idlFile; - Properties configProperty; - ComponentPortDescriptions port; - ComponentPropertyDescriptions property; - Properties infoProperty; - }; - - struct MonolithicDeploymentDescription { - string name; - ::CORBA::StringSeq source; - ::CORBA::ULongSeq artifactRef; - // @@changed - // Properties nodeExecParameter; - Properties execParameter; - - // @@added - // Properties componentExecParameter; - - // @@delete: - Requirements deployRequirement; - }; - - typedef sequence < MonolithicDeploymentDescription > MonolithicDeploymentDescriptions; - - enum ResourceUsageKind { - None, - InstanceUsesResource, - ResourceUsesInstance, - PortUsesResource, - ResourceUsesPort - }; - - struct InstanceResourceDeploymentDescription { - ResourceUsageKind resourceUsage; - // @@added - //string resourcePort; - // @@added - //string componentPort; - - string requirementName; - string resourceName; - Properties property; - }; - - typedef sequence < InstanceResourceDeploymentDescription > InstanceResourceDeploymentDescriptions; - - struct InstanceDeploymentDescription { - string name; - string node; - ::CORBA::StringSeq source; - unsigned long implementationRef; - Properties configProperty; - InstanceResourceDeploymentDescriptions deployedResource; - InstanceResourceDeploymentDescriptions deployedSharedResource; - }; - - typedef sequence < InstanceDeploymentDescription > InstanceDeploymentDescriptions; - - struct ComponentExternalPortEndpoint { - string portName; - }; - - typedef sequence < ComponentExternalPortEndpoint > ComponentExternalPortEndpoints; - - struct PlanSubcomponentPortEndpoint { - string portName; - boolean provider; - CCMComponentPortKind kind; - unsigned long instanceRef; - }; - - typedef sequence < PlanSubcomponentPortEndpoint > PlanSubcomponentPortEndpoints; - - struct ExternalReferenceEndpoint { - string location; - // @@added - // boolean provider; - // @@added - // string portName; - // @@added - // ::CORBA::StringSeq supportedType; - }; - - typedef sequence < ExternalReferenceEndpoint > ExternalReferenceEndpoints; - - struct ConnectionResourceDeploymentDescription { - string targetName; - string requirementName; - string resourceName; - Properties property; - }; - - typedef sequence < ConnectionResourceDeploymentDescription > ConnectionResourceDeploymentDescriptions; - - struct PlanConnectionDescription { - string name; - ::CORBA::StringSeq source; - Requirements deployRequirement; - ComponentExternalPortEndpoints externalEndpoint; - PlanSubcomponentPortEndpoints internalEndpoint; - ExternalReferenceEndpoints externalReference; - ConnectionResourceDeploymentDescriptions deployedResource; - }; - - typedef sequence < PlanConnectionDescription > PlanConnectionDescriptions; - - struct PlanSubcomponentPropertyReference { - string propertyName; - unsigned long instanceRef; - }; - - typedef sequence < PlanSubcomponentPropertyReference > PlanSubcomponentPropertyReferences; - - struct PlanPropertyMapping { - string name; - ::CORBA::StringSeq source; - string externalName; - PlanSubcomponentPropertyReferences delegatesTo; - }; - - typedef sequence < PlanPropertyMapping > PlanPropertyMappings; - - struct ImplementationDependency { - string requiredType; - }; - - typedef sequence < ImplementationDependency > ImplementationDependencies; - - struct ResourceDeploymentDescription { - string requirementName; - string resourceName; - Properties property; - }; - - typedef sequence < ResourceDeploymentDescription > ResourceDeploymentDescriptions; - - struct ArtifactDeploymentDescription { - string name; - ::CORBA::StringSeq location; - string node; - ::CORBA::StringSeq source; - Properties execParameter; - - // @@delete: - Requirements deployRequirement; - - ResourceDeploymentDescriptions deployedResource; - }; - - typedef sequence < ArtifactDeploymentDescription > ArtifactDeploymentDescriptions; - - // @@added - enum PlanLocalityKind { - PlanSameProcess, - PlanDifferentProcess, - PlanNoConstraint - }; - - // @@added - struct PlanLocality { - PlanLocalityKind constraint; - ::CORBA::ULongSeq constrainedInstanceRef; - }; - - struct DeploymentPlan { - string label; - string UUID; - ComponentInterfaceDescription realizes; - MonolithicDeploymentDescriptions implementation; - InstanceDeploymentDescriptions instance; - PlanConnectionDescriptions connection; - PlanPropertyMappings externalProperty; - ImplementationDependencies dependsOn; - ArtifactDeploymentDescriptions artifact; - Properties infoProperty; - // @added - // PlanLocalities localityConstraint; - }; + enum CCMComponentPortKind { + Facet, + SimplexReceptacle, + MultiplexReceptacle, + EventEmitter, + EventPublisher, + EventConsumer + }; + + struct ComponentPortDescription { + string name; + string specificType; + ::CORBA::StringSeq supportedType; + boolean provider; + boolean exclusiveProvider; + boolean exclusiveUser; + boolean optional; + CCMComponentPortKind kind; + }; + + typedef sequence < ComponentPortDescription > ComponentPortDescriptions; + + struct ComponentPropertyDescription { + string name; + CORBA::TypeCode type; + }; + + typedef sequence < ComponentPropertyDescription > ComponentPropertyDescriptions; + + struct ComponentInterfaceDescription { + string label; + string UUID; + string specificType; + ::CORBA::StringSeq supportedType; + ::CORBA::StringSeq idlFile; + Properties configProperty; + ComponentPortDescriptions port; + ComponentPropertyDescriptions property; + Properties infoProperty; + }; + + struct MonolithicDeploymentDescription { + string name; + ::CORBA::StringSeq source; + ::CORBA::ULongSeq artifactRef; + Properties execParameter; + Requirements deployRequirement; + }; + + typedef sequence < MonolithicDeploymentDescription > MonolithicDeploymentDescriptions; + + enum ResourceUsageKind { + None, + InstanceUsesResource, + ResourceUsesInstance, + PortUsesResource, + ResourceUsesPort + }; + + struct InstanceResourceDeploymentDescription { + ResourceUsageKind resourceUsage; + string requirementName; + string resourceName; + Properties property; + }; + + typedef sequence < InstanceResourceDeploymentDescription > InstanceResourceDeploymentDescriptions; + + struct InstanceDeploymentDescription { + string name; + string node; + ::CORBA::StringSeq source; + unsigned long implementationRef; + Properties configProperty; + InstanceResourceDeploymentDescriptions deployedResource; + InstanceResourceDeploymentDescriptions deployedSharedResource; + }; + + typedef sequence < InstanceDeploymentDescription > InstanceDeploymentDescriptions; + + struct ComponentExternalPortEndpoint { + string portName; + }; + + typedef sequence < ComponentExternalPortEndpoint > ComponentExternalPortEndpoints; + + struct PlanSubcomponentPortEndpoint { + string portName; + boolean provider; + CCMComponentPortKind kind; + unsigned long instanceRef; + }; + + typedef sequence < PlanSubcomponentPortEndpoint > PlanSubcomponentPortEndpoints; + + //@! in DOCGroup provider, portName and supportesType are removed + struct ExternalReferenceEndpoint { + string location; + boolean provider; + string portName; + ::CORBA::StringSeq supportedType; + }; + + typedef sequence < ExternalReferenceEndpoint > ExternalReferenceEndpoints; + + struct ConnectionResourceDeploymentDescription { + string targetName; + string requirementName; + string resourceName; + Properties property; + }; + + typedef sequence < ConnectionResourceDeploymentDescription > ConnectionResourceDeploymentDescriptions; + + struct PlanConnectionDescription { + string name; + ::CORBA::StringSeq source; + Requirements deployRequirement; + ComponentExternalPortEndpoints externalEndpoint; + PlanSubcomponentPortEndpoints internalEndpoint; + ExternalReferenceEndpoints externalReference; + ConnectionResourceDeploymentDescriptions deployedResource; + }; + + typedef sequence < PlanConnectionDescription > PlanConnectionDescriptions; + + struct PlanSubcomponentPropertyReference { + string propertyName; + unsigned long instanceRef; + }; + + typedef sequence < PlanSubcomponentPropertyReference > PlanSubcomponentPropertyReferences; + + struct PlanPropertyMapping { + string name; + ::CORBA::StringSeq source; + string externalName; + PlanSubcomponentPropertyReferences delegatesTo; + }; + + typedef sequence < PlanPropertyMapping > PlanPropertyMappings; + + struct ImplementationDependency { + string requiredType; + }; + + typedef sequence < ImplementationDependency > ImplementationDependencies; + + struct ResourceDeploymentDescription { + string requirementName; + string resourceName; + Properties property; + }; + + typedef sequence < ResourceDeploymentDescription > ResourceDeploymentDescriptions; + + struct ArtifactDeploymentDescription { + string name; + ::CORBA::StringSeq location; + string node; + ::CORBA::StringSeq source; + Properties execParameter; + Requirements deployRequirement; + ResourceDeploymentDescriptions deployedResource; + }; + + typedef sequence < ArtifactDeploymentDescription > ArtifactDeploymentDescriptions; + + enum PlanLocalityKind { + PlanSameProcess, + PlanDifferentProcess, + PlanNoConstraint + }; + + struct PlanLocality { + PlanLocalityKind constraint; + ::CORBA::ULongSeq constrainedInstanceRef; + }; + //@! in DOCGroup not implemented + typedef sequence < PlanLocality > PlanLocalities; + //@! in DOCGroup localityConstraint is commented + struct DeploymentPlan { + string label; + string UUID; + ComponentInterfaceDescription realizes; + MonolithicDeploymentDescriptions implementation; + InstanceDeploymentDescriptions instance; + PlanConnectionDescriptions connection; + PlanPropertyMappings externalProperty; + ImplementationDependencies dependsOn; + ArtifactDeploymentDescriptions artifact; + Properties infoProperty; + PlanLocalities localityConstraint; + }; }; #endif /* DEPLOYMENT_DATA_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_DomainApplication.idl b/CIAO/DAnCE/Deployment/Deployment_DomainApplication.idl index 7781907bafe..5bc0941aca9 100644 --- a/CIAO/DAnCE/Deployment/Deployment_DomainApplication.idl +++ b/CIAO/DAnCE/Deployment/Deployment_DomainApplication.idl @@ -3,17 +3,16 @@ #ifndef DEPLOYMENT_DOMAINAPPLICATION_IDL #define DEPLOYMENT_DOMAINAPPLICATION_IDL -#include "Deployment_Application.idl" -#include "Deployment_Core.idl" +#include "DAnCE/Deployment/Deployment_Application.idl" +#include "DAnCE/Deployment/Deployment_Core.idl" module Deployment { - // @@added - interface DomainApplication : - Application - { - }; + interface DomainApplication : + Application + { + }; }; -#endif +#endif //DEPLOYMENT_DOMAINAPPLICATION_IDL diff --git a/CIAO/DAnCE/Deployment/Deployment_DomainApplicationManager.idl b/CIAO/DAnCE/Deployment/Deployment_DomainApplicationManager.idl index 9e0ab0eab52..37930364044 100644 --- a/CIAO/DAnCE/Deployment/Deployment_DomainApplicationManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_DomainApplicationManager.idl @@ -7,67 +7,17 @@ #include "DAnCE/Deployment/Deployment_ApplicationManager.idl" module Deployment { - // @@changed - // interface DomainApplicationManager : - // ApplicationManager - // { - // Applications getApplications (); - // DeploymentPlan getPlan (); - // }; - - /// CIAO 's DomainApplicationManager interface differs spec-defined interface - /// in the same that it also integrates the spec-defined interface for - /// DomainApplication into itself - /// This should be derived from ApplicationManager - interface DomainApplicationManager - { - DeploymentPlan getPlan (); - - /// This method is missing from CIAO but in the spec - /// Applications getApplications (); - - /// CIAO specific version of startLaunch implementation, this one - /// differs with spec-defined operation in the sense that it doesn't - /// return DomainApplication object reference. - void startLaunch (in Properties configProperty, in boolean start) - raises (ResourceNotAvailable, StartError, InvalidProperty); - - /// This method has CIAO specific arguments and is not spec compliant - void finishLaunch (in boolean start, - in boolean is_ReDAC) - raises (StartError, InvalidConnection); - - /// CIAO specific extension - void start () - raises (StartError); - - /// CIAO specific extention - /// Fetch NodeApplication based on the given node name - NodeApplication get_node_app (in string node_name) - raises (NoSuchName); - - /// CIAO specific extension, it differs with the spec defined one - /// for no input parameter. - void destroyApplication () - raises (StopError); - - /// CIAO specific extension to destroy NodeApplicationManager - void destroyManager () - raises (StopError); - - /// CIAO specific extension - /// Perform the actual redeployment and reconfiguration on the dommain level. - void perform_redeployment (in DeploymentPlan new_plan) - raises (PlanError, - InstallationFailure, - UnknownImplId, - ImplEntryPointNotFound, - InvalidConnection, - InvalidProperty, - ::Components::RemoveFailure); - }; - - typedef sequence < DomainApplicationManager > DomainApplicationManagers; + /// CIAO 's DomainApplicationManager interface differs spec-defined interface + /// in the same that it also integrates the spec-defined interface for + /// DomainApplication into itself + interface DomainApplicationManager : + ApplicationManager + { + Applications getApplications (); + DeploymentPlan getPlan (); + }; + + typedef sequence < DomainApplicationManager > DomainApplicationManagers; }; #endif /* DOMAINAPPLICATIONMANAGER_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_Events.idl b/CIAO/DAnCE/Deployment/Deployment_Events.idl deleted file mode 100644 index b0559dfe164..00000000000 --- a/CIAO/DAnCE/Deployment/Deployment_Events.idl +++ /dev/null @@ -1,95 +0,0 @@ -// $Id$ - -/** - * @file Deployment_Events.idl - * - * @brief A collection of IDL data types for CIAO pub/sub services deployment. - * - * @author Gan Deng - */ - -#if !defined (CIAO_DEPLOYMENT_EVENT_SERVICES_IDL) -#define CIAO_DEPLOYMENT_EVENT_SERVICES_IDL - -#include "tao/StringSeq.pidl" - -// EventServiceType definition -#include <ciaosvcs/Events/CIAO_Events_Base/CIAO_Events.idl> - -module CIAO -{ - module DAnCE - { - /// Each element in the EventSourceSet denotes a event source id - typedef string EventSourceId; - - typedef sequence<EventSourceId> EventSourceSet; - - /// Event Filters - enum FilterType - { - CONJUNCTION, - DISJUNCTION, - LOGICAL_AND, - NEGATE - }; - - struct EventFilter - { - string name; - FilterType type; - EventSourceSet sources; - }; - typedef sequence<EventFilter> EventFilters; - - struct AddrServer - { - string name; - unsigned short port; - string address; - }; - typedef sequence<AddrServer> AddrServers; - - struct UDPSender - { - string name; - string addr_serv_id; - }; - typedef sequence<UDPSender> UDPSenders; - - struct UPDReceiver - { - string name; - string addr_serv_id; - boolean is_multicast; - unsigned short listen_port; - }; - typedef sequence<UPDReceiver> UPDReceivers; -/* - struct EventHandler - { - string name; - boolean is_multicast; - }; - typedef sequence<EventHandler> EventHandlers; - */ - - /// CIAO specific extension to describe pub/sub services in the deployment - struct EventServiceDeploymentDescription - { - string name; - string node; - EventServiceType type; - string svc_cfg_file; - - EventFilters filters; - AddrServers addr_servs; - UDPSenders senders; - UPDReceivers receivers; - }; - typedef sequence < EventServiceDeploymentDescription > - EventServiceDeploymentDescriptions; - }; -}; - -#endif /* CIAO_DEPLOYMENT_EVENT_SERVICES_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_ExecutionManager.idl b/CIAO/DAnCE/Deployment/Deployment_ExecutionManager.idl index 070b6a99100..00d415fde49 100644 --- a/CIAO/DAnCE/Deployment/Deployment_ExecutionManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_ExecutionManager.idl @@ -4,60 +4,18 @@ #include "DAnCE/Deployment/Deployment.idl" #include "DAnCE/Deployment/Deployment_DomainApplicationManager.idl" +#include "DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl" module Deployment { - // @@changed - // interface ExecutionManager - // { - // DomainApplicationManager preparePlan (in DeploymentPlan plan, - // in ResourceCommitmentManager resourceCommitment) - // raises (ResourceNotAvailable, PlanError, StartError); - // DomainApplicationManagers getManagers (); - // void destroyManager (in DomainApplicationManager manager) - // raises (StopError); - // }; - - interface ExecutionManager { - /// @todo ResourceCommitmentManger is missing - DomainApplicationManager preparePlan (in DeploymentPlan plan, - in boolean commitResources) - raises (ResourceNotAvailable, PlanError, StartError); - - DomainApplicationManagers getManagers (); - - void destroyManager (in DomainApplicationManager manager) - raises (StopError); - - /// CIAO Specific extension - DomainApplicationManager getManager (in string plan_uuid) - raises (PlanNotExist); - - /// CIAO specific extention - /// Destroy ApplicationManagers by plan_uuid, the unique semantics of this - /// operation lies in the fact that if some components are - /// still up and running, then the ApplicationManagers won't be destroyed. - void destroyManagerByPlan (in string plan_uuid) - raises (StopError); - - /// CIAO specific extention - /// "Get" operation, return the DeploymentPlan - DeploymentPlan getPlan (in string plan_uuid); - - /// CIAO specific operation to handle dynamic system redeployment - /// and reconfiguration - /// This operation could handle dynamic redeployment, and this - /// is the operation exposed to clients directly. Other - /// "perform_redeployment" operation defined on DAM and NA - /// are implementaion details within DAnCE. - void perform_redeployment (in DeploymentPlan new_plan) - raises (PlanError, - InstallationFailure, - UnknownImplId, - ImplEntryPointNotFound, - InvalidConnection, - InvalidProperty, - ::Components::RemoveFailure); - }; + //@! in DOCGroup this interface has significant extensions + interface ExecutionManager { + DomainApplicationManager preparePlan (in DeploymentPlan plan, + in ResourceCommitmentManager resourceCommitment) + raises (ResourceNotAvailable, PlanError, StartError); + DomainApplicationManagers getManagers (); + void destroyManager (in DomainApplicationManager manager) + raises (StopError); + }; }; #endif /* EXECUTIONMANAGER_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl b/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl index f80dda55369..7e3900bd4dd 100644 --- a/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl +++ b/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl @@ -1,127 +1,19 @@ // $Id$ -#if !defined (DEPLOYMENT_NODEAPPLICATION_IDL) +#ifndef DEPLOYMENT_NODEAPPLICATION_IDL #define DEPLOYMENT_NODEAPPLICATION_IDL -#include "Deployment_Application.idl" -#include "Deployment_Core.idl" -#include "Deployment_Container.idl" -#include "Deployment_Events.idl" - -// *************** Packaging and Deployment *************** -module Deployment -{ - /// CIAO specific extension - /// This struct captures the installation information of a particular - /// CIAO_Event_Service, as defined in <ciaosvcs/Events/CIAO_Events.idl> - struct ESInstallationInfo - { - string id; - CIAO::EventServiceType type; - string svcconf; - //Properties es_config; - }; - - /// CIAO specific - struct NodeImplementationInfo - { - ContainerImplementationInfos impl_infos; - Properties nodeapp_config; - }; - - /// CIAO specific - typedef sequence<CIAO::CIAO_Event_Service> CIAO_Event_Services; - - /// CIAO specific extension - typedef sequence<ESInstallationInfo> ESInstallationInfos; - - // @@changed - //interface NodeApplication : Application - //{ - //}; - - interface NodeApplication : Application - { - /// CIAO specific extensions - readonly attribute ::Deployment::Properties properties; - - /// CIAO specific operation to handle dynamic system redeployment - /// and reconfiguration - /// @@ Initialize the nodeapplication, so it will know what - /// components it will create and home many of them are - /// there. However the real create action will take place when - /// start launch is called on NodeApplicationManager. - long init (); - - /// @@ This operation will be called by NodeApplicationManager - /// client to really start to create homes and components. - /// CIAO specific extensions - ComponentInfos install (in NodeImplementationInfo node_impl_info) - raises (UnknownImplId, - ImplEntryPointNotFound, - InstallationFailure, - ::Components::InvalidConfiguration, - ::Components::RemoveFailure); - - /// CIAO specific extension - /// This operation will create one or more CIAO_Event_Service objects - /// within the NodeApplication, which will be used to mediate the - /// communication of CCM events - CIAO::CIAO_Event_Service install_es ( - in CIAO::DAnCE::EventServiceDeploymentDescription es_info) - raises (InstallationFailure); - - /// CIAO specific extensions - ///@@ We know that Deployment::NodeApplicationManager will be returned, - /// however to avoid the size of the shared object of CIAO_Server. - /// we return an Object. - Object get_node_application_manager (); - - /// CIAO specific extension - Container create_container (in ::Deployment::Properties properties) - raises (::Components::CreateFailure, - ::Components::InvalidConfiguration); - - /// CIAO specific extension - void remove_container (in Container cref) - raises (::Components::RemoveFailure); - - /// CIAO specific extension - Containers get_containers (); - - /// CIAO specific extension - /// Remove a component instance from the NodeApplication - void remove_component (in string inst_name) - raises (::Components::RemoveFailure); - - /// CIAO specific extensions - /// Activate a component instance from the NodeApplication - void activate_component (in string inst_name) - raises (::Deployment::StartError); - - /// CIAO specific extensions - /// Passivate a component instance from the NodeApplication - void passivate_component (in string inst_name) - raises (::Components::RemoveFailure); - - /// Remove all containers, components and component homes. - /// Shuts down the ORB of the NodeApplication to terminate the process. - oneway void remove (); - - /// CIAO specific extension. This will enforce the component to - /// be activated (preactivate, activate, postactivated) before the assembly - /// is established - void ciao_preactivate () - raises (StartError); - - /// CIAO specific extension - void ciao_postactivate () - raises (StartError); - - /// CIAO specific extension - void ciao_passivate () - raises (StopError); - }; - +#include "DAnCE/Deployment/Deployment_Application.idl" +#include "DAnCE/Deployment/Deployment_Core.idl" +//#include "DAnCE/Deployment/Deployment_Container.idl" +//#include "DAnCE/Deployment/Deployment_Events.idl" + +module Deployment { + //@! in DOCGroup NodeApplication has a lot extensions and additional types + interface NodeApplication : + Application + { + }; }; -#endif /* DEPLOYMENT_CORE_IDL */ +#endif /* DEPLOYMENT_NODEAPPLICATION_IDL */ + diff --git a/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl b/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl index 9fc2aa09581..d0026d8408e 100644 --- a/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl @@ -2,62 +2,15 @@ #ifndef NODEAPPLICATIONMANAGER_IDL #define NODEAPPLICATIONMANAGER_IDL -#include "Deployment_Core.idl" -#include "Deployment_ApplicationManager.idl" -#include "Deployment.idl" +#include "DAnCE/Deployment/Deployment_Core.idl" +#include "DAnCE/Deployment/Deployment_ApplicationManager.idl" +#include "DAnCE/Deployment/Deployment.idl" module Deployment { - /** - * CIAO specific structure to carry the scheduling params - * to set the process, required by RACE - * @struct Sched_Params - * @brief Carries Scheduling Params - */ - struct Sched_Params - { - long policy_; - long priority_; - long scope_; - long msec_; - }; - - // @@changed: - // interface NodeApplicationManager : - // ApplicationManager - // { - // }; - - interface NodeApplicationManager : - ApplicationManager - { - /// CIAO specific operation to handle dynamic system redeployment - /// and reconfiguration - /// This operation could handle dynamic redeployment for - /// a node-level deployment plan within a node - /// @param add_or_remove If true, we add new components only, vice vesa. - Application perform_redeployment (in Properties configProperty, - out Connections providedReference, - in boolean add_or_remove, - in boolean start) - raises (PlanError, - InstallationFailure, - UnknownImplId, - ImplEntryPointNotFound, - InvalidConnection, - InvalidProperty, - ::Components::RemoveFailure); - - /// CIAO specific operation to reset deployment plan - void reset_plan (in DeploymentPlan plan); - - /// CIAO specific operation to set the information of - /// "shared components" (through NodeManager) - void set_shared_components (in ComponentPlans components); - - /// CIAO specific function to set priority - /// of component, required by RACE - long set_priority (in string cid , in Sched_Params params); - }; + interface NodeApplicationManager : + ApplicationManager + { + }; }; #endif /* NODEAPPLICATIONMANAGER_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_NodeManager.idl b/CIAO/DAnCE/Deployment/Deployment_NodeManager.idl index 7c15dff0598..f70aca19928 100644 --- a/CIAO/DAnCE/Deployment/Deployment_NodeManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_NodeManager.idl @@ -5,66 +5,30 @@ #include "DAnCE/Deployment/Deployment.idl" #include "DAnCE/Deployment/Deployment_Core.idl" #include "DAnCE/Deployment/Deployment_TargetManager.idl" +#include "DAnCE/Deployment/Deployment_NodeApplicationManager.idl" module Deployment { interface Logger { }; - interface NodeApplicationManager; - - //@@changed -// interface NodeManager { -// void joinDomain (in Domain theDomain, in TargetManager manager, in -// Logger log, in long updateInterval); -// void leaveDomain (); -// NodeApplicationManager preparePlan (in DeploymentPlan plan, in -// ResourceCommitmentManager resourceCommitment) -// raises (StartError, PlanError); -// void destroyManager (in NodeApplicationManager appManager) -// raises (StopError); -// Resources getDynamicResources (); -// }; - + //@! in DOCGroup this interface has a lot extensions interface NodeManager { - /* - * @todo 06-02-01 mentions a 4th argument:in long updateInterval - */ - void joinDomain (in Domain ciao_domain, - in TargetManager manager, - in Logger log); - + void joinDomain ( in Domain theDomain, + in TargetManager manager, + in Logger log, + in long updateInterval); + void leaveDomain (); - - /* - * @todo According to 06-02-01 there should also be a ResourceCommitmentManager - * as second argument - */ - NodeApplicationManager preparePlan (in DeploymentPlan plan) + + NodeApplicationManager preparePlan (in DeploymentPlan plan, + in ResourceCommitmentManager resourceCommitment) raises (StartError, PlanError); - - /* - * @todo According to 06-02-01 InvalidReference shouldn't be here - */ + void destroyManager (in NodeApplicationManager appManager) raises (StopError, InvalidReference); - - /// CIAO specific extension - /// Destroy the NAM and all the associated NAs with this child_plan - /// We can guarantee that the input DeploymentPlan is valid, since it - /// is fetched from the cached DeploymentPlan of DAM, which has been - /// validated before. - void destroyPlan (in DeploymentPlan plan) - raises (StopError); - - /// CIAO specific extension - /// Get all the shared components installed in this node - ComponentPlans get_shared_components (); - - /* - * @todo According to 06-02-01 missing is: - * Resources getDynamicResources (); - */ + + Resources getDynamicResources (); }; }; diff --git a/CIAO/DAnCE/Deployment/Deployment_Packaging_Data.idl b/CIAO/DAnCE/Deployment/Deployment_Packaging_Data.idl index 99619f4699c..e64327168f0 100644 --- a/CIAO/DAnCE/Deployment/Deployment_Packaging_Data.idl +++ b/CIAO/DAnCE/Deployment/Deployment_Packaging_Data.idl @@ -5,167 +5,173 @@ #include "DAnCE/Deployment/Deployment_Data.idl" -module Deployment -{ - struct ComponentPackageImport { - ::CORBA::StringSeq location; - }; - - typedef sequence < ComponentPackageImport > ComponentPackageImports; - - struct SubcomponentPropertyReference { - string propertyName; - unsigned long instanceRef; - }; - - struct SubcomponentPortEndpoint { - string portName; - unsigned long instanceRef; - }; - - typedef sequence < SubcomponentPortEndpoint > SubcomponentPortEndpoints; - - typedef sequence < SubcomponentPropertyReference > SubcomponentPropertyReferences; - - struct AssemblyPropertyMapping { - string name; - string externalName; - SubcomponentPropertyReferences delegatesTo; - }; - - typedef sequence < AssemblyPropertyMapping > AssemblyPropertyMappings; - - struct NamedImplementationArtifact; - - typedef sequence < NamedImplementationArtifact > NamedImplementationArtifacts; - - struct ImplementationArtifactDescription { - string label; - string UUID; - ::CORBA::StringSeq location; - Properties execParameter; - Requirements deployRequirement; - NamedImplementationArtifacts dependsOn; - Properties infoProperty; - }; - - struct NamedImplementationArtifact { - string name; - ImplementationArtifactDescription referencedArtifact; - }; - - // @@changed: order of members - struct MonolithicImplementationDescription { - Properties nodeExecParameter; - NamedImplementationArtifacts primaryArtifact; - ImplementationRequirements deployRequirement; - Properties componentExecParameter; - }; - - typedef sequence < MonolithicImplementationDescription > MonolithicImplementationDescriptions; - - struct PackageConfiguration; - - typedef sequence < PackageConfiguration > PackageConfigurations; - - struct ComponentPackageDescription; - - typedef sequence < ComponentPackageDescription > ComponentPackageDescriptions; - - struct SubcomponentInstantiationDescription { - string name; - ComponentPackageDescriptions basePackage; - PackageConfigurations specializedConfig; - Requirements selectRequirement; - Properties configProperty; - ComponentPackageReferences referencedPackage; - ComponentPackageImports importedPackage; - }; - - typedef sequence < SubcomponentInstantiationDescription > SubcomponentInstantiationDescriptions; - - struct AssemblyConnectionDescription { - string name; - Requirements deployRequirement; - ComponentExternalPortEndpoints externalEndpoint; - SubcomponentPortEndpoints internalEndpoint; - ExternalReferenceEndpoints externalReference; - }; - - typedef sequence < AssemblyConnectionDescription > AssemblyConnectionDescriptions; - - // @@added - enum LocalityKind { - SameNodeAnyProcess, - SameNodeSameProcess, - SameNodeDifferentProcess, - DifferentNode, - DifferentProcess, - NoConstraint - }; - - // @@added - struct Locality { - LocalityKind constraint; - ::CORBA::ULongSeq constrainedInstanceRef; - }; - - struct ComponentAssemblyDescription { - SubcomponentInstantiationDescriptions instance; - AssemblyConnectionDescriptions connection; - AssemblyPropertyMappings externalProperty; - // @@added - // Localities localityConstraint; - }; - - typedef sequence < ComponentAssemblyDescription > ComponentAssemblyDescriptions; - - struct ComponentImplementationDescription { - string label; - string UUID; - ComponentInterfaceDescription implements; - ComponentAssemblyDescriptions assemblyImpl; - MonolithicImplementationDescriptions monolithicImpl; - Properties configProperty; - Capabilities capability; - ImplementationDependencies dependsOn; - Properties infoProperty; - }; - - - struct PackagedComponentImplementation { - string name; - ComponentImplementationDescription referencedImplementation; - }; - - - typedef sequence < PackagedComponentImplementation > PackagedComponentImplementations; - - struct ComponentPackageDescription { - string label; - string UUID; - ComponentInterfaceDescription realizes; - Properties configProperty; - PackagedComponentImplementations implementation; - Properties infoProperty; - }; - - - struct PackageConfiguration { - string label; - string UUID; - ComponentPackageDescriptions basePackage; - PackageConfigurations specializedConfig; - Requirements selectRequirement; - Properties configProperty; - ComponentPackageReferences reference; - // @@changed, delete previous - //ComponentPackageReferences referencedPackage; - // @@add - ComponentPackageImports importedPackage; - }; +module Deployment { + struct ComponentPackageDescription; + typedef sequence < ComponentPackageDescription > ComponentPackageDescriptions; + + struct PackageConfiguration; + + typedef sequence < PackageConfiguration > PackageConfigurations; + + struct ComponentPackageImport { + ::CORBA::StringSeq location; + }; + + typedef sequence < ComponentPackageImport > ComponentPackageImports; + + struct SubcomponentInstantiationDescription { + string name; + ComponentPackageDescriptions basePackage; + PackageConfigurations specializedConfig; + Requirements selectRequirement; + Properties configProperty; + ComponentPackageReferences referencedPackage; + ComponentPackageImports importedPackage; + }; + + typedef sequence < SubcomponentInstantiationDescription > SubcomponentInstantiationDescriptions; + + struct SubcomponentPortEndpoint { + string portName; + unsigned long instanceRef; + }; + + typedef sequence < SubcomponentPortEndpoint > SubcomponentPortEndpoints; + + struct AssemblyConnectionDescription { + string name; + Requirements deployRequirement; + ComponentExternalPortEndpoints externalEndpoint; + SubcomponentPortEndpoints internalEndpoint; + ExternalReferenceEndpoints externalReference; + }; + + typedef sequence < AssemblyConnectionDescription > AssemblyConnectionDescriptions; + + struct SubcomponentPropertyReference { + string propertyName; + unsigned long instanceRef; + }; + + typedef sequence < SubcomponentPropertyReference > SubcomponentPropertyReferences; + + struct AssemblyPropertyMapping { + string name; + string externalName; + SubcomponentPropertyReferences delegatesTo; + }; + + typedef sequence < AssemblyPropertyMapping > AssemblyPropertyMappings; + + struct NamedImplementationArtifact; + + typedef sequence < NamedImplementationArtifact > NamedImplementationArtifacts; + + struct ImplementationArtifactDescription { + string label; + string UUID; + ::CORBA::StringSeq location; + Properties execParameter; + Requirements deployRequirement; + NamedImplementationArtifacts dependsOn; + Properties infoProperty; + }; + + struct NamedImplementationArtifact { + string name; + ImplementationArtifactDescription referencedArtifact; + }; + + struct MonolithicImplementationDescription { + Properties nodeExecParameter; + NamedImplementationArtifacts primaryArtifact; + ImplementationRequirements deployRequirement; + Properties componentExecParameter; + }; + + typedef sequence < MonolithicImplementationDescription > MonolithicImplementationDescriptions; + + enum LocalityKind { + SameNodeAnyProcess, + SameNodeSameProcess, + SameNodeDifferentProcess, + DifferentNode, + DifferentProcess, + NoConstraint + }; + + struct Locality { + LocalityKind constraint; + ::CORBA::ULongSeq constrainedInstanceRef; + }; + + typedef sequence < Locality > Localities; + + struct ComponentAssemblyDescription { + SubcomponentInstantiationDescriptions instance; + AssemblyConnectionDescriptions connection; + AssemblyPropertyMappings externalProperty; + Localities localityConstraint; + }; + + typedef sequence < ComponentAssemblyDescription > ComponentAssemblyDescriptions; + + struct ComponentImplementationDescription { + string label; + string UUID; + ComponentInterfaceDescription implements; + ComponentAssemblyDescriptions assemblyImpl; + MonolithicImplementationDescriptions monolithicImpl; + Properties configProperty; + Capabilities capability; + ImplementationDependencies dependsOn; + Properties infoProperty; + }; + + struct PackagedComponentImplementation { + string name; + ComponentImplementationDescription referencedImplementation; + }; + + typedef sequence < PackagedComponentImplementation > PackagedComponentImplementations; + + struct ComponentPackageDescription { + string label; + string UUID; + ComponentInterfaceDescription realizes; + Properties configProperty; + PackagedComponentImplementations implementation; + Properties infoProperty; + }; + + struct PackageConfiguration { + string label; + string UUID; + ComponentPackageDescriptions basePackage; + PackageConfigurations specializedConfig; + Requirements selectRequirement; + Properties configProperty; + ComponentPackageReferences referencedPackage; + ComponentPackageImports importedPackage; + }; + + struct ComponentUsageDescription { + ComponentPackageDescriptions basePackage; + PackageConfigurations specializedConfig; + Requirements selectRequirement; + Properties configProperty; + ComponentPackageReferences referencedPackage; + ComponentPackageImports importedPackage; + }; + + struct RequirementSatisfier { + string name; + ::CORBA::StringSeq resourceType; + SatisfierProperties property; + }; + }; #endif /* PACKAGING_DATA_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_RepositoryManager.idl b/CIAO/DAnCE/Deployment/Deployment_RepositoryManager.idl index d9201af0702..c0484094017 100644 --- a/CIAO/DAnCE/Deployment/Deployment_RepositoryManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_RepositoryManager.idl @@ -7,34 +7,41 @@ module Deployment { - exception NameExists { - }; + exception NameExists { + }; - exception PackageError { - string source; - string reason; - }; + exception PackageError { + string source; + string reason; + }; - interface RepositoryManager { - void installPackage (in string installationName, - in string location, - in boolean replace) - raises (NameExists, PackageError); - void createPackage (in string installationName, - in PackageConfiguration package, - in string baseLocation, - in boolean replace) - raises (NameExists, PackageError); - PackageConfiguration findPackageByName (in string name) - raises (NoSuchName); - PackageConfiguration findPackageByUUID (in string UUID) - raises (NoSuchName); - ::CORBA::StringSeq findNamesByType (in string type); - ::CORBA::StringSeq getAllNames (); - ::CORBA::StringSeq getAllTypes (); - void deletePackage (in string installationName) - raises (NoSuchName); - }; + interface RepositoryManager { + void installPackage ( in string installationName, + in string location, + in boolean replace) + raises (NameExists, PackageError); + + void createPackage (in string installationName, + in PackageConfiguration package, + in string baseLocation, + in boolean replace) + raises (NameExists, PackageError); + + PackageConfiguration findPackageByName (in string name) + raises (NoSuchName); + + PackageConfiguration findPackageByUUID (in string UUID) + raises (NoSuchName); + + ::CORBA::StringSeq findNamesByType (in string type); + + ::CORBA::StringSeq getAllNames (); + + ::CORBA::StringSeq getAllTypes (); + + void deletePackage (in string installationName) + raises (NoSuchName); + }; }; #endif /* REPOSITOR_MANAGER_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl b/CIAO/DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl index 8c1e9c29776..346c2626950 100644 --- a/CIAO/DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl @@ -8,34 +8,29 @@ module Deployment { - exception ResourceCommitmentFailure { - string reason; - long index; - string propertyName; - ::CORBA::AnySeq propertyValue; - }; - /** - * @struct ResourceAllocation - * @brief Identifies a resource within a domain that is - * allocated from and the amount it is allocated - */ - struct ResourceAllocation - { - string elementName; - string resourceName; - Properties property; - }; - - /// The Resource Allocation Sequence - typedef sequence <ResourceAllocation> ResourceAllocations; - - interface ResourceCommitmentManager { - void commitResources (in ResourceAllocations resources) - raises (ResourceCommitmentFailure); - void releaseResources (in ResourceAllocations resources) - raises (ResourceCommitmentFailure); - }; + struct ResourceAllocation { + string elementName; + string resourceName; + Properties property; + }; + + typedef sequence < ResourceAllocation > ResourceAllocations; + + exception ResourceCommitmentFailure { + string reason; + long index; + string propertyName; + ::CORBA::AnySeq propertyValue; + }; + + interface ResourceCommitmentManager { + void commitResources (in ResourceAllocations resources) + raises (ResourceCommitmentFailure); + void releaseResources (in ResourceAllocations resources) + raises (ResourceCommitmentFailure); + }; + }; +#endif //RESOURCE_COMMITMENT_MANAGER_IDL -#endif diff --git a/CIAO/DAnCE/Deployment/Deployment_TargetData.idl b/CIAO/DAnCE/Deployment/Deployment_TargetData.idl index 877600f93bf..f0ec9732afd 100644 --- a/CIAO/DAnCE/Deployment/Deployment_TargetData.idl +++ b/CIAO/DAnCE/Deployment/Deployment_TargetData.idl @@ -9,57 +9,61 @@ module Deployment { - struct Resource { - string name; - ::CORBA::StringSeq resourceType; - SatisfierProperties property; - }; + struct Resource { + string name; + ::CORBA::StringSeq resourceType; + SatisfierProperties property; + }; - typedef sequence < Resource > Resources; + typedef sequence < Resource > Resources; - struct SharedResource { - string name; - ::CORBA::StringSeq resourceType; - ::CORBA::ULongSeq nodeRef; - SatisfierProperties property; - }; - typedef sequence < SharedResource > SharedResources; + struct SharedResource { + string name; + ::CORBA::StringSeq resourceType; + ::CORBA::ULongSeq nodeRef; + SatisfierProperties property; + }; + + typedef sequence < SharedResource > SharedResources; - struct Node { - string name; - string label; - ::CORBA::ULongSeq sharedResourceRef; - ::CORBA::ULongSeq connectionRef; - Resources resource; - }; - typedef sequence < Node > Nodes; + struct Node { + string name; + string label; + ::CORBA::ULongSeq sharedResourceRef; + ::CORBA::ULongSeq connectionRef; + Resources resource; + }; - struct Interconnect { - string name; - string label; - ::CORBA::ULongSeq connectionRef; - ::CORBA::ULongSeq connectRef; - Resources resource; - }; - typedef sequence < Interconnect > Interconnects; + typedef sequence < Node > Nodes; - struct Bridge { - string name; - string label; - ::CORBA::ULongSeq connectRef; - Resources resource; - }; - typedef sequence < Bridge > Bridges; + struct Interconnect { + string name; + string label; + ::CORBA::ULongSeq connectionRef; + ::CORBA::ULongSeq connectRef; + Resources resource; + }; - struct Domain { - string UUID; - string label; - SharedResources sharedResource; - Nodes node; - Interconnects interconnect; - Bridges bridge; - Properties infoProperty; - }; + typedef sequence < Interconnect > Interconnects; + + struct Bridge { + string name; + string label; + ::CORBA::ULongSeq connectRef; + Resources resource; + }; + + typedef sequence < Bridge > Bridges; + + struct Domain { + string UUID; + string label; + SharedResources sharedResource; + Nodes node; + Interconnects interconnect; + Bridges bridge; + Properties infoProperty; + }; }; #endif /* DEPLOYMENT_TARGETDATA_IDL */ diff --git a/CIAO/DAnCE/Deployment/Deployment_TargetManager.idl b/CIAO/DAnCE/Deployment/Deployment_TargetManager.idl index 91a9c849099..d313227a352 100644 --- a/CIAO/DAnCE/Deployment/Deployment_TargetManager.idl +++ b/CIAO/DAnCE/Deployment/Deployment_TargetManager.idl @@ -11,34 +11,28 @@ #include "DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl" module Deployment { - - /// @todo, UpdateAvailable is not in the spec, must be UpdateDynamic enum DomainUpdateKind { Add, Delete, UpdateAll, - // @@changed UpdateDynamic }; - + interface TargetManager { + Domain getAllResources (); + Domain getAvailableResources (); - // @@changed - ResourceCommitmentManager createResourceCommitment (in ResourceAllocations resources) + //@! in DOCGroup renamed to createResourceCommitment + ResourceCommitmentManager commitResources (in ResourceAllocations resources) raises (ResourceCommitmentFailure); - - // @@added - void destroyResourceCommitment (in ResourceCommitmentManager manager); - /// @todo This is not part of 06-04-01 - // @@delete: - //void releaseResources (in DeploymentPlan argname); + void destroyResourceCommitment (in ResourceCommitmentManager manager); - void updateDomain (in ::CORBA::StringSeq elements, - in Domain domainSubset, - in DomainUpdateKind updateKind); + void updateDomain ( in ::CORBA::StringSeq elements, + in Domain domainSubset, + in DomainUpdateKind updateKind); }; }; diff --git a/CIAO/DAnCE/Deployment/Deployment_common.h b/CIAO/DAnCE/Deployment/Deployment_common.h index 730bd235f6f..dfd44797069 100644 --- a/CIAO/DAnCE/Deployment/Deployment_common.h +++ b/CIAO/DAnCE/Deployment/Deployment_common.h @@ -14,6 +14,9 @@ #include /**/ "ace/pre.h" #include "ace/config-all.h" +#include "ace/Hash_Map_Manager_T.h" +#include "tao/AnyTypeCode/Any.h" +#include "Deployment/Deployment_ConnectionC.h" #if !defined ACE_LACKS_PRAGMA_ONCE #pragma once @@ -21,8 +24,14 @@ /// A struct which captures the binding information about a component -namespace CIAO +namespace DAnCE { + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + CORBA::Any, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> PROPERTY_MAP; + /// A struct which captures the compnent binding information, which /// is useful for inter-assembly connection setup typedef struct _component_binding @@ -38,7 +47,7 @@ namespace CIAO Deployment::Connections_var providedReference_; - bool operator==(const struct _component_binding & comp) const + bool operator==(const struct _component_binding & comp) { if (this->name_ == comp.name_ && this->plan_uuid_ == comp.plan_uuid_ && diff --git a/CIAO/DAnCE/Deployment/Module_Main.h b/CIAO/DAnCE/Deployment/Module_Main.h new file mode 100644 index 00000000000..cba4ba4d5e3 --- /dev/null +++ b/CIAO/DAnCE/Deployment/Module_Main.h @@ -0,0 +1,94 @@ +// $Id$ +/** + * @file Module_Main.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * Provides a generic main function used by individual modules. + */ + +#ifndef DANCE_MODULE_MAIN_H_ +#define DANCE_MODULE_MAIN_H_ + +#include "ace/Auto_Ptr.h" +#include "ace/Dynamic_Service.h" +#include "tao/Object.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "DAnCE/Logger/Logger_Service.h" + +#ifndef DANCE_MODULE_MAIN_CLASS_NAME +#error Module_Main.h used without DANCE_MODULE_MAIN_CLASS_NAME defined. +#endif + +//#ifndef DANCE_MODULE_MAIN_INCLUDE_NAME +//#error Module_Main.h used without DANCE_MODULE_MAIN_INCLUDE_NAME defined. +//#endif + +//#include DANCE_MODULE_MAIN_INCLUDE_NAME + +using namespace DAnCE; + +int +ACE_TMAIN (int argc, ACE_TCHAR **argv) +{ + DANCE_DISABLE_TRACE (); + + auto_ptr<Logger_Service> logger; + + try + { + Logger_Service + * dlf = ACE_Dynamic_Service<Logger_Service>::instance ("DAnCE_Logger_Backend_Factory"); + + if (!dlf) + { + dlf = new Logger_Service; + logger.reset (dlf); + } + + dlf->init (argc, argv); + + DANCE_DEBUG ((LM_TRACE, DLINFO + "Module_main.h - initializing ORB\n")); + + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + ACE_Log_Msg_Backend * backend = dlf->get_logger_backend(orb); + + if (backend != 0) + { + backend->open(0); + ACE_Log_Msg::msg_backend (backend); + ACE_Log_Msg * ace = ACE_Log_Msg::instance(); + ace->clr_flags(ace->flags()); + ace->set_flags(ACE_Log_Msg::CUSTOM); + } + + DANCE_DEBUG ((LM_TRACE, DLINFO + "Module_Main.h - initializing module instance")); + DANCE_MODULE_MAIN_CLASS_NAME module_instance; + + CORBA::Object_var obj = module_instance.create_object (orb.in (), + argc, + argv); +#ifndef DANCE_MODULE_MAIN_SKIP_ORB_RUN + if (!CORBA::is_nil (obj.in ())) + orb->run (); + else + DANCE_ERROR ((LM_ERROR, DLINFO "Module_Main.h - " + "Got nil object reference from Module\n")); + + DANCE_DEBUG ((LM_TRACE, DLINFO + "Module_Main.h - ORB event loop finished, exiting.\n")); + + orb->destroy (); +#endif + } + catch (...) + { + return -1; + } + + return 0; +} + +#endif diff --git a/CIAO/DAnCE/Deployment/NodeApp_CB_Impl.cpp b/CIAO/DAnCE/Deployment/NodeApp_CB_Impl.cpp deleted file mode 100644 index af7fc329959..00000000000 --- a/CIAO/DAnCE/Deployment/NodeApp_CB_Impl.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// $Id$ - -#include "NodeApp_CB_Impl.h" - -CIAO::NodeApplication_Callback_Impl:: -NodeApplication_Callback_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - Deployment::NodeApplicationManager_ptr s, - const Deployment::Properties &properties, - ACE_Condition<TAO_SYNCH_MUTEX> &wait, - TAO_SYNCH_MUTEX& mutex) - : is_callback_completed_ (false), - orb_ (CORBA::ORB::_duplicate (o)), - poa_ (PortableServer::POA::_duplicate (p)), - nam_ (Deployment::NodeApplicationManager::_duplicate (s)), - waitCond_ (wait), - mutex_ (mutex) -{ - try - { - //@@ Note: this properties is useless unless - // we have some specific properties for the callback obj. - Deployment::Properties * tmp = 0; - ACE_NEW_THROW_EX (tmp, - Deployment::Properties (properties), - CORBA::NO_MEMORY ()); - this->properties_ = tmp; - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("NodeApp_CB_Impl::Constructor\t\n"); - throw; - } -} - -CIAO::NodeApplication_Callback_Impl::~NodeApplication_Callback_Impl () -{ -} - -PortableServer::POA_ptr -CIAO::NodeApplication_Callback_Impl::_default_POA (void) -{ - return PortableServer::POA::_duplicate (this->poa_.in ()); -} - -Deployment::NodeApplicationManager_ptr -CIAO::NodeApplication_Callback_Impl::register_node_application ( - Deployment::NodeApplication_ptr na, - Deployment::Properties_out properties) -{ - this->is_callback_completed_ = true; - properties = this->properties_._retn (); - - this->nodeapp_ = Deployment::NodeApplication::_duplicate (na); - - this->waitCond_.signal (); - return Deployment::NodeApplicationManager::_duplicate (this->nam_.in ()); -} - -Deployment::NodeApplication_ptr -CIAO::NodeApplication_Callback_Impl::get_nodeapp_ref (void) -{ - // @@ (OO) How are you relinquishing ownership here? Since you're - // duplicating the reference you actually maintain - // ownership. Is the below comment wrong, or is the code - // wrong? - - // Relinquish the ownership of the nodeapplication reference. - //This method should only be called from the NodeApplicationManager. - return Deployment::NodeApplication::_duplicate (this->nodeapp_.in ()); -} - -bool -CIAO::NodeApplication_Callback_Impl::is_callback_completed () -{ - return this->is_callback_completed_; -} diff --git a/CIAO/DAnCE/Deployment/NodeApp_CB_Impl.h b/CIAO/DAnCE/Deployment/NodeApp_CB_Impl.h deleted file mode 100644 index 68a61d3616e..00000000000 --- a/CIAO/DAnCE/Deployment/NodeApp_CB_Impl.h +++ /dev/null @@ -1,86 +0,0 @@ -// -*- C++ -*- -// $Id$ -//============================================================================= -/** - * @file NodeApp_CB_Impl.h - * - * @author Nanbor Wang <nanbor@cs.wustl.edu> - * Tao Lu <lu@dre.vanderbilt.edu> - * - //===========================================================================*/ - - -#ifndef NODEAPPLICATION_CALLBACK_IMPL_H -#define NODEAPPLICATION_CALLBACK_IMPL_H -#include /**/ "ace/pre.h" -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "CIAO_NodeApplication_CallBackS.h" -#include "ace/Synch.h" - -namespace CIAO -{ - /** - * @class NodeApplication_Callback_Impl - * - * @brief A call back interface for NodeApplication - * @Note Here is no need to be thread safe since for every nodeapplication - * we will have an unique callback object. --Tao - */ - class Deployment_svnt_Export NodeApplication_Callback_Impl - : public virtual POA_CIAO::NodeApplication_Callback - { - public: - friend class NodeApplicationManager_Impl; - - /// Constructor. - NodeApplication_Callback_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - Deployment::NodeApplicationManager_ptr s, - const Deployment::Properties &properties, - ACE_Condition<TAO_SYNCH_MUTEX> &wait, - TAO_SYNCH_MUTEX& mutex); - - /// Get the containing POA. This operation does *not* increase - /// the reference count of the POA. - virtual PortableServer::POA_ptr _default_POA (void); - - /// Record the NodeApplication reference returned by the newly - /// spawned NodeApplication and give it back a reference to - /// NodeApplicationManager - Deployment::NodeApplicationManager_ptr - register_node_application (Deployment::NodeApplication_ptr na, - Deployment::Properties_out properties); - - Deployment::NodeApplication_ptr get_nodeapp_ref (void); - - bool is_callback_completed (void); - - protected: - /// Destructor. - ~NodeApplication_Callback_Impl (); - - bool is_callback_completed_; - - CORBA::ORB_var orb_; - - PortableServer::POA_var poa_; - - Deployment::NodeApplicationManager_var nam_; - - Deployment::NodeApplication_var nodeapp_; - - Deployment::Properties_var properties_; - - ACE_Condition<TAO_SYNCH_MUTEX> &waitCond_; - - TAO_SYNCH_MUTEX &mutex_; - }; -} - -#include /**/ "ace/post.h" -#endif /* NODEAPPLICATION_CALLBACK_IMPL_H */ diff --git a/CIAO/DAnCE/DomainApplication/DomainApplication.mpc b/CIAO/DAnCE/DomainApplication/DomainApplication.mpc new file mode 100644 index 00000000000..03946ef98aa --- /dev/null +++ b/CIAO/DAnCE/DomainApplication/DomainApplication.mpc @@ -0,0 +1,13 @@ +// -*- MPC -*- +// $Id$ + + +project: dance_lib, taolib, tao_output, dance_deployment_stub, dance_deployment_svnt, dance_logger { + sharedname = DAnCE_DomainApplication + dynamicflags = DOMAIN_APPLICATION_BUILD_DLL + + Source_Files { + Domain_Application_Impl.cpp + } +} + diff --git a/CIAO/DAnCE/DomainApplication/Domain_Application_Export.h b/CIAO/DAnCE/DomainApplication/Domain_Application_Export.h new file mode 100644 index 00000000000..fe9b0133ebb --- /dev/null +++ b/CIAO/DAnCE/DomainApplication/Domain_Application_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl Domain_Application +// ------------------------------ +#ifndef DOMAIN_APPLICATION_EXPORT_H +#define DOMAIN_APPLICATION_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DOMAIN_APPLICATION_HAS_DLL) +# define DOMAIN_APPLICATION_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DOMAIN_APPLICATION_HAS_DLL */ + +#if !defined (DOMAIN_APPLICATION_HAS_DLL) +# define DOMAIN_APPLICATION_HAS_DLL 1 +#endif /* ! DOMAIN_APPLICATION_HAS_DLL */ + +#if defined (DOMAIN_APPLICATION_HAS_DLL) && (DOMAIN_APPLICATION_HAS_DLL == 1) +# if defined (DOMAIN_APPLICATION_BUILD_DLL) +# define Domain_Application_Export ACE_Proper_Export_Flag +# define DOMAIN_APPLICATION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DOMAIN_APPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DOMAIN_APPLICATION_BUILD_DLL */ +# define Domain_Application_Export ACE_Proper_Import_Flag +# define DOMAIN_APPLICATION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DOMAIN_APPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DOMAIN_APPLICATION_BUILD_DLL */ +#else /* DOMAIN_APPLICATION_HAS_DLL == 1 */ +# define Domain_Application_Export +# define DOMAIN_APPLICATION_SINGLETON_DECLARATION(T) +# define DOMAIN_APPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DOMAIN_APPLICATION_HAS_DLL == 1 */ + +// Set DOMAIN_APPLICATION_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DOMAIN_APPLICATION_NTRACE) +# if (ACE_NTRACE == 1) +# define DOMAIN_APPLICATION_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DOMAIN_APPLICATION_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DOMAIN_APPLICATION_NTRACE */ + +#if (DOMAIN_APPLICATION_NTRACE == 1) +# define DOMAIN_APPLICATION_TRACE(X) +#else /* (DOMAIN_APPLICATION_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DOMAIN_APPLICATION_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DOMAIN_APPLICATION_NTRACE == 1) */ + +#endif /* DOMAIN_APPLICATION_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.cpp b/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.cpp new file mode 100644 index 00000000000..47cabb79cba --- /dev/null +++ b/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.cpp @@ -0,0 +1,118 @@ +// $Id$ + +#include "Domain_Application_Impl.h" +#include "ace/Log_Msg.h" +#include "ace/streams.h" +#include "DAnCE/Logger/Log_Macros.h" + +namespace DAnCE +{ + + DomainApplication_Impl::DomainApplication_Impl ( + TNam2Nm & nams, + const Deployment::Properties & configProperty, + Deployment::Connections& conn) + : nams_ (nams) + { + DANCE_TRACE("DomainApplication_Impl::DomainApplication_Impl"); + this->startLaunch (configProperty); + conn = this->connections_; + } + + DomainApplication_Impl::~DomainApplication_Impl() + { + DANCE_TRACE ("DomainApplication_Impl::~DomainApplication_Impl()"); + + try + { + for (TApp2Mgr::iterator iter = this->node_applications_.begin(); + iter != this->node_applications_.end(); + ++iter) + { + (*iter).int_id_->destroyApplication ( (*iter).ext_id_.in()); + } + this->node_applications_.unbind_all(); + } + catch (CORBA::Exception &e) + { + DANCE_ERROR((LM_ERROR, DLINFO + "DomainApplication_Impl::~DomainApplication_Impl - " + "caught a CORBA exception %C(%C) \"%C\"\n", + e._name(), e._rep_id(), e._info().c_str())); + } + catch(...) + { + DANCE_ERROR((LM_ERROR, DLINFO "DomainApplication_Impl::~DomainApplication_Impl - " + "caught an unknown exception.\n")); + } + } + + void + DomainApplication_Impl::finishLaunch (const Deployment::Connections & connections, + CORBA::Boolean start) + { + DANCE_TRACE ("DomainApplication_Impl::finishLaunch"); + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplication_impl::finishLaunch - " + "connections length is %d\n", connections.length())); + for (TApp2Mgr::iterator iter = this->node_applications_.begin(); + iter != this->node_applications_.end(); + ++iter) + { + (*iter).ext_id_->finishLaunch (connections, start); + } + } + + void + DomainApplication_Impl::start () + { + DANCE_TRACE ("DomainApplication_Impl::start"); + for (TApp2Mgr::iterator iter = this->node_applications_.begin(); + iter != this->node_applications_.end(); + ++iter) + { + (*iter).ext_id_->start (); + } + } + + void + DomainApplication_Impl::startLaunch (const Deployment::Properties & configProperty) + { + DANCE_TRACE ("DomainApplication_Impl::startLaunch"); + + for (TNam2Nm::iterator iter = this->nams_.begin(); + iter != this->nams_.end(); + ++iter) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplication_Impl::startLaunch - " + "Invoking startLaunch on an application\n")); + ::Deployment::Connections_var conn; + Deployment::Application_ptr na = (*iter).ext_id_->startLaunch (configProperty, conn.out()); + //Deployment::NodeApplication_ptr na = Deployment::NodeApplication::_narrow (a); + if (CORBA::is_nil (na)) + { + DANCE_ERROR ((LM_ERROR, DLINFO + "DomainApplication_Impl::startLaunch -" + "Received nil object reference from startLaunch on node managers.\n")); + throw Deployment::StartError(); + } + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplication_Impl::startLaunch - " + "Application startLaunch succeeded, received %u connections \n", + conn->length ())); + + this->node_applications_.bind (na, (*iter).ext_id_); + + size_t before = this->connections_.length(); + this->connections_.length (before + conn->length()); + for (size_t i = 0; i < conn->length(); ++i) + { + this->connections_[before+i] = (*conn) [i]; + } + } + + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplication_Impl::startLaunch - " + "Received %u connections from applications\n", + this->connections_.length ())); + } + +} // DAnCE + diff --git a/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.h b/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.h new file mode 100644 index 00000000000..f03972c983a --- /dev/null +++ b/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.h @@ -0,0 +1,80 @@ +/**======================================================== + * + * @file DomainApplication_Impl_Impl.h + * + * @Brief This file contains the implementation of + * the DomainApplication interface. + * + * @author Vinzenz Tornow <vt@prismtech.com> + *========================================================*/ + +#ifndef DOMAIN_APPLICATION_H +#define DOMAIN_APPLICATION_H +#include /**/ "ace/pre.h" + +#include "Domain_Application_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Deployment/Deployment_DomainApplicationS.h" +#include "ace/Map_Manager.h" +#include "Deployment/Deployment_NodeApplicationC.h" +#include "Deployment/Deployment_NodeApplicationManagerC.h" +#include "Deployment/Deployment_NodeManagerC.h" + +namespace DAnCE + { + + /** + * + * @class DomainApplication_Impl + * + * @brief This class implements the DomainApplication interface. + * + **/ + class Domain_Application_Export DomainApplication_Impl + : public virtual POA_Deployment::DomainApplication + { + public: + typedef ACE_Map_Manager < Deployment::NodeApplicationManager_var, + Deployment::NodeManager_var, + ACE_Null_Mutex > TNam2Nm; + typedef ACE_Map_Manager < Deployment::Application_var, + Deployment::NodeApplicationManager_var, + ACE_Null_Mutex > TApp2Mgr; + + DomainApplication_Impl (TNam2Nm& nams, + const Deployment::Properties & configProperty, + Deployment::Connections& conn); + ~DomainApplication_Impl(); + + /** + * The second step in launching an application in the + * domain-level. If the start parameter is true, the application + * is started as well. Raises the StartError exception if + * launching or starting the application fails. + */ + virtual void + finishLaunch (const Deployment::Connections & connections, + CORBA::Boolean start); + /** + * Starts the application. Raises the StartError exception if + * starting the application fails. + */ + virtual void start (); + + private: + TApp2Mgr node_applications_; + Deployment::Connections connections_; + TNam2Nm & nams_; + Deployment::Application_var na_; + void startLaunch (const Deployment::Properties & configProperty); + }; +}; // DAnCE + +#include /**/ "ace/post.h" +#endif // DOMAIN_APPLICATION_H + + diff --git a/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp b/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp deleted file mode 100644 index 2a9d162f158..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp +++ /dev/null @@ -1,182 +0,0 @@ -// $Id$ - -#include "Deployment_Configuration.h" -#include "ciao/CIAO_common.h" - -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" -#include "ace/Read_Buffer.h" - -CIAO::Deployment_Configuration::Deployment_Configuration (CORBA::ORB_ptr o) - : orb_ (CORBA::ORB::_duplicate (o)) -{ -} - -CIAO::Deployment_Configuration::~Deployment_Configuration (void) -{ - this->deployment_info_.unbind_all (); -} - -int -CIAO::Deployment_Configuration::init (const char *filename) -{ - if (filename == 0) - { - ACE_ERROR ((LM_ERROR, "DANCE (%P|%t) Deployment_Configuration.cpp" - ": Unable to identify the file name \n")); - return -1; - } - - FILE *inf = ACE_OS::fopen (filename, "r"); - - if (inf == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "DAnCE (%P|%t) Deployment_Configuration.cpp:" - "Fail to open node manager map data file: <%s>\n", - filename), - -1); - } - - // Get a read buffer, this will close the stream when we are ready - ACE_Read_Buffer reader (inf, true); - - bool first = true; - char* string = 0; - - // Read from the file line by line - while ((string = reader.read ('\n')) != 0) - { - // Search from the right to the first space - const char* ior_start = ACE_OS::strrchr (string, ' '); - // Search from the left to the first space - const char* dest_end = ACE_OS::strchr (string, ' '); - // The destination is first followed by some spaces - ACE_CString destination (string, dest_end - string); - // And then the IOR - - ACE_CString ior (ior_start + 1, ACE_OS::strlen (ior_start + 1)); - int const result = - this->deployment_info_.bind (destination.c_str (), ior.c_str ()); - if (result == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "DAnCE (%P|%t) Deployment_Configuration, " - "failed to bind destination <%s>\n", - destination.c_str ()), - -1); - } - else if (result == 1) - { - if (CIAO::debug_level () > 5) - { - ACE_DEBUG ((LM_DEBUG, - "DAnCE (%P|%t) Deployment_Configuration.cpp, " - "reuse existing node in the cached map: <%s>\n" , - destination.c_str ())); - } - } - else - { - if (CIAO::debug_level () > 5) - { - ACE_DEBUG ((LM_DEBUG, - "DAnCE (%P|%t) Deployment_Configuration, " - "bind <%s> <%s>\n", destination.c_str (), ior.c_str ())); - } - } - - if (first) - { - this->default_node_manager_.IOR_ = ior; - first = false; - } - } - - return 0; -} - -const char * -CIAO::Deployment_Configuration::get_node_manager_ior (const char *name) const -{ - if (name == 0) - return this->get_default_node_manager_ior (); - - ACE_Hash_Map_Entry - <ACE_CString, CIAO::Deployment_Configuration::Node_Manager_Info> *entry = 0; - - if (this->deployment_info_.find (ACE_CString (name), entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) Deployment_Configuration, " - "get_node_manager_ior, failed to find IOR for destination <%s>\n", - name)); - return 0; - } - - return entry->int_id_.IOR_.c_str (); -} - -const char * -CIAO::Deployment_Configuration::get_default_node_manager_ior (void) const -{ - if (this->default_node_manager_.IOR_.length () == 0) - return 0; - return this->default_node_manager_.IOR_.c_str (); -} - -::Deployment::NodeManager_ptr -CIAO::Deployment_Configuration::get_node_manager (const char *name) -{ - if (name == 0) - return get_default_node_manager (); - - ACE_Hash_Map_Entry - <ACE_CString, - CIAO::Deployment_Configuration::Node_Manager_Info> *entry = 0; - - if (this->deployment_info_.find (ACE_CString (name), - entry) != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "DAnCE (%P|%t) Deployment_Configuration.cpp:" - "Failed to find IOR for destination <%s>\n", - name), - 0); - } - - if (CORBA::is_nil (entry->int_id_.node_manager_.in ())) - { - try - { - CORBA::Object_var temp = this->orb_->string_to_object - (entry->int_id_.IOR_.c_str ()); - - entry->int_id_.node_manager_ = - ::Deployment::NodeManager::_narrow (temp.in ()); - } - catch (const CORBA::Exception&) - { - ACE_ERROR ((LM_ERROR, "DANCE (%P|%t) Deployment_Configuration.cpp: " - "Error while contacting NodeManager %s\n", name)); - throw; - } - } - return ::Deployment::NodeManager::_duplicate - (entry->int_id_.node_manager_.in ()); -} - -::Deployment::NodeManager_ptr -CIAO::Deployment_Configuration::get_default_node_manager () -{ - if (CORBA::is_nil (this->default_node_manager_.node_manager_.in ())) - { - CORBA::Object_var temp = this->orb_->string_to_object - (this->default_node_manager_.IOR_.c_str ()); - - this->default_node_manager_.node_manager_ = - ::Deployment::NodeManager::_narrow (temp.in ()); - } - return ::Deployment::NodeManager::_duplicate - (this->default_node_manager_.node_manager_.in ()); -} diff --git a/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.h b/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.h deleted file mode 100644 index cd6d13b9f0c..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.h +++ /dev/null @@ -1,128 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Deployment_Configuration.h - * - * $Id$ - * - * The Deployment_Configuration provides abstraction for the - * deployment mechanisms. - * - * @author Nanbor Wang <nanbor@cs.wustl.edu> - * @author Gan Deng <gan.deng@vanderbilt.edu> - */ -//============================================================================= -#ifndef CIAO_DEPLOYMENT_CONFIGURATION_H -#define CIAO_DEPLOYMENT_CONFIGURATION_H -#include /**/ "ace/pre.h" - -#include "ace/Hash_Map_Manager_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DAnCE/Deployment/Deployment_NodeManagerC.h" -#include "tao/Valuetype/ValueBase.h" -#include "tao/Valuetype/Valuetype_Adapter_Impl.h" -#include "ace/SString.h" - -#include "DomainApplicationManager/DomainApplicationManager_Export.h" - -namespace CIAO -{ - /** - * @class Deployment_Configuration - * - * @brief A class that provides strategies on deployment topology. - * - * This class provides strategies on how the DomainApplicationManager - * should deploy an deployment plan at domain-level. This is achieved - * by providing mappings from deployment destination names to actually - * NodeManager daemon IORs, and the strategy for which default NodeManager - * daemons a deployment mechanism should use. - * - * This is a trivial implementation of the deployment configuration - * strategy. We can enhance this class later on to provide - * different deployment location strategies, such as naming service. - */ - class DomainApplicationManager_Export Deployment_Configuration - { - public: - typedef struct _node_manager_info - { - _node_manager_info (const char *ior = 0) - { - IOR_ = ior; - } - - ACE_CString IOR_; - ::Deployment::NodeManager_var node_manager_; - } Node_Manager_Info; - - Deployment_Configuration (CORBA::ORB_ptr o); - - /// Destructor - ~Deployment_Configuration (void); - - /** - * Init method takes the filename to a configuration file which - * has a simple line format of name, ior string delimited by a - * space in each line. - * - * name IOR-string - * - * @retval 0 on success. - * @retval -1 otherwise. - */ - int init (const char *filename); - - /** - * @retval 0 if no valid name were found. When @c name = 0, then - * this function behave exactly as get_default_activator_ior. - */ - const char *get_node_manager_ior (const char *name) const; - - /** - * Return the default NodeManager the DomainApplicationManager - * should use to deploy a component. In this implementation, the - * first entry in the deployment configuration data file is always - * the entry for default activator. - * - * @retval 0 if no valid daemon is configured. - */ - const char *get_default_node_manager_ior () const; - - /** - * @retval nil if no valid name were found. - */ - ::Deployment::NodeManager_ptr - get_node_manager (const char *name); - - /** - * Return the reference to the default NodeManager the - * DomainApplicationManager should use to deploy a node-level - * deployment plan.. - * - * @retval nil if no valid daemon is configured. - */ - ::Deployment::NodeManager_ptr - get_default_node_manager (); - - protected: - CORBA::ORB_var orb_; - - ACE_Hash_Map_Manager_Ex<ACE_CString, - Node_Manager_Info, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> deployment_info_; - - Node_Manager_Info default_node_manager_; - }; - -} - -#include /**/ "ace/post.h" -#endif /* CIAO_DEPLOYMENT_CONFIGURATION_H */ diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager.mpc b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager.mpc index 5db236de1e5..86d2cbab3ab 100644 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager.mpc +++ b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager.mpc @@ -1,31 +1,19 @@ // -*- MPC -*- // $Id$ -project (DomainApplicationManager): ciao_deployment_svnt, naming, ace_output { - sharedname = DomainApplicationManager - after += ExecutionManager_stub - - dynamicflags = DOMAINAPPLICATIONMANAGER_BUILD_DLL - +project : dance_lib, taolib, tao_output, dance_domain_application, naming { + sharedname = DAnCE_DomainApplicationManager + dynamicflags = DOMAINAPPLICATIONMANAGER_BUILD_DLL + Source_Files { DomainApplicationManager_Impl.cpp - DomainApplicationManager_AMI_Impl.cpp - DomainApplicationManager_AMH_Impl.cpp - DomainApplicationManager_ActiveObject_Impl.cpp - Deployment_Configuration.cpp - Reply_Handler_i.cpp - Task_StartLaunch.cpp + Node_Locator.cpp } Header_Files { + Node_Locator.h DomainApplicationManager_Impl.h - DomainApplicationManager_AMI_Impl.h - DomainApplicationManager_AMH_Impl.h - DomainApplicationManager_ActiveObject_Impl.h - Deployment_Configuration.h DomainApplicationManager_Export.h - Reply_Handler_i.h - Task_StartLaunch.h } } diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.cpp b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.cpp deleted file mode 100644 index 33b30a4cea6..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.cpp +++ /dev/null @@ -1,1965 +0,0 @@ -// $Id$ - -#include "DomainApplicationManager_AMH_Impl.h" -#include "ExecutionManager/Execution_Manager_Impl.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationManagerC.h" -#include "ace/Null_Mutex.h" -#include "ace/OS_NS_string.h" -#include "ace/SString.h" -#include "ace/Assert.h" - -#if !defined (__ACE_INLINE__) -# include "DomainApplicationManager_AMH_Impl.inl" -#endif /* __ACE_INLINE__ */ - -CIAO::DomainApplicationManager_AMH_Impl:: -DomainApplicationManager_AMH_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl * em, - const Deployment::DeploymentPlan & plan, - const char * deployment_file) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - execution_manager_ (em), // a plain C++ pointer - target_manager_ (Deployment::TargetManager::_duplicate (manager)), // object ref - plan_ (plan), - num_child_plans_ (0), - // @@ (OO) The default size for an ACE_Hash_Map_Mapanger is quiet - // large. The maximum size of an ACE_Hash_Map_Manager is - // also fixed, i.e. it does not grow dynamically on demand. - // Make sure the default size of artifact_map_ is - // appropriate for your needs. You may also want to make - // the size configurable at compile-time, at least. - // - // Need to initialize chained artifacts here. - // - deployment_file_ (CORBA::string_dup (deployment_file)), - deployment_config_ (orb), - uuid_ (plan.UUID), - is_redeployment_ (false), - esd_ (0) -{ - ACE_NEW_THROW_EX (this->all_connections_, - Deployment::Connections (), - CORBA::NO_MEMORY ()); - - ACE_NEW_THROW_EX (this->shared_, - Deployment::ComponentPlans (), - CORBA::NO_MEMORY ()); - - ACE_NEW_THROW_EX (this->esd_, - CIAO::DAnCE::EventServiceDeploymentDescriptions (), - CORBA::NO_MEMORY ()); - - for (CORBA::ULong i = 0; i < this->plan_.infoProperty.length (); ++i) - { - if (ACE_OS::strcmp (this->plan_.infoProperty[i].name.in (), - "CIAOEvents") != 0) - continue; - - // Note, we should do a sanity check here to make - // sure we didn't pick up the wrong infoProperty!! - this->plan_.infoProperty[0].value >>= this->esd_; - break; - } - - this->init (); -} - -CIAO::DomainApplicationManager_AMH_Impl::~DomainApplicationManager_AMH_Impl () -{ - if (CIAO::debug_level () > 1) - { - ACE_DEBUG ((LM_DEBUG, "DomainApplicationManager destroyed\n")); - } -} - -void -CIAO::DomainApplicationManager_AMH_Impl::get_node_app ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const char * node_name) -{ - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (node_name, entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::get_node_app -" - "ERROR while finding the node application " - "for the node [%s] \n", - node_name)); - throw Deployment::NoSuchName (); - } - - _tao_rh->get_node_app ( - Deployment::NodeApplication::_duplicate ( - entry->int_id_.node_application_.in ())); -} - -void -CIAO::DomainApplicationManager_AMH_Impl::init () -{ - try - { - // (1) Call get_plan_info() method to get the total number - // of child plans and list of NodeManager names, and - // (2) Check the validity of the global deployment plan. - if (! this->get_plan_info ()) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::init -" - "ERROR while calling get_plan_info () \n")); - throw Deployment::PlanError (); - } - - // Call split_plan() - if (! this->split_plan ()) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::init -" - "ERROR while calling split_plan () \n")); - throw Deployment::PlanError (); - } - - // Invoke preparePlan on each NodeManager by giving child plan. - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeManager object reference. - ::Deployment::NodeManager_var my_node_manager = - this->deployment_config_.get_node_manager - (this->node_manager_names_[i].c_str ()); - - // Get the child deployment plan reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::init -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - throw Deployment::PlanError (); - } - - Chained_Artifacts & artifacts = entry->int_id_; - - // Call preparePlan() method on the NodeManager with the - // corresponding child plan as input, which returns a - // NodeApplicationManager object reference. - Deployment::ApplicationManager_var tmp_app_manager = - my_node_manager->preparePlan (artifacts.child_plan_.in ()); - - Deployment::NodeApplicationManager_var app_manager = - Deployment::NodeApplicationManager::_narrow - (tmp_app_manager.in ()); - - if (CORBA::is_nil (app_manager.in ())) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::init -" - "ERROR while narroing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error ("DomainAppMgr::init () received a nil \ - reference for NodeApplicationManager\n"); - - ACE_DEBUG ((LM_DEBUG, error.c_str ())); - throw - (Deployment::StartError ("DomainApplicationManager_AMH_Impl:init", - error.c_str ())); - } - - // Cache the NodeApplicationManager object reference. - artifacts.node_application_manager_ = app_manager._retn (); - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("DomainApplicationManager_AMH_Impl::init\t\n"); - throw; - } -} - -bool -CIAO::DomainApplicationManager_AMH_Impl::get_plan_info (void) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::get_plan_info"); - - // Read the deployment.dat file and get to know the different nodes - // that are present in the deployment domain. - // We should be able to replace this way, by parsing the domain - // descriptor to get to know more on the domain. - // - if ( this->deployment_config_.init (this->deployment_file_) == -1 ) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::get_plan_info -" - "ERROR while trying to initialize after reading " - "deployment DAT file \n")); - return 0; - } - - // Error: If there are no nodes in the plan => No nodes to deploy the - // components - CORBA::ULong const length = this->plan_.instance.length (); - - if (length == 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::get_plan_info -" - "ERROR while trying to get the total instances to " - "be deployed \n")); - return false; - } - - // Copy the name of the node in the plan on to the node manager - // array, Making sure that duplicates are not added. - // - // OPTIMIZATION: - // We can parse the domain descriptor and the size of the node - // data structure is the size of the num_plans and - // the individual node names need to be entered into the - // node_manager_map. - // - int num_plans = 0; - this->node_manager_names_.clear (); - - for (CORBA::ULong index = 0; index < length; index ++) - { - bool matched = false; - - const CORBA::ULong number_node_managers = - this->node_manager_names_.size (); - - for (CORBA::ULong i = 0; i < number_node_managers; ++i) - // If a match is found do not add it to the list of unique - // node names - if (ACE_OS::strcmp (this->plan_.instance [index].node.in (), - (this->node_manager_names_ [i]).c_str ()) == 0) - { - // Break out -- Duplicates found - matched = true; - break; - } - - if (! matched) - { - // Check if there is a corresponding NodeManager instance existing - // If not present return false - ::Deployment::NodeManager_var mgr = - this->deployment_config_.get_node_manager - (this->plan_.instance [index].node.in ()); - - if (CORBA::is_nil (mgr.in ())) - return false; /* Failure */ - - // Add this unique node_name to the list of NodeManager names - this->node_manager_names_.push_back (this->plan_.instance [index].node.in ()); - - // Increment the number of plans - ++num_plans; - } - } - - // Set the length of the Node Managers - // - // why cannot we use the provate variable in the above "for" loop? - // - this->num_child_plans_ = num_plans; - - // Indicate success - return true; -} - -//@@ We should ask those spec writers to look at the code below, hopefully -// They will realize some thing. -int -CIAO::DomainApplicationManager_AMH_Impl::split_plan (void) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::split_plan"); - - // Initialize the total number of child deployment plans specified - // by the global plan. - CORBA::ULong i; - - for ( i = 0; i < this->num_child_plans_; ++i) - { - ::Deployment::DeploymentPlan_var tmp_plan; - ACE_NEW_RETURN (tmp_plan, - ::Deployment::DeploymentPlan, - 0); - - // Construct the UUID for the child plan. - // Currently, this UUID consists of: - // The global UUID for the parent plan + the name of the node the - // child plan is to be installed on. - ACE_CString child_uuid (this->plan_.UUID.in ()); - child_uuid += "@"; - child_uuid += this->node_manager_names_[i]; - - tmp_plan->UUID = CORBA::string_dup (child_uuid.c_str ()); - tmp_plan->implementation.length (0); - tmp_plan->instance.length (0); - tmp_plan->connection.length (0); - tmp_plan->externalProperty.length (0); - tmp_plan->dependsOn.length (0); - tmp_plan->artifact.length (0); - - // @@ There is an optimization point here, since we really don't have to - // pass the entire CIAOServerResources into each individual child plan. - tmp_plan->infoProperty = this->plan_.infoProperty; - - //tmp_plan->infoProperty[0].name = CORBA::string_dup ("CIAOServerResource"); - //tmp_plan->infoProperty[0].value = this->plan_.infoProperty[0].value; - - Chained_Artifacts artifacts; - - // Fill in the child_plan_ field, relinquishing ownership - artifacts.child_plan_ = tmp_plan._retn (); - - // Fill in the node_manager_ field. - artifacts.node_manager_ = - this->deployment_config_.get_node_manager - (this->node_manager_names_[i].c_str ()); - - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find - (node_manager_names_[i], entry) == 0) - artifacts.old_child_plan_ = (entry->int_id_).child_plan_; - else - artifacts.old_child_plan_ = 0; - - // In case we are doing redeployment, rebind will help replace the - // old child plan with the new child plan. - this->artifact_map_.rebind (node_manager_names_[i], artifacts); - } - - // (1) Iterate over the <instance> field of the global DeploymentPlan - // structure. - // (2) Retrieve the necessary information to contruct the node-level - // plans one by one. - for ( i = 0; i < (this->plan_.instance).length (); ++i) - { - // @@TODO Fill in the child deployment plan in the map. - // If the component instance already exists in the child plan, - // then we overwrite the existing instance, since the new instance - // might have different resource usage requirements. - - - - // Get the instance deployment description - const ::Deployment::InstanceDeploymentDescription & my_instance = - (this->plan_.instance)[i]; - - // Find the corresponding child deployment plan entry in - // the hash map for this instance. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find - (ACE_CString (my_instance.node.in ()), - entry) != 0) - return 0; // no valid name found. - - // Get the child plan. - ::Deployment::DeploymentPlan_var &child_plan = - (entry->int_id_).child_plan_; - - // Fill in the contents of the child plan entry. - - // Append the "MonolithicDeploymentDescriptions implementation" - // field with a new "implementation", which is specified by the - // <implementationRef> field of <my_instance> entry. NOTE: The - // <artifactRef> field needs to be changed accordingly. - const ::Deployment::MonolithicDeploymentDescription & my_implementation = - (this->plan_.implementation)[my_instance.implementationRef]; - - // Deployment::DnC_Dump::dump (this->plan_); - //Deployment::DnC_Dump::dump ( (this->plan_.implementation)[my_instance.implementationRef]); - //ACE_DEBUG ((LM_DEBUG, "My implementation")); - //Deployment::DnC_Dump::dump (my_implementation); - - CORBA::ULong index_imp = child_plan->implementation.length (); - child_plan->implementation.length (++index_imp); - child_plan->implementation[index_imp-1] = my_implementation; - - // Initialize with the correct sequence length. - CORBA::ULongSeq ulong_seq; - ulong_seq.length (my_implementation.artifactRef.length ()); - - // Append the "ArtifactDeploymentDescriptions artifact" field - // with some new "artifacts", which is specified by the - // <artifactRef> sequence of <my_implementation> entry. - const CORBA::ULong impl_length = my_implementation.artifactRef.length (); - for (CORBA::ULong iter = 0; - iter < impl_length; - iter ++) - { - CORBA::ULong artifact_ref = my_implementation.artifactRef[iter]; - - // Fill in the <artifact> field of the child plan - CORBA::ULong index_art = child_plan->artifact.length (); - child_plan->artifact.length (++index_art); - child_plan->artifact[index_art-1] = - (this->plan_.artifact)[artifact_ref]; - - // Fill in the <artifactRef> field of the MonolithicDeploymentDescription - ulong_seq[iter] = index_art-1; - } - - // Change the <artifactRef> field of the "implementation". - child_plan->implementation[index_imp-1].artifactRef = ulong_seq; - - // Append the "InstanceDeploymentDescription instance" field with - // a new "instance", which is almost the same as the "instance" in - // the global plan except the <implementationRef> field. - // NOTE: The <implementationRef> field needs to be changed accordingly. - CORBA::ULong index_ins = child_plan->instance.length (); - child_plan->instance.length (++index_ins); - child_plan->instance[index_ins-1] = my_instance; - - // Change the <implementationRef> field of the "instance". - // @@ The implementationRef starts from 0. - // @@TODO: Below logic needs to be changed once we want to avoid - // duplicate <implementation> for the optimization. - child_plan->instance[index_ins-1].implementationRef = index_ins-1; - } - - return 1; -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -add_connections (const Deployment::Connections & incoming_conn) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::add_connections"); - - CORBA::ULong const old_len = this->all_connections_->length (); - - // Expand the length of the <all_connection_> sequence. - this->all_connections_->length (old_len + incoming_conn.length ()); - - // Store the connections to the <all_conections_> sequence - const CORBA::ULong conn_lenth = incoming_conn.length (); - for (CORBA::ULong i = 0; i < conn_lenth; ++i) - { - (*this->all_connections_)[old_len + i] = incoming_conn[i]; - } -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -startLaunch (Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::startLaunch"); - ACE_UNUSED_ARG (start); - - try - { - // Clean up all cached connections first - this->all_connections_->length (0); - - // Invoke startLaunch() operations on each cached NodeApplicationManager - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplicationManager object reference. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::startLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_AMH_Impl:startLaunch", - error.c_str ())); - } - - ::Deployment::NodeApplicationManager_ptr my_nam = - (entry->int_id_).node_application_manager_.in (); - - if (CORBA::is_nil (my_nam)) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::startLaunch -" - "ERROR while narrowing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("While starting launch, the DomainApplicationManager\ - has a nil reference for NodeApplicationManager\n"); - ACE_DEBUG ((LM_DEBUG, error.c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_AMH_Impl::startLaunch", - error.c_str ())); - } - - - ::Deployment::Connections_var retn_connections; - - // Obtained the returned NodeApplication object reference - // and the returned Connections variable. - ::Deployment::Application_var temp_application; - if (!is_redeployment_) - { - temp_application = - my_nam->startLaunch (configProperty, - retn_connections.out (), - 0); - } - else - { - //============================================================= - // Add New Components Logic - //============================================================= - // Let's add new components only now, the to-be-removed - // components should be removed AFTER the connections - // are removed. - temp_application = - my_nam->perform_redeployment (configProperty, - retn_connections.out (), - true, // add new components only now - 0); - } - - // Narrow down to NodeApplication object reference - ::Deployment::NodeApplication_var my_na = - ::Deployment::NodeApplication::_narrow (temp_application.in ()); - - if (CORBA::is_nil (my_na.in ())) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::startLaunch -" - "ERROR while narrowing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("The DomainApplicationManager receives a nil " - "reference of NodeApplication after calling " - "startLaunch on NodeApplicationManager.\n"); - ACE_ERROR ((LM_ERROR, error.c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_AMH_Impl::startLaunch", - error.c_str ())); - } - - // Cache the returned set of connections into the list. - this->add_connections (retn_connections.in ()); - - // Cache the returned NodeApplication object reference into - // the hash table. - (entry->int_id_).node_application_ = my_na._retn (); - } - - this->synchronize_shared_components_with_node_managers (); - } - catch (const Deployment::StartError& ex) - { - ACE_DEBUG ((LM_DEBUG, "DAM_Impl:StartError: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::startLaunch\t\n"); - throw; - } - - _tao_rh->startLaunch (); - -} - - -void -CIAO::DomainApplicationManager_AMH_Impl::install_all_es (void) -{ - try - { - for (CORBA::ULong j = 0; j < this->esd_->length (); ++j) - { - // Find NA, and then invoke operation on it - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->esd_[j].node.in (), - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::install_all_es -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->esd_[j].node.in ())); - - ACE_CString error - ("Unable to resolve a reference to NodeManager: "); - error += this->esd_[j].node.in (); - - throw - (Deployment::StartError - ("DomainApplicationManager_AMH_Impl::install_all_es", - error.c_str ())); - } - - // Invoke install_es () operation on each cached NodeApplication object. - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - ::CIAO::CIAO_Event_Service_var ciao_es = - my_na->install_es (this->esd_[j]); - - // Add these returned ES objects into the cached map - this->add_es_to_map (this->esd_[j].name.in (), ciao_es.in ()); - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::install_all_es.\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -add_es_to_map (const char * node_name, - CIAO::CIAO_Event_Service * ciao_es) -{ - try - { - this->es_map_.bind ( - node_name, - CIAO::CIAO_Event_Service::_duplicate (ciao_es)); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::add_es_to_map.\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -finishLaunch (Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - CORBA::Boolean start, - CORBA::Boolean is_ReDaC) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::finishLaunch"); - try - { - // Install all the CIAO_Event_Services within the Deployment Plan - this->install_all_es (); - - // Invoke finishLaunch() operation on each cached NodeApplication object. - // This will establish bindings for only those internal components, but - // NOT for those external/shared components, which requires special - // handling, since these components are outside the control of this - // DomainApplicationManager. - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> * entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::finishLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to NodeManager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_AMH_Impl::finishLaunch", - error.c_str ())); - } - - //@@ Note: Don't delete the below debugging helpers. - // Dump the connections for debug purpose. - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - ACE_DEBUG ((LM_DEBUG, - "dump incoming connections for child plan:%s\n", - (entry->int_id_).child_plan_->UUID.in ())); - dump_connections (this->all_connections_.in ()); - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - } - - // Get the Connections variable, if ReDaC is true, then we get - // those new connections only. NOTE: get_outgoing_connections - // by default will get *all* connections. - Deployment::Connections * my_connections = - this->get_outgoing_connections ( - (entry->int_id_).child_plan_.in (), - !is_ReDaC, - true, // we search *new* plan - DomainApplicationManager_AMH_Impl::Internal_Connections); - - if (my_connections == 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::finishLaunch -" - "ERROR while getting the outgoing connections " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_AMH_Impl::finish_launch", - "There was some error establishing connections.")); - } - - // Dump the connections for debug purpose. - if (CIAO::debug_level () > 1) - { - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - ACE_DEBUG ((LM_DEBUG, - "dump outgoing connections for child plan:%s\n", - (entry->int_id_).child_plan_->UUID.in ())); - dump_connections (*my_connections); - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - } - - // Invoke finishLaunch() operation on NodeApplication. - if (my_connections->length () != 0) - { - entry->int_id_.node_application_->finishLaunch - (*my_connections, - start, - true // "true" => establish new connections only - ); - } - - //============================================================= - // Remove Old Connections Logic - //============================================================= - - if (is_ReDaC) // We should also *REMOVE* unnecessary connections - { - // If this is a brand new child plan, then continue. - if ((entry->int_id_).old_child_plan_ == 0) - continue; - - // Get all the connections in the old deployment plan - Deployment::Connections * connections_in_old_plan = - this->get_outgoing_connections ( - (entry->int_id_).old_child_plan_.in (), - true, // yes, get *all* the connections - false, // search in the *old* plan - DomainApplicationManager_AMH_Impl::Internal_Connections); - - // Pass in the "false" parameter to get *all* the connections in - // the new deployment plan, regardless those in old plan - Deployment::Connections * connections_in_new_plan = - this->get_outgoing_connections ( - (entry->int_id_).child_plan_.in (), - true, // yes, get *all* the connections - true, // search in the *new* plan - DomainApplicationManager_AMH_Impl::Internal_Connections); - - Deployment::Connections * unnecessary_connections = - this->subtract_connections (*connections_in_old_plan, - *connections_in_new_plan); - - delete connections_in_old_plan; - delete connections_in_new_plan; - - // Dump the connections for debug purpose. - if (CIAO::debug_level () > 1) - { - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - ACE_DEBUG ((LM_DEBUG, - "dump to-be-removed connections for child plan:%s\n", - (entry->int_id_).child_plan_->UUID.in ())); - dump_connections (*unnecessary_connections); - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - } - - // Invoke finishLaunch() operation on NodeApplication. - if (unnecessary_connections->length () != 0) - { - if (CORBA::is_nil (entry->int_id_.node_application_.in ())) - throw Deployment::StartError (); - - entry->int_id_.node_application_->finishLaunch - (*unnecessary_connections, - start, - false // false ==> remove unnecessary connections - ); - } - - //============================================================= - // Remove Old Components - //============================================================= - // Finally we need to remove those to-be-removed components - ::Deployment::Properties_var configProperty; - ACE_NEW (configProperty, - Deployment::Properties); - - ::Deployment::Connections_var retn_connections; - - Deployment::Application_var temp_application = - entry->int_id_.node_application_manager_-> - perform_redeployment (configProperty, - retn_connections.out (), - false, // remove old components only - false);// do not "start" - } - } - - // Establish bindings on external/shared components of this deployment plan. - this->post_finishLaunch (); - } - catch (const Deployment::StartError& ex) - { - ACE_ERROR ((LM_ERROR, "DAM_Impl::finishLaunch - StartError: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::finishLaunch: ""Killing NodeApplications.\n"); - - // Invoke destroyManager() operation on each cached - // NodeManager object. - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeManager and NodeApplicationManager object references. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> * entry = 0; - this->artifact_map_.find (this->node_manager_names_[i],entry); - - ::Deployment::NodeApplicationManager_ptr - my_node_application_manager = - (entry->int_id_).node_application_manager_.in (); - - // Invoke destoryApplication() operation on the NodeApplicationManger. - // Since we have the first arg is not used by NAM anyway. - my_node_application_manager->destroyApplication - (0); - } - throw; - } - - _tao_rh->finishLaunch (); -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -post_finishLaunch (void) -{ - try - { - // For each "external" component... - CORBA::ULong length = this->shared_->length (); - for (CORBA::ULong j = 0; j < length; ++j) - { - // Construct <Component_Binding_Info> struct for the component - CIAO::Component_Binding_Info * - binding = this->populate_binding_info ( - this->shared_[j].name.in (), - this->shared_[j].plan_uuid.in ()); - - // Invoke <finalize_global_binding> on ExecutionManager - this->execution_manager_->finalize_global_binding ( - *binding, true); - - delete binding; - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::post_finishLaunch.\n"); - throw; - } - -} - -CIAO::Component_Binding_Info * -CIAO::DomainApplicationManager_AMH_Impl:: -populate_binding_info (const ACE_CString& name, - const ACE_CString& child_uuid) -{ - CIAO::Component_Binding_Info * retv; - ACE_NEW_RETURN (retv, - CIAO::Component_Binding_Info (), - 0); - - retv->name_ = name; - - // Parse the child_uuid string and populate the "node" name and - // "plan_uuid" fields. Our protocol here is searching for the "@", - // the substring *before* that is the global plan uuid, and the - // substring *after* that is the node name. - ACE_CString::size_type pos = child_uuid.find ('@'); - - retv->plan_uuid_ = - child_uuid.substring (0, pos); - - retv->node_ = - child_uuid.substring (pos + 1, - ACE_CString::npos); // get the rest of the string - - Deployment::Connections_var connections; - ACE_NEW_RETURN (connections, - Deployment::Connections, - 0); - - this->get_outgoing_connections_i (name.c_str (), - connections.inout (), - false, // get *all* connections - true); // search current plan - - retv->providedReference_ = connections._retn (); - - return retv; -} - -CIAO::Component_Binding_Info * -CIAO::DomainApplicationManager_AMH_Impl:: -populate_binding_info (const ACE_CString& name) -{ - CIAO::Component_Binding_Info * retv; - ACE_NEW_RETURN (retv, - CIAO::Component_Binding_Info (), - 0); - - // Looking for the child plan uuid through the shared compoonent list - for (CORBA::ULong i = 0; i < this->shared_->length (); ++i) - { - if (ACE_OS::strcmp (this->shared_[i].name.in (), - name.c_str ()) == 0) - { - ACE_CString child_uuid = this->shared_[i].plan_uuid.in (); - retv = this->populate_binding_info (name, child_uuid); - return retv; - } - } - - return 0; // If no matching is found (should never happen). -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -add_shared_components (const Deployment::ComponentPlans & shared) -{ - for (CORBA::ULong i = 0; i < shared.length (); ++i) - { - CORBA::ULong curr_len = this->shared_->length (); - this->shared_->length (curr_len + 1); - this->shared_[curr_len] = shared[i]; - } -} - -bool -CIAO::DomainApplicationManager_AMH_Impl:: -is_shared_component (const char * name) -{ - for (CORBA::ULong i = 0; i < this->shared_->length (); ++i) - { - if (ACE_OS::strcmp (this->shared_[i].name.in (), - name) == 0) - return true; - } - - return false; -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -synchronize_shared_components_with_node_managers (void) -{ - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeManager object reference. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::startLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_AMH_Impl:startLaunch", - error.c_str ())); - } - - // Update the shared components list - ::Deployment::NodeManager_ptr - my_node_manager = (entry->int_id_).node_manager_.in (); - - Deployment::ComponentPlans_var - shared = my_node_manager->get_shared_components (); - - this->add_shared_components (shared.in ()); - } -} - - -Deployment::Connections * -CIAO::DomainApplicationManager_AMH_Impl:: -get_outgoing_connections (const Deployment::DeploymentPlan &plan, - bool is_getting_all_connections, - bool is_search_new_plan, - Connection_Search_Type t) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::get_outgoing_connections"); - Deployment::Connections_var connections; - ACE_NEW_RETURN (connections, - Deployment::Connections, - 0); - - // For each component instance in the child plan ... - CORBA::ULong number = plan.instance.length (); - for (CORBA::ULong i = 0; i < number; ++i) - { - - if (t == Internal_Connections && - this->is_shared_component (plan.instance[i].name.in ())) - continue; - - // Get the outgoing connections of the component - if (!get_outgoing_connections_i (plan.instance[i].name.in (), - connections.inout (), - is_getting_all_connections, - is_search_new_plan)) - return 0; - } - return connections._retn (); -} - - -// Get outgoing connections for particular instance -bool -CIAO::DomainApplicationManager_AMH_Impl:: -get_outgoing_connections_i (const char * instname, - Deployment::Connections & retv, - bool is_getting_all_connections, - bool is_search_new_plan) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::get_outoing_connections_i"); - - Deployment::DeploymentPlan tmp_plan; - if (is_search_new_plan) - tmp_plan = this->plan_; - else - tmp_plan = this->old_plan_; - - // Search for all the bindings in the plan. - const CORBA::ULong total_length = tmp_plan.connection.length(); - for (CORBA::ULong i = 0; i < total_length; ++i) - { - // Current binding that we are looking at. - const Deployment::PlanConnectionDescription & binding = - tmp_plan.connection[i]; - - // If this is a ReDaC case, then we ignore the connection if it - // already exists in the old_plan - if (already_exists (binding) && - !is_getting_all_connections) - continue; - - this->populate_connection_for_binding (instname, - binding, - tmp_plan, - retv); - } - return true; -} - -// Search the current binding to see whether a connection of this -// component needs to be populated -bool -CIAO::DomainApplicationManager_AMH_Impl:: -populate_connection_for_binding ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv) -{ - const CORBA::ULong binding_len = binding.internalEndpoint.length (); - - // If only 1 internalEndpoint, then we know it's through event service. - if (binding_len == 1) - { - return - this->handle_es_connection (instname, - binding, - plan, - retv); - } - else if (binding_len == 2) - { - return this->handle_direct_connection (instname, - binding, - plan, - retv); - } - else // invalid binding encounted... - return false; -} - -bool -CIAO::DomainApplicationManager_AMH_Impl:: -handle_es_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv) -{ - // The initial retv might have something inside - CORBA::ULong len = retv.length (); - - const Deployment::PlanSubcomponentPortEndpoint & endpoint = - binding.internalEndpoint[0]; - - // If the instance name does NOT match one of the names in the binding - // Then thsi binding has nothing related to myself (an instance) - if (ACE_OS::strcmp (instname, - plan.instance[endpoint.instanceRef].name.in ()) != 0) - return false; - - if (binding.externalReference.length () != 1) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::" - "handle_publisher_es_connection -" - "externalReference must have length of 1.\n")); - return false; - } - - retv.length (len+1); - retv[len].instanceName = instname; - retv[len].portName = endpoint.portName.in (); - retv[len].kind = endpoint.kind; - - ACE_CString es_id = binding.externalReference[0].location.in (); - - retv[len].endpointInstanceName = es_id.c_str (); - retv[len].endpointPortName = CORBA::string_dup ("CIAO_ES"); - - // We need to populate the actual filter and store it into - // the <connection.config> field - if (binding.deployRequirement.length () != 0) - { - retv[len].config = - * (this->get_connection_QoS_configuration (binding.deployRequirement[0])); - } - - // If we didnt find the objref of the connection ... - CIAO::CIAO_Event_Service_var es; - - if (this->es_map_.find (es_id.c_str (), es) != 0) - { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += binding.name.in (); - throw Deployment::StartError( - "DomainApplicationManager_AMH_Impl::create_connections_i", - error.c_str ()); - } - - retv[len].event_service = es._retn (); - - // One more thing needs to be done if this is a es_consumer connection - // We need to populate the <endpoint> field of this connection, which - // is the object reference of this event consumer port. - if (endpoint.kind == Deployment::EventConsumer) - { - // Now we search in the received connections to get the objRef of event sink - bool found = false; - const CORBA::ULong all_conn_len = this->all_connections_->length (); - for (CORBA::ULong j = 0; j < all_conn_len; ++j) - { - const Deployment::Connection & curr_recv_conn = - this->all_connections_[j]; - - // We need to look at the instance name and the port name to confirm. - if (ACE_OS::strcmp (curr_recv_conn.instanceName.in (), - instname) == 0 && - ACE_OS::strcmp (curr_recv_conn.portName.in (), - endpoint.portName.in ()) == 0) - { - retv[len].endpoint = - CORBA::Object::_duplicate(curr_recv_conn.endpoint.in ()); - found = true; - } - } // End of searching received connections - - if (!found) - { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += binding.name.in (); - throw Deployment::StartError( - "DomainApplicationManager_AMH_Impl::handle_es_connection", - error.c_str ()); - } - } - - return true; -} - -bool -CIAO::DomainApplicationManager_AMH_Impl:: -handle_direct_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv) -{ - // The initial retv might have something inside - CORBA::ULong len = retv.length (); - - const CORBA::ULong binding_len = binding.internalEndpoint.length (); - for (CORBA::ULong i = 0; i < binding_len; ++i) - { - const Deployment::PlanSubcomponentPortEndpoint & endpoint = - binding.internalEndpoint[i]; - - // If the instance name does NOT match one of the names in the binding - if (ACE_OS::strcmp (instname, - plan.instance[endpoint.instanceRef].name.in ()) != 0) - continue; - - // We are only interested when we are the "client" of the endpoint objref - if (endpoint.kind == Deployment::EventPublisher || - endpoint.kind == Deployment::EventEmitter || - endpoint.kind == Deployment::SimplexReceptacle || - endpoint.kind == Deployment::MultiplexReceptacle ) - { - // Obtain the index of the "real" endpoint which has an objref. It - // is the opposite side of myself. - CORBA::ULong e_index = (i + 1) % 2; - - ACE_CString source_port = - binding.internalEndpoint[i].portName.in (); - - ACE_CString endpoint_inst = - plan.instance[binding.internalEndpoint[e_index] - .instanceRef].name.in (); - - ACE_CString endpoint_port = - binding.internalEndpoint[e_index].portName.in (); - - bool found = false; - - // Now we search in the received connections to get the objRef. - const CORBA::ULong all_conn_len = this->all_connections_->length (); - for (CORBA::ULong j = 0; j < all_conn_len; ++j) - { - const Deployment::Connection & curr_recv_conn = - this->all_connections_[j]; - - // We need to look at the instance name and the port name to confirm. - if (ACE_OS::strcmp (curr_recv_conn.instanceName.in (), - endpoint_inst.c_str ()) == 0 && - ACE_OS::strcmp (curr_recv_conn.portName.in (), - endpoint_port.c_str ()) == 0) - { - retv.length (len+1); - retv[len].instanceName = instname; - retv[len].portName = source_port.c_str (); - retv[len].endpointInstanceName = endpoint_inst.c_str (); - retv[len].endpointPortName = endpoint_port.c_str (); - - retv[len].endpoint = - CORBA::Object::_duplicate(curr_recv_conn.endpoint.in ()); - retv[len].kind = binding.internalEndpoint[i].kind; - - ++len; - found = true; - break; - } - } // End of searching received connections - - // We didnt find the objref of the connection ... - if (!found) - { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += binding.name.in (); - throw Deployment::StartError( - "DomainApplicationManager_AMH_Impl::create_connections_i", - error.c_str ()); - } - break; - } - } - return true; -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -start ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::start"); - - try - { - CORBA::ULong i; - - for (i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::start -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw Deployment::StartError( - "DomainApplicationManager_AMH_Impl:startLaunch", - error.c_str ()); - } - - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->ciao_preactivate (); - } - - // Invoke start () operation on each cached NodeApplication object. - for (i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::start -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - throw Deployment::StartError (); - } - - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->start (); - } - - // Invoke ciao_postctivate () operation on each - // cached NodeApplication object. - - for (i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::start -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw Deployment::StartError( - "DomainApplicationManager_AMH_Impl:startLaunch", - error.c_str ()); - } - - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->ciao_postactivate (); - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("DomainApplicationManager_AMH_Impl::start\t\n"); - throw; - } - - _tao_rh->start (); -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -destroyApplication ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::destroyApplication"); - try - { - // Passivate shared components also, which should delegate to EM to handle - this->passivate_shared_components (); - - // Passivate all components associated with the plan - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_AMH_Impl.cpp -" - "CIAO::DomainApplicationManager_AMH_Impl::destroyApplication -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to NodeManager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StopError - ("DomainApplicationManager_AMH_Impl::destroyApplication", - error.c_str ())); - } - ACE_DEBUG ((LM_DEBUG, "DAM_Impl: Invoking passivate on %s\n", - this->node_manager_names_[i].c_str ())); - - // Invoke ciao_passivate () operation on each cached NodeApplication object. - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->ciao_passivate (); - } - - // Remove all connections associated with the plan - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - this->artifact_map_.find (this->node_manager_names_[i], entry); - - Deployment::Connections_var connections = - this->get_outgoing_connections ( - (entry->int_id_).child_plan_.in (), - true, // yes, get *all* the connections - true, // yes, we search the current plan - DomainApplicationManager_AMH_Impl::External_Connections); - - // Invoke finishLaunch() on NodeApplication to remove bindings. - // If this NodeApplication is not within the control of this DAM, - // then we should delegate the call to the correct DAM through EM. - - // Iterave over the returned connection list in <connections>, - // (1) If this is a shared component, then we remove this connection - // from <connections> list, and then populate a "Component_Binding_Info" - // struct for it and send to EM for remove. - // (2) For the rest of the connections, we send them to the NAs - // managed by the local DAM to remove. - - for (CORBA::ULong j = 0; j < connections->length (); ++j) - { - if (this->is_shared_component (connections[j].instanceName.in ())) - { - // ask EM to remove the binding for us - ACE_CString inst_name = connections[j].instanceName.in (); - CIAO::Component_Binding_Info * - binding = this->populate_binding_info (inst_name.c_str ()); - - this->execution_manager_->finalize_global_binding ( - *binding, false); - - // Remove all the connections whose "source" component - // is this component instance from the <connections> list - this->purge_connections (connections, - inst_name.c_str ()); - } - } - - if (connections->length () > 0) - { - entry->int_id_.node_application_->finishLaunch - (connections.in (), - true, // "true" ==> start the components - false // "false" => remove connections - ); - } - - } - - // After all the connections are removed, we actually destroy - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - this->artifact_map_.find (this->node_manager_names_[i], entry); - - // Invoke destroyPlan() operation on the NodeManager - Deployment::NodeManager_var - my_node_manager = (entry->int_id_).node_manager_; - - my_node_manager->destroyPlan ((entry->int_id_).child_plan_); - } - - // ?? - // Shall we invoke destroyManager () operation on the NodeManager, since we need - // to clean up all the NodeApplicationManagers associated with this deployment - // plan (one NodeApplicationManager per Node per plan). - - // We should again activate those shared components - this->activate_shared_components (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::destroyApplication\t\n"); - throw; - } - - _tao_rh->destroyApplication (); -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -destroyManager ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::destroyManager"); - try - { - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeManager and NodeApplicationManager object references. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - throw Deployment::StopError (); // Should never happen! - - ::Deployment::NodeManager_var my_node_manager = - (entry->int_id_).node_manager_; - - ::Deployment::NodeApplicationManager_var my_nam = - (entry->int_id_).node_application_manager_; - - my_node_manager->destroyManager (my_nam.in ()); - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::destroyManager\t\n"); - throw; - } - _tao_rh->destroyManager (); -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -perform_redeployment ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const Deployment::DeploymentPlan & plan) -{ - // Currently we could dynamically update the NodeManagerMap topology, - // but later maybe we could add another parameter to this operation, - // which allows the user to specify the new NodeManagerMap data file. - this->old_plan_ = this->plan_; - this->is_redeployment_ = true; - this->plan_ = plan; - - try - { - // Call init() on the myself, which will validate/split the plan and - // call preparePlan on each NodeManager, by this, we shall get - // all the object references of NM and NAM associated with each - // component instance populated. - this->init (); - - // Call startLaunch on each NM for each child plan, this should not only - // install all the new components specified, but should also remove - // the components that are no longer in the new deployment plan. - // Meanwhile, we should set up the container configurations appropriately, - // whose information is fully captured in the node-level deployment plan. - ::Deployment::Properties_var properties; - ACE_NEW (properties, - Deployment::Properties); - - this->startLaunch (_tao_rh, properties.in (), false); - - // finishLaunch will (1) establish new connections, and (2) - // get rid of those non-existing connections. As we know, in the - // node level, the connections are cached within the NodeApplication *and* - // Container, then we should modify the implementation of the - // <finishLaunch> on the NodeApplication to accomplish this. - this->finishLaunch (_tao_rh, true, true); // true means start activation also. - // ture means "ReDaC" is desired - - this->start (_tao_rh); - - _tao_rh->perform_redeployment (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::perform_redeployment\t\n"); - this->plan_ = this->old_plan_; - throw; - } -} - - -void -CIAO::DomainApplicationManager_AMH_Impl:: -getPlan (Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::getPlan"); - Deployment::DeploymentPlan_var plan = 0; - // Make a deep copy of the Plan - ACE_NEW_THROW_EX (plan, - Deployment::DeploymentPlan (this->plan_), - CORBA::NO_MEMORY ()); - - _tao_rh->getPlan (plan.in ()); -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -dump_connections (const ::Deployment::Connections & connections) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMH_Impl::dump_connections"); - const CORBA::ULong conn_len = connections.length (); - for (CORBA::ULong i = 0; i < conn_len; ++i) - { - ACE_DEBUG ((LM_DEBUG, - "instanceName: %s\n", connections[i].instanceName.in ())); - - ACE_DEBUG ((LM_DEBUG, "portName: %s\n", connections[i].portName.in ())); - - ACE_DEBUG ((LM_DEBUG, "portkind: ")); - - switch (connections[i].kind) - { - case Deployment::Facet: - - ACE_DEBUG ((LM_DEBUG, "Facet\n")); - break; - - case Deployment::SimplexReceptacle: - - ACE_DEBUG ((LM_DEBUG, "SimplexReceptacle\n")); - break; - - case Deployment::MultiplexReceptacle: - - ACE_DEBUG ((LM_DEBUG, "MultiplexReceptacle\n")); - break; - - case Deployment::EventEmitter: - - ACE_DEBUG ((LM_DEBUG, "EventEmitter\n")); - break; - - case Deployment::EventPublisher: - - ACE_DEBUG ((LM_DEBUG, "EventPublisher\n")); - break; - - case Deployment::EventConsumer: - - ACE_DEBUG ((LM_DEBUG, "EventConsumer\n")); - break; - - default: - ACE_DEBUG ((LM_DEBUG, "Unknown port kind.\n")); - } - - ACE_DEBUG ((LM_DEBUG, - "endpointInstanceName: %s\n", - connections[i].endpointInstanceName.in ())); - - ACE_DEBUG ((LM_DEBUG, - "endpointPortName: %s\n", - connections[i].endpointPortName.in ())); - ACE_DEBUG ((LM_DEBUG, "---------------------\n")); - } -} - -bool -CIAO::DomainApplicationManager_AMH_Impl:: -already_exists (const Deployment::PlanConnectionDescription & conn) -{ - const CORBA::ULong conn_len = this->old_plan_.connection.length(); - for(CORBA::ULong i = 0; i < conn_len; ++i) - { - if (ACE_OS::strcmp (this->old_plan_.connection[i].name.in (), - conn.name.in ()) == 0) - return true; - } - - return false; -} - -Deployment::Connections * -CIAO::DomainApplicationManager_AMH_Impl:: -subtract_connections (const Deployment::Connections & left, - const Deployment::Connections & right) -{ - Deployment::Connections_var retv; - ACE_NEW_RETURN (retv, - Deployment::Connections, - 0); - - CORBA::ULong left_length = left.length (); - CORBA::ULong right_length = right.length (); - for (CORBA::ULong i = 0; i < left_length; ++i) - { - bool found = false; - for (CORBA::ULong j = 0; j < right_length; ++j) - { - if (ACE_OS::strcmp (left[i].instanceName.in (), - right[j].instanceName.in ()) == 0 && - ACE_OS::strcmp (left[i].portName.in (), - right[j].portName.in ()) == 0 && - left[i].kind == right[j].kind && - left[i].endpoint->_is_equivalent (right[j].endpoint.in ())) - { - found = true; - break; - } - } - - if (!found) - { - CORBA::ULong curr_length = retv->length (); - retv->length (curr_length + 1); - retv[curr_length] = left[i]; - } - } - return retv._retn (); -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -passivate_shared_components (void) -{ - try - { - // For each "external" component... - CORBA::ULong length = this->shared_->length (); - for (CORBA::ULong j = 0; j < length; ++j) - { - // Construct <Component_Binding_Info> struct for the component - CIAO::Component_Binding_Info * - binding = this->populate_binding_info ( - this->shared_[j].name.in (), - this->shared_[j].plan_uuid.in ()); - - // Invoke <finalize_global_binding> on ExecutionManager - this->execution_manager_->passivate_shared_components ( - *binding); - - delete binding; - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::passivate_shared_components.\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -activate_shared_components (void) -{ - try - { - // For each "external" component... - CORBA::ULong length = this->shared_->length (); - for (CORBA::ULong j = 0; j < length; ++j) - { - // Construct <Component_Binding_Info> struct for the component - CIAO::Component_Binding_Info * - binding = this->populate_binding_info ( - this->shared_[j].name.in (), - this->shared_[j].plan_uuid.in ()); - - // Invoke <finalize_global_binding> on ExecutionManager - this->execution_manager_->activate_shared_components ( - *binding); - - delete binding; - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_AMH_Impl::activate_shared_components.\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_AMH_Impl:: -purge_connections (Deployment::Connections_var & connections, - const char * inst) -{ - CORBA::ULong total_len = connections->length (); - - for (CORBA::ULong i = 0; i < total_len; ++i) - { - bool found = false; - - // Remove all the connections whose "source" component - // name is <inst> - if (ACE_OS::strcmp (connections[i].instanceName.in (), - inst) == 0) - { - found = true; - - for (CORBA::ULong j = i; j < total_len - 1; ++j) - { - connections[j] = connections[j + 1]; - } - connections->length (total_len - 1); - } - - if (found) - this->purge_connections (connections, inst); - } -} - -const Deployment::Properties * -CIAO::DomainApplicationManager_AMH_Impl:: -get_connection_QoS_configuration (const Deployment::Requirement & requirement) -{ - // Get the name/identifier of the filter associated with - // this connection - Deployment::Properties * retv; - ACE_NEW_NORETURN (retv, Deployment::Properties); - - CORBA::ULong len = retv->length (); - - for (CORBA::ULong i = 0; - i < requirement.property.length (); - ++i) - { - const char *filter_name; - if (ACE_OS::strcmp ("EventFilter", - requirement.property[i].name) == 0) - { - - if ((requirement.property[i].value >>= filter_name) == false) - ACE_ERROR ((LM_ERROR, - "ERROR: DomainApplicationManager_AMH_Impl::" - "get_connection_QoS_configuration unable to " - "extract event filter information\n")); - } - - // Search for the desired filter - for (CORBA::ULong j = 0; j < this->esd_->length (); ++j) - { - // Populate the "filters" info, in case this CIAO_Event_Service has - // one or more filters specified through descriptors - for (CORBA::ULong k = 0; k < this->esd_[j].filters.length (); ++k) - { - if (ACE_OS::strcmp (this->esd_[j].filters[k].name.in (), - filter_name) == 0) - { - retv->length (len + 1); - (*retv)[len].name = CORBA::string_dup ("EventFilter"); - (*retv)[len].value <<= this->esd_[j].filters[k]; - break; - } - } - } - } - return retv; -} diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.h b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.h deleted file mode 100644 index af79e1b42ef..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.h +++ /dev/null @@ -1,467 +0,0 @@ -//================================================================== -/** - * @file DomainApplicationManager_AMH_Impl.h - * - * $Id$ - * - * This file contains the AMH implementation for the servant of - * Deployment::DomainApplicationManager. - * - * @author Gan Deng <gan.deng@vanderbilt.edu> - */ -//===================================================================== - -#ifndef CIAO_DOMAINAPPLICATIONMANAGER_AMH_IMPL_H -#define CIAO_DOMAINAPPLICATIONMANAGER_AMH_IMPL_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - - -#include "ace/Hash_Map_Manager.h" -#include "ace/Vector_T.h" -#include "ace/Functor.h" -#include "ace/OS_NS_string.h" - -#include "DAnCE/Deployment/Deployment_DomainApplicationManagerS.h" -#include "DAnCE/Deployment/Deployment_common.h" - -#include "tao/Valuetype/ValueBase.h" -#include "tao/Valuetype/Valuetype_Adapter_Impl.h" - -#include "ciao/CIAO_common.h" -#include "DAnCE/Deployment/Deployment_EventsC.h" - -#include "Deployment_Configuration.h" -#include "DomainApplicationManager_Export.h" - -namespace CIAO -{ - namespace Execution_Manager - { - class Execution_Manager_Impl; - } - - /** - * @class DomainApplicationManager_Impl - * - * @brief A servant for the Deployment::DomainApplicationManager - * interface. The DomainApplicationManager is responsible for - * deploying an application on the domain level, i.e. across - * nodes. It specializes the ApplicationManager abstract interface. - */ - class DomainApplicationManager_Export DomainApplicationManager_AMH_Impl - : public virtual POA_Deployment::AMH_DomainApplicationManager - { - public: - - /// External_Connections means we search all the connections including - /// the connectiosn for external/shared components of this plan which hold - /// port objrefs of components within this plan - enum Connection_Search_Type - { - External_Connections, - Internal_Connections - }; - - /// Define the type which contains a list of DnC artifacts. - /// @@ Assumption: Each NodeApplicationManager create only one - /// NodeApplication when the startLaunch() operation is invoked, - /// which means all the nodes on that child plan are collocated in - /// the same process. - typedef struct _chained_artifacts - { - ::Deployment::NodeManager_var node_manager_; - ::Deployment::DeploymentPlan_var child_plan_; - ::Deployment::NodeApplicationManager_var node_application_manager_; - ::Deployment::NodeApplication_var node_application_; - ::Deployment::DeploymentPlan_var old_child_plan_; - } Chained_Artifacts; - - /// Constructor - DomainApplicationManager_AMH_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl * em, - const Deployment::DeploymentPlan &plan, - const char * deployment_file); - - - /*=========================================================== - * Below are helper methods for the DomainApplicationManager - * - *============================================================*/ - /** - * Initialize the DomainApplicationManager. - * @para em A pointer to the ExecutionManager servant C++ object. - * - * (1) Set the total number of child plans. - * (2) Set the list of NodeManager names, which is an array of strings. - * The <node_manager_names> is a pointer to an array of ACE_CString - * objets, which is allocated by the caller and deallocated by the - * DomainApplicationManager destructor. - * (3) Check the validity of the deployment plan and the deployment - * information data file. - * (4) Call split_plan () member function. - * (5) Invoke all the preparePlan () operations on all the corresponding - * NodeManagers with child plans. - * - * - * @@ What else do we need to initialize here? - */ - void init (); - - /** - * set_uuid method on the DomainApplicationManager assigns the - * UUID of the associated plan to this Manager. This helps in - * reverse lookup operations such as given a manager, obtaining - * the UUID associated. The get_uuid method is used in this case. - */ - void set_uuid (const char * uuid); - - const char * get_uuid () const; - - /*=========================================================== - * Below are operations from the DomainApplicationManager - * - *============================================================*/ - - /** - * Fetch the NodeApplication object reference based on the NodeManager name. - */ - virtual void get_node_app ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const char * node_name); - - /** - * Executes the application, but does not start it yet. Users can - * optionally provide launch-time configuration properties to - * override properties that are part of the plan. Raises the - * InvalidProperty exception if a configuration property is - * invalid. Raises the StartError exception if an error occurs - * during launching. Raises the ResourceNotAvailable exception if - * the commitResources parameter to the prepare operation of the - * ExecutionManager was true, if late resource allocation is used, - * and one of the requested resources is not available. - */ - virtual void startLaunch ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start); - /** - * The second step in launching an application in the - * domain-level. If the start parameter is true, the application - * is started as well. Raises the StartError exception if - * launching or starting the application fails. - */ - virtual void finishLaunch ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - CORBA::Boolean start, - CORBA::Boolean is_ReDAC); - - /** - * The last step in launching an application in the - * domain-level. We establish connection bindings - * for external/shared components of this deployment plan - * components. - * Internally, this operation will invoke some operations - * on ExecutionManager to finish up this task. - */ - virtual void post_finishLaunch (void); - - virtual void passivate_shared_components (void); - - virtual void activate_shared_components (void); - - /** - * Starts the application. Raises the StartError exception if - * starting the application fails. - */ - virtual void start ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh); - - /** - * Terminates a running application. Raises the StopError - * exception if an error occurs during termination. Raises the - * InvalidReference exception if the appliction reference is - * unknown. - */ - virtual void destroyApplication ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh); - - /** - * Returns the DeploymentPlan associated with this ApplicationManager. - */ - virtual void getPlan ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh); - - /** - * This is a helper function to destroy the NodeAppManager. - * Since we don't want to do so in the destructor so we will - * ask the ExecutionManager to do this on us when the same IDL - * op invoked on it. This is part of the result for merging DAM - * with DA. - */ - virtual void destroyManager ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh); - - // The input parameter is a *new_plan* which has the - // same UUID of the existing running plan. - virtual void perform_redeployment ( - Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const Deployment::DeploymentPlan & plan); - - protected: - /// Destructor - virtual ~DomainApplicationManager_AMH_Impl (void); - - /** - * (1) Parse the global deployment plan, get the total number of - * child plans included in the global plan, and get the list of - * names of NodeManagers for each child plan. - * (2) Check whether all the NodeManager names are present in the - * deployment information data file. - */ - bool get_plan_info (void); - - /** - * Split the global (domain-level) deployment plan to a set of - * local (node-level) deployment plans. The set of local plans - * are cached in the ACE hash map member variable. - * Also, fill in the <node_manager_> field of the Chained_Artifacts - * struct. - */ - int split_plan (void); - - /** - * Construct <Component_Binding_Info> struct for the component instance. - * - * @param name component instance name - * @param child_uuid child plan uuid string - */ - CIAO::Component_Binding_Info * - populate_binding_info (const ACE_CString& name, - const ACE_CString& child_uuid); - - /** - * Construct <Component_Binding_Info> struct for the component instance. - * Fetch the plan_uuid info from the internally cached shared component - * list. - * - * @param name component instance name - */ - CIAO::Component_Binding_Info * - populate_binding_info (const ACE_CString& name); - - /** - * Contact each NodeManager to get shared compnents information - * and then update its internal cache. - */ - void synchronize_shared_components_with_node_managers (void); - - /** - * A helper function to add a list of shared components into - * the cached shared component list. - * - * @param shared A list of shared components to be added. - */ - void add_shared_components (const Deployment::ComponentPlans & shared); - - /** - * A private function to check whether a component is in the shared - * component list. - * - * @param name The name of a component instance. - */ - bool is_shared_component (const char * name); - - /** - * Cache the incoming connections, which is a sequence of Connections, - * into the <all_connections_> list. - */ - void add_connections (const Deployment::Connections & incoming_conn); - - /** - * Given a child deployment plan, find the <Connections> sequence - * of the "providedReference" for the component instances in the - * child deployment plan as Receiver side. - * By default, we search in the new plan. - * - * If <is_getting_all_connections> is false, then we only - * search for "new connections" (valid for ReDaC case only). - * Otherwise, we will search for both new connections and those - * already existing connections. - */ - Deployment::Connections * - get_outgoing_connections (const Deployment::DeploymentPlan &plan, - bool is_getting_all_connections = true, - bool is_search_new_plan = true, - Connection_Search_Type t = Internal_Connections); - - /// This is a helper function to find the connection for a component. - bool - get_outgoing_connections_i (const char * instname, - Deployment::Connections & retv, - bool is_ReDAC, - bool is_search_new_plan); - - bool - populate_connection_for_binding ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv); - - bool - handle_es_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv); - - bool - handle_direct_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv); - - /// Dump connections, a static method - void dump_connections (const ::Deployment::Connections & connections); - - /// Check whether a connection already exists in the cached old plan - bool already_exists (const Deployment::PlanConnectionDescription & conn); - - /// Remove those appeared in <right> from the <left> - Deployment::Connections * - subtract_connections (const Deployment::Connections & left, - const Deployment::Connections & right); - - void - purge_connections (Deployment::Connections_var & connections, - const char * inst); - - /** - * The first step in finish_launching an application in the - * domain-level. We install all the CIAO_Event_Service objects - * as specified in the DeploymentPlan. - * Internally, this operation will invoke an operation on each cached - * NodeApplication object. - */ - virtual void install_all_es (void); - - /** - * Add all CIAO_Event_Service objects into the cached map. - */ - virtual void - add_es_to_map (const char* node_name, - CIAO::CIAO_Event_Service * ciao_es); - - /** - * Get the actual event connection QoS properties based on the - * deployment requirement. The deployment requirement only specifies - * an identifier/reference to the EventServiceDeploymentDescriptions. - */ - virtual const Deployment::Properties * - get_connection_QoS_configuration ( - const Deployment::Requirement & requirement); - - protected: - /// location of the Domainapplication - CORBA::String_var domainapp_path_; - - /// Keep a pointer to the managing ORB serving this servant. - CORBA::ORB_var orb_; - - /// Keep a pointer to the managing POA. - PortableServer::POA_var poa_; - - /// Pointer to the ExecutionManager_Impl "singleton" servant object - /// We could do this because ExecutionManager and DomainApplicationManager - /// are always collocated in the same process, so we don't have - /// to pass CORBA object reference back and forth. - Execution_Manager::Execution_Manager_Impl * execution_manager_; - - /// Cache a list of shared components - Deployment::ComponentPlans_var shared_; - - /// Cache the ior of the previous reference - CORBA::String_var ior_; - - /// Cached TargetManager. - Deployment::TargetManager_var target_manager_; - - /// Cached deployment plan for the particular domain. - /// The plan will be initialized when init is called. - Deployment::DeploymentPlan plan_; - - /// Cached old deployment plan, i.e., before redeployment - Deployment::DeploymentPlan old_plan_; - - /// Cached child plans. - //Deployment::DeploymentPlan * child_plan_; - - /// Total number of child deployment plans. - size_t num_child_plans_; - - /// The list of node manager names, each of them - /// corresponds to one child plan. - ACE_Vector<ACE_CString> node_manager_names_; - - /// Cached information for NodeManager, NodeApplicationManager, - /// NodeApplication, Connections, etc. - /// Key: NodeManager name with CString type. - /// Value: Chained_Artifacts struct type. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Chained_Artifacts, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Chained_Artifacts_Table; - - Chained_Artifacts_Table artifact_map_; - - /// Cached information of all the CIAO_Event_Service objects within - /// the deployment plan - /// Key: the string identifier of the CIAO_Event_Service - /// Value: the object reference of the CIAO_Event_Service - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - CIAO::CIAO_Event_Service_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Event_Service_Table; - - Event_Service_Table es_map_; - - /// The deployment information data file. - const char * deployment_file_; - - /// Deployment Configuration info, which contains the deployment topology. - Deployment_Configuration deployment_config_; - - /// UUID from the Plan - CORBA::String_var uuid_; - - /// Maintain a list of <Connections>, each of which is obtained by - /// calling the startLaunch() method on the NodeApplicationManager object. - ::Deployment::Connections_var all_connections_; - - /// This variable is used to control the execution path of some - /// member function implementations. The reason is because we want - /// to avoid unnecessary code duplicate. The default value is "false". - bool is_redeployment_; - - /// Cache the CIAO_Event_Service deployment description - CIAO::DAnCE::EventServiceDeploymentDescriptions_var esd_; - }; -} - -#if defined (__ACE_INLINE__) -# include "DomainApplicationManager_AMH_Impl.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* CIAO_DOMAINAPPLICATIONMANAGER_AMH_IMPL_H */ diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.inl b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.inl deleted file mode 100644 index d15c5e81a24..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMH_Impl.inl +++ /dev/null @@ -1,16 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_INLINE const char * -CIAO::DomainApplicationManager_AMH_Impl::get_uuid () const -{ - return this->uuid_; -} - -ACE_INLINE void -CIAO::DomainApplicationManager_AMH_Impl::set_uuid (const char * uuid) -{ - // Copy this uuid reference - this->uuid_ = CORBA::string_dup (uuid); -} diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMI_Impl.cpp b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMI_Impl.cpp deleted file mode 100644 index 38ee26e7c73..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMI_Impl.cpp +++ /dev/null @@ -1,201 +0,0 @@ -// $Id$ - -#include "DomainApplicationManager_AMI_Impl.h" -#include "ace/OS_NS_unistd.h" - -CIAO::DomainApplicationManager_AMI_Impl:: -DomainApplicationManager_AMI_Impl ( - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl *em, - const Deployment::DeploymentPlan &plan, - const char * deployment_file) - : DomainApplicationManager_AMH_Impl (orb, poa, manager, em, plan, deployment_file), - start_launch_reply_count_ (0) -{ -} - -void -CIAO::DomainApplicationManager_AMI_Impl:: -decrease_start_launch_reply_count () -{ - --this->start_launch_reply_count_; -} - -int -CIAO::DomainApplicationManager_AMI_Impl:: -start_launch_reply_count () -{ - return this->start_launch_reply_count_; -} - -void -CIAO::DomainApplicationManager_AMI_Impl:: -startLaunch (Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMI_Impl::startLaunch"); - ACE_UNUSED_ARG (start); - - ACE_DEBUG ((LM_ERROR, "Enter CIAO::DomainApplicationManager_AMI_Impl::startLaunch\n")); - - this->amh_response_handler_ = - Deployment::AMH_DomainApplicationManagerResponseHandler::_duplicate (_tao_rh); - - try - { - // Clean up all cached connections first - this->all_connections_->length (0); - - this->start_launch_reply_count_ = this->num_child_plans_; - - // Invoke startLaunch() operations on each cached NodeApplicationManager - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplicationManager object reference. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl:startLaunch", - error.c_str ())); - } - - ::Deployment::NodeApplicationManager_ptr my_nam = - (entry->int_id_).node_application_manager_.in (); - - if (CORBA::is_nil (my_nam)) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while narrowing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("While starting launch, the DomainApplicationManager\ - has a nil reference for NodeApplicationManager\n"); - ACE_DEBUG ((LM_DEBUG, error.c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::startLaunch", - error.c_str ())); - } - - // Create a reply handler struct - AMI_NAM_Handler ami_nam_handler; - - // Instantiate an reply handler servant object - ACE_NEW (ami_nam_handler.servant_, - Deployment_AMI_NodeApplicationManagerHandler_i (this)); - - ACE_DEBUG ((LM_ERROR, "Step 1\n")); - - PortableServer::ObjectId_var oid = - this->poa_->activate_object (ami_nam_handler.servant_); - - ACE_DEBUG ((LM_ERROR, "Step 2\n")); - - this->rh_oid_.push_back (oid.in ()); - - CORBA::Object_var handler_obj = poa_->id_to_reference (oid.in ()); - - ami_nam_handler.obj_ref_ = - Deployment::AMI_NodeApplicationManagerHandler::_narrow (handler_obj.in ()); - - this->ami_nam_handler_table_.bind (this->node_manager_names_[i], - ami_nam_handler); - - // Invoke operation asynchronously - my_nam->sendc_startLaunch (ami_nam_handler.obj_ref_.in (), - configProperty, 0); - } -/* - while (true) - { - // Check whether the reply has been returned - if (this->orb_->work_pending ()) - { - this->orb_->perform_work (); - - // if (this->start_launch_reply_count_ == 0) - // break; - } - } -*/ - } - catch (const Deployment::StartError& ex) - { - ACE_DEBUG ((LM_DEBUG, "DAM_Impl:StartError: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::startLaunch\t\n"); - throw; - } - ACE_DEBUG ((LM_ERROR, "Exit CIAO::DomainApplicationManager_AMI_Impl::startLaunch\n")); -} - - -void -CIAO::DomainApplicationManager_AMI_Impl:: -post_ami_startLaunch () -{ - CIAO_TRACE("CIAO::DomainApplicationManager_AMI_Impl::post_ami_startLaunch"); - - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_ERROR, - "CIAO (%P|%t):DomainApplicationManager_AMI_Impl::post_ami_startLaunch called\n")); - - - for (AMI_NAM_Handler_Table_Iterator iter (this->ami_nam_handler_table_.begin ()); - iter != this->ami_nam_handler_table_.end (); - ++iter) - { - // Cache the returned set of connections into the list. - this->add_connections (iter->int_id_.servant_->get_connections ()); - - // Cache the returned NodeApplication object reference into - // the chained artifact table. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - this->artifact_map_.find (iter->ext_id_, // node name - entry); - - (entry->int_id_).node_application_ = - Deployment::NodeApplication::_duplicate ( - iter->int_id_.servant_->get_node_app ()); - } - - this->amh_response_handler_->startLaunch (); - - for (size_t i = 0; i < this->rh_oid_.size (); ++i) - this->poa_->deactivate_object (this->rh_oid_[i].in ()); - - this->rh_oid_.clear (); -} diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMI_Impl.h b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMI_Impl.h deleted file mode 100644 index 50e3cc7c30b..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMI_Impl.h +++ /dev/null @@ -1,96 +0,0 @@ -//================================================================== -/** - * @file DomainApplicationManager_AMI_Impl.h - * - * $Id$ - * - * This file contains implementation for the servant of - * Deployment::DomainApplicationManager_AMI_Impl. - * - * @author Gan Deng <gan.deng@vanderbilt.edu> - */ -//===================================================================== - -#ifndef CIAO_DOMAINAPPLICATIONMANAGER_AMI_IMPL_H -#define CIAO_DOMAINAPPLICATIONMANAGER_AMI_IMPL_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DomainApplicationManager_AMH_Impl.h" -#include "Reply_Handler_i.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationManagerC.h" -#include "DAnCE/Deployment/Deployment_ApplicationC.h" - -namespace CIAO -{ - /** - * @class DomainApplicationManager_AMI_Impl - * - * @brief A subclass of the DomainApplicationManager_Impl servant - * which uses AMI mechanism to handle deployment. - */ - class DomainApplicationManager_Export DomainApplicationManager_AMI_Impl - : public DomainApplicationManager_AMH_Impl - { - public: - /// Constructor - DomainApplicationManager_AMI_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl *em, - const Deployment::DeploymentPlan &plan, - const char * deployment_file); - - virtual void - startLaunch (Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh, - const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start); - - /// This operation will be called after *all* the AMI callbacks - /// are received - void - post_ami_startLaunch (void); - - void decrease_start_launch_reply_count (void); - - int start_launch_reply_count (void); - - private: - typedef struct - { - Deployment_AMI_NodeApplicationManagerHandler_i * servant_; - ::Deployment::AMI_NodeApplicationManagerHandler_var obj_ref_; - } AMI_NAM_Handler; - - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - AMI_NAM_Handler, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> AMI_NAM_Handler_Table; - typedef AMI_NAM_Handler_Table::iterator AMI_NAM_Handler_Table_Iterator; - - /// A table to trace the AMI reply handler - AMI_NAM_Handler_Table ami_nam_handler_table_; - - /// Disable copy assignment - DomainApplicationManager_AMI_Impl (const DomainApplicationManager_AMI_Impl&); - - /// AMI reply count - volatile int start_launch_reply_count_; - - /// Object reference of the AMH response handler - Deployment::AMH_DomainApplicationManagerResponseHandler_var amh_response_handler_; - - /// Object ID of the AMH response handler - //PortableServer::ObjectId_var rh_oid_; - ACE_Vector<PortableServer::ObjectId_var> rh_oid_; - }; -} - -#include /**/ "ace/post.h" -#endif /* CIAO_DOMAINAPPLICATIONMANAGER_AMI_IMPL_H */ diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_ActiveObject_Impl.cpp b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_ActiveObject_Impl.cpp deleted file mode 100644 index cb1d27c305f..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_ActiveObject_Impl.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// $Id$ - -#include "DomainApplicationManager_ActiveObject_Impl.h" -#include "ace/OS_NS_unistd.h" - -CIAO::DomainApplicationManager_ActiveObject_Impl:: -DomainApplicationManager_ActiveObject_Impl ( - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl *em, - const Deployment::DeploymentPlan &plan, - const char * deployment_file) - : DomainApplicationManager_Impl (orb, poa, manager, em, plan, deployment_file) -{ -} - -void -CIAO::DomainApplicationManager_ActiveObject_Impl:: -startLaunch (const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_ActiveObject_Impl::startLaunch"); - ACE_UNUSED_ARG (start); - - try - { - // Clean up all cached connections first - this->all_connections_->length (0); - - // Invoke startLaunch() operations on each cached NodeApplicationManager - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplicationManager object reference. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl:startLaunch", - error.c_str ())); - } - - ::Deployment::NodeApplicationManager_ptr my_nam = - (entry->int_id_).node_application_manager_.in (); - - if (CORBA::is_nil (my_nam)) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while narrowing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("While starting launch, the DomainApplicationManager\ - has a nil reference for NodeApplicationManager\n"); - ACE_DEBUG ((LM_DEBUG, error.c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::startLaunch", - error.c_str ())); - } - - // Create a startLaunch task - Task_StartLaunch * task; - - ACE_NEW (task, - Task_StartLaunch (this->node_manager_names_[i].c_str (), - my_nam, - configProperty)); - - this->start_launch_task_table_.bind (this->node_manager_names_[i], - task); - - // Activate as an active object - task->activate (THR_NEW_LWP | THR_JOINABLE); - } - - // Wait for the completion of the task - start_launch_task_table_.begin ()->int_id_->thr_mgr()->wait (); - - // Collect the results of each startLaunch task - for (StartLaunch_Task_Table_Iterator iter (this->start_launch_task_table_.begin ()); - iter != this->start_launch_task_table_.end (); - ++iter) - { - ACE_DEBUG ((LM_ERROR, "**********************Table size [%d]\n", - this->start_launch_task_table_.current_size ())); - - ACE_DEBUG ((LM_ERROR, "**********************Step 2.1\n")); - - // Cache the returned set of connections into the list. - this->add_connections (iter->int_id_->get_connections ()); - - // Cache the returned NodeApplication object reference into - // the chained artifact table. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - ACE_DEBUG ((LM_ERROR, "**********************Step 2.2\n")); - this->artifact_map_.find (iter->ext_id_, // node name - entry); - - ACE_DEBUG ((LM_ERROR, "**********************Step 2.3\n")); - (entry->int_id_).node_application_ = - Deployment::NodeApplication::_duplicate ( - iter->int_id_->get_node_app ()); - - ACE_DEBUG ((LM_ERROR, "**********************Step 2.4\n")); - } - - ACE_DEBUG ((LM_ERROR, "******************Step 3\n")); - } - catch (const Deployment::StartError& ex) - { - ACE_DEBUG ((LM_DEBUG, "DAM_Impl:StartError: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_ActiveObject_Impl::startLaunch\t\n"); - throw; - } - -} diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_ActiveObject_Impl.h b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_ActiveObject_Impl.h deleted file mode 100644 index 12ce2e69638..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_ActiveObject_Impl.h +++ /dev/null @@ -1,68 +0,0 @@ -//================================================================== -/** - * @file DomainApplicationManager_ActiveObject_Impl.h - * - * $Id$ - * - * This file contains implementation for the servant of - * Deployment::DomainApplicationManager_AMI_Impl. - * - * @author Gan Deng <gan.deng@vanderbilt.edu> - */ -//===================================================================== - -#ifndef CIAO_DOMAINAPPLICATIONMANAGER_ACTIVE_OBJECT_IMPL_H -#define CIAO_DOMAINAPPLICATIONMANAGER_ACTIVE_OBJECT_IMPL_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DomainApplicationManager_Impl.h" -#include "Task_StartLaunch.h" - -namespace CIAO -{ - /** - * @class DomainApplicationManager_ActiveObject_Impl - * - * @brief A subclass of the DomainApplicationManager_Impl servant - * which uses active object mechanism to handle deployment. Internally - * it spawns threads with each thread runs an active object - * to invoke the remote invocation, such as invoking startLaunch - * on a corresponding NodeApplicationManager. - */ - class DomainApplicationManager_Export DomainApplicationManager_ActiveObject_Impl - : public DomainApplicationManager_Impl - { - public: - /// Constructor - DomainApplicationManager_ActiveObject_Impl ( - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl *em, - const Deployment::DeploymentPlan &plan, - const char * deployment_file); - - virtual void - startLaunch (const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start); - - private: - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Task_StartLaunch *, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> StartLaunch_Task_Table; - typedef StartLaunch_Task_Table::iterator StartLaunch_Task_Table_Iterator; - - StartLaunch_Task_Table start_launch_task_table_; - }; -} - -#include /**/ "ace/post.h" -#endif /* CIAO_DOMAINAPPLICATIONMANAGER_ACTIVE_OBJECT_IMPL_H */ diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp index 560f9feec5d..b9956127f84 100644 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp +++ b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp @@ -1,408 +1,312 @@ // $Id$ #include "DomainApplicationManager_Impl.h" -#include "ExecutionManager/Execution_Manager_Impl.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationManagerC.h" -#include "ace/Null_Mutex.h" -#include "ace/OS_NS_string.h" -#include "ace/SString.h" -#include "ace/Assert.h" +#include "Deployment/Deployment_ConnectionC.h" +#include "DAnCE/Logger/Log_Macros.h" -#if !defined (__ACE_INLINE__) -# include "DomainApplicationManager_Impl.inl" -#endif /* __ACE_INLINE__ */ +using namespace DAnCE; -CIAO::DomainApplicationManager_Impl:: -DomainApplicationManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl * em, - const Deployment::DeploymentPlan & plan, - const char * deployment_file) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - execution_manager_ (em), // a plain C++ pointer - target_manager_ (Deployment::TargetManager::_duplicate (manager)), // object ref - plan_ (plan), - num_child_plans_ (0), - // @@ (OO) The default size for an ACE_Hash_Map_Mapanger is quiet - // large. The maximum size of an ACE_Hash_Map_Manager is - // also fixed, i.e. it does not grow dynamically on demand. - // Make sure the default size of artifact_map_ is - // appropriate for your needs. You may also want to make - // the size configurable at compile-time, at least. - // - // Need to initialize chained artifacts here. - // - deployment_file_ (CORBA::string_dup (deployment_file)), - deployment_config_ (orb), - uuid_ (plan.UUID), - is_redeployment_ (false), - esd_ (0) +DomainApplicationManager_Impl::DomainApplicationManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const Deployment::DeploymentPlan& plan, + Node_Locator & nodes) + : orb_ (CORBA::ORB::_duplicate (orb)) + , poa_ (PortableServer::POA::_duplicate (poa)) + , plan_ (plan) + , nodes_ (nodes) { - ACE_NEW_THROW_EX (this->all_connections_, - Deployment::Connections (), - CORBA::NO_MEMORY ()); - - ACE_NEW_THROW_EX (this->shared_, - Deployment::ComponentPlans (), - CORBA::NO_MEMORY ()); - - ACE_NEW_THROW_EX (this->esd_, - CIAO::DAnCE::EventServiceDeploymentDescriptions (), - CORBA::NO_MEMORY ()); - - for (CORBA::ULong i = 0; i < this->plan_.infoProperty.length (); ++i) - { - if (ACE_OS::strcmp (this->plan_.infoProperty[i].name.in (), - "CIAOEvents") != 0) - continue; - - // Note, we should do a sanity check here to make - // sure we didn't pick up the wrong infoProperty!! - this->plan_.infoProperty[0].value >>= this->esd_; - break; - } - - this->init (); + DANCE_TRACE(DLINFO "DomainApplicationManager_Impl::DomainApplicationManager_Impl"); + this->preparePlan(); + DANCE_DEBUG((LM_DEBUG, DLINFO "DomainApplicationManager_Impl::DomainApplicationManager_Impl - " + "Successfully prepared plan : %C\n", this->plan_.UUID.in())); } -CIAO::DomainApplicationManager_Impl::~DomainApplicationManager_Impl () +DomainApplicationManager_Impl::~DomainApplicationManager_Impl() { - if (CIAO::debug_level () > 1) + DANCE_TRACE( "DomainApplicationManager_Impl::~DomainApplicationManager_Impl()"); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplicationManager_Impl::~DomainApplicationManager_Impl - " + "Destroying %u applications\n", this->running_app_.size())); + while (0 < this->running_app_.size()) { - ACE_DEBUG ((LM_DEBUG, "DomainApplicationManager destroyed\n")); + DomainApplication_Impl* p = this->running_app_[this->running_app_.size()-1]; + Deployment::DomainApplication_var app = + Deployment::DomainApplication::_narrow (this->poa_->servant_to_reference (p)); + PortableServer::ObjectId_var id = this->poa_->reference_to_id (app); + DANCE_DEBUG((LM_TRACE, DLINFO "DomainApplicationManager_impl::~DomainApplicationManager_impl - " + "deactivating DomainApplication object...\n")); + this->poa_->deactivate_object (id); + DANCE_DEBUG((LM_DEBUG, DLINFO "DomainApplicationManager_impl::~DomainApplicationManager_impl - " + "deleting DomainApplication.\n")); + this->running_app_.pop_back(); + delete p; } -} - -Deployment::NodeApplication_ptr -CIAO::DomainApplicationManager_Impl::get_node_app (const char * node_name) -{ - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - if (this->artifact_map_.find (node_name, entry) != 0) + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplicationManager_Impl::~DomainApplicationManager_Impl - " + "Destroying %u managers\n", this->sub_app_mgr_.current_size())); + for (DomainApplication_Impl::TNam2Nm::iterator iter = this->sub_app_mgr_.begin(); + iter != this->sub_app_mgr_.end(); + ++iter) { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::get_node_app -" - "ERROR while finding the node application " - "for the node [%s] \n", - node_name)); - throw Deployment::NoSuchName (); + (*iter).int_id_->destroyManager ( (*iter).ext_id_.in()); } - - return - Deployment::NodeApplication::_duplicate ( - entry->int_id_.node_application_.in ()); + this->sub_app_mgr_.unbind_all(); } -void -CIAO::DomainApplicationManager_Impl::init () +Deployment::Application_ptr +DomainApplicationManager_Impl::startLaunch (const Deployment::Properties & configProperty, + Deployment::Connections_out providedReference) { - try - { + DANCE_TRACE( "DomainApplicationManager_impl::startLaunch"); - //Deployment::DnC_Dump::dump (this->plan_); - /* - //====================================== - // Dump the contents of infoProperty to a XML file - if (CIAO::debug_level () > 1) - { - CIAO::DAnCE::ServerResource *sr = 0; - this->plan_.infoProperty[0].value >>= sr; - - Config_Handlers::SRD_Handler reverse_handler (sr); + ::Deployment::Connections_var connections; + ACE_NEW_THROW_EX (connections, + Deployment::Connections (), + CORBA::NO_MEMORY ()); + DomainApplication_Impl* app = 0; + ACE_NEW_THROW_EX (app, + DomainApplication_Impl (this->sub_app_mgr_, + configProperty, + connections.inout()), + CORBA::NO_MEMORY()); - Config_Handlers::XML_Helper the_helper; - xercesc::DOMDocument *the_xsc - (the_helper.create_dom ("CIAO:ServerResources", - "http://www.dre.vanderbilt.edu/ServerResources")); + providedReference = connections._retn(); - ServerResources (*reverse_handler.srd_xsc (), the_xsc); + PortableServer::ObjectId_var id = this->poa_->activate_object (app); + this->running_app_.push_back(app); - // write out the result - the_helper.write_DOM (the_xsc, "output.srd"); - } - */ - //====================================== + DANCE_DEBUG ((LM_TRACE, "DomainApplicationManager_Impl::startLaunch - " + "Successfully created DomainApplication\n")); + DANCE_DEBUG ((LM_TRACE, "DomainApplicationManager_Impl::startLaunch - " + "Created %u provided references\n", + providedReference->length ())); - // (1) Call get_plan_info() method to get the total number - // of child plans and list of NodeManager names, and - // (2) Check the validity of the global deployment plan. - if (! this->get_plan_info ()) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::init -" - "ERROR while calling get_plan_info () \n")); - throw Deployment::PlanError (); - } + CORBA::Object_var ref = this->poa_->id_to_reference (id); + return Deployment::DomainApplication::_narrow (ref.in ()); +} - // Call split_plan() - if (! this->split_plan ()) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::init -" - "ERROR while calling split_plan () \n")); - throw Deployment::PlanError (); - } +void +DomainApplicationManager_Impl::destroyApplication (Deployment::Application_ptr application) +{ + DANCE_TRACE ( "DomainApplicationManager_Impl::destroyApplication"); - // Invoke preparePlan on each NodeManager by giving child plan. - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) + try + { + for (size_t i = 0; i < this->running_app_.size(); ++i) { - // Get the NodeManager object reference. - ::Deployment::NodeManager_var my_node_manager = - this->deployment_config_.get_node_manager - (this->node_manager_names_[i].c_str ()); - - // Get the child deployment plan reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) + DomainApplication_Impl* p = this->running_app_[i]; + Deployment::DomainApplication_var app = + Deployment::DomainApplication::_narrow (this->poa_->servant_to_reference (p)); + if (application->_is_equivalent (app.in())) { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::init -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - throw Deployment::PlanError (); - } - - Chained_Artifacts & artifacts = entry->int_id_; - - // Call preparePlan() method on the NodeManager with the - // corresponding child plan as input, which returns a - // NodeApplicationManager object reference. - Deployment::ApplicationManager_var tmp_app_manager = - my_node_manager->preparePlan (artifacts.child_plan_.in ()); - - Deployment::NodeApplicationManager_var app_manager = - Deployment::NodeApplicationManager::_narrow - (tmp_app_manager.in ()); - - if (CORBA::is_nil (app_manager.in ())) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::init -" - "ERROR while narroing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error ("DomainAppMgr::init () received a nil \ - reference for NodeApplicationManager\n"); - - ACE_DEBUG ((LM_DEBUG, error.c_str ())); - throw - (Deployment::StartError ("DomainApplicationManager_Impl:init", - error.c_str ())); + PortableServer::ObjectId_var id = this->poa_->reference_to_id (application); + DANCE_DEBUG((LM_TRACE, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "deactivating application object\n")); + this->poa_->deactivate_object (id); + DANCE_DEBUG((LM_TRACE, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "deleting application object\n")); + delete p; + for (size_t j = i + 1; j < this->running_app_.size(); ++j) + { + this->running_app_[j-1] = this->running_app_[j]; + } + this->running_app_.pop_back(); + return; } - - // Cache the NodeApplicationManager object reference. - artifacts.node_application_manager_ = app_manager._retn (); } } - catch (const CORBA::Exception& ex) + catch (const Deployment::StopError &e) { - ex._tao_print_exception ("DomainApplicationManager_Impl::init\t\n"); - throw; + ACE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "Propagating a received StopError exception\n")); + throw e; } -} - -bool -CIAO::DomainApplicationManager_Impl::get_plan_info (void) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::get_plan_info"); - - // Read the deployment.dat file and get to know the different nodes - // that are present in the deployment domain. - // We should be able to replace this way, by parsing the domain - // descriptor to get to know more on the domain. - // - if ( this->deployment_config_.init (this->deployment_file_) == -1 ) + catch (...) { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::get_plan_info -" - "ERROR while trying to initialize after reading " - "deployment DAT file \n")); - return 0; + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "Caught unknown exception.")); + throw Deployment::StopError(); } - // Error: If there are no nodes in the plan => No nodes to deploy the - // components - CORBA::ULong const length = this->plan_.instance.length (); - - if (length == 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::get_plan_info -" - "ERROR while trying to get the total instances to " - "be deployed \n")); - return false; - } + ACE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "Provided application reference unknown\n")); + throw Deployment::StopError(); +} - // Copy the name of the node in the plan on to the node manager - // array, Making sure that duplicates are not added. - // - // OPTIMIZATION: - // We can parse the domain descriptor and the size of the node - // data structure is the size of the num_plans and - // the individual node names need to be entered into the - // node_manager_map. - // - int num_plans = 0; - this->node_manager_names_.clear (); +::Deployment::Applications * +DomainApplicationManager_Impl::getApplications () +{ + DANCE_TRACE ( "DomainApplicationManager_Impl::getApplications ()"); - for (CORBA::ULong index = 0; index < length; index ++) + Deployment::Applications* running_app = 0; + ACE_NEW_THROW_EX (running_app, + Deployment::Applications(), + CORBA::NO_MEMORY()); + running_app->length (this->running_app_.size()); + unsigned int index = 0; + for (size_t i = 0; i < this->running_app_.size(); ++i) { - bool matched = false; + CORBA::Object_var ref = this->poa_->servant_to_reference (this->running_app_[i]); + (*running_app) [index++] = + Deployment::DomainApplication::_narrow (ref.in ()); + } - const CORBA::ULong number_node_managers = - this->node_manager_names_.size (); + DANCE_DEBUG((LM_DEBUG, DLINFO "DomainApplicationManager_impl::getApplications - " + "Returning %u running applications\n", + running_app->length ())); + return running_app; +} - for (CORBA::ULong i = 0; i < number_node_managers; ++i) - // If a match is found do not add it to the list of unique - // node names - if (ACE_OS::strcmp (this->plan_.instance [index].node.in (), - (this->node_manager_names_ [i]).c_str ()) == 0) - { - // Break out -- Duplicates found - matched = true; - break; - } +::Deployment::DeploymentPlan * +DomainApplicationManager_Impl::getPlan () +{ + DANCE_TRACE ( DLINFO "DomainApplicationManager_Impl::getPlan ()"); - if (! matched) - { - // Check if there is a corresponding NodeManager instance existing - // If not present return false - ::Deployment::NodeManager_var mgr = - this->deployment_config_.get_node_manager - (this->plan_.instance [index].node.in ()); + Deployment::DeploymentPlan* plan = 0; - if (CORBA::is_nil (mgr.in ())) - return false; /* Failure */ + ACE_NEW_THROW_EX (plan, + Deployment::DeploymentPlan (this->plan_), + CORBA::NO_MEMORY()); - // Add this unique node_name to the list of NodeManager names - this->node_manager_names_.push_back (this->plan_.instance [index].node.in ()); + return plan; +} - // Increment the number of plans - ++num_plans; - } - } +// This methhod is commented because it requred rework for processing connections +// sequence together with correspondent DeploymentPlan +void +DomainApplicationManager_Impl:: +dump_connections (const ::Deployment::Connections & /*connections*/) const +{ + DANCE_DEBUG((LM_DEBUG, DLINFO "DomainApplicationManager_impl::dump_connections - started\n")); - // Set the length of the Node Managers + // CIAO_TRACE("CIAO::DomainApplicationManager_Impl::dump_connections"); + // const CORBA::ULong conn_len = connections.length (); + // for (CORBA::ULong i = 0; i < conn_len; ++i) + // { + // DANCE_DEBUG((LM_DEBUG, "[%M] instanceName: %C\n", connections[i].instanceName.in ())); + // + // DANCE_DEBUG((LM_DEBUG, "[%M] portName: %C\n", connections[i].portName.in ())); // - // why cannot we use the provate variable in the above "for" loop? + // DANCE_DEBUG((LM_DEBUG, "[%M] portkind: ")); // - this->num_child_plans_ = num_plans; + // switch (connections[i].kind) + // { + // case Deployment::Facet: + // + // DANCE_DEBUG((LM_DEBUG, "[%M] Facet\n")); + // break; + // + // case Deployment::SimplexReceptacle: + // + // DANCE_DEBUG((LM_DEBUG, "[%M] SimplexReceptacle\n")); + // break; + // + // case Deployment::MultiplexReceptacle: + // + // DANCE_DEBUG((LM_DEBUG, "[%M] MultiplexReceptacle\n")); + // break; + // + // case Deployment::EventEmitter: + // + // DANCE_DEBUG((LM_DEBUG, "[%M] EventEmitter\n")); + // break; + // + // case Deployment::EventPublisher: + // + // DANCE_DEBUG((LM_DEBUG, "[%M] EventPublisher\n")); + // break; + // + // case Deployment::EventConsumer: + // + // DANCE_DEBUG((LM_DEBUG, "[%M] EventConsumer\n")); + // break; + // + // default: + // DANCE_DEBUG((LM_DEBUG, "[%M] Unknown port kind.\n")); + // } + // + // DANCE_DEBUG((LM_DEBUG, "[%M] endpointInstanceName: %C\n", + // connections[i].endpointInstanceName.in ())); + // + // DANCE_DEBUG((LM_DEBUG, "[%M] endpointPortName: %C\n", + // connections[i].endpointPortName.in ())); + // DANCE_DEBUG((LM_DEBUG, "[%M] ---------------------\n")); + // } - // Indicate success - return true; + DANCE_DEBUG((LM_DEBUG, DLINFO "DomainApplicationManager_impl::dump_connections - finished\n")); } -//@@ We should ask those spec writers to look at the code below, hopefully -// They will realize some thing. -int -CIAO::DomainApplicationManager_Impl::split_plan (void) +void +DomainApplicationManager_Impl::split_plan (const Deployment::DeploymentPlan & plan, + TNodePlans & sub_plans) { - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::split_plan"); - - // Initialize the total number of child deployment plans specified - // by the global plan. - CORBA::ULong i; - - for ( i = 0; i < this->num_child_plans_; ++i) - { - ::Deployment::DeploymentPlan_var tmp_plan; - ACE_NEW_RETURN (tmp_plan, - ::Deployment::DeploymentPlan, - 0); - - // Construct the UUID for the child plan. - // Currently, this UUID consists of: - // The global UUID for the parent plan + the name of the node the - // child plan is to be installed on. - ACE_CString child_uuid (this->plan_.UUID.in ()); - child_uuid += "@"; - child_uuid += this->node_manager_names_[i]; + DANCE_TRACE ( "DomainApplicationManager_Impl::split_plan"); - tmp_plan->UUID = CORBA::string_dup (child_uuid.c_str ()); - tmp_plan->implementation.length (0); - tmp_plan->instance.length (0); - tmp_plan->connection.length (0); - tmp_plan->externalProperty.length (0); - tmp_plan->dependsOn.length (0); - tmp_plan->artifact.length (0); - - // @@ There is an optimization point here, since we really don't have to - // pass the entire CIAOServerResources into each individual child plan. - tmp_plan->infoProperty = this->plan_.infoProperty; + DANCE_DEBUG ((LM_TRACE, "DomainApplicationManager_Impl::split_plan - " + "Creating sub-plans\n")); + // Create empty sub-plans + for (CORBA::ULong i = 0; i < plan.instance.length(); ++i) + { + ACE_CString node = plan.instance[i].node.in(); + if (0 == sub_plans.find (node)) continue; - //tmp_plan->infoProperty[0].name = CORBA::string_dup ("CIAOServerResource"); - //tmp_plan->infoProperty[0].value = this->plan_.infoProperty[0].value; + ::Deployment::DeploymentPlan tmp_plan; - Chained_Artifacts artifacts; + // Construct the UUID for the child plan. + // Currently, this UUID consists of: + // The global UUID for the parent plan + the name of the node the + // child plan is to be installed on. + ACE_CString child_uuid (plan.UUID.in ()); + // child_uuid += "@"; CCM#61 + // child_uuid += node; - // Fill in the child_plan_ field, relinquishing ownership - artifacts.child_plan_ = tmp_plan._retn (); + tmp_plan.UUID = CORBA::string_dup (child_uuid.c_str()); + tmp_plan.implementation.length (0); + tmp_plan.instance.length (0); + tmp_plan.connection.length (0); + tmp_plan.externalProperty.length (0); + tmp_plan.dependsOn.length (0); + tmp_plan.artifact.length (0); - // Fill in the node_manager_ field. - artifacts.node_manager_ = - this->deployment_config_.get_node_manager - (this->node_manager_names_[i].c_str ()); + // @@ There is an optimization point here, since we really don't have to + // pass the entire CIAOServerResources into each individual child plan. + tmp_plan.infoProperty = plan.infoProperty; - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; + sub_plans.bind (node, tmp_plan); - if (this->artifact_map_.find - (node_manager_names_[i], entry) == 0) - artifacts.old_child_plan_ = (entry->int_id_).child_plan_; - else - artifacts.old_child_plan_ = 0; + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplicationManager_Impl::split_plan - " + "Created sub-plan for node %C with UUID %C\n", + node.c_str (), child_uuid.c_str ())); + } - // In case we are doing redeployment, rebind will help replace the - // old child plan with the new child plan. - this->artifact_map_.rebind (node_manager_names_[i], artifacts); - } + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplicationManager_Impl::split_plan - " + "First phase produced %u child plans, proceeding to second\n")); // (1) Iterate over the <instance> field of the global DeploymentPlan // structure. // (2) Retrieve the necessary information to contruct the node-level // plans one by one. - for ( i = 0; i < (this->plan_.instance).length (); ++i) + for (CORBA::ULong i = 0; i < plan.instance.length (); ++i) { + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplicationManager_Impl::split_plan - " + "Processing instance : %C\n", plan.instance[i].name.in())); // @@TODO Fill in the child deployment plan in the map. // If the component instance already exists in the child plan, // then we overwrite the existing instance, since the new instance // might have different resource usage requirements. - - // Get the instance deployment description - const ::Deployment::InstanceDeploymentDescription & my_instance = - (this->plan_.instance)[i]; - - // Find the corresponding child deployment plan entry in - // the hash map for this instance. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find - (ACE_CString (my_instance.node.in ()), - entry) != 0) - return 0; // no valid name found. + const ::Deployment::InstanceDeploymentDescription & my_instance = plan.instance[i]; // Get the child plan. - ::Deployment::DeploymentPlan_var &child_plan = - (entry->int_id_).child_plan_; + ::Deployment::DeploymentPlan child_plan; + + if (0 != sub_plans.find (ACE_CString (my_instance.node.in()), child_plan)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::split_plan - " + "ERROR: Unable to find sub-plan for instance %C\n", + my_instance.node.in ())); + } // Fill in the contents of the child plan entry. @@ -410,17 +314,12 @@ CIAO::DomainApplicationManager_Impl::split_plan (void) // field with a new "implementation", which is specified by the // <implementationRef> field of <my_instance> entry. NOTE: The // <artifactRef> field needs to be changed accordingly. - const ::Deployment::MonolithicDeploymentDescription & my_implementation = - (this->plan_.implementation)[my_instance.implementationRef]; - - // Deployment::DnC_Dump::dump (this->plan_); - //Deployment::DnC_Dump::dump ( (this->plan_.implementation)[my_instance.implementationRef]); - //ACE_DEBUG ((LM_DEBUG, "My implementation")); - //Deployment::DnC_Dump::dump (my_implementation); + const ::Deployment::MonolithicDeploymentDescription & my_implementation + = plan.implementation[my_instance.implementationRef]; - CORBA::ULong index_imp = child_plan->implementation.length (); - child_plan->implementation.length (++index_imp); - child_plan->implementation[index_imp-1] = my_implementation; + CORBA::ULong index_imp = child_plan.implementation.length (); + child_plan.implementation.length (++index_imp); + child_plan.implementation[index_imp-1] = my_implementation; // Initialize with the correct sequence length. CORBA::ULongSeq ulong_seq; @@ -437,1541 +336,165 @@ CIAO::DomainApplicationManager_Impl::split_plan (void) CORBA::ULong artifact_ref = my_implementation.artifactRef[iter]; // Fill in the <artifact> field of the child plan - CORBA::ULong index_art = child_plan->artifact.length (); - child_plan->artifact.length (++index_art); - child_plan->artifact[index_art-1] = - (this->plan_.artifact)[artifact_ref]; + CORBA::ULong index_art = child_plan.artifact.length (); + child_plan.artifact.length (++index_art); + child_plan.artifact[index_art-1] = plan.artifact[artifact_ref]; // Fill in the <artifactRef> field of the MonolithicDeploymentDescription - ulong_seq[iter] = index_art-1; + ulong_seq[iter] = index_art - 1; } // Change the <artifactRef> field of the "implementation". - child_plan->implementation[index_imp-1].artifactRef = ulong_seq; + child_plan.implementation[index_imp-1].artifactRef = ulong_seq; // Append the "InstanceDeploymentDescription instance" field with // a new "instance", which is almost the same as the "instance" in // the global plan except the <implementationRef> field. // NOTE: The <implementationRef> field needs to be changed accordingly. - CORBA::ULong index_ins = child_plan->instance.length (); - child_plan->instance.length (++index_ins); - child_plan->instance[index_ins-1] = my_instance; + CORBA::ULong index_ins = child_plan.instance.length (); + child_plan.instance.length (++index_ins); + child_plan.instance[index_ins-1] = my_instance; // Change the <implementationRef> field of the "instance". // @@ The implementationRef starts from 0. // @@TODO: Below logic needs to be changed once we want to avoid // duplicate <implementation> for the optimization. - child_plan->instance[index_ins-1].implementationRef = index_ins-1; - } - - return 1; -} - -void -CIAO::DomainApplicationManager_Impl:: -add_connections (const Deployment::Connections & incoming_conn) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::add_connections"); - - CORBA::ULong const old_len = this->all_connections_->length (); + child_plan.instance[index_ins-1].implementationRef = index_imp - 1; - // Expand the length of the <all_connection_> sequence. - this->all_connections_->length (old_len + incoming_conn.length ()); - - // Store the connections to the <all_conections_> sequence - const CORBA::ULong conn_lenth = incoming_conn.length (); - for (CORBA::ULong i = 0; i < conn_lenth; ++i) - { - (*this->all_connections_)[old_len + i] = incoming_conn[i]; - } -} - -void -CIAO::DomainApplicationManager_Impl:: -startLaunch (const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::startLaunch"); - ACE_UNUSED_ARG (start); - - try - { - // Clean up all cached connections first - this->all_connections_->length (0); - - // Invoke startLaunch() operations on each cached NodeApplicationManager - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplicationManager_Impl::split_plan - " + "Processing connections.\n")); + // Copy connections + for (CORBA::ULong j = 0; j < plan.connection.length(); ++j) { - // Get the NodeApplicationManager object reference. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplicationManager_Impl::split_plan - " + "For connection : %C\n", plan.connection[j].name.in())); + for (CORBA::ULong k = 0; k < plan.connection[j].internalEndpoint.length(); ++k) { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl:startLaunch", - error.c_str ())); - } - - ::Deployment::NodeApplicationManager_ptr my_nam = - (entry->int_id_).node_application_manager_.in (); - - if (CORBA::is_nil (my_nam)) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while narrowing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("While starting launch, the DomainApplicationManager\ - has a nil reference for NodeApplicationManager\n"); - ACE_DEBUG ((LM_DEBUG, error.c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::startLaunch", - error.c_str ())); - } - - - ::Deployment::Connections_var retn_connections; - - // Obtained the returned NodeApplication object reference - // and the returned Connections variable. - ::Deployment::Application_var temp_application; - if (!is_redeployment_) - { - temp_application = - my_nam->startLaunch (configProperty, - retn_connections.out (), - 0); - } - else - { - //============================================================= - // Add New Components Logic - //============================================================= - // Let's add new components only now, the to-be-removed - // components should be removed AFTER the connections - // are removed. - temp_application = - my_nam->perform_redeployment (configProperty, - retn_connections.out (), - true, // add new components only now - 0); - } - - // Narrow down to NodeApplication object reference - ::Deployment::NodeApplication_var my_na = - ::Deployment::NodeApplication::_narrow (temp_application.in ()); - - if (CORBA::is_nil (my_na.in ())) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while narrowing the NAM " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("The DomainApplicationManager receives a nil " - "reference of NodeApplication after calling " - "startLaunch on NodeApplicationManager.\n"); - ACE_ERROR ((LM_ERROR, error.c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::startLaunch", - error.c_str ())); - } - - // Cache the returned set of connections into the list. - this->add_connections (retn_connections.in ()); - - // Cache the returned NodeApplication object reference into - // the hash table. - (entry->int_id_).node_application_ = my_na._retn (); - } - - this->synchronize_shared_components_with_node_managers (); - } - catch (const Deployment::StartError& ex) - { - ACE_DEBUG ((LM_DEBUG, "DAM_Impl:StartError: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::startLaunch\t\n"); - throw; - } - -} - - -void -CIAO::DomainApplicationManager_Impl::install_all_es (void) -{ - try - { - for (CORBA::ULong j = 0; j < this->esd_->length (); ++j) - { - // Find NA, and then invoke operation on it - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->esd_[j].node.in (), - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::install_all_es -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->esd_[j].node.in ())); - - ACE_CString error - ("Unable to resolve a reference to NodeManager: "); - error += this->esd_[j].node.in (); - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::install_all_es", - error.c_str ())); - } - - // Invoke install_es () operation on each cached NodeApplication object. - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - ::CIAO::CIAO_Event_Service_var ciao_es = - my_na->install_es (this->esd_[j]); - - // Add these returned ES objects into the cached map - this->add_es_to_map (this->esd_[j].name.in (), ciao_es.in ()); - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::install_all_es.\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_Impl:: -add_es_to_map (const char * node_name, - CIAO::CIAO_Event_Service * ciao_es) -{ - try - { - this->es_map_.bind ( - node_name, - CIAO::CIAO_Event_Service::_duplicate (ciao_es)); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::add_es_to_map.\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_Impl:: -finishLaunch (CORBA::Boolean start, - CORBA::Boolean is_ReDaC) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::finishLaunch"); - try - { - // Install all the CIAO_Event_Services within the Deployment Plan - this->install_all_es (); - - // Invoke finishLaunch() operation on each cached NodeApplication object. - // This will establish bindings for only those internal components, but - // NOT for those external/shared components, which requires special - // handling, since these components are outside the control of this - // DomainApplicationManager. - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> * entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::finishLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to NodeManager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::finishLaunch", - error.c_str ())); - } - - //@@ Note: Don't delete the below debugging helpers. - // Dump the connections for debug purpose. - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - ACE_DEBUG ((LM_DEBUG, - "dump incoming connections for child plan:%s\n", - (entry->int_id_).child_plan_->UUID.in ())); - dump_connections (this->all_connections_.in ()); - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - } - - // Get the Connections variable, if ReDaC is true, then we get - // those new connections only. NOTE: get_outgoing_connections - // by default will get *all* connections. - Deployment::Connections * my_connections = - this->get_outgoing_connections ( - (entry->int_id_).child_plan_.in (), - !is_ReDaC, - true, // we search *new* plan - DomainApplicationManager_Impl::Internal_Connections); - - if (my_connections == 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::finishLaunch -" - "ERROR while getting the outgoing connections " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::finish_launch", - "There was some error establishing connections.")); - } - - // Dump the connections for debug purpose. - if (CIAO::debug_level () > 1) - { - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - ACE_DEBUG ((LM_DEBUG, - "dump outgoing connections for child plan:%s\n", - (entry->int_id_).child_plan_->UUID.in ())); - dump_connections (*my_connections); - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - } - - // Invoke finishLaunch() operation on NodeApplication. - if (my_connections->length () != 0) - { - entry->int_id_.node_application_->finishLaunch - (*my_connections, - start, - true // "true" => establish new connections only - ); - } - - //============================================================= - // Remove Old Connections Logic - //============================================================= - - if (is_ReDaC) // We should also *REMOVE* unnecessary connections - { - // If this is a brand new child plan, then continue. - if ((entry->int_id_).old_child_plan_ == 0) - continue; - - // Get all the connections in the old deployment plan - Deployment::Connections * connections_in_old_plan = - this->get_outgoing_connections ( - (entry->int_id_).old_child_plan_.in (), - true, // yes, get *all* the connections - false, // search in the *old* plan - DomainApplicationManager_Impl::Internal_Connections); - - // Pass in the "false" parameter to get *all* the connections in - // the new deployment plan, regardless those in old plan - Deployment::Connections * connections_in_new_plan = - this->get_outgoing_connections ( - (entry->int_id_).child_plan_.in (), - true, // yes, get *all* the connections - true, // search in the *new* plan - DomainApplicationManager_Impl::Internal_Connections); - - Deployment::Connections * unnecessary_connections = - this->subtract_connections (*connections_in_old_plan, - *connections_in_new_plan); - - delete connections_in_old_plan; - delete connections_in_new_plan; - - // Dump the connections for debug purpose. - if (CIAO::debug_level () > 1) + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplicationManager_Impl::split_plan - " + "For endpoint : %C(%C)\n", + plan.connection[j].internalEndpoint[k].portName.in(), + plan.connection[j].internalEndpoint[k].provider ? "provider" : "client")); + if (i == plan.connection[j].internalEndpoint[k].instanceRef) // the instance (i) is referenced by the connection { - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); - ACE_DEBUG ((LM_DEBUG, - "dump to-be-removed connections for child plan:%s\n", - (entry->int_id_).child_plan_->UUID.in ())); - dump_connections (*unnecessary_connections); - ACE_DEBUG ((LM_DEBUG, - "==============================================\n")); + Deployment::PlanConnectionDescription * connection_copied = 0; + for (CORBA::ULong m = 0; m < child_plan.connection.length(); ++m) + { + if (plan.connection[j].name == child_plan.connection[m].name) + { + connection_copied = &child_plan.connection[m]; + break; + } + } + + if (0 == connection_copied) + { + // Copy the connection + CORBA::ULong index_con = child_plan.connection.length(); + child_plan.connection.length (index_con + 1); + child_plan.connection[index_con] = plan.connection[j]; + connection_copied = &child_plan.connection[index_con]; + connection_copied->internalEndpoint.length (0); + } + + // Copy the endpoint + CORBA::ULong index_ep = connection_copied->internalEndpoint.length(); + connection_copied->internalEndpoint.length (index_ep + 1); + connection_copied->internalEndpoint[index_ep] = plan.connection[j].internalEndpoint[k]; + connection_copied->internalEndpoint[index_ep].instanceRef = index_ins - 1; } - - // Invoke finishLaunch() operation on NodeApplication. - if (unnecessary_connections->length () != 0) - { - if (CORBA::is_nil (entry->int_id_.node_application_.in ())) - throw Deployment::StartError (); - - entry->int_id_.node_application_->finishLaunch - (*unnecessary_connections, - start, - false // false ==> remove unnecessary connections - ); - } - - //============================================================= - // Remove Old Components - //============================================================= - // Finally we need to remove those to-be-removed components - ::Deployment::Properties_var configProperty; - ACE_NEW (configProperty, - Deployment::Properties); - - ::Deployment::Connections_var retn_connections; - - Deployment::Application_var temp_application = - entry->int_id_.node_application_manager_-> - perform_redeployment (configProperty, - retn_connections.out (), - false, // remove old components only - false);// do not "start" } } - - // Establish bindings on external/shared components of this deployment plan. - this->post_finishLaunch (); - } - catch (const Deployment::StartError& ex) - { - ACE_ERROR ((LM_ERROR, "DAM_Impl::finishLaunch - StartError: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::finishLaunch: ""Killing NodeApplications.\n"); - - // Invoke destroyManager() operation on each cached - // NodeManager object. - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeManager and NodeApplicationManager object references. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> * entry = 0; - this->artifact_map_.find (this->node_manager_names_[i],entry); - - ::Deployment::NodeApplicationManager_ptr - my_node_application_manager = - (entry->int_id_).node_application_manager_.in (); - - // Invoke destoryApplication() operation on the NodeApplicationManger. - // Since we have the first arg is not used by NAM anyway. - my_node_application_manager->destroyApplication - (0); - } - throw; - } - -} - -void -CIAO::DomainApplicationManager_Impl:: -post_finishLaunch (void) -{ - try - { - // For each "external" component... - CORBA::ULong length = this->shared_->length (); - for (CORBA::ULong j = 0; j < length; ++j) - { - // Construct <Component_Binding_Info> struct for the component - CIAO::Component_Binding_Info * - binding = this->populate_binding_info ( - this->shared_[j].name.in (), - this->shared_[j].plan_uuid.in ()); - - // Invoke <finalize_global_binding> on ExecutionManager - this->execution_manager_->finalize_global_binding ( - *binding, true); - - delete binding; - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::post_finishLaunch.\n"); - throw; - } - -} - -CIAO::Component_Binding_Info * -CIAO::DomainApplicationManager_Impl:: -populate_binding_info (const ACE_CString& name, - const ACE_CString& child_uuid) -{ - CIAO::Component_Binding_Info * retv; - ACE_NEW_RETURN (retv, - CIAO::Component_Binding_Info (), - 0); - - retv->name_ = name; - - // Parse the child_uuid string and populate the "node" name and - // "plan_uuid" fields. Our protocol here is searching for the "@", - // the substring *before* that is the global plan uuid, and the - // substring *after* that is the node name. - ACE_CString::size_type pos = child_uuid.find ('@'); - - retv->plan_uuid_ = - child_uuid.substring (0, pos); - - retv->node_ = - child_uuid.substring (pos + 1, - ACE_CString::npos); // get the rest of the string - - Deployment::Connections_var connections; - ACE_NEW_RETURN (connections, - Deployment::Connections, - 0); - - this->get_outgoing_connections_i (name.c_str (), - connections.inout (), - false, // get *all* connections - true); // search current plan - - retv->providedReference_ = connections._retn (); - - return retv; -} - -CIAO::Component_Binding_Info * -CIAO::DomainApplicationManager_Impl:: -populate_binding_info (const ACE_CString& name) -{ - CIAO::Component_Binding_Info * retv; - ACE_NEW_RETURN (retv, - CIAO::Component_Binding_Info (), - 0); - - // Looking for the child plan uuid through the shared compoonent list - for (CORBA::ULong i = 0; i < this->shared_->length (); ++i) - { - if (ACE_OS::strcmp (this->shared_[i].name.in (), - name.c_str ()) == 0) - { - ACE_CString child_uuid = this->shared_[i].plan_uuid.in (); - retv = this->populate_binding_info (name, child_uuid); - return retv; - } + sub_plans.rebind (ACE_CString (my_instance.node.in()), child_plan); } - return 0; // If no matching is found (should never happen). -} - -void -CIAO::DomainApplicationManager_Impl:: -add_shared_components (const Deployment::ComponentPlans & shared) -{ - for (CORBA::ULong i = 0; i < shared.length (); ++i) + //Debug + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplicationManager_Impl::split_plan - " + "Original plan connection count : %u\n", plan.connection.length())); + CORBA::ULong cnt = 0; + for (TNodePlans::iterator it = sub_plans.begin(); it != sub_plans.end(); ++it) { - CORBA::ULong curr_len = this->shared_->length (); - this->shared_->length (curr_len + 1); - this->shared_[curr_len] = shared[i]; + cnt += (*it).int_id_.connection.length(); + // DANCE_DEBUG((LM_DEBUG, "[%M] Dumping deployment plan #%C:\n", (*it).ext_id_.c_str())); + // Deployment::DnC_Dump::dump((*it).int_id_); } -} - -bool -CIAO::DomainApplicationManager_Impl:: -is_shared_component (const char * name) -{ - for (CORBA::ULong i = 0; i < this->shared_->length (); ++i) - { - if (ACE_OS::strcmp (this->shared_[i].name.in (), - name) == 0) - return true; - } - - return false; + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplicationManager_Impl::split_plan - " + "Child plans connection count : %u\n", cnt)); } void -CIAO::DomainApplicationManager_Impl:: -synchronize_shared_components_with_node_managers (void) +DomainApplicationManager_Impl::preparePlan() { - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeManager object reference. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::startLaunch -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl:startLaunch", - error.c_str ())); - } - - // Update the shared components list - ::Deployment::NodeManager_ptr - my_node_manager = (entry->int_id_).node_manager_.in (); - - Deployment::ComponentPlans_var - shared = my_node_manager->get_shared_components (); + DANCE_TRACE ("DomainApplicationManager_Impl::preparePlan()"); - this->add_shared_components (shared.in ()); - } -} - - -Deployment::Connections * -CIAO::DomainApplicationManager_Impl:: -get_outgoing_connections (const Deployment::DeploymentPlan &plan, - bool is_getting_all_connections, - bool is_search_new_plan, - Connection_Search_Type t) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::get_outgoing_connections"); - Deployment::Connections_var connections; - ACE_NEW_RETURN (connections, - Deployment::Connections, - 0); - - // For each component instance in the child plan ... - CORBA::ULong number = plan.instance.length (); - for (CORBA::ULong i = 0; i < number; ++i) - { - - if (t == Internal_Connections && - this->is_shared_component (plan.instance[i].name.in ())) - continue; - - // Get the outgoing connections of the component - if (!get_outgoing_connections_i (plan.instance[i].name.in (), - connections.inout (), - is_getting_all_connections, - is_search_new_plan)) - return 0; - } - return connections._retn (); -} - - -// Get outgoing connections for particular instance -bool -CIAO::DomainApplicationManager_Impl:: -get_outgoing_connections_i (const char * instname, - Deployment::Connections & retv, - bool is_getting_all_connections, - bool is_search_new_plan) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::get_outoing_connections_i"); - - Deployment::DeploymentPlan tmp_plan; - if (is_search_new_plan) - tmp_plan = this->plan_; - else - tmp_plan = this->old_plan_; - - // Search for all the bindings in the plan. - const CORBA::ULong total_length = tmp_plan.connection.length(); - for (CORBA::ULong i = 0; i < total_length; ++i) - { - // Current binding that we are looking at. - const Deployment::PlanConnectionDescription & binding = - tmp_plan.connection[i]; - - // If this is a ReDaC case, then we ignore the connection if it - // already exists in the old_plan - if (already_exists (binding) && - !is_getting_all_connections) - continue; - - this->populate_connection_for_binding (instname, - binding, - tmp_plan, - retv); - } - return true; -} - -// Search the current binding to see whether a connection of this -// component needs to be populated -bool -CIAO::DomainApplicationManager_Impl:: -populate_connection_for_binding ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv) -{ - const CORBA::ULong binding_len = binding.internalEndpoint.length (); - - // If only 1 internalEndpoint, then we know it's through event service. - if (binding_len == 1) - { - return - this->handle_es_connection (instname, - binding, - plan, - retv); - } - else if (binding_len == 2) - { - return this->handle_direct_connection (instname, - binding, - plan, - retv); - } - else // invalid binding encounted... - return false; -} - -bool -CIAO::DomainApplicationManager_Impl:: -handle_es_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv) -{ - // The initial retv might have something inside - CORBA::ULong len = retv.length (); - - const Deployment::PlanSubcomponentPortEndpoint & endpoint = - binding.internalEndpoint[0]; - - // If the instance name does NOT match one of the names in the binding - // Then thsi binding has nothing related to myself (an instance) - if (ACE_OS::strcmp (instname, - plan.instance[endpoint.instanceRef].name.in ()) != 0) - return false; - - if (binding.externalReference.length () != 1) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::" - "handle_publisher_es_connection -" - "externalReference must have length of 1.\n")); - return false; - } - - retv.length (len+1); - retv[len].instanceName = instname; - retv[len].portName = endpoint.portName.in (); - retv[len].kind = endpoint.kind; - - ACE_CString es_id = binding.externalReference[0].location.in (); - - retv[len].endpointInstanceName = es_id.c_str (); - retv[len].endpointPortName = CORBA::string_dup ("CIAO_ES"); - - // We need to populate the actual filter and store it into - // the <connection.config> field - if (binding.deployRequirement.length () != 0) - { - retv[len].config = - * (this->get_connection_QoS_configuration (binding.deployRequirement[0])); - } - - // If we didnt find the objref of the connection ... - CIAO::CIAO_Event_Service_var es; - - if (this->es_map_.find (es_id.c_str (), es) != 0) - { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += binding.name.in (); - throw Deployment::StartError( - "DomainApplicationManager_Impl::create_connections_i", - error.c_str ()); - } - - retv[len].event_service = es._retn (); - - // One more thing needs to be done if this is a es_consumer connection - // We need to populate the <endpoint> field of this connection, which - // is the object reference of this event consumer port. - if (endpoint.kind == Deployment::EventConsumer) - { - // Now we search in the received connections to get the objRef of event sink - bool found = false; - const CORBA::ULong all_conn_len = this->all_connections_->length (); - for (CORBA::ULong j = 0; j < all_conn_len; ++j) - { - const Deployment::Connection & curr_recv_conn = - this->all_connections_[j]; - - // We need to look at the instance name and the port name to confirm. - if (ACE_OS::strcmp (curr_recv_conn.instanceName.in (), - instname) == 0 && - ACE_OS::strcmp (curr_recv_conn.portName.in (), - endpoint.portName.in ()) == 0) - { - retv[len].endpoint = - CORBA::Object::_duplicate(curr_recv_conn.endpoint.in ()); - found = true; - } - } // End of searching received connections - - if (!found) - { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += binding.name.in (); - throw Deployment::StartError( - "DomainApplicationManager_Impl::handle_es_connection", - error.c_str ()); - } - } - - return true; -} - -bool -CIAO::DomainApplicationManager_Impl:: -handle_direct_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv) -{ - // The initial retv might have something inside - CORBA::ULong len = retv.length (); - - const CORBA::ULong binding_len = binding.internalEndpoint.length (); - for (CORBA::ULong i = 0; i < binding_len; ++i) - { - const Deployment::PlanSubcomponentPortEndpoint & endpoint = - binding.internalEndpoint[i]; - - // If the instance name does NOT match one of the names in the binding - if (ACE_OS::strcmp (instname, - plan.instance[endpoint.instanceRef].name.in ()) != 0) - continue; - - // We are only interested when we are the "client" of the endpoint objref - if (endpoint.kind == Deployment::EventPublisher || - endpoint.kind == Deployment::EventEmitter || - endpoint.kind == Deployment::SimplexReceptacle || - endpoint.kind == Deployment::MultiplexReceptacle ) - { - // Obtain the index of the "real" endpoint which has an objref. It - // is the opposite side of myself. - CORBA::ULong e_index = (i + 1) % 2; - - ACE_CString source_port = - binding.internalEndpoint[i].portName.in (); - - ACE_CString endpoint_inst = - plan.instance[binding.internalEndpoint[e_index] - .instanceRef].name.in (); - - ACE_CString endpoint_port = - binding.internalEndpoint[e_index].portName.in (); - - bool found = false; - - // Now we search in the received connections to get the objRef. - const CORBA::ULong all_conn_len = this->all_connections_->length (); - for (CORBA::ULong j = 0; j < all_conn_len; ++j) - { - const Deployment::Connection & curr_recv_conn = - this->all_connections_[j]; - - // We need to look at the instance name and the port name to confirm. - if (ACE_OS::strcmp (curr_recv_conn.instanceName.in (), - endpoint_inst.c_str ()) == 0 && - ACE_OS::strcmp (curr_recv_conn.portName.in (), - endpoint_port.c_str ()) == 0) - { - retv.length (len+1); - retv[len].instanceName = instname; - retv[len].portName = source_port.c_str (); - retv[len].endpointInstanceName = endpoint_inst.c_str (); - retv[len].endpointPortName = endpoint_port.c_str (); - - retv[len].endpoint = - CORBA::Object::_duplicate(curr_recv_conn.endpoint.in ()); - retv[len].kind = binding.internalEndpoint[i].kind; - - ++len; - found = true; - break; - } - } // End of searching received connections - - // We didnt find the objref of the connection ... - if (!found) - { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += binding.name.in (); - throw Deployment::StartError( - "DomainApplicationManager_Impl::create_connections_i", - error.c_str ()); - } - break; - } - } - return true; -} - -void -CIAO::DomainApplicationManager_Impl:: -start () -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::start"); - - try - { - CORBA::ULong i; - - for (i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::start -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw Deployment::StartError( - "DomainApplicationManager_Impl:startLaunch", - error.c_str ()); - } - - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->ciao_preactivate (); - } - - // Invoke start () operation on each cached NodeApplication object. - for (i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::start -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - throw Deployment::StartError (); - } - - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->start (); - } - - // Invoke ciao_postctivate () operation on each - // cached NodeApplication object. - - for (i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeApplication object reference. - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::start -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to node manager: "); - error += this->node_manager_names_[i]; - - throw Deployment::StartError( - "DomainApplicationManager_Impl:startLaunch", - error.c_str ()); - } - - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->ciao_postactivate (); - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("DomainApplicationManager_Impl::start\t\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_Impl:: -destroyApplication () -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::destroyApplication"); try { - // Passivate shared components also, which should delegate to EM to handle - this->passivate_shared_components (); - - // Passivate all components associated with the plan - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) + // Map of sub plans for each node + TNodePlans sub_plans; + // Splitting deployment plan on sub plans for each node + DomainApplicationManager_Impl::split_plan (this->plan_, sub_plans); + DANCE_DEBUG((LM_TRACE, DLINFO "DomainApplicationManager_Impl::preparePlan - Plan successfully split\n")); + // Executing preparePlan on each NodeManager described in DeploymentPlan + for (TNodePlans::iterator iter_plans = sub_plans.begin(); + iter_plans != sub_plans.end(); + ++iter_plans) { - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" - "CIAO::DomainApplicationManager_Impl::destroyApplication -" - "ERROR while finding the node specific plan " - "for the node [%s] \n", - this->node_manager_names_[i].c_str ())); - - ACE_CString error - ("Unable to resolve a reference to NodeManager: "); - error += this->node_manager_names_[i]; - - throw - (Deployment::StopError - ("DomainApplicationManager_Impl::destroyApplication", - error.c_str ())); - } - ACE_DEBUG ((LM_DEBUG, "DAM_Impl: Invoking passivate on %s\n", - this->node_manager_names_[i].c_str ())); - - // Invoke ciao_passivate () operation on each cached NodeApplication object. - ::Deployment::NodeApplication_ptr my_na = - (entry->int_id_).node_application_.in (); - - my_na->ciao_passivate (); - } - - // Remove all connections associated with the plan - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - this->artifact_map_.find (this->node_manager_names_[i], entry); - - Deployment::Connections_var connections = - this->get_outgoing_connections ( - (entry->int_id_).child_plan_.in (), - true, // yes, get *all* the connections - true, // yes, we search the current plan - DomainApplicationManager_Impl::External_Connections); - - // Invoke finishLaunch() on NodeApplication to remove bindings. - // If this NodeApplication is not within the control of this DAM, - // then we should delegate the call to the correct DAM through EM. - - // Iterave over the returned connection list in <connections>, - // (1) If this is a shared component, then we remove this connection - // from <connections> list, and then populate a "Component_Binding_Info" - // struct for it and send to EM for remove. - // (2) For the rest of the connections, we send them to the NAs - // managed by the local DAM to remove. - - for (CORBA::ULong j = 0; j < connections->length (); ++j) - { - if (this->is_shared_component (connections[j].instanceName.in ())) - { - // ask EM to remove the binding for us - ACE_CString inst_name = connections[j].instanceName.in (); - CIAO::Component_Binding_Info * - binding = this->populate_binding_info (inst_name.c_str ()); - - this->execution_manager_->finalize_global_binding ( - *binding, false); - - // Remove all the connections whose "source" component - // is this component instance from the <connections> list - this->purge_connections (connections, - inst_name.c_str ()); - } - } - - if (connections->length () > 0) + // Finding correspondent NodeManager + Deployment::NodeManager_var nm = this->nodes_.locate_node ((*iter_plans).ext_id_.c_str ());; + // If NodeManager not found throw StartError exception + if (CORBA::is_nil (nm.in ())) { - entry->int_id_.node_application_->finishLaunch - (connections.in (), - true, // "true" ==> start the components - false // "false" => remove connections - ); + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Deployment::StartError exception. NodeManager %C cannot be found\n", + (*iter_plans).ext_id_.c_str())); + throw Deployment::StartError ( (*iter_plans).ext_id_.c_str(), "NodeManager not found"); } - } - - // After all the connections are removed, we actually destroy - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - ACE_Hash_Map_Entry <ACE_CString, Chained_Artifacts> *entry = 0; - - this->artifact_map_.find (this->node_manager_names_[i], entry); - - // Invoke destroyPlan() operation on the NodeManager - Deployment::NodeManager_var - my_node_manager = (entry->int_id_).node_manager_; - - my_node_manager->destroyPlan ((entry->int_id_).child_plan_); - } - - // ?? - // Shall we invoke destroyManager () operation on the NodeManager, since we need - // to clean up all the NodeApplicationManagers associated with this deployment - // plan (one NodeApplicationManager per Node per plan). - - // We should again activate those shared components - this->activate_shared_components (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::destroyApplication\t\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_Impl:: -destroyManager () -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::destroyManager"); - try - { - for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) - { - // Get the NodeManager and NodeApplicationManager object references. - ACE_Hash_Map_Entry - <ACE_CString, - Chained_Artifacts> *entry = 0; - - if (this->artifact_map_.find (this->node_manager_names_[i], - entry) != 0) - throw Deployment::StopError (); // Should never happen! - - ::Deployment::NodeManager_var my_node_manager = - (entry->int_id_).node_manager_; - - ::Deployment::NodeApplicationManager_var my_nam = - (entry->int_id_).node_application_manager_; - - my_node_manager->destroyManager (my_nam.in ()); - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::destroyManager\t\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_Impl:: -perform_redeployment ( - const Deployment::DeploymentPlan & plan) -{ - // Currently we could dynamically update the NodeManagerMap topology, - // but later maybe we could add another parameter to this operation, - // which allows the user to specify the new NodeManagerMap data file. - this->old_plan_ = this->plan_; - this->is_redeployment_ = true; - this->plan_ = plan; - - try - { - // Call init() on the myself, which will validate/split the plan and - // call preparePlan on each NodeManager, by this, we shall get - // all the object references of NM and NAM associated with each - // component instance populated. - this->init (); - - // Call startLaunch on each NM for each child plan, this should not only - // install all the new components specified, but should also remove - // the components that are no longer in the new deployment plan. - // Meanwhile, we should set up the container configurations appropriately, - // whose information is fully captured in the node-level deployment plan. - ::Deployment::Properties_var properties; - ACE_NEW (properties, - Deployment::Properties); - - this->startLaunch (properties.in (), false); - - // finishLaunch will (1) establish new connections, and (2) - // get rid of those non-existing connections. As we know, in the - // node level, the connections are cached within the NodeApplication *and* - // Container, then we should modify the implementation of the - // <finishLaunch> on the NodeApplication to accomplish this. - this->finishLaunch (true, true); // true means start activation also. - // ture means "ReDaC" is desired - - this->start (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::perform_redeployment\t\n"); - this->plan_ = this->old_plan_; - throw; - } -} - - -// Returns the DeploymentPlan associated with this ApplicationManager. -::Deployment::DeploymentPlan * -CIAO::DomainApplicationManager_Impl:: -getPlan () -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::getPlan"); - Deployment::DeploymentPlan_var plan = 0; - // Make a deep copy of the Plan - ACE_NEW_THROW_EX (plan, - Deployment::DeploymentPlan (this->plan_), - CORBA::NO_MEMORY ()); - - // Transfer ownership - return plan._retn (); -} - -void -CIAO::DomainApplicationManager_Impl:: -dump_connections (const ::Deployment::Connections & connections) -{ - CIAO_TRACE("CIAO::DomainApplicationManager_Impl::dump_connections"); - const CORBA::ULong conn_len = connections.length (); - for (CORBA::ULong i = 0; i < conn_len; ++i) - { - ACE_DEBUG ((LM_DEBUG, - "instanceName: %s\n", connections[i].instanceName.in ())); - - ACE_DEBUG ((LM_DEBUG, "portName: %s\n", connections[i].portName.in ())); - - ACE_DEBUG ((LM_DEBUG, "portkind: ")); - - switch (connections[i].kind) - { - case Deployment::Facet: - - ACE_DEBUG ((LM_DEBUG, "Facet\n")); - break; - - case Deployment::SimplexReceptacle: - - ACE_DEBUG ((LM_DEBUG, "SimplexReceptacle\n")); - break; - - case Deployment::MultiplexReceptacle: - - ACE_DEBUG ((LM_DEBUG, "MultiplexReceptacle\n")); - break; + // Calling preparePlan for node, specified in current sub plan + DANCE_DEBUG((LM_TRACE, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Calling preparePlan on node %C\n", + (*iter_plans).ext_id_.c_str())); - case Deployment::EventEmitter: + Deployment::NodeApplicationManager_ptr nam + = nm->preparePlan ( (*iter_plans).int_id_, + Deployment::ResourceCommitmentManager::_nil()); - ACE_DEBUG ((LM_DEBUG, "EventEmitter\n")); - break; - - case Deployment::EventPublisher: - - ACE_DEBUG ((LM_DEBUG, "EventPublisher\n")); - break; - - case Deployment::EventConsumer: - - ACE_DEBUG ((LM_DEBUG, "EventConsumer\n")); - break; - - default: - ACE_DEBUG ((LM_DEBUG, "Unknown port kind.\n")); - } - - ACE_DEBUG ((LM_DEBUG, - "endpointInstanceName: %s\n", - connections[i].endpointInstanceName.in ())); - - ACE_DEBUG ((LM_DEBUG, - "endpointPortName: %s\n", - connections[i].endpointPortName.in ())); - ACE_DEBUG ((LM_DEBUG, "---------------------\n")); - } -} - -bool -CIAO::DomainApplicationManager_Impl:: -already_exists (const Deployment::PlanConnectionDescription & conn) -{ - const CORBA::ULong conn_len = this->old_plan_.connection.length(); - for(CORBA::ULong i = 0; i < conn_len; ++i) - { - if (ACE_OS::strcmp (this->old_plan_.connection[i].name.in (), - conn.name.in ()) == 0) - return true; - } - - return false; -} - -Deployment::Connections * -CIAO::DomainApplicationManager_Impl:: -subtract_connections (const Deployment::Connections & left, - const Deployment::Connections & right) -{ - Deployment::Connections_var retv; - ACE_NEW_RETURN (retv, - Deployment::Connections, - 0); - - CORBA::ULong left_length = left.length (); - CORBA::ULong right_length = right.length (); - for (CORBA::ULong i = 0; i < left_length; ++i) - { - bool found = false; - for (CORBA::ULong j = 0; j < right_length; ++j) - { - if (ACE_OS::strcmp (left[i].instanceName.in (), - right[j].instanceName.in ()) == 0 && - ACE_OS::strcmp (left[i].portName.in (), - right[j].portName.in ()) == 0 && - left[i].kind == right[j].kind && - left[i].endpoint->_is_equivalent (right[j].endpoint.in ())) + if (CORBA::is_nil (nam)) { - found = true; - break; + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "PreparePlan failed for node %C, returning a nill " + "NodeApplicationManager poiniter.\n", + (*iter_plans).ext_id_.c_str())); + throw ::Deployment::StartError(); } - } + // We save NAM reference ptr in TNodes vector were it places to var variable + this->sub_app_mgr_.bind (nam, nm); - if (!found) - { - CORBA::ULong curr_length = retv->length (); - retv->length (curr_length + 1); - retv[curr_length] = left[i]; - } - } - return retv._retn (); -} - -void -CIAO::DomainApplicationManager_Impl:: -passivate_shared_components (void) -{ - try - { - // For each "external" component... - CORBA::ULong length = this->shared_->length (); - for (CORBA::ULong j = 0; j < length; ++j) - { - // Construct <Component_Binding_Info> struct for the component - CIAO::Component_Binding_Info * - binding = this->populate_binding_info ( - this->shared_[j].name.in (), - this->shared_[j].plan_uuid.in ()); - - // Invoke <finalize_global_binding> on ExecutionManager - this->execution_manager_->passivate_shared_components ( - *binding); - - delete binding; + DANCE_DEBUG ((LM_INFO, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Sucessfully prepared node %C for deployment\n", + (*iter_plans).ext_id_.c_str())); } } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::passivate_shared_components.\n"); - throw; - } - -} - -void -CIAO::DomainApplicationManager_Impl:: -activate_shared_components (void) -{ - try + catch (Deployment::StartError &e) { - // For each "external" component... - CORBA::ULong length = this->shared_->length (); - for (CORBA::ULong j = 0; j < length; ++j) - { - // Construct <Component_Binding_Info> struct for the component - CIAO::Component_Binding_Info * - binding = this->populate_binding_info ( - this->shared_[j].name.in (), - this->shared_[j].plan_uuid.in ()); - - // Invoke <finalize_global_binding> on ExecutionManager - this->execution_manager_->activate_shared_components ( - *binding); - - delete binding; - } + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Propagating StartError exception caught here\n")); + throw e; } - catch (const CORBA::Exception& ex) + catch (CORBA::Exception &ex) { - ex._tao_print_exception ( - "DomainApplicationManager_Impl::activate_shared_components.\n"); - throw; + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Caught a CORBA exception, propagating StartError: %s\n", + ex._info ().c_str ())); + throw ::Deployment::StartError (); } - -} - -void -CIAO::DomainApplicationManager_Impl:: -purge_connections (Deployment::Connections_var & connections, - const char * inst) -{ - CORBA::ULong total_len = connections->length (); - - for (CORBA::ULong i = 0; i < total_len; ++i) + catch (...) { - bool found = false; - - // Remove all the connections whose "source" component - // name is <inst> - if (ACE_OS::strcmp (connections[i].instanceName.in (), - inst) == 0) - { - found = true; - - for (CORBA::ULong j = i; j < total_len - 1; ++j) - { - connections[j] = connections[j + 1]; - } - connections->length (total_len - 1); - } - - if (found) - this->purge_connections (connections, inst); + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Caught unknown exception. Propagating StartError\n")); + throw ::Deployment::StartError (); } } -const Deployment::Properties * -CIAO::DomainApplicationManager_Impl:: -get_connection_QoS_configuration (const Deployment::Requirement & requirement) -{ - // Get the name/identifier of the filter associated with - // this connection - Deployment::Properties * retv; - ACE_NEW_NORETURN (retv, Deployment::Properties); - CORBA::ULong len = retv->length (); - for (CORBA::ULong i = 0; - i < requirement.property.length (); - ++i) - { - const char *filter_name; - if (ACE_OS::strcmp ("EventFilter", - requirement.property[i].name) == 0) - { - - if ((requirement.property[i].value >>= filter_name) == false) - ACE_ERROR ((LM_ERROR, - "ERROR: DomainApplicationManager_Impl::" - "get_connection_QoS_configuration unable to " - "extract event filter information\n")); - } - // Search for the desired filter - for (CORBA::ULong j = 0; j < this->esd_->length (); ++j) - { - // Populate the "filters" info, in case this CIAO_Event_Service has - // one or more filters specified through descriptors - for (CORBA::ULong k = 0; k < this->esd_[j].filters.length (); ++k) - { - if (ACE_OS::strcmp (this->esd_[j].filters[k].name.in (), - filter_name) == 0) - { - retv->length (len + 1); - (*retv)[len].name = CORBA::string_dup ("EventFilter"); - (*retv)[len].value <<= this->esd_[j].filters[k]; - break; - } - } - } - } - return retv; -} diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h index bc471e2f495..9433693573f 100644 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h +++ b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h @@ -1,462 +1,73 @@ -//================================================================== +// -*- C++ -*- + +//============================================================================= /** - * @file DomainApplicationManager_Impl.h + * @file DomainApplicationManager_Impl.h * * $Id$ * - * This file contains implementation for the servant of - * Deployment::DomainApplicationManager. + * @Brief Implementation of POA_Deployment::DomainApplicationManager * - * @author Gan Deng <gan.deng@vanderbilt.edu> - * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> - * @author Tao Lu <lu@dre.vanderbilt.edu> + * @author Erwin Gottlieb <eg@prismtech.com> */ -//===================================================================== - -#ifndef CIAO_DOMAINAPPLICATIONMANAGER_IMPL_H -#define CIAO_DOMAINAPPLICATIONMANAGER_IMPL_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ +//============================================================================= +#ifndef DOMAINAPPLICATIONMANAGER_IMPL_H_ +#define DOMAINAPPLICATIONMANAGER_IMPL_H_ -#include "ace/Hash_Map_Manager.h" #include "ace/Vector_T.h" -#include "ace/Functor.h" -#include "ace/OS_NS_string.h" - -#include "DAnCE/Deployment/Deployment_DomainApplicationManagerS.h" -#include "DAnCE/Deployment/Deployment_common.h" - -#include "tao/Valuetype/ValueBase.h" -#include "tao/Valuetype/Valuetype_Adapter_Impl.h" - -#include "ciao/CIAO_common.h" -#include "DAnCE/Deployment/Deployment_EventsC.h" - -#include "Deployment_Configuration.h" +#include "ace/SStringfwd.h" +#include "ace/Map_Manager.h" #include "DomainApplicationManager_Export.h" +#include "Deployment/Deployment_DomainApplicationManagerS.h" +#include "Deployment/Deployment_NodeApplicationManagerC.h" +#include "DomainApplication/Domain_Application_Impl.h" +#include "Deployment/Deployment_NodeManagerC.h" +#include "DomainApplicationManager/Node_Locator.h" -namespace CIAO -{ - namespace Execution_Manager +namespace DAnCE { - class Execution_Manager_Impl; - } - - /** - * @class DomainApplicationManager_Impl - * - * @brief A servant for the Deployment::DomainApplicationManager - * interface. The DomainApplicationManager is responsible for - * deploying an application on the domain level, i.e. across - * nodes. It specializes the ApplicationManager abstract interface. - */ class DomainApplicationManager_Export DomainApplicationManager_Impl - : public virtual POA_Deployment::DomainApplicationManager - { - public: - - /// External_Connections means we search all the connections including - /// the connectiosn for external/shared components of this plan which hold - /// port objrefs of components within this plan - enum Connection_Search_Type - { - External_Connections, - Internal_Connections - }; - - /// Define the type which contains a list of DnC artifacts. - /// @@ Assumption: Each NodeApplicationManager create only one - /// NodeApplication when the startLaunch() operation is invoked, - /// which means all the nodes on that child plan are collocated in - /// the same process. - typedef struct _chained_artifacts + : public virtual POA_Deployment::DomainApplicationManager { - ::Deployment::NodeManager_var node_manager_; - ::Deployment::DeploymentPlan_var child_plan_; - ::Deployment::NodeApplicationManager_var node_application_manager_; - ::Deployment::NodeApplication_var node_application_; - ::Deployment::DeploymentPlan_var old_child_plan_; - } Chained_Artifacts; - - /// Constructor - DomainApplicationManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Deployment::TargetManager_ptr manager, - Execution_Manager::Execution_Manager_Impl * em, - const Deployment::DeploymentPlan &plan, - const char * deployment_file); - - - /*=========================================================== - * Below are helper methods for the DomainApplicationManager - * - *============================================================*/ - /** - * Initialize the DomainApplicationManager. - * @para em A pointer to the ExecutionManager servant C++ object. - * - * (1) Set the total number of child plans. - * (2) Set the list of NodeManager names, which is an array of strings. - * The <node_manager_names> is a pointer to an array of ACE_CString - * objets, which is allocated by the caller and deallocated by the - * DomainApplicationManager destructor. - * (3) Check the validity of the deployment plan and the deployment - * information data file. - * (4) Call split_plan () member function. - * (5) Invoke all the preparePlan () operations on all the corresponding - * NodeManagers with child plans. - * - * - * @@ What else do we need to initialize here? - */ - void init (); - - /** - * set_uuid method on the DomainApplicationManager assigns the - * UUID of the associated plan to this Manager. This helps in - * reverse lookup operations such as given a manager, obtaining - * the UUID associated. The get_uuid method is used in this case. - */ - void set_uuid (const char * uuid); - - const char * get_uuid () const; - - /*=========================================================== - * Below are operations from the DomainApplicationManager - * - *============================================================*/ - - /** - * Fetch the NodeApplication object reference based on the NodeManager name. - */ - virtual Deployment::NodeApplication_ptr get_node_app ( - const char * node_name); - - /** - * Executes the application, but does not start it yet. Users can - * optionally provide launch-time configuration properties to - * override properties that are part of the plan. Raises the - * InvalidProperty exception if a configuration property is - * invalid. Raises the StartError exception if an error occurs - * during launching. Raises the ResourceNotAvailable exception if - * the commitResources parameter to the prepare operation of the - * ExecutionManager was true, if late resource allocation is used, - * and one of the requested resources is not available. - */ - virtual void - startLaunch (const ::Deployment::Properties & configProperty, - ::CORBA::Boolean start); - - /** - * The second step in launching an application in the - * domain-level. If the start parameter is true, the application - * is started as well. Raises the StartError exception if - * launching or starting the application fails. - */ - virtual void finishLaunch (CORBA::Boolean start, - CORBA::Boolean is_ReDAC); - - /** - * The last step in launching an application in the - * domain-level. We establish connection bindings - * for external/shared components of this deployment plan - * components. - * Internally, this operation will invoke some operations - * on ExecutionManager to finish up this task. - */ - virtual void post_finishLaunch (void); - - virtual void passivate_shared_components (void); - - virtual void activate_shared_components (void); - - /** - * Starts the application. Raises the StartError exception if - * starting the application fails. - */ - virtual void start (); - - /** - * Terminates a running application. Raises the StopError - * exception if an error occurs during termination. Raises the - * InvalidReference exception if the appliction reference is - * unknown. - */ - virtual void destroyApplication (); - - /** - * Returns the DeploymentPlan associated with this ApplicationManager. - */ - virtual ::Deployment::DeploymentPlan * getPlan (); - - /** - * This is a helper function to destroy the NodeAppManager. - * Since we don't want to do so in the destructor so we will - * ask the ExecutionManager to do this on us when the same IDL - * op invoked on it. This is part of the result for merging DAM - * with DA. - */ - virtual void destroyManager (); - - // The input parameter is a *new_plan* which has the - // same UUID of the existing running plan. - virtual void - perform_redeployment ( - const Deployment::DeploymentPlan & plan); - - protected: - /// Destructor - virtual ~DomainApplicationManager_Impl (void); - - /** - * (1) Parse the global deployment plan, get the total number of - * child plans included in the global plan, and get the list of - * names of NodeManagers for each child plan. - * (2) Check whether all the NodeManager names are present in the - * deployment information data file. - */ - bool get_plan_info (void); - - /** - * Split the global (domain-level) deployment plan to a set of - * local (node-level) deployment plans. The set of local plans - * are cached in the ACE hash map member variable. - * Also, fill in the <node_manager_> field of the Chained_Artifacts - * struct. - */ - int split_plan (void); - - /** - * Construct <Component_Binding_Info> struct for the component instance. - * - * @param name component instance name - * @param child_uuid child plan uuid string - */ - CIAO::Component_Binding_Info * - populate_binding_info (const ACE_CString& name, - const ACE_CString& child_uuid); - - /** - * Construct <Component_Binding_Info> struct for the component instance. - * Fetch the plan_uuid info from the internally cached shared component - * list. - * - * @param name component instance name - */ - CIAO::Component_Binding_Info * - populate_binding_info (const ACE_CString& name); - - /** - * Contact each NodeManager to get shared compnents information - * and then update its internal cache. - */ - void synchronize_shared_components_with_node_managers (void); - - /** - * A helper function to add a list of shared components into - * the cached shared component list. - * - * @param shared A list of shared components to be added. - */ - void add_shared_components (const Deployment::ComponentPlans & shared); - - /** - * A private function to check whether a component is in the shared - * component list. - * - * @param name The name of a component instance. - */ - bool is_shared_component (const char * name); - - /** - * Cache the incoming connections, which is a sequence of Connections, - * into the <all_connections_> list. - */ - void add_connections (const Deployment::Connections & incoming_conn); - - /** - * Given a child deployment plan, find the <Connections> sequence - * of the "providedReference" for the component instances in the - * child deployment plan as Receiver side. - * By default, we search in the new plan. - * - * If <is_getting_all_connections> is false, then we only - * search for "new connections" (valid for ReDaC case only). - * Otherwise, we will search for both new connections and those - * already existing connections. - */ - Deployment::Connections * - get_outgoing_connections (const Deployment::DeploymentPlan &plan, - bool is_getting_all_connections = true, - bool is_search_new_plan = true, - Connection_Search_Type t = Internal_Connections); - - /// This is a helper function to find the connection for a component. - bool - get_outgoing_connections_i (const char * instname, - Deployment::Connections & retv, - bool is_ReDAC, - bool is_search_new_plan); - - bool - populate_connection_for_binding ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv); - - bool - handle_es_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv); - - bool - handle_direct_connection ( - const char * instname, - const Deployment::PlanConnectionDescription & binding, - const Deployment::DeploymentPlan & plan, - Deployment::Connections & retv); - - /// Dump connections, a static method - void dump_connections (const ::Deployment::Connections & connections); - - /// Check whether a connection already exists in the cached old plan - bool already_exists (const Deployment::PlanConnectionDescription & conn); - - /// Remove those appeared in <right> from the <left> - Deployment::Connections * - subtract_connections (const Deployment::Connections & left, - const Deployment::Connections & right); - - void - purge_connections (Deployment::Connections_var & connections, - const char * inst); - - /** - * The first step in finish_launching an application in the - * domain-level. We install all the CIAO_Event_Service objects - * as specified in the DeploymentPlan. - * Internally, this operation will invoke an operation on each cached - * NodeApplication object. - */ - virtual void install_all_es (void); - - /** - * Add all CIAO_Event_Service objects into the cached map. - */ - virtual void - add_es_to_map (const char* node_name, - CIAO::CIAO_Event_Service * ciao_es); - - /** - * Get the actual event connection QoS properties based on the - * deployment requirement. The deployment requirement only specifies - * an identifier/reference to the EventServiceDeploymentDescriptions. - */ - virtual const Deployment::Properties * - get_connection_QoS_configuration ( - const Deployment::Requirement & requirement); - - protected: - /// location of the Domainapplication - CORBA::String_var domainapp_path_; - - /// Keep a pointer to the managing ORB serving this servant. - CORBA::ORB_var orb_; - - /// Keep a pointer to the managing POA. - PortableServer::POA_var poa_; - - /// Pointer to the ExecutionManager_Impl "singleton" servant object - /// We could do this because ExecutionManager and DomainApplicationManager - /// are always collocated in the same process, so we don't have - /// to pass CORBA object reference back and forth. - Execution_Manager::Execution_Manager_Impl * execution_manager_; - - /// Cache a list of shared components - Deployment::ComponentPlans_var shared_; - - /// Cache the ior of the previous reference - CORBA::String_var ior_; - - /// Cached TargetManager. - Deployment::TargetManager_var target_manager_; - - /// Cached deployment plan for the particular domain. - /// The plan will be initialized when init is called. - Deployment::DeploymentPlan plan_; - - /// Cached old deployment plan, i.e., before redeployment - Deployment::DeploymentPlan old_plan_; - - /// Cached child plans. - //Deployment::DeploymentPlan * child_plan_; - - /// Total number of child deployment plans. - size_t num_child_plans_; - - /// The list of node manager names, each of them - /// corresponds to one child plan. - ACE_Vector<ACE_CString> node_manager_names_; + private: + typedef ACE_Map_Manager<ACE_CString, Deployment::DeploymentPlan, ACE_Null_Mutex> TNodePlans; - /// Cached information for NodeManager, NodeApplicationManager, - /// NodeApplication, Connections, etc. - /// Key: NodeManager name with CString type. - /// Value: Chained_Artifacts struct type. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Chained_Artifacts, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Chained_Artifacts_Table; + public: + DomainApplicationManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const Deployment::DeploymentPlan& plan, + Node_Locator &nodes); - Chained_Artifacts_Table artifact_map_; + virtual ~DomainApplicationManager_Impl(); - /// Cached information of all the CIAO_Event_Service objects within - /// the deployment plan - /// Key: the string identifier of the CIAO_Event_Service - /// Value: the object reference of the CIAO_Event_Service - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - CIAO::CIAO_Event_Service_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Event_Service_Table; + virtual Deployment::Application_ptr + startLaunch (const Deployment::Properties & configProperty, + Deployment::Connections_out providedReference); - Event_Service_Table es_map_; + virtual void destroyApplication (Deployment::Application_ptr); - /// The deployment information data file. - const char * deployment_file_; + virtual ::Deployment::Applications * getApplications (void); - /// Deployment Configuration info, which contains the deployment topology. - Deployment_Configuration deployment_config_; + virtual ::Deployment::DeploymentPlan * getPlan (void); - /// UUID from the Plan - CORBA::String_var uuid_; + void dump_connections (const ::Deployment::Connections & connections) const; - /// Maintain a list of <Connections>, each of which is obtained by - /// calling the startLaunch() method on the NodeApplicationManager object. - ::Deployment::Connections_var all_connections_; + private: + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; + const Deployment::DeploymentPlan plan_; + DomainApplication_Impl::TNam2Nm sub_app_mgr_; + Node_Locator &nodes_; + typedef ACE_Vector<DomainApplication_Impl*> TApplications; + TApplications running_app_; - /// This variable is used to control the execution path of some - /// member function implementations. The reason is because we want - /// to avoid unnecessary code duplicate. The default value is "false". - bool is_redeployment_; + static void split_plan (const Deployment::DeploymentPlan & plan, + TNodePlans & sub_plans); - /// Cache the CIAO_Event_Service deployment description - CIAO::DAnCE::EventServiceDeploymentDescriptions_var esd_; - }; -} + void preparePlan(); + }; -#if defined (__ACE_INLINE__) -# include "DomainApplicationManager_Impl.inl" -#endif /* __ACE_INLINE__ */ +};//DAnCE -#include /**/ "ace/post.h" -#endif /* CIAO_DOMAINAPPLICATIONMANAGER_IMPL_H */ +#endif /*DOMAINAPPLICATIONMANAGER_IMPL_H_*/ diff --git a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.inl b/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.inl deleted file mode 100644 index b50adfbc712..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.inl +++ /dev/null @@ -1,16 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_INLINE const char * -CIAO::DomainApplicationManager_Impl::get_uuid () const -{ - return this->uuid_; -} - -ACE_INLINE void -CIAO::DomainApplicationManager_Impl::set_uuid (const char * uuid) -{ - // Copy this uuid reference - this->uuid_ = CORBA::string_dup (uuid); -} diff --git a/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp b/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp new file mode 100644 index 00000000000..2f01f5f92d6 --- /dev/null +++ b/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp @@ -0,0 +1,170 @@ +// $Id$ + +#include "Node_Locator.h" + +#include "ace/Read_Buffer.h" +#include "DAnCE/Logger/Log_Macros.h" + +namespace DAnCE +{ + Node_Locator::Node_Locator (CORBA::ORB_ptr orb, + CosNaming::NamingContext_ptr nc) + : orb_ (CORBA::ORB::_duplicate (orb)), + nc_ (CosNaming::NamingContext::_duplicate (nc)) + { + } + + ::Deployment::NodeManager_ptr + Node_Locator::locate_node (const ACE_TCHAR *name) + { + ACE_CString ior; + + if (this->nodes_.find (name, ior) == 0) + { + return this->resolve_ior (name, ior.c_str ()); + } + else + { + return this->ns_lookup (name); + } + } + + bool + Node_Locator::process_node_map (const ACE_TCHAR *filename) + { + DANCE_TRACE ("Node_Locator::process_node_map"); + + if (filename == 0) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::process_node_map - " + "Error: Provided with nil filename\n")); + return false; + } + + FILE *inf = ACE_OS::fopen (filename, ACE_TEXT("r")); + + if (inf == 0) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::process_node_map - " + "Fail to open node manager map data file: <%s>\n", + filename)); + return false; + } + + ACE_Read_Buffer reader (inf, true); + + char* string = 0; + // Read from the file line by line + while ((string = reader.read ('\n')) != 0) + { + if (ACE_OS::strlen (string) == 0) continue; + + // Search from the right to the first space + const char* ior_start = ACE_OS::strrchr (string, ' '); + // Search from the left to the first space + const char* dest_end = ACE_OS::strchr (string, ' '); + + // The destination is first followed by some spaces + ACE_CString destination (string, dest_end - string); + // And then the IOR + ACE_CString ior (ior_start + 1, ACE_OS::strlen (ior_start + 1)); + reader.alloc ()->free (string); + + DANCE_DEBUG ((LM_INFO, DLINFO "Node_Locator::process_node_map - " + "Storing IOR %C for destination %C\n", + ior.c_str (), destination.c_str ())); + this->nodes_.bind (destination, ior); + } + + return true; + } + + ::Deployment::NodeManager_ptr + Node_Locator::resolve_ior (const ACE_TCHAR *name, const ACE_TCHAR *ior) + { + DANCE_TRACE ("Node_Locator::resolve_ior"); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Locator::resolve_ior - " + "Resolving ior %s for destination %s\n", + ior, name)); + + CORBA::Object_var obj = this->orb_->string_to_object (ior); + + if (CORBA::is_nil (obj.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::resolve_ior - " + "Error: Unable to resolve object reference for destination " + "%s and ior %s\n", + name, ior)); + return false; + } + + ::Deployment::NodeManager_var nm = ::Deployment::NodeManager::_narrow (obj.in ()); + + if (CORBA::is_nil (nm.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::resolve_ior - " + "Error: Unable to narrow reference for destination " + "%s and ior %s\n", + name, ior)); + return false; + } + + return nm._retn (); + } + + void + Node_Locator::store_ior (const ACE_TCHAR *name, const ACE_TCHAR *ior) + { + DANCE_TRACE ("Node_Locator::store_ior"); + this->nodes_.bind (name, ior); + } + + ::Deployment::NodeManager_ptr + Node_Locator::ns_lookup (const ACE_TCHAR *nodename) + { + DANCE_TRACE ("Node_Locator::ns_lookup"); + + if (CORBA::is_nil (this->nc_.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::ns_lookup - " + "Nameservice lookup of %s failed because there is no naming service.\n", + nodename)); + return ::Deployment::NodeManager::_nil (); + } + + try + { + CosNaming::Name name; + name.length (1); + + name[0].id = nodename; + name[0].kind = ACE_TEXT("NodeManager"); + + CORBA::Object_var obj = this->nc_->resolve (name); + ::Deployment::NodeManager_var nm = ::Deployment::NodeManager::_narrow (obj.in ()); + + if (CORBA::is_nil (nm.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::ns_lookup - " + "Unable to narrow provided reference for node %s\n", + nodename)); + return ::Deployment::NodeManager::_nil (); + } + + return nm._retn (); + } + catch (const CORBA::Exception &e) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::ns_lookup - " + "Caught CORBA exception while looking up name %s:%C\n", + nodename, e._info ().c_str ())); + } + catch (...) + { + } + + return ::Deployment::NodeManager::_nil (); + } +} + diff --git a/CIAO/DAnCE/DomainApplicationManager/Node_Locator.h b/CIAO/DAnCE/DomainApplicationManager/Node_Locator.h new file mode 100644 index 00000000000..f3255d0c230 --- /dev/null +++ b/CIAO/DAnCE/DomainApplicationManager/Node_Locator.h @@ -0,0 +1,55 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Node_Locator.h + * + * $Id$ + * + * @Brief Locates NodeManager instances. + * + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef NODE_LOCATOR_H_ +#define NODE_LOCATOR_H_ + +#include "ace/Map_Manager.h" +#include "orbsvcs/orbsvcs/CosNamingC.h" +#include "tao/ORB.h" +#include "DAnCE/Deployment/Deployment_NodeManagerC.h" +#include "DomainApplicationManager/DomainApplicationManager_Export.h" + +namespace DAnCE +{ + class DomainApplicationManager_Export Node_Locator + { + public: + Node_Locator (CORBA::ORB_ptr orb, + CosNaming::NamingContext_ptr nc); + + ::Deployment::NodeManager_ptr locate_node (const ACE_TCHAR *name); + + bool process_node_map (const ACE_TCHAR *file); + + void store_ior (const ACE_TCHAR *name, const ACE_TCHAR *ior); + + private: + ::Deployment::NodeManager_ptr resolve_ior (const ACE_TCHAR *name, + const ACE_TCHAR *ior); + + ::Deployment::NodeManager_ptr ns_lookup (const ACE_TCHAR *name); + + typedef ACE_Map_Manager<ACE_TString, + ACE_TString, + ACE_Null_Mutex> NODEMAP; + + NODEMAP nodes_; + CORBA::ORB_var orb_; + CosNaming::NamingContext_var nc_; + }; + +} + +#endif /* NODE_LOCATOR_H_ */ diff --git a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.cpp b/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.cpp deleted file mode 100644 index 6ebe08457da..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "Reply_Handler_i.h" -#include "DomainApplicationManager_AMI_Impl.h" - -// Implementation skeleton constructor -Deployment_AMI_NodeApplicationManagerHandler_i:: -Deployment_AMI_NodeApplicationManagerHandler_i (CIAO::DomainApplicationManager_AMH_Impl *dam) -: retn_node_app_ (0), - retn_connections_ (0), - dam_ (dam) -{ -} - -// Implementation skeleton destructor -Deployment_AMI_NodeApplicationManagerHandler_i::~Deployment_AMI_NodeApplicationManagerHandler_i (void) -{ -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::startLaunch ( - ::Deployment::Application_ptr ami_return_val, - const ::Deployment::Connections & providedReference) -{ - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_ERROR, - "CIAO (%P|%t): Reply_Handler_i.cpp::AMI startLaunch() returned\n")); - - // Add your implementation here - ACE_Guard<TAO_SYNCH_MUTEX> guard (lock_); - - CIAO::DomainApplicationManager_AMI_Impl * ami_dam = - static_cast<CIAO::DomainApplicationManager_AMI_Impl*> (dam_); - ami_dam->decrease_start_launch_reply_count (); - - // Narrow down to NodeApplication object reference - this->retn_node_app_ = - ::Deployment::NodeApplication::_narrow (ami_return_val); - - this->retn_connections_ = providedReference; - - // Below operation will be called only once, i.e., when the reply count - // drops to zero - if (ami_dam->start_launch_reply_count () == 0) - ami_dam->post_ami_startLaunch (); -} - -::Deployment::NodeApplication_ptr -Deployment_AMI_NodeApplicationManagerHandler_i::get_node_app () -{ - return ::Deployment::NodeApplication::_duplicate ( - this->retn_node_app_.in ()); -} - - -::Deployment::Connections -Deployment_AMI_NodeApplicationManagerHandler_i::get_connections () -{ - return this->retn_connections_; -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::perform_redeployment ( - ::Deployment::Application_ptr, - const ::Deployment::Connections &) -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::perform_redeployment_excep ( - ::Messaging::ExceptionHolder *) -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::reset_plan () -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::reset_plan_excep ( - ::Messaging::ExceptionHolder *) -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::set_shared_components () -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::set_shared_components_excep ( - ::Messaging::ExceptionHolder *) -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::set_priority ( - ::CORBA::Long) -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::set_priority_excep ( - ::Messaging::ExceptionHolder *) -{ - // Add your implementation here -} - - - -void Deployment_AMI_NodeApplicationManagerHandler_i::startLaunch_excep ( - ::Messaging::ExceptionHolder *) -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::destroyApplication () -{ - // Add your implementation here -} - -void Deployment_AMI_NodeApplicationManagerHandler_i::destroyApplication_excep ( - ::Messaging::ExceptionHolder *) -{ - // Add your implementation here -} - diff --git a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.h b/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.h deleted file mode 100644 index 57649c1c948..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/Reply_Handler_i.h +++ /dev/null @@ -1,87 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - - -#ifndef DEPLOYMENT_NODEAPPLICATIONMANAGER_REPLY_HANDLER_H -#define DEPLOYMENT_NODEAPPLICATIONMANAGER_REPLY_HANDLER_H - -#include "DAnCE/Deployment/Deployment_NodeApplicationManagerS.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" -#include "DomainApplicationManager_Export.h" -#include "DomainApplicationManager_AMH_Impl.h" // A base class -#include "ace/Thread_Mutex.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -class DomainApplicationManager_Export Deployment_AMI_NodeApplicationManagerHandler_i - : public virtual POA_Deployment::AMI_NodeApplicationManagerHandler -{ -public: - /// Constructor - Deployment_AMI_NodeApplicationManagerHandler_i (CIAO::DomainApplicationManager_AMH_Impl *dam); - - /// Destructor - virtual ~Deployment_AMI_NodeApplicationManagerHandler_i (void); - - virtual - void startLaunch ( - ::Deployment::Application_ptr ami_return_val, - const ::Deployment::Connections & providedReference); - - ::Deployment::NodeApplication_ptr get_node_app (void); - - ::Deployment::Connections get_connections (void); - - /// Unused operations - - virtual - void perform_redeployment ( - ::Deployment::Application_ptr ami_return_val, - const ::Deployment::Connections & providedReference); - - virtual - void perform_redeployment_excep (::Messaging::ExceptionHolder *); - - virtual - void reset_plan (void); - - virtual - void reset_plan_excep (::Messaging::ExceptionHolder *); - - virtual - void set_shared_components (void); - - virtual - void set_shared_components_excep (::Messaging::ExceptionHolder *); - - virtual - void set_priority (::CORBA::Long); - - virtual - void set_priority_excep (::Messaging::ExceptionHolder *); - - virtual - void startLaunch_excep (::Messaging::ExceptionHolder *); - - virtual - void destroyApplication (void); - - virtual - void destroyApplication_excep (::Messaging::ExceptionHolder *); - -private: - ::Deployment::NodeApplication_var retn_node_app_; - - ::Deployment::Connections retn_connections_; - - TAO_SYNCH_MUTEX lock_; - - ::CIAO::DomainApplicationManager_AMH_Impl * dam_; -}; - - -#endif /* DEPLOYMENT_NODEAPPLICATIONMANAGER_REPLY_HANDLER_H */ - diff --git a/CIAO/DAnCE/DomainApplicationManager/Task_StartLaunch.cpp b/CIAO/DAnCE/DomainApplicationManager/Task_StartLaunch.cpp deleted file mode 100644 index 257a8a4ae37..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/Task_StartLaunch.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -// $Id$ -// -#include "Task_StartLaunch.h" - -CIAO::Task_StartLaunch:: -Task_StartLaunch ( - const char * node_name, - const ::Deployment::NodeApplicationManager_ptr nam, - const ::Deployment::Properties & configProperty) - : node_name_ (node_name) - , nam_ (::Deployment::NodeApplicationManager::_duplicate (nam)) - , configProperty_ (configProperty) -{ -} - -int -CIAO::Task_StartLaunch::svc (void) -{ - try - { - ::Deployment::Application_var temp_application = - this->nam_->startLaunch (this->configProperty_, - retn_connections_.out (), - 0); - - // Narrow down to NodeApplication object reference - this->retn_node_app_ = - ::Deployment::NodeApplication::_narrow (temp_application.in ()); - - if (CORBA::is_nil (retn_node_app_.in ())) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) Task_StartLaunch.cpp -" - "CIAO::Task_StartLaunch::svc -" - "ERROR while narrowing the NAM " - "for the node [%s] \n", - node_name_.c_str ())); - - ACE_CString error - ("The DomainApplicationManager receives a nil " - "reference of NodeApplication after calling " - "startLaunch on NodeApplicationManager.\n"); - ACE_ERROR ((LM_ERROR, error.c_str ())); - - throw - (Deployment::StartError - ("DomainApplicationManager_Impl::startLaunch", - error.c_str ())); - } - } - catch (const CORBA::Exception&) - { - return 0; - } - return 0; -} - -::Deployment::Connections -CIAO::Task_StartLaunch::get_connections () -{ - return this->retn_connections_.in (); -} - -::Deployment::NodeApplication_ptr -CIAO::Task_StartLaunch::get_node_app () -{ - return ::Deployment::NodeApplication::_duplicate ( - this->retn_node_app_.in ()); -} diff --git a/CIAO/DAnCE/DomainApplicationManager/Task_StartLaunch.h b/CIAO/DAnCE/DomainApplicationManager/Task_StartLaunch.h deleted file mode 100644 index 5046a75cb29..00000000000 --- a/CIAO/DAnCE/DomainApplicationManager/Task_StartLaunch.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Task_StartLaunch.h - * - * $Id$ - * - * An ACE_Task subclass that implements the <startLaunch> task, which - * basically calls <startLaunch> operation on a NodeApplicationManager. - * - * @author Gan Deng <gan.deng@vanderbilt.edu> - */ -//============================================================================= - - -#ifndef CIAO_TASK_START_LAUNCH_H -#define CIAO_TASK_START_LAUNCH_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/ORB_Core.h" -#include "tao/ORB.h" -#include "ace/Task.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationManagerS.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationS.h" - -namespace CIAO -{ - /** - * @class Task_StartLaunch - * - * @brief An ACE_Task subclass that allow the <startLaunch> invocation - * to be completed in a separate thread than then main thread running - * the DomainApplicationManager. - */ - class Task_StartLaunch - : public virtual ACE_Task_Base - { - public: - Task_StartLaunch (const char * node_name, - const ::Deployment::NodeApplicationManager_ptr nam, - const ::Deployment::Properties & configProperty); - - /// Service entry point - virtual int svc (void); - - /// Accessor method to get returned connections - ::Deployment::Connections get_connections (); - - /// Accessor method to get returned NA - ::Deployment::NodeApplication_ptr get_node_app (); - - protected: - //CORBA::ORB_var orb_; - - /// The node name which hosts the NAM - ACE_CString node_name_; - - /// Input parameter which identifies the NAM to invoke the call - ::Deployment::NodeApplicationManager_var nam_; - - /// Input parameter of the configProperty - const ::Deployment::Properties & configProperty_; - - /// The NA obj ref is a return value by calling startLaunch on NAM - ::Deployment::NodeApplication_var retn_node_app_; - - /// Returned object references of <connections>, i.e., provided ports - ::Deployment::Connections_var retn_connections_; - }; - -} - -#include /**/ "ace/post.h" -#endif /* CIAO_TASK_START_LAUNCH_H */ diff --git a/CIAO/DAnCE/ExecutionManager/DAM_Map.cpp b/CIAO/DAnCE/ExecutionManager/DAM_Map.cpp deleted file mode 100644 index 5d50cc682d0..00000000000 --- a/CIAO/DAnCE/ExecutionManager/DAM_Map.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "DAM_Map.h" -#include "ciao/CIAO_Config.h" -#include "ciao/CIAO_common.h" - -ACE_RCSID (ExecutionManager, - DAM_Map, - "$Id$") - -namespace CIAO -{ - namespace Execution_Manager - { - DAM_Map::DAM_Map (void) - : map_ (CIAO_DEFAULT_MAP_SIZE) - { - } - - size_t - DAM_Map::size (void) const - { - return this->map_.current_size (); - } - - bool - DAM_Map::is_plan_available (const ACE_CString &str) const - { - CIAO_TRACE("Execution_Manager::DAM_Map::is_plan_available"); - if (this->map_.find (str) == 0) - return true; - - return false; - } - - ::Deployment::DomainApplicationManager_ptr - DAM_Map::fetch_dam_reference (const ACE_CString &str) - { - CIAO_TRACE("Execution_Manager::DAM_Map::fetch_dam_reference"); - if (!this->is_plan_available (str)) - return ::Deployment::DomainApplicationManager::_nil (); - - ::Deployment::DomainApplicationManager_var tmp; - - /// There should be duplicate when assigning a _var to an _var. - int const retval = this->map_.find (str, tmp); - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) CIAO_ExecutionManager: fetch_dam_reference, " - "result from find is [%d] \n", - retval)); - } - - return tmp._retn (); - } - - - bool - DAM_Map::bind_dam_reference ( - const ACE_CString &str, - ::Deployment::DomainApplicationManager_ptr dam) - { - CIAO_TRACE("Execution_Manager::DAM_Map::bind_dam_reference"); - - if (this->map_.rebind (str, dam) != 0) - return false; - - return true; - } - - - Deployment::DomainApplicationManagers * - DAM_Map::get_dams () - { - CIAO_TRACE("Execution_Manager::DAM_Map::get_dams"); - CORBA::ULong const sz = this->map_.current_size (); - - // Initialize the list of DomainApplication Managers - Deployment::DomainApplicationManagers_var list; - ACE_NEW_THROW_EX (list, - Deployment::DomainApplicationManagers (sz), - CORBA::NO_MEMORY()); - - // Add the manager to the list - list->length (sz); - - Iterator end = this->map_.end (); - - CORBA::ULong i = 0; - - for (Iterator b = this->map_.begin (); b != end; ++b) - { - list [i] = - Deployment::DomainApplicationManager::_duplicate ((*b).int_id_.in ()); - - ++i; - } - - return list._retn (); - } - - bool - DAM_Map::unbind_dam (const ACE_CString &str) - { - CIAO_TRACE("Execution_Manager::DAM_Map::unbind_dam"); - - if (this->map_.unbind (str) != 0) - return false; - - return true; - } - } -} diff --git a/CIAO/DAnCE/ExecutionManager/DAM_Map.h b/CIAO/DAnCE/ExecutionManager/DAM_Map.h deleted file mode 100644 index 734b953d912..00000000000 --- a/CIAO/DAnCE/ExecutionManager/DAM_Map.h +++ /dev/null @@ -1,71 +0,0 @@ -/*======================================================================= - * - * @file DAM_Map.h - * - * $Id$ - * - * @brief Map of DomainApplicationManager to UUID's - * - * @author Bala Natarajan <bala @ dre.vanderbilt.edu> - * - *======================================================================*/ -#ifndef CIAO_DAM_MAP_H -#define CIAO_DAM_MAP_H -#include /**/ "ace/pre.h" - -#include "DAnCE/Deployment/Deployment_DomainApplicationManagerC.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" -#include "ace/Hash_Map_Manager.h" -#include "ace/SString.h" - -namespace CIAO -{ - namespace Execution_Manager - { - /** - * @class DAM_Map - * - * @brief Map of DomainApplicationManager to ACE_CStrings - * - */ - class DAM_Map - { - public: - DAM_Map (void); - - bool is_plan_available (const ACE_CString &str) const; - - ::Deployment::DomainApplicationManager_ptr - fetch_dam_reference (const ACE_CString &str); - - bool bind_dam_reference ( - const ACE_CString &str, - ::Deployment::DomainApplicationManager_ptr tmp); - - Deployment::DomainApplicationManagers *get_dams (); - - bool unbind_dam (const ACE_CString &str); - - size_t size (void) const; - - private: - typedef - ACE_Hash_Map_Manager_Ex < ACE_CString, - ::Deployment::DomainApplicationManager_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> MAP; - typedef MAP::iterator Iterator; - - MAP map_; - }; - } -} - -#include /**/ "ace/post.h" -#endif /*CIAO_DAM_MAP_H*/ diff --git a/CIAO/DAnCE/ExecutionManager/DAnCE_ExecutionManager_Module_Export.h b/CIAO/DAnCE/ExecutionManager/DAnCE_ExecutionManager_Module_Export.h new file mode 100644 index 00000000000..6ab710d4044 --- /dev/null +++ b/CIAO/DAnCE/ExecutionManager/DAnCE_ExecutionManager_Module_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DAnCE_ExecutionManager_Module +// ------------------------------ +#ifndef DANCE_EXECUTIONMANAGER_MODULE_EXPORT_H +#define DANCE_EXECUTIONMANAGER_MODULE_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL) +# define DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL */ + +#if !defined (DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL) +# define DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL 1 +#endif /* ! DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL */ + +#if defined (DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL) && (DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL == 1) +# if defined (DANCE_EXECUTIONMANAGER_MODULE_BUILD_DLL) +# define DAnCE_ExecutionManager_Module_Export ACE_Proper_Export_Flag +# define DANCE_EXECUTIONMANAGER_MODULE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DANCE_EXECUTIONMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DANCE_EXECUTIONMANAGER_MODULE_BUILD_DLL */ +# define DAnCE_ExecutionManager_Module_Export ACE_Proper_Import_Flag +# define DANCE_EXECUTIONMANAGER_MODULE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DANCE_EXECUTIONMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DANCE_EXECUTIONMANAGER_MODULE_BUILD_DLL */ +#else /* DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL == 1 */ +# define DAnCE_ExecutionManager_Module_Export +# define DANCE_EXECUTIONMANAGER_MODULE_SINGLETON_DECLARATION(T) +# define DANCE_EXECUTIONMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DANCE_EXECUTIONMANAGER_MODULE_HAS_DLL == 1 */ + +// Set DANCE_EXECUTIONMANAGER_MODULE_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DANCE_EXECUTIONMANAGER_MODULE_NTRACE) +# if (ACE_NTRACE == 1) +# define DANCE_EXECUTIONMANAGER_MODULE_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DANCE_EXECUTIONMANAGER_MODULE_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DANCE_EXECUTIONMANAGER_MODULE_NTRACE */ + +#if (DANCE_EXECUTIONMANAGER_MODULE_NTRACE == 1) +# define DANCE_EXECUTIONMANAGER_MODULE_TRACE(X) +#else /* (DANCE_EXECUTIONMANAGER_MODULE_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_EXECUTIONMANAGER_MODULE_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DANCE_EXECUTIONMANAGER_MODULE_NTRACE == 1) */ + +#endif /* DANCE_EXECUTIONMANAGER_MODULE_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc b/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc index 9e3f54d46ca..948701fc5ad 100644 --- a/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc +++ b/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc @@ -1,16 +1,23 @@ // -*- MPC -*- // $Id$ -project(ExecutionManager): ciao_server_dnc, dance_extension_stub, ciao_domainapplicationmanager_dnc, ciao_executionmanager_stub, rtcorba, rtportableserver, rt_server, ciaoexe, rtcorba, strategies { - exename = Execution_Manager - - IDL_Files { +project(ExecutionManager_Module): dance_lib, taolib, tao_output, utils, strategies, naming, dance_executionmanager_stub, dance_node_manager, dance_domain_application_manager, dance_deployment_svnt { + sharedname = DAnCE_ExecutionManager + dynamicflags = EXECUTIONMANAGER_BUILD_DLL DANCE_EXECUTIONMANAGER_MODULE_BUILD_DLL + + Source_Files { + $(CIAO_ROOT)/DAnCE/Interfaces/ExecutionManagerDaemonS.cpp + ExecutionManager_Impl.cpp + ExecutionManager_Module.cpp } +} + +project(Execution_Manager_Exec) : dance_exe, dance_domain_application_manager, naming_serv, dance_executionmanager_stub { + exename = dance_execution_manager + after += ExecutionManager_Module + libs += DAnCE_ExecutionManager Source_Files { - ../Interfaces/ExecutionManagerDaemonS.cpp - Execution_Manager.cpp - Execution_Manager_Impl.cpp - DAM_Map.cpp + Execution_Manager_Exec.cpp } -} +}
\ No newline at end of file diff --git a/CIAO/DAnCE/ExecutionManager/ExecutionManager_Export.h b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Export.h new file mode 100644 index 00000000000..8633f5d5400 --- /dev/null +++ b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Export.h @@ -0,0 +1,57 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ExecutionManager +// ------------------------------ +#ifndef EXECUTIONMANAGER_EXPORT_H +#define EXECUTIONMANAGER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (EXECUTIONMANAGER_HAS_DLL) +# define EXECUTIONMANAGER_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && EXECUTIONMANAGER_HAS_DLL */ + +#if !defined (EXECUTIONMANAGER_HAS_DLL) +# define EXECUTIONMANAGER_HAS_DLL 1 +#endif /* ! EXECUTIONMANAGER_HAS_DLL */ + +#if defined (EXECUTIONMANAGER_HAS_DLL) && (EXECUTIONMANAGER_HAS_DLL == 1) +# if defined (EXECUTIONMANAGER_BUILD_DLL) +# define ExecutionManager_Export ACE_Proper_Export_Flag +# define EXECUTIONMANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define EXECUTIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* EXECUTIONMANAGER_BUILD_DLL */ +# define ExecutionManager_Export ACE_Proper_Import_Flag +# define EXECUTIONMANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define EXECUTIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* EXECUTIONMANAGER_BUILD_DLL */ +#else /* EXECUTIONMANAGER_HAS_DLL == 1 */ +# define ExecutionManager_Export +# define EXECUTIONMANAGER_SINGLETON_DECLARATION(T) +# define EXECUTIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* EXECUTIONMANAGER_HAS_DLL == 1 */ + +// Set EXECUTIONMANAGER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (EXECUTIONMANAGER_NTRACE) +# if (ACE_NTRACE == 1) +# define EXECUTIONMANAGER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define EXECUTIONMANAGER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !EXECUTIONMANAGER_NTRACE */ + +#if (EXECUTIONMANAGER_NTRACE == 1) +# define EXECUTIONMANAGER_TRACE(X) +#else /* (EXECUTIONMANAGER_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define EXECUTIONMANAGER_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (EXECUTIONMANAGER_NTRACE == 1) */ + +#endif /* EXECUTIONMANAGER_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.cpp b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.cpp new file mode 100644 index 00000000000..7dd4ba032cb --- /dev/null +++ b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.cpp @@ -0,0 +1,157 @@ +//--*C++*-- +// $Id$ + +#include "ExecutionManager_Impl.h" +#include "ace/Log_Msg.h" +#include "tools/Config_Handlers/DnC_Dump.h" +#include "DAnCE/Logger/Log_Macros.h" + + +using namespace DAnCE; + +ExecutionManager_Impl::ExecutionManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNaming::NamingContext_ptr nc) + : orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)), + locator_ (orb, nc) +{ + DANCE_TRACE ( "ExecutionManager_Impl::ExecutionManager_Impl"); +} + +ExecutionManager_Impl::~ExecutionManager_Impl() +{ + DANCE_TRACE ( "ExecutionManager_Impl::~ExecutionManager_Impl"); + for (TDomainManagers::iterator iter = this->managers_.begin(); + iter != this->managers_.end(); + ++iter) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "ExecutionManager_Impl::~ExecutionManager_Impl - " + "deactivating DAM \"%C\"\n", (*iter).ext_id_.c_str())); + PortableServer::ObjectId_var id = this->poa_->servant_to_id ( (*iter).int_id_); + DANCE_DEBUG ((LM_TRACE, DLINFO "ExecutionManager_Impl::~ExecutionManager_Impl - " + "before deactivate_object...\n")); + this->poa_->deactivate_object (id.in()); + DANCE_DEBUG ((LM_TRACE, DLINFO "ExecutionManager_Impl::~ExecutionManager_Impl - " + "deleting DomainApplicationManager\n")); + delete (*iter).int_id_; + DANCE_DEBUG ((LM_TRACE, DLINFO "ExecutionManager_Impl::~ExecutionManager_Impl - " + "DomainApplicationManager deleted\n")); + } +} + +::Deployment::DomainApplicationManager_ptr +ExecutionManager_Impl::preparePlan (const ::Deployment::DeploymentPlan & plan, + ::Deployment::ResourceCommitmentManager_ptr /*resourceCommitment*/) +{ + DANCE_TRACE ( "ExecutionManager_Impl::preparePlan"); + + // Check if plan is already deployed. + DomainApplicationManager_Impl * dam = 0; + if (0 == this->managers_.find (plan.UUID.in(), dam)) + { + DANCE_DEBUG((LM_NOTICE, DLINFO "ExecutionManager_Impl::preparePlan - " + "DomainApplicationManager with specified UUID already exists\n")); + // Should we return on this situation reference on existed DomainApplicationManager or + // we should throw PlanError exception? + CORBA::Object_var ref = this->poa_->servant_to_reference (dam); + return Deployment::DomainApplicationManager::_narrow (ref.in ()); + } + + DomainApplicationManager_Impl* dam_servant = 0; + ACE_NEW_THROW_EX (dam_servant, + DAnCE::DomainApplicationManager_Impl (this->orb_.in (), + this->poa_.in (), + plan, + this->locator_), + CORBA::NO_MEMORY ()); + this->managers_.rebind (plan.UUID.in(), dam_servant); + DANCE_DEBUG((LM_TRACE, DLINFO "ExecutionManager_Impl::preparePlan - " + "Domain Application Manager was successfully created.\n")); + + PortableServer::ObjectId_var id = this->poa_->activate_object (dam_servant); + + DANCE_DEBUG((LM_NOTICE, DLINFO "ExecutionManager_Impl::preparePlan - " + "Plan with UUID %C was successfully prepared.\n")); + CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); + return Deployment::DomainApplicationManager::_narrow (ref.in ()); +} + +::Deployment::DomainApplicationManagers * +ExecutionManager_Impl::getManagers () +{ + DANCE_TRACE ( "ExecutionManager_Impl::getManagers ()"); + + ::Deployment::DomainApplicationManagers * managers = 0; + ACE_NEW_THROW_EX (managers, + ::Deployment::DomainApplicationManagers(), + CORBA::NO_MEMORY()); + + managers->length (this->managers_.current_size()); + unsigned int index = 0; + for (TDomainManagers::iterator iter = this->managers_.begin(); + iter != this->managers_.end(); + ++iter) + { + CORBA::Object_var ref = this->poa_->servant_to_reference ( (*iter).int_id_); + (*managers) [index] + = Deployment::DomainApplicationManager::_narrow (ref.in ()); + ++index; + } + + return managers; +} + +void +ExecutionManager_Impl::destroyManager (::Deployment::DomainApplicationManager_ptr appManager) +{ + DANCE_DEBUG((LM_DEBUG, DLINFO "ExecutionManager_Impl::destroyManager - started\n")); + + for (TDomainManagers::iterator iter = this->managers_.begin(); + iter != this->managers_.end(); + ++iter) + { + CORBA::Object_var app = this->poa_->servant_to_reference ( (*iter).int_id_); + if (appManager->_is_equivalent (app.in ())) + { + this->managers_.unbind ( (*iter).ext_id_); + PortableServer::ObjectId_var id = this->poa_->reference_to_id (appManager); + this->poa_->deactivate_object (id.in()); + DANCE_DEBUG((LM_INFO, DLINFO "ExecutionManager_Impl::destroyManager - deleting DomainApplicationManager\n")); + delete (*iter).int_id_; + (*iter).int_id_ = 0; + DANCE_DEBUG((LM_INFO, DLINFO "ExecutionManager_Impl::destroyManager - DomainApplicationManager deleted\n")); + //this->managers_.unbind ( (*iter).ext_id_); + DANCE_DEBUG((LM_INFO, DLINFO "ExecutionManager_Impl::destroyManager - finished\n")); + return; + } + } + DANCE_ERROR ((LM_ERROR, DLINFO "ExecutionManager_Impl::destroyManager - " + "corresponding DomainApplicationManager cannot be found\n")); + throw ::Deployment::StopError(); +} + +// This one derived from ExecutionManagerDaemon interface +// for shutdowning DAnCE agent +void +ExecutionManager_Impl::shutdown () +{ + DANCE_TRACE ("ExecutionManager_Impl::shutdown"); + this->orb_->shutdown(); +} + + +void +ExecutionManager_Impl::add_node_manager (const ACE_TCHAR *name, + const ACE_TCHAR *ior) +{ + DANCE_TRACE ("ExecutionManager_Impl::add_node_manager"); + this->locator_.store_ior (name, ior); +} + +void +ExecutionManager_Impl::load_node_map (const ACE_TCHAR *filename) +{ + DANCE_TRACE ("ExecutionManager_Impl::add_node_manager"); + this->locator_.process_node_map (filename); +} diff --git a/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.h b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.h new file mode 100644 index 00000000000..71032330eda --- /dev/null +++ b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.h @@ -0,0 +1,71 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ExecutionManager_Impl.h + * + * $Id$ + * + * @Brief Implementation of Deployment::ExecutionManager and POA_DAnCE::ExecutionManagerDaemon + * + * @author Erwin Gottlieb <eg@prismtech.com> + */ +//============================================================================= + +#ifndef EXECUTIONMANAGER_IMPL_H_ +#define EXECUTIONMANAGER_IMPL_H_ + +#include "ace/Map_Manager.h" +#include "ace/SStringfwd.h" +#include "orbsvcs/orbsvcs/CosNamingC.h" +#include "ExecutionManager_Export.h" +#include "Interfaces/ExecutionManagerDaemonS.h" +#include "Deployment/Deployment_NodeManagerC.h" +#include "DomainApplicationManager/DomainApplicationManager_Impl.h" +#include "DomainApplicationManager/Node_Locator.h" + +namespace DAnCE + { + class ExecutionManager_Export ExecutionManager_Impl + : public virtual POA_DAnCE::ExecutionManagerDaemon + { + private: + typedef ACE_Map_Manager<ACE_CString, DomainApplicationManager_Impl*, ACE_Null_Mutex> TDomainManagers; + + public: + + ExecutionManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNaming::NamingContext_ptr); + + virtual ~ExecutionManager_Impl(); + + virtual ::Deployment::DomainApplicationManager_ptr preparePlan ( + const ::Deployment::DeploymentPlan & plan, + ::Deployment::ResourceCommitmentManager_ptr resourceCommitment + ); + + virtual ::Deployment::DomainApplicationManagers * getManagers ( + ); + + virtual void destroyManager ( + ::Deployment::DomainApplicationManager_ptr manager + ); + + // This one derived from ExecutionManagerDaemon interface + // for shutdowning DAnCE agent + virtual void shutdown (); + + void add_node_manager (const ACE_TCHAR *name, const ACE_TCHAR *ior); + + void load_node_map (const ACE_TCHAR *filename); + + private: + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; + TDomainManagers managers_; + Node_Locator locator_; + }; +};//DAnCE + +#endif /*EXECUTIONMANAGER_IMPL_H_*/ diff --git a/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.cpp b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.cpp new file mode 100644 index 00000000000..13751581223 --- /dev/null +++ b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.cpp @@ -0,0 +1,382 @@ +// -*- C++ -*- +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/OS.h" + +#include "tao/TAO_Singleton_Manager.h" +#include "tao/StringSeqC.h" +#include "tao/IORTable/IORTable.h" +#include "tao/Utils/PolicyList_Destroyer.h" +#include "orbsvcs/CosNamingC.h" +#include "ciao/CIAO_common.h" +#include "ciao/Valuetype_Factories/Cookies.h" +#include "ExecutionManager_Module.h" +#include "ExecutionManager_Impl.h" +#include "RedirectionService/RedirectionService.h" +#include "DAnCE/Logger/Log_Macros.h" + +ACE_RCSID (DAnCE, + DAnCE_ExecutionManager_Module, + "$Id$") + +namespace DAnCE +{ + namespace ExecutionManager + { + bool + write_IOR (const char * ior_file_name, const char* ior) + { + FILE* ior_output_file_ = + ACE_OS::fopen (ior_file_name, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + DANCE_DEBUG ( (LM_TRACE, DLINFO "ExectionManager::write_IOR - EM's ior was written into file \"%C\"\n", ior_file_name)); + return true; + } + else + { + DANCE_ERROR ( (LM_ERROR, + "[%M] DAnCE_ExecutionManager::write_ior-file - " + "Unable to open ExecutionManager IOR output file %C : %m\n", + ior_file_name)); + return false; + } + return true; + } + } +} + +DAnCE_ExecutionManager_Module::DAnCE_ExecutionManager_Module (void) + : em_impl_ (0) +{ +} + +DAnCE_ExecutionManager_Module::~DAnCE_ExecutionManager_Module (void) +{ + delete this->em_impl_; +} + +bool +DAnCE_ExecutionManager_Module::parse_args (int argc, char *argv[]) +{ + DANCE_TRACE ("DAnCE_ExecutionManager_Module::parse_args"); + + ACE_Get_Opt get_opts (argc, + argv, + "n:e::p::c::r::ifh", + 0, + 0, + ACE_Get_Opt::RETURN_IN_ORDER); + + get_opts.long_option ("exec-mgr", 'e', ACE_Get_Opt::ARG_OPTIONAL); + get_opts.long_option ("node-mgr", 'n', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option ("process-ns", 'p', ACE_Get_Opt::ARG_OPTIONAL); + get_opts.long_option ("create-plan-ns", 'c', ACE_Get_Opt::ARG_OPTIONAL); + get_opts.long_option ("rebind-plan-ns", 'r', ACE_Get_Opt::ARG_OPTIONAL); + get_opts.long_option ("port-indirection", 'i', ACE_Get_Opt::NO_ARG); + get_opts.long_option ("ignore-failure", 'f', ACE_Get_Opt::NO_ARG); + get_opts.long_option ("help", 'h', ACE_Get_Opt::NO_ARG); + get_opts.long_option ("node-map", ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option ("domain-nc", ACE_Get_Opt::ARG_REQUIRED); + + //get_opts.long_option ("help", '?'); + + char c; + while ( (c = get_opts ()) != -1) + { + switch (c) + { + case 'e': + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::parse_args - " + "Output filename is %C\n", + get_opts.opt_arg ())); + this->options_.exec_mgr_file_ = get_opts.opt_arg (); + break; + case 'n': + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::parse_args - " + "--node-mgr option was parsed out for EM\n")); + this->options_.node_managers_.push_back (get_opts.opt_arg ()); + break; + + case 'p': + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::parse_args - " + "--process-ns enabled for EM\n")); + this->options_.process_ns_ = true; + this->options_.process_ns_file_ = get_opts.opt_arg (); + break; + + case 'c': + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::parse_args - " + "--create-plan-ns enabled for EM\n")); + this->options_.create_plan_ns_ = true; + this->options_.create_plan_ns_ior_ = get_opts.opt_arg (); + break; + + case 'r': + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::parse_args - " + "--rebind-plan-ns enabled for EM\n")); + this->options_.rebind_plan_ns_ = true; + this->options_.rebind_plan_ns_ior_ = get_opts.opt_arg (); + break; + + case 'i': + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::parse_args - " + "--port-indirection enabled for EM\n")); + this->options_.port_indirection_ = true; + break; + + case 'f': + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::parse_args - " + "--ignore-failure enabled for EM\n")); + this->options_.ignore_failure_ = true; + break; + + case 0: + if (ACE_OS::strcmp (get_opts.long_option (), + "node-map") == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Found Node map filename %C.\n", + get_opts.opt_arg ())); + this->options_.node_map_ = get_opts.opt_arg (); + break; + + } + else if (ACE_OS::strcmp (get_opts.long_option (), + "domain-nc") == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Binding to domain naming context %C.\n", + get_opts.opt_arg ())); + this->options_.domain_nc_ = get_opts.opt_arg (); + break; + } + + case 'h': + //case '?': // Display help for use of the server. + //default: + DANCE_ERROR_RETURN ((LM_ERROR, + "usage: %C\n" + "\t--exec-mgr,-e [execution manager ior file name]\n" + "\t--node-mgr,-n <node name>[=node manager ior file name]\n" + "\t--node-map <file name> \t\tFile containing a node manager map\n" + "\t--domain-nc <nc ior> \t\tIOR for the Domain Naming Context\n" + //"--process-ns,-p [file name] \t\tcreate process name service and store its ior to file name\n" + //"--create-plan-ns,-c [NC] \t\tcreate plan objects (components and ports) representation in name context with ior NC\n" + //"--rebind-plan-ns,-r [NC] \t\tbind plan representation name context to NC\n" + //"-i \t\t\t\tenable plan objects indirection via servant locator\n", + ,argv [0]), + false); + break; + } + } + return true; +} + +CORBA::Object_ptr +DAnCE_ExecutionManager_Module::create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv[]) +{ + DANCE_TRACE ("DAnCE_ExecutionManager_Module::create_object"); + + try + { + if (this->em_impl_ != 0) + { + DANCE_ERROR ( (LM_ERROR, + DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "Error: ExecutionManager already exists.\n")); + return CORBA::Object::_nil (); + } + + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "before parsing arguments.\n")); + + if (!this->parse_args (argc, argv)) + return CORBA::Object::_nil (); + + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "before creating value factory.\n")); + CORBA::ValueFactory_var vf = new Components::Cookie_init(); + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "before registering value factory.\n")); + vf = orb->register_value_factory ("IDL:omg.org/Components/Cookie:1.0", vf.in()); + + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "after creating value factory.\n")); + // Get reference to Root POA. + CORBA::Object_var poa_obj + = orb->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var poa + = PortableServer::POA::_narrow (poa_obj.in ()); + + PortableServer::POAManager_var mgr = poa->the_POAManager (); + + PortableServer::POA_var persistent_poa; + TAO::Utils::PolicyList_Destroyer policies (2); + policies.length (2); + try + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "before creating the \"Managers\" POA.\n")); + + policies[0] = poa->create_id_assignment_policy (PortableServer::USER_ID); + policies[1] = poa->create_lifespan_policy (PortableServer::PERSISTENT); + persistent_poa = poa->create_POA ("Managers", + mgr.in(), + policies); + } + catch (const PortableServer::POA::AdapterAlreadyExists &) + { + persistent_poa = poa->find_POA ("Managers", 0); + } + + CosNaming::NamingContext_var domain_nc; + + // Resolve DomainNC + try + { + if (this->options_.domain_nc_) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "before resolving \"DomainNC\".\n")); + CORBA::Object_var domain_obj = orb->string_to_object (this->options_.domain_nc_); + if (!CORBA::is_nil (domain_obj.in ())) + { + domain_nc = CosNaming::NamingContext::_narrow (domain_obj.in()); + if (CORBA::is_nil (domain_nc.in ())) + { + DANCE_ERROR ( (LM_ERROR, + DLINFO "Narrow to NamingContext return nil for DomainNC.\n")); + return CORBA::Object::_nil (); + } + } + } + } + catch (CORBA::Exception&) + { + DANCE_DEBUG ((LM_DEBUG, + DLINFO "DomainNC context not found!\n")); + } + + // Initialize IOR table + CORBA::Object_var table_object + = orb->resolve_initial_references ("IORTable"); + + IORTable::Table_var adapter + = IORTable::Table::_narrow (table_object.in ()); + + if (CORBA::is_nil (adapter.in ())) + { + DANCE_ERROR ( (LM_ERROR, + DLINFO "Nil IORTable\n")); + return CORBA::Object::_nil (); + } + + // Create and install the DAnCE Daemon servant on child POA + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - before creating EM servant.\n")); + ACE_NEW_RETURN (this->em_impl_, + DAnCE::ExecutionManager_Impl (orb, + poa.in (), + domain_nc.in ()), + CORBA::Object::_nil ()); + + // Explicit activation through the persistent POA + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId ("ExecutionManager"); + persistent_poa->activate_object_with_id (oid, this->em_impl_); + + CORBA::Object_var em_obj = persistent_poa->id_to_reference (oid.in ()); + CORBA::String_var em_ior = orb->object_to_string (em_obj.in ()); + + DAnCE::ExecutionManagerDaemon_var em_daemon + = DAnCE::ExecutionManagerDaemon::_narrow (em_obj.in ()); + + // Binding ior to IOR Table + adapter->bind ("ExecutionManager", em_ior.in ()); + + // Saving execution manager ior + if (0 != this->options_.exec_mgr_file_) + { + DAnCE::ExecutionManager::write_IOR (this->options_.exec_mgr_file_, em_ior.in ()); + } + + // Binding execution manager to name service + if (!CORBA::is_nil (domain_nc.in ())) + { + DANCE_DEBUG((LM_TRACE, DLINFO "Registering EM in NC.\n")); + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup ("ExecutionManager"); + domain_nc->rebind (name, em_daemon.in()); + } + + // End ExecutionManager initialization part + + // Initializing NodeManagers + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "before processing --node-mgr options(%u).\n", this->options_.node_managers_.size())); + for (size_t i = 0; i < this->options_.node_managers_.size(); ++i) + { + size_t pos = this->options_.node_managers_[i].find ('='); + ACE_CString node_name = this->options_.node_managers_[i]; + ACE_CString nm_ior; + + if (ACE_CString::npos == pos) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "Execution manager received --node-mgr without IOR\n")); + continue; + } + + node_name = this->options_.node_managers_[i].substring (0, pos); + nm_ior = this->options_.node_managers_[i].substring (pos + 1); + /* + CORBA::Object_var obj = orb->string_to_object (nm_ior.c_str ()); + Deployment::NodeManager_var nm_obj = + Deployment::NodeManager::_narrow (obj.in ()); + + if (CORBA::is_nil (nm_obj)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_ExecutionManager::create_object - " + "Failed to narrow the object to node manager : %C\n", + this->options_.node_managers_[i].c_str())); + continue; + } + */ + DANCE_DEBUG ((LM_TRACE, DLINFO "Placing node \"%C\" to EM's map.\n", node_name.c_str())); + this->em_impl_->add_node_manager (node_name.c_str(), nm_ior.c_str ()); + } + + if (this->options_.node_map_ != 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_ExecutionManager_Module::create_object - " + "Parsing node map %C\n", + this->options_.node_map_)); + this->em_impl_->load_node_map (this->options_.node_map_); + } + + + mgr->activate (); + + return em_obj._retn (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("DAnCE_ExecutionManager::run_main\n"); + return CORBA::Object::_nil (); + } +} + +ACE_FACTORY_DEFINE (DAnCE_ExecutionManager_Module, DAnCE_ExecutionManager_Module) + + + diff --git a/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.h b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.h new file mode 100644 index 00000000000..869c2b093d4 --- /dev/null +++ b/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.h @@ -0,0 +1,102 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ExecutionManager_Module.h + * + * $Id$ + * + * @Brief + * + * @author Vinzenz Tornow <vt@prismtech.com> + */ +//============================================================================= + +#ifndef EXECUTION_MANAGER_MODULE_H +#define EXECUTION_MANAGER_MODULE_H + +#include /**/ "ace/pre.h" + +#include "DAnCE_ExecutionManager_Module_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" +#include "ace/Vector_T.h" +#include "tao/Object_Loader.h" + +namespace DAnCE +{ + class ExecutionManager_Impl; +} + +/** + * @class Execution_Manager_Module + * + * @brief The shared object that is instantiated when the execution manager + * module/library is dynamically loaded. + * + * This class runs the execution manager instance + */ +class DAnCE_ExecutionManager_Module_Export DAnCE_ExecutionManager_Module + : public TAO_Object_Loader + { + public: + struct SOptions + { + const char* exec_mgr_file_; + bool process_ns_; + const char* process_ns_file_; + bool create_plan_ns_; + const char* create_plan_ns_ior_; + bool rebind_plan_ns_; + const char* rebind_plan_ns_ior_; + bool port_indirection_; + ACE_Vector<ACE_CString> node_managers_; + bool ignore_failure_; + const char *node_map_; + const char *domain_nc_; + + SOptions() + : exec_mgr_file_ (0), + process_ns_ (false), + process_ns_file_ (0), + create_plan_ns_ (false), + create_plan_ns_ior_ (0), + rebind_plan_ns_ (false), + rebind_plan_ns_ior_ (0), + ignore_failure_ (false), + node_map_(0), + domain_nc_ (0) + { + } + }; + + /// Constructor. + DAnCE_ExecutionManager_Module (void); + + /// Destructor. + ~DAnCE_ExecutionManager_Module (void); + + /// Overload the base class method to create a new instance + /// of a DAnCE_NodeManager_Module object. + virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv []); + + virtual bool parse_args (int argc, ACE_TCHAR *argv []); + + SOptions options_; + private: + /// Storage for ExecutionManager servant. + DAnCE::ExecutionManager_Impl * em_impl_; + }; + +ACE_FACTORY_DECLARE (DAnCE_ExecutionManager_Module, DAnCE_ExecutionManager_Module) + +#include /**/ "ace/post.h" + +#endif /* EXECUTION_MANAGER_MODULE_H */ + diff --git a/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp b/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp deleted file mode 100644 index e7b70bc8533..00000000000 --- a/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp +++ /dev/null @@ -1,323 +0,0 @@ -//--*C++*-- -// $Id$ - -#include "Execution_Manager_Impl.h" - -// Include Name Service header -#include "orbsvcs/CosNamingC.h" -#include "tao/Utils/Implicit_Deactivator.h" - -#include "tao/RTCORBA/RTCORBA.h" -#include "tao/RTCORBA/RT_Policy_i.h" -#include "tao/RTPortableServer/RTPortableServer.h" -#include "tao/Strategies/advanced_resource.h" - -#include "ace/SString.h" -#include "ace/Read_Buffer.h" -#include "ace/Get_Opt.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_stdio.h" - -namespace CIAO -{ - namespace Execution_Manager - { - const char *ior_file_name_ = "executionManager.ior"; - const char *init_file_name = "deployment.dat"; - const char *pid_file_name_ = 0; - static bool register_with_ns_ = false; - static bool write_to_ior_ = false; - static bool rt_corba_enabled = false; - static bool is_using_ami = false; - static bool is_using_active_object = false; - - bool - parse_args (int argc, ACE_TCHAR *argv[]) - { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:i:abnrp:")); - int c; - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - write_to_ior_ = true; - ior_file_name_ = get_opts.opt_arg (); - break; - case 'i': - init_file_name = get_opts.opt_arg (); - break; - case 'n': - register_with_ns_ = true; - break; - case 'r': - rt_corba_enabled = true; - break; - case 'p': - pid_file_name_ = get_opts.opt_arg (); - break; - case 'a': - is_using_ami = true; - break; - case 'b': - is_using_active_object = true; - break; - case '?': // display help for use of the server. - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s\n" - "-a : Using Asynchronous Deployment\n" - "-b : Using Active Object based deployment \n" - "-o <ior_output_file>\n" - "-i <installation data filename>\n" - "-n <use naming service>\n" - "-p <filename to output the process id>\n" - "\n", - argv [0]), - false); - } - - return true; - } - - bool - write_ior_file (CORBA::ORB_ptr orb, CIAO::ExecutionManagerDaemon_ptr obj) - { - CORBA::String_var ior = orb->object_to_string (obj); - - FILE* ior_output_file_ = ACE_OS::fopen (ior_file_name_, "w"); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, - "%s", - ior.in ()); - ACE_OS::fclose (ior_output_file_); - } - else - { - ACE_ERROR ((LM_ERROR, - "Unable to open ExecutionManager IOR output file %s : %m\n", - ior_file_name_)); - return false; - } - return true; - } - - bool - write_pid (void) - { - - FILE* pid_file = ACE_OS::fopen (pid_file_name_, "w"); - - if (!pid_file) - { - ACE_ERROR ( (LM_ERROR, "Unable to open file %s to write the PID : %m", - pid_file_name_)); - return false; - } - ACE_OS::fprintf (pid_file, "%i", ACE_OS::getpid ()); - ACE_OS::fclose (pid_file); - return true; - } - - - bool - register_with_ns (CORBA::ORB_ptr orb, - CIAO::ExecutionManagerDaemon_ptr obj) - { - // Naming Service related operations - CORBA::Object_var naming_context_object = - orb->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_context_object.in ()); - - // Initialize the Naming Sequence - CosNaming::Name name (1); - name.length (1); - - name[0].id = CORBA::string_dup ("ExecutionManager"); - - // Register the servant with the Naming Service - try - { - // Register the servant with the Naming Service - naming_context->bind (name, obj); - } - catch (const CosNaming::NamingContext::AlreadyBound &) - { - ACE_DEBUG ((LM_DEBUG, - "Execution_Manager.cpp: Name already bound, rebinding\n")); - naming_context->rebind (name, obj); - } - - return true; - } - - int - run_main (int argc, char *argv[]) - { - - try - { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - if (!parse_args (argc, argv)) - return -1; - - // RTORB. - CORBA::Object_var object = - orb->resolve_initial_references ("RTORB"); - RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (object.in ()); - - if (CORBA::is_nil (rt_orb.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) CIAO_ExecutionManager: " - "Nil RT_ORB panic error, returning \n"), - -1); - - // Get reference to Root POA. - CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (obj.in ()); - - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) CIAO_ExecutionManager: " - "Nil Root POA panic error, returning \n"), - -1); - - // POAManager. - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (); - - if (poa_manager.in () == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) CIAO_ExecutionManager: " - "Nil POA Manager panic error, returning \n"), - -1); - - PortableServer::POA_var child_poa; - if (rt_corba_enabled) - { - // Create child POA with RTCORBA::ClientProtocolPolicy set. - CORBA::PolicyList poa_policy_list; - poa_policy_list.length (1); - poa_policy_list[0] = - rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, - 0); - - child_poa = - root_poa->create_POA ("Child_POA", - poa_manager.in (), - poa_policy_list); - - - } - else - { - child_poa = - root_poa->create_POA ("Child_POA", - poa_manager.in (), - 0); - } - - if (CORBA::is_nil (child_poa.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) CIAO_ExecutionManager: " - "Nil Child POA panic error, returning \n"), - -1); - - // Create and install the CIAO Daemon servant on child POA - Execution_Manager_Impl *daemon_servant = 0; - ACE_NEW_RETURN (daemon_servant, - Execution_Manager_Impl(orb.in (), - child_poa.in (), - init_file_name, - is_using_ami, - is_using_active_object), - -1); - - // Explicit activation through the child POA - PortableServer::ServantBase_var safe_daemon (daemon_servant); - TAO::Utils::Implicit_Deactivator de (daemon_servant); - - PortableServer::ObjectId_var id = - child_poa->activate_object (daemon_servant); - - CORBA::Object_var daemon_obj = - child_poa->id_to_reference (id.in ()); - - CIAO::ExecutionManagerDaemon_var daemon = - CIAO::ExecutionManagerDaemon::_narrow (daemon_obj.in ()); - - // Register to naming service - bool retval = false; - - if (register_with_ns_) - { - retval = register_with_ns (orb.in (), daemon.in ()); - if (!retval) - return -1; - } - - - if (write_to_ior_) - { - retval = write_ior_file (orb.in (), daemon.in ()); - if (!retval) - return -1; - } - - // Activate POA manager - PortableServer::POAManager_var mgr = root_poa->the_POAManager (); - - if (CORBA::is_nil (mgr.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) CIAO_ExecutionManager: " - "Nil POA Manager error, returning \n"), - -1); - - mgr->activate (); - - // End Deployment part - ACE_DEBUG ((LM_DEBUG, - "CIAO_ExecutionManager is running...\n")); - - if (pid_file_name_) - { - retval = write_pid (); - if (!retval) - return -1; - } - - // Run the main event loop for the ORB. - orb->run (); - - // Forget the pointer. The POA will take care of it during - // destroy. - (void) de.release (); - - root_poa->destroy (1, 1); - - orb->destroy (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("CIAO_ExecutionManager::main\n"); - return -1; - } - - ACE_DEBUG ((LM_DEBUG, - "CIAO_ExecutionManager has closed\n")); - return 0; - } - - } -} - -int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) -{ - return CIAO::Execution_Manager::run_main (argc, argv); -} diff --git a/CIAO/DAnCE/ExecutionManager/Execution_Manager_Exec.cpp b/CIAO/DAnCE/ExecutionManager/Execution_Manager_Exec.cpp new file mode 100644 index 00000000000..2331ec167df --- /dev/null +++ b/CIAO/DAnCE/ExecutionManager/Execution_Manager_Exec.cpp @@ -0,0 +1,7 @@ +// $Id$ +#include "ExecutionManager_Module.h" + +#define DANCE_MODULE_MAIN_CLASS_NAME DAnCE_ExecutionManager_Module +#include "Deployment/Module_Main.h" + + diff --git a/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp b/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp deleted file mode 100644 index 2b9afabd89f..00000000000 --- a/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// $Id$ - -#include "Execution_Manager_Impl.h" -#include "tao/RTCORBA/RTCORBA.h" -#include "ciao/CIAO_common.h" -#include "DomainApplicationManager/DomainApplicationManager_Impl.h" -#include "DomainApplicationManager/DomainApplicationManager_AMI_Impl.h" -#include "DomainApplicationManager/DomainApplicationManager_ActiveObject_Impl.h" - -ACE_RCSID (ExecutionManager, - Execution_Manager_Impl, - "$Id$") - -namespace CIAO -{ - namespace Execution_Manager - { - Execution_Manager_Impl::Execution_Manager_Impl ( - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - const char * init_file, - bool is_using_ami, - bool is_using_active_object) - : orb_ (CORBA::ORB::_duplicate (orb)) - , poa_ (PortableServer::POA::_duplicate (poa)) - , init_file_ (init_file) - , is_using_ami_ (is_using_ami) - , is_using_active_object_ (is_using_active_object) - { - } - - Execution_Manager_Impl::~Execution_Manager_Impl (void) - { - } - - Deployment::DomainApplicationManager_ptr - Execution_Manager_Impl::preparePlan ( - const Deployment::DeploymentPlan &plan, - CORBA::Boolean) - { - CIAO_TRACE("Execution_Manager::Execution_Manager_Impl::preparePlan"); - - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Execution Manager Running on CORBA Priority <%d> \n", - this->get_current_thread_priority ())); - - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Domain Application Manager " - "invoked CIAO_Execution_Manager: preparePlan \n")); - - // There is a Domain Application Manager already existing - // for this DeploymentPlan. - // No need to create a new DAM. Hence pass the - // reference that is already created. - // - ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) calling this->man_.is_plan_available()...\n")); - if (this->map_.is_plan_available (plan.UUID.in ())) - { - ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) Plan is already available; " - "calling this->man_.fetch_dam_reference()...\n")); - - return this->map_.fetch_dam_reference (plan.UUID.in ()); - } - else - { - ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) Plan wasn't already available\n")); - } - - // We are about to begin working on a new DeploymentPlan. - // Create a DAM servant, which will be populated - // to be sent back to the PlanLauncher. - // - PortableServer::ServantBase_var dam_servant; - - // Create a new Domain Application Manager servant - // to be sent back to the Plan Launcher. - // - ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) About to instantiate CIAO::DomainApplicationManager_Impl\n")); - - if (this->is_using_ami_) - { - ACE_NEW_THROW_EX ( - dam_servant, - CIAO::DomainApplicationManager_AMI_Impl ( - this->orb_.in (), - this->poa_.in (), - ::Deployment::TargetManager::_nil (), - this, // a plain C++ pointer - plan, - this->init_file_.c_str ()), - CORBA::NO_MEMORY ()); - - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Instantiated CIAO::DomainApplicationManager_AMI_Impl\n")); - - } - else if (this->is_using_active_object_) - { - ACE_NEW_THROW_EX ( - dam_servant, - CIAO::DomainApplicationManager_ActiveObject_Impl ( - this->orb_.in (), - this->poa_.in (), - ::Deployment::TargetManager::_nil (), - this, // a plain C++ pointer - plan, - this->init_file_.c_str ()), - CORBA::NO_MEMORY ()); - - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Instantiated CIAO::DomainApplicationManager_ActiveObject_Impl\n")); - } - else - { - ACE_NEW_THROW_EX ( - dam_servant, - CIAO::DomainApplicationManager_Impl ( - this->orb_.in (), - this->poa_.in (), - ::Deployment::TargetManager::_nil (), - this, // a plain C++ pointer - plan, - this->init_file_.c_str ()), - CORBA::NO_MEMORY ()); - - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Instantiated CIAO::DomainApplicationManager_Impl\n")); - } - - - // Sanity check for NULL pointer - // Should we throw an exception here? - // We have exceptions like PlanError or StartError at - // our disposal already in this function. - - // Calling the init function on the DAM. - // This function will split the plan into node specific - // plans, so that those plans can be sent off to individual - // Node Application Managers. - // - - PortableServer::ObjectId_var oid = poa_->activate_object(dam_servant.in()); - - CORBA::Object_var obj = poa_->id_to_reference( oid.in() ); - - Deployment::DomainApplicationManager_var dam = - Deployment::DomainApplicationManager::_narrow (obj.in ()); - - /// @@ TODO:Need to check the return value...... - /// - this->map_.bind_dam_reference ( - plan.UUID.in (), - Deployment::DomainApplicationManager::_duplicate (dam.in ())); - ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) Bound DAM reference...\n")); - - // Return the ApplicationManager instance - return dam._retn (); - } - - Deployment::DomainApplicationManagers * - Execution_Manager_Impl::getManagers () - { - CIAO_TRACE("Execution_Manager::Execution_Manager_Impl::getManagers"); - - // TODO Need to check the return value. - // - return this->map_.get_dams (); - } - - Deployment::DomainApplicationManager_ptr - Execution_Manager_Impl::getManager (const char * plan_uuid) - { - return this->map_.fetch_dam_reference (plan_uuid); - } - - void - Execution_Manager_Impl::destroyManager ( - Deployment::DomainApplicationManager_ptr manager) - { - CIAO_TRACE("Execution_Manager::Execution_Manager_Impl::destroyManagers"); - try - { - ::Deployment::DeploymentPlan_var plan = - manager->getPlan (); - - // What if we still have components running within this plan? - // - (void) this->map_.unbind_dam (plan->UUID.in ()); - - // Where does the POA deactivate happen? - // - manager->destroyManager (); - -#if 0 - PortableServer::ObjectId_var oid = - this->poa_->reference_to_id (manager); - - this->poa_->deactivate_object (oid.in ()); -#endif /*if 0*/ - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Execution_Manager_Impl::destroyManager\n"); - throw Deployment::StopError (); - } - } - - - void - Execution_Manager_Impl::destroyManagerByPlan ( - const char * plan_uuid) - { - CIAO_TRACE("Execution_Manager::Execution_Manager_Impl::destroyManagerByPlan"); - try - { - // Get DomainApplicationManager first - if (! this->map_.is_plan_available (plan_uuid)) - { - ACE_ERROR ((LM_ERROR, - "Execution_Manager_Impl::destroyManagerByPlan - " - "Invalid plan uuid [%s]\n", plan_uuid)); - throw Deployment::StopError (); - } - - Deployment::DomainApplicationManager_var - dam = this->map_.fetch_dam_reference (plan_uuid); - - // Get the plan - Deployment::DeploymentPlan_var plan = dam->getPlan (); - - // If any component is still running, then we return. - CORBA::ULong const inst_lenth = plan->instance.length (); - for (CORBA::ULong i = 0; i < inst_lenth; ++i) - { - if (this->is_component_running (plan->instance[i].name.in (), - plan_uuid)) - return; - } - - (void) this->map_.unbind_dam (plan->UUID.in ()); - - // Where does the POA deactivate happen? - // - dam->destroyManager (); - -#if 0 - PortableServer::ObjectId_var oid = - this->poa_->reference_to_id (manager); - - this->poa_->deactivate_object (oid.in ()); -#endif /*if 0*/ - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Execution_Manager_Impl::destroyManager\n"); - throw Deployment::StopError (); - } - } - - void - Execution_Manager_Impl::shutdown () - { - CIAO_TRACE("Execution_Manager::Execution_Manager_Impl::shutdown"); - // Shutdown the ORB on which it is runing - this->orb_->shutdown (0); - } - - void - Execution_Manager_Impl::perform_redeployment ( - const Deployment::DeploymentPlan & plan) - { - CIAO_TRACE ("CIAO::Execution_Manager_Impl::perform_redeployment"); - - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Dynamic Redeployment: " - "invoked CIAO::Execution_Manager_Impl::perform_redeployment \n")); - - Deployment::DomainApplicationManager_var dam; - - if (this->map_.is_plan_available (plan.UUID.in ())) - { - dam = this->map_.fetch_dam_reference (plan.UUID.in ()); - } - else - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) ExecutionManager_Impl.cpp -" - "CIAO::Execution_Manager_Impl::perform_redeployment -" - "Invalid plan uuid: %s\n", plan.UUID.in ())); - throw Deployment::PlanError ( - "Execution_Manager_Impl::perform_redeployment", - "Invalid plan uuid specified."); - } - - try - { - // Call perform_redeployment() on the DAM, which will do the - // actual redeployment and reconfiguration on the dommain level. - dam->perform_redeployment (plan); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "Execution_Manager_Impl::perform_redeployment\n"); - throw; - } - } - - Deployment::DeploymentPlan * - Execution_Manager_Impl::getPlan (const char * plan_uuid) - { - Deployment::DomainApplicationManager_var dam; - - if (this->map_.is_plan_available (plan_uuid)) - { - dam = this->map_.fetch_dam_reference (plan_uuid); - } - else - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) ExecutionManager_Impl.cpp -" - "CIAO::Execution_Manager_Impl::getPlan -" - "Invalid plan uuid: %s\n", plan_uuid)); - throw ::CORBA::BAD_PARAM (); - } - - try - { - return dam->getPlan (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Execution_Manager_Impl::getPlan\n"); - throw; - } - } - - void - Execution_Manager_Impl::finalize_global_binding ( - const Component_Binding_Info & binding, - CORBA::Boolean add_or_remove) - { - ACE_DEBUG ((LM_DEBUG, - "Execution_Manage::finalizing global bindings.\n")); - - // Find the NodeApplication hosting the component, and then call - // <finishLaunch> on it - try - { - Deployment::NodeApplication_var - node_app = this->find_node_application (binding); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR ((LM_ERROR, - "Execution_Manager_Impl::finalize_global_binding - " - "nil NodeApplication object reference.\n")); - throw Deployment::InvalidConnection (); - } - - node_app->finishLaunch (binding.providedReference_.in (), - true, // start - add_or_remove); - - // Update the internal shared component list - if (add_or_remove) - this->add_shared_component (binding); - else - this->remove_shared_component (binding); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "Execution_Manager_Impl::finalize_global_binding\n"); - throw Deployment::InvalidConnection (); - } - } - - void - Execution_Manager_Impl::passivate_shared_components ( - const Component_Binding_Info & binding) - { - ACE_DEBUG ((LM_DEBUG, - "Execution_Manage::passivate shared components.\n")); - - // Find the NodeApplication hosting the component, and then call - // <finishLaunch> on it - try - { - Deployment::NodeApplication_var - node_app = this->find_node_application (binding); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR ((LM_ERROR, - "Execution_Manager_Impl::passivate_shared_components - " - "nil NodeApplication object reference.\n")); - throw Deployment::StartError (); - } - - node_app->passivate_component (binding.name_.c_str ()); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "Execution_Manager_Impl::passivate_shared_components\n"); - throw Deployment::StartError (); - } - } - - void - Execution_Manager_Impl::activate_shared_components ( - const Component_Binding_Info & binding) - { - ACE_DEBUG ((LM_DEBUG, - "Execution_Manage::activate shared components.\n")); - - // Find the NodeApplication hosting the component, and then call - // <ciao_activate> on it - try - { - Deployment::NodeApplication_var - node_app = this->find_node_application (binding); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR ((LM_ERROR, - "Execution_Manager_Impl::activate_shared_components - " - "nil NodeApplication object reference.\n")); - throw Deployment::StartError (); - } - - node_app->activate_component (binding.name_.c_str ()); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ( - "Execution_Manager_Impl::passivate_shared_components\n"); - throw Deployment::StartError (); - } - } - - Deployment::NodeApplication_ptr - Execution_Manager_Impl::find_node_application ( - const Component_Binding_Info & binding) - { - // Find the DAM based on plan_UUID - Deployment::DomainApplicationManager_var dam; - - if (this->map_.is_plan_available (binding.plan_uuid_)) - { - dam = this->map_.fetch_dam_reference (binding.plan_uuid_); - } - else - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) ExecutionManager_Impl.cpp -" - "CIAO::Execution_Manager_Impl::find_node_application -" - "Invalid plan uuid: %s\n", binding.plan_uuid_.c_str ())); - throw ::CORBA::BAD_PARAM (); - } - - // Find the NA based on the NodeName field of the binding - // This is a CORBA call on the DAM - Deployment::NodeApplication_var node_app = - dam->get_node_app (binding.node_.c_str ()); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) ExecutionManager_Impl.cpp -" - "CIAO::Execution_Manager_Impl::find_node_application -" - "Invalid node name: %s!\n", binding.node_.c_str ())); - throw ::CORBA::BAD_PARAM (); - } - - return node_app._retn (); - } - - CORBA::Short - Execution_Manager_Impl:: - get_current_thread_priority () - { - // Use RTCurrent to find out the CORBA priority of the current - // thread. - - CORBA::Object_var obj = - this->orb_->resolve_initial_references ("RTCurrent"); - - RTCORBA::Current_var current = - RTCORBA::Current::_narrow (obj.in ()); - - if (CORBA::is_nil (obj.in ())) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) ExecutionManager_Impl.cpp -" - "CIAO::Execution_Manager_Impl::get_current_thread_priority -" - "Unable to get current thread handld.\n")); - throw CORBA::INTERNAL (); - } - - CORBA::Short servant_thread_priority = - current->the_priority (); - - return servant_thread_priority; - } - - void - Execution_Manager_Impl:: - add_shared_component (const Component_Binding_Info & comp) - { - this->shared_components_.insert (comp); - } - - void - Execution_Manager_Impl:: - remove_shared_component (const Component_Binding_Info & comp) - { - this->shared_components_.remove (comp); - } - - bool - Execution_Manager_Impl::is_component_running ( - const char * name, const char * plan_uuid) - { - for (ACE_Unbounded_Set<Component_Binding_Info>::iterator - iter = this->shared_components_.begin (); - iter != this->shared_components_.end (); - ++iter) - { - if (ACE_OS::strcmp ((*iter).name_.c_str (), name) == 0 && - ACE_OS::strcmp ((*iter).plan_uuid_.c_str (), plan_uuid) == 0) - return true; - } - - return false; - } - } -} diff --git a/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h b/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h deleted file mode 100644 index 4a549f42e19..00000000000 --- a/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h +++ /dev/null @@ -1,150 +0,0 @@ -/*======================================================================= - * - * @file Execution_Manager_Impl.h - * - * $Id$ - * - * @brief This file contains implementation for - * Deployment::ExecutionManager interface. - * - * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> - * @auther Tao Lu <lu@dre.vanderbilt.edu> - * - *======================================================================*/ - -#ifndef CIAO_EXECUTION_MANAGER_IMPL_H -#define CIAO_EXECUTION_MANAGER_IMPL_H -#include /**/ "ace/pre.h" - -#include "Interfaces/ExecutionManagerDaemonS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DAM_Map.h" -#include "ace/SString.h" -#include "DAnCE/Deployment/Deployment_common.h" - -namespace CIAO -{ - namespace Execution_Manager - { - /** - * - * @class Execution_Manager_Impl - * - * @brief This class implements the ExecutionManger. ExecutionManager - * starts the execution process after the planning stage. - * - */ - class Execution_Manager_Impl - : public virtual POA_CIAO::ExecutionManagerDaemon - { - public: - /// Constructor - Execution_Manager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - const char * init_file, - bool is_using_ami, - bool is_using_active_object); - - /// Template methods from ExecutionManagerDaemon, please see - /// $CIAO_ROOT/DAnCE/Deployment/Deployment.idl for documentation - virtual Deployment::DomainApplicationManager_ptr - preparePlan (const Deployment::DeploymentPlan & plan, - CORBA::Boolean commitResources); - - virtual Deployment::DomainApplicationManagers *getManagers (); - - // Below method is CIAO specific extension - virtual Deployment::DomainApplicationManager_ptr - getManager (const char * plan_uuid); - - virtual void - destroyManager (Deployment::DomainApplicationManager_ptr manager); - - // Below method is CIAO specific extension, please see the IDL - // definition for more details. - virtual void destroyManagerByPlan (const char * plan_uuid); - - virtual void shutdown (); - - // The input parameter is a *new_plan* which has the - // same UUID of the existing running plan. - virtual void - perform_redeployment (const Deployment::DeploymentPlan & plan); - - virtual Deployment::DeploymentPlan * getPlan (const char * plan_uuid); - - /// ****************** C++ Methods ************************* - - /// If input <add_connection> is true, then it will add new - /// connections which are across different assemblies. Otherwise - /// it will remove the specified connections of this component. - /// - /// @@GD: Later we can add another method which could accept - /// a list of bindings and do the batch job. - virtual void finalize_global_binding ( - const Component_Binding_Info & binding, - CORBA::Boolean add_connection); - - virtual void passivate_shared_components ( - const Component_Binding_Info & binding); - - virtual void activate_shared_components ( - const Component_Binding_Info & binding); - - /// Add shared component information. - /// This call will be made by DomainApplicationManager. - virtual void - add_shared_component (const Component_Binding_Info & binding); - - /// Remove shared component - virtual void - remove_shared_component (const Component_Binding_Info & binding); - - /// If the input component <name> was found in the internal - /// cached shared component list, and the plan_uuid also matches, - /// then this member function returns <true>, otherwise it - /// returns <false>. - virtual bool - is_component_running (const char * name, const char * plan_uuid); - - protected: - /// Return the NodeApplication hosting the given biding - virtual Deployment::NodeApplication_ptr - find_node_application (const Component_Binding_Info & binding); - - CORBA::Short get_current_thread_priority (void); - - protected: - /// Destructor. - virtual ~Execution_Manager_Impl (void); - - /// Cached ORB pointer - CORBA::ORB_var orb_; - - /// Cached POA pointer - PortableServer::POA_var poa_; - - /// Path to the initialization file - ACE_CString const init_file_; - - /// Whether we use AMI - bool is_using_ami_; - - /// Whether we use active object based deployment - bool is_using_active_object_; - - /// A map which caches the DomainApplicationManager object ref. - DAM_Map map_; - - /// A set of shared components and their location info. - ACE_Unbounded_Set<Component_Binding_Info> shared_components_; - }; - } -} - -#include /**/ "ace/post.h" -#endif /* EXECUTIONMANAGER_IMPL_H */ diff --git a/CIAO/DAnCE/Interfaces/ExecutionManagerDaemon.idl b/CIAO/DAnCE/Interfaces/ExecutionManagerDaemon.idl index 6bc330ff25e..ce88a04a818 100644 --- a/CIAO/DAnCE/Interfaces/ExecutionManagerDaemon.idl +++ b/CIAO/DAnCE/Interfaces/ExecutionManagerDaemon.idl @@ -10,7 +10,7 @@ #include "DAnCE/Deployment/Deployment_ExecutionManager.idl" -module CIAO +module DAnCE { /** * @brief CIAO Execution Manager Program diff --git a/CIAO/DAnCE/Interfaces/ExecutionManager_stub_export.h b/CIAO/DAnCE/Interfaces/ExecutionManager_stub_export.h index 248498c5a0e..f32c91c5e6e 100644 --- a/CIAO/DAnCE/Interfaces/ExecutionManager_stub_export.h +++ b/CIAO/DAnCE/Interfaces/ExecutionManager_stub_export.h @@ -9,10 +9,6 @@ #include "ace/config-all.h" -#if defined (ACE_AS_STATIC_LIBS) && !defined (EXECUTIONMANAGER_STUB_HAS_DLL) -# define EXECUTIONMANAGER_STUB_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && EXECUTIONMANAGER_STUB_HAS_DLL */ - #if !defined (EXECUTIONMANAGER_STUB_HAS_DLL) # define EXECUTIONMANAGER_STUB_HAS_DLL 1 #endif /* ! EXECUTIONMANAGER_STUB_HAS_DLL */ diff --git a/CIAO/DAnCE/Interfaces/Interfaces.mpc b/CIAO/DAnCE/Interfaces/Interfaces.mpc index 753e11ad947..36316bed524 100644 --- a/CIAO/DAnCE/Interfaces/Interfaces.mpc +++ b/CIAO/DAnCE/Interfaces/Interfaces.mpc @@ -1,17 +1,22 @@ // -*- MPC -*- // $Id$ -project (ExecutionManager_stub): ciao_deployment_stub, messaging, ace_output { - - sharedname = ExecutionManager_stub - +project (DAnCE_ExecutionManager_idl): taoidldefaults, anytypecode { + custom_only = 1 idlflags += -Wb,stub_export_macro=ExecutionManager_stub_Export idlflags += -Wb,stub_export_include=ExecutionManager_stub_export.h + idlflags += -I$(CIAO_ROOT) + IDL_Files { + ExecutionManagerDaemon.idl + } +} +project (ExecutionManager_stub): dance_lib, messaging, dance_deployment_stub { + sharedname = DAnCE_ExecutionManager_stub + after += DAnCE_ExecutionManager_idl dynamicflags = EXECUTIONMANAGER_STUB_BUILD_DLL IDL_Files { - ExecutionManagerDaemon.idl } Source_Files { @@ -19,21 +24,42 @@ project (ExecutionManager_stub): ciao_deployment_stub, messaging, ace_output { } } -project (NodeManager_stub): ciao_deployment_stub, messaging, ace_output { - sharedname = NodeManager_stub - +project (DAnCE_NodeManager_idl): taoidldefaults, anytypecode { + custom_only = 1 idlflags += -Wb,stub_export_macro=NodeManager_stub_Export idlflags += -Wb,stub_export_include=NodeManager_stub_export.h idlflags += -Wb,skel_export_macro=NodeManager_svnt_Export idlflags += -Wb,skel_export_include=NodeManager_svnt_export.h + idlflags += -I$(CIAO_ROOT) + IDL_Files { + NodeManagerDaemon.idl + } +} + +project (DAnCE_NodeManager_stub): dance_lib, messaging, dance_deployment_stub { + after += DAnCE_NodeManager_idl + sharedname = DAnCE_NodeManager_stub dynamicflags = NODEMANAGER_STUB_BUILD_DLL IDL_Files { - NodeManagerDaemon.idl } Source_Files { NodeManagerDaemonC.cpp } } + +project (DAnCE_NodeManager_svnt): dance_lib, messaging, dance_deployment_svnt, dance_nodemanager_stub { + after += DAnCE_NodeManager_idl + sharedname = DAnCE_NodeManager_svnt + + dynamicflags = NODEMANAGER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + NodeManagerDaemonS.cpp + } +} diff --git a/CIAO/DAnCE/Interfaces/NodeManagerDaemon.idl b/CIAO/DAnCE/Interfaces/NodeManagerDaemon.idl index 2daf535031a..540ca31a3c6 100644 --- a/CIAO/DAnCE/Interfaces/NodeManagerDaemon.idl +++ b/CIAO/DAnCE/Interfaces/NodeManagerDaemon.idl @@ -9,7 +9,7 @@ #include "DAnCE/Deployment/Deployment_NodeManager.idl" #include "DAnCE/Deployment/Deployment_NodeApplicationManager.idl" -module CIAO +module DAnCE { /** * @brief CIAO daemon process control program. @@ -28,8 +28,8 @@ module CIAO /// RACE specific extension. /// Modify the priority of a node application process. - long set_priority (in string plan_id, - in string cid, - in ::Deployment::Sched_Params nm_params); +// long set_priority (in string plan_id, +// in string cid, +// in ::Deployment::Sched_Params nm_params); }; }; diff --git a/CIAO/DAnCE/Interfaces/NodeManager_stub_export.h b/CIAO/DAnCE/Interfaces/NodeManager_stub_export.h index 0a9e320542c..3e708b0ab1f 100644 --- a/CIAO/DAnCE/Interfaces/NodeManager_stub_export.h +++ b/CIAO/DAnCE/Interfaces/NodeManager_stub_export.h @@ -9,10 +9,6 @@ #include "ace/config-all.h" -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEMANAGER_STUB_HAS_DLL) -# define NODEMANAGER_STUB_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEMANAGER_STUB_HAS_DLL */ - #if !defined (NODEMANAGER_STUB_HAS_DLL) # define NODEMANAGER_STUB_HAS_DLL 1 #endif /* ! NODEMANAGER_STUB_HAS_DLL */ diff --git a/CIAO/DAnCE/Interfaces/NodeManager_svnt_export.h b/CIAO/DAnCE/Interfaces/NodeManager_svnt_export.h index ed72f96f810..199168ef44d 100644 --- a/CIAO/DAnCE/Interfaces/NodeManager_svnt_export.h +++ b/CIAO/DAnCE/Interfaces/NodeManager_svnt_export.h @@ -9,10 +9,6 @@ #include "ace/config-all.h" -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEMANAGER_SVNT_HAS_DLL) -# define NODEMANAGER_SVNT_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEMANAGER_SVNT_HAS_DLL */ - #if !defined (NODEMANAGER_SVNT_HAS_DLL) # define NODEMANAGER_SVNT_HAS_DLL 1 #endif /* ! NODEMANAGER_SVNT_HAS_DLL */ diff --git a/CIAO/DAnCE/Interfaces/README b/CIAO/DAnCE/Interfaces/README index 0118689ad70..e2ca262a62f 100644 --- a/CIAO/DAnCE/Interfaces/README +++ b/CIAO/DAnCE/Interfaces/README @@ -1,2 +1,2 @@ To resolve the MPC issue of directory dependency, we have to put some IDL -files into a separate directory. This directory servers for this purpose. +files into a separate directory. This directory serves for this purpose. diff --git a/CIAO/DAnCE/Logger/DAnCE_Logger_Export.h b/CIAO/DAnCE/Logger/DAnCE_Logger_Export.h new file mode 100644 index 00000000000..e8e7cb3c81a --- /dev/null +++ b/CIAO/DAnCE/Logger/DAnCE_Logger_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DAnCE_Logger +// ------------------------------ +#ifndef DANCE_LOGGER_EXPORT_H +#define DANCE_LOGGER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_LOGGER_HAS_DLL) +# define DANCE_LOGGER_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DANCE_LOGGER_HAS_DLL */ + +#if !defined (DANCE_LOGGER_HAS_DLL) +# define DANCE_LOGGER_HAS_DLL 1 +#endif /* ! DANCE_LOGGER_HAS_DLL */ + +#if defined (DANCE_LOGGER_HAS_DLL) && (DANCE_LOGGER_HAS_DLL == 1) +# if defined (DANCE_LOGGER_BUILD_DLL) +# define DAnCE_Logger_Export ACE_Proper_Export_Flag +# define DANCE_LOGGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DANCE_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DANCE_LOGGER_BUILD_DLL */ +# define DAnCE_Logger_Export ACE_Proper_Import_Flag +# define DANCE_LOGGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DANCE_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DANCE_LOGGER_BUILD_DLL */ +#else /* DANCE_LOGGER_HAS_DLL == 1 */ +# define DAnCE_Logger_Export +# define DANCE_LOGGER_SINGLETON_DECLARATION(T) +# define DANCE_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DANCE_LOGGER_HAS_DLL == 1 */ + +// Set DANCE_LOGGER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DANCE_LOGGER_NTRACE) +# if (ACE_NTRACE == 1) +# define DANCE_LOGGER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DANCE_LOGGER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DANCE_LOGGER_NTRACE */ + +#if (DANCE_LOGGER_NTRACE == 1) +# define DANCE_LOGGER_TRACE(X) +#else /* (DANCE_LOGGER_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_LOGGER_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DANCE_LOGGER_NTRACE == 1) */ + +#endif /* DANCE_LOGGER_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/Logger/File_Logger_Backend.cpp b/CIAO/DAnCE/Logger/File_Logger_Backend.cpp new file mode 100644 index 00000000000..2741afe830f --- /dev/null +++ b/CIAO/DAnCE/Logger/File_Logger_Backend.cpp @@ -0,0 +1,46 @@ + +#include "File_Logger_Backend.h" +#include "ace/OS.h" +#include "ace/Log_Record.h" +#include "ace/Log_Msg.h" +#include "Log_Macros.h" + +namespace DAnCE + { + + int + File_Logger_Backend::open (const ACE_TCHAR *) + { + DANCE_DEBUG ((LM_DEBUG, "[%M] Setting logger's output to file \"%s\"", this->filename_.c_str())); + this->fh_ = ACE_OS::fopen (this->filename_.c_str(), "w"); + if (0 == this->fh_) + { + ACE_CString s = "Failed to open log file \""; + s += this->filename_; + s += "\""; + throw LoggerError (s.c_str()); + } + return 0; + } + + int + File_Logger_Backend::close (void) + { + if (0 != this->fh_) + { + ACE_OS::fclose (this->fh_); + this->fh_ = 0; + } + return 0; + } + + ssize_t + File_Logger_Backend::log (ACE_Log_Record &log_record) + { + int res = log_record.print (0, ACE_Log_Msg::VERBOSE, this->fh_); + ACE_OS::fflush (this->fh_); + return res; + } + +} + diff --git a/CIAO/DAnCE/Logger/File_Logger_Backend.h b/CIAO/DAnCE/Logger/File_Logger_Backend.h new file mode 100644 index 00000000000..9e247792b08 --- /dev/null +++ b/CIAO/DAnCE/Logger/File_Logger_Backend.h @@ -0,0 +1,49 @@ +#ifndef FILE_LOGGER_BACKEND_H_ +#define FILE_LOGGER_BACKEND_H_ + +#include "ace/Log_Msg_Backend.h" +#include "DAnCE_Logger_Export.h" +#include "ace/SString.h" + +namespace DAnCE + { + + class DAnCE_Logger_Export LoggerError + { + public: + LoggerError (const char * msg) + : errmsg_ (msg) {}; + ACE_CString errmsg_; + }; + + class DAnCE_Logger_Export File_Logger_Backend : public ACE_Log_Msg_Backend + { + public: + File_Logger_Backend (const char * fname) + : fh_ (0), filename_ (fname) {} + + virtual ~File_Logger_Backend (void) + { + this->close(); + }; + + virtual int open (const ACE_TCHAR *logger_key); + + virtual int reset (void) + { + this->close(); + return this->open (0); + }; + + virtual int close (void); + + virtual ssize_t log (ACE_Log_Record &log_record); + + private: + FILE * fh_; + ACE_CString filename_; + }; + +} // DAnCE + +#endif /*FILE_LOGGER_BACKEND_H_*/ diff --git a/CIAO/DAnCE/Logger/Log_Macros.h b/CIAO/DAnCE/Logger/Log_Macros.h new file mode 100644 index 00000000000..a096c4bb3e8 --- /dev/null +++ b/CIAO/DAnCE/Logger/Log_Macros.h @@ -0,0 +1,90 @@ +/** + * @file Log_Macros.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * Macros used for logging in DAnCE + */ + + +#ifndef DANCE_LOG_MACROS_H_ +#define DANCE_LOG_MACROS_H_ + +/* +// By default tracing is turned off. +#if !defined (DANCE_NTRACE) +# if !defined (ACE_NTRACE) +# define DANCE_NTRACE 1 +# else +# define DANCE_NTRACE ACE_NTRACE +# endif +#endif DANCE_NTRACE +*/ +#define DLINFO "(%P|%t) [%M] - %T - " + +#if (DANCE_NTRACE == 1) +# if !defined (ACE_NTRACE) +# define DANCE_TRACE(X) do {} while (0) +# define DANCE_ENABLE_TRACE(X) do {} while (0) +# define DANCE_DISABLE_TRACE(X) do {} while (0) +# else +# if (ACE_NTRACE == 0) +# error DANCE_TRACE cannot be disabled if ACE_TRACE is enabled +# else +# define DANCE_TRACE(X) do {} while (0) +# define DANCE_ENABLE_TRACE(X) do {} while (0) +# define DANCE_DISABLE_TRACE(X) do {} while (0) +# endif +# endif +#else +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_TRACE(X) ACE_TRACE_IMPL (X) +# define DANCE_ENABLE_TRACE() ACE_Trace::start_tracing () +# define DANCE_DISABLE_TRACE() ACE_Trace::stop_tracing () +# undef CLINFO // Make log messages indent with tracing. +# define CLINFO "%I(%P|%t) [%M] - %T - " +# include "ace/Trace.h" +#endif /* DANCE_NTRACE */ + +#if defined (DANCE_NLOGGING) +# define DANCE_ERROR(X) do {} while (0) +# define DANCE_DEBUG(X) do {} while (0) +#define DANCE_ERROR_RETURN(X, Y) return (Y) +#define DANCE_ERROR_BREAK(X) { break; } +#else +# if !defined (DANCE_ERROR) +# define DANCE_ERROR(X) \ + do { \ + int __ace_error = ACE_Log_Msg::last_error_adapter (); \ + ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ + ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \ + ace___->log X; \ + } while (0) +# endif +# if !defined (DANCE_DEBUG) +# define DANCE_DEBUG(X) \ + do { \ + int __ace_error = ACE_Log_Msg::last_error_adapter (); \ + ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ + ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \ + ace___->log X; \ + } while (0) +# endif +# if !defined (DANCE_ERROR_RETURN) +# define DANCE_ERROR_RETURN(X, Y) \ + do { \ + int __ace_error = ACE_Log_Msg::last_error_adapter (); \ + ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ + ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \ + ace___->log X; \ + return Y; \ + } while (0) +# endif +# if !defined (DANCE_ERROR_BREAK) +# define DANCE_ERROR_BREAK(X) { DANCE_ERROR (X); break; } +# endif +#endif + + +#endif diff --git a/CIAO/DAnCE/Logger/Logger.mpc b/CIAO/DAnCE/Logger/Logger.mpc new file mode 100644 index 00000000000..c6e9436b9ac --- /dev/null +++ b/CIAO/DAnCE/Logger/Logger.mpc @@ -0,0 +1,19 @@ +// -*- MPC -*- +// $Id$ + +project(DAnCE_Logger): dance_lib, messaging { + after += ACE + sharedname = DAnCE_Logger + dynamicflags = DANCE_LOGGER_BUILD_DLL + + Source_Files { + File_Logger_Backend.cpp + Logger_Service.cpp + } + Header_Files { + } +} + + + + diff --git a/CIAO/DAnCE/Logger/Logger_Service.cpp b/CIAO/DAnCE/Logger/Logger_Service.cpp new file mode 100644 index 00000000000..2a332b9b5db --- /dev/null +++ b/CIAO/DAnCE/Logger/Logger_Service.cpp @@ -0,0 +1,160 @@ + +#include "Logger_Service.h" +#include "ace/Get_Opt.h" +#include "ace/Env_Value_T.h" +#include "ace/CORBA_macros.h" +#include "tao/SystemException.h" +#include "Log_Macros.h" + +namespace DAnCE + { + Logger_Service::Logger_Service (void) + : filename_ (""), + trace_ (false), + log_level_ (5) + { + } + + int + Logger_Service::init (int argc, ACE_TCHAR * argv[]) + { + // Get prospective values from the environment first, those given on + // command line can override + ACE_Env_Value<int> log ("DANCE_LOG_LEVEL", this->log_level_); + + this->log_level_ = log; + + ACE_Env_Value<int> trace ("DANCE_TRACE_ENABLE", this->trace_); + this->trace_ = trace; + + + ACE_Env_Value<const char *> filename ("DANCE_LOG_FILE", this->filename_.c_str ()); + this->filename_ = filename; + + this->parse_args (argc, argv); + + this->set_levels (); + + return 0; + } + + + void + Logger_Service::parse_args (int argc, char **argv) + { + const ACE_TCHAR *shortl = "-l"; + const ACE_TCHAR *longl = "--log-level"; + const ACE_TCHAR *tracel = "--trace"; + // const ACE_TCHAR *traces = "-t"; + const ACE_TCHAR *lfl = "--log-file"; + const ACE_TCHAR *lfs = "-f"; + + // We need to actually FIND the -l option, as the get_opt won't ignore + // the ORB options and such. + for (int i = 0; i < argc; ++i) + { + if (//ACE_OS::strncmp (argv[i], traces, 2) == 0 || + ACE_OS::strncmp (argv[i], tracel, 7) == 0) + { + this->trace_ = true; + continue; + } + + if (ACE_OS::strncmp (argv[i], shortl, 2) == 0 || + ACE_OS::strncmp (argv[i], longl, 11 ) == 0) + { + if ((i + 1) < argc && *argv[i + 1] != '-') + { + int level = ACE_OS::atoi (argv[i + 1]); + + if (level != 0) + this->log_level_ = level; + } + } + + if (ACE_OS::strncmp (argv[i], lfs, 2) == 0 || + ACE_OS::strncmp (argv[i], lfl, 10 ) == 0) + { + if ((i + 1) < argc && *argv[i + 1] != '-') + { + this->filename_ = argv[i+1]; + } + } + } + } + + void + Logger_Service::set_levels (void) + { + if (this->trace_) + { + DANCE_ENABLE_TRACE (); + this->log_level_ = 10; + } + else + { + DANCE_DISABLE_TRACE (); + } + + u_long new_mask = 0; + + if (this->log_level_ >= 9) + { + new_mask |= LM_TRACE; + } + if (this->log_level_ >= 8) + { + new_mask |= LM_DEBUG; + } + if (this->log_level_ >= 7) + { + new_mask |= LM_INFO; + } + if (this->log_level_ >= 6) + { + new_mask |= LM_NOTICE; + } + if (this->log_level_ >= 5) + { + new_mask |= LM_WARNING; + } + if (this->log_level_ >= 4) + { + new_mask |= LM_ERROR; + } + if (this->log_level_ >= 3) + { + new_mask |= LM_CRITICAL; + } + if (this->log_level_ >= 2) + { + new_mask |= LM_ALERT; + } + if (this->log_level_ >= 1) + { + new_mask |= LM_EMERGENCY; + } + + ACE_Log_Msg::instance()->priority_mask(new_mask, ACE_Log_Msg::PROCESS); + DANCE_DEBUG ( (LM_TRACE, DLINFO "Logging level is set to %i\n", this->log_level_)); + } + + ACE_Log_Msg_Backend * + Logger_Service::get_logger_backend (CORBA::ORB_ptr) + { + if (this->filename_ != "") + { + File_Logger_Backend * the_backend; + ACE_NEW_THROW_EX (the_backend, + File_Logger_Backend (this->filename_.c_str()), + CORBA::NO_MEMORY()); + return the_backend; + } + return 0; + } + +} // DAnCE + +using namespace DAnCE; +ACE_FACTORY_DEFINE (DAnCE_Logger, Logger_Service); + diff --git a/CIAO/DAnCE/Logger/Logger_Service.h b/CIAO/DAnCE/Logger/Logger_Service.h new file mode 100644 index 00000000000..2d5b1050627 --- /dev/null +++ b/CIAO/DAnCE/Logger/Logger_Service.h @@ -0,0 +1,30 @@ +#ifndef LOGGER_SERVICE_H_ +#define LOGGER_SERVICE_H_ + +#include "DAnCE_Logger_Export.h" +#include "Starter/DAnCELoggerFactory.h" +#include "File_Logger_Backend.h" + +namespace DAnCE + { + + class DAnCE_Logger_Export Logger_Service : public DAnCELoggerFactory + { + public: + Logger_Service (void); + virtual int init (int argc, ACE_TCHAR * argv[]); + virtual ACE_Log_Msg_Backend * get_logger_backend (CORBA::ORB_ptr orb); + private: + void parse_args (int argc, ACE_TCHAR **argv); + void set_levels (void); + + ACE_CString filename_; + bool trace_; + int log_level_; + }; + +} // DAnCE + +ACE_FACTORY_DECLARE (DAnCE_Logger, Logger_Service); + +#endif /*LOGGER_SERVICE_H_*/ diff --git a/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.cpp b/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.cpp new file mode 100644 index 00000000000..a93cbeff4f1 --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#include "tao/DynamicInterface/Request.h" + +#include "ComponentAttributesSetter.h" +//#include "Cdmw_ccm_dance1_cif.stub.hpp" +#include "tao/DynamicInterface/DII_CORBA_methods.h" +#include "tao/DynamicInterface/Context.h" +#include "tao/AnyTypeCode/NVList.h" +#include "tao/AnyTypeCode/TypeCode_Constants.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "Deployment/Deployment_ApplicationC.h" + +//bool read_config_value( const ACE_CString & name, +// const Deployment::Properties & prop, +// CORBA::Any_out value) +// throw() +//{ +// ACE_CString cdmw_name = name; +// bool found = false; +// CORBA::ULong len = prop.length(); +// for (CORBA::ULong count = 0; count < len; ++count) +// { +// if ( cdmw_name.compare(prop[count].name.in()) == 0 ) +// { +// value = new CORBA::Any(prop[count].value); +// found = true; +// break; +// } +// } +// return found; +//} + + +ComponentAttributesSetter::ComponentAttributesSetter() +{ +} + +ComponentAttributesSetter::~ComponentAttributesSetter() +{ +} + +void +ComponentAttributesSetter::SetComponentAttributes (ACE_CString /*componentName*/, + ::CORBA::Object_ptr obj, + const Deployment::Properties& prop, + CORBA::ORB_ptr ) +{ + DANCE_TRACE ("ComponentAttributesSetter::SetComponentAttributes"); + + for (CORBA::ULong i = 0; i < prop.length(); i++) + { + ACE_CString name = prop[i].name.in(); + // Ignore configuration properties, since attributes can't have . in them, this seems like a good method. + if (name.find (".") != ACE_CString::npos) + { + continue; + } + DANCE_DEBUG ((LM_DEBUG, DLINFO + "ComponentAttributesSetter::SetComponentAttributes - " + "Populating attribute name %C\n", name.c_str())); + ACE_CString method = "_set_"; + method += prop[i].name.in(); + + ::CORBA::Request_var req; + + try + { + req = obj->_request (method.c_str ()); + req->add_in_arg ("x") = prop[i].value; + + req->invoke(); + } + catch (const CORBA::BAD_OPERATION &) + { + DANCE_ERROR ((LM_WARNING, DLINFO + "ComponentAttributesSetter::SetComponentAttributes - " + "Caught BAD_OPERATION while trying to set attribute %C\n", + name.c_str ())); + } + catch (const CORBA::Exception &e) + { + CORBA::release (req); + e._tao_print_exception ("ComponentAttributesSetter.cpp::SetComponentAttributes "); + throw ::Deployment::StartError(); + } + //Question - How exceptions will be processed, rised by invoked method + } +} diff --git a/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.h b/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.h new file mode 100644 index 00000000000..2a36da17cfd --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.h @@ -0,0 +1,35 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ComponentAttributesSetter.h + * + * $Id$ + * + * @Brief Workaround for component attributes setting + * + * @author Erwin Gottlieb <eg@prismtech.com> + */ +//============================================================================= + +#ifndef COMPONENTATTRIBUTESSETTER_H_ +#define COMPONENTATTRIBUTESSETTER_H_ + +//#include "ComponentAttributesSetter_Export.h" +#include "NodeApplication_Export.h" +#include "Deployment/Deployment_BaseC.h" +#include "ccm/CCM_ObjectC.h" + +class NodeApplication_Export ComponentAttributesSetter + { + public: + ComponentAttributesSetter(); + ~ComponentAttributesSetter(); + + static void SetComponentAttributes (ACE_CString componentName, + CORBA::Object_ptr, + const Deployment::Properties& prop, + CORBA::ORB_ptr orb); + }; + +#endif /*COMPONENTATTRIBUTESSETTER_H_*/ diff --git a/CIAO/DAnCE/NodeApplication/ComponentInstallation_Impl.cpp b/CIAO/DAnCE/NodeApplication/ComponentInstallation_Impl.cpp new file mode 100644 index 00000000000..5492df95404 --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/ComponentInstallation_Impl.cpp @@ -0,0 +1,120 @@ +// $Id$ + +#include "ComponentInstallation_Impl.h" +#include "DAnCE/Logger/Log_Macros.h" + +using namespace DAnCE; + +ComponentInstallation_Impl::ComponentInstallation_Impl() +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::ComponentInstallation_Impl - started\n")); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::ComponentInstallation_Impl - finished\n")); +} + +ComponentInstallation_Impl::~ComponentInstallation_Impl() +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::~ComponentInstallation_Impl - started\n")); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::~ComponentInstallation_Impl - finished\n")); +} + +void +ComponentInstallation_Impl::install (const char * implUUID, const char * component_loc) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::install - started\n")); + + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::install - implUUID %s, component_loc %s\n", implUUID, component_loc)); + if (0 != this->locations_.find (implUUID)) + { + ACE_CString location = component_loc; + this->locations_.bind (implUUID, location); + } + else + { + // I don't certaint that we should throw exception here + //throw ::Components::Deployment::InstallationFailure(); + } + + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::install - finished\n")); +} + + +void +ComponentInstallation_Impl::replace (const char * , const char *) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::replace - started\n")); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::replace - finished\n")); +} + +void +ComponentInstallation_Impl::remove (const char *) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::remove - started\n")); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::remove - finished\n")); +} + +char * +ComponentInstallation_Impl::get_implementation (const char * implUUID) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::get_implementation - started\n")); + + ACE_CString s; + if (0 == this->locations_.find (implUUID, s)) + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::get_implementation - ComponentInstallation_Impl::get_implementation for UUID %s, location %s\n", implUUID, s.c_str())); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::get_implementation - finished\n")); + return CORBA::string_dup (s.c_str()); + } + else + { + DANCE_ERROR ( (LM_ERROR, "[%M] ComponentInstallation_Impl::get_implementation - cannot find location for specified implementation UUID\n")); + throw ::Components::Deployment::UnknownImplId(); + return 0; + } +} + + +char * +ComponentInstallation_Impl::get_valuetypefactory_location ( + const char * implUUID, + const char * repid +) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::get_valuetypefactory_location - started\n")); + ACE_CString key = ComponentInstallation_Impl::valuefactory_key (implUUID, repid); + ACE_CString s; + if (0 == this->locations_.find (implUUID, s)) + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::get_valuetypefactory_location - UUID:\"%s\" repid:\"%s\" -> location:\"%s\"\n", implUUID, repid, s.c_str())); + return CORBA::string_dup (s.c_str()); + } + else + { + DANCE_ERROR ( (LM_ERROR, "[%M] ComponentInstallation_Impl::get_valuetypefactory_location - cannot find location for specified implementation UUID and repid.\n")); + throw ::Components::Deployment::InstallationFailure(); + return 0; + } + DANCE_DEBUG ( (LM_DEBUG, "[%M] ComponentInstallation_Impl::get_valuetypefactory_location - finished\n")); + return 0; +} + + +void +ComponentInstallation_Impl::install_valuetypefactory_location ( + const char * implUUID, + const char * repid, + const char * loc +) +{ + ACE_CString key = ComponentInstallation_Impl::valuefactory_key (implUUID, repid); + if (0 != this->locations_.find (key)) + { + ACE_CString location = loc; + this->locations_.bind (implUUID, location); + } + else + { + // I don't certaint that we should throw exception here + //throw ::Components::Deployment::InstallationFailure(); + } +} + diff --git a/CIAO/DAnCE/NodeApplication/ComponentInstallation_Impl.h b/CIAO/DAnCE/NodeApplication/ComponentInstallation_Impl.h new file mode 100644 index 00000000000..3b3dc1a4246 --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/ComponentInstallation_Impl.h @@ -0,0 +1,76 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ComponentInstallation_Impl.h + * + * $Id$ + * + * @Brief Return location of component artifact + * + * @author Erwin Gottlieb <eg@prismtech.com> + */ +//============================================================================= + +#ifndef COMPONENTINSTALLATION_IMPL_H_ +#define COMPONENTINSTALLATION_IMPL_H_ + +#include "ace/Map_Manager.h" +#include "ccm/CCM_ComponentC.h" + +#include "Cdmw/CDMW_DeploymentS.h" +#include "tao/ORB.h" +#include "NodeApplication_Export.h" + +namespace DAnCE + { + + class NodeApplication_Export ComponentInstallation_Impl + : public virtual POA_CdmwDeployment::ComponentInstallation + { + public: + ComponentInstallation_Impl(); + + virtual ~ComponentInstallation_Impl(); + + virtual void install ( + const char * implUUID, + const char * component_loc + ); + + virtual void replace ( + const char * implUUID, + const char * component_loc + ); + + virtual void remove ( + const char * implUUID + ); + + virtual char * get_implementation ( + const char * implUUID + ); + + virtual char * get_valuetypefactory_location ( + const char * implUUID, + const char * repid + ); + + void install_valuetypefactory_location ( + const char * implUUID, + const char * repid, + const char * loc + ); + + private: + typedef ACE_Map_Manager< ACE_CString, ACE_CString, ACE_Null_Mutex > TLocations; + TLocations locations_; + + static ACE_CString valuefactory_key (const char* uuid, const char* repid) + { + return ACE_CString (repid) + "@" + uuid; + }; + }; + +}; +#endif /*COMPONENTINSTALLATION_IMPL_H_*/ diff --git a/CIAO/DAnCE/NodeApplication/Config_Manager.cpp b/CIAO/DAnCE/NodeApplication/Config_Manager.cpp deleted file mode 100644 index 4b313662cf5..00000000000 --- a/CIAO/DAnCE/NodeApplication/Config_Manager.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// $Id$ - -#include "Config_Manager.h" - -CIAO::Config_Manager::~Config_Manager (void) -{ -} - diff --git a/CIAO/DAnCE/NodeApplication/Config_Manager.h b/CIAO/DAnCE/NodeApplication/Config_Manager.h deleted file mode 100755 index 8872761d596..00000000000 --- a/CIAO/DAnCE/NodeApplication/Config_Manager.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Config_Manager.h - * - * $Id$ - * - */ -//============================================================================= - - -#ifndef CIAO_CONFIG_MANAGER_H -#define CIAO_CONFIG_MANAGER_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" -#include "Config_Manager_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DAnCE/Deployment/CIAO_ServerResourcesC.h" - -namespace CIAO -{ - /** - */ - class Config_Manager_Export Config_Manager - { - public: - virtual ~Config_Manager (void); - - virtual int pre_orb_initialize (void) = 0; - - virtual int post_orb_initialize (CORBA::ORB_ptr o) = 0; - - virtual void init_resources (const CIAO::DAnCE::ServerResource &info) = 0; - - virtual void init (CORBA::ORB_ptr orb) = 0; - - virtual CORBA::PolicyList *find_policies_by_name (const char *name)= 0; - - virtual bool policy_exists (const char *name) = 0; - }; -} - -#include /**/ "ace/post.h" -#endif /* CIAO_CONFIG_MANAGER_H */ - diff --git a/CIAO/DAnCE/NodeApplication/Config_Manager_export.h b/CIAO/DAnCE/NodeApplication/Config_Manager_export.h deleted file mode 100644 index 57d17637dde..00000000000 --- a/CIAO/DAnCE/NodeApplication/Config_Manager_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl Config_Manager -// ------------------------------ -#ifndef CONFIG_MANAGER_EXPORT_H -#define CONFIG_MANAGER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (CONFIG_MANAGER_HAS_DLL) -# define CONFIG_MANAGER_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && CONFIG_MANAGER_HAS_DLL */ - -#if !defined (CONFIG_MANAGER_HAS_DLL) -# define CONFIG_MANAGER_HAS_DLL 1 -#endif /* ! CONFIG_MANAGER_HAS_DLL */ - -#if defined (CONFIG_MANAGER_HAS_DLL) && (CONFIG_MANAGER_HAS_DLL == 1) -# if defined (CONFIG_MANAGER_BUILD_DLL) -# define Config_Manager_Export ACE_Proper_Export_Flag -# define CONFIG_MANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define CONFIG_MANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* CONFIG_MANAGER_BUILD_DLL */ -# define Config_Manager_Export ACE_Proper_Import_Flag -# define CONFIG_MANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define CONFIG_MANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* CONFIG_MANAGER_BUILD_DLL */ -#else /* CONFIG_MANAGER_HAS_DLL == 1 */ -# define Config_Manager_Export -# define CONFIG_MANAGER_SINGLETON_DECLARATION(T) -# define CONFIG_MANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* CONFIG_MANAGER_HAS_DLL == 1 */ - -// Set CONFIG_MANAGER_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (CONFIG_MANAGER_NTRACE) -# if (ACE_NTRACE == 1) -# define CONFIG_MANAGER_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define CONFIG_MANAGER_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !CONFIG_MANAGER_NTRACE */ - -#if (CONFIG_MANAGER_NTRACE == 1) -# define CONFIG_MANAGER_TRACE(X) -#else /* (CONFIG_MANAGER_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define CONFIG_MANAGER_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (CONFIG_MANAGER_NTRACE == 1) */ - -#endif /* CONFIG_MANAGER_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/NodeApplication/Configurator_Factory.cpp b/CIAO/DAnCE/NodeApplication/Configurator_Factory.cpp deleted file mode 100644 index cebbf738e6c..00000000000 --- a/CIAO/DAnCE/NodeApplication/Configurator_Factory.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// $Id$ - -#include "Configurator_Factory.h" -#include "NodeApp_Configurator.h" -#include "ciao/CIAO_common.h" -#include "ace/Arg_Shifter.h" - -#if !defined (__ACE_INLINE__) -# include "Configurator_Factory.inl" -#endif /* __ACE_INLINE__ */ - -CIAO::NodeApplication_Options::NodeApplication_Options () : - use_callback_ (true), - rt_support_ (false) -{ -} - -int -CIAO::NodeApplication_Options::parse_args (int &argc, char *argv[]) -{ - ACE_Arg_Shifter shifter (argc, argv); - - while (shifter.is_anything_left ()) - { - const char *parm = 0; - - if (shifter.cur_arg_strncasecmp ("-n") == 0) // Use callback. - { - this->use_callback_ = false; - shifter.consume_arg (); - } - else if (shifter.cur_arg_strncasecmp ("-r") == 0) - { - this->rt_support_ = true; - shifter.consume_arg (); - } - else if (ACE_OS::strncmp (shifter.get_current (), - "-ORB", - ACE_OS::strlen ("-ORB")) == 0) - { - // Ignore ORB parameter - shifter.ignore_arg (); - } - else if (shifter.cur_arg_strncasecmp ("-o") == 0) - { - // This double checking is necessary to avoid the Arg_Shifter from - // mistaking any -ORBxxx flag as -o flag. - if ((parm = shifter.get_the_parameter ("-o")) !=0) - { - this->ior_output_filename_ = parm; - } - shifter.consume_arg (); - } - else if ((parm = shifter.get_the_parameter ("-k")) !=0) - { - this->callback_ior_ = parm; - shifter.consume_arg (); - } - else if (shifter.cur_arg_strncasecmp ("-h") == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s\n" - "-n Do not use Callback (for testing)\n" - "-o <ior_output_file>\n" - "-k <NodeApplicationManager_callback_ior>\n" - "-r Request RT support\n" - "-h Usage help" - "\n", - argv [0]), - -1); - shifter.consume_arg (); - } - else - { - shifter.ignore_arg (); - } - } - - if (this->use_callback_ && 0 == this->callback_ior_.length ()) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Callback IOR to NodeApplicationManager " - "is required.\n"), - -1); - } - - return 0; -} - -CIAO::NodeApp_Configurator * -CIAO::NodeApplication_Options::create_nodeapp_configurator (void) -{ - CIAO::NodeApp_Configurator* ptr = 0; - ACE_NEW_THROW_EX (ptr, - CIAO::NodeApp_Configurator (), - CORBA::NO_MEMORY (TAO::VMCID, - CORBA::COMPLETED_NO)); - if (this->rt_support_) - { - ptr->set_rt_support (); - } - - return ptr; - /* - typedef CIAO::NodeApp_Configurator * (*intelligent_designer)(void); - CIAO::NodeApp_Configurator* ptr = 0; - - if (this->rt_support_) - { - int const retval = - this->config_dll_.open ( - ACE_DLL_PREFIX ACE_TEXT ("CIAO_RTNA_Configurator"), - ACE_DEFAULT_SHLIB_MODE, - 0); - - if (0 != retval) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "dll.open"), - 0); - } - - - // Cast the void* to non-pointer type first - it's not legal to - // cast a pointer-to-object directly to a pointer-to-function. - void *void_ptr = - this->config_dll_.symbol (ACE_TEXT ("create_nodeapp_configurator")); - ptrdiff_t tmp = reinterpret_cast<ptrdiff_t> (void_ptr); - - // "id" is for intelligent-designer. - intelligent_designer config_id = - reinterpret_cast<intelligent_designer> (tmp); - - if (0 == config_id) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.symbol"), - 0); - } - - ptr = config_id (); - - if (0 == ptr) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Error creating RTNodeApp_Configurator\n"), - 0); - } - } - else - { - ACE_NEW_RETURN (ptr, - CIAO::NoOp_Configurator (), - 0); - } - - return ptr; - */ -} - diff --git a/CIAO/DAnCE/NodeApplication/Configurator_Factory.h b/CIAO/DAnCE/NodeApplication/Configurator_Factory.h deleted file mode 100644 index be9f7bc300b..00000000000 --- a/CIAO/DAnCE/NodeApplication/Configurator_Factory.h +++ /dev/null @@ -1,100 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Configurator_Factory.h - * - * $Id$ - * - * Configurator Factory contains the factory method for creating concret - * NodeApp_Configurator object. - * - * @author Nanbor Wang <nanbor@cs.wustl.edu> - */ -//============================================================================= - - -#ifndef CIAO_CONFIGURATOR_FACTORY_H -#define CIAO_CONFIGURATOR_FACTORY_H -#include /**/ "ace/pre.h" - -#include "CIAO_NodeApplication_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SString.h" -//#include "ace/DLL.h" - -namespace CIAO -{ - //forward declaration - class NodeApp_Configurator; - - /** - * @class NodeApplication_Options - * - * @brief An class for managing and extracting command line options - * for NodeApplication. - * - * @note We currently support loading one single external module for - * RT support. Perhaps how this should really be done is to allow - * the NodeApplication_Core to load up a list of external modules - * (in DLLs or otherwise) and call the corresponding init methods in - * sequence. This way, we open up the component server so system - * developers can plug in their own system configuration needs into - * the whole system. - */ - class NODEAPPLICATION_Export NodeApplication_Options - { - public: - // default ctor. - NodeApplication_Options (); - - /// extracting commandline arguments - int parse_args (int &argc, char *argv[]); - - NodeApp_Configurator *create_nodeapp_configurator (void); - - bool use_callback (); - - bool rt_support (); - - int write_ior_file (); - - const char *ior_output_filename (); - - const char *callback_ior (); - - private: - /// The name of the file to write stringified IOR to. - ACE_CString ior_output_filename_; - - /// Stringified IOR of a CIAO's callback object. - ACE_CString callback_ior_; - - /// CIAO ComponentServer uses the callback object to pass it's - /// own object reference back to NodeApplicationManager. - bool use_callback_; - - /// If we need to support RT-CORBA. Currently, this is - /// mandatory, but we can probably allow some sort of - /// "best-effort" RT support. I.e., if the platform/environment - /// doesn't support RT, then we will still deploy the NodeApp but - /// ignore the RT spec. Perhaps something in the future. - bool rt_support_; - - // For managing dynamically loaded configurator library - //ACE_DLL config_dll_; - }; - -} - -#if defined (__ACE_INLINE__) -# include "Configurator_Factory.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* CIAO_CONFIGURATOR_FACTORY_H */ - diff --git a/CIAO/DAnCE/NodeApplication/Configurator_Factory.inl b/CIAO/DAnCE/NodeApplication/Configurator_Factory.inl deleted file mode 100644 index bde906ae6b5..00000000000 --- a/CIAO/DAnCE/NodeApplication/Configurator_Factory.inl +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -ACE_INLINE bool -CIAO::NodeApplication_Options::use_callback () -{ - return this->use_callback_; -} - -ACE_INLINE bool -CIAO::NodeApplication_Options::rt_support () -{ - return this->rt_support_; -} - -ACE_INLINE int -CIAO::NodeApplication_Options::write_ior_file () -{ - return (this->ior_output_filename_.length () != 0); -} - -ACE_INLINE const char * -CIAO::NodeApplication_Options::ior_output_filename () -{ - return this->ior_output_filename_.c_str (); -} - -ACE_INLINE const char * -CIAO::NodeApplication_Options::callback_ior () -{ - return this->callback_ior_.c_str (); -} - diff --git a/CIAO/DAnCE/NodeApplication/Container_Impl.cpp b/CIAO/DAnCE/NodeApplication/Container_Impl.cpp deleted file mode 100644 index 8b28f60bc76..00000000000 --- a/CIAO/DAnCE/NodeApplication/Container_Impl.cpp +++ /dev/null @@ -1,617 +0,0 @@ -// $Id$ - -#include "Container_Impl.h" -#include "ciao/CCM_StandardConfiguratorC.h" -#include "ciao/CCM_KeylessCCMHomeC.h" - -#include "orbsvcs/CosNamingC.h" - -#if !defined (__ACE_INLINE__) -# include "Container_Impl.inl" -#endif /* __ACE_INLINE__ */ - -CIAO::Container_Impl::~Container_Impl () -{ -} - -PortableServer::POA_ptr -CIAO::Container_Impl::_default_POA (void) -{ - CIAO_TRACE ("CIAO::Container_Impl::_default_POA"); - return PortableServer::POA::_duplicate (this->poa_.in ()); -} - - /////////////////////////////////////////////////////////////// - -CORBA::Long -CIAO::Container_Impl::init (const CORBA::PolicyList *policies) -{ - CIAO_TRACE ("CIAO::Container_Impl::init"); - // @@ Initialize container and create the internal container - // implementation that actually interacts with installed - // homes/components. - - // @@ We will need a container factory here later on when we support - // more kinds of container implementations. - - // @@Jai, what is the condition to create an upgradeable container? - // Where is it getting created and how? Need to address that. - - if (this->static_entrypts_maps_ == 0) - { - this->container_.reset (new CIAO::Session_Container (this->orb_.in (), this)); - } - else - { - this->container_.reset (new CIAO::Session_Container (this->orb_.in (), - this, - 1, - this->static_entrypts_maps_)); - } - - return this->container_->init (0, policies); -} - - -Deployment::ComponentInfos * -CIAO::Container_Impl::install ( - const ::Deployment::ContainerImplementationInfo & container_impl_info - ) -{ - CIAO_TRACE ("CIAO::Container_Impl::install"); - Deployment::ComponentInfos_var retv; - try - { - ACE_NEW_THROW_EX (retv, - Deployment::ComponentInfos, - CORBA::NO_MEMORY ()); - - // Get the ComponentImplementationInfos from the - // ContainerImplementationInfo - // to avoid too long syntax representation - const ::Deployment::ComponentImplementationInfos impl_infos = - container_impl_info.impl_infos; - - CORBA::ULong const len = impl_infos.length (); - retv->length (len); - REC_POL_MAP rec_pol_map; - - for (CORBA::ULong i = 0; i < len; ++i) - { - const CORBA::ULong cplen = impl_infos[i].component_config.length (); - for (CORBA::ULong cp_len = 0; cp_len < cplen; ++cp_len) - { - if (impl_infos[i].component_config[cp_len]. - value.type ()->kind () == CORBA::tk_string) - { - const char* policy_set_id; - ACE_CString receptacle_name; - ACE_CString instance_name; - impl_infos[i].component_config[cp_len].value >>= - policy_set_id; - bool result = this->configurator_.policy_exists ( - policy_set_id); - if (result == true) - { - receptacle_name = impl_infos[i].component_config[cp_len]. - name.in (); - instance_name = impl_infos[i]. - component_instance_name.in (); - receptacle_name += "_"; - receptacle_name += instance_name; - CORBA::PolicyList_var policies = - this->configurator_.find_policies_by_name ( - policy_set_id); - CORBA::PolicyList temp_policies (0); - if (policies != 0) - { - temp_policies = *policies; - } - rec_pol_map.bind (receptacle_name, temp_policies); - } - } - } - - // Install home - Components::CCMHome_var home = - this->install_home (impl_infos[i]); - - Components::KeylessCCMHome_var kh = - Components::KeylessCCMHome::_narrow (home.in ()); - - if (CORBA::is_nil (kh.in ())) - throw Deployment::InstallationFailure (); - - // Create component from home - Components::CCMObject_var comp = kh->create_component (); - - if (CORBA::is_nil (comp.in ())) - throw Deployment::InstallationFailure (); - - if (this->component_map_.bind - (impl_infos[i].component_instance_name.in (), - Components::CCMObject::_duplicate (comp.in ()))) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Container_Impl.cpp -" - "CIAO::Container_Impl::install -" - "error in binding component " - "instance name [%s] into the component map \n", - impl_infos[i].component_instance_name.in ())); - throw Deployment::InstallationFailure (); - } - - // Set the return value. - (*retv)[i].component_instance_name - = impl_infos[i].component_instance_name.in (); - - (*retv)[i].component_ref = - Components::CCMObject::_duplicate (comp.in ()); - - // Deal with Component instance related Properties. - // Now I am only concerning about the COMPOENTIOR and attribute - // configuration initialization. - - // I need to map Properties to Components::ConfigValues - ::Components::ConfigValues comp_attributes; - comp_attributes.length (0); - - const CORBA::ULong clen = impl_infos[i].component_config.length (); - for (CORBA::ULong prop_len = 0; prop_len < clen; ++prop_len) - { - // Set up the ComponentIOR attribute - if (ACE_OS::strcmp - (impl_infos[i].component_config[prop_len].name.in (), - "ComponentIOR") == 0) - { - const char * path; - impl_infos[i].component_config[prop_len].value >>= path; - - CORBA::String_var ior = - this->orb_->object_to_string (comp.in ()); - - if (CIAO::Utility::write_IOR (path, ior.in ()) != 0) - { - if (CIAO::debug_level () > 1) - ACE_DEBUG ((LM_DEBUG, "Failed to write the IOR.\n")); - - throw CORBA::INTERNAL (); - } - } - - // Set up the naming service attribute - if (ACE_OS::strcmp - (impl_infos[i].component_config[prop_len].name.in (), - "RegisterNaming") == 0) - { - const char * naming_context; - impl_infos[i]. - component_config[prop_len].value >>= naming_context; - - // Register the component with the naming service - ACE_DEBUG ((LM_DEBUG, - "Register component with naming service.\n")); - bool result = - register_with_ns ( - naming_context, - this->orb_.in (), - Components::CCMObject::_duplicate (comp.in ()) - ); - - if (!result) - { - ACE_DEBUG ((LM_DEBUG, - "Failed to register with naming service.\n")); - } - else - { - if (this->naming_map_.bind - (impl_infos[i].component_instance_name.in (), - ACE_CString (naming_context))) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Container_Impl.cpp -" - "CIAO::Container_Impl::install -" - "error in binding component " - "instance name [%s] into the naming map \n", - impl_infos[i].component_instance_name.in ())); - throw Deployment::InstallationFailure (); - } - } - - - } - - // Initialize attributes through StandardConfigurator interface - // @@Todo: Currently I have to manually map - // the Deployment::Properties to - // Components::ConfigValues, we should use a - // common data structure in - // the future. - Gan - CORBA::ULong cur_len = comp_attributes.length (); - comp_attributes.length (cur_len + 1); - - Components::ConfigValue *item = new OBV_Components::ConfigValue (); - item->name (impl_infos[i].component_config[prop_len].name.in ()); - CORBA::Any tmp = impl_infos[i].component_config[prop_len].value; - item->value (tmp); - - comp_attributes[cur_len] = item; - } - - if (comp_attributes.length () != 0) - { - //std_configurator.set_configuration - ::Components::StandardConfigurator_var std_configurator = - comp->get_standard_configurator (); - - std_configurator->set_configuration (comp_attributes); - } - } - this->container_->set_receptacle_policy_map (rec_pol_map); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Container_Impl::install\t\n"); - throw; - } - - return retv._retn (); -} - -::Deployment::Properties * -CIAO::Container_Impl::properties () -{ - CIAO_TRACE ("CIAO::Container_Impl::properties"); - ::Deployment::Properties *retval = 0; - - ACE_NEW_THROW_EX (retval, - ::Deployment::Properties, - CORBA::NO_MEMORY ()); - - *retval = this->properties_; - - return retval; -} - -::Deployment::NodeApplication_ptr -CIAO::Container_Impl::get_node_application () -{ - CIAO_TRACE ("CIAO::Container_Impl::get_node_application"); - return ::Deployment::NodeApplication::_duplicate (this->nodeapp_.in ()); -} - -::Components::CCMHome_ptr -CIAO::Container_Impl::install_home ( - const ::Deployment::ComponentImplementationInfo & impl_info) -{ - CIAO_TRACE ("CIAO::Container_Impl::install_home"); - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Container_Impl.cpp -" - "CIAO::Container_Impl::install_home -" - "installing home for component " - "instance [%s] \n", - impl_info.component_instance_name.in ())); - } - - Components::CCMHome_var newhome = - this->container_->ciao_install_home (impl_info.executor_dll.in (), - impl_info.executor_entrypt.in (), - impl_info.servant_dll.in (), - impl_info.servant_entrypt.in (), - impl_info.component_instance_name.in ()); - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) Container_Impl.cpp -" - "CIAO::Container_Impl::install_home -" - "success in installing home for component " - "instance [%s] \n", - impl_info.component_instance_name.in ())); - } - - // We don't have to do _narrow since the generated code makes sure of - // the object type for us - // Bind the home in the map. - if (this->home_map_.bind (impl_info.component_instance_name.in (), - Components::CCMHome::_duplicate (newhome.in ()))) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) Container_Impl.cpp -" - "CIAO::Container_Impl::install_home -" - "error in binding home for component " - "instance [%s] \n", - impl_info.component_instance_name.in ())); - throw Deployment::InstallationFailure (); - } - - //Note: If the return value will be discarded, it must be kept in a var or - // release () will have to be called explicitly. - return newhome._retn (); -} - - -void -CIAO::Container_Impl::remove_home (const char * comp_ins_name) -{ - CIAO_TRACE ("CIAO::Container_Impl::remove_home"); - - Components::CCMHome_ptr home; - ACE_CString str (comp_ins_name); - - if (this->home_map_.find (str, home) != 0) - throw CORBA::BAD_PARAM (); - - // @@TODO We should remove all components created by this home as well. - // This is not implemented yet. - - this->container_->ciao_uninstall_home (home); - - // If the previous calls failed, what should we do here?? - CORBA::release (home); - - // @@ Still need to remove the home if the previous operation fails? - if (this->home_map_.unbind (str) == -1) - throw ::Components::RemoveFailure (); -} - -// Remove all homes and components -void -CIAO::Container_Impl::remove () -{ - CIAO_TRACE ("CIAO::Container_Impl::remove"); - - // Remove all components first. - this->remove_components (); - - // Even if above operation failed we should still remove homes. - const Home_Iterator end = this->home_map_.end (); - for (Home_Iterator iter (this->home_map_.begin ()); - iter != end; - ++iter) - { - this->container_->ciao_uninstall_home ( (*iter).int_id_); - - CORBA::release ( (*iter).int_id_); - } - - this->home_map_.unbind_all (); - - if (CIAO::debug_level () > 3) - ACE_DEBUG ((LM_DEBUG, - "Removed all homes and components from this container!\n")); -} - -//////////////////////////////////////////////////////////////////////// -// Internal helper functions. -//////////////////////////////////////////////////////////////////////// - -void -CIAO::Container_Impl::remove_components () -{ - CIAO_TRACE ("CIAO::Container_Impl::remove_components"); - - // Remove all the components in the NodeApplication/Container - // Release all component servant object. - const Component_Iterator end = this->component_map_.end (); - for (Component_Iterator iter (this->component_map_.begin ()); - iter != end; - ++iter) - { - // Find the component home first, then call the remove_component - // on the home. - Components::CCMHome_ptr home; - if (this->home_map_.find ( (*iter).ext_id_, home) != 0) - throw CORBA::BAD_PARAM (); - - // This will call ccm_passivate on the component executor. - home->remove_component (((*iter).int_id_).in ()); - - //CORBA::release (((*iter).int_id_).in ()); - } - - this->component_map_.unbind_all (); - // To this point the servant should have been destroyed. However, - // if someone is still making calls on the servant, terrible thing - // will happen. -} - - -// Below method is not used actually. -void -CIAO::Container_Impl::remove_component (const char * comp_ins_name) -{ - CIAO_TRACE ("CIAO::Container_Impl::remove_component"); - - Components::CCMObject_var comp; - Components::CCMHome_ptr home; - - ACE_CString naming_context; - - ACE_CString str (comp_ins_name); - - if (CIAO::debug_level () > 5) - ACE_DEBUG ((LM_DEBUG, "CIAO::COntainer_Impl::remove_component: Removing comp_ins_name:: %s\n", - str.c_str ())); - - /* Before we do remove component we have to inform the homeservant so - * Component::ccm_passivate () - * constainer::uninstall_component () ->deactivate_object () will be called. - * - * ccm_remove will be called when the poa destroys the servant. - */ - - if (this->component_map_.find (str, comp) != 0) - throw CORBA::BAD_PARAM (); - - if (this->home_map_.find (str, home) != 0) - throw CORBA::BAD_PARAM (); - - // This will call ccm_passivate on the component executor. - home->remove_component (comp.in ()); - - // If the previous calls failed, what should we do here?? - - // @@ Still need to remove the home if the previous operation fails? - if (this->component_map_.unbind (str) == -1) - throw ::Components::RemoveFailure (); - - if (this->naming_map_.find (str, naming_context) == 0) - { - - bool const result = - unregister_with_ns ( - naming_context.c_str (), - this->orb_.in () - ); - - if (!result) - { - ACE_DEBUG ((LM_DEBUG, - "Failed to unregister with naming service.\n")); - } - else - { - if (this->naming_map_.unbind (str) == -1) - throw ::Components::RemoveFailure (); - } - } -} - -bool -CIAO::Container_Impl::register_with_ns (const char * s, - CORBA::ORB_ptr orb, - Components::CCMObject_ptr obj) -{ - CIAO_TRACE ("CIAO::Container_Impl::register_with_ns"); - - try - { - // Obtain the naming service - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - if (CORBA::is_nil (naming_obj.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "DAnCE: (%P|%t) Unable to get the Naming Service.\n"), - false); - - CosNaming::NamingContextExt_var root = - CosNaming::NamingContextExt::_narrow (naming_obj.in ()); - - CosNaming::Name name (0); - name.length (0); - - // Get the multicomponent naming context from the <naming_context>. - // The convention of this <naming_context> input string is that - // different naming context is separated by character '/', such as - // "create a naming context A/B/C/D". - ACE_CString tmp (s); - char * naming_string = tmp.rep (); - char seps[] = "/:"; - - char *token, *lastToken = 0; - token = ACE_OS::strtok (naming_string, seps); - - for (CORBA::ULong i = 0; token != 0; ++i) - { - // While there still are tokens in the "naming_string" - name.length (name.length () + 1); - name[i].id = CORBA::string_dup (token); - - // Get next naming context - lastToken = token; - token = ACE_OS::strtok ( 0, seps ); - } - - if (name.length() > 1) - { - // Let's create the context path first - name.length(name.length()-1); - Utility::NameUtility::CreateContextPath (root.in (), name); - name.length(name.length()+1); - name[name.length()-1].id = CORBA::string_dup(lastToken); - } - - // Bind the actual object - Utility::NameUtility::BindObjectPath (root.in (), name, obj); - - return true; - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("CIAO (%P|%t) Container_Impl.cpp -" - "CIAO::Container_Impl::register_with_ns -" - "NodeApplication: failed to register " - "with naming service."); - return false; - } - return true; -} - -bool -CIAO::Container_Impl::unregister_with_ns (const char * obj_name, - CORBA::ORB_ptr orb) -{ - CIAO_TRACE ("CIAO::Container_Impl::unregister_with_ns"); - - try - { - // Obtain the naming service - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - if (CORBA::is_nil (naming_obj.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to get the Naming Service.\n"), - false); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in ()); - - CosNaming::Name name (0); - name.length (0); - - // Get the multicomponent naming context from the <naming_context>. - // The convention of this <naming_context> input string is that - // different naming context is separated by character '/', such as - // "create a naming context A/B/C/D". - ACE_CString tmp (obj_name); - char * naming_string = tmp.rep (); - char seps[] = "/:"; - - char *token, *lastToken = 0; - token = ACE_OS::strtok (naming_string, seps); - - for (CORBA::ULong i = 0; token != 0; ++i) - { - // While there still are tokens in the "naming_string" - name.length (name.length () + 1); - name[i].id = CORBA::string_dup (token); - - // Get next naming context - lastToken = token; - token = ACE_OS::strtok ( 0, seps ); - } - - // Unregister with the Name Server - ACE_DEBUG ((LM_DEBUG, - "Unregister component with the name server : %s!\n", - obj_name)); - naming_context->unbind (name); - - return true; - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("CIAO (%P|%t) Container_Impl.cpp -" - "CIAO::Container_Impl::unregister_with_ns -" - "NodeApplication: failed to unregister " - "with naming service."); - return false; - } - return true; -} diff --git a/CIAO/DAnCE/NodeApplication/Container_Impl.h b/CIAO/DAnCE/NodeApplication/Container_Impl.h deleted file mode 100644 index 96ec5eb9e6c..00000000000 --- a/CIAO/DAnCE/NodeApplication/Container_Impl.h +++ /dev/null @@ -1,191 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Container_Impl.h - * - * $Id$ - * - * This file contains implementation for the servant of - * Components::Deployment::Container interface. - * - * @author Nanbor Wang <nanbor@cs.wustl.edu> - * @author Gan Deng <gan.deng@vanderbilt.edu> - */ -//============================================================================= - - -#ifndef CIAO_CONTAINER_IMPL_H -#define CIAO_CONTAINER_IMPL_H -#include /**/ "ace/pre.h" - -#include "CIAO_NodeApplication_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DAnCE/Deployment/Deployment_ContainerS.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" -#include "DAnCE/Deployment//DeploymentC.h" -#include "ace/SString.h" -#include "ace/Auto_Ptr.h" -#include "ciao/Server_init.h" // write_IOR function & NameUtility -#include "ciao/CIAO_common.h" // CIAO::debug_level -#include "ciao/Session_Container.h" -#include "NodeApp_Configurator.h" - -namespace CIAO -{ - /** - * @class Container_Impl - * - * @brief Servant implementation for the interface Deployment::Container - * - * This class implements the Deployment::Container - * interface which is not defined by the CCM DnC specification. - * As the interface implies, this is actually part of the deployment - * interface and is used to manage the lifecycle of the installed - * components and homes. - */ - class NODEAPPLICATION_Export Container_Impl - : public virtual POA_Deployment::Container - { - public: - /// Constructor - Container_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - ::Deployment::NodeApplication_ptr server, - NodeApp_Configurator &c, - const Static_Config_EntryPoints_Maps* static_entrypts_maps =0); - - /// Destructor - virtual ~Container_Impl (void); - - /*-------------------------------------------------------------*/ - /*-------------------- IDL operations (idl) ------------------*/ - - /// Initialize the container. - virtual CORBA::Long init (const CORBA::PolicyList *policies); - - /// Install all homes and components - Deployment::ComponentInfos * - install (const ::Deployment::ContainerImplementationInfo & container_impl_info); - - /// Remove all homes and components - virtual void remove (); - - /// Deployment::Container interface defined attributes/operations. - virtual ::Deployment::Properties *properties (); - - virtual ::Deployment::NodeApplication_ptr get_node_application (); - - /*-------------------------------------------------------------*/ - /*------------------- C++ help methods (c++) -----------------*/ - - /// Get the containing POA. This operation does *not* - /// increase the reference count of the POA. - virtual PortableServer::POA_ptr _default_POA (void); - - // Install the home of this particular component - virtual ::Components::CCMHome_ptr - install_home (const ::Deployment::ComponentImplementationInfo & impl_info); - - /** - * @@Note: I don't know how to remove a home right now. - * I assume that user will only call remove instead. - * This is true at least for DnC run time. - * - * Right now, in this implementation I assumpe that there will be - * same number of homes as the components even if the components - * are of the same type. I don't think that we have the modeling - * side support of this either. So bear me if you think I avoid - * the real thinking for easiness. - */ - // Remove the home of this particular component - virtual void remove_home (const char * comp_ins_name); - - bool - register_with_ns (const char * obj_name, - CORBA::ORB_ptr orb, - Components::CCMObject_ptr obj); - - bool - unregister_with_ns (const char * obj_name, CORBA::ORB_ptr orb); - - // ------------------- CIAO Internal Operations ------------------------ - // These below two are helper methods to clean up components - // should only be called when we are sure that there is no - // active connection on this component. - virtual void remove_components (); - - virtual void remove_component (const char * comp_ins_name); - - /// Set the cached object reference. - void set_objref (Deployment::Container_ptr o); - - /// Get the cached object reference. This operation will invoke - /// _this if there's no cached reference available. Notice that - /// this method does *NOT* increase the reference count of the - /// cached reference. - Deployment::Container_ptr get_objref (); - -protected: - /// Keep a pointer to the managing ORB serving this servant. - CORBA::ORB_var orb_; - - /// Keep a pointer to the managing POA. - PortableServer::POA_var poa_; - - /// Internal container implementation. - // @@ Gan/Jai, heard of auto_ptr <>? - //CIAO::Container *container_; - ACE_Auto_Ptr<CIAO::Container> container_; - - /// Cached ConfigValues. - Deployment::Properties properties_; - - /// Cached Container reference (of ourselves.) - Deployment::Container_var objref_; - - /// Cached NodeApplication. - Deployment::NodeApplication_var nodeapp_; - - NodeApp_Configurator &configurator_; - - /// To store all created CCMHome object - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Components::CCMHome_ptr, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> CCMHome_Map; - typedef CCMHome_Map::iterator Home_Iterator; - CCMHome_Map home_map_; - - /// To store all created Component object. - // @@Gan, see how this caching is duplicated.. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Components::CCMObject_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> CCMComponent_Map; - typedef CCMComponent_Map::iterator Component_Iterator; - CCMComponent_Map component_map_; - - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - ACE_CString, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> CCMNaming_Map; - CCMNaming_Map naming_map_; - - const Static_Config_EntryPoints_Maps* static_entrypts_maps_; - }; -} - -#if defined (__ACE_INLINE__) -# include "Container_Impl.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* CIAO_CONTAINER_IMPL_H */ diff --git a/CIAO/DAnCE/NodeApplication/Container_Impl.inl b/CIAO/DAnCE/NodeApplication/Container_Impl.inl deleted file mode 100644 index 2bb25421ff0..00000000000 --- a/CIAO/DAnCE/NodeApplication/Container_Impl.inl +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -ACE_INLINE -CIAO::Container_Impl::Container_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - ::Deployment::NodeApplication_ptr server, - NodeApp_Configurator &c, - const Static_Config_EntryPoints_Maps* static_entrypts_maps) - : orb_ (CORBA::ORB::_duplicate (o)), - poa_ (PortableServer::POA::_duplicate (p)), - nodeapp_ (::Deployment::NodeApplication::_duplicate (server)), - configurator_ (c), - static_entrypts_maps_ (static_entrypts_maps) -{ -} - -ACE_INLINE void -CIAO::Container_Impl::set_objref (Deployment::Container_ptr o) -{ - CIAO_TRACE("CIAO::Container_Imp::set_objref"); - - if (!CORBA::is_nil (this->objref_.in ())) - throw CORBA::BAD_INV_ORDER (); - - this->objref_ = Deployment::Container::_duplicate (o); -} - -ACE_INLINE ::Deployment::Container_ptr -CIAO::Container_Impl::get_objref () -{ - CIAO_TRACE("CIAO::Container_Imp::get_objref"); - - if (CORBA::is_nil (this->objref_.in ())) - { - this->objref_ = this->_this (); - } - return Deployment::Container::_duplicate (this->objref_.in ()); -} diff --git a/CIAO/DAnCE/NodeApplication/NAConfig_Manager.cpp b/CIAO/DAnCE/NodeApplication/NAConfig_Manager.cpp deleted file mode 100755 index e36c8767632..00000000000 --- a/CIAO/DAnCE/NodeApplication/NAConfig_Manager.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// $Id$ - -#include "NAConfig_Manager.h" -#include "ciao/CIAO_common.h" -#include "ace/SString.h" -#include "tao/SystemException.h" -#include "tao/DiffServPolicy/DiffServPolicy.h" -#include "tao/DiffServPolicy/Client_Network_Priority_Policy.h" -#include "tao/DiffServPolicy/Server_Network_Priority_Policy.h" - -void -CIAO::NAResource_Config_Manager::init (CORBA::ORB_ptr orb) -{ - this->orb_ = CORBA::ORB::_duplicate (orb); -} - -int -CIAO::NAResource_Config_Manager::pre_orb_initialize (void) -{ - return 0; -} - -int -CIAO::NAResource_Config_Manager::post_orb_initialize (CORBA::ORB_ptr) -{ - return 0; -} - -void -CIAO::NAResource_Config_Manager::init_resources -(const CIAO::DAnCE::ServerResource &server_resource) -{ - ACE_DEBUG ((LM_DEBUG,"NAResource_Config_Manager::init_resources\n")); - - if (CORBA::is_nil (this->orb_.in())) - { - ACE_ERROR ((LM_ERROR, - "NAResource_Config_Manager has not been properly initialized\n")); - throw CORBA::INTERNAL (); - } - - const CIAO::DAnCE::PolicySets &sets = server_resource.orb_config.policy_set; - for (CORBA::ULong i = 0; i < sets.length (); ++i) - { - CORBA::ULong np = sets[i].policies.length (); - if (np == 0) - continue; - - CORBA::PolicyList_var policy_list = new CORBA::PolicyList (np); - policy_list->length (np); - CORBA::ULong index = 0; - CORBA::ULong array_index = np; - - // Create a list of policies - for (CORBA::ULong pc = 0; pc < np; ++pc) - { - CORBA::Policy_var temp_policy = - this->create_single_policy (sets[i].policies[pc]); - - if (CORBA::is_nil (temp_policy.in ())) - { - array_index = array_index - 1; - policy_list->length (array_index); - } - else - { - policy_list[index] = temp_policy; - index = index + 1; - } - } - - // Bind the policy list to the name. The bind operation should - // surrender the ownership of the newly created PolicyList - // sequence to the map. - if (array_index != 0) - { - if (this->policy_map_.bind (sets[i].Id.in (), - policy_list) != 0) - { - ACE_ERROR ((LM_ERROR, - "Error binding Policy_Set with name: %s\n", - sets[i].Id.in ())); - throw CORBA::INTERNAL (); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "NAResource_Config_Manager::init_resource" - " added policy set : %s with %d policies\n", - sets[i].Id.in (), array_index)); - } - } - else - { - ACE_DEBUG ((LM_DEBUG, - "NAResource_Config_Manager::init_resource" - " added policy set : %s with %d policies\n", - sets[i].Id.in (), array_index)); - } - } -} - -bool -CIAO::NAResource_Config_Manager::policy_exists (const char *name) -{ - if (name == 0) - { - ACE_ERROR ((LM_ERROR, - "Invalid name string found in " - "CIAO::NAResource_Config_Manager::policy_exists\n")); - throw CORBA::INTERNAL (); - } - - POLICY_MAP::ENTRY *entry = 0; - - if (this->policy_map_.find (name, entry) != 0) - { - return false; - } - - return true; -} - -CORBA::PolicyList * -CIAO::NAResource_Config_Manager::find_policies_by_name (const char *name) -{ - if (name == 0) - { - ACE_DEBUG ((LM_DEBUG, - "Invalid name string found in find_policies_by_name\n")); - throw CORBA::INTERNAL (); - } - - POLICY_MAP::ENTRY *entry = 0; - - CORBA::PolicyList_var retv; - - if (this->policy_map_.find (name, entry) != 0) - { - ACE_DEBUG ((LM_DEBUG, - "Unable to find a PolicyList named %s\n", - name)); - retv = 0; - } - else - { - retv = new CORBA::PolicyList (entry->int_id_.in ()); - } - return retv._retn (); -} - -CORBA::Policy_ptr -CIAO::NAResource_Config_Manager::create_single_policy -(const CIAO::DAnCE::PolicyDef &policy_def) -{ - CORBA::Policy_var retv; - - switch (policy_def._d ()) - { - case TAO::NETWORK_PRIORITY_TYPE: - { - const CIAO::DAnCE::NWPriorityModelPolicyDef &nw_tmp - = policy_def.NWPriorityModelDef (); - retv = this->orb_->_create_policy (TAO::NETWORK_PRIORITY_TYPE); - - TAO::NetworkPriorityPolicy_var nw_priority = - TAO::NetworkPriorityPolicy::_narrow (retv.in ()); - - nw_priority->network_priority_model ( - (TAO::NetworkPriorityModel) nw_tmp.nw_priority_model); - - nw_priority->request_diffserv_codepoint ( - (TAO::DiffservCodepoint) nw_tmp.request_dscp); - - nw_priority->reply_diffserv_codepoint ( - (TAO::DiffservCodepoint) nw_tmp.reply_dscp); - - retv = nw_priority._retn (); - - if (! CORBA::is_nil (retv.in ())) - ACE_DEBUG ((LM_DEBUG, - "NAConfigManager::Create NetworkPriority policy: %d\n", - nw_tmp.nw_priority_model)); - } - break; - - case TAO::CLIENT_NETWORK_PRIORITY_TYPE: - { - const CIAO::DAnCE::CNWPriorityModelPolicyDef &cnw_tmp - = policy_def.CNWPriorityModelDef (); - retv = this->orb_->_create_policy (TAO::CLIENT_NETWORK_PRIORITY_TYPE); - - TAO::NetworkPriorityPolicy_var cnw_priority = - TAO::NetworkPriorityPolicy::_narrow (retv.in ()); - - cnw_priority->request_diffserv_codepoint ( - (TAO::DiffservCodepoint) cnw_tmp.request_dscp); - - cnw_priority->reply_diffserv_codepoint ( - (TAO::DiffservCodepoint) cnw_tmp.reply_dscp); - - retv = cnw_priority._retn (); - - if (! CORBA::is_nil (retv.in ())) - ACE_DEBUG ((LM_DEBUG, - "NAConfigManager::Create NetworkPriority policy \n")); - } - break; - - default: - retv = 0; - } - - return retv._retn (); -} - -extern "C" CIAO_NA_Configurator_Export CIAO::Config_Manager *create_na_config_manager (void); - -CIAO::Config_Manager * -create_na_config_manager (void) -{ - CIAO::NAResource_Config_Manager *config; - ACE_NEW_RETURN (config, CIAO::NAResource_Config_Manager, 0); - return config; -} diff --git a/CIAO/DAnCE/NodeApplication/NAConfig_Manager.h b/CIAO/DAnCE/NodeApplication/NAConfig_Manager.h deleted file mode 100755 index 00248c5c551..00000000000 --- a/CIAO/DAnCE/NodeApplication/NAConfig_Manager.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file NAConfig_Manager.h - * - * $Id$ - * - */ -//============================================================================= - - -#ifndef CIAO_NACONFIG_MANAGER_H -#define CIAO_NACONFIG_MANAGER_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DAnCE/Deployment/CIAO_ServerResourcesC.h" -#include "ace/Null_Mutex.h" -#include "ace/SString.h" -#include "ace/Hash_Map_Manager_T.h" -#include "Config_Manager.h" -#include "NA_Configurator_Export.h" - -namespace CIAO -{ - /** - */ - class CIAO_NA_Configurator_Export NAResource_Config_Manager - : public Config_Manager - { - public: - virtual ~NAResource_Config_Manager (void) {} - - virtual int pre_orb_initialize (void); - - virtual int post_orb_initialize (CORBA::ORB_ptr o); - - virtual void init (CORBA::ORB_ptr orb); - - /// Initializing the NAResource_Config_Manager - virtual void init_resources (const CIAO::DAnCE::ServerResource &info); - - /// Query a policy set by name - virtual CORBA::PolicyList *find_policies_by_name (const char *name); - - virtual bool policy_exists (const char *name); - - private: - /// Cached an ORB reference. - CORBA::ORB_var orb_; - - CORBA::Policy_ptr create_single_policy - (const CIAO::DAnCE::PolicyDef &policy_def); - - /// Hash_Map stuff. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - CORBA::PolicyList_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> POLICY_MAP; - - /// Internal TP names to id map. - POLICY_MAP policy_map_; - }; -} - -#include /**/ "ace/post.h" -#endif /* CIAO_NACONFIG_MANAGER_H */ - diff --git a/CIAO/DAnCE/NodeApplication/NAConfig_Manager.inl b/CIAO/DAnCE/NodeApplication/NAConfig_Manager.inl deleted file mode 100755 index 67203a91ff8..00000000000 --- a/CIAO/DAnCE/NodeApplication/NAConfig_Manager.inl +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ - -ACE_INLINE -CIAO::NAResource_Config_Manager::NAResource_Config_Manager () -{ -} - -ACE_INLINE -CIAO::NAResource_Config_Manager::~NAResource_Config_Manager () -{ -} - diff --git a/CIAO/DAnCE/NodeApplication/NA_Configurator_Export.h b/CIAO/DAnCE/NodeApplication/NA_Configurator_Export.h deleted file mode 100755 index 2e30fd59cc1..00000000000 --- a/CIAO/DAnCE/NodeApplication/NA_Configurator_Export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl CIAO_NA_Configurator -// ------------------------------ -#ifndef CIAO_NA_CONFIGURATOR_EXPORT_H -#define CIAO_NA_CONFIGURATOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_NA_CONFIGURATOR_HAS_DLL) -# define CIAO_NA_CONFIGURATOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && CIAO_NA_CONFIGURATOR_HAS_DLL */ - -#if !defined (CIAO_NA_CONFIGURATOR_HAS_DLL) -# define CIAO_NA_CONFIGURATOR_HAS_DLL 1 -#endif /* ! CIAO_NA_CONFIGURATOR_HAS_DLL */ - -#if defined (CIAO_NA_CONFIGURATOR_HAS_DLL) && (CIAO_NA_CONFIGURATOR_HAS_DLL == 1) -# if defined (CIAO_NA_CONFIGURATOR_BUILD_DLL) -# define CIAO_NA_Configurator_Export ACE_Proper_Export_Flag -# define CIAO_NA_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define CIAO_NA_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* CIAO_NA_CONFIGURATOR_BUILD_DLL */ -# define CIAO_NA_Configurator_Export ACE_Proper_Import_Flag -# define CIAO_NA_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define CIAO_NA_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* CIAO_NA_CONFIGURATOR_BUILD_DLL */ -#else /* CIAO_NA_CONFIGURATOR_HAS_DLL == 1 */ -# define CIAO_NA_Configurator_Export -# define CIAO_NA_CONFIGURATOR_SINGLETON_DECLARATION(T) -# define CIAO_NA_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* CIAO_NA_CONFIGURATOR_HAS_DLL == 1 */ - -// Set CIAO_NA_CONFIGURATOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (CIAO_NA_CONFIGURATOR_NTRACE) -# if (ACE_NTRACE == 1) -# define CIAO_NA_CONFIGURATOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define CIAO_NA_CONFIGURATOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !CIAO_NA_CONFIGURATOR_NTRACE */ - -#if (CIAO_NA_CONFIGURATOR_NTRACE == 1) -# define CIAO_NA_CONFIGURATOR_TRACE(X) -#else /* (CIAO_NA_CONFIGURATOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define CIAO_NA_CONFIGURATOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (CIAO_NA_CONFIGURATOR_NTRACE == 1) */ - -#endif /* CIAO_NA_CONFIGURATOR_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/NodeApplication/Name_Utilities.cpp b/CIAO/DAnCE/NodeApplication/Name_Utilities.cpp new file mode 100644 index 00000000000..dd34beee6b7 --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/Name_Utilities.cpp @@ -0,0 +1,178 @@ +// $Id$ + +#include "Name_Utilities.h" + +#include "ace/Auto_Ptr.h" +#include "ace/SString.h" +#include "Logger/Log_Macros.h" + +namespace DAnCE +{ + bool + Name_Utilities::write_ior (const ACE_TCHAR *file, + const char *ior) + { + FILE* ior_output_file_ = ACE_OS::fopen (file, "w"); + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + return true; + } + return false; + } + + bool + Name_Utilities::bind_object (const char *name, + CORBA::Object_ptr obj, + CosNaming::NamingContext_ptr ctx) + { + DANCE_TRACE ("Name_Utilities::bind_object"); + + if (CORBA::is_nil (ctx)) + { + DANCE_ERROR ((LM_WARNING, DLINFO "Name_Utilities::bind_object - " + "Provided naming context is nil, component %s will not be registered.", + name)); + return false; + } + + try + { + CosNaming::Name nm; + + Name_Utilities::build_name (name, nm); + + if (nm.length () == 0) + { + DANCE_ERROR ((LM_WARNING, DLINFO "Name_Utilities::bind_object - " + "build_name resulted in an invalid name for string %C\n", + name)); + return false; + } + + Name_Utilities::bind_context (nm, ctx); + + try + { + ctx->bind (nm, obj); + } + catch (const CosNaming::NamingContext::AlreadyBound &) + { + DANCE_ERROR ((LM_WARNING, DLINFO "Name_Utilities::bind_object - " + "Name %C already bound, rebinding....\n", + name)); + ctx->rebind (nm, obj); + } + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Name_Utilities::bind_object - " + "Caught CORBA exception while attempting to bind name %C: %C\n", + name, ex._info ().c_str ())); + return false; + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Name_Utilities::bind_object - " + "Caught unknown C++ exception while attemptint to bind name %C\n", + name)); + return false; + } + + return true; + } + + void + Name_Utilities::bind_context (CosNaming::Name &nm, + CosNaming::NamingContext_ptr ctx) + { + DANCE_TRACE ("Name_Utilities::bind_context"); + + if (CORBA::is_nil (ctx)) + { + DANCE_ERROR ((LM_WARNING, DLINFO "Name_Utilities::bind_context - " + "Provided naming context is nil, the naming context will not be bound.")); + } + + CosNaming::Name newname (nm.length ()); + + for (CORBA::ULong i = 0; + i < (nm.length () - 1); ++i) + { + newname.length (i + 1); + newname[i] = nm[i]; + + try + { + ctx->bind_new_context (newname); + DANCE_DEBUG ((LM_TRACE, DLINFO "Name_Utilities::bind_context - " + "Bound new context %C\n", newname[i].id.in ())); + } + catch (CosNaming::NamingContext::AlreadyBound &) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "Name_Utilities::bind_context - " + "Context %C already bound.\n", newname[i].id.in ())); + } + } + } + + bool + Name_Utilities::unbind_object (const char *name, + CosNaming::NamingContext_ptr ctx) + { + DANCE_TRACE ("Name_Utilities::unbind_object"); + + if (CORBA::is_nil (ctx)) + { + DANCE_ERROR ((LM_WARNING, DLINFO "Name_Utilities::unbind_object - " + "Provided naming context is nil, instance %s will not be unbound\n", + name)); + } + + CosNaming::Name nm; + Name_Utilities::build_name (name, nm); + + try + { + ctx->unbind (nm); + } + catch (CORBA::Exception &e) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Name_Utilities::unbind_object - " + "Caught CORBA exception whilst unbinding name %C: %C\n", + name, e._info ().c_str ())); + return false; + } + return true; + } + + void + Name_Utilities::build_name (const char *name, + CosNaming::Name &nm) + { + DANCE_TRACE ("Name_Utilities::build_name"); + + /*ACE_Auto_Basic_Array_Ptr<ACE_TCHAR>*/ ACE_TCHAR *safe_array (new char[ACE_OS::strlen (name)]); + + ACE_Tokenizer parser (ACE_OS::strcpy (safe_array/*.get ()*/, name)); + parser.delimiter ('/'); + + ACE_TCHAR *next (0); + + while ((next = parser.next ()) != 0) + { + CORBA::ULong i = nm.length (); + nm.length (i + 1); + + DANCE_DEBUG ((LM_TRACE, DLINFO "Name_Utilities::build_name - " + "Found name component %C\n", + next)); + + nm[i].id = CORBA::string_dup (next); + } + } + +} diff --git a/CIAO/DAnCE/NodeApplication/Name_Utilities.h b/CIAO/DAnCE/NodeApplication/Name_Utilities.h new file mode 100644 index 00000000000..5e75249a693 --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/Name_Utilities.h @@ -0,0 +1,42 @@ +/** + * @file Name_Utilities.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * A set of utility methods to manages references. + * + */ + +#ifndef NAME_UTILITIES_H +#define NAME_UTILITIES_H + +#include "orbsvcs/CosNamingC.h" + +namespace DAnCE +{ + class Name_Utilities + { + public: + /// Write IOR to named file. Will overwrite file if present. + static bool write_ior (const ACE_TCHAR *file, const char *ior); + + /// Binds object to provided name, which may be formatted with / to indicate + /// naming contexts, e.g. A/B/C. + static bool bind_object (const char *name, + CORBA::Object_ptr obj, + CosNaming::NamingContext_ptr); + + /// Will unbind the provided name. + static bool unbind_object (const char *name, + CosNaming::NamingContext_ptr); + + private: + static void bind_context (CosNaming::Name &nm, + CosNaming::NamingContext_ptr); + + static void build_name (const char *nm, + CosNaming::Name &); + + }; +} + +#endif /* NAME_UTILITIES_H */ diff --git a/CIAO/DAnCE/NodeApplication/NoOp_Configurator.cpp b/CIAO/DAnCE/NodeApplication/NoOp_Configurator.cpp deleted file mode 100644 index 4ffe48cd7d2..00000000000 --- a/CIAO/DAnCE/NodeApplication/NoOp_Configurator.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// $Id$ - -#include "NoOp_Configurator.h" - -CIAO::NoOp_Configurator::~NoOp_Configurator (void) -{ - // Not much to do. -} - -int -CIAO::NoOp_Configurator::pre_orb_initialize () -{ - return 0; -} - -int -CIAO::NoOp_Configurator::post_orb_initialize (CORBA::ORB_ptr) -{ - return 0; -} - -int -CIAO::NoOp_Configurator::init_resource_manager -(const ::Deployment::Properties & /*properties*/) -{ - // @@ Currently do thing. We should go over the resource struct in - // the future and throw exceptions if there are - // un-recognizable/supported stuff in it. - return 0; -} - -CORBA::PolicyList * -CIAO::NoOp_Configurator::find_container_policies -(const ::Deployment::Properties & /*properties*/) -{ - // Not much to do. - - return 0; -} diff --git a/CIAO/DAnCE/NodeApplication/NoOp_Configurator.h b/CIAO/DAnCE/NodeApplication/NoOp_Configurator.h deleted file mode 100644 index 6c32b83ce0d..00000000000 --- a/CIAO/DAnCE/NodeApplication/NoOp_Configurator.h +++ /dev/null @@ -1,62 +0,0 @@ -/** $Id$ - * @file NoOp_Configurator.h - * @brief This file contains the noop configurator. - */ - -#ifndef NOOP_CONFIGURATOR_H -#define NOOP_CONFIGURATOR_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "NodeApp_Configurator.h" -#include "NoOp_Configurator_export.h" - -namespace CIAO -{ - /** - * @class NoOP_Configurator - * - * @brief The NoOp_Configurator doesn't do anything. - */ - class NoOp_Configurator_Export NoOp_Configurator - : public NodeApp_Configurator - { - public: - /// Default destructor. - virtual ~NoOp_Configurator (void); - - /** - * @brief "pre_orb_initialize" is called before ORB_init. - */ - virtual int pre_orb_initialize (void); - - /** - * @brief "post_orb_initialize" is called after NodeApplication - * get a hold at this object. - */ - virtual int post_orb_initialize (CORBA::ORB_ptr o); - - /** - * @brief "init_resource_manager" is called by NodeApplication when - * it receives an "install" commands. - */ - virtual int - init_resource_manager (const ::Deployment::Properties &properties); - - /** - * @brief get a policyset by its name. - */ - virtual CORBA::PolicyList * - find_container_policies (const ::Deployment::Properties &properties); - }; - -} - -#include /**/ "ace/post.h" -#endif /* NOOP_CONFIGURATOR_H */ diff --git a/CIAO/DAnCE/NodeApplication/NoOp_Configurator_export.h b/CIAO/DAnCE/NodeApplication/NoOp_Configurator_export.h deleted file mode 100644 index b6b3a9ec841..00000000000 --- a/CIAO/DAnCE/NodeApplication/NoOp_Configurator_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NoOp_Configurator -// ------------------------------ -#ifndef NOOP_CONFIGURATOR_EXPORT_H -#define NOOP_CONFIGURATOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (NOOP_CONFIGURATOR_HAS_DLL) -# define NOOP_CONFIGURATOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NOOP_CONFIGURATOR_HAS_DLL */ - -#if !defined (NOOP_CONFIGURATOR_HAS_DLL) -# define NOOP_CONFIGURATOR_HAS_DLL 1 -#endif /* ! NOOP_CONFIGURATOR_HAS_DLL */ - -#if defined (NOOP_CONFIGURATOR_HAS_DLL) && (NOOP_CONFIGURATOR_HAS_DLL == 1) -# if defined (NOOP_CONFIGURATOR_BUILD_DLL) -# define NoOp_Configurator_Export ACE_Proper_Export_Flag -# define NOOP_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define NOOP_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* NOOP_CONFIGURATOR_BUILD_DLL */ -# define NoOp_Configurator_Export ACE_Proper_Import_Flag -# define NOOP_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define NOOP_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* NOOP_CONFIGURATOR_BUILD_DLL */ -#else /* NOOP_CONFIGURATOR_HAS_DLL == 1 */ -# define NoOp_Configurator_Export -# define NOOP_CONFIGURATOR_SINGLETON_DECLARATION(T) -# define NOOP_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* NOOP_CONFIGURATOR_HAS_DLL == 1 */ - -// Set NOOP_CONFIGURATOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (NOOP_CONFIGURATOR_NTRACE) -# if (ACE_NTRACE == 1) -# define NOOP_CONFIGURATOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define NOOP_CONFIGURATOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !NOOP_CONFIGURATOR_NTRACE */ - -#if (NOOP_CONFIGURATOR_NTRACE == 1) -# define NOOP_CONFIGURATOR_TRACE(X) -#else /* (NOOP_CONFIGURATOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define NOOP_CONFIGURATOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (NOOP_CONFIGURATOR_NTRACE == 1) */ - -#endif /* NOOP_CONFIGURATOR_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/NodeApplication/NodeApp_Configurator.cpp b/CIAO/DAnCE/NodeApplication/NodeApp_Configurator.cpp deleted file mode 100755 index 8b18b66f16b..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApp_Configurator.cpp +++ /dev/null @@ -1,322 +0,0 @@ -// $Id$ - -#include "NodeApp_Configurator.h" -#include "Config_Manager.h" -#include "ace/Log_Msg.h" - -CIAO::NodeApp_Configurator::NodeApp_Configurator (void) - : rt_support_ (0) -{ -} - -CIAO::NodeApp_Configurator::~NodeApp_Configurator (void) -{ - // Not much to do. -} - -void -CIAO::NodeApp_Configurator::set_rt_support (void) -{ - this->rt_support_ = 1; -} - -int -CIAO::NodeApp_Configurator::create_config_managers (void) -{ - typedef CIAO::Config_Manager * (*na_intelligent_designer)(void); - typedef CIAO::Config_Manager * (*rtna_intelligent_designer)(void); - CIAO::Config_Manager* ptr = 0; - CIAO::Config_Manager* rt_ptr = 0; - - int retval = this->config_dll_.open ( - ACE_DLL_PREFIX ACE_TEXT ("CIAO_NA_Configurator"), - ACE_DEFAULT_SHLIB_MODE, - 0); - - if (0 != retval) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "dll.open"), - 0); - } - - // Cast the void* to non-pointer type first - it's not legal to - // cast a pointer-to-object directly to a pointer-to-function. - void *void_ptr = - this->config_dll_.symbol (ACE_TEXT ("create_na_config_manager")); - ptrdiff_t tmp = reinterpret_cast<ptrdiff_t> (void_ptr); - - // "id" is for na_intelligent-designer. - na_intelligent_designer config_id = - reinterpret_cast<na_intelligent_designer> (tmp); - - if (0 == config_id) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.symbol"), - 0); - } - - ptr = config_id (); - - if (0 == ptr) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Error creating NodeApp_Configurator\n"), - 0); - } - - this->na_config_manager_.reset (ptr); - - if (this->rt_support_) - { - int rt_retval = this->config_dll_.open ( - ACE_DLL_PREFIX ACE_TEXT ("CIAO_RTNA_Configurator"), - ACE_DEFAULT_SHLIB_MODE, - 0); - - if (0 != rt_retval) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "dll.open"), - 0); - } - - // Cast the void* to non-pointer type first - it's not legal to - // cast a pointer-to-object directly to a pointer-to-function. - void *rt_void_ptr = - this->config_dll_.symbol (ACE_TEXT ("create_rt_config_manager")); - ptrdiff_t rt_tmp = reinterpret_cast<ptrdiff_t> (rt_void_ptr); - - // "id" is for na_intelligent-designer. - rtna_intelligent_designer rt_config_id = - reinterpret_cast<rtna_intelligent_designer> (rt_tmp); - - if (0 == rt_config_id) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.symbol"), - 0); - } - - rt_ptr = rt_config_id (); - - if (0 == rt_ptr) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Error creating RTNodeApp_Configurator\n"), - 0); - } - - this->rt_config_manager_.reset (rt_ptr); - } - - return 0; -} - -int -CIAO::NodeApp_Configurator::pre_orb_initialize () -{ - ACE_DEBUG ((LM_DEBUG, "NodeApp_Configurator::pre_orb_init\n")); - - (*this->na_config_manager_.get ()).pre_orb_initialize (); - if (this->rt_support_) - { - (*this->rt_config_manager_.get ()).pre_orb_initialize (); - } - - return 0; -} - -int -CIAO::NodeApp_Configurator::post_orb_initialize (CORBA::ORB_ptr o) -{ - ACE_DEBUG ((LM_DEBUG, "NodeApp_Configurator::post_orb_init\n")); - this->orb_ = CORBA::ORB::_duplicate (o); - - (*this->na_config_manager_.get ()).init (this->orb_.in ()); - if (this->rt_support_ == 1) - { - (*this->rt_config_manager_.get ()).init (this->orb_.in ()); - } - - (*this->na_config_manager_.get ()).post_orb_initialize (this->orb_.in ()); - if (this->rt_support_ == 1) - { - (*this->rt_config_manager_.get ()).post_orb_initialize (this->orb_.in ()); - } - - return 0; -} - -int -CIAO::NodeApp_Configurator::init_resource_manager -(const ::Deployment::Properties &properties) -{ - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp ( - "CIAOServerResources", properties[i].name.in ()) == 0) - { - const CIAO::DAnCE::ServerResource *svr_resource; - if (properties[i].value >>= svr_resource) - { - (*this->na_config_manager_.get ()). - init_resources (*svr_resource); - - if (this->rt_support_ == 1) - { - (*this->rt_config_manager_.get ()). - init_resources (*svr_resource); - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "ERROR: NodeApp_Configurator::" - "init_resource_manager unable to extract" - "CIAOServerResources\n"), -1); - } - } - } - - return 0; -} - -CORBA::PolicyList * -CIAO::NodeApp_Configurator::find_container_policies -(const ::Deployment::Properties &properties) -{ - if (!this->na_config_manager_.get ()) - return 0; - - CORBA::PolicyList *configured_policies = 0; - CORBA::PolicyList *rt_configured_policies = 0; - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp ("ContainerPolicySet", properties[i].name) == 0) - { - const char *policy_name; - if (properties[i].value >>= policy_name) - { - configured_policies = (*this->na_config_manager_.get ()). - find_policies_by_name (policy_name); - - CORBA::ULong p_length = 0; - if (configured_policies != 0) - { - p_length = configured_policies->length (); - } - - if (this->rt_support_ == 1) - { - rt_configured_policies = (*this->rt_config_manager_.get ()). - find_policies_by_name (policy_name); - } - - CORBA::PolicyList_var temp_policies; - CORBA::ULong rtp_length = 0; - if (rt_configured_policies != 0) - { - rtp_length = rt_configured_policies->length (); - temp_policies = rt_configured_policies; - } - else - { - return configured_policies; - } - - CORBA::ULong final_length = p_length + rtp_length; - temp_policies->length (final_length); - - for (CORBA::ULong i = 0; i < p_length; ++i) - { - temp_policies[i+rtp_length] = - CORBA::Policy::_duplicate ((*configured_policies)[i]); - } - return temp_policies._retn (); - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "ERROR: NodeApp_Configurator:" - "find_container_policies unable to extract" - "ContainerPolicySet\n"), 0); - } - } - } - return 0; -} - -CORBA::PolicyList * -CIAO::NodeApp_Configurator::find_policies_by_name (const char *policy_name) -{ - if (!this->na_config_manager_.get ()) - return 0; - - CORBA::PolicyList *configured_policies = 0; - CORBA::PolicyList *rt_configured_policies = 0; - - configured_policies = (*this->na_config_manager_.get ()). - find_policies_by_name (policy_name); - - CORBA::ULong p_length = 0; - if (configured_policies != 0) - { - p_length = configured_policies->length (); - } - - if (this->rt_support_ == 1) - { - rt_configured_policies = (*this->rt_config_manager_.get ()). - find_policies_by_name (policy_name); - } - - CORBA::PolicyList_var temp_policies; - CORBA::ULong rtp_length = 0; - if (rt_configured_policies != 0) - { - rtp_length = rt_configured_policies->length (); - temp_policies = rt_configured_policies; - } - else - { - return configured_policies; - } - - CORBA::ULong final_length = p_length + rtp_length; - temp_policies->length (final_length); - - for (CORBA::ULong i = 0; i < p_length; ++i) - { - temp_policies[i+rtp_length] = - CORBA::Policy::_duplicate ((*configured_policies)[i]); - } - return temp_policies._retn (); -} - -bool -CIAO::NodeApp_Configurator::policy_exists (const char *policy_set_id) -{ - if (!this->na_config_manager_.get ()) - return 0; - - bool result; - result = (*this->na_config_manager_.get ()). - policy_exists (policy_set_id); - - if (result == false) - { - if (this->rt_support_ == 1) - { - result = (*this->rt_config_manager_.get ()). - policy_exists (policy_set_id); - } - } - return result; -} diff --git a/CIAO/DAnCE/NodeApplication/NodeApp_Configurator.h b/CIAO/DAnCE/NodeApplication/NodeApp_Configurator.h deleted file mode 100644 index 8fb48050806..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApp_Configurator.h +++ /dev/null @@ -1,120 +0,0 @@ -//$Id$ -/**======================================================== - * - * @file NodeApp_Configurator.h - * - * @Brief This file contains the implementation of - * the basic NodeApp_Configurator interface, the one - * that does nothing more - * - * @author Nanbor Wang <nanbor@exothermic.txcorp.com> - *========================================================*/ - -#ifndef NODEAPP_CONFIGURATOR_H -#define NODEAPP_CONFIGURATOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DAnCE/Deployment/Deployment_CoreC.h" -#include "ace/DLL.h" -#include "ace/Auto_Ptr.h" -#include "NodeApp_Configurator_Export.h" -#include "Config_Manager.h" - -namespace CIAO -{ - /** - * - * @class NodeApp_Configurator - * - * @brief This class defines and implements the default - * NodeApp_Configurator base class that's needed for configuring the - * NodeApplication process. - **/ - class NODEAPP_Configurator_Export NodeApp_Configurator - { - public: - - /// Default constructor. - NodeApp_Configurator (void); - - /// Default destructor. - virtual ~NodeApp_Configurator (void); - - /** - * @brief "pre_orb_initialize" is called before ORB_init. - */ - virtual int pre_orb_initialize (void); - - /** - * @brief "post_orb_initialize" is called after NodeApplication - * get a hold at this object. - */ - virtual int post_orb_initialize (CORBA::ORB_ptr o); - - /** - * @brief "init_resource_manager" is called by NodeApplication when - * it receives an "install" commands. - */ - virtual int - init_resource_manager (const ::Deployment::Properties &properties); - - /** - * @brief get a policyset by its name. - */ - virtual CORBA::PolicyList * - find_container_policies (const ::Deployment::Properties &properties); - - /// @@ Perhaps we also need a finalizer method here. Perhaps we - /// even need to differentiate finalizer before ORB is destroyed - /// and the one after that. - - void set_rt_support (void); - - int create_config_managers (void); - - bool policy_exists (const char *policy_set_id); - - CORBA::PolicyList * - find_policies_by_name (const char *name); - - protected: - - int rt_support_; - - CORBA::ORB_var orb_; - - auto_ptr<Config_Manager> rt_config_manager_; - - auto_ptr<Config_Manager> na_config_manager_; - - ACE_DLL config_dll_; - }; -} - -/** - * For dynamically linkable concrete NodeApp_Configurator - * implementation, remember to create a factory method using "C" - * calling convention in the CPP file as follow: - - extern "C" EXPORT_MACRO CIAO::NodeApp_Configurator *create_nodeapp_configurator (void); - - CIAO::NodeApp_Configurator * - create_nodeapp_configurator (void) - { - concrete_NodeApp_Configurator *config; - ACE_NEW_RETURN (config, concrete_NodeApp_Configurator, 0); - return config; - } - - */ - - -#include /**/ "ace/post.h" -#endif /* NODEAPP_CONFIGURATOR_H */ - diff --git a/CIAO/DAnCE/NodeApplication/NodeApp_Configurator_Export.h b/CIAO/DAnCE/NodeApplication/NodeApp_Configurator_Export.h deleted file mode 100644 index 80bbc03531d..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApp_Configurator_Export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NODEAPP_Configurator -// ------------------------------ -#ifndef NODEAPP_CONFIGURATOR_EXPORT_H -#define NODEAPP_CONFIGURATOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPP_CONFIGURATOR_HAS_DLL) -# define NODEAPP_CONFIGURATOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEAPP_CONFIGURATOR_HAS_DLL */ - -#if !defined (NODEAPP_CONFIGURATOR_HAS_DLL) -# define NODEAPP_CONFIGURATOR_HAS_DLL 1 -#endif /* ! NODEAPP_CONFIGURATOR_HAS_DLL */ - -#if defined (NODEAPP_CONFIGURATOR_HAS_DLL) && (NODEAPP_CONFIGURATOR_HAS_DLL == 1) -# if defined (NODEAPP_CONFIGURATOR_BUILD_DLL) -# define NODEAPP_Configurator_Export ACE_Proper_Export_Flag -# define NODEAPP_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define NODEAPP_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* NODEAPP_CONFIGURATOR_BUILD_DLL */ -# define NODEAPP_Configurator_Export ACE_Proper_Import_Flag -# define NODEAPP_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define NODEAPP_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* NODEAPP_CONFIGURATOR_BUILD_DLL */ -#else /* NODEAPP_CONFIGURATOR_HAS_DLL == 1 */ -# define NODEAPP_Configurator_Export -# define NODEAPP_CONFIGURATOR_SINGLETON_DECLARATION(T) -# define NODEAPP_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* NODEAPP_CONFIGURATOR_HAS_DLL == 1 */ - -// Set NODEAPP_CONFIGURATOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (NODEAPP_CONFIGURATOR_NTRACE) -# if (ACE_NTRACE == 1) -# define NODEAPP_CONFIGURATOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define NODEAPP_CONFIGURATOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !NODEAPP_CONFIGURATOR_NTRACE */ - -#if (NODEAPP_CONFIGURATOR_NTRACE == 1) -# define NODEAPP_CONFIGURATOR_TRACE(X) -#else /* (NODEAPP_CONFIGURATOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define NODEAPP_CONFIGURATOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (NODEAPP_CONFIGURATOR_NTRACE == 1) */ - -#endif /* NODEAPP_CONFIGURATOR_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication.cpp b/CIAO/DAnCE/NodeApplication/NodeApplication.cpp deleted file mode 100644 index 8f26bcc2101..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApplication.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// $Id$ - -#include "NodeApplication_Core.h" -#include "ace/Sched_Params.h" -#include "ace/OS_NS_errno.h" -#include "ciao/CIAO_common.h" - -#include <orbsvcs/Event/EC_Default_Factory.h> - -void print_arg (int argc, ACE_TCHAR *argv[]) -{ - for (int i = 0; i < argc; ++i) - ACE_DEBUG ((LM_DEBUG, "NodeApplication ARGV[%d] = %s\n", i, argv [i])); -} - -int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) -{ - try - { - TAO_EC_Default_Factory::init_svcs (); - - ACE_DEBUG ((LM_DEBUG, "*** Starting NodeApplication\n")); - - CIAO::NodeApplication_Options nodeapp_options; - - if (CIAO::debug_level () > 9) - print_arg (argc, argv); - - if (nodeapp_options.parse_args (argc, argv) != 0) - return -1; - - CIAO::NodeApplication_Core nodeapp_core (nodeapp_options); - - if (nodeapp_core.startup (argc, argv) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to start up the NodeApplication_Core\n"), -1); - - // Run the main event loop for the ORB. - nodeapp_core.run_orb (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("NodeApp::main\t\n"); - return 1; - } - - if (CIAO::debug_level () > 1) - ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) - This NodeApplication is destroyed!\n")); - - return 0; -} diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication.mpc b/CIAO/DAnCE/NodeApplication/NodeApplication.mpc index 8fed7ebd998..9ebd5b13356 100644 --- a/CIAO/DAnCE/NodeApplication/NodeApplication.mpc +++ b/CIAO/DAnCE/NodeApplication/NodeApplication.mpc @@ -1,61 +1,29 @@ // -*- MPC -*- // $Id$ -project(Config_Manager) : ciao_deployment_stub, ace_output { - sharedname = CIAO_Config_Manager - dynamicflags = CONFIG_MANAGER_BUILD_DLL - Source_Files { - Config_Manager.cpp - } -} +project(NodeApplication): dance_lib, dynamicinterface, dance_component_server_svnt, \ + dance_deployment_stub, dance_deployment_svnt, dance_redirection_service, \ + dance_logger, iortable, naming, ccm_configvalue, ciao_cs_client, ccm_componentserver_svnt, \ + gen_ostream { + sharedname = DAnCE_NodeApplication + dynamicflags = NODEAPPLICATION_BUILD_DLL -project(NodeApp_Configurator): ciao_config_manager, ace_output { - sharedname = CIAO_NodeApp_Configurator - dynamicflags = NODEAPP_CONFIGURATOR_BUILD_DLL - Source_Files { - NodeApp_Configurator.cpp - } -} -project(NoOp_Configurator): ciao_nodeapp_configurator, ace_output { - sharedname = CIAO_NoOp_Configurator - dynamicflags = NOOP_CONFIGURATOR_BUILD_DLL - Source_Files { - NoOp_Configurator.cpp +Source_Files { +// ComponentInstallation_Impl.cpp +// ServerActivator_Impl.cpp + NodeApplication_Impl.cpp + ComponentAttributesSetter.cpp + Name_Utilities.cpp } -} - -project(RTNA_Configurator): negotiate_codesets, rtportableserver, rtcorba, ciao_nodeapp_configurator, ace_output { - sharedname = CIAO_RTNA_Configurator - dynamicflags = CIAO_RTNA_CONFIGURATOR_BUILD_DLL - Source_Files { - RTConfig_Manager.cpp + Header_Files { +// ComponentInstallation_Impl.h +// ServerActivator_Impl.h + NodeApplication_Impl.h + ComponentAttributesSetter.h + Name_Utilities.h } } -project(NA_Configurator): ciao_deployment_stub, diffservpolicy, ciao_nodeapp_configurator, ace_output { - sharedname = CIAO_NA_Configurator - dynamicflags = CIAO_NA_CONFIGURATOR_BUILD_DLL - Source_Files { - NAConfig_Manager.cpp - } -} - -project(NodeApplicationLib): ciao_server_dnc, ciao_events_dnc, ciao_nodeapp_configurator, ace_output { - sharedname = CIAO_NodeApplication - dynamicflags = NODEAPPLICATION_BUILD_DLL - Source_Files { - Configurator_Factory.cpp - Container_Impl.cpp - NodeApplication_Core.cpp - NodeApplication_Impl.cpp - } -} -project(NodeApplication): ciao_server_dnc, ciao_events_dnc, ciao_nodeapplication, ciaoexe { - exename = NodeApplication - Source_Files { - NodeApplication.cpp - } -} diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Core.cpp b/CIAO/DAnCE/NodeApplication/NodeApplication_Core.cpp deleted file mode 100644 index dc4da51e397..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Core.cpp +++ /dev/null @@ -1,253 +0,0 @@ -// $Id$ - -#include "DAnCE/Deployment/CIAO_NodeApplication_CallBackC.h" -#include "ace/Sched_Params.h" -#include "NodeApplication_Impl.h" -#include "NodeApplication_Core.h" -#include "ace/Null_Mutex.h" -#include "ciao/Server_init.h" -#include "ciao/CIAO_common.h" - -#if !defined (__ACE_INLINE__) -# include "NodeApplication_Core.inl" -#endif /* __ACE_INLINE__ */ - -const char * -sched_policy_name (int sched_policy) -{ - const char *name = 0; - - switch (sched_policy) - { - case ACE_SCHED_OTHER: - name = "SCHED_OTHER"; - break; - case ACE_SCHED_RR: - name = "SCHED_RR"; - break; - case ACE_SCHED_FIFO: - name = "SCHED_FIFO"; - break; - } - - return name; -} - - -/// The following check is taken from $(TAO_ROOT)/tests/RTCORBA/ -int -check_supported_priorities (CORBA::ORB_ptr orb) -{ - CIAO_TRACE ("NodeApplication_Core::check_supported_priorities"); - - int const sched_policy = - orb->orb_core ()->orb_params ()->ace_sched_policy (); - - // Check that we have sufficient priority range to run, - // i.e., more than 1 priority level. - int const max_priority = - ACE_Sched_Params::priority_max (sched_policy); - int const min_priority = - ACE_Sched_Params::priority_min (sched_policy); - - if (max_priority == min_priority) - { - ACE_DEBUG ((LM_DEBUG, - "Not enough priority levels with the %s scheduling policy\n" - "on this platform to run, terminating program....\n" - "Check svc.conf options\n", - sched_policy_name (sched_policy))); - - return -1; - } - return 0; -} - -int -CIAO::NodeApplication_Core::svc () -{ - CIAO_TRACE ("CIAO::NodeApplication_Core::svc"); - - try - { - CORBA::Object_var object = - this->orb_->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (object.in ()); - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (); - - poa_manager->activate (); - - // ... - CIAO::NodeApplication_Impl *nodeapp_servant = 0; - - ACE_NEW_RETURN (nodeapp_servant, - CIAO::NodeApplication_Impl (this->orb_.in (), - root_poa.in (), - *this->configurator_.get ()), - -1); - - PortableServer::ServantBase_var safe_servant (nodeapp_servant); - - // Configuring NodeApplication. - PortableServer::ObjectId_var nodeapp_oid - = root_poa->activate_object (nodeapp_servant); - - object = root_poa->id_to_reference (nodeapp_oid.in ()); - - Deployment::NodeApplication_var nodeapp_obj = - Deployment::NodeApplication::_narrow (object.in ()); - - if (CORBA::is_nil (nodeapp_obj.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to activate NodeApplication object\n"), - -1); - - /** @@ We need to call NodeApplication servant's init method. - * But it's not sure to me where exactly we can get the - * Properties needed by the init method at this moment. There are two - * ways to set the property of the NodeApplication: - * 1. call init remotely from NodeApplicationManager - * 2. call init locally on the servant of NodeApplication. - */ - bool retval = nodeapp_servant->init (); - - if (retval) - { - ACE_DEBUG ((LM_DEBUG, "NodeApplication Failed on creating and\ - initializing the session container!")); - return 1; - } - - CORBA::String_var str = this->orb_->object_to_string (nodeapp_obj.in ()); - - if (this->options_.write_ior_file ()) - CIAO::Utility::write_IOR (this->options_.ior_output_filename (), - str.in ()); - - // End Deployment part - if (CIAO::debug_level () > 10) - { - ACE_DEBUG ((LM_INFO, "NodeApplication IOR: %s\n", str.in ())); - - } - - Deployment::NodeApplicationManager_var nodeapp_man; - Deployment::Properties_var prop = new Deployment::Properties; - - if (this->options_.use_callback ()) - { - object = this->orb_->string_to_object (this->options_.callback_ior ()); - - CIAO::NodeApplication_Callback_var nam_callback - = CIAO::NodeApplication_Callback::_narrow (object.in ()); - - Deployment::Properties_out properties_out (prop.out ()); - - nodeapp_man - = nam_callback->register_node_application (nodeapp_obj.in (), - properties_out); - } - - ACE_DEBUG ((LM_DEBUG, - "Running NodeApplication...\n")); - - this->orb_->run (); - - root_poa->destroy (1, 1); - - this->orb_->destroy (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Exception caught"); - return -1; - } - - ACE_DEBUG ((LM_DEBUG, - "Exiting NodeApplication...\n")); - return 0; -} - -int -CIAO::NodeApplication_Core::startup (int argc, char *argv[]) -{ - CIAO_TRACE ("CIAO::NodeApplication_Core::startup"); - - // pre-init - this->configurator_.reset (this->options_.create_nodeapp_configurator ()); - - if (this->configurator_->create_config_managers ()) - return -1; - - if (this->configurator_->pre_orb_initialize ()) - return -1; - - // Initialize orb - this->orb_ = - CORBA::ORB_init (argc, argv); - CIAO::Server_init (this->orb_.in ()); - - return this->configurator_->post_orb_initialize (this->orb_.in ()); -} - -int -CIAO::NodeApplication_Core::run_orb () -{ - CIAO_TRACE ("CIAO::NodeApplication_Core::run_orb"); - - // check supported priority before running RT - if (this->options_.rt_support () && - check_supported_priorities (this->orb_.in ()) != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "ERROR: DISABLE RT SUPPORT\n"), -1); - // this->options_.rt_support_ = 0; - } - - if (this->options_.rt_support ()) // RT support reuqested - { - - - // spawn a thread - // Task activation flags. - long flags = - THR_NEW_LWP | - THR_JOINABLE | - this->orb_->orb_core ()->orb_params ()->thread_creation_flags (); - - // Activate task. - int result = - this->activate (flags); - if (result == -1) - { - if (errno == EPERM) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot create thread with scheduling policy %s\n" - "because the user does not have the appropriate privileges, terminating program....\n" - "Check svc.conf options and/or run as root\n", - sched_policy_name (this->orb_->orb_core ()->orb_params ()->ace_sched_policy ())), - 2); - } - else - return -1; - } - - ACE_DEBUG ((LM_DEBUG, "*** Running NodeApplication in RT mode\n")); - - // Wait for task to exit. - result = - this->wait (); - ACE_ASSERT (result != -1); - - ACE_DEBUG ((LM_INFO, "*** Ending NodeApplication\n")); - return 0; - - } - else - return this->svc (); -} - diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Core.h b/CIAO/DAnCE/NodeApplication/NodeApplication_Core.h deleted file mode 100644 index aceef49209c..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Core.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file NodeApplication_Core.h - * - * $Id$ - * - * An ACE_Task subclass that manages the NodeApplication runtime. We - * can run this class as a separate thread, as in the case of RT - * support, or as a event driven ORB. - * - * @author Nanbor Wang <nanbor@cs.wustl.edu> - */ -//============================================================================= - - -#ifndef CIAO_NODEAPPLICATION_CORE_H -#define CIAO_NODEAPPLICATION_CORE_H -#include /**/ "ace/pre.h" - -#include "CIAO_NodeApplication_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/ORB_Core.h" -#include "tao/ORB.h" -#include "ace/Task.h" -#include "ace/Auto_Ptr.h" -#include "Configurator_Factory.h" -#include "NoOp_Configurator.h" - -namespace CIAO -{ - /** - * @class NodeApplication_Core - * - * @brief An ACE_Task subclass that allow the ORB thread to be run - * as separate thread when RT behaviors are needed. - */ - class NODEAPPLICATION_Export NodeApplication_Core - : public virtual ACE_Task_Base - { - public: - NodeApplication_Core (NodeApplication_Options &opts); - - virtual int svc (void); - - int startup (int argc, char *argv[]); - - int run_orb (void); - - protected: - CORBA::ORB_var orb_; - - NodeApplication_Options &options_; - - auto_ptr<NodeApp_Configurator> configurator_; - }; - -} - -#if defined (__ACE_INLINE__) -# include "NodeApplication_Core.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* CIAO_NODEAPPLICAITON_CORE_H */ diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Core.inl b/CIAO/DAnCE/NodeApplication/NodeApplication_Core.inl deleted file mode 100644 index f1f1e82da0c..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Core.inl +++ /dev/null @@ -1,9 +0,0 @@ -// -*- C++ -*- -// $Id$ - -ACE_INLINE -CIAO::NodeApplication_Core::NodeApplication_Core (CIAO::NodeApplication_Options &opts) - : options_ (opts) -{ -} - diff --git a/CIAO/DAnCE/NodeApplication/CIAO_NodeApplication_export.h b/CIAO/DAnCE/NodeApplication/NodeApplication_Export.h index 3e4d638957e..bf2c6d7a5cb 100644 --- a/CIAO/DAnCE/NodeApplication/CIAO_NodeApplication_export.h +++ b/CIAO/DAnCE/NodeApplication/NodeApplication_Export.h @@ -2,7 +2,7 @@ // -*- C++ -*- // $Id$ // Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NODEAPPLICATION +// This file is generated automatically by generate_export_file.pl NodeApplication // ------------------------------ #ifndef NODEAPPLICATION_EXPORT_H #define NODEAPPLICATION_EXPORT_H @@ -19,16 +19,16 @@ #if defined (NODEAPPLICATION_HAS_DLL) && (NODEAPPLICATION_HAS_DLL == 1) # if defined (NODEAPPLICATION_BUILD_DLL) -# define NODEAPPLICATION_Export ACE_Proper_Export_Flag +# define NodeApplication_Export ACE_Proper_Export_Flag # define NODEAPPLICATION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define NODEAPPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* NODEAPPLICATION_BUILD_DLL */ -# define NODEAPPLICATION_Export ACE_Proper_Import_Flag +# define NodeApplication_Export ACE_Proper_Import_Flag # define NODEAPPLICATION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define NODEAPPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* NODEAPPLICATION_BUILD_DLL */ #else /* NODEAPPLICATION_HAS_DLL == 1 */ -# define NODEAPPLICATION_Export +# define NodeApplication_Export # define NODEAPPLICATION_SINGLETON_DECLARATION(T) # define NODEAPPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* NODEAPPLICATION_HAS_DLL == 1 */ diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp index 39c773bbee3..b5250b701b0 100644 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp +++ b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp @@ -1,1207 +1,2131 @@ // $Id$ - #include "NodeApplication_Impl.h" -#include "ace/SString.h" -#include "Container_Impl.h" -#include "DAnCE/Deployment/Deployment_EventsC.h" -#include "ciaosvcs/Events/CIAO_RTEC/CIAO_RTEventC.h" - -#if !defined (__ACE_INLINE__) -# include "NodeApplication_Impl.inl" -#endif /* __ACE_INLINE__ */ -CIAO::NodeApplication_Impl::~NodeApplication_Impl (void) +#include "ace/OS_Memory.h" +#include "ace/Log_Msg.h" +#include "ace/streams.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/Object.h" +#include "tao/ORB.h" +#include "ccm/CCM_ObjectC.h" +#include "ccm/CCM_SessionComponentC.h" +#include "ciao/Valuetype_Factories/ConfigValue.h" +#include "ciao/ComponentServer/CIAO_ServerActivator_Impl.h" +#include "ciao/ComponentServer/CIAO_PropertiesC.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "Deployment/Deployment_BaseC.h" +#include "Deployment/Deployment_ApplicationC.h" +#include "Deployment/Deployment_common.h" +#include "Deployment/DAnCE_PropertiesC.h" +#include "ComponentAttributesSetter.h" +#include "Name_Utilities.h" + +//#include "ComponentInstallation_Impl.h" + +#ifdef GEN_OSTREAM_OPS +#include <iostream> +#include <sstream> +#endif /* GEN_OSTREAM_OPS */ + +using namespace DAnCE; + +namespace { -} + template<class T> + bool get_property_value (const char *name, PROPERTY_MAP &properties, T &val) + { + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<T>"); + CORBA::Any any; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Finding property value for name '%C'\n", + name)); -CORBA::Long -CIAO::NodeApplication_Impl::init () -{ - /// @todo initialize this NodeApplication properties - return 0; -} - -CORBA::Long -CIAO::NodeApplication_Impl::create_all_containers ( - const ::Deployment::ContainerImplementationInfos & container_infos - ) -{ - // Create all the containers here based on the input node_impl_info. - CORBA::ULong const len = container_infos.length (); + if (properties.find (name, any) == 0) + { + if (any >>= val) + { + return true; + } + else + { + DANCE_ERROR ((LM_WARNING, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Failed to extract property value for %C\n", name)); + return false; + } + } - for (CORBA::ULong i = 0; i < len; ++i) - { - // The factory method <create_container> will intialize the container - // servant with properties, so we don't need to call <init> on the - // container object reference. - // Also, the factory method will add the container object reference - // to the set for us. - ::Deployment::Container_var cref = - this->create_container (container_infos[i].container_config); - - // Build the Component_Container_Map - for (CORBA::ULong j = 0; - j < container_infos[i].impl_infos.length (); - ++j) - { - this->component_container_map_.bind ( - container_infos[i].impl_infos[j].component_instance_name.in (), - ::Deployment::Container::_duplicate (cref.in ())); - } - } + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Property value for name '%C' has no value\n", name)); - return 0; -} + return false; + } -void -CIAO::NodeApplication_Impl::finishLaunch ( - const Deployment::Connections & providedReference, - CORBA::Boolean start, - CORBA::Boolean add_connection) -{ - ACE_UNUSED_ARG (start); + template<> + bool get_property_value (const char *name, PROPERTY_MAP &properties, bool &val) + { + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<bool>"); + CORBA::Any any; - // If parameter "add_connection" is true, then it means we want to "add" - // new connections, other, we remove existing connections - this->finishLaunch_i (providedReference, start, add_connection); -} + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Finding property value for name '%C'\n", + name)); -void -CIAO::NodeApplication_Impl::finishLaunch_i ( - const Deployment::Connections & connections, - CORBA::Boolean start, - CORBA::Boolean add_connection) -{ - ACE_UNUSED_ARG (start); + if (properties.find (name, any) == 0) + { + if (any >>= CORBA::Any::to_boolean(val)) + { + return true; + } + else + { + DANCE_ERROR ((LM_WARNING, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Failed to extract property value for %C\n", name)); + return false; + } + } - try - { - CORBA::ULong const length = connections.length (); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Property value for name '%C' has no value\n", name)); - // For every connection struct we finish the connection. - for (CORBA::ULong i = 0; i < length; ++i) - { - ACE_CString name = connections[i].instanceName.in (); + return false; + } - // For ES_to_Consumer connection, we simply call - // handle_es_consumer_connection method. - //if (connections[i].kind == Deployment::rtecEventConsumer) - if (this->_is_es_consumer_conn (connections[i])) - { - this->handle_es_consumer_connection ( - connections[i], - add_connection); - continue; - } + template<> + bool get_property_value (const char *name, PROPERTY_MAP &properties, const char * &val) + { + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<const char *>"); + CORBA::Any any; - // For other type of connections, we need to fetch the - // objref of the source component - Component_State_Info comp_state; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Finding property value for name '%C'\n", + name)); - if (this->component_state_map_.find (name, comp_state) != 0) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "invalid port name [%s] in instance [%s] \n", - connections[i].portName.in (), - name.c_str ())); - throw Deployment::InvalidConnection (); - } + if (properties.find (name, any) == 0) + { + if (any >>= CORBA::Any::to_string(val, 0)) + { + return true; + } + else + { + DANCE_ERROR ((LM_WARNING, DLINFO "NodeApplicion::<anonymous>::get_property_value<const char *> - " + "Failed to extract property value for %C\n", name)); + return false; + } + } - Components::EventConsumerBase_var consumer; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Property value for name '%C' has no value\n", name)); - Components::CCMObject_var comp = comp_state.objref_; + return false; + } - if (CORBA::is_nil (comp.in ())) - { - ACE_DEBUG ((LM_DEBUG, "comp is nil\n")); - throw Deployment::InvalidConnection (); - } + template<class T> + bool get_property_value (const char *name, const Deployment::Properties &properties, T &val) + { + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<T>"); - switch (connections[i].kind) - { - case Deployment::SimplexReceptacle: - case Deployment::MultiplexReceptacle: - this->handle_facet_receptable_connection ( - comp.in (), - connections[i], - add_connection); - break; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Finding property value for name '%C'\n", + name)); - case Deployment::EventEmitter: - this->handle_emitter_consumer_connection ( - comp.in (), - connections[i], - add_connection); - break; + for (CORBA::ULong i = 0; i < properties.length (); ++i) + { + if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Found property '%C'\n", name)); + if (properties[i].value >>= val) + return true; + else + { + DANCE_ERROR ((LM_WARNING, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Failed to extract property value for %C\n", name)); + return false; + } + } + } - case Deployment::EventPublisher: - if (this->_is_publisher_es_conn (connections[i])) - this->handle_publisher_es_connection ( - comp.in (), - connections[i], - add_connection); - else - this->handle_publisher_consumer_connection ( - comp.in (), - connections[i], - add_connection); - break; - default: - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch_i: " - "Unsupported event port type encounted\n")); - throw CORBA::NO_IMPLEMENT (); - } - } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("NodeApplication_Impl::finishLaunch\t\n"); - throw; - } + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Property value for name '%C' has no value\n", name)); -} + return false; + } -void -CIAO::NodeApplication_Impl::ciao_preactivate () -{ - Component_Iterator end = this->component_state_map_.end (); - for (Component_Iterator iter (this->component_state_map_.begin ()); - iter != end; - ++iter) + template<> + bool get_property_value (const char *name, const Deployment::Properties &properties, const char * &val) { - if (((*iter).int_id_).state_ == NEW_BORN) - { - ((*iter).int_id_).objref_->ciao_preactivate (); - } + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<const char *>"); - ((*iter).int_id_).state_ = PRE_ACTIVE; - } -} + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Finding property value for name '%C'\n", + name)); -void -CIAO::NodeApplication_Impl::start () -{ - Component_Iterator end = this->component_state_map_.end (); - for (Component_Iterator iter (this->component_state_map_.begin ()); - iter != end; - ++iter) - { - if (((*iter).int_id_).state_ == PRE_ACTIVE) + for (CORBA::ULong i = 0; i < properties.length (); ++i) { - ((*iter).int_id_).objref_->ciao_activate (); + if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Found property '%C'\n", name)); + if (properties[i].value >>= CORBA::Any::to_string (val, 0)) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Value is %C\n", val)); + return true; + } + else + { + DANCE_ERROR ((LM_WARNING, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Failed to extract property value for %C\n", name)); + return false; + } + } } - ((*iter).int_id_).state_ = ACTIVE; + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Unable to find property named %C\n", name)); + + return false; } -} -void -CIAO::NodeApplication_Impl::ciao_postactivate () -{ - Component_Iterator end = this->component_state_map_.end (); - for (Component_Iterator iter (this->component_state_map_.begin ()); - iter != end; - ++iter) + /// Tests flag, if false, sets it to true and replaces the name and + /// reason flags of the exception. + template <typename EXCEPTION> + void test_and_set_exception (bool &flag, EXCEPTION &exception, + const char *name, const char *reason) { - if (((*iter).int_id_).state_ == ACTIVE) + if (!flag) { - ((*iter).int_id_).objref_->ciao_postactivate (); - - ((*iter).int_id_).state_ = POST_ACTIVE; + flag = true; + exception.name = name; + exception.reason = reason; } } } -void -CIAO::NodeApplication_Impl::ciao_passivate () -{ - Component_Iterator end = this->component_state_map_.end (); - for (Component_Iterator iter (this->component_state_map_.begin ()); - iter != end; - ++iter) - { - ((*iter).int_id_).objref_->ciao_passivate (); - ((*iter).int_id_).state_ = PASSIVE; - } - ACE_DEBUG ((LM_DEBUG, "exiting passivate\n")); +NodeApplication_Impl::NodeApplication_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const Deployment::DeploymentPlan& plan, + RedirectionService & redirection, + const ACE_CString& node_name, + const PROPERTY_MAP &properties) + : orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)), + plan_ (plan), + redirection_ (redirection), + node_name_ (node_name), + properties_ (), + instances_ (plan.instance.length ()) +{ + DANCE_TRACE ("NodeApplication_Impl::NodeApplication_Impl"); + PROPERTY_MAP::const_iterator i = properties.begin (); + while (!i.done ()) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::NodeApplication_Impl - " + "Binding value for property '%C'\n", i->key ().c_str ())); + this->properties_.bind (i->key (), i->item ()); + i.advance (); + } + this->init (); } -Deployment::ComponentInfos * -CIAO::NodeApplication_Impl::install ( - const ::Deployment::NodeImplementationInfo & node_impl_info) +NodeApplication_Impl::~NodeApplication_Impl() { - Deployment::ComponentInfos_var retv; - try - { - // Extract ORB resource def here. - this->configurator_.init_resource_manager (node_impl_info.nodeapp_config); + DANCE_TRACE( "NodeApplication_Impl::~NodeApplication_Impl()"); - const ::Deployment::ContainerImplementationInfos container_infos = - node_impl_info.impl_infos; + using namespace Components; + ConfigValues config_values; + config_values.length (1L); + CORBA::Any feature_any; - ACE_NEW_THROW_EX (retv, - Deployment::ComponentInfos, - CORBA::NO_MEMORY ()); + for (size_t i = 0; + i != this->servers_.size (); + ++i) + { + /* TODO: This is highly suspect. I believe we should be using get_component_server, + not calling create_container. */ + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Deactivating %u ComponentServers\n", + this->servers_.size ())); + for (size_t i = 0; i < this->servers_.size (); ++i) + { + ComponentServer &server = this->servers_[i]; - retv->length (0UL); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "In ComponentServer %u, deactivating %u containers\n", i, server.containers.size ())); + for (size_t j = 0; j < server.containers.size (); ++j) + { + Container &container = server.containers[j]; + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "In container %u hosted in server %u\n", j, i)); + + try + { + server.ref->remove_container (container.ref.in ()); + container.ref = CIAO::Deployment::Container::_nil (); + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Caught CORBA exception while removing container %u on server %u: %C\n", + j, i, ex._info ().c_str ())); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Caught unknown C++ exception while removing container %u on server %u.\n", + j, i)); + } + } - // Call create_all_containers to create all the necessary containers.. - // @@(GD): The "create_all_containers" mechanism needs to be refined, so - // we should always try to reuse existing containers as much as possible! - // We need not only factory pattern, but also finder pattern here as well. - if (CIAO::debug_level () > 15) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) NodeApplication_Impl.cpp -" - "CIAO::NodeApplication_Impl::install -" - "creating all the containers. \n")); - } + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Removing component server %u\n", i)); - CORBA::ULong old_set_size = this->container_set_.size (); + try + { + this->activator_->remove_component_server (server.ref.in ()); + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Caught CORBA exception while removing server %u: %C\n", + i, ex._info ().c_str ())); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Caught unknown C++ exception while removing server %u.\n", + i)); + } - (void) this->create_all_containers (container_infos); - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) NodeApplication_Impl.cpp -" - "CIAO::NodeApplication_Impl::install -" - "create_all_containers() called.\n")); + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Successfully removed container %u on node %C.\n", + i, this->node_name_.c_str ())); } + } +} - // For each container, invoke <install> operation, this will return - // the ComponentInfo for components installed in each container. - // Merge all the returned ComponentInfo, which will be used - // as the return value of this method. - CORBA::ULong const num_containers = container_infos.length (); - for (CORBA::ULong i = 0; i < num_containers; ++i) - { - Deployment::ComponentInfos_var comp_infos = - this->container_set_.at(i+old_set_size)-> - install (container_infos[i]); +void +NodeApplication_Impl::init() +{ + DANCE_TRACE( "NodeApplication_Impl::init()"); + + /* TODO: Lets move this stuff to the constructor, shall we?!? */ + /* TODO: Might be nice to use a component configurator here to load the proper versions + of the serveractivator. */ + + /* ServerActivator configuration */ + CORBA::ULong spawn = 0; + const char *cs_path = 0; + const char *cs_args = 0; + CORBA::Boolean multithread = false; + + get_property_value (CIAO::Deployment::SERVER_EXECUTABLE, this->properties_, cs_path); + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::init - " + "Component server path: %C\n", cs_path)); + get_property_value (CIAO::Deployment::SERVER_ARGUMENTS, this->properties_, cs_args); + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::init - " + "Component server arguments: %C\n", cs_args)); + get_property_value (CIAO::Deployment::SERVER_TIMEOUT, this->properties_, spawn); + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::init - " + "Spawn delay: %u\n", spawn)); + get_property_value (CIAO::Deployment::SERVER_MULTITHREAD, this->properties_, multithread); + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::init - " + "Threading: %C\n", multithread ? "Multi" : "Single")); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::init - " + "Spawning server activator\n")); + + CIAO::Deployment::CIAO_ServerActivator_i *tmp_act; + ACE_NEW_THROW_EX (tmp_act, + CIAO::Deployment::CIAO_ServerActivator_i (spawn, + cs_path, + cs_args, + multithread, + this->orb_.in(), + this->poa_.in()), + CORBA::NO_MEMORY ()); - // Append the return sequence to the *big* return sequence - CORBA::ULong curr_len = retv->length (); - retv->length (curr_len + comp_infos->length ()); + this->activator_.reset (tmp_act); - for (CORBA::ULong j = curr_len; j < retv->length (); j++) - retv[j] = comp_infos[j-curr_len]; - } + PortableServer::ObjectId_var sa_id = + this->poa_->activate_object (this->activator_.get ()); - // @@ Maybe we can optimize this. We can come up with a decision later. - // Cache a copy of the component object references for all the components - // installed on this NodeApplication. I know we can delegates these to the - // undelying containers, but in that case, we should loop - // all the containers to find the component object reference. - Gan - CORBA::ULong const comp_len = retv->length (); - for (CORBA::ULong len = 0; - len < comp_len; - ++len) - { - Component_State_Info tmp; + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplication_impl::init - ServerActivator object created\n")); - tmp.state_ = NEW_BORN; - tmp.objref_ = - Components::CCMObject::_duplicate (retv[len].component_ref.in ()); + const ACE_TCHAR *ior; - //Since we know the type ahead of time...narrow is omitted here. - if (this->component_state_map_.rebind ( - retv[len].component_instance_name.in(), tmp)) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) NodeApplication_Impl.cpp -" - "CIAO::NodeApplication_Impl::install -" - "error binding component instance [%s] " - "into the map. \n", - retv[len].component_instance_name.in ())); - throw Deployment::InstallationFailure ( - "NodeApplication_Imp::install", - "Duplicate component instance name"); - } - } - } - catch (const CORBA::Exception& ex) + if (get_property_value (DAnCE::INSTANCE_NC, this->properties_, ior) || + get_property_value (DAnCE::DOMAIN_NC, this->properties_, ior)) { - ex._tao_print_exception ("CIAO_NodeApplication::install error\t\n"); - throw; + try + { + CORBA::Object_var obj = this->orb_->string_to_object (ior); + this->instance_nc_ = CosNaming::NamingContext::_narrow (obj); + } + catch (const CORBA::Exception &e) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_impl::init - " + "Unable to resolve the instance naming context:%C\n", + e._info ().c_str ())); + } + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_impl::init - " + "Successfully resolved the instance naming context.\n")); } - - return retv._retn (); + else DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_impl::init - " + "No instance NC was provided\n")); } void -CIAO::NodeApplication_Impl::remove_component (const char * inst_name) +NodeApplication_Impl::configuration_complete_components () { - ACE_DEBUG ((LM_DEBUG, "NA_I: removing component %s\n", - inst_name)); - - // Fetch the container object reference from the componet_container_map - ::Deployment::Container_var container_ref; - if (this->component_container_map_.find (inst_name, container_ref) != 0) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::remove_component, " - "invalid instance [%s] in the component_container_map.\n", - inst_name)); - throw ::Components::RemoveFailure (); - } - - // Remove this component instance from the node application - ACE_CString name (inst_name); - this->component_container_map_.unbind (name); - this->component_state_map_.unbind (name); - container_ref->remove_component (inst_name); -} + DANCE_TRACE( "NodeApplication_Impl::configuration_complete_components"); -void -CIAO::NodeApplication_Impl::passivate_component (const char * name) -{ - Component_State_Info comp_state; + bool error (false); + Deployment::StartError exception; - if (this->component_state_map_.find (name, comp_state) != 0) + for (size_t k = 0; k < this->instances_.size (); ++k) { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::passivate_component, " - "invalid instance [%s] \n", - name)); - throw Components::RemoveFailure (); - } + if (this->instances_[k]->type == eHome) + { + continue; + } - if (CORBA::is_nil (comp_state.objref_.in ())) - { - ACE_DEBUG ((LM_DEBUG, "comp is nil\n")); - throw Components::RemoveFailure (); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::configuration_complete_components - " + "Invoking configuration_complete on component instance %C on node %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + this->node_name_.c_str ())); + + try + { + Components::CCMObject_var ccmobj = + Components::CCMObject::_narrow (this->instances_[k]->ref.in ()); + if (CORBA::is_nil (this->instances_[k]->ref)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::configuration_complete_components - " + "Failed to narrow object reference for component instance %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + continue; + } + + if (this->instances_[k]->state == eInstalled) + { + ccmobj->configuration_complete (); + this->instances_[k]->state = eConfigured; + } + else + { + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = "Attempting to activate component that has already passed the configure stage.\n"; + continue; + } + } + + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::configuration_complete_components - " + "Component %C successfully configured.\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::configuration_complete_components - " + "Caught CORBA exception from ccm_activate on component %C: %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + ex._info ().c_str ())); + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = ex._info ().c_str (); + } + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::configuration_complete_components - " + "Caught unknown C++ exception from ccm_activate on component %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = "Unknown C++ exception"; + } + } } - comp_state.objref_->ciao_passivate (); + if (error) + throw exception; } void -CIAO::NodeApplication_Impl::activate_component (const char * name) +NodeApplication_Impl::start () { - Component_State_Info comp_state; + DANCE_TRACE( "NodeApplication_Impl::start"); - if (this->component_state_map_.find (name, comp_state) != 0) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::activate_component, " - "invalid instance [%s] \n", - name)); - throw Deployment::StartError (); - } + bool error (false); + Deployment::StartError exception; - if (CORBA::is_nil (comp_state.objref_.in ())) + for (size_t k = 0; k < this->instances_.size (); ++k) { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "comp is nil\n")); - throw Deployment::StartError (); - } + if (this->instances_[k]->type == eHome) + { + continue; + } - comp_state.objref_->ciao_preactivate (); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::start - " + "Invoking start on component instance %C on node %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + this->node_name_.c_str ())); - comp_state.objref_->ciao_activate (); + try + { + CIAO::Deployment::Container_var cont = + CIAO::Deployment::Container::_narrow (this->instances_[k]->container->ref.in()); - comp_state.objref_->ciao_postactivate (); -} + if (CORBA::is_nil (this->instances_[k]->container->ref.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::start - " + "Failed to narrow object reference for container managing " + "component instance %C to a CIAO container reference\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + test_and_set_exception (error, exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Failed to narrow managing container to CIAO container type"); + continue; + } + + if (this->instances_[k]->state == eConfigured || + this->instances_[k]->state == ePassive) + { + Components::CCMObject_var comp (Components::CCMObject::_narrow (this->instances_[k]->ref)); + cont->activate_component (comp.in ()); + this->instances_[k]->state = eActive; + } + else + { + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = "Attempting to activate component that is not configured or passive.\n"; + } + } + + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::start - " + "Component %C successfully activated.\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::start - " + "Caught CORBA exception from ccm_activate on component %C: %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + ex._info ().c_str ())); + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = ex._info ().c_str (); + } + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::start - " + "Caught unknown C++ exception from ccm_activate on component %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = "Unknown C++ exception"; + } + } + } + if (error) + throw exception; +} void -CIAO::NodeApplication_Impl::remove () +NodeApplication_Impl::install_home (Container &cont, Instance &inst) { - // If we still have components installed, then do nothing + DANCE_TRACE( "NodeApplication_Impl::install_home"); - if (this->component_state_map_.current_size () != 0) - return; + const ::Deployment::MonolithicDeploymentDescription &mdd = this->plan_.implementation[inst.mdd_idx]; + const ::Deployment::InstanceDeploymentDescription &idd = this->plan_.instance[inst.idd_idx]; - // For each container, invoke <remove> operation to remove home and components. - CORBA::ULong const set_size = this->container_set_.size (); - for (CORBA::ULong i = 0; i < set_size; ++i) - { - if (CIAO::debug_level () > 5) - { - ACE_DEBUG ((LM_DEBUG, "NA: calling remove on container %i\n")); - } + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_home - " + "Starting installation of home %C on node %C\n", + idd.name.in (), idd.node.in ())); - this->container_set_.at(i)->remove (); - } + this->instances_[inst.idd_idx] = &inst; + + // need to get significant property values + const char *entrypt = 0; + get_property_value (DAnCE::HOME_FACTORY, mdd.execParameter, entrypt); - // Remove all containers - // Maybe we should also deactivate container object reference. - if (CIAO::debug_level () > 5) + if (entrypt == 0) { - ACE_DEBUG ((LM_DEBUG, "NA: remove all\n")); + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_home - " + "Unable to find home factory property on home %C\n", + idd.name.in ())); + throw ::Deployment::InvalidComponentExecParameter (mdd.name.in (), + "No 'home factory' property present on MDD\n"); } - this->container_set_.remove_all (); + // @@TODO: Perhaps need better way to do this. + Components::ConfigValues config; + config.length (mdd.execParameter.length () + idd.configProperty.length ()); + CORBA::ULong pos (0); - if (CIAO::debug_level () > 1) + for (CORBA::ULong i = 0; i < mdd.execParameter.length (); ++i) { - ACE_DEBUG ((LM_DEBUG, "Removed all containers from this NodeApplication!\n")); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_home - " + "Inserting value for execParameter %C\n", mdd.execParameter[i].name.in ())); + config[pos++] = new CIAO::ConfigValue_impl (mdd.execParameter[i].name.in (), + mdd.execParameter[i].value); } - // For static deployment, ORB will be shutdown in the Static_NodeManager - if (this->static_entrypts_maps_ == 0) + for (CORBA::ULong i = 0; i < idd.configProperty.length (); ++i) { - this->orb_->shutdown (0); - ACE_DEBUG ((LM_DEBUG, "NA: shutdown\n")); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_home - " + "Inserting value for configProperty %C\n", idd.configProperty[i].name.in ())); + config[pos++] = new CIAO::ConfigValue_impl (idd.configProperty[i].name.in (), + idd.configProperty[i].value); } -} + try + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_home - " + "Calling install_home on container. Home id '%C', entrypt '%C', " + "length of config values is %u\n", + idd.name.in (), entrypt, config.length ())); -// Create a container interface, which will be hosted in this NodeApplication. -::Deployment::Container_ptr -CIAO::NodeApplication_Impl::create_container ( - const ::Deployment::Properties &properties) -{ - //if (CIAO::debug_level () > 1) - // ACE_DEBUG ((LM_DEBUG, "ENTERING: NodeApplication_Impl::create_container()\n")); + ::Components::CCMHome_var home = cont.ref->install_home (idd.name.in (), + entrypt, + config); - CORBA::PolicyList_var policies - = this->configurator_.find_container_policies (properties); + if (CORBA::is_nil (home)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_home - " + "Got nil object reference from container while installing home %C on node %C," + "throwing PlanError\n", + idd.name.in (), idd.node.in ())); + throw ::Deployment::PlanError (idd.name.in (), + "Nil object reference returned from conainer"); + } - CIAO::Container_Impl *container_servant = 0; + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::install_home - " + "Home '%C' on node '%C' successfully installed\n", + idd.name.in (), idd.node.in ())); - ACE_NEW_THROW_EX (container_servant, - CIAO::Container_Impl (this->orb_.in (), - this->poa_.in (), - this->get_objref (), - this->configurator_, - this->static_entrypts_maps_), - CORBA::NO_MEMORY ()); + inst.ref = CORBA::Object::_narrow (home); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_home - " + "Populating attributes for home %C\n", + idd.name.in ())); - PortableServer::ServantBase_var safe_servant (container_servant); - // @TODO: Need to decide a "component_installation" equivalent data - // structure to pass to the container, which will be used to - // suggest how to install the components. Each such data stucture - // should be correspond to one <process_collocation> tag in the XML - // file to describe the deployment plan. - container_servant->init (policies.ptr ()); + ComponentAttributesSetter::SetComponentAttributes (idd.name.in (), + inst.ref.in (), + idd.configProperty, + this->orb_.in ()); + + inst.state = eInstalled; + } + catch (const Components::InvalidConfiguration &) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_home - " + "Error creating home %C on node %C, caught InvalidConfiguration. Throwing exception\n", + idd.name.in (), idd.node.in ())); + throw ::Deployment::InvalidProperty (idd.name.in (), + "Invalid configuration exception from container"); + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_home - " + "Caught CORBA exception while installing home %C: %C\n", + idd.name.in (), + ex._info ().c_str ())); + throw ::Deployment::StartError (idd.name.in (), + ex._info ().c_str ()); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_home - " + "Caught unknown C++ exception while installing home %C\n", + idd.name.in ())); + throw ::Deployment::StartError (idd.name.in (), + "Unknown C++ exception"); + } +} - PortableServer::ObjectId_var oid - = this->poa_->activate_object (container_servant); +void +NodeApplication_Impl::install_component (Container &cont, Instance &inst) +{ + DANCE_TRACE( "NodeApplication_Impl::install_component"); + + const ::Deployment::MonolithicDeploymentDescription &mdd = this->plan_.implementation[inst.mdd_idx]; + const ::Deployment::InstanceDeploymentDescription &idd = this->plan_.instance[inst.idd_idx]; + + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_home - " + "Starting installation of home %C on node %C\n", + idd.name.in (), idd.node.in ())); + + this->instances_[inst.idd_idx] = &inst; + + const char *entrypt = 0; + get_property_value (DAnCE::COMPONENT_FACTORY, mdd.execParameter, entrypt); + + if (entrypt == 0) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - " + "Unable to find component factory property on component %C\n", + idd.name.in ())); + throw ::Deployment::InvalidComponentExecParameter (mdd.name.in (), + "No 'component factory' property present on MDD\n"); + } + + // @@TODO: Perhaps need better way to do this. + Components::ConfigValues config; + config.length (mdd.execParameter.length () + idd.configProperty.length ()); + CORBA::ULong pos (0); + + for (CORBA::ULong i = 0; i < mdd.execParameter.length (); ++i) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_component - " + "Inserting value for execParameter %C\n", mdd.execParameter[i].name.in ())); + config[pos++] = new CIAO::ConfigValue_impl (mdd.execParameter[i].name.in (), + mdd.execParameter[i].value); + } - CORBA::Object_var obj - = this->poa_->id_to_reference (oid.in ()); + for (CORBA::ULong i = 0; i < idd.configProperty.length (); ++i) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_component - " + "Inserting value for configProperty %C\n", idd.configProperty[i].name.in ())); + config[pos++] = new CIAO::ConfigValue_impl (idd.configProperty[i].name.in (), + idd.configProperty[i].value); + } + + ::CIAO::Deployment::Container_var ciao_cont = ::CIAO::Deployment::Container::_narrow (cont.ref.in ()); - ::Deployment::Container_var ci - = ::Deployment::Container::_narrow (obj.in ()); + if (CORBA::is_nil (ciao_cont.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - " + "Unable to narrow container assigned for component instance %C to one that supports " + "un-homed components.\n")); + throw ::Deployment::PlanError (idd.name.in (), + "Hosting container does not support unhomed components.\n"); + } + + try + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_component - " + "Calling install_component on container. Component id '%C', entrypt '%C', " + "length of config values is %u\n", + idd.name.in (), entrypt, config.length ())); + + ::Components::CCMObject_var comp = ciao_cont->install_component (idd.name.in (), + entrypt, + config); + + if (CORBA::is_nil (comp)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - " + "Got nil object reference from container while installing component %C on node %C," + "throwing PlanError\n", + idd.name.in (), idd.node.in ())); + throw ::Deployment::PlanError (idd.name.in (), + "Nil object reference returned from install_component on conainer"); + } - // Cached the objref in its servant. - container_servant->set_objref (ci.in ()); + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::install_component - " + "Component '%C' on node '%C' successfully installed\n", + idd.name.in (), idd.node.in ())); + + inst.ref = CORBA::Object::_narrow (comp); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_component - " + "Populating attributes for home %C\n", + idd.name.in ())); - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - this->container_set_.add (ci.in ()); - } + ComponentAttributesSetter::SetComponentAttributes (idd.name.in (), + inst.ref.in (), + idd.configProperty, + this->orb_.in ()); - //if (CIAO::debug_level () > 1) - // ACE_DEBUG ((LM_DEBUG, - // "LEAVING: NodeApplication_Impl::create_container()\n")); - return ci._retn (); + inst.state = eInstalled; + } + catch (const Components::InvalidConfiguration &) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - " + "Error creating component %C on node %C, caught InvalidConfiguration. Throwing exception\n", + idd.name.in (), idd.node.in ())); + throw ::Deployment::InvalidProperty (idd.name.in (), + "Invalid configuration exception from container"); + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - " + "Caught CORBA exception while installing component %C: %C\n", + idd.name.in (), + ex._info ().c_str ())); + throw ::Deployment::StartError (idd.name.in (), + ex._info ().c_str ()); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - " + "Caught unknown C++ exception while installing component %C\n", + idd.name.in ())); + throw ::Deployment::StartError (idd.name.in (), + "Unknown C++ exception"); + } } -// Remove a container interface. void -CIAO::NodeApplication_Impl::remove_container (::Deployment::Container_ptr cref) +NodeApplication_Impl::install_homed_component (Container &cont, Instance &inst) { - ACE_DEBUG ((LM_DEBUG, "ENTERING: NodeApplication_Impl::remove_container()\n")); - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); + DANCE_TRACE("NodeApplication_Impl::install_homed_component (unsigned int index)"); + + //const ::Deployment::MonolithicDeploymentDescription &mdd = this->plan_.implementation[inst.mdd_idx]; + const ::Deployment::InstanceDeploymentDescription &idd = this->plan_.instance[inst.idd_idx]; + this->instances_[inst.idd_idx] = &inst; + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_homed_component - " + "Starting installation of homed component %C on node %C\n", + idd.name.in (), + idd.node.in ())); - if (this->container_set_.object_in_set (cref) == 0) + const char *home_id = 0; + get_property_value (DAnCE::EXPLICIT_HOME, idd.configProperty, home_id); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_homed_component - " + "Property %C has value %C\n", + DAnCE::EXPLICIT_HOME, home_id)); + + + if (home_id == 0) { - throw Components::RemoveFailure(); + DANCE_ERROR ((LM_ERROR, DLINFO "Nodeapplication_Impl::install_homed_component - " + "Apparent homed component %C lacks a %C configProperty, aborting installation\n", + idd.name.in (), DAnCE::EXPLICIT_HOME)); + throw ::Deployment::PlanError (idd.name.in (), + "No explicit home property on component requiring explicit home."); } - cref->remove (); + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_homed_component - " + "Found explicit home property '%C' for component '%C'\n", + home_id, + idd.name.in ())); - // @@ Deactivate object. - PortableServer::ObjectId_var oid - = this->poa_->reference_to_id (cref); + Instance *home_inst (0); - this->poa_->deactivate_object (oid.in ()); + for (size_t i = 0; i < cont.homes.size (); ++i) + { + if (ACE_OS::strcmp (home_id, + this->plan_.instance[cont.homes[i].idd_idx].name.in ()) == 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_homed_component - " + "Found home designated for component '%C'\n", + idd.name.in ())); + home_inst = &cont.homes[i]; + break; + } + } - // Should we remove the server still, even if the previous call failed. - if (this->container_set_.remove (cref) == -1) + if (home_inst == 0) { - throw ::Components::RemoveFailure (); + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_homed_component - " + "Unable to find home instance matching %C allocated to same container as component %C\n", + home_id, + idd.name.in ())); + throw Deployment::InvalidProperty (idd.name.in (), + "Unable to find valid home allocated to same container."); } - ACE_DEBUG ((LM_DEBUG, "LEAVING: NodeApplication_Impl::remove_container()\n")); -} + Components::KeylessCCMHome_var home = + Components::KeylessCCMHome::_narrow (home_inst->ref.in ()); -// Get containers -::Deployment::Containers * -CIAO::NodeApplication_Impl::get_containers () -{ - return 0; -} + if (CORBA::is_nil (home.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_homed_component - " + "Object reference for home '%C' for homed component '%C' is nil\n", + home_id, + idd.name.in ())); + throw Deployment::PlanError (idd.name.in (), + "Installed home for explicitly homed component has nil object reference\n"); + } -CIAO::CIAO_Event_Service * -CIAO::NodeApplication_Impl:: -install_es (const ::CIAO::DAnCE::EventServiceDeploymentDescription & es_info) -{ try { - ACE_DEBUG ((LM_DEBUG, "\nNodeApplication_Impl::install_es() called.\n\n")); + inst.home = home_inst; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_homed_component - " + "Invoking create_component on home %C for component %C\n", + home_id, + idd.name.in ())); - CIAO_Event_Service_var ciao_es = - es_factory_.create (es_info.type, es_info.name.in ()); + Components::CCMObject_var ccm_obj = home->create_component (); - // Set up the event channel federations - if (es_info.type == CIAO::RTEC) + if (CORBA::is_nil (ccm_obj)) { - // Narrow the event service to CIAO_RT_Event_Service - ::CIAO::CIAO_RT_Event_Service_var ciao_rtes = - ::CIAO::CIAO_RT_Event_Service::_narrow (ciao_es.in ()); + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_homed_component - " + "Received nil component reference from create_component on home %C " + " while creating component %C\n", + home_id, idd.name.in ())); + throw Deployment::StartError (idd.name.in (), + "Home for explicitly homed component returned nil"); + } - if (CORBA::is_nil (ciao_rtes.in ())) - throw ::Deployment::InstallationFailure (); + inst.ref = CORBA::Object::_narrow (ccm_obj.in ()); + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::install_homed_component - " + "Component %C successfully installed in home %C\n", + idd.name.in (), + home_id)); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_home - " + "Populating attributes for component %C\n", + idd.name.in ())); + ComponentAttributesSetter::SetComponentAttributes (idd.name.in (), + inst.ref.in (), + idd.configProperty, + this->orb_.in ()); + inst.state = eInstalled; + } + catch (const Components::CreateFailure &) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_homed_component - " + "Caught CreateFailure exception from home '%C' while installing component '%C'\n", + home_inst, + idd.name.in ())); + throw Deployment::StartError (idd.name.in (), + "Caught CreateFailure exception"); + } + catch (const CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_homed_component - " + "Caught CORBA exception while installing component %C in home %C: %C\n", + idd.name.in (), + home_id, + ex._info ().c_str ())); + throw ::Deployment::StartError (idd.name.in (), + ex._info ().c_str ()); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_homed_component - " + "Caught unknown C++ exception while installing component %C in home %C\n", + idd.name.in (), + home_id)); + throw ::Deployment::StartError (idd.name.in (), + "Unknown C++ exception"); + } +} - // Set up the event channel federations - for (CORBA::ULong j = 0; j < es_info.addr_servs.length (); ++j) - { - bool retv = - ciao_rtes->create_addr_serv ( - es_info.addr_servs[j].name.in (), - es_info.addr_servs[j].port, - es_info.addr_servs[j].address); +void +NodeApplication_Impl::create_component_server (size_t index) +{ + DANCE_TRACE ("NodeApplication_Impl::create_component_server"); - if (retv == false) - { - ACE_DEBUG ((LM_ERROR, "RTEC failed to create addr serv object\t\n")); - throw ::Deployment::InstallationFailure (); - } - } + ComponentServer &server = this->servers_[index]; - for (CORBA::ULong j = 0; j < es_info.senders.length (); ++j) - { - bool retv = - ciao_rtes->create_sender ( - es_info.senders[j].addr_serv_id.in ()); + try + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::create_component_Server - " + "creating component server %u\n", index)); + ::Components::ConfigValues config_values; + server.ref = this->activator_->create_component_server (config_values); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::create_component_server - " + "component server created\n")); + } + catch (const ::Components::CreateFailure& ) + { + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplication_impl::create_container - " + "Components::Deployment::ServerActivator_var::create_component_server() " + "returned ::Components::CreateFailure exception\n")); + throw ::Deployment::StartError("", + "Received a ::Components::CreateFailure exception while creating component server."); + } + catch (const ::Components::Deployment::InvalidConfiguration& ) + { + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplication_impl::create_container - " + "Components::Deployment::ServerActivator_var::create_component_server() " + "returned ::Components::Deployment::InvalidConfiguration exception\n")); + throw ::Deployment::InvalidProperty("", + "::Components::Deployment::InvalidConfiguration exception caught while creating server"); + } - if (retv == false) - { - ACE_DEBUG ((LM_ERROR, "RTEC failed to create UDP sender object\t\n")); - throw ::Deployment::InstallationFailure (); - } + try + { + for (size_t i = 0; i < server.containers.size (); ++i) + { + this->create_container (index, i); } + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_impl::create_container - " + "Caught exception whilst creating container; re-throwing.\n")); + throw; + } +} - for (CORBA::ULong j = 0; j < es_info.receivers.length (); ++j) - { - bool retv = - ciao_rtes->create_receiver ( - es_info.receivers[j].addr_serv_id.in (), - es_info.receivers[j].is_multicast, - es_info.receivers[j].listen_port); +void +NodeApplication_Impl::store_instance_ior (Instance &inst) +{ + DANCE_TRACE ("NodeApplication_impl::store_instance_ior"); - if (retv == false) - { - ACE_DEBUG ((LM_ERROR, "RTEC failed to create UDP receiver object\t\n")); - throw ::Deployment::InstallationFailure (); - } - } - } + const char *name = 0; + + if (get_property_value (DAnCE::REGISTER_NAMING, + this->plan_.instance[inst.idd_idx].configProperty, + name)) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_impl::store_instance_ior - " + "Storing instance '%C' object reference in Naming Service as %C", + this->plan_.instance[inst.idd_idx].name.in (), + name)); - return ciao_es._retn (); + Name_Utilities::bind_object (name, inst.ref.in (), this->instance_nc_.in ()); } - catch (const CORBA::Exception& ex) + + if (get_property_value (DAnCE::INSTANCE_IOR_FILE, + this->plan_.instance[inst.idd_idx].configProperty, + name)) { - ex._tao_print_exception ("NodeApplication_Impl::finishLaunch\t\n"); - throw ::Deployment::InstallationFailure (); + CORBA::String_var ior = this->orb_->object_to_string (inst.ref.in ()); + Name_Utilities::write_ior (name, ior.in ()); } } -ACE_CString * -CIAO::NodeApplication_Impl:: -create_connection_key (const Deployment::Connection & connection) +void +NodeApplication_Impl::create_container (size_t server, size_t cont_idx) { - ACE_CString * retv; - ACE_NEW_RETURN (retv, ACE_CString, 0); + DANCE_TRACE ("NodeApplication_impl::create_container"); - (*retv) += connection.instanceName.in (); - (*retv) += connection.portName.in (); - (*retv) += connection.endpointInstanceName.in (); - (*retv) += connection.endpointPortName.in (); + Container &container = this->servers_[server].containers[cont_idx]; - if (CIAO::debug_level () > 3) - ACE_ERROR ((LM_ERROR, "The key is: %s\n", (*retv).c_str ())); + DANCE_DEBUG ((LM_TRACE, "NodeApplication_impl::create_container - " + "Creating container\n")); + // TODO: Need to create configvalues + Components::ConfigValues cvs; - return retv; -} + container.ref = this->servers_[server].ref->create_container (cvs); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_impl::create_container - " + "Configuring %u homes on container %u on server %u\n", + container.homes.size (), + server, cont_idx)); -void -CIAO::NodeApplication_Impl:: -handle_facet_receptable_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection) -{ - if (CIAO::debug_level () > 11) + // Configure homes first + for (size_t i = 0; i < container.homes.size (); ++i) { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "working on port name [%s] in instance [%s] \n", - connection.portName.in (), - connection.instanceName.in ())); + this->install_home (container, container.homes[i]); + this->store_instance_ior (container.homes[i]); } - if (add_connection) - { - ::Components::Cookie_var cookie = - comp->connect (connection.portName.in (), - connection.endpoint.in ()); - - ACE_CString key = (*create_connection_key (connection)); - if (CIAO::debug_level () > 10) - { - ACE_ERROR ((LM_ERROR, "[BINDING KEY]: %s\n", key.c_str ())); - } - this->cookie_map_.rebind (key, cookie); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_impl::create_container - " + "Configuring %u components on container %u on server %u\n", + container.components.size (), + server, cont_idx)); - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); - } - } - else + // Configure components + for (size_t i = 0; i < container.components.size (); ++i) { - ACE_CString key = (*create_connection_key (connection)); - ::Components::Cookie_var cookie; - if (CIAO::debug_level () > 6) - { - ACE_ERROR ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); - } - if (this->cookie_map_.find (key, cookie) != 0) - { - ACE_ERROR ((LM_ERROR, "Error: Cookie Not Found!\n")); - throw Deployment::InvalidConnection (); - } - - comp->disconnect (connection.portName.in (), - cookie.in ()); - this->cookie_map_.unbind (key); - if (CIAO::debug_level () > 6) + switch (container.components[i].type) { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); + case eComponent: + this->install_component (container, container.components[i]); + break; + case eHomedComponent: + this->install_homed_component (container, container.components[i]); + break; + default: + break; } + this->store_instance_ior (container.components[i]); } } - +/* void -CIAO::NodeApplication_Impl:: -handle_emitter_consumer_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection) +NodeApplication_Impl::create_container (unsigned int index) { - Components::EventConsumerBase_var consumer = - Components::EventConsumerBase::_narrow (connection.endpoint.in ()); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::create_container - started\n")); - if (CORBA::is_nil (consumer.in ())) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection, " - "for port name [%s] in instance [%s] ," - "there is an invalid endPoint. \n", - connection.portName.in (), - connection.instanceName.in ())); - throw Deployment::InvalidConnection (); - } + Components::ConfigValues config_values; + ACE_CString processDest; + CORBA::Any_var feature_any; + + this->create_config_values (this->plan_.instance[index].configProperty, + eCreateComponentServer, + config_values); - if (CIAO::debug_level () > 11) + ::Components::Deployment::ComponentServer_var compServer; + + + // COMPONENT_KIND + this->create_config_values (this->plan_.implementation[this->plan_.instance[index].implementationRef].execParameter, + eCreateContainer, + config_values); + try { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection, " - "working on port name [%s] in instance [%s] \n", - connection.portName.in (), - connection.instanceName.in ())); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::create_container - " + "creating container for destination: %C\n", processDest.c_str())); + this->containers_.rebind (processDest.c_str(), compServer->create_container (config_values)); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::create_container - container created\n")); } - - if (add_connection) + catch (::Components::CreateFailure& ) { - comp->connect_consumer (connection.portName.in (), - consumer.in ()); - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); - } + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::create_container - " + "::Components::Deployment::ComponentServer_var::create_container() " + "returned ::Components::CreateFailure exception\n")); + throw Deployment::StartError(); } - else + catch (::Components::Deployment::InvalidConfiguration& ) { -// Operation not implemented by the CIDLC. -// comp->disconnect_consumer (connection.portName.in (), -// 0 -//); - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); - } + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::create_container - " + "::Components::Deployment::ComponentServer_var::create_container() " + "returned ::Components::Deployment::InvalidConfiguration exception\n")); + throw ::Deployment::InvalidProperty(); } -} + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::create_container - finished\n")); +} +*/ void -CIAO::NodeApplication_Impl:: -handle_publisher_consumer_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection) +NodeApplication_Impl::init_components() { - Components::EventConsumerBase_var consumer = - Components::EventConsumerBase::_narrow (connection.endpoint.in ()); + DANCE_TRACE ("NodeApplication_impl::init_components"); - if (CORBA::is_nil (consumer.in ())) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection, " - "for port name [%s] in instance [%s] ," - "there is an invalid endPoint. \n", - connection.portName.in (), - connection.instanceName.in ())); - throw Deployment::InvalidConnection (); - } + Components::ConfigValues config_values; + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::init_components - " + "Configuring %u component/home instances\n", + this->plan_.instance.length())); - if (CIAO::debug_level () > 11) + // @@TODO: For the moment, we are only going to support a single component server and container. + // in the future, we will need to determine how many component servers we need. + if (this->plan_.instance.length () > 0) { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection, " - "working on port name [%s] in instance [%s] \n", - connection.portName.in (), - connection.instanceName.in ())); + ComponentServer server; + server.containers.size (1); + this->servers_.size (1); + this->servers_[0] = server; } - if (add_connection) + for (unsigned int i = 0; i < this->plan_.instance.length(); i++) { - ::Components::Cookie_var cookie = - comp->subscribe (connection.portName.in (), - consumer.in ()); - - ACE_CString key = (*create_connection_key (connection)); - this->cookie_map_.rebind (key, cookie); - if (CIAO::debug_level () > 6) + try { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); + CORBA::ULong impl = this->plan_.instance[i].implementationRef; + // Determine type from implementation properties, then from instance properties. + EInstanceType type = + this->get_instance_type (this->plan_.implementation[impl].execParameter); + if (type == eInvalid) + type = this->get_instance_type (this->plan_.instance[i].configProperty); + + switch (type) + { + case eHome: + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_impl::init_components - " + "Allocating instance %C as a home\n", + this->plan_.instance[i].name.in ())); + + size_t pos = this->servers_[0].containers[0].homes.size (); + this->servers_[0].containers[0].homes.size (pos + 1); + this->servers_[0].containers[0].homes[pos] = Instance (eHome, + &this->servers_[0].containers[0], + i, + this->plan_.instance[i].implementationRef); + //this->instances_[i] = &this->servers_[0].containers[0].homes[pos]; + break; + } + case eComponent: + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_impl::init_components - " + "Allocating instance %C as a standalone component\n", + this->plan_.instance[i].name.in ())); + size_t pos = this->servers_[0].containers[0].homes.size (); + this->servers_[0].containers[0].components.size (pos + 1); + this->servers_[0].containers[0].components[pos] = Instance (eComponent, + &this->servers_[0].containers[0], + i, + this->plan_.instance[i].implementationRef); + //this->instances_[i] = &this->servers_[0].containers[0].components[pos]; + break; + } + case eHomedComponent: + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_impl::init_components - " + "Allocating instance %C as a home managed component\n", + this->plan_.instance[i].name.in ())); + size_t pos = this->servers_[0].containers[0].components.size (); + this->servers_[0].containers[0].components.size (pos + 1); + this->servers_[0].containers[0].components[pos] = Instance (eHomedComponent, + &this->servers_[0].containers[0], + i, + this->plan_.instance[i].implementationRef); + //this->instances_[i] = &this->servers_[0].containers[0].components[pos]; + break; + } + default: + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::init_components - " + "get_instance_type function returned invalid instance type\n")); + throw ::Deployment::InvalidProperty (this->plan_.instance[i].name.in (), + "Unable to affirmatively determine instance type"); + } + } // switch + } catch (...) + { + DANCE_ERROR((LM_ERROR, DLINFO "Exception was thrown while sorting instance \"%C\".\n", this->plan_.instance[i].name.in())); + throw; } } - else // remove the connection - { - ACE_CString key = (*create_connection_key (connection)); - ::Components::Cookie_var cookie; - if (CIAO::debug_level () > 6) - { - ACE_ERROR ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); - } - if (this->cookie_map_.find (key, cookie) != 0) - { - ACE_ERROR ((LM_ERROR, "Error: Cookie Not Found!\n")); - throw Deployment::InvalidConnection (); - } + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_impl::init_components - " + "Creating component servers and installing components.\n")); + for (size_t i = 0; i < this->servers_.size (); ++i) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_impl::init_components - " + "Creating component server with index %u\n", i)); + this->create_component_server (i); + } - comp->unsubscribe (connection.portName.in (), - cookie.in ()); - this->cookie_map_.unbind (key); - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); - } - } + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::init_components - finished\n")); } - void -CIAO::NodeApplication_Impl:: -handle_publisher_es_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection) +NodeApplication_Impl::passivate_components() { - if (! this->_is_publisher_es_conn (connection)) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_publisher_es_connection: " - "Unsupported event connection type\n")); - throw CORBA::NO_IMPLEMENT (); - } - - const CIAO::CIAO_Event_Service_ptr event_service = - connection.event_service; - - if (CORBA::is_nil (event_service)) - { - ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); - throw Deployment::InvalidConnection (); - } + DANCE_TRACE ("NodeApplication_Impl::passivate_components()"); - // supplier ID - ACE_CString sid (connection.instanceName.in ()); - sid += "_"; - sid += connection.portName.in (); + bool error (false); + Deployment::StopError exception ("unfilled", "unfilled passivate components"); - if (add_connection) + for (size_t k = 0; k < this->instances_.size (); ++k) { - ::Components::Cookie_var cookie = - comp->subscribe (connection.portName.in (), - event_service); + if (this->instances_[k]->type == eHome || + this->instances_[k]->type == eInvalid) + continue; - ACE_CString key = (*create_connection_key (connection)); - this->cookie_map_.rebind (key, cookie); - // Create a supplier_config and register it to ES - CIAO::Supplier_Config_var supplier_config = - event_service->create_supplier_config (); + try + { + CIAO::Deployment::Container_var cont = + CIAO::Deployment::Container::_narrow (this->instances_[k]->container->ref.in()); - supplier_config->supplier_id (sid.c_str ()); - event_service->connect_event_supplier (supplier_config.in ()); - supplier_config->destroy (); + if (CORBA::is_nil (this->instances_[k]->container->ref.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::start - " + "Failed to narrow object reference for container managing " + "component instance %C to a CIAO container reference\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + test_and_set_exception (error, exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Failed to narrow managing container to CIAO container type"); + continue; + } - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_publisher_es_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); - } - } - else // remove the connection - { - ACE_CString key = (*create_connection_key (connection)); - ::Components::Cookie_var cookie; + if (this->instances_[k]->state == eActive) + { + Components::CCMObject_var comp (Components::CCMObject::_narrow (this->instances_[k]->ref)); + cont->passivate_component (comp.in ()); + this->instances_[k]->state = ePassive; + } + else + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::start - " + "Attempting to passivate non-active component %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + test_and_set_exception (error, exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Attempting to passivate non-active component."); + continue; + } - if (CIAO::debug_level () > 6) - { - ACE_ERROR ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::passivate_components - " + "Component %C successfully passivated.\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); } - if (this->cookie_map_.find (key, cookie) != 0) + catch (const CORBA::Exception &ex) { - ACE_ERROR ((LM_ERROR, "Error: Cookie Not Found!\n")); - throw Deployment::InvalidConnection (); + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::passivate_components - " + "Caught CORBA exception from ccm_passivate on component %C: %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + ex._info ().c_str ())); + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = ex._info ().c_str (); + } } - - comp->unsubscribe (connection.portName.in (), - cookie.in ()); - this->cookie_map_.unbind (key); - event_service->disconnect_event_supplier (sid.c_str ()); - - if (CIAO::debug_level () > 6) + catch (...) { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_publisher_es_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - connection.instanceName.in (), - connection.portName.in (), - connection.endpointInstanceName.in (), - connection.endpointPortName.in ())); + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::passivate_components - " + "Caught unknown C++ exception from ccm_passivate on component %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + if (!error) + { + error = true; + exception.name = this->plan_.instance[this->instances_[k]->idd_idx].name.in (); + exception.reason = "Unknown C++ exception"; + } } } -} + if (error) + throw exception; +} void -CIAO::NodeApplication_Impl:: -handle_es_consumer_connection ( - const Deployment::Connection & connection, - CORBA::Boolean add_connection) +NodeApplication_Impl::remove_components() { - if (! this->_is_es_consumer_conn (connection)) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_es_consumer_connection: " - "Unsupported event connection type\n")); - throw CORBA::NO_IMPLEMENT (); - } + DANCE_TRACE ("NodeApplication_Impl::remove_components()"); - // Get ES object - const CIAO::CIAO_Event_Service_ptr event_service = - connection.event_service; + bool error (false); + Deployment::StopError exception ("unfilled", "unfilled remove_components"); - if (CORBA::is_nil (event_service)) + // Removing components first. + for (size_t k = 0; k < this->instances_.size (); ++k) { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_es_consumer_connection: " - "NIL event_service\n")); - throw Deployment::InvalidConnection (); - } + try + { + if (this->instances_[k]->type == eInvalid || + this->instances_[k]->type == eHome) + continue; - // Get consumer object - Components::EventConsumerBase_var consumer = - Components::EventConsumerBase::_narrow (connection.endpoint.in ()); + if (this->instances_[k]->state != ePassive) + DANCE_DEBUG ((LM_WARNING, DLINFO "NodeApplication_Impl::remove_components - " + "Attempting to remove component that is not passive.\n")); - if (CORBA::is_nil (consumer.in ())) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_es_consumer_connection: " - "Nil consumer port object reference\n")); - throw Deployment::InvalidConnection (); - } + if (this->instances_[k]->type == eComponent) + { + if (this->instances_[k]->container == 0) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Container element in component data structure for '%C' is nill\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in () + )); + + test_and_set_exception (error, + exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Container element in component data structure is nil\n"); + this->instances_[k]->state = eInvalidState; + continue; + } + + CIAO::Deployment::Container_var ciao_container = + CIAO::Deployment::Container::_narrow (this->instances_[k]->container->ref.in ()); + + if (CORBA::is_nil (ciao_container.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Attempted to remove un-homed component from unsupported container\n")); + + test_and_set_exception (error, exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Attempted to remove un-homed component from unsupported container\n"); + this->instances_[k]->state = eInvalidState; + continue; + } + + ciao_container->remove_component (Components::CCMObject::_narrow (this->instances_[k]->ref.in ())); + } + else + { + Components::CCMHome_var home = + Components::CCMHome::_narrow (this->instances_[k]->home->ref.in ()); + + if (CORBA::is_nil (home)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Object reference for home %C, managing component %C is nil.\n", + this->plan_.instance[this->instances_[k]->home->idd_idx].name.in (), + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + test_and_set_exception (error, + exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Managing home's object reference is invalid."); + this->instances_[k]->state = eInvalidState; + continue; + } + + home->remove_component (Components::CCMObject::_narrow (this->instances_[k]->ref.in ())); + } - // consumer ID - ACE_CString cid (connection.instanceName.in ()); - cid += "_"; - cid += connection.portName.in (); - cid += "_consumer"; - if (add_connection) - { - CIAO::Consumer_Config_var consumer_config = - event_service->create_consumer_config (); + this->instances_[k]->state = eRemoved; - consumer_config->consumer_id (cid.c_str ()); - consumer_config->consumer (consumer.in ()); + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::remove_components - " + "Component %C successfully removed.\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); - // Need to setup a filter, if it's specified in the descriptor - for (CORBA::ULong i = 0; i < connection.config.length (); ++i) + } + catch (const CORBA::Exception &ex) { - if (ACE_OS::strcmp (connection.config[i].name.in (), - "EventFilter") != 0) - continue; - - // Extract the filter information - CIAO::DAnCE::EventFilter *filter = 0; - connection.config[i].value >>= filter; + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Caught CORBA exception removing on component %C: %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + ex._info ().c_str ())); + test_and_set_exception (error, + exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + exception.reason = ex._info ().c_str ()); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Caught unknown C++ exception from ccm_remove on component %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + test_and_set_exception (error, + exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Unknown C++ exception"); + } + } - CORBA::ULong size = (*filter).sources.length (); + for (size_t k = 0; k < this->instances_.size (); ++k) + { + try + { + if (this->instances_[k]->type != eHome) + continue; - if ((*filter).type == DAnCE::CONJUNCTION) - consumer_config->start_conjunction_group (size); - else if ((*filter).type == DAnCE::DISJUNCTION) - consumer_config->start_disjunction_group (size); + DANCE_ERROR ((LM_TRACE, DLINFO "NodeApplication_Impl::remove_components - " + "Removing home %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); - for (CORBA::ULong j = 0; j < size; ++j) + if (this->instances_[k]->container == 0 || + CORBA::is_nil (this->instances_[k]->container->ref.in ())) { - consumer_config->insert_source ((*filter).sources[j]); + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Home %C lacks an associated container reference\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + test_and_set_exception (error, + exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Didn't have a valid container reference"); + continue; } - } - event_service->connect_event_consumer (consumer_config.in ()); - consumer_config->destroy (); + Components::CCMHome_var home = Components::CCMHome::_narrow (this->instances_[k]->ref.in ()); + this->instances_[k]->container->ref->remove_home (home.in ()); - if (CIAO::debug_level () > 6) + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::remove_components - " + "Successfully uninstalled home %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + } + catch (const CORBA::Exception &ex) { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_es_consumer_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - connection.endpointInstanceName.in (), - connection.endpointPortName.in (), - connection.instanceName.in (), - connection.portName.in ())); + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Caught CORBA exception removing home %C: %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + ex._info ().c_str ())); + test_and_set_exception (error, + exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + exception.reason = ex._info ().c_str ()); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::remove_components - " + "Caught unknown C++ exception from while removing home %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + test_and_set_exception (error, + exception, + this->plan_.instance[this->instances_[k]->idd_idx].name.in (), + "Unknown C++ exception"); } } - else // remove the connection + +if (error) + throw exception; +} + +NodeApplication_Impl::EInstanceType +NodeApplication_Impl::get_instance_type (const Deployment::Properties& prop) const +{ + DANCE_TRACE ("NodeApplication_Impl::get_instance_type"); + + for (CORBA::ULong i = 0; i < prop.length (); ++i) { - event_service->disconnect_event_consumer (cid.c_str ()); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::get_instance_type - " + "Checking property %C\n", + prop[i].name.in ())); - if (CIAO::debug_level () > 6) + if (ACE_OS::strcmp (prop[i].name.in (), + DAnCE::HOME_FACTORY) == 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::get_instance_type - " + "Found Home type\n")); + return eHome; + } + if (ACE_OS::strcmp (prop[i].name.in (), + DAnCE::COMPONENT_FACTORY) == 0) { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::handle_es_consumer_connection\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - connection.endpointInstanceName.in (), - connection.endpointPortName.in (), - connection.instanceName.in (), - connection.portName.in ())); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::get_instance_type - " + "Found unmanaged component type.\n")); + return eComponent; + } + if (ACE_OS::strcmp (prop[i].name.in (), + DAnCE::EXPLICIT_HOME) == 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::get_instance_type - " + "Found explicit home component type.\n")); + return eHomedComponent; } } + + DANCE_ERROR ((LM_INFO, DLINFO "NodeApplication_Impl::get_instance_type - " + "Unable to determine instance type\n")); + return eInvalid; } -// Below code is not used at this time. void -CIAO::NodeApplication_Impl::build_event_connection ( - const Deployment::Connection & connection, - bool add_or_remove) +NodeApplication_Impl::create_config_values (const Deployment::Properties& /*prop*/, + const ERequestType request, + Components::ConfigValues& /*cfg*/) const { - ACE_DEBUG ((LM_DEBUG, "CIAO::NodeApplication_Impl::build_connection ()!!!\n")); - - ACE_DEBUG ((LM_DEBUG, "instanceName: %s\n", connection.instanceName.in ())); - ACE_DEBUG ((LM_DEBUG, "portName: %s\n", connection.portName.in ())); - - ACE_DEBUG ((LM_DEBUG, "consumer Component Name: %s\n", connection.endpointInstanceName.in ())); - ACE_DEBUG ((LM_DEBUG, "consumer Port Name: %s\n", connection.endpointPortName.in ())); - - ACE_DEBUG ((LM_DEBUG, "portkind: ")); - switch (connection.kind) { - case Deployment::Facet: ACE_DEBUG ((LM_DEBUG, "Facet\n")); break; - case Deployment::SimplexReceptacle: ACE_DEBUG ((LM_DEBUG, "SimplexReceptacle\n")); break; - case Deployment::MultiplexReceptacle: ACE_DEBUG ((LM_DEBUG, "MultiplexReceptacle\n")); break; - case Deployment::EventEmitter: ACE_DEBUG ((LM_DEBUG, "EventEmitter\n")); break; - case Deployment::EventPublisher: ACE_DEBUG ((LM_DEBUG, "EventPublisher\n")); break; - case Deployment::EventConsumer: ACE_DEBUG ((LM_DEBUG, "EventConsumer\n")); break; + DANCE_TRACE ("NodeApplication_Impl::create_config_values"); + + //unsigned int ind = 0; + CORBA::Any_var feature_any; + switch (request) + { + case eCreateComponentServer: + { + break; + } + case eCreateContainer: + { + + break; + } + case eInstallHome: + { + break; + } default: - ACE_DEBUG ((LM_DEBUG, "Unknow\n")); break; + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::create_config_values - " + "request is not a know type: eCreateComponentServer, eCreateContainer, " + "eInstallHome, eCreateComponentWithConfigValues\n")); + throw ::Deployment::InvalidProperty("", + "Invalid creation type for filling in config values"); + } } +} - const CIAO::CIAO_Event_Service_ptr event_service = - connection.event_service; +Deployment::Connections* +NodeApplication_Impl::getAllConnections() +{ + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - started\n")); + Deployment::Connections_var conn; + ACE_NEW_THROW_EX (conn, + Deployment::Connections (), + CORBA::NO_MEMORY ()); + unsigned int index = 0; + /* + this->redirection_.registration_start (this->node_name_, this->plan_.UUID.in()); + + CCMObjects registration + for (TComponents::iterator it = this->components_.begin(); + !it.done(); + ++it) + { + this->redirection_.registration (this->node_name_, + this->plan_.UUID.in(), + (*it).ext_id_, + (*it).int_id_.in()); - // Get the consumer port object reference and put it into "consumer" - Components::EventConsumerBase_var consumer = - Components::EventConsumerBase::_narrow (connection.endpoint.in ()); + }*/ + for (unsigned int i = 0; i < this->plan_.connection.length(); i++) + { + for (unsigned int j = 0; j < this->plan_.connection[i].internalEndpoint.length(); j++) + { + if (this->plan_.connection[i].internalEndpoint[j].provider) + { + index = conn->length (); + conn->length (index + 1); + (*conn) [index].name = CORBA::string_dup (this->plan_.connection[i].name.in()); + + ACE_CString inst_name = + this->plan_.instance[this->plan_.connection[i].internalEndpoint[j].instanceRef].name.in(); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::getAllConnections() - " + "Found provider '%C' for connection '%C'\n", + this->plan_.connection[i].name.in (), + inst_name.c_str ())); + + Components::CCMObject_var obj = + Components::CCMObject:: + _narrow (this->instances_[this->plan_.connection[i].internalEndpoint[j].instanceRef]->ref.in ()); + + (*conn) [index].endpoint.length (1L); + // ACE_CString path = CCMObjectLocator::TreeNode::mergePath (inst_name.c_str() + // , this->plan_.connection[i].internalEndpoint[j].portName.in()); + switch (this->plan_.connection[i].internalEndpoint[j].kind) + { + case Deployment::Facet: + { + try + { + ACE_CString name = this->plan_.connection[i].internalEndpoint[j].portName.in(); + if (name.compare ("supports") != 0) + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - " + "provide_facet for connection %C endpoint %C started\n", + this->plan_.connection[i].name.in(), + this->plan_.connection[i].internalEndpoint[j].portName.in())); + CORBA::String_var facet_name = CORBA::string_dup (name.c_str()); + (*conn) [index].endpoint[0] = obj->provide_facet (facet_name.in()); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - " + "provide_facet for connection %C endpoint %C finished\n", + this->plan_.connection[i].name.in(), + this->plan_.connection[i].internalEndpoint[j].portName.in())); + } + else + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - " + "provide_facet for connection %C endpoint %C started\n", + this->plan_.connection[i].name.in(), + this->plan_.connection[i].internalEndpoint[j].portName.in())); + (*conn) [index].endpoint[0] = CORBA::Object::_duplicate (obj.in()); + } + /* this->redirection_.registration (this->node_name_, + this->plan_.UUID.in(), + inst_name, + name, + (*conn) [index].endpoint[0].in());*/ + //app_node.addChild(path.c_str(), obj->provide_facet(facet_name)); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - provide_facet finished\n")); + } + catch (const ::Components::InvalidName& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::getAllConnections - " + "Components::CCMObject_var::provide_facet() returned " + "::Components::InvalidName exception for connection %C and port %C\n", + this->plan_.connection[i].name.in (), + this->plan_.connection[i].internalEndpoint[j].portName.in ())); + throw ::Deployment::InvalidProperty(this->plan_.connection[i].name.in (), + "Container returned InvalidName"); + } + break; + } + case Deployment::EventConsumer: + { + try + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - " + "get_consumer for connection %C endpoint %C started\n", + this->plan_.connection[i].name.in(), + this->plan_.connection[i].internalEndpoint[j].portName.in())); + (*conn) [index].endpoint[0] = obj->get_consumer (this->plan_.connection[i].internalEndpoint[j].portName.in()); + /*this->redirection_.registration (this->node_name_, + this->plan_.UUID.in(), + inst_name, + this->plan_.connection[i].internalEndpoint[j].portName.in(), + (*conn) [index].endpoint[0].in());*/ + + //app_node.addChild(path.c_str(), obj->get_consumer(this->plan_.connection[i].internalEndpoint[j].portName)); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - " + "get_consumer finished\n")); + } + catch (const ::Components::InvalidName& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::getAllConnections - " + "Components::CCMObject_var::get_consumer() returned " + "::Components::InvalidName exception for connection %C and port %C\n", + this->plan_.connection[i].name.in (), + this->plan_.connection[i].internalEndpoint[j].portName.in ())); + throw ::Deployment::InvalidProperty(this->plan_.connection[i].name.in (), + "Container returned InvalidName exception"); + } + break; + } + default: + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::getAllConnections - " + "Connection.InternalEndPoint.Kind is not a " + "Deployment::Facet or Deployment::EventConsumer\n")); + throw ::Deployment::InvalidProperty(this->plan_.connection[i].name.in (), + "Invalid connection type, should be Facet or EventConsumer"); + } + } + // index++; + } + } + } + /*this->redirection_.registration_finish (this->node_name_, this->plan_.UUID.in());*/ + //this->node_.registerObjects(this->plan_.UUID.in(), app_node); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::getAllConnections - finished\n")); + return conn._retn(); +} - if (CORBA::is_nil (consumer.in ())) - { - ACE_DEBUG ((LM_DEBUG, "Nil consumer port object reference\n")); - throw Deployment::InvalidConnection (); - } +void +NodeApplication_Impl::finishLaunch (const Deployment::Connections & providedReference, + ::CORBA::Boolean start) +{ + DANCE_TRACE ("NodeApplication_Impl::finishLaunch"); - // Get the supplier component object reference. - ACE_CString supplier_comp_name = connection.instanceName.in (); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "started for connections sequence with length: %d\n", + providedReference.length())); - ACE_DEBUG ((LM_DEBUG, "source component name is: %s\n", supplier_comp_name.c_str ())); - Component_State_Info comp_state; - if (this->component_state_map_.find (supplier_comp_name, comp_state) != 0) - { - ACE_DEBUG ((LM_DEBUG, "Nil source component object reference\n")); - throw Deployment::InvalidConnection (); - } +#ifdef GEN_OSTREAM_OPS + { + std::ostringstream pr_stream; + pr_stream << providedReference << std::endl; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_impl::finishLaunch - Provided references: %s", + pr_stream.str ().c_str ())); + } +#endif /* GEN_OSTREAM_OPS */ - // Get the consumer component object reference. - ACE_CString consumer_comp_name = connection.endpointInstanceName.in (); + for (unsigned int j = 0; j < this->plan_.connection.length(); ++j) + { + CORBA::ULong inst (this->plan_.connection[j].internalEndpoint[0].instanceRef); - ACE_DEBUG ((LM_DEBUG, "consumer component name is: %s\n", consumer_comp_name.c_str ())); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_impl::finishLaunch - " + "Connection %C, instance %u\n", + this->plan_.connection[j].name.in (), + inst)); - if (CORBA::is_nil (event_service)) +#ifdef GEN_OSTREAM_OPS { - ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); - throw Deployment::InvalidConnection (); + std::ostringstream conn_stream; + conn_stream << this->plan_.connection[j] << std::endl; + DANCE_DEBUG ((LM_TRACE, "NodeApplication_impl::finishLaunch - Local connections: %s", conn_stream.str ().c_str ())); } +#endif /* GEN_OSTREAM_OPS */ - // supplier ID - ACE_CString sid (connection.instanceName.in ()); - sid += "_"; - sid += connection.portName.in (); + Components::CCMObject_var obj = + Components::CCMObject:: + _narrow (this->instances_[inst]->ref.in ()); - // consumer ID - ACE_CString cid (connection.endpointInstanceName.in ()); - cid += "_"; - cid += connection.endpointPortName.in (); - cid += "_consumer"; + if (CORBA::is_nil (obj.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_impl::finishLaunch - " + "Unable to narrow apparent component instance reference to CCMObject for instance '%C'\n", + this->plan_.instance[inst].name.in ())); + throw Deployment::InvalidConnection (this->plan_.instance[inst].name.in (), + "Unable to narrow apparent component instance reference to CCMObject\n"); + } - //ACE_DEBUG ((LM_DEBUG, "Publisher: %s\n", sid.c_str ())); - ACE_DEBUG ((LM_DEBUG, "Subscriber: %s\n", cid.c_str ())); + const ::Deployment::PlanConnectionDescription &conn = this->plan_.connection[j]; + ACE_CString name = conn.name.in(); - if (add_or_remove == true) - { - CIAO::Supplier_Config_var supplier_config = - event_service->create_supplier_config (); + for (unsigned int i = 0; i < providedReference.length(); ++i) + { + /*DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "loop on all connections iteration %d for connection %C\n", + i, + providedReference[i].name.in()));*/ - supplier_config->supplier_id (sid.c_str ()); - event_service->connect_event_supplier (supplier_config.in ()); - supplier_config->destroy (); + if (name.compare (providedReference[i].name.in()) == 0) + { + try + { + switch (conn.internalEndpoint[0].kind) + { + case Deployment::Facet: + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "set for facet %C \n", name.c_str ())); + Components::CCMObject_var ext_inst; + try + { + if (0 == conn.externalReference.length()) + { + if (conn.internalEndpoint.length () == 2 && + (conn.internalEndpoint[1].kind == Deployment::MultiplexReceptacle || + conn.internalEndpoint[1].kind == Deployment::SimplexReceptacle)) + { + obj = Components::CCMObject:: + _narrow (this->instances_[conn.internalEndpoint[1].instanceRef]->ref.in ()); + + this->connect_receptacle (obj.in (), + conn.internalEndpoint[1].portName.in(), + providedReference[i].endpoint[0].in()); + } + /* + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_impl::finishLaunch - " + "Unsupported facet connection; lacks either external reference or " + "multiple internalEndpoints.\n")); + throw ::Deployment::StartError (name.c_str (), + "Unsupported facet connection; lacks either external reference " + "or multiple internalEndpoints.\n"); + */ + break; + } + CORBA::Object_var tmp = + this->orb_->string_to_object (conn.externalReference[0].location.in()); + ext_inst = Components::CCMObject::_narrow (tmp); + if (CORBA::is_nil (ext_inst.in())) + { + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplication_impl::finishLaunch - " + "facet for %C can't be narrowed \n", name.c_str ())); + break; + } + this->connect_receptacle_ext (ext_inst, + conn.externalReference[0].portName.in(), + providedReference[i].endpoint[0].in()); + } + catch (const CORBA::OBJECT_NOT_EXIST&) + { + // @@TODO: Shouldn't this be an error?!? + break; + } + catch (const CORBA::TRANSIENT&) + { + // @@TODO: Shouldn't this be an error?!? + break; + } + + break; + } + case Deployment::EventConsumer: + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - set for consumer \n")); + Components::CCMObject_var ext_inst; + try + { + if (0 == conn.externalReference.length()) + { + break; + } + CORBA::Object_var tmp = + this->orb_->string_to_object (conn.externalReference[0].location.in()); + ext_inst = Components::CCMObject::_narrow (tmp); + if (CORBA::is_nil (ext_inst.in())) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "reference for %C can't be narrowed \n", name.c_str ())); + throw ::Deployment::InvalidConnection(conn.name.in (), + "Couldn't narrow reference for external reference"); + break; + } + try + { + // Check is connection kind is consumer to emitter? + this->connect_emitter_ext (ext_inst, + conn.externalReference[0].portName.in(), + providedReference[i].endpoint[0].in()); + } + catch (const ::Components::InvalidName&) + { + // No this is consumer to publisher + this->connect_publisher (ext_inst, + conn.externalReference[0].portName.in(), + providedReference[i].endpoint[0].in()); + } + } + catch (const CORBA::OBJECT_NOT_EXIST&) + { + break; + } + catch (const CORBA::TRANSIENT&) + { + break; + } + break; + } + case Deployment::MultiplexReceptacle: + case Deployment::SimplexReceptacle: + { + // What we should do with Cookie, returned from connect call??? + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - set for receptacle \n")); + this->connect_receptacle (obj.in(), + conn.internalEndpoint[0].portName.in(), + providedReference[i].endpoint[0].in()); + break; + } + case Deployment::EventEmitter: + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - set for emitter \n")); + this->connect_emitter (obj.in(), + conn.internalEndpoint[0].portName.in(), + providedReference[i].endpoint[0].in()); + break; + } + case Deployment::EventPublisher: + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - set for publisher \n")); + this->connect_publisher (obj.in(), + conn.internalEndpoint[0].portName.in(), + providedReference[i].endpoint[0].in()); + break; + } + default: + { + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplication_impl::finishLaunch - currect Connection.InternalEndPoint.Kind " + "is not a Deployment::SimplexReceptacle, Deployment::EventEmitter, Deployment::EventPublisher " + "(Connection:%C Kind:%i PortName:%C)\n", + conn.name.in(), + conn.internalEndpoint[0].kind, + conn.internalEndpoint[0].portName.in() + )); + throw ::Deployment::InvalidConnection(conn.name.in (), + "Invalid connection type, should be Receptacle or even producer."); + }//default + }//switch + } + catch (::Deployment::StartError &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_impl::finishLaunch - " + "Intercepted StartError exception while configuring %C conneciton, rethrowing\n", + name.c_str ())); + ex.name = name.c_str (); + throw; + } + catch (::Deployment::InvalidConnection &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_impl::finishLaunch - " + "Intercepted InvalidConnection exception while configuring %C conneciton, rethrowing\n", + name.c_str ())); + ex.name = name.c_str (); + throw; + } + }//if(name.compare(providedReference[i].name.in()) == 0) + }//for ( unsigned int i = 0; i < providedReference.length(); ++i ) + }//for ( unsigned int j = 0; j < this->plan_.connection.length(); ++j ) + + this->configuration_complete_components (); + + if (start) + { + this->start(); + } - CIAO::Consumer_Config_var consumer_config = - event_service->create_consumer_config (); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - finished\n")); +} - consumer_config->consumer_id (cid.c_str ()); - consumer_config->consumer (consumer.in ()); +Components::Cookie* +NodeApplication_Impl::connect_receptacle (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr facet) +{ + Components::Cookie* res = 0; + try + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "connect SimplexReceptacle for %C started\n", port_name.c_str())); + res = inst->connect (port_name.c_str(), facet); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - connect finished\n")); + } + catch (const ::Components::InvalidName& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::InvalidName exception\n")); + throw ::Deployment::StartError("", + "Received InvalidName exception while connecting receptacle."); + } + catch (const ::Components::InvalidConnection& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::InvalidConnection exception\n")); + throw ::Deployment::InvalidConnection("", + "InvalidConnection caught while connecting receptacle."); + } + catch (const ::Components::AlreadyConnected& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::AlreadyConnected exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught AlredyConnected exception while connecting receptacle"); + } + catch (const ::Components::ExceededConnectionLimit& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::ExceededConnectionLimit exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught ExceededConnectionLimit exception while connecting receptacle."); + } + return res; +} - event_service->connect_event_consumer (consumer_config.in ()); +Components::Cookie* +NodeApplication_Impl::connect_receptacle_ext (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr facet) +{ + Components::Cookie* res = 0; + try + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "connect SimplexReceptacle for %C started\n", port_name.c_str())); + res = inst->connect (port_name.c_str(), facet); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - connect finished\n")); + } + catch (const ::Components::InvalidName& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::InvalidName exception\n")); + throw ::Deployment::StartError("", + "Caught InvalidName exception while connecting external receptacle."); + } + catch (const ::Components::InvalidConnection& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::InvalidConnection exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught InvalidConnection exception while connecting external receptacle."); + } + catch (const ::Components::AlreadyConnected& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::AlreadyConnected exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught AlreadyConnected exception while connecting external receptacle."); + } + catch (const ::Components::ExceededConnectionLimit& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect() returned ::Components::ExceededConnectionLimit exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught ExceededConnectionLimit while connecting external receptacle."); + } + return res; +} - consumer_config->destroy (); - } - else - { - event_service->disconnect_event_supplier (sid.c_str ()); - event_service->disconnect_event_consumer (cid.c_str ()); - } +void +NodeApplication_Impl::connect_emitter (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer) +{ + Components::EventConsumerBase_var event = Components::EventConsumerBase::_unchecked_narrow (consumer); + try + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "connect_consumer for %C started\n", port_name.c_str())); + inst->connect_consumer (port_name.c_str(), event); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "connect_consumer finished\n")); + } + catch (const ::Components::InvalidName& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect_consumer() returned ::Components::InvalidName exception\n")); + throw ::Deployment::StartError("", + "Caught InvalidName while connecting emitter."); + } + catch (const ::Components::AlreadyConnected& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect_consumer() returned ::Components::AlreadyConnected exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught AlreadyConnected exception while connecting emitter"); + } + catch (const ::Components::InvalidConnection& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect_consumer() returned ::Components::InvalidConnection exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught InvalidConnection while connecting emitter."); + } +} - ACE_DEBUG ((LM_DEBUG, "CIAO::NodeApplication_Impl::build_connection () completed!!!!\n")); +void +NodeApplication_Impl::connect_emitter_ext (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer) +{ + Components::EventConsumerBase_var event = Components::EventConsumerBase::_unchecked_narrow (consumer); + try + { + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "connect_emitter_ext for %C started\n", port_name.c_str())); + inst->connect_consumer (port_name.c_str(), event); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - connect_emitter_ext finished\n")); + } + catch (const ::Components::AlreadyConnected& ) + { + DANCE_DEBUG ( (LM_WARNING, "NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect_consumer() returned ::Components::AlreadyConnected exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught AlreadyConnected exception while connecting external emitter."); + } + catch (const ::Components::InvalidConnection& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::connect_consumer() returned ::Components::InvalidConnection exception\n")); + throw ::Deployment::InvalidConnection("", + "Caught InvalidConnection exception while connecting external emitter."); + } } -bool -CIAO::NodeApplication_Impl:: -_is_es_consumer_conn (Deployment::Connection conn) +Components::Cookie* +NodeApplication_Impl::connect_publisher (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer) { - if (conn.kind == Deployment::EventConsumer && - ACE_OS::strcmp (conn.endpointPortName, "CIAO_ES") == 0) - return true; - else - return false; + DANCE_TRACE ("NodeApplication_Impl::connect_publisher"); + + if (CORBA::is_nil (inst)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::connect_publisher - " + "Provided a nil CCMObject reference while connecting port %C\n", + port_name.c_str ())); + throw ::Deployment::InvalidConnection (); + } + Components::Cookie* res = 0; + Components::EventConsumerBase_var event = Components::EventConsumerBase::_unchecked_narrow (consumer); + try + { + res = inst->subscribe (port_name.c_str(), event); + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - successfully subscribed %C\n", + port_name.c_str ())); + } + catch (const ::Components::InvalidName& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::subscribe() returned ::Components::InvalidName exception\n")); + throw ::Deployment::StartError("", "Caught InvalidName exception while connecting publisher"); + } + catch (const ::Components::InvalidConnection& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::subscribe() returned ::Components::InvalidConnection exception\n")); + throw ::Deployment::InvalidConnection("", "Caught InvalidConnection exception while connecting publisher."); + } + catch (const ::Components::ExceededConnectionLimit& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::finishLaunch - " + "Components::CCMObject_var::subscribe() returned ::Components::ExceededCOnnectionLimit exception\n")); + throw ::Deployment::InvalidConnection("", "Caught ExceededConnectionLimit exception while connecting publisher."); + } + return res; } -bool -CIAO::NodeApplication_Impl:: -_is_publisher_es_conn (Deployment::Connection conn) +void NodeApplication_Impl::create_config_values(const Deployment::Properties& prop, + Components::ConfigValues& cfg) const { - if (conn.kind == Deployment::EventPublisher && - ACE_OS::strcmp (conn.endpointPortName, "CIAO_ES") == 0) - return true; - else - return false; + ACE_CString cdmw_name = "cdmw.config."; + CORBA::ULong len = prop.length(); + unsigned int ind = 0; + for (CORBA::ULong i = 0; i < len; ++i) + { + ACE_CString s = prop[i].name.in(); + if (0 == s.find(cdmw_name)) + { + cfg.length(ind+1); + cfg[ind++] = new CIAO::ConfigValue_impl (s.substring(cdmw_name.length()).c_str(), prop[i].value); + } + } } + diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h index 70d5c1ee0fd..4bc3246d3a2 100644 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h +++ b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h @@ -1,315 +1,212 @@ -//$Id$ +// -*- C++ -*- -/**======================================================== +//============================================================================= +/** + * @file NodeApplication_Impl.h * - * @file NodeApplication_Impl.h + * $Id$ * - * @Brief This file contains the implementation of - * the NodeApplication interface. + * @Brief Implementation of Deployment::NodeApplication * - * @author Tao Lu <lu@dre.vanderbilt.edu> - * @author Gan Deng <dengg@dre.vanderbilt.edu> - *========================================================*/ + * @author Erwin Gottlieb <eg@prismtech.com> + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ +//============================================================================= -#ifndef NODEAPPLICATION_IMPL_H -#define NODEAPPLICATION_IMPL_H -#include /**/ "ace/pre.h" -#include "CIAO_NodeApplication_export.h" +#ifndef NODEAPPLICATION_IMPL_H_ +#define NODEAPPLICATION_IMPL_H_ -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "NodeApplication_Export.h" -#include "ace/Synch.h" -#include "ace/Synch_Traits.h" -#include "ace/SString.h" -#include "ace/Hash_Map_Manager_T.h" +#include "ace/Map_Manager.h" +#include "ace/Containers_T.h" #include "tao/ORB.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationS.h" -#include "ciao/Server_init.h" -#include "ciao/CIAO_common.h" -#include "ciao/Object_Set_T.h" -#include "ciaosvcs/Events/CIAO_EventService_Factory_impl.h" -#include "ciaosvcs/Events/CIAO_Events_Base/CIAO_EventsS.h" - -#include "NodeApp_Configurator.h" -#include "Session_Container.h" +#include "tao/Object.h" +#include "ccm/CCM_KeylessCCMHomeC.h" +#include "ccm/ComponentsC.h" +#include "RedirectionService/RedirectionService.h" +#include "ciao/ComponentServer/CIAO_ServerActivator_Impl.h" +//#include "Cdmw/CDMW_IDLC.h" + +#include "ccm/ComponentServer/CCM_ComponentServerC.h" +#include "Deployment/Deployment_NodeApplicationS.h" +#include "Deployment/Deployment_DeploymentPlanC.h" +#include "Deployment/DeploymentC.h" +#include "Deployment/Deployment_common.h" + +//#include "ComponentInstallation_Impl.h" +namespace DAnCE +{ -using CIAO::Utility::write_IOR; + class NodeManager_Impl; -/** - * - * @class NodeApplication_Impl - * - * @brief This class implements the NodeApplication interface. - * This interface is semantically very simillar to container - * in the old DnC spec. However this class will also be used - * as a Server for hosting home/component. This way we reduce the - * complexity of the framework by omitting the componentserver layer. - * - * @@TODO add configuration capabilities. Threading is one of them. - * - * @@Assumptions: - * 1. Now the implementation is not thread safe. - * // @@Gan, the above assumption is _really_ bad. Could you please - * use the lock in the imeplementation to do some simple - * prootections. - **/ - -namespace CIAO -{ - // @@ Gan, as we discussed before can you please wrap this - // implementation in a namespace Node_Application or whatever to - // signify that it belongs to another software piece of CIAO? - class NODEAPPLICATION_Export NodeApplication_Impl - : public virtual POA_Deployment::NodeApplication + class NodeApplication_Export NodeApplication_Impl : public virtual POA_Deployment::NodeApplication { public: - enum Component_State - { - NEW_BORN, PRE_ACTIVE, ACTIVE, POST_ACTIVE, PASSIVE, DEACTIVATED - }; + NodeApplication_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const Deployment::DeploymentPlan& plan, + RedirectionService & redirection, + const ACE_CString& node_name, + const PROPERTY_MAP &properties); - typedef struct _component_state_info - { - Components::CCMObject_var objref_; - Component_State state_; - } Component_State_Info; - - NodeApplication_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - NodeApp_Configurator &c, - const Static_Config_EntryPoints_Maps* static_entrypts_maps =0); - - /// Default destructor. - virtual ~NodeApplication_Impl (void); - - /** - * @brief This operation dose 2 things. - * 1. Get the external connction (facet and Event source) - * and connect them to the local receptacle/event sink. - * 2. If the start augment is true, start the Components. - * @Note: - * The connection containes the object ref of the provided object - * reference (facet/event consumer) of components from other NodeApplications. - * However the name field stores the name of the port on the local component. - */ - virtual void - finishLaunch (const Deployment::Connections & connections, - CORBA::Boolean start, - CORBA::Boolean add_connection); + virtual ~NodeApplication_Impl(); + + virtual void finishLaunch (const Deployment::Connections & providedReference, + ::CORBA::Boolean start); virtual void start (); - /*------------- CIAO specific IDL operations (idl)---------- - * - *-----------------------------------------------------------*/ + Deployment::Connections * getAllConnections(); - virtual void ciao_preactivate (); + //TODO Exception specification should be customized + void init_components(); - virtual void ciao_postactivate (); + void configuration_complete_components (); - virtual void ciao_passivate (); + void passivate_components (); - /// Initialize the NodeApplication - virtual CORBA::Long init (); + void remove_components (); - /// Start install homes and components. - virtual ::Deployment::ComponentInfos * - install (const ::Deployment::NodeImplementationInfo & node_impl_info); + enum ERequestType + { + eCreateComponentServer, + eCreateContainer, + eInstallHome, + eCreateComponentWithConfigValues + }; - /// Install a number of CIAO_Event_Service objects within the NA - virtual ::CIAO::CIAO_Event_Service * - install_es (const ::CIAO::DAnCE::EventServiceDeploymentDescription & es_info); + enum EInstanceType + { + eHome, + eComponent, + eHomedComponent, + eInvalid + }; - /// Get the object reference of the NodeApplicationManager. - /// This might come in handy later. - virtual ::CORBA::Object_ptr get_node_application_manager (); + enum EComponentState + { + eUninstalled, + eInstalled, + eConfigured, + eActive, + ePassive, + eRemoved, + eInvalidState + }; + + + protected: + //TODO Add throw specification + void init(); - /// Access the readonly attribute. - virtual ::Deployment::Properties * properties (); + struct Container; - /// Remove a component instance from the NodeApplication - virtual void remove_component (const char * inst_name); + struct Instance + { + Instance (EInstanceType type = eInvalid, + Container *cont = 0, + CORBA::ULong idd = 0, + CORBA::ULong mdd = 0) : + state (eUninstalled), + type (type), idd_idx (idd), mdd_idx (mdd), home(0), + container (cont) + { + } + + EComponentState state; + EInstanceType type; + CORBA::ULong idd_idx; + CORBA::ULong mdd_idx; + CORBA::Object_var ref; + Instance *home; + Container *container; + }; - virtual void activate_component (const char * name); + typedef ACE_Array<Instance> INSTANCES; + typedef ACE_Array<Instance *> INSTANCE_PTRS; - virtual void passivate_component (const char * name); + struct Container + { + INSTANCES homes; + INSTANCES components; + Deployment::Properties properties; + Components::Deployment::Container_var ref; + }; - /// Remove everything inside including all components and homes. - virtual void remove (); + typedef ACE_Array<Container> CONTAINERS; - /// Create a container interface, which will be hosted in this NodeApplication. - virtual ::Deployment::Container_ptr - create_container (const ::Deployment::Properties &properties); + struct ComponentServer + { + CONTAINERS containers; + Deployment::Properties properties; + Components::Deployment::ComponentServer_var ref; + }; - /// Remove a container interface. - virtual void remove_container (::Deployment::Container_ptr cref); + typedef ACE_Array<ComponentServer> COMPONENTSERVERS; - /// Get all container object refs - virtual ::Deployment::Containers * get_containers (); + EInstanceType get_instance_type (const Deployment::Properties& prop) const; - /*------------- CIAO specific helper functions (C++)--------- - * - *-----------------------------------------------------------*/ + void create_config_values (const Deployment::Properties& prop, + const ERequestType request, + Components::ConfigValues& cfg) const; - /// Get the containing POA. This operation does *not* - /// increase the reference count of the POA. - virtual PortableServer::POA_ptr _default_POA (void); + void create_config_values(const Deployment::Properties& prop, + Components::ConfigValues& cfg) const; - /// Return the cached object reference of this NodeApplication object. - /// This operation does *NOT* increase the reference count. - ::Deployment::NodeApplication_ptr - get_objref (); + void create_component_server (size_t index); - /*------- CIAO helper functions for pub/sub service ------- - * - *--------------------------------------------------------*/ + void create_container (size_t server, size_t container); - /// Set up a connection using the CIAO_Event_Service, which - /// is available as a field in the <Deployment::Connection> - /// struct type. - /// If <add_or_remove> input parameter is true, then we will - /// add the event connection, otherwise we will remove the - /// event connection. - void build_event_connection ( - const Deployment::Connection & connection, - bool add_or_remove); + void install_home (Container &cont, Instance &inst); - protected: - /// If <add_connection> is "false", then we shall "remove" - /// the connections, otherwise we will add these connections. - virtual void - finishLaunch_i (const Deployment::Connections & connections, - CORBA::Boolean start, - CORBA::Boolean add_connection); - virtual void - handle_facet_receptable_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection); - - virtual void - handle_emitter_consumer_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection); - - virtual void - handle_publisher_consumer_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection); - - virtual bool - _is_es_consumer_conn (Deployment::Connection conn); - - virtual bool - _is_publisher_es_conn (Deployment::Connection conn); - - /// Register the publisher to the CIAO event service - /// The only fields of <connection> struct used in this method - /// are: <type>, <event_service>, <instanceName>, <portName>. - virtual void - handle_publisher_es_connection ( - Components::CCMObject_ptr comp, - const Deployment::Connection & connection, - CORBA::Boolean add_connection); - - /// Register the consumer to the CIAO event service - virtual void - handle_es_consumer_connection ( - const Deployment::Connection & connection, - CORBA::Boolean add_connection); - - /// Create and initialize all the containers - virtual CORBA::Long create_all_containers ( - const ::Deployment::ContainerImplementationInfos & container_infos); - - /// Create a "key" for the connection - virtual ACE_CString * - create_connection_key (const Deployment::Connection & connection); - - /// To build a map between a component instance and its container - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Deployment::Container_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Component_Container_Map; - typedef Component_Container_Map::iterator Component_Container_Iterator; - Component_Container_Map component_container_map_; - - - /// To store all created Component objects as well as their lifecycle - /// states.. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Component_State_Info, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> CCMComponent_Map; - typedef CCMComponent_Map::iterator Component_Iterator; - CCMComponent_Map component_state_map_; - - /// A Map which stores all the connection cookies - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - ::Components::Cookie_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Cookie_Map; - typedef Cookie_Map::iterator Cookie_Map_Iterator; - Cookie_Map cookie_map_; - - /// Synchronize access to the object set. - TAO_SYNCH_MUTEX lock_; - - /// Keep a list of managed Container objects. - Object_Set<Deployment::Container, Deployment::Container_var> container_set_; - - /// Keep a pointer to the managing ORB serving this servant. - CORBA::ORB_var orb_; + void install_component (Container &cont, Instance &inst); - /// Keep a pointer to the managing POA. - // @@Gan/Jai, which POA is this? Same as the component POA or a - // different one. My sense is that its different. Could you please - //document it? - PortableServer::POA_var poa_; + void install_homed_component (Container &cont, Instance &inst); + + void store_instance_ior (Instance &inst); + + Components::Cookie* connect_receptacle (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr facet); + + Components::Cookie* connect_receptacle_ext (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr facet); + + void connect_emitter (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer); - // Configurator for allocating NodeApp resources and policies - NodeApp_Configurator &configurator_; + void connect_emitter_ext (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer); - /// Cached properties - Deployment::Properties properties_; + Components::Cookie* connect_publisher (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer); - /// And a reference to the NodeApplicationManager that created us. - ::CORBA::Object_var node_app_manager_; + CORBA::ORB_var orb_; - /// Cache the object reference (of ourselves). - ::Deployment::NodeApplication_var objref_; + PortableServer::POA_var poa_; - /// A factory to create CIAO event services - EventService_Factory_impl es_factory_; + const Deployment::DeploymentPlan& plan_; - /// Cache the (NA specific) installation info of all the - /// CIAO_Event_Services - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - DAnCE::EventServiceDeploymentDescriptions_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> ES_Installation_Map; - typedef ES_Installation_Map::iterator ES_Installation_Map_Iterator; - ES_Installation_Map es_info_map_; + //ComponentInstallation_Impl* installation_; + auto_ptr<CIAO::Deployment::CIAO_ServerActivator_i> activator_; - const Static_Config_EntryPoints_Maps* static_entrypts_maps_; - private: - /// Default constructor, noop - NodeApplication_Impl(void); - }; -} + RedirectionService & redirection_; -#if defined (__ACE_INLINE__) -# include "NodeApplication_Impl.inl" -#endif /* __ACE_INLINE__ */ + ACE_CString node_name_; -#include /**/ "ace/post.h" -#endif /* NODEAPPLICATION_IMPL_H */ + PROPERTY_MAP properties_; + + COMPONENTSERVERS servers_; + + INSTANCE_PTRS instances_; + + CosNaming::NamingContext_var instance_nc_; + }; +}; +#endif /*NODEAPPLICATION_IMPL_H_*/ diff --git a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl b/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl deleted file mode 100644 index 07438304994..00000000000 --- a/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ -#include "Configurator_Factory.h" - -ACE_INLINE -CIAO::NodeApplication_Impl:: -NodeApplication_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - NodeApp_Configurator &c, - const Static_Config_EntryPoints_Maps* static_entrypts_maps) - : orb_ (CORBA::ORB::_duplicate (o)), - poa_ (PortableServer::POA::_duplicate (p)), - configurator_ (c), - es_factory_ (o, p), - static_entrypts_maps_ (static_entrypts_maps) -{ -} - -// Access the readonly attribute -ACE_INLINE -Deployment::Properties * -CIAO::NodeApplication_Impl::properties () -{ - Deployment::Properties * tmp = 0; - - ACE_NEW_THROW_EX (tmp, - Deployment::Properties (this->properties_), - CORBA::NO_MEMORY ()); - - return tmp; -} - -ACE_INLINE -PortableServer::POA_ptr -CIAO::NodeApplication_Impl::_default_POA (void) -{ - return PortableServer::POA::_duplicate (this->poa_.in ()); -} - - -ACE_INLINE -CORBA::Object_ptr -CIAO::NodeApplication_Impl::get_node_application_manager () -{ - return ::CORBA::Object::_duplicate (this->node_app_manager_.in ()); -} - -/* -ACE_INLINE void -CIAO::NodeApplication_Impl:: -set_objref (Components::Deployment::ServerActivator_ptr act, - const Components::ConfigValues &config, - Components::Deployment::ComponentServer_ptr cs) -{ - if (!CORBA::is_nil (this->node_app_manager_.in ()) || - !CORBA::is_nil (this->objref_.in ())) - throw CORBA::BAD_INV_ORDER (); - - this->config_ = new Components::ConfigValues (config); - this->activator_ = Components::Deployment::ServerActivator::_duplicate (act); - this->objref_ = Components::Deployment::ComponentServer::_duplicate (cs); -} -*/ - -ACE_INLINE ::Deployment::NodeApplication_ptr -CIAO::NodeApplication_Impl:: -get_objref () -{ - if (CORBA::is_nil (this->objref_.in ())) - { - this->objref_ = this->_this (); - } - - return this->objref_.in (); -} diff --git a/CIAO/DAnCE/NodeApplication/RTConfig_Manager.cpp b/CIAO/DAnCE/NodeApplication/RTConfig_Manager.cpp deleted file mode 100644 index 0f400349237..00000000000 --- a/CIAO/DAnCE/NodeApplication/RTConfig_Manager.cpp +++ /dev/null @@ -1,513 +0,0 @@ -// $Id$ - -#include "RTConfig_Manager.h" -#include "ciao/CIAO_common.h" -#include "ace/SString.h" - -#if !defined (__ACE_INLINE__) -# include "RTConfig_Manager.inl" -#endif /* __ACE_INLINE__ */ - -void -CIAO::RTResource_Config_Manager::init (CORBA::ORB_ptr orb) -{ - CORBA::Object_var object = - orb->resolve_initial_references ("RTORB"); - this->rtorb_ = RTCORBA::RTORB::_narrow (object.in ()); -} - -int -CIAO::RTResource_Config_Manager::pre_orb_initialize (void) -{ - return 0; -} - -int -CIAO::RTResource_Config_Manager::post_orb_initialize (CORBA::ORB_ptr) -{ - return 0; -} - -void -CIAO::RTResource_Config_Manager::print_resources -(const CIAO::DAnCE::ServerResource &server_resource) -{ - const CIAO::DAnCE::ORBResource &orb_resource - = server_resource.orb_config.orb_resources[0]; - - CORBA::ULong i; - - // Creating and binding name with RT Threadpool - for (i = 0; i < orb_resource.threadpool_list.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, - "-RTResource_Config_Manager::print_resource threadpool: %s\n" - "\tStack size: %d\n" - "\tStatic: %d\n" - "\tDynamic %d\n" - "\tDefault Prio: %d\n" - "\tBuffering %s\n" - "\tMax Buffered: %d\n" - "\tBuffer Size %d\n", - orb_resource.threadpool_list[i].Id.in (), - orb_resource.threadpool_list[i].stacksize, - orb_resource.threadpool_list[i].static_threads, - orb_resource.threadpool_list[i].dynamic_threads, - orb_resource.threadpool_list[i].default_priority, - (orb_resource.threadpool_list[i].allow_request_buffering ? "Y" : "N"), - orb_resource.threadpool_list[i].max_buffered_requests, - orb_resource.threadpool_list[i].max_request_buffer_size)); - } - - for (i = 0; i < orb_resource.threadpool_with_lanes_list.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, - "-RTResource_Config_Manager::print_resource threadpool_with %d, lanes: %s\n", - orb_resource.threadpool_with_lanes_list[i].threadpool_lanes.length (), - orb_resource.threadpool_with_lanes_list[i].Id.in ())); - - for (CORBA::ULong l = 0; - l < orb_resource.threadpool_with_lanes_list[i].threadpool_lanes.length (); - ++l) - { - ACE_DEBUG ((LM_DEBUG, - "\tLane %d:\n" - "\t\tPriority: %d\n" - "\t\tStatic: %d\n" - "\t\tDynamic: %d\n", - l, - orb_resource.threadpool_with_lanes_list[i].threadpool_lanes[l].lane_priority, - orb_resource.threadpool_with_lanes_list[i].threadpool_lanes[l].static_threads, - orb_resource.threadpool_with_lanes_list[i].threadpool_lanes[l].dynamic_threads)); - } - ACE_DEBUG ((LM_DEBUG, - "\tStack size: %d\n" - "\tBorrowing: %s\n" - "\tBuffering %s\n" - "\tMax Buffered: %d\n" - "\tBuffer Size %d\n", - orb_resource.threadpool_with_lanes_list[i].stacksize, - (orb_resource.threadpool_with_lanes_list[i].allow_borrowing ? "Y" : "N"), - (orb_resource.threadpool_with_lanes_list[i].allow_request_buffering ? "Y" : "N"), - orb_resource.threadpool_with_lanes_list[i].max_buffered_requests, - orb_resource.threadpool_with_lanes_list[i].max_request_buffer_size)); - } - - for (i = 0; i < orb_resource.connection_bands_list.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, - "-RTResource_Config_Manager::print_resource connection %d bands: %s\n", - orb_resource.connection_bands_list[i].bands.length (), - orb_resource.connection_bands_list[i].Id.in ())); - - for (CORBA::ULong l = 0; - l < orb_resource.connection_bands_list[i].bands.length (); - ++l) - { - ACE_DEBUG ((LM_DEBUG, - "\tBand %d Prio: %d -- %d\n", - l, - orb_resource.connection_bands_list[i].bands[l].low, - orb_resource.connection_bands_list[i].bands[l].high)); - } - } -} - -void -CIAO::RTResource_Config_Manager::init_resources -(const CIAO::DAnCE::ServerResource &server_resource) -{ - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource.\n")); - - if (CORBA::is_nil (this->rtorb_.in())) - { - ACE_ERROR ((LM_ERROR, - "RTResource_Config_Manager has not been properly initialized.\n")); - throw CORBA::INTERNAL (); - } - - this->print_resources (server_resource); - // return; - - const CIAO::DAnCE::ORBResource &orb_resource - = server_resource.orb_config.orb_resources[0]; - - CORBA::ULong i; - - // Creating and binding name with RT Threadpool - for (i = 0; i < orb_resource.threadpool_list.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource threadpool: %s\n", - orb_resource.threadpool_list[i].Id.in ())); - RTCORBA::ThreadpoolId thr_id = - this->rtorb_->create_threadpool - (orb_resource.threadpool_list[i].stacksize, - orb_resource.threadpool_list[i].static_threads, - orb_resource.threadpool_list[i].dynamic_threads, - orb_resource.threadpool_list[i].default_priority, - orb_resource.threadpool_list[i].allow_request_buffering, - orb_resource.threadpool_list[i].max_buffered_requests, - orb_resource.threadpool_list[i].max_request_buffer_size); - // Simply pass back the exception here - // for now. We need to have a better way - // to handle execption here. - if (this->threadpool_map_.bind (orb_resource.threadpool_list[i].Id.in (), - thr_id) != 0) - { - ACE_ERROR ((LM_ERROR, "Error binding thread pool Id: %s to map when initializing RTNodeApplication resources.\n", orb_resource.threadpool_list[i].Id.in ())); - throw CORBA::INTERNAL (); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource added thread pool: %s\n", - orb_resource.threadpool_list[i].Id.in ())); - } - } - - for (i = 0; i < orb_resource.threadpool_with_lanes_list.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource threadpool_with %d, lanes: %s\n", - orb_resource.threadpool_with_lanes_list[i].threadpool_lanes.length (), - orb_resource.threadpool_with_lanes_list[i].Id.in ())); - - // Duplicate RTCORBA lanes - RTCORBA::ThreadpoolLanes lanes - (orb_resource.threadpool_with_lanes_list[i].threadpool_lanes.length ()); - lanes.length (orb_resource.threadpool_with_lanes_list[i].threadpool_lanes.length ()); - - for (CORBA::ULong l = 0; - l < orb_resource.threadpool_with_lanes_list[i].threadpool_lanes.length (); - ++l) - { - lanes[l].lane_priority - = orb_resource.threadpool_with_lanes_list[i].threadpool_lanes[l].lane_priority; - lanes[l].static_threads - = orb_resource.threadpool_with_lanes_list[i].threadpool_lanes[l].static_threads; - lanes[l].dynamic_threads - = orb_resource.threadpool_with_lanes_list[i].threadpool_lanes[l].dynamic_threads; - } - - RTCORBA::ThreadpoolId thr_id = - this->rtorb_->create_threadpool_with_lanes - (orb_resource.threadpool_with_lanes_list[i].stacksize, - lanes, - orb_resource.threadpool_with_lanes_list[i].allow_borrowing, - orb_resource.threadpool_with_lanes_list[i].allow_request_buffering, - orb_resource.threadpool_with_lanes_list[i].max_buffered_requests, - orb_resource.threadpool_with_lanes_list[i].max_request_buffer_size); - // Simply pass back the exception here - // for now. We need to have a better way - // to handle execption here. - - if (this->threadpool_map_.bind (orb_resource.threadpool_with_lanes_list[i].Id.in (), - thr_id) != 0) - { - ACE_ERROR ((LM_ERROR, - "Error binding thread pool name: %s to map when " - "initializing RTNodeApplication resources.\n", - orb_resource.threadpool_with_lanes_list[i].Id.in ())); - throw CORBA::INTERNAL (); - } - - else - { - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource added thread pool with lanes: %s\n", - orb_resource.threadpool_with_lanes_list[i].Id.in ())); - } - } - - for (i = 0; i < orb_resource.connection_bands_list.length (); ++i) - { - RTCORBA::PriorityBands - safebands(orb_resource.connection_bands_list[i].bands.length ()); - safebands.length (orb_resource.connection_bands_list[i].bands.length ()); - - for (CORBA::ULong l = 0; - l < orb_resource.connection_bands_list[i].bands.length (); - ++l) - { - safebands[l].low = orb_resource.connection_bands_list[i].bands[l].low; - safebands[l].high = orb_resource.connection_bands_list[i].bands[l].high; - } - - if (this->priority_bands_map_.bind (orb_resource.connection_bands_list[i].Id.in (), - safebands) != 0) - { - ACE_ERROR ((LM_ERROR, - "Error binding priority bands name: %s to map " - "when initializing RTNodeApplication resources.\n", - orb_resource.connection_bands_list[i].Id.in ())); - throw CORBA::INTERNAL (); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource added connection bands: %s\n", - orb_resource.connection_bands_list[i].Id.in ())); - } - } - - // now initialize the policy set part of it. - // server_resource.orb_config.policy_set - const CIAO::DAnCE::PolicySets &sets = server_resource.orb_config.policy_set; - for (CORBA::ULong i = 0; i < sets.length (); ++i) - { - CORBA::ULong const np = sets[i].policies.length (); - if (np == 0) - continue; - - CORBA::PolicyList_var policy_list = new CORBA::PolicyList (np); - policy_list->length (np); - CORBA::ULong index = 0; - CORBA::ULong array_index = np; - - // Create a list of policies - for (CORBA::ULong pc = 0; pc < np; ++pc) - { - CORBA::Policy_var temp_policy = - this->create_single_policy (sets[i].policies[pc]); - if (CORBA::is_nil (temp_policy.in ())) - { - array_index = array_index - 1; - policy_list->length (array_index); - } - else - { - policy_list[index] = CORBA::Policy::_duplicate (temp_policy.in ()); - index = index + 1; - } - } - - // Bind the policy list to the name. The bind operation should - // surrender the ownership of the newly created PolicyList - // sequence to the map. - if (array_index != 0) - { - if (this->policy_map_.bind (sets[i].Id.in (), - policy_list._retn ()) != 0) - { - ACE_ERROR ((LM_ERROR, - "Error binding Policy_Set with name: %s\n", - sets[i].Id.in ())); - throw CORBA::INTERNAL (); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource " - "added policy set: %s with %d policies\n", - sets[i].Id.in (), array_index)); - } - } - else - { - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::init_resource " - "added policy set: %s with %d policies\n", - sets[i].Id.in (), array_index)); - } - } -} - -void -CIAO::RTResource_Config_Manager::fini () -{ - TP_MAP::ITERATOR iter = this->threadpool_map_.begin (); - TP_MAP::ITERATOR end = this->threadpool_map_.end (); - - for (; iter != end; ++iter) - { - this->rtorb_->destroy_threadpool ((*iter).int_id_); - } - -} - -RTCORBA::ThreadpoolId -CIAO::RTResource_Config_Manager::find_threadpool_by_name (const char *name) -{ - if (name == 0) - { - ACE_ERROR ((LM_ERROR, - "Invalid name string found in \"find_threadpool_by_name\"\n")); - throw CORBA::BAD_PARAM (); - } - - - RTCORBA::ThreadpoolId ret_id = 0; // return id - - if (this->threadpool_map_.find (name, ret_id) != 0) - { - ACE_ERROR ((LM_ERROR, - "Unable to find a threadpool named %s\n", - name)); - throw CORBA::INTERNAL (); - } - - return ret_id; -} - -RTCORBA::PriorityBands * -CIAO::RTResource_Config_Manager::find_priority_bands_by_name (const char *name) -{ - if (name == 0) - { - ACE_ERROR ((LM_ERROR, - "Invalid name string found in \"find_priority_bands_by_name\"\n")); - throw CORBA::BAD_PARAM (); - } - - PB_MAP::ENTRY *entry = 0; - - if (this->priority_bands_map_.find (name, entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "Unable to find a connection bands named %s\n", - name)); - throw CORBA::INTERNAL (); - } - - RTCORBA::PriorityBands_var retv = new RTCORBA::PriorityBands; - (*retv.ptr ()) = (*entry->int_id_.ptr ()); - return retv._retn (); -} - -bool -CIAO::RTResource_Config_Manager::policy_exists (const char *name) -{ - if (name == 0) - { - ACE_DEBUG ((LM_DEBUG, - "Invalid name string found in " - "CIAO::NAResource_Config_Manager::policy_exists\n")); - throw CORBA::INTERNAL (); - } - - POLICY_MAP::ENTRY *entry = 0; - - if (this->policy_map_.find (name, entry) != 0) - { - return false; - } - - return true; -} - -CORBA::PolicyList * -CIAO::RTResource_Config_Manager::find_policies_by_name (const char *name) -{ - if (name == 0) - { - ACE_ERROR ((LM_ERROR, - "Invalid name string found in \"find_policies_by_name\"\n")); - throw CORBA::BAD_PARAM (); - } - - - ACE_DEBUG ((LM_DEBUG, "RTResource_Config_Manager::find_policies_by_name: %s\n", - name)); - - POLICY_MAP::ENTRY *entry = 0; - - if (this->policy_map_.find (name, entry) != 0) - { - ACE_ERROR ((LM_ERROR, - "Unable to find a PolicyList named %s\n", - name)); - throw CORBA::INTERNAL (); - } - - // duplicate the sequence PolicyList. - CORBA::PolicyList_var retv = - new CORBA::PolicyList (entry->int_id_.in ()); - - ACE_DEBUG ((LM_DEBUG, "RTResource_Config_Manager::find_policies_by_name ok.\n")); - - return retv._retn (); -} - -CORBA::Policy_ptr -CIAO::RTResource_Config_Manager::create_single_policy -(const CIAO::DAnCE::PolicyDef &policy_def) -{ - // if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, - "RTResource_Config_Manager::create_single_policy: %d\n", - policy_def._d ())); - - CORBA::Policy_var retv; - - switch (policy_def._d ()) - { - case RTCORBA::PRIORITY_MODEL_POLICY_TYPE: - { - const CIAO::DAnCE::PriorityModelPolicyDef &tmp - = policy_def.PriorityModelDef (); - - retv = this->rtorb_->create_priority_model_policy ((RTCORBA::PriorityModel) tmp.priority_model, - tmp.server_priority); - - if (! CORBA::is_nil (retv.in ())) - ACE_DEBUG ((LM_DEBUG, - "Create PriorityModel policy: %d - %d\n", - tmp.priority_model, tmp.server_priority)); - } - break; - - case RTCORBA::THREADPOOL_POLICY_TYPE: - { - RTCORBA::ThreadpoolId tpid = - this->find_threadpool_by_name (policy_def.ThreadpoolDef().Id.in ()); - - retv = this->rtorb_->create_threadpool_policy (tpid); - - if (! CORBA::is_nil (retv.in ())) - ACE_DEBUG ((LM_DEBUG, - "Create Threadpool policy: %s, TPid: %d\n", - policy_def.ThreadpoolDef().Id.in (), tpid)); - } - break; - - case RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE: - { - RTCORBA::PriorityBands_var bands = - this->find_priority_bands_by_name (policy_def.PriorityBandedConnectionDef().Id.in ()); - - retv = - this->rtorb_->create_priority_banded_connection_policy (bands.in ()); - - if (! CORBA::is_nil (retv.in ())) - { - ACE_DEBUG ((LM_DEBUG, - "Created Banded Connection policy: %s\n", - policy_def.PriorityBandedConnectionDef().Id.in ())); - } - } - break; - - default: - retv = 0; - } - - return retv._retn (); -} - -CIAO::RTResource_Config_Manager::~RTResource_Config_Manager () -{ - this->fini (); -} - -extern "C" CIAO_RTNA_Configurator_Export CIAO::Config_Manager -*create_rt_config_manager (void); - -CIAO::Config_Manager * -create_rt_config_manager (void) -{ - CIAO::RTResource_Config_Manager *config; - ACE_NEW_RETURN (config, CIAO::RTResource_Config_Manager, 0); - return config; -} diff --git a/CIAO/DAnCE/NodeApplication/RTConfig_Manager.h b/CIAO/DAnCE/NodeApplication/RTConfig_Manager.h deleted file mode 100644 index 53ca9de018a..00000000000 --- a/CIAO/DAnCE/NodeApplication/RTConfig_Manager.h +++ /dev/null @@ -1,134 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file RTConfig_Manager.h - * - * $Id$ - * - * This file contains classes that manage name to configuration - * mapping info in a RTComponentServer. - * - * @author Nanbor Wang <nanbor@cs.wustl.edu> - */ -//============================================================================= - - -#ifndef CIAO_RTCONFIG_MANAGER_H -#define CIAO_RTCONFIG_MANAGER_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/RTCORBA/RTCORBA.h" -#include "DAnCE/Deployment/CIAO_ServerResourcesC.h" -#include "ace/Null_Mutex.h" -#include "ace/SString.h" -#include "ace/Hash_Map_Manager_T.h" -#include "Config_Manager.h" -#include "RTNA_Configurator_Export.h" - -namespace CIAO -{ - /** - * @brief RTResource_Config_Manager maintains a collection of - * RTCORBA related resources. - * - * This class is responsible to create and manage a list of RTCORBA - * related resources that are global to an RT ComponentServer. The - * information required to create and configure these resources are - * passed in via the @a info argument in the @c init method. These - * resources are identified by names and can be used to associate - * these resources with related RTPolicies. These resources are - * destoryed along with this class. - * - * Currently, the only resources supported (and managed) by this - * class are Threadpool and Threadpool_with_Lanes. - */ - class RTResource_Config_Manager : public Config_Manager - { - public: - RTResource_Config_Manager (void); - ~RTResource_Config_Manager (void); - - virtual void init (CORBA::ORB_ptr orb); - - virtual int pre_orb_initialize (void); - - virtual int post_orb_initialize (CORBA::ORB_ptr o); - - /// Initializing the RTResource_Config_Manager - virtual void init_resources (const CIAO::DAnCE::ServerResource &info); - - /// Finalizing the RTResource_Config_Manager and the resources it - /// manages. - void fini (); - - /// Query a policy set by name - virtual CORBA::PolicyList *find_policies_by_name (const char *name); - - virtual bool policy_exists (const char *name); - - protected: - void print_resources (const CIAO::DAnCE::ServerResource &info); - - /// Query a thread pool by name. - RTCORBA::ThreadpoolId find_threadpool_by_name (const char *name); - - - /// Query a priority bands info by name. - RTCORBA::PriorityBands *find_priority_bands_by_name (const char *name); - - private: - /// Cached an ORB reference. - CORBA::ORB_var orb_; - - // Cached an RTORB reference. - RTCORBA::RTORB_var rtorb_; - - /// Hash_Map stuff. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - RTCORBA::ThreadpoolId, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> TP_MAP; - - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - RTCORBA::PriorityBands_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> PB_MAP; - - /// Internal TP name to id map. - TP_MAP threadpool_map_; - - /// Internal PB name to priority bands map. - PB_MAP priority_bands_map_; - - /// create a single policy - CORBA::Policy_ptr create_single_policy - (const CIAO::DAnCE::PolicyDef &policy_def); - - /// Hash_Map stuff. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - CORBA::PolicyList_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> POLICY_MAP; - - /// Internal TP names to id map. - POLICY_MAP policy_map_; - }; -} - -#if defined (__ACE_INLINE__) -# include "RTConfig_Manager.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* CIAO_RTCONFIG_MANAGER_H */ - diff --git a/CIAO/DAnCE/NodeApplication/RTConfig_Manager.inl b/CIAO/DAnCE/NodeApplication/RTConfig_Manager.inl deleted file mode 100644 index 7962506555d..00000000000 --- a/CIAO/DAnCE/NodeApplication/RTConfig_Manager.inl +++ /dev/null @@ -1,7 +0,0 @@ -// $Id$ - -ACE_INLINE -CIAO::RTResource_Config_Manager::RTResource_Config_Manager () -{ -} - diff --git a/CIAO/DAnCE/NodeApplication/RTNA_Configurator_Export.h b/CIAO/DAnCE/NodeApplication/RTNA_Configurator_Export.h deleted file mode 100644 index 689a871c7e5..00000000000 --- a/CIAO/DAnCE/NodeApplication/RTNA_Configurator_Export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl CIAO_RTNA_Configurator -// ------------------------------ -#ifndef CIAO_RTNA_CONFIGURATOR_EXPORT_H -#define CIAO_RTNA_CONFIGURATOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_RTNA_CONFIGURATOR_HAS_DLL) -# define CIAO_RTNA_CONFIGURATOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && CIAO_RTNA_CONFIGURATOR_HAS_DLL */ - -#if !defined (CIAO_RTNA_CONFIGURATOR_HAS_DLL) -# define CIAO_RTNA_CONFIGURATOR_HAS_DLL 1 -#endif /* ! CIAO_RTNA_CONFIGURATOR_HAS_DLL */ - -#if defined (CIAO_RTNA_CONFIGURATOR_HAS_DLL) && (CIAO_RTNA_CONFIGURATOR_HAS_DLL == 1) -# if defined (CIAO_RTNA_CONFIGURATOR_BUILD_DLL) -# define CIAO_RTNA_Configurator_Export ACE_Proper_Export_Flag -# define CIAO_RTNA_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define CIAO_RTNA_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* CIAO_RTNA_CONFIGURATOR_BUILD_DLL */ -# define CIAO_RTNA_Configurator_Export ACE_Proper_Import_Flag -# define CIAO_RTNA_CONFIGURATOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define CIAO_RTNA_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* CIAO_RTNA_CONFIGURATOR_BUILD_DLL */ -#else /* CIAO_RTNA_CONFIGURATOR_HAS_DLL == 1 */ -# define CIAO_RTNA_Configurator_Export -# define CIAO_RTNA_CONFIGURATOR_SINGLETON_DECLARATION(T) -# define CIAO_RTNA_CONFIGURATOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* CIAO_RTNA_CONFIGURATOR_HAS_DLL == 1 */ - -// Set CIAO_RTNA_CONFIGURATOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (CIAO_RTNA_CONFIGURATOR_NTRACE) -# if (ACE_NTRACE == 1) -# define CIAO_RTNA_CONFIGURATOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define CIAO_RTNA_CONFIGURATOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !CIAO_RTNA_CONFIGURATOR_NTRACE */ - -#if (CIAO_RTNA_CONFIGURATOR_NTRACE == 1) -# define CIAO_RTNA_CONFIGURATOR_TRACE(X) -#else /* (CIAO_RTNA_CONFIGURATOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define CIAO_RTNA_CONFIGURATOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (CIAO_RTNA_CONFIGURATOR_NTRACE == 1) */ - -#endif /* CIAO_RTNA_CONFIGURATOR_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/NodeApplication/RTNodeApp_Configurator.cpp b/CIAO/DAnCE/NodeApplication/RTNodeApp_Configurator.cpp deleted file mode 100644 index 04e7bd91f74..00000000000 --- a/CIAO/DAnCE/NodeApplication/RTNodeApp_Configurator.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// $Id$ - -#include "RTNodeApp_Configurator.h" -#include "DAnCE/Deployment/CIAO_ServerResourcesC.h" -#include "tao/RTPortableServer/RTPortableServer.h" - -CIAO::RTNodeApp_Configurator::~RTNodeApp_Configurator () -{ -} - -int -CIAO::RTNodeApp_Configurator::pre_orb_initialize () -{ - ACE_DEBUG ((LM_DEBUG, "RTNodeApp_Configurator::pre_orb_init\n")); - - return 0; -} - -int -CIAO::RTNodeApp_Configurator::post_orb_initialize (CORBA::ORB_ptr o) -{ - ACE_DEBUG ((LM_DEBUG, "RTNodeApp_Configurator::post_orb_init\n")); - - this->orb_ = CORBA::ORB::_duplicate (o); - - CORBA::Object_var object = - this->orb_->resolve_initial_references ("RTORB"); - - this->rtorb_ = - RTCORBA::RTORB::_narrow (object.in ()); - - this->config_manager_.init (this->rtorb_.in ()); - - return 0; -} - -int -CIAO::RTNodeApp_Configurator::init_resource_manager -(const ::Deployment::Properties &properties) -{ - - // if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, "RTNodeApp_Configurator::init_resource_manager\n")); - // @@ Should we cache the properties that we consumed here? - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - // if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, "RTNodeApp_Configurator::init_resource_manager processing property: %s\n", - properties[i].name.in ())); - - if (ACE_OS::strcmp ("CIAOServerResources", properties[i].name.in ()) == 0) - { - const CIAO::DAnCE::ServerResource *svr_resource; - if (properties[i].value >>= svr_resource) - { - this->config_manager_.init_resources (*svr_resource); - // Now we have the information to initialize the manager. - } - else - ACE_ERROR_RETURN ((LM_ERROR, - "ERROR: RTNodeApp_Configurator::init_resource_manager unable to extract CIAOServerResources\n"), -1); - } - - // Ignore other stuff - } - - return 0; -} - -CORBA::PolicyList * -CIAO::RTNodeApp_Configurator::find_container_policies -(const ::Deployment::Properties &properties) -{ - ACE_DEBUG ((LM_DEBUG, "RTNodeApp_Configurator::find_container_policies\n")); - // @@ Should we cache the properties that we consumed here? - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, "RTNodeApp_Configurator::find_container_policies processing property: %s\n", - properties[i].name.in ())); - - if (ACE_OS::strcmp ("ContainerPolicySet", properties[i].name) == 0) - { - const char *policy_name = 0; - if (properties[i].value >>= policy_name) - { - return this->config_manager_.find_policies_by_name (policy_name); - } - else - ACE_ERROR_RETURN ((LM_ERROR, - "ERROR: RTNodeApp_Configurator::find_container_policies unable to extract ContainerPolicySet\n"), 0); - } - } - - return 0; -} - - -extern "C" CIAO_RTNA_Configurator_Export CIAO::NodeApp_Configurator *create_nodeapp_configurator (void); - -CIAO::NodeApp_Configurator * -create_nodeapp_configurator (void) -{ - CIAO::RTNodeApp_Configurator *config = 0; - ACE_NEW_RETURN (config, CIAO::RTNodeApp_Configurator, 0); - return config; -} diff --git a/CIAO/DAnCE/NodeApplication/RTNodeApp_Configurator.h b/CIAO/DAnCE/NodeApplication/RTNodeApp_Configurator.h deleted file mode 100644 index fc2388b6aff..00000000000 --- a/CIAO/DAnCE/NodeApplication/RTNodeApp_Configurator.h +++ /dev/null @@ -1,78 +0,0 @@ -// $Id$ -/**======================================================== - * - * @file RTNodeApp_Configurator.h - * - * @Brief This file contains the implementation of - * the RTNodeApp_Configurator, a concrete NodeApp_Configurator for - * setting up real-time support for NodeApplication. - * - * - * @author Nanbor Wang <nanbor@exothermic.txcorp.com> - *========================================================*/ - -#ifndef RTNODEAPP_CONFIGURATOR_H -#define RTNODEAPP_CONFIGURATOR_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "NodeApp_Configurator.h" -#include "RTNA_Configurator_Export.h" -#include "tao/RTCORBA/RTCORBA.h" -#include "RTConfig_Manager.h" - -namespace CIAO -{ - /** - * @class RTNodeApp_Configurator - * - * @brief This class implements a concrete NodeApp_Configurator for - * setting up the NodeApplication process for RT support. - **/ - class CIAO_RTNA_Configurator_Export RTNodeApp_Configurator : - public NodeApp_Configurator - { - public: - /// Default destructor. - virtual ~RTNodeApp_Configurator (void); - - /** - * @brief "pre_orb_initialize" is called before ORB_init. - */ - virtual int pre_orb_initialize (void); - - /** - * @brief "initialize" is called after NodeApplication get a hold - * at this object. - */ - virtual int post_orb_initialize (CORBA::ORB_ptr o); - - /** - * @brief "init_resource_manager" is called by NodeApplication when - * it receives an "install" commands. - */ - virtual int - init_resource_manager (const ::Deployment::Properties &properties); - - /** - * @brief get a policyset by its name. - */ - virtual CORBA::PolicyList * - find_container_policies (const ::Deployment::Properties &properties); - - protected: - CORBA::ORB_var orb_; - - RTCORBA::RTORB_var rtorb_; - - RTResource_Config_Manager config_manager_; - }; -} - -#include /**/ "ace/post.h" -#endif /* RTNODEAPP_CONFIGURATOR_H */ diff --git a/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.cpp b/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.cpp new file mode 100644 index 00000000000..541457a9afe --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.cpp @@ -0,0 +1,249 @@ +// $Id$ + +#include "ServerActivator_Impl.h" +#include "Cdmw/CDMW_IDL_ExtC.h" +#include "DAnCE/Logger/Log_Macros.h" + +const char* COMPONENT_SERVER_NAME = "ComponentServer"; + +bool read_config_value (const ACE_CString & name, + const Components::ConfigValues & config, + CORBA::Any_out value) +{ + bool found = false; + CORBA::ULong const len = config.length(); + for (CORBA::ULong count = 0; count < len; ++count) + { + if (name.compare (config[count]->name()) == 0) + { + value = new CORBA::Any (config[count]->value()); + found = true; + break; + } + } + + return found; +} + +using namespace DAnCE; + +ServerActivator_Impl::ServerActivator_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + Components::Deployment::ComponentInstallation_ptr compInst) + : orb_ (CORBA::ORB::_duplicate (orb)) + , poa_ (PortableServer::POA::_duplicate (poa)) + , compInst_ (Components::Deployment::ComponentInstallation::_duplicate (compInst)) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::ServerActivator_Impl - started\n")); + + CORBA::Object_var obj = + this->orb_->resolve_initial_references ("ProcessDestinationNC"); + if (CORBA::is_nil(obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] ServerActivator_Impl::ServerActivator_Impl - Failed to retrieve the \"ProcessDestinationNC\" object.\n")); + throw CORBA::ORB::InvalidName(); + } + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::ServerActivator_Impl name service reference received\n")); + try + { + this->naming_ = CosNaming::NamingContext::_narrow (obj); + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] ServerActivator_Impl::ServerActivator_Impl - failed to narrow the \"ProcessDestinationNC\" NC.\n")); + throw; + } + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::ServerActivator_Impl - finished\n")); +} + +ServerActivator_Impl::~ServerActivator_Impl() +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::~ServerActivator_Impl - started\n")); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::~ServerActivator_Impl - finished\n")); +} + +::Components::Deployment::ComponentServer_ptr +ServerActivator_Impl::create_component_server (const ::Components::ConfigValues & config) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::create_component_server - started\n")); + + // NOTA: These are the configuration values understood by the server activator + // for component server creation + // + // +====================================+=============================+ + // | Config Name | Type | + // +====================================+=============================+ + // | PROCESS_DESTINATION (*) | string | + // +------------------------------------+-----------------------------+ + // + // (*) compulsory + // + //Extracting process destination + ACE_CString processDest; + { + CORBA::Any_var processDestAny; + + if (read_config_value (Components::PROCESS_DESTINATION, config, processDestAny)) + { + const char* szProcessDest = 0; + processDestAny.in() >>= szProcessDest; + processDest = szProcessDest; + } + else + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::create_component_server - read_config_value() function fails\n")); + throw ::Components::Deployment::InvalidConfiguration(); + } + } + ::Components::Deployment::ComponentServer_var srv; + if (0 == this->servers_.find (processDest, srv)) + { + return srv._retn();//::Components::Deployment::ComponentServer::_duplicate (srv.in()); + } + //Looking for ComponentServer + ACE_CString processName = processDest + "." + COMPONENT_SERVER_NAME; + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup (processDest.c_str()); + name[0].kind = CORBA::string_dup (COMPONENT_SERVER_NAME); + CORBA::Object_var obj; + CosNaming::NamingContext_var naming; + try + { + obj = this->naming_->resolve (name); + } + catch (const CosNaming::NamingContext::NotFound& ) + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::create_component_server - NotFound exception rised." + "(Name : CDMW/SERVICES/ASSEMBLYANDDEPLOYMENT/%C)\n" + , processDest.c_str())); + throw ::Components::CreateFailure(); + } + catch (const CosNaming::NamingContext::CannotProceed& ) + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::create_component_server - NotFound exception rised." + "(Name : CDMW/SERVICES/ASSEMBLYANDDEPLOYMENT/%C)\n" + , processDest.c_str())); + throw ::Components::CreateFailure(); + } + catch (const CosNaming::NamingContext::InvalidName& ) + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::create_component_server - NotFound exception rised." + "(Name : CDMW/SERVICES/ASSEMBLYANDDEPLOYMENT/%C)\n" + , processDest.c_str())); + throw ::Components::CreateFailure(); + } + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::create_component_server - ComponentServer object resolved\n")); + //Casting founded object + ::Components::Deployment::ComponentServer_var server + = ::Components::Deployment::ComponentServer::_narrow (obj); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::create_component_server - ComponentServer object narrowed\n")); + if (CORBA::is_nil (server)) + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::create_component_server - ComponentServer in process destination %s could not be contacted\n", processDest.c_str())); + throw ::Components::CreateFailure (::Components::COMPONENT_SERVER_NOT_FOUND); + } + + //ComponentServer initialization by ServerActivator and ComponentInstallation references + this->initializeComponentServer (server.in()); + + //Saving server reference + //TODO add checking on already present component server with exception CdmwDeployment::COMPONENT_SERVER_ALREADY_CREATED + if (0 != this->servers_.bind (processDest, ::Components::Deployment::ComponentServer::_duplicate (server.in()))) + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::create_component_server - ComponentServer in process destination %s already exists.\n", processDest.c_str())); + throw ::Components::CreateFailure (::Components::COMPONENT_SERVER_ALREADY_CREATED); + } + + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::create_component_server - finished\n")); + return server._retn (); +} + +void +ServerActivator_Impl::remove_component_server (::Components::Deployment::ComponentServer_ptr server) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::remove_component_server - started\n")); + + // Checking input parameters + if (CORBA::is_nil (server)) + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::remove_component_server - Wrong input parameter\n")); + throw CORBA::BAD_PARAM(); + } + + // find equivalent server in servers list + bool bFound = false; + for (TCompServers::iterator iter = this->servers_.begin(); + iter != this->servers_.end(); + ++iter) + { + if (server->_is_equivalent ( (*iter).int_id_.in())) + { + // remove ComponentServer from list + this->servers_.unbind ( (*iter).ext_id_); + bFound = true; + break; + } + } + + // if no equivalent found, throw exception + if (!bFound) + { + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::remove_component_server - equivalent server cannot be found in servers list\n")); + throw ::Components::RemoveFailure (::Components::UNKNOWN_COMPONENT_SERVER); + } + + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::remove_component_server - finished\n")); +} + +::Components::Deployment::ComponentServers * +ServerActivator_Impl::get_component_servers () +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::get_component_servers - started\n")); + + ::Components::Deployment::ComponentServers* pServers = 0; + ACE_NEW_THROW_EX (pServers, + ::Components::Deployment::ComponentServers (this->servers_.current_size()), + CORBA::NO_MEMORY()); + int i = 0; + for (TCompServers::iterator iter = this->servers_.begin(); + iter != this->servers_.end(); + ++iter) + { + (*pServers) [i] = ::Components::Deployment::ComponentServer::_duplicate ( (*iter).int_id_.in()); + i++; + } + + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::get_component_servers - finished\n")); + return pServers; +} + +void +ServerActivator_Impl::initializeComponentServer (::Components::Deployment::ComponentServer_ptr server) +{ + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::initializeComponentServer - started\n")); + + // the ComponentServer should be a Cdmw ComponentServer + Components::Deployment::ComponentServer_var cdmwServer = + Components::Deployment::ComponentServer::_narrow (server); + + if (CORBA::is_nil (cdmwServer.in ()) + { + // Component server is not Cdmw ComponentServer + DANCE_ERROR ( (LM_ERROR, "[%M] ServerActivator_Impl::initializeComponentServer - ComponentServer is not CdmwComponentServer\n")); + throw ::Components::CreateFailure (::Components::COMPONENT_SERVER_NOT_FOUND); + } + if (CORBA::is_nil (this->compInst_.in())) + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::initializeComponentServer - Reference on ComponentInstallation is nil!!!!\n")); + } + CdmwCcmComponentServer::ComponentServer_var proprietary_svr = + CdmwCcmComponentServer::ComponentServer::_narrow (cdmwServer); + + // give it the ComponentInstallation + proprietary_svr->set_component_installation (this->compInst_.in()); + // give it the ServerActivator + proprietary_svr->set_server_activator (Components::Deployment::ServerActivator::_narrow (this->poa_->servant_to_reference (this))); + + DANCE_DEBUG ( (LM_DEBUG, "[%M] ServerActivator_Impl::initializeComponentServer - finished\n")); +} diff --git a/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.h b/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.h new file mode 100644 index 00000000000..8ce81ca1db6 --- /dev/null +++ b/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.h @@ -0,0 +1,93 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ServerActivator_Impl.h + * + * $Id$ + * + * @Brief Implementation of Deployment::ServerActivator + * + * @author Erwin Gottlieb <eg@prismtech.com> + */ +//============================================================================= + +#ifndef SERVERACTIVATOR_IMPL_H_ +#define SERVERACTIVATOR_IMPL_H_ + +#include "ace/Map_Manager.h" +#include "tao/ORB.h" +#include "orbsvcs/orbsvcs/CosNamingC.h" + +#include "Cdmw/CDMW_IDLS.h" +#include "ComponentServer/ComponentServerS.h" +#include "NodeApplication_Export.h" + +namespace DAnCE + { + + class NodeApplication_Export ServerActivator_Impl : public virtual POA_Components::Deployment::ServerActivator + { + public: + ServerActivator_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa_, + Components::Deployment::ComponentInstallation_ptr compInst); + virtual ~ServerActivator_Impl(); + + + // + // IDL:omg.org/Components/Deployment/ServerActivator/create_component_server:1.0 + // + /** + * Creates a ComponentServer object on the host on which the + * ServerActivator is located. + * + * @param config ConfigValues for creation of ComponentServer. + * For CDMW CCM, this sequence should contain a + * PROCESS_DESTINATION ConfigValue which specify the + * destination of an already started ComponentServer process. + * + * @throws CreateFailure + * INVALID_PROCESS_DESTINATION: raised if the destination + * specified in PROCESS_DESTINATION ConfigValue is not valid.<br> + * COMPONENT_SERVER_NOT_CREATED: raised if the ComponentServer could + * not be contacted (it should be started by PlatformManagement before + * the call to ServerActivator).<br> + * COMPONENT_SERVER_ALREADY_CREATED: raised if this method has already + * been called with the same PROCESS_DESTINATION ConfigValue. + * @throws InvalidConfiguration + * raised if the config parameter doesn't contain a single + * PROCESS_DESTINATION ConfigValue. + */ + virtual ::Components::Deployment::ComponentServer_ptr create_component_server ( + const ::Components::ConfigValues & config + ); + + // + // IDL:omg.org/Components/Deployment/ServerActivator/remove_component_server:1.0 + // + virtual void remove_component_server ( + ::Components::Deployment::ComponentServer_ptr server + ); + + // + // IDL:omg.org/Components/Deployment/ServerActivator/get_component_servers:1.0 + // + virtual ::Components::Deployment::ComponentServers * get_component_servers ( + ); + + private: + typedef ACE_Map_Manager<ACE_CString, ::Components::Deployment::ComponentServer_var, ACE_Null_Mutex > TCompServers; + TCompServers servers_; + + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; + CosNaming::NamingContext_var naming_; + Components::Deployment::ComponentInstallation_var compInst_; + + private: + void initializeComponentServer (::Components::Deployment::ComponentServer_ptr server); + }; +}; + +#endif /*SERVERACTIVATOR_IMPL_H_*/ diff --git a/CIAO/DAnCE/NodeApplicationManager/CIAO_NAM_Export.h b/CIAO/DAnCE/NodeApplicationManager/CIAO_NAM_Export.h deleted file mode 100644 index 1a506292ef7..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/CIAO_NAM_Export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl CIAO_NAM -// ------------------------------ -#ifndef CIAO_NAM_EXPORT_H -#define CIAO_NAM_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_NAM_HAS_DLL) -# define CIAO_NAM_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && CIAO_NAM_HAS_DLL */ - -#if !defined (CIAO_NAM_HAS_DLL) -# define CIAO_NAM_HAS_DLL 1 -#endif /* ! CIAO_NAM_HAS_DLL */ - -#if defined (CIAO_NAM_HAS_DLL) && (CIAO_NAM_HAS_DLL == 1) -# if defined (CIAO_NAM_BUILD_DLL) -# define CIAO_NAM_Export ACE_Proper_Export_Flag -# define CIAO_NAM_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define CIAO_NAM_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* CIAO_NAM_BUILD_DLL */ -# define CIAO_NAM_Export ACE_Proper_Import_Flag -# define CIAO_NAM_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define CIAO_NAM_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* CIAO_NAM_BUILD_DLL */ -#else /* CIAO_NAM_HAS_DLL == 1 */ -# define CIAO_NAM_Export -# define CIAO_NAM_SINGLETON_DECLARATION(T) -# define CIAO_NAM_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* CIAO_NAM_HAS_DLL == 1 */ - -// Set CIAO_NAM_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (CIAO_NAM_NTRACE) -# if (ACE_NTRACE == 1) -# define CIAO_NAM_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define CIAO_NAM_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !CIAO_NAM_NTRACE */ - -#if (CIAO_NAM_NTRACE == 1) -# define CIAO_NAM_TRACE(X) -#else /* (CIAO_NAM_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define CIAO_NAM_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (CIAO_NAM_NTRACE == 1) */ - -#endif /* CIAO_NAM_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp b/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp deleted file mode 100644 index 1472f598751..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp +++ /dev/null @@ -1,779 +0,0 @@ -// $Id$ - -#include "Containers_Info_Map.h" -#include "ciao/CIAO_Config.h" -#include "ciao/CIAO_common.h" -#include "DAnCE/Deployment/CIAO_ServerResourcesC.h" - -//Added for HTTP -#include "URL_Parser.h" //for parsing the URL -#include "tao/HTTP_Client.h" //the HTTP client class to downloading packages -#include "ace/Message_Block.h" //for ACE_Message_Block -#include "ace/OS_NS_fcntl.h" //for open -#include "ace/OS_NS_unistd.h" //for close -#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir -#include "ace/OS_NS_string.h" //for string functions -#include "ace/streams.h" - -namespace CIAO -{ - Containers_Info_Map:: - Containers_Info_Map (const Deployment::DeploymentPlan & plan, - const Deployment::ComponentPlans & shared_components) - : map_ (CIAO_DEFAULT_MAP_SIZE), - plan_ (plan), - shared_components_ (shared_components), - HTTP_DOWNLOAD_PATH () - { - char* temp = ACE_OS::getenv ("CIAO_ROOT"); - HTTP_DOWNLOAD_PATH += temp; - -#if defined (ACE_WIN32) - HTTP_DOWNLOAD_PATH += "\\"; -#else - HTTP_DOWNLOAD_PATH += "/"; -#endif - - HTTP_DOWNLOAD_PATH += "HTTP_DOWNLOADED_LIBS"; - - ACE_OS::mkdir(HTTP_DOWNLOAD_PATH.c_str ()); - //if dir already exists a -1 is returned - //we ignore this, just need to make sure the directory exists - - this->initialize_map (); - this->build_map (); - } - - Deployment::ContainerImplementationInfos * - Containers_Info_Map::containers_info (void) - { - // Fetch the information from the <containers_info_map_> - // and return the corresponding sequence - Deployment::ContainerImplementationInfos_var retv; - - ACE_NEW_RETURN (retv, - Deployment::ContainerImplementationInfos, - 0); - - Iterator end = this->map_.end (); - CORBA::ULong i = 0; - - for (Iterator b = this->map_.begin (); - b != end; - ++b) - { - retv->length (i + 1); - (*retv)[i] = *((*b).int_id_); - - ++i; - } - return retv._retn (); - } - - void - Containers_Info_Map:: - initialize_map (void) - { - const CORBA::ULong instance_len = this->plan_.instance.length (); - - // Iterate over the instance list and look at the policy set id of each - // component instance. For each policy set, we create a separate container - // to host all the components with such policy set. - // NOTE: all the component instances without policies are specified should - // be hosted in the same container, and in our map the key is an empty - // string "" - int first_time = 0; - for (CORBA::ULong i = 0; i < instance_len; ++i) - { - CORBA::String_var my_resource_id (""); - const char *diff_policy_set_id = ""; - bool found = false; - - // @@ super hack here. we are assuming RT policy set is - // the only thing that will be specified. - CORBA::ULong dp_length = - this->plan_.instance[i].deployedResource.length (); - - if (dp_length == 0) - { - found = true; - } - - for (CORBA::ULong x = 0; x < dp_length; ++x) - { - my_resource_id = - this->plan_.instance[i].deployedResource[x].resourceName.in (); - - CORBA::ULong property_length = - this->plan_.instance[i].deployedResource[x].property.length (); - - found = true; - - for (CORBA::ULong p = 0; p < property_length; ++p) - { - if (ACE_OS::strcmp ( - this->plan_.instance[i].deployedResource[x]. - property[p].name.in (), - "CIAO:InstancePolicy") == 0) - { // should be only one of them. - // each instance will have one one CIAO:InstancePolicy - // definition. - this->plan_.instance[i].deployedResource[x].property[p]. - value >>= diff_policy_set_id; - if (this->map_.find (diff_policy_set_id) != 0) - { - // we found a policy that is different from what - // we have seen before. - found = true; - } - else - { - found = false; - } - } - } - } - - // If we find a existing policy_set_id, then do nothing. - if (found == false) - { - // we did not find a new instance policy. - // but the instance's receptacles could have their - // own policies. - continue; - } - - if (ACE_OS::strcmp (diff_policy_set_id, "") == 0) - { - // no policy set id has been specified - // but we could have some receptacle policies around. - // - if (first_time == 0) - { - Deployment::ContainerImplementationInfo * info; - ACE_NEW (info, Deployment::ContainerImplementationInfo); - this->map_.bind (diff_policy_set_id, info); - first_time = 1; - continue; - } - } - else - { - Deployment::ContainerImplementationInfo * info; - ACE_NEW (info, Deployment::ContainerImplementationInfo); - - // Fetch the actual policy_set_def from the infoProperty - // Ugly due to the IDL data structure definition! :( - CORBA::ULong j; - CORBA::ULong infoProperty_length = - this->plan_.infoProperty.length (); - - for (j = 0; j < infoProperty_length; ++j) - { - if (ACE_OS::strcmp (this->plan_.infoProperty[j].name.in (), - "CIAOServerResources") != 0) - continue; - - CIAO::DAnCE::ServerResource *server_resource_def = 0; - this->plan_.infoProperty[j].value >>= server_resource_def; - - if (ACE_OS::strcmp ((*server_resource_def).Id, - my_resource_id.in ()) == 0) - { - // Iterate over the policy_sets - CORBA::ULong k; - CORBA::ULong policy_sets_length = - (*server_resource_def).orb_config.policy_set.length (); - const char *comparing_policy_set_id; - CORBA::ULong config_length; - CORBA::ULong new_config_length; - for (k = 0; k < policy_sets_length; ++k) - { - CORBA::ULong new_dp_length = - this->plan_.instance[i].deployedResource.length (); - - for (CORBA::ULong z = 0; z < new_dp_length; - ++z) - { - CORBA::ULong new_property_length = - this->plan_.instance[i].deployedResource[z]. - property.length (); - for (CORBA::ULong s = 0; - s < new_property_length; ++s) - { - this->plan_.instance[i].deployedResource[z]. - property[s].value >>= comparing_policy_set_id; - if (ACE_OS::strcmp (comparing_policy_set_id, - (*server_resource_def). - orb_config.policy_set[k].Id) == 0) - { - config_length = - info->container_config.length (); - new_config_length = - config_length + 1; - info->container_config.length ( - new_config_length); - if (ACE_OS::strcmp ( - this->plan_.instance[i]. - deployedResource[z]. - property[s].name.in (), - "CIAO:InstancePolicy") == 0) - { - info-> - container_config[config_length].name = - CORBA::string_dup - ("ContainerPolicySet"); - } - else if (ACE_OS::strcmp ( - this->plan_.instance[i]. - deployedResource[z]. - property[s].name.in (), - "CIAO:ReceptaclePolicy") == 0) - { - info-> - container_config[config_length].name = - CORBA::string_dup - ("ReceptaclePolicySet"); - } - else - { - info-> - container_config[config_length].name = - this->plan_.instance[i]. - deployedResource[z]. - property[s].name.in (); - } - info-> - container_config[config_length].value <<= - comparing_policy_set_id; - } - } - } - } - this->map_.bind (diff_policy_set_id, info); - } - } - } - } - } - - bool - Containers_Info_Map:: - build_map (void) - { - const CORBA::ULong instance_len = this->plan_.instance.length (); - - for (CORBA::ULong i = 0; i < instance_len; ++i) - { - const Deployment::InstanceDeploymentDescription & instance = - this->plan_.instance[i]; - - // If this component instance happens to be in the "shared components - // list", then we ignore it, otherwise we shall install it. - ACE_CString name (instance.name.in ()); - if (this->is_shared_component (name)) - continue; - - if (! this->insert_instance_into_map (instance)) - return false; - } - - return true; - } - - bool - Containers_Info_Map::insert_instance_into_map ( - const Deployment::InstanceDeploymentDescription & instance) - { - Deployment::ContainerImplementationInfo container_info; - - const char * policy_set_id = ""; - - CORBA::ULong dp_length = - instance.deployedResource.length (); - - for (CORBA::ULong x = 0; x < dp_length; ++x) - { - CORBA::ULong property_length = - instance.deployedResource[x].property.length (); - - for (CORBA::ULong p = 0; p < property_length; ++p) - { - if (ACE_OS::strcmp ( - instance.deployedResource[x]. - property[p].name.in (), - "CIAO:InstancePolicy") == 0) - { - instance.deployedResource[x].property[p].value >>= - policy_set_id; - } - } - } - - // Find the ContainerImplementationInfo entry from the map - MAP::ENTRY *entry = 0; - if (this->map_.find (policy_set_id, entry) != 0) - { - return false; //should never happen - } - else - { - this->insert_instance_into_container ( - instance, - entry->int_id_->impl_infos); - } - - return true; - } - - bool - Containers_Info_Map::insert_instance_into_container ( - const Deployment::InstanceDeploymentDescription & instance, - Deployment::ComponentImplementationInfos & impl_infos) - { - // Increase the length of the ComponentImplementationInfos by one - CORBA::ULong i = impl_infos.length (); - impl_infos.length (i + 1); - - // Fill in the information about this component instance - // Get the component instance name. - impl_infos[i].component_instance_name = instance.name.in (); - - const Deployment::MonolithicDeploymentDescription & impl = - this->plan_.implementation[instance.implementationRef]; - - const CORBA::ULong artifact_num = impl.artifactRef.length (); - - // Copy Component instance related Properties if there is any. - if (instance.configProperty.length () > 0) - { - impl_infos[i].component_config = instance.configProperty; - } - - CORBA::ULong config_length = - impl_infos[i].component_config.length (); - - CORBA::ULong dp_length = - instance.deployedResource.length (); - - const char* policy_set_id = ""; - - for (CORBA::ULong x = 0; x < dp_length; ++x) - { - CORBA::ULong property_length = - instance.deployedResource[x].property.length (); - - for (CORBA::ULong p = 0; p < property_length; ++p) - { - if (ACE_OS::strcmp ( - instance.deployedResource[x]. - property[p].name.in (), - "CIAO:InstancePolicy") != 0) - { - if (ACE_OS::strcmp ( - instance.deployedResource[x]. - property[p].name.in (), - "CIAO:ReceptaclePolicy") != 0) - { - config_length = - impl_infos[i].component_config.length (); - impl_infos[i].component_config.length (config_length + 1); - impl_infos[i].component_config[config_length].name = - instance.deployedResource[x].property[p].name.in (); - instance.deployedResource[x].property[p].value >>= - policy_set_id; - impl_infos[i].component_config[config_length].value <<= - policy_set_id; - } - } - } - } - - bool svnt_found = false; - bool exec_found = false; - - // For svnt/exec artifacts - for (CORBA::ULong j = 0; j < artifact_num; ++j) - { - Deployment::ArtifactDeploymentDescription arti = - this->plan_.artifact[ impl.artifactRef[j] ]; - - for (size_t loc_num = 0; - loc_num < arti.location.length (); - ++loc_num) - { - if (ACE_OS::strstr (arti.location[loc_num], "http://")) - { - ACE_CString path; - ACE_CString arti_name; - if (!this->resolve_http_reference (arti.location[loc_num], - arti_name, - path)) - { - ACE_ERROR - ((LM_ERROR, - "CIAO (%P|%t) Containers_Info_Map.cpp -" - "Containers_Info_Map::insert_instance_into_container -" - "ERROR: Unable to resolve HTTP ref to location[%d] of %s\n", - loc_num, arti.name.in ())); - - //No need to throw an exception here! - //Actually it is not desirable. - //This is handled in a different part of DAnCE - arti.location[loc_num] = "HTTP_failure"; - } - else - { - arti.location[loc_num] = arti_name.c_str (); - //enque for cleanup - } - } - } - - ACE_CString tmp = arti.name.in (); - ACE_CString::size_type pos; - - //@@ Note: I am not checking for redundancy here. Maybe - // the modeling tool should make sure of - // uniqueness, i.e., one component implementation - // should have only 1 _svnt and 1 _exec libs. - if ((pos = tmp.find ("_stub")) != ACE_CString::npos || - (pos = tmp.find ("_Stub")) != ACE_CString::npos) - continue; // We ignore _stub artifact since it's not used. - - if (!svnt_found && - ((pos = tmp.find ("_svnt")) != ACE_CString::npos || - (pos = tmp.find ("_Svnt")) != ACE_CString::npos)) - { - if (arti.location.length() < 1 ) - { - ACE_DEBUG ((LM_DEBUG, "Servant Artifact must have a location!\n")); - return 0; - } - - svnt_found = true; - // Copy the servant dll/so name. - // @@ Note: I ignore all the other locations except the first one. - impl_infos[i].servant_dll = - CORBA::string_dup (arti.location[0]); - - // Get the entry point. - const CORBA::ULong prop_length = arti.execParameter.length (); - - for (CORBA::ULong prop_num = 0; - prop_num < prop_length; - ++prop_num) - { - ACE_CString name (arti.execParameter[prop_num].name.in ()); - if (name == ACE_CString ("entryPoint")) - { - const char * entry = 0; - (arti.execParameter[prop_num].value) >>= entry; - impl_infos[i].servant_entrypt = CORBA::string_dup (entry); - } - else - { - ACE_DEBUG ((LM_DEBUG, "Found unknown property in the artifact!\n")); - ACE_DEBUG ((LM_DEBUG, "We only support entrypoint at this point in CIAO.\n")); - } - } - - continue; // continue for the next artifact - } - - // As one can see, code is duplicated here. I will come back for this later. - // For exec artifact - if (!exec_found && - ((pos = tmp.find ("_exec")) != ACE_CString::npos || - (pos = tmp.find ("_Exec")) != ACE_CString::npos)) - { - if (arti.location.length() < 1 ) - { - ACE_DEBUG ((LM_DEBUG, "Executor Artifact must have a location!\n")); - return 0; - } - - exec_found = true; - // Copy the servant dll/so name. - // @@ Note: I ignore all the other locations except the first one. - exec_found = true; - impl_infos[i].executor_dll = - CORBA::string_dup (arti.location[0]); - - // Get the entry point. - const CORBA::ULong prop_length = arti.execParameter.length (); - for (CORBA::ULong prop_num = 0; - prop_num < prop_length; - ++prop_num) - { - ACE_CString name (arti.execParameter[prop_num].name.in ()); - if (name == ACE_CString ("entryPoint")) - { - const char * entry = 0; - (arti.execParameter[prop_num].value) >>= entry; - impl_infos[i].executor_entrypt = CORBA::string_dup (entry); - } - else - { - ACE_DEBUG ((LM_DEBUG, "Found unknown property in the artifact!\n")); - ACE_DEBUG ((LM_DEBUG, "We only support entrypoint at this point in CIAO.\n")); - } - } - } - else - // We see artifact other than servant/executor and we ignore them. - continue; - } - return true; - } -} - -bool -CIAO::Containers_Info_Map:: -is_shared_component (ACE_CString & name) -{ - for (CORBA::ULong i = 0; i < this->shared_components_.length (); ++i) - { - if (ACE_OS::strcmp (this->shared_components_[i].name.in (), - name.c_str ()) == 0) - return true; - } - - return false; -} - - -/*--------------------------------------------------------------------- - * functions to support HTTP capabilities of the NodeApplicationManager - * @author Stoyan Paunov - * - * Purpose: Adding the HTTP access code which will resove - * any references to HTTP URLs - */ - - // This function checks if the HTTP_DOWNLOAD_PATH is - // in the library load path - void - CIAO::Containers_Info_Map::update_loader_path (void) - { -#if defined (ACE_WIN32) - char* path = ACE_OS::getenv ("PATH"); -#else - char* path = ACE_OS::getenv ("LD_LIBRARY_PATH"); -#endif - - if (ACE_OS::strstr (path, this->HTTP_DOWNLOAD_PATH.c_str ())) - return; - -#if defined (ACE_WIN32) - ACE_CString new_path = "PATH="; -#else - ACE_CString new_path = "LD_LIBRARY_PATH="; -#endif - - new_path += this->HTTP_DOWNLOAD_PATH; - -#if defined (ACE_WIN32) - new_path += ";"; -#else - new_path += ":"; -#endif - - new_path += path; - - ACE_OS::putenv (new_path.c_str ()); - - } - - //This function resolves any http location references - //in the name of the implementation artifacts - //It returns true on success and false on failure - - bool - CIAO::Containers_Info_Map::resolve_http_reference (const char* location, - ACE_CString &arti_name, - ACE_CString &path) - { - // Figure out the file name. - char* name = const_cast<char*> (location); - char* p = 0; - - while (true) - { - p = ACE_OS::strstr (name, "/"); - - if (0 == p) - { - p = ACE_OS::strstr (name, "\\"); - } - - if (0 == p) - { - break; - } - else - { - name = ++p; - continue; - } - } - - arti_name = name; - - // Get the file. - ACE_Message_Block* mb = 0; - ACE_NEW_RETURN (mb, ACE_Message_Block (0,0), false); - - if (!this->retrieve_via_HTTP (location, *mb)) - { - mb->release (); - return false; - } - -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - ACE_TString decorator (ACE_LD_DECORATOR_STR); -#endif - ACE_TString prefix (ACE_DLL_PREFIX); - ACE_TString suffix (ACE_DLL_SUFFIX); - - ACE_CString new_name (name); - new_name = prefix + new_name; -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - new_name += decorator; -#endif - new_name += suffix; - - path = HTTP_DOWNLOAD_PATH; - path += "/"; - path += new_name; - - if (!this->write_to_disk (path.c_str (), *mb)) - { - mb->release (); - return false; - } - - mb->release (); - return true; - } - - //function to retvieve a file via HTTP - //stores the file in the passed preallocated ACE_Message_Block - //returns 1 on success - // 0 on error - - bool - CIAO::Containers_Info_Map::retrieve_via_HTTP (const char* URL, - ACE_Message_Block &mb) - { - ACE_CString loc (URL); - - // Figure out the file name. - char* name_ = const_cast<char*> (URL); - char* p = 0; - - while (true) - { - p = ACE_OS::strstr (name_, "/"); - - if (0 == p) - { - p = ACE_OS::strstr (name_, "\\"); - } - - if (0 == p) - { - break; - } - else - { - name_ = ++p; - continue; - } - } - - ACE_CString name (name_); - loc = loc.substr (0, loc.length() - name.length ()); - -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - ACE_TString decorator (ACE_LD_DECORATOR_STR); -#endif - ACE_TString prefix (ACE_DLL_PREFIX); - ACE_TString suffix (ACE_DLL_SUFFIX); - - ACE_CString new_name (name); - new_name = prefix + new_name; -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - new_name += decorator; -#endif - new_name += suffix; - - loc = loc + new_name; - - ACE_DEBUG ((LM_INFO, - "Attempting to download %s\n", - loc.c_str ())); - - URL_Parser *parser = TheURL_Parser::instance (); - if (!parser->parseURL (const_cast<char*> (loc.c_str ()))) - return false; - - // Create a client - TAO_HTTP_Client client; - - // Open the client - if (client.open (parser->filename_, - parser->hostname_, - parser->port_) == -1) - { - client.close (); - return false; - } - - // Read from it - if (client.read (&mb) <= 0) - { - client.close (); - return false; - } - - return true; - } - - //This function attempts to write a sequence of bytes from an - //ACE_Message_Block to a specified location. A 0 is returned - //in the case of an error and a 1 upon success - - bool - CIAO::Containers_Info_Map::write_to_disk (const char* full_path, - ACE_Message_Block& mb, - bool replace) - { - ACE_stat stat; - - if (ACE_OS::stat(full_path, &stat) != -1 && !replace) - return false; - - // Open a file handle to the local filesystem - ACE_HANDLE handle = ACE_OS::open (full_path, O_CREAT | O_TRUNC | O_WRONLY); - if (handle == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[CIAO::Containers_Info_Map::write_to_disk]"), - ACE_TEXT (" file creation error")), - false); - - //write the data to the file - for (ACE_Message_Block * curr = &mb; curr != 0; curr = curr->cont ()) - if (ACE_OS::write_n (handle, curr->rd_ptr(), curr->length()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[CIAO::Containers_Info_Map::write_to_disk]"), - ACE_TEXT (" write error")), - false); - - // Close the file handle - ACE_OS::close (handle); - - return true; - } diff --git a/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.h b/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.h deleted file mode 100644 index 237ecf07c86..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.h +++ /dev/null @@ -1,137 +0,0 @@ -/** - * - * @file Containers_Info_Map.h - * @author Gan Deng <dengg@dre.vanderbilt.edu> - * - * Map of ContainerImplementationInfo sequences. - * - * $Id$ - */ - -#ifndef CIAO_CONTAINERS_INFO_MAP_H -#define CIAO_CONTAINERS_INFO_MAP_H - -#include /**/ "ace/pre.h" - -#include "ace/Null_Mutex.h" -#include "ace/Hash_Map_Manager.h" - -//added for the HTTP support -#include "ace/Message_Block.h" //for ACE_Message_Block - -#include "DAnCE/Deployment/Deployment_ContainerC.h" -#include "DAnCE/Deployment/DeploymentC.h" -#include "ace/SString.h" -#include "CIAO_NAM_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -namespace CIAO -{ - /** - * @class Container_Infos_Map - * @brief Implementation of a map of ContainerImplementationInfo sequences. - * - * This is a helper class to populate the NodeImplementationInfo struct from - * a deployment plan.. - */ - class CIAO_NAM_Export Containers_Info_Map - { - public: - - Containers_Info_Map (const Deployment::DeploymentPlan & plan, - const Deployment::ComponentPlans & shared_components); - - Deployment::ContainerImplementationInfos * - containers_info (void); - - private: - void initialize_map (void); - bool build_map (void); - - bool insert_instance_into_map ( - const Deployment::InstanceDeploymentDescription & instance); - - bool insert_instance_into_container ( - const Deployment::InstanceDeploymentDescription & instance, - Deployment::ComponentImplementationInfos & impl_infos); - - /// Helper function to check wheather a component instance - /// is in the "shared components list". - bool is_shared_component (ACE_CString & name); - - //Deployment::ContainerImplementationInfos_var containers_info_; - - typedef - ACE_Hash_Map_Manager_Ex <ACE_CString, - Deployment::ContainerImplementationInfo *, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> MAP; - - typedef MAP::iterator Iterator; - MAP map_; - - const Deployment::DeploymentPlan & plan_; - - /// shared components list, passed in from NodeImplementationInfoHandler - /// class. - Deployment::ComponentPlans shared_components_; - - /**------------------------------------------------------------------- - * HTTP capability - * @author Stoyan Paunov - * - * Purpose: Adding the HTTP access code which will resove - * any references to HTTP URLs - */ - protected: - - // @Stoyan - Please follow ACE coding guideines when naming your - //member variables. In particular, please use lower case and - //follow the name with a trailing underscore. - //directory in which to download the libraries obtained via HTTP - ACE_CString HTTP_DOWNLOAD_PATH; - - /// This function checks if the HTTP_DOWNLOAD_PATH is - /// in the library load path - void - update_loader_path (void); - - /// This function resolves any http location references - /// in the name of the implementation artifacts - /// It returns true on success and false on failure - bool - resolve_http_reference (const char* location, - ACE_CString &arti_name, - ACE_CString &name); - - /// function to retvieve a file via HTTP - /// stores the file in the passed preallocated ACE_Message_Block - /// returns 1 on success - /// 0 on error - bool - retrieve_via_HTTP (const char* URL, - ACE_Message_Block &mb); - - /// function that writes out a file to a specified location on the hand disk - /// returns 1 on success - /// 0 on already exists and replace == false - /// 0 on error - - bool - write_to_disk (const char* full_path, - ACE_Message_Block& mb, - bool replace = true); - - /// TODO: Fuction to remove the downloaded library to ensure - /// consisterncy in future runs - - }; -} - -#include /**/ "ace/post.h" - -#endif /*CIAO_CONTAINERS_INFO_MAP_H*/ diff --git a/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp b/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp deleted file mode 100644 index 0ae9f9b0175..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//$Id$ -#ifndef CIAO_IMPLEMENTATION_INFO_CPP -#define CIAO_IMPLEMENTATION_INFO_CPP - -#include "ImplementationInfo.h" -#include "DAnCE/Deployment/CIAO_ServerResourcesC.h" -#include "ace/SString.h" - -CIAO::NodeImplementationInfoHandler:: -NodeImplementationInfoHandler (const ::Deployment::DeploymentPlan & plan, - const Deployment::ComponentPlans & shared_components) : - plan_ (plan), - node_info_ (0), - containers_info_map_ (plan, shared_components) -{ - ACE_NEW (node_info_, ::Deployment::NodeImplementationInfo); - this->populate_server_resource_def (); - this->populate_container_impl_infos (); -} - -Deployment::NodeImplementationInfo * -CIAO::NodeImplementationInfoHandler::node_impl_info (void) const -{ - Deployment::NodeImplementationInfo_var retv; - ACE_NEW_RETURN (retv, - Deployment::NodeImplementationInfo (this->node_info_.in ()), - 0); - return retv._retn (); -} - -void -CIAO::NodeImplementationInfoHandler::populate_server_resource_def (void) -{ - CORBA::ULong const instance_len = plan_.instance.length (); - const char * target_resource_id = 0; - - // Iterate over the instance list to find whether any server resource - // has been specified - // TODO: We shoud do some sanity check here, since all the component - // instance in this NodeApplication should have the same "server_resource_def" - // defined. Since currently we ignored this sanity check, then will allow - // users to specify some self-conflicting configuration in the descriptor. - - // NW: this stuff is broken because it assumes all component - // instances in a node will use the same ServerResource file. This - // is not the case. Component instances using the same - // ServerResource file will be deployed in the same NA. However, - // those using different ServerResource files should be deployed to - // different NAs. Something to be fixed later. - for (CORBA::ULong i = 0; i < instance_len; ++i) - { - if (this->plan_.instance[i].deployedResource.length () != 0) - { - target_resource_id = - this->plan_.instance[i].deployedResource[0].resourceName.in (); - - // Some component instance has server resource usage defined, so we - // set the <nodeapp_config> field of the NodeImplementationInfo struct. - for (CORBA::ULong j = 0; j < this->plan_.infoProperty.length (); ++j) - { - CIAO::DAnCE::ServerResource *server_resource_def = 0; - this->plan_.infoProperty[j].value >>= server_resource_def; - - if (ACE_OS::strcmp ((*server_resource_def).Id, - target_resource_id) == 0) - { - // Found the target server resource def, and store it. - this->node_info_->nodeapp_config.length (1); - - this->node_info_->nodeapp_config[0].name = - CORBA::string_dup ("CIAOServerResources"); - - this->node_info_->nodeapp_config[0].value <<= - *server_resource_def; - break; - } - } - } - } -} - -void -CIAO::NodeImplementationInfoHandler::populate_container_impl_infos (void) -{ - CORBA::ULong const curr_len = - this->containers_info_map_.containers_info ()->length (); - - ACE_UNUSED_ARG (curr_len); - - // assignment operation - this->node_info_->impl_infos = - *(this->containers_info_map_.containers_info ()); -} - -#endif /* CIAO_IMPLEMENTATION_INFO_CPP */ diff --git a/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h b/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h deleted file mode 100644 index 4109fee1a21..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h +++ /dev/null @@ -1,60 +0,0 @@ -//$Id$ -/* -*- C++ -*- */ -/*************************************************************** - * @file ImplementationInfo.h - * - * @brief This file defines some helper functions for preparing the - * Component ImplementationInfo and properties from - * the plan. - * - * @author Tao Lu <lu@dre.vanderbilt.edu> - * @author Gan Deng <dengg@dre.vanderbilt.edu> - ***************************************************************/ - -#ifndef IMPLEMENTATIONIFO_H -#define IMPLEMENTATIONIFO_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" -#include "ace/SString.h" -#include "ace/Hash_Map_Manager.h" -#include "Containers_Info_Map.h" -#include "CIAO_NAM_Export.h" - -namespace CIAO -{ - /// This class is a helper class to parse the local deployment plan into the - /// NodeImplementationInfo struct. - class CIAO_NAM_Export NodeImplementationInfoHandler - { - public: - NodeImplementationInfoHandler ( - const ::Deployment::DeploymentPlan & plan, - const Deployment::ComponentPlans & shared_components); - - Deployment::NodeImplementationInfo * - node_impl_info (void) const; - - private: - Deployment::DeploymentPlan plan_; - - Deployment::NodeImplementationInfo_var node_info_; - - void populate_server_resource_def (void); - - void populate_container_impl_infos (void); - - /// Helper class that helps populate the container_impl_infos - /// field. - Containers_Info_Map containers_info_map_; - }; -} - -#include /**/ "ace/post.h" -#endif /* IMPLEMENTATIONIFO_H */ diff --git a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc index caa5b8ffbad..c07575ef68a 100644 --- a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc +++ b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc @@ -1,24 +1,11 @@ // -*- MPC -*- // $Id$ -project(NodeApplicationManager): ciao_server_dnc, ciao_deployment_svnt, dance_extension_stub, ciao_nodeapplication, ace_output { - - sharedname = NodeApplicationManager - after += NodeManager_stub CIAO_TargetManager_stub - dynamicflags = CIAO_NAM_BUILD_DLL +project: dance_lib, naming, dance_node_application, dance_deployment_svnt, dance_deployment_stub, dynamicinterface, ccm_componentserver_svnt, ciao_cs_client { + sharedname = DAnCE_NodeApplicationManager + dynamicflags = NODEAPPLICATIONMANAGER_BUILD_DLL Source_Files { NodeApplicationManager_Impl.cpp - ImplementationInfo.cpp - Containers_Info_Map.cpp - URL_Parser.cpp - } - - Header_Files { - NodeApplicationManager_Impl.h - ImplementationInfo.h - Containers_Info_Map.h - URL_Parser.h - CIAO_NAM_Export.h } } diff --git a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Export.h b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Export.h new file mode 100644 index 00000000000..b86e93b49ab --- /dev/null +++ b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NodeApplicationManager +// ------------------------------ +#ifndef NODEAPPLICATIONMANAGER_EXPORT_H +#define NODEAPPLICATIONMANAGER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPPLICATIONMANAGER_HAS_DLL) +# define NODEAPPLICATIONMANAGER_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && NODEAPPLICATIONMANAGER_HAS_DLL */ + +#if !defined (NODEAPPLICATIONMANAGER_HAS_DLL) +# define NODEAPPLICATIONMANAGER_HAS_DLL 1 +#endif /* ! NODEAPPLICATIONMANAGER_HAS_DLL */ + +#if defined (NODEAPPLICATIONMANAGER_HAS_DLL) && (NODEAPPLICATIONMANAGER_HAS_DLL == 1) +# if defined (NODEAPPLICATIONMANAGER_BUILD_DLL) +# define NodeApplicationManager_Export ACE_Proper_Export_Flag +# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* NODEAPPLICATIONMANAGER_BUILD_DLL */ +# define NodeApplicationManager_Export ACE_Proper_Import_Flag +# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* NODEAPPLICATIONMANAGER_BUILD_DLL */ +#else /* NODEAPPLICATIONMANAGER_HAS_DLL == 1 */ +# define NodeApplicationManager_Export +# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) +# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NODEAPPLICATIONMANAGER_HAS_DLL == 1 */ + +// Set NODEAPPLICATIONMANAGER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NODEAPPLICATIONMANAGER_NTRACE) +# if (ACE_NTRACE == 1) +# define NODEAPPLICATIONMANAGER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NODEAPPLICATIONMANAGER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NODEAPPLICATIONMANAGER_NTRACE */ + +#if (NODEAPPLICATIONMANAGER_NTRACE == 1) +# define NODEAPPLICATIONMANAGER_TRACE(X) +#else /* (NODEAPPLICATIONMANAGER_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define NODEAPPLICATIONMANAGER_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (NODEAPPLICATIONMANAGER_NTRACE == 1) */ + +#endif /* NODEAPPLICATIONMANAGER_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp index f65379d11c7..deb395ceccc 100644 --- a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp +++ b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp @@ -1,1110 +1,209 @@ // $Id$ -#include "NodeApplicationManager_Impl.h" +#include "ace/Log_Msg.h" +#include "ace/streams.h" +#include "DAnCE/Deployment/DAnCE_PropertiesC.h" +#include "DAnCE/Logger/Log_Macros.h" -#include "ace/Process.h" -#include "ace/Process_Manager.h" -#include "ace/Reactor.h" -#include "ace/OS_NS_stdio.h" -#include "ace/Sched_Params.h" -#include "ace/Vector_T.h" -#include "ciao/Container_Base.h" -#include "DAnCE/Deployment/CIAO_ServerResourcesC.h" +#include "NodeApplicationManager_Impl.h" #include "NodeApplication/NodeApplication_Impl.h" -#include "NodeApplication/NodeApp_Configurator.h" -#include "ace/Reactor.h" - -#if !defined (__ACE_INLINE__) -# include "NodeApplicationManager_Impl.inl" -#endif /* __ACE_INLINE__ */ - - -bool -CIAO::NodeApplicationManager_Impl_Base:: -is_shared_component (ACE_CString & name) -{ - for (CORBA::ULong i = 0; i < this->shared_components_.length (); ++i) - { - if (ACE_OS::strcmp (this->shared_components_[i].name.in (), - name.c_str ()) == 0) - return true; - } - - return false; -} - -bool -CIAO::NodeApplicationManager_Impl_Base:: -is_external_component (ACE_CString & name) -{ - for (CORBA::ULong i = 0; i < this->external_components_.length (); ++i) - { - if (ACE_OS::strcmp (this->external_components_[i].name.in (), - name.c_str ()) == 0 && - ACE_OS::strcmp (this->external_components_[i].plan_uuid.in (), - this->plan_.UUID.in ())) - return true; - } - - return false; -} - -Deployment::Connections * -CIAO::NodeApplicationManager_Impl_Base:: -create_connections () -{ - CIAO_TRACE("CIAO::NodeApplicationManager_Impl_Base::create_connections"); - Deployment::Connections_var retv; - - ACE_NEW_THROW_EX (retv, - Deployment::Connections (), - CORBA::NO_MEMORY ()); - - CORBA::ULong len = retv->length (); - - const Component_Iterator end (this->component_map_.end ()); - for (Component_Iterator iter (this->component_map_.begin ()); - iter != end; - ++iter) - { - // If this component is in the "shared components list", then we - // should just simply fetch the port object references from the - // NodeManager. - ACE_CString comp_name ((*iter).ext_id_.c_str ()); - - // Get all the facets first - Components::FacetDescriptions_var facets; - - if (this->is_shared_component (comp_name)) - { - ACE_DEBUG ((LM_DEBUG, "NAMImpl::create_connections: Component %s is shared\n", - comp_name.c_str ())); - facets = this->node_manager_->get_all_facets (comp_name); - } - else - { - ACE_DEBUG ((LM_DEBUG, "NAMImpl::create_connections: Component %s is not shared, getting and setting " - "all facets\n", - comp_name.c_str ())); - facets = ((*iter).int_id_)->get_all_facets (); - this->node_manager_->set_all_facets (comp_name, facets); - } - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "DAnCE (%P|%t) NodeApplicationManager_Impl.cpp -" - "CIAO::NodeApplicationManager_Impl::create_connections -" - "success getting facets for the component " - "instance [%s] \n", - comp_name.c_str ())); - } - - // Get all the event consumers - Components::ConsumerDescriptions_var consumers; - - if (this->is_shared_component (comp_name)) - { - ACE_DEBUG ((LM_DEBUG, "NAMImpl::create_connections: Component %s is shared\n", - comp_name.c_str ())); - consumers = this->node_manager_->get_all_consumers (comp_name); - } - else - { - ACE_DEBUG ((LM_DEBUG, "NAMImpl::create_connections: Component %s is not shared, getting and setting " - "all facets\n", - comp_name.c_str ())); - consumers = - ((*iter).int_id_)->get_all_consumers (); - this->node_manager_->set_all_consumers (comp_name, consumers); - } - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "DAnCE (%P|%t) NodeApplicationManager_Impl.cpp -" - "CIAO::NodeApplicationManager_Impl::create_connections -" - "success getting consumers for the component " - "instance [%s] \n", - comp_name.c_str ())); - } - - CORBA::ULong const facet_len = facets->length (); - CORBA::ULong const consumer_len = consumers->length (); - - CORBA::ULong const curr_len = retv->length (); - retv->length (curr_len + facet_len + consumer_len); - - CORBA::ULong i = 0; - for (i = 0; i < facet_len; ++i) - { - Deployment::Connection & conn = retv[len]; - conn.instanceName = (*iter).ext_id_.c_str (); - conn.portName = facets[i]->name (); - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "DAnCE (%P|%t) NodeApplicationManager_Impl.cpp -" - "CIAO::NodeApplicationManager_Impl::create_connections -" - "adding connection for facet [%s] in instance [%s] \n", - conn.portName.in (), conn.instanceName.in ())); - } - conn.kind = Deployment::Facet; - conn.endpoint = CORBA::Object::_duplicate (facets[i]->facet_ref ()); - ++len; - } - - for (i = 0; i < consumer_len; ++i) - { - Deployment::Connection & conn = retv[len]; - conn.instanceName = (*iter).ext_id_.c_str (); - conn.portName = consumers[i]->name (); - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "DAnCE (%P|%t) NodeApplicationManager_Impl.cpp -" - "CIAO::NodeApplicationManager_Impl::create_connections -" - "adding connection for consumer [%s] in instance [%s] \n", - conn.portName.in (), conn.instanceName.in ())); - } - conn.kind = Deployment::EventConsumer; - conn.endpoint = CORBA::Object::_duplicate (consumers[i]->consumer ()); - ++len; - } - } - return retv._retn (); -} - -Deployment::Application_ptr -CIAO::NodeApplicationManager_Impl_Base:: -startLaunch (const Deployment::Properties & configProperty, - Deployment::Connections_out providedReference, - CORBA::Boolean start) -{ +#include "NodeManager/NodeManager_Impl.h" + +using namespace DAnCE; + +NodeApplicationManager_Impl::NodeApplicationManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const Deployment::DeploymentPlan& plan, + RedirectionService & redirection, + const ACE_CString& node_name, + const PROPERTY_MAP &properties) + : plan_ (plan), + orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)), + application_ (0), + redirection_ (redirection), + node_name_ (node_name), + properties_ () +{ + DANCE_TRACE (DLINFO "NodeApplicationManager_Impl::NodeApplicationManager_Impl"); + + DANCE_DEBUG((LM_DEBUG, DLINFO " NodeApplicationManager_Impl::NodeApplicationManager_Impl - " + "Initializing for node '%s' and plan '%s' starting...\n", + node_name.c_str(), + plan_.UUID.in())); + this->register_plan(); + + PROPERTY_MAP::const_iterator i = properties.begin (); + while (!i.done ()) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplicationManager_Impl::NodeApplicationManager_Impl - " + "Binding value for property %s\n", i->key ().c_str ())); + this->properties_.bind (i->key (), i->item ()); + i.advance (); + } +} + +NodeApplicationManager_Impl::~NodeApplicationManager_Impl() +{ + DANCE_TRACE (DLINFO "NodeApplicationManager_Impl::~NodeApplicationManager_Impl"); + try { - CIAO_TRACE("CIAO::NodeApplicationManager_Impl::startLaunch"); - ACE_UNUSED_ARG (configProperty); - ACE_UNUSED_ARG (start); - - // In this step, we know all the "shared components" are - // the external components to ourself. - this->external_components_ = this->shared_components_; - - // If no additional components need to be installed, then we simply - // create a NA, but doesn't install any components on it. - if (this->plan_.instance.length () == this->shared_components_.length ()) - { - ACE_DEBUG ((LM_DEBUG, "Prespawn a NodeApplication process without " - "installing any components.\n")); - } - - /** - * 1. First Map properties to TAO/CIAO specific property/configurations - * 2. Necessary property checking (needed?) - * 3. Call create_nade_application to spawn new process. - * 4. Initialize the NodeApplication. - * 5. get the provided connection endpoints back and return them. - */ - - NodeImplementationInfoHandler handler (this->plan_, this->shared_components_); - - Deployment::NodeImplementationInfo * node_info = - handler.node_impl_info (); - - if (!node_info) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) NodeApplicationManager.cpp -" - "CIAO::NodeApplicationManager_Impl::startLaunch -" - "Failed to create Node Implementation Infos!\n")); - - throw - (Deployment::StartError ("NodeApplicationManager_Imp::startLaunch", - "Unable to get node level infos")); - } - - CIAO::DAnCE::ServerResource *server_resource = 0; - for (CORBA::ULong k = 0; k < node_info->nodeapp_config.length (); ++k) - { - if (ACE_OS::strcmp (node_info->nodeapp_config[k].name.in (), - "CIAOServerResources") == 0) - { - node_info->nodeapp_config[0].value >>= server_resource; - break; // Ignore the rest of the NodeApp_Config values - } - } - - // Now spawn the NodeApplication process. - // @@TODO: we need to pass arguments to the nodeapplication, ie - // naming service endpoints, if necessary - // (will) - ACE_CString cmd_option (this->nodeapp_command_op_.in ()); - - if (server_resource) - { - // If command line options are specified through RTCCM descriptors, - // then we should honor these command line options as well. - for (CORBA::ULong arg_i = 0; - arg_i < (*server_resource).args.length (); - ++arg_i) - { - cmd_option += " "; // space between command line args - cmd_option += (*server_resource).args[arg_i]; - } - - // If service configuration file is specified through RTCCM - // descriptors, then we should honor it as well. - if (ACE_OS::strcmp ((*server_resource).svcconf.in (), - "") != 0) - { - cmd_option += " -ORBSvcConf "; - cmd_option += (*server_resource).svcconf; - } - } - - Deployment::NodeApplication_var tmp = - create_node_application (cmd_option.c_str ()); - - if (CIAO::debug_level () > 9) - { - CORBA::ULong curr_len = node_info->impl_infos.length (); - ACE_UNUSED_ARG (curr_len); - - Deployment::ComponentImplementationInfos infos = - ((node_info->impl_infos)[0]).impl_infos; - - const CORBA::ULong info_len = infos.length (); - for (CORBA::ULong i = 0; i < info_len; ++i) - { - ACE_DEBUG ((LM_DEBUG, - "DAnCE (%P|%t) NodeApplicationManager.cpp -" - "CIAO::NodeApplicationManager_Impl::startLaunch -" - "The info for installation: " - "\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n", - infos[i].component_instance_name.in (), - infos[i].executor_dll.in (), - infos[i].executor_entrypt.in (), - infos[i].servant_dll.in (), - infos[i].servant_entrypt.in () )); - } - } - - // This is what we will get back, a sequence of component object refs. - Deployment::ComponentInfos_var comp_info; - - // This will install all homes and components. - comp_info = this->nodeapp_->install (*node_info); - - - // Now fill in the map we have for the "newly installed" components. - const CORBA::ULong comp_len = comp_info->length (); - for (CORBA::ULong len = 0; - len < comp_len; - ++len) - { - //FUZZ: disable check_for_lack_ACE_OS - //Since we know the type ahead of time...narrow is omitted here. - if (this->component_map_. - bind (comp_info[len].component_instance_name.in(), - Components::CCMObject::_duplicate - (comp_info[len].component_ref.in()))) - //FUZZ: enable check_for_lack_ACE_OS - { - ACE_CString error ("Duplicate component instance name "); - error += comp_info[len].component_instance_name.in(); - - throw - (Deployment::StartError - ("NodeApplicationManager_Impl::startLaunch", - error.c_str ())); - } - } - - // Also, we need to fill in the map about those "shared components" - // For now, we could use "NIL" component object reference for these - // shared components since they are not used anyway. - CORBA::ULong shared_comp_length = this->shared_components_.length (); - for (CORBA::ULong j = 0; j < shared_comp_length; ++j) - { - //FUZZ: disable check_for_lack_ACE_OS - if (this->component_map_. - bind (this->shared_components_[j].name.in (), - Components::CCMObject::_nil ())) - //FUZZ: enable check_for_lack_ACE_OS - { - ACE_CString error ("Duplicate component instance name "); - error += this->shared_components_[j].name.in(); - - throw - (Deployment::StartError - ("NodeApplicationManager_Impl::startLaunch", - error.c_str ())); - } - } - - - providedReference = - this->create_connections (); - - if (providedReference == 0) + if (this->application_ != 0) { - throw - (Deployment::StartError - ("NodeApplicationManager_Impl::startLaunch", - "Error creating connections for components during startLaunch.")); + CORBA::Object_var app = this->poa_->servant_to_reference (this->application_); + PortableServer::ObjectId_var id = this->poa_->reference_to_id (app); + this->poa_->deactivate_object (id); + + delete this->application_; + this->application_ = 0; } } - catch (const Deployment::UnknownImplId& e) - { - throw Deployment::StartError (e.name.in (), e.reason.in ()); - } - catch (const Deployment::ImplEntryPointNotFound& e) + catch (...) { - throw Deployment::StartError (e.name.in (), e.reason.in ()); + DANCE_ERROR ((LM_WARNING, DLINFO "NodeApplicationManager_Impl::~NodeApplicationManager_Impl - " + "Caught exception in NodeApplicationManager destructor\n")); } - catch (const Deployment::InstallationFailure& e) - { - throw Deployment::StartError (e.name.in (), e.reason.in ()); - } - - return Deployment::NodeApplication::_duplicate (this->nodeapp_.in ()); } - Deployment::Application_ptr -CIAO::NodeApplicationManager_Impl_Base:: -perform_redeployment (const Deployment::Properties & configProperty, - Deployment::Connections_out providedReference, - CORBA::Boolean add_or_remove, // true means "add" only - CORBA::Boolean start) -{ - // Prerequisite: - // (1) If this is an existiing old NAM, then <nodeapp_> is ready to use. - // We also got a copy of <plan_> as well as all the installed components - // in the <component_map_>. - // (2) Then we should call <install> operation on the NA, but in order to do this, - // we must pack all the to-be-added components into some appropriate - // data structure called "NodeImplementationInfo". - // (3) We should also call <remove> operation on the NA to remove those - // to-be-removed components, and the "comp_inst_name" could be as input. - // (4) We should also consider removing all the unneeded "connections", but - // this should be driven by the DAM, so it looks like that we need to - // add another operation on the NA interface which is a counterpart of - // <finishLaunch>, something like <finishLaunch_remove_only>. - // - // - // - // (1) If this is an brand new NAM, then only new installation is needed. - // (2) Then we could pretty much replicate the "startLaunch" implementation. - // This capability is useful to install a set of new components into - // some totally new nodes. - - - CIAO_TRACE ("CIAO::NodeApplicationManager_Impl_Base::perform_redeployment"); - - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) NodeApplicationManager_Impl_Base: " - "invoked CIAO::NodeApplicationManager_Impl_Base::perform_redeployment \n")); - try - { - if (! CORBA::is_nil (this->nodeapp_.in ())) - { - if (add_or_remove == true) - { - this->add_new_components (); - } - else - { - this->remove_existing_components (); - } - - // NOTE: We are propogating back "all" the facets/consumers object - // references to the DAM, including the previous existing ones. - providedReference = - this->create_connections (); - - if (providedReference == 0) - { - throw Deployment::InstallationFailure ("NodeApplicationManager_Impl::startLaunch", - "Error creating connections during startLaunch."); - } - } - else // This is a new NodeApplication process, then we need to install - // all the components. We should try to reuse much of the above code. - { - this->startLaunch (configProperty, - providedReference, - start); - } - } - catch (const Deployment::UnknownImplId& e) - { - throw Deployment::UnknownImplId (e.name.in (), e.reason.in ()); - } - catch (const Deployment::ImplEntryPointNotFound& e) - { - throw Deployment::ImplEntryPointNotFound (e.name.in (), e.reason.in ()); - } - catch (const Deployment::InstallationFailure& e) - { - throw Deployment::InstallationFailure (e.name.in (), e.reason.in ()); - } - - return Deployment::NodeApplication::_duplicate (this->nodeapp_.in ()); -} - - -void -CIAO::NodeApplicationManager_Impl_Base:: -add_new_components () -{ - try - { - // We ignored those components that are already in the <component_map_>, for - // the rest ones, we pack them into NodeImplementationInfo. - Deployment::DeploymentPlan tmp_plan = this->plan_; - tmp_plan.instance.length (0); - - const CORBA::ULong length = this->plan_.instance.length (); - for (CORBA::ULong i = 0; i < length; ++i) - { - // add the new components into the tmp_plan - if (this->component_map_.find (this->plan_.instance[i].name.in ()) != 0) - { - CORBA::ULong cur_len = tmp_plan.instance.length (); - tmp_plan.instance.length (cur_len + 1); - tmp_plan.instance[cur_len] = this->plan_.instance[i]; - } - } - - // If there are no new components to be installed ... - if (tmp_plan.instance.length () == 0) - return; +NodeApplicationManager_Impl::startLaunch (const Deployment::Properties &, + Deployment::Connections_out providedReference) +{ + DANCE_TRACE (DLINFO "NodeApplicationManager_Impl::startLaunch"); + + // Creating NodeApplication object + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplicationManager_impl::startLaunch - " + "Initializing NodeApplication\n")); + ACE_NEW_THROW_EX (this->application_, + NodeApplication_Impl (this->orb_.in(), + this->poa_.in(), + this->plan_, + this->redirection_, + this->node_name_, + this->properties_), + CORBA::NO_MEMORY ()); - // package the components - NodeImplementationInfoHandler handler (tmp_plan, - this->shared_components_); - Deployment::NodeImplementationInfo * node_info = - handler.node_impl_info (); + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplicationManager_impl::startLaunch - " + "Instructing NodeApplication to initialize components. \n")); + this->application_->init_components(); - if (!node_info) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) NodeApplicationManager.cpp -" - "CIAO::NodeApplicationManager_Impl::perform_redeployment -" - "Failed to create Node Implementation Infos!\n")); + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplicationManager_impl::startLaunch - " + "Collecting connection references\n")); + providedReference = this->application_->getAllConnections(); + //this->parent_.registerConnections(this->plan_.UUID.in(), *providedReference); - throw - (Deployment::PlanError ("NodeApplicationManager_Imp::perform_redeployment", - "Unable to get node level infos")); - } + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplicationManager_impl::startLaunch - " + "Activating NodeApplication servant\n")); + PortableServer::ObjectId_var as_id = + this->poa_->activate_object (this->application_); - // Install the components - // This is what we will get back, a sequence of component object refs. - Deployment::ComponentInfos_var comp_info; - comp_info = this->nodeapp_->install (*node_info); + CORBA::Object_var as_obj = this->poa_->id_to_reference (as_id.in ()); + Deployment::Application_var app = Deployment::Application::_narrow (as_obj.in ()); - // Now fill in the map we have for the components. - const CORBA::ULong comp_len = comp_info->length (); - for (CORBA::ULong len = 0; - len < comp_len; - ++len) - { - //FUZZ: disable check_for_lack_ACE_OS - //Since we know the type ahead of time...narrow is omitted here. - if (this->component_map_. - bind (comp_info[len].component_instance_name.in(), - Components::CCMObject::_duplicate - (comp_info[len].component_ref.in()))) - { - //FUZZ: enable check_for_lack_ACE_OS - ACE_CString error ("Duplicate component instance name "); - error += comp_info[len].component_instance_name.in(); - - throw - (Deployment::PlanError - ("NodeApplicationManager_Impl::startLaunch", - error.c_str ())); - } - } - } - catch (const CORBA::Exception&) - { - ACE_ERROR ((LM_ERROR, "NodeApplicationManager_Impl_Base::" - "add_new_components () exception caught.\n")); - throw; - } + return app._retn (); } - void -CIAO::NodeApplicationManager_Impl_Base:: -remove_existing_components () +NodeApplicationManager_Impl::destroyApplication (Deployment::Application_ptr application) { + DANCE_TRACE (DLINFO "NodeApplicationManager_Impl::destroyApplication"); + try - { - ACE_Vector<ACE_CString> gone_component_list; - - for (Component_Iterator iter (this->component_map_.begin ()); - iter != this->component_map_.end (); - ++iter) - { - ACE_CString comp_name ((*iter).ext_id_.c_str ()); - - // If this component is not in the new deployment plan, then we - // should destroy this component and unbind from the map. - if (this->is_to_be_removed (comp_name.c_str ())) - { - ((*iter).int_id_)->ciao_passivate (); - this->nodeapp_->remove_component (comp_name.c_str ()); - gone_component_list.push_back (comp_name); - } - } - - for (size_t i = 0; i < gone_component_list.size (); ++i) - this->component_map_.unbind (gone_component_list[i]); - } - catch (const CORBA::Exception&) - { - ACE_ERROR ((LM_ERROR, "NodeApplicationManager_Impl_Base::" - "remove_existing_components () exception caught.\n")); - throw; - } -} - -bool -CIAO::NodeApplicationManager_Impl_Base:: -is_to_be_removed (const char * name) -{ - const CORBA::ULong length = this->plan_.instance.length (); - for (CORBA::ULong i = 0; i < length; ++i) - { - if (ACE_OS::strcmp (name, - this->plan_.instance[i].name.in ()) == 0) - { - // If we have found it in the new plan, then this component - // needs to be kept, and should not be removed. - return false; - } - } - return true; -} - -void -CIAO::NodeApplicationManager_Impl_Base:: -set_shared_components (const Deployment::ComponentPlans & shared) -{ - this->shared_components_ = shared; -} - -void -CIAO::NodeApplicationManager_Impl_Base:: -destroyApplication (Deployment::Application_ptr app) -{ - CIAO_TRACE("CIAO::NodeApplicationManager_Impl::destroyApplication"); - ACE_UNUSED_ARG (app); - - ACE_DEBUG ((LM_DEBUG, "NAM: entering DA\n")); - //ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - //@@ Since we know there is only 1 nodeapp so the passed in - // parameter is ignored for now. - if (CORBA::is_nil (this->nodeapp_.in () )) - throw Deployment::StopError (); - - // Iterate over all the components within this NAM, and if it's - // not a shared component, then remove it. If all the components - // are removed, then we shall kill the NA totally. - for (CORBA::ULong i = 0; i < this->plan_.instance.length (); ++i) - { - ACE_DEBUG ((LM_DEBUG, "NAM: first for loop: %s\n", - this->plan_.instance[i].name.in ())); - ACE_CString name = plan_.instance[i].name.in (); - if (this->is_shared_component (name)) - { - this->component_map_.unbind (name); - continue; - } - - // If this is not a shared component and is installed within - // this NAM, then remove it. Otherwise, we do nothing. - // Ideally, we should ask NM to remove this component for - // us even if this is not within this NAM. - if (! this->is_external_component (name)) - { - this->nodeapp_->remove_component (name.c_str ()); - this->component_map_.unbind (name); - } - } - - // Call remove on NodeApplication, if all the components are removed, - // then the NodeApplication will kill itself. - ACE_DEBUG ((LM_DEBUG, "NAM: calling remove\n")); - this->nodeapp_->remove (); - ACE_DEBUG ((LM_DEBUG, "NAM: remove returned\n")); - - return; -} - -// The set priority method -::CORBA::Long -CIAO::NodeApplicationManager_Impl_Base::set_priority ( - const char * cid, - const ::Deployment::Sched_Params & params) -{ - if (CIAO::debug_level () > 20) - { - ACE_DEBUG ((LM_DEBUG , "NAM::The component Id received [%s]", cid)); - - ACE_DEBUG ((LM_DEBUG , - "NAM::The params are policy [%d], priority [%d], " - "scope [%d], time [%d]\n", - params.policy_ , - params.priority_, - params.scope_, params.msec_)); - } - - // First validate the values coming in .... - ACE_Sched_Params::Policy policy = params.policy_; - - if (policy != ACE_SCHED_FIFO && - policy != ACE_SCHED_RR && - policy != ACE_SCHED_OTHER) - return -1; - - ACE_Sched_Priority priority = params.priority_; - - // check the scope .. - if (params.scope_ != ACE_SCOPE_PROCESS && - params.scope_ != ACE_SCOPE_THREAD && - params.scope_ != ACE_SCOPE_LWP) - { - return -1; - } - - // FUZZ: disable check_for_lack_ACE_OS - // Here form the ACE_Sched_Params structure and pass it on to the Process - // manager with the current process id. - // @@ TODO: Right now we are ignoring params.msec_ value since - // ACE_OS::sched_params fails setting errno = EINVAL if - // scope = ACE_PROCESS_SCOPE and quantun != ACE_Time_Value:zero. - ACE_Sched_Params sched_params (policy, - priority, - params.scope_, - ACE_Time_Value::zero); - // FUZZ: enable check_for_lack_ACE_OS - - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - if (node_app_process_manager_.set_scheduler (sched_params, process_id_) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "User is not superuser, therefore cannot modify the " - "priority of the component\n")); - } - else if (ACE_OS::last_error () == ESRCH) - { - ACE_DEBUG ((LM_DEBUG, - "No process with PID: %d was found!\n", - process_id_)); - } - else if (ACE_OS::last_error () == EINVAL) - { - ACE_DEBUG ((LM_DEBUG, "\nGiven sched_params does not make sence " - "for the current scheduling policy\n")); - } - ACE_ERROR ((LM_ERROR, "NodeApplicationManager (%P|%t): sched_params " - "failed\n")); - return -1; - } - return 1; -} - -/////////////////////////////////////////////////////////////////////// - -CIAO::NodeApplicationManager_Impl::~NodeApplicationManager_Impl (void) -{ -} - -CIAO::NodeApplicationManager_Impl:: -NodeApplicationManager_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - bool is_multi_threaded) - : NodeApplicationManager_Impl_Base (o, p) - , is_multi_threaded_ (is_multi_threaded) -{ -} - -PortableServer::ObjectId -CIAO::NodeApplicationManager_Impl::init ( - const char *nodeapp_location, - const char *nodeapp_op, - const CORBA::ULong delay, - const Deployment::DeploymentPlan & plan, - const PortableServer::POA_ptr callback_poa, - NodeManager_Impl_Base * nm) -{ - PortableServer::ObjectId_var oid; - - try - { - if (nodeapp_location == 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) NodeApplicationManager_Impl.cpp -" - "CIAO::NodeApplicationManager_Impl::init -" - "NULL NodeApplication location. \n")); - throw CORBA::BAD_PARAM (); - } - - if (delay == 0) - { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) NodeApplicationManager_Impl.cpp -" - "CIAO::NodeApplicationManager_Impl::init -" - "NodeManager must be started with a -d " - "of greter than zero.\n")); - throw CORBA::BAD_PARAM (); - } - - this->nodeapp_path_.set (nodeapp_location); - this->spawn_delay_ = delay; - this->nodeapp_command_op_ = CORBA::string_dup (nodeapp_op); - this->node_manager_ = nm; - - // Make a copy of the plan for later usage. - this->plan_ = plan; - - // Cache the call back POA for callback object. - this->callback_poa_ = PortableServer::POA::_duplicate (callback_poa); - - // Activate the ourself. - oid = this->poa_->activate_object (this); - - CORBA::Object_var obj = - this->poa_->id_to_reference (oid.in ()); - - // And cache the object reference. - this->objref_ = - Deployment::NodeApplicationManager::_narrow (obj.in ()); - - // add the signal handler to the ACE_REACTOR - - /* - if (orb_->orb_core ()->reactor ()-> - register_handler (SIGCHLD, - &child_handler_) == -1) - - if (ACE_Reactor::instance ()->register_handler (SIGCHLD, - &child_handler_) == -1) - { - ACE_DEBUG ((LM_DEBUG, "Error in registering Handler\n\n")); - } - */ - } - - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("NodeApplicationManager_Impl_Base::init\t\n"); - throw; - } - - //return this object reference - return oid.in (); -} - -Deployment::NodeApplication_ptr -CIAO::NodeApplicationManager_Impl:: -create_node_application (const ACE_CString & options) -{ - CIAO_TRACE("CIAO::NodeApplicationManager_Impl::create_node_application"); - Deployment::NodeApplication_var retval; - Deployment::Properties_var prop; - - ACE_NEW_THROW_EX (prop, - Deployment::Properties, - CORBA::NO_MEMORY ()); - - // @@ Create a new callback servant. - CIAO::NodeApplication_Callback_Impl * callback_servant = 0; - ACE_NEW_THROW_EX (callback_servant, - CIAO::NodeApplication_Callback_Impl (this->orb_.in (), - this->callback_poa_.in (), - this->objref_.in (), - prop.in (), - this->waitCond_, - this->mutex_), - CORBA::NO_MEMORY ()); - - PortableServer::ServantBase_var servant_var (callback_servant); - PortableServer::ObjectId_var cb_id - = this->callback_poa_->activate_object (callback_servant); - - ACE_Process_Options p_options; - ACE_Process_Manager process_manager; - - process_manager.open (10, ACE_Reactor::instance ()); - - try - { - CORBA::Object_var cb_obj = - this->callback_poa_->id_to_reference (cb_id.in ()); - - CIAO::NodeApplication_Callback_var cb = - CIAO::NodeApplication_Callback::_narrow (cb_obj.in ()); - - CORBA::String_var cb_ior = - this->orb_->object_to_string (cb.in ()); - - // spawn the new NodeApplication. - p_options.command_line ("%s -k %s " - "%s", - this->nodeapp_path_.c_str (), - cb_ior.in (), - options.c_str ()); - - p_options.avoid_zombies (0); - - process_id_ = node_app_process_manager_.spawn (p_options, - &child_handler_); - - if (process_id_ == ACE_INVALID_PID) - { - if (CIAO::debug_level () > 1) - { - ACE_ERROR ((LM_ERROR, - "Fail to spawn a NodeApplication process\n")); - } - - throw - (Deployment::ResourceNotAvailable - ("Failed to spawn process", - "NodeApplication", - "", - "", - "")); - } - - // wait for nodeApp to pass back its object reference. with a - // timeout value. using perform_work and stuff. - ACE_Time_Value timeout (this->spawn_delay_, 0); - - if (this->is_multi_threaded_) - retval = multi_threaded_wait_for_callback (callback_servant, timeout); - else - retval = single_threaded_wait_for_callback (callback_servant, timeout); - - if (CORBA::is_nil (retval.in ())) - { - if (CIAO::debug_level () > 1) - { - ACE_ERROR ((LM_ERROR, - "Fail to acquire the NodeApplication object\n")); - } - - throw Deployment::ResourceNotAvailable (); - } - + { + if (!application->_is_equivalent (this->poa_->servant_to_reference (this->application_))) { - //ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - this->nodeapp_ = - Deployment::NodeApplication::_duplicate (retval.in ()); + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplicationManager_Impl::destroyApplication - " + "application is equivalent to current application \n")); + throw ::Deployment::StopError(); } - } - catch (const CORBA::Exception&) - { - this->callback_poa_->deactivate_object (cb_id.in ()); - - throw; - } - - this->callback_poa_->deactivate_object (cb_id.in ()); - - if (CIAO::debug_level () > 1) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO::NodeApplicationManager_Impl::NodeApplication spawned!\n")); - } - - // push the component info and the process id to the - // NodeManager - push_component_info (process_id_); - - - return retval._retn (); -} - - -Deployment::NodeApplication_ptr -CIAO::NodeApplicationManager_Impl:: -single_threaded_wait_for_callback ( - CIAO::NodeApplication_Callback_Impl * cb_servant, - ACE_Time_Value &timeout) -{ - // Below code is broken for thread-per-connection concurrency model, - // since the main thread is running ORB event loop and will spawn - // a different thread to handle the call <register_node_application>, - // the <perform_work> operation will not be invoked and finally - // a timeout will occur. For a similar reason, it won't work - // for thread-pool concurrency model. - Deployment::NodeApplication_var retv; - while (true) - { - this->orb_->perform_work (timeout); - - retv = cb_servant->get_nodeapp_ref (); - - if ((timeout == ACE_Time_Value::zero) || !CORBA::is_nil (retv.in ())) - break; - } - - return retv._retn (); -} - -Deployment::NodeApplication_ptr -CIAO::NodeApplicationManager_Impl:: -multi_threaded_wait_for_callback ( - CIAO::NodeApplication_Callback_Impl* cb_servant, - ACE_Time_Value &timeout) -{ - Deployment::NodeApplication_var retv; - - // Wait for a conditional variable - this->mutex_.acquire (); - while (! cb_servant->is_callback_completed ()) - this->waitCond_.wait (&timeout); - retv = cb_servant->get_nodeapp_ref (); - this->mutex_.release (); - - return retv._retn (); -} - - -void -CIAO::NodeApplicationManager_Impl:: -push_component_info (pid_t process_id) -{ - CIAO::NodeManager_Impl_Base::Component_Ids comp; - - for (unsigned int i=0;i < plan_.instance.length ();i++) - { - if (CIAO::debug_level () > 10) - { - ACE_DEBUG ((LM_DEBUG, "The component id is [%s]", - plan_.instance[i].name.in ())); - } - comp.cid_seq_.insert (plan_.instance[i].name.in ()); - } - - comp.process_id_ = process_id; - - node_manager_->push_component_id_info (comp); -} - -///////////////////////////////////////////////////////////////////////// - -CIAO::Static_NodeApplicationManager_Impl::~Static_NodeApplicationManager_Impl (void) -{ -} - -CIAO::Static_NodeApplicationManager_Impl:: -Static_NodeApplicationManager_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - Static_Config_EntryPoints_Maps* static_config_entrypoints_maps) - : NodeApplicationManager_Impl_Base (o, p), - static_config_entrypoints_maps_ (static_config_entrypoints_maps) -{ -} - -PortableServer::ObjectId -CIAO::Static_NodeApplicationManager_Impl::init ( - const char *nodeapp_location, - const char *nodeapp_op, - const CORBA::ULong delay, - const Deployment::DeploymentPlan & plan, - const PortableServer::POA_ptr callback_poa, - NodeManager_Impl_Base * nm) -{ - PortableServer::ObjectId_var oid; - - ACE_UNUSED_ARG (nodeapp_location); - ACE_UNUSED_ARG (nodeapp_op); - ACE_UNUSED_ARG (delay); - ACE_UNUSED_ARG (callback_poa); - - try - { - this->node_manager_ = nm; - - // Make a copy of the plan for later usage. - this->plan_ = plan; - - // Activate the ourself. - oid = this->poa_->activate_object (this); - - CORBA::Object_var obj = - this->poa_->id_to_reference (oid.in ()); - - // And cache the object reference. - this->objref_ = - Deployment::NodeApplicationManager::_narrow (obj.in ()); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("NodeApplicationManager_Impl_Base::init\t\n"); - throw; - } - - //return this object reference - return oid.in (); -} - -Deployment::NodeApplication_ptr -CIAO::Static_NodeApplicationManager_Impl:: -create_node_application (const ACE_CString & options) -{ - ACE_UNUSED_ARG(options); - - CIAO::NodeApplication_Impl *nodeapp_servant; - - ACE_DEBUG ((LM_DEBUG, "create_static_node_application\n")); - - ACE_NEW_RETURN (nodeapp_servant, - CIAO::NodeApplication_Impl (orb_.in (), - poa_.in (), - configurator_, - this->static_config_entrypoints_maps_), - Deployment::NodeApplication::_nil () - ); - if (nodeapp_servant->init ()) - { - ACE_DEBUG ((LM_DEBUG, "NodeApplication Failed on creating and\ - initializing the session container!")); - return Deployment::NodeApplication::_nil (); - } - - // CONFIGURING NodeApplication - PortableServer::ObjectId_var nodeapp_oid - = poa_->activate_object (nodeapp_servant); + this->redirection_.unregister (this->node_name_, this->plan_.UUID.in()); + + CORBA::Any val; - CORBA::Object_var - obj = poa_->id_to_reference (nodeapp_oid.in ()); - - Deployment::NodeApplication_var nodeapp_obj = - Deployment::NodeApplication::_narrow (obj.in ()); - - if (CORBA::is_nil (nodeapp_obj.in ())) - { - ACE_ERROR ((LM_ERROR, "Unable to activate NodeApplication object\n")); - return Deployment::NodeApplication::_nil (); - } - - this->nodeapp_ = Deployment::NodeApplication::_duplicate (nodeapp_obj.in ()); - - return nodeapp_obj._retn (); -} - -CIAO::NodeApplicationManager_Impl_Base::~NodeApplicationManager_Impl_Base (void) -{ + if (this->properties_.find (DAnCE::STANDALONE_NM, + val) == 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicationManager_Impl::destroyApplication - " + "Found STANDALONE_NM property\n")); + + CORBA::Boolean standalone (false); + + val >>= CORBA::Any::to_boolean (standalone); + if (standalone) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplicationManager_Impl::destroyApplication - " + "Acting as a standalone NM, passivating and removing installed components\n")); + + this->application_->passivate_components (); + this->application_->remove_components (); + } + } + + + PortableServer::ObjectId_var id = this->poa_->reference_to_id (application); + this->poa_->deactivate_object (id); + + delete this->application_; + this->application_ = 0; + } + catch (CORBA::SystemException &) + { + throw; + } + catch (Deployment::StopError &) + { + throw; + } + catch (CORBA::UserException &e) + { + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplicationManager_Impl::destroyApplication failed with UserException %s(%s) \"%s\"\n", + e._name(), e._rep_id(), e._info().c_str())); + throw Deployment::StopError(e._name(), e._info().c_str()); + } + catch (...) + { + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplicationManager_Impl::destroyApplication failed with unknown exception.\n")); + throw Deployment::StopError(); + } +} + +void +NodeApplicationManager_Impl::register_plan(void) +{ + DANCE_TRACE(DLINFO "NodeApplicationManager_Impl::register_plan()"); + + this->redirection_.registration_start (this->node_name_, this->plan_.UUID.in()); + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplicationManager_Impl::register_plan - registering objects...\n")); + for (unsigned int i = 0; i < this->plan_.instance.length(); i++) + { + this->redirection_.registration (this->node_name_, + this->plan_.UUID.in(), + this->plan_.instance[i].name.in(), + CORBA::Object::_nil()); + } + + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplicationManager_Impl::register_plan - registering endpoints...\n")); + for (unsigned int i = 0; i < this->plan_.connection.length(); i++) + { + for (unsigned int j = 0; j < this->plan_.connection[i].internalEndpoint.length(); j++) + { + if (this->plan_.connection[i].internalEndpoint[j].provider) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicationManager_Impl::register_plan - ", + "Registering Port '%s' on instance '%s' on node '%s'\n", + this->plan_.connection[i].internalEndpoint[j].portName.in(), + this->plan_.instance[this->plan_.connection[i].internalEndpoint[j].instanceRef].name.in(), + this->node_name_.c_str ())); + this->redirection_.registration (this->node_name_, + this->plan_.UUID.in(), + this->plan_.instance[this->plan_.connection[i].internalEndpoint[j].instanceRef].name.in(), + this->plan_.connection[i].internalEndpoint[j].portName.in(), + CORBA::Object::_nil()); + } + } + } + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicationManager_Impl::register_plan - " + "Finishing registration\n")); + this->redirection_.registration_finish (this->node_name_, this->plan_.UUID.in()); } diff --git a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h index 50cfb3476e0..73b70010e52 100644 --- a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h +++ b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h @@ -1,380 +1,59 @@ -// $Id$ - // -*- C++ -*- //============================================================================= /** * @file NodeApplicationManager_Impl.h * - * @author Tao Lu <lu@dre.vanderbilt.edu> - * @author Gan Deng <dengg@dre.vanderbilt.edu> + * $Id$ + * + * @Brief Implementation of POA_Deployment::NodeApplicationManager * - * This file contains implementation for the servant of - * Deployment::NodeApplicationManager. + * @author Erwin Gottlieb <eg@prismtech.com> */ //============================================================================= +#ifndef NODEAPPLICATIONMANAGER_IMPL_H_ +#define NODEAPPLICATIONMANAGER_IMPL_H_ -#ifndef CIAO_NODEAPPLICATIONMANAGER_IMPL_H -#define CIAO_NODEAPPLICATIONMANAGER_IMPL_H -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SString.h" -#include "ace/Hash_Map_Manager_T.h" -#include "ace/OS_NS_sys_wait.h" -#include "ace/Process_Manager.h" -#include "ace/Synch.h" -#include "DAnCE/Deployment/NodeApp_CB_Impl.h" -#include "DAnCE/Deployment/Deployment_NodeApplicationManagerS.h" -#include "ciao/CIAO_common.h" -#include "CIAO_NAM_Export.h" -#include "ImplementationInfo.h" -#include "NodeManager/NodeManager_Impl.h" -#include "NodeApplication/NodeApplication_Core.h" +#include "NodeApplicationManager_Export.h" +#include "Deployment/Deployment_DeploymentPlanC.h" +#include "Deployment/Deployment_NodeApplicationManagerS.h" +#include "Deployment/Deployment_NodeApplicationC.h" +#include "NodeApplication/NodeApplication_Impl.h" +#include "RedirectionService/RedirectionService.h" -namespace CIAO -{ - - /** - * @class NodeApplicationManager_Impl_Base - */ - class CIAO_NAM_Export NodeApplicationManager_Impl_Base - : public virtual POA_Deployment::NodeApplicationManager +namespace DAnCE { - public: - /// Constructor - NodeApplicationManager_Impl_Base (CORBA::ORB_ptr o, - PortableServer::POA_ptr p); - - /*=========================================================== - * Below are operations from the NodeApplicationManager - * - *============================================================*/ - - /// The return type is NodeApplication_ptr actually. - /// For "external/shared" components of this child plan, they are - /// not actaully installed, however, the object references - /// of the ports of these external components are returned - /// through <providedReference>. - virtual Deployment::Application_ptr - startLaunch (const Deployment::Properties & configProperty, - Deployment::Connections_out providedReference, - CORBA::Boolean start); - - //@@ Destroy the whole applicaton. - virtual void destroyApplication (Deployment::Application_ptr); - - virtual Deployment::Application_ptr - perform_redeployment (const Deployment::Properties & configProperty, - Deployment::Connections_out providedReference, - CORBA::Boolean add_or_remove, - CORBA::Boolean start); - - virtual void - reset_plan (const ::Deployment::DeploymentPlan & plan); - - virtual void - set_shared_components (const Deployment::ComponentPlans & shared); - - /** - * A factory operation to create NodeApplicationManager interface, and return - * the object reference. - * Initialize the NodeApplicationManager. The current implementation - * of CIAO_NodeApplicationManager can only activate CIAO's own - * NodeApplication processes. You should specify the location - * (pathname) of the NodeApplication and the delay. - * CIAO_NodeApplicationManager should wait (in second) for NodeApplication to - * call back. - * - * @param nodeapp_location A null-termiated char * string pointing - * to the pathname of a NodeApplication executable. - * - * @param nodeapp_options A null-terminated char * string - * containing command line options to be passed to the - * NodeApplication. - * - * @param delay instructs how long (in second) a CIAO_NodeApplicationManager - * should wait for a newly spawned NodeApplication to pass back - * its IOR. - * - * @param plan has all the information needed for the NodeAppManager to - * construct the application locally. Note, this includes the properties - * of the NodeApplication. For example, ORB config options etc. - * - * @param callback_poa contains child poa created for the callback interface. - * - * @para nm Pointer to the NodeManager_Impl servant object - * - * @return NodeApplicationManager_ptr. - **/ - virtual PortableServer::ObjectId - init (const char *nodeapp_location, - const char *nodeapp_options, - const CORBA::ULong delay, - const Deployment::DeploymentPlan & plan, - const PortableServer::POA_ptr callback_poa, - NodeManager_Impl_Base * nm) - =0; - - /// @note This method doesn't do duplicate. - Deployment::NodeApplicationManager_ptr get_nodeapp_manager (void); - - /// Set the priority of the NodeApplication process which this NAM manages - virtual ::CORBA::Long set_priority ( - const char * cid, - const ::Deployment::Sched_Params & params); - - protected: - /// Destructor - virtual ~NodeApplicationManager_Impl_Base (void); - - /// Add new components - virtual void - add_new_components (void); - - /// Remove existing components - virtual void - remove_existing_components (void); - - /// Determine whether a component is absent in the new_plan - /// Return true if absent - virtual bool - is_to_be_removed (const char * name); - - /// Internal help function to create new NodeApplicationProcess - virtual Deployment::NodeApplication_ptr - create_node_application (const ACE_CString & options) = 0; - - /// Helper function to get the connection. - virtual Deployment::Connections * create_connections (); - - /** - * Find the configurations in the plan and prepare them to pass to the - * NodeApplication, from command line probably. - */ - void parse_config_value (ACE_CString & str); - - /// Helper function to check wheather a component instance - /// is in the "shared components list". - bool is_shared_component (ACE_CString & name); - - /// Helper function to check wheather a component instance - /// is in the "shared components list". - bool is_external_component (ACE_CString & name); - - protected: - /// location of the Nodeapplication - ACE_CString nodeapp_path_; - - /// Keep a pointer to the managing ORB serving this servant. - CORBA::ORB_var orb_; - - /// Keep a pointer to the managing POA. - PortableServer::POA_var poa_; - - /// Pointer to the NodeManager_Impl servant object - /// We could do this because NodeManager and NodeApplicationManager - /// are always collocated in the same process, so we don't have - /// to pass CORBA object reference back and forth. - NodeManager_Impl_Base * node_manager_; - - /// ObjectRef of ourself which will be needed by the callback - Deployment::NodeApplicationManager_var objref_; - - /// Child poa that uses active object map. - PortableServer::POA_var callback_poa_; - - /// Cache a object reference of the underlying NodeApplication - /// Since I have decided to have only 1 NA in NAM so no map is needed. - Deployment::NodeApplication_var nodeapp_; - - /// Cached plan (This should be the part of the whole plan local to this node) - /// The plan will be initialized when init is called. - Deployment::DeploymentPlan plan_; - - /// Specify the time in second NodeApplicationManager will wait for a - /// child NodeApplication to callback. Default is 5 second. - CORBA::ULong spawn_delay_; - - /// Extracted commandline options to pass to the NodeApplication. - CORBA::String_var nodeapp_command_op_; - /// A list of components shared across deployment plans - Deployment::ComponentPlans shared_components_; + class NodeManager_Impl; - /// A list of components that are "external" to this plan - Deployment::ComponentPlans external_components_; - - /// A map of the component created on this node. - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - Components::CCMObject_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> CCMComponent_Map; - typedef CCMComponent_Map::iterator Component_Iterator; - CCMComponent_Map component_map_; - - /// Synchronize access to the object set. - TAO_SYNCH_MUTEX lock_; - - /// The Process Manager for this NodeApplicationManager - ACE_Process_Manager node_app_process_manager_; - - /// The process id of the NA associated with the NAM, - /// Each NAM will only have one NA associated with it, - /// so we have only one process associated with it. - - // this is UNIX specific .... not portable - pid_t process_id_; - - /// For synchronization between multiple threads - ACE_Condition<TAO_SYNCH_MUTEX> waitCond_; - TAO_SYNCH_MUTEX mutex_; - }; - - - /** - * @class NAM_Handler - * @brief The signal handler class for the SIGCHLD - * handling to avoid zombies - * - */ - class NAM_Handler : public ACE_Event_Handler + class NodeApplicationManager_Export NodeApplicationManager_Impl : public virtual POA_Deployment::NodeApplicationManager { public: - virtual int handle_signal (int sig, - siginfo_t *, - ucontext_t *) - { - ACE_UNUSED_ARG (sig); - - // @@ Note that this code is not portable to all OS platforms - // since it uses print statements within signal handler context. - //ACE_DEBUG ((LM_DEBUG, - // "Executed ACE signal handler for signal %S \n", - // sig)); - - ACE_exitcode status; - // makes a claal to the underlying os system call - // -1 to wait for any child process - // and WNOHANG so that it retuurns immediately - ACE_OS::waitpid (-1 ,&status, WNOHANG, 0); - - return 0; - } + NodeApplicationManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const Deployment::DeploymentPlan& plan, + RedirectionService & redirection, + const ACE_CString& name, + const PROPERTY_MAP &properties); + + virtual ~NodeApplicationManager_Impl(); + + virtual Deployment::Application_ptr + startLaunch (const Deployment::Properties & configProperty, + Deployment::Connections_out providedReference); + + virtual void destroyApplication (Deployment::Application_ptr); + private: + void register_plan(); + + Deployment::DeploymentPlan plan_; + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; + NodeApplication_Impl* application_; + RedirectionService & redirection_; + ACE_CString node_name_; + PROPERTY_MAP properties_; }; - - - /** - * @class NodeApplicationManager_Impl - */ - class CIAO_NAM_Export NodeApplicationManager_Impl - : public virtual NodeApplicationManager_Impl_Base - { - public: - /// Constructor - NodeApplicationManager_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - bool is_multi_threaded); - - virtual PortableServer::ObjectId - init (const char *nodeapp_location, - const char *nodeapp_options, - const CORBA::ULong delay, - const Deployment::DeploymentPlan & plan, - const PortableServer::POA_ptr callback_poa, - NodeManager_Impl_Base * nm); - - protected: - /// Destructor - virtual ~NodeApplicationManager_Impl (void); - - // Internal help function to create new NodeApplicationProcess - // Here we override it to create an in-process NodeApplication object - virtual Deployment::NodeApplication_ptr - create_node_application (const ACE_CString & options); - - /// This method is only applicable when our program is configured as - /// singled threaded . Internally it uses a <perform_work> blocking - /// call to wait for NA object to call back - Deployment::NodeApplication_ptr - single_threaded_wait_for_callback ( - CIAO::NodeApplication_Callback_Impl* cb_servant, - ACE_Time_Value &timeout); - - /// This method is only applicable when our program is configured as - /// multiple threaded. Internally it waits on a conditional variable - /// that could be modified by the callback servant which runs in - /// another thread - Deployment::NodeApplication_ptr - multi_threaded_wait_for_callback ( - CIAO::NodeApplication_Callback_Impl* cb_servant, - ACE_Time_Value &timeout); - - /** - * @operation push_component_info - * @brief pushes component info to the NodeManager - * - * @param process_id The id of the process of NodeApplication - */ - void push_component_info (pid_t process_id); - - /// The signal handler - NAM_Handler child_handler_; - - private: - /// Whether we run ourselves in multi threaded configuration or not - /// By default, we run in single threaded configuration. - bool is_multi_threaded_; - }; - - - struct Static_Config_EntryPoints_Maps; - - /** - * @class Static_NodeApplicationManager_Impl - */ - class CIAO_NAM_Export Static_NodeApplicationManager_Impl - : public virtual NodeApplicationManager_Impl_Base - { - public: - /// Constructor - Static_NodeApplicationManager_Impl (CORBA::ORB_ptr o, - PortableServer::POA_ptr p, - Static_Config_EntryPoints_Maps* static_config_entrypoints_maps); - - virtual PortableServer::ObjectId - init (const char *nodeapp_location, - const char *nodeapp_options, - const CORBA::ULong delay, - const Deployment::DeploymentPlan & plan, - const PortableServer::POA_ptr callback_poa, - NodeManager_Impl_Base * nm); - - protected: - /// Destructor - virtual ~Static_NodeApplicationManager_Impl (void); - - /// Internal help function to create new NodeApplicationProcess - /// Here we override it to create an in-process NodeApplication object - virtual Deployment::NodeApplication_ptr - create_node_application (const ACE_CString & options); - - Static_Config_EntryPoints_Maps* static_config_entrypoints_maps_; - - CIAO::NodeApp_Configurator configurator_; - }; -} - -#if defined (__ACE_INLINE__) -# include "NodeApplicationManager_Impl.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* CIAO_NODEAPPLICATIONMANAGER_IMPL_H */ +}; +#endif /*NODEAPPLICATIONMANAGER_IMPL_H_*/ diff --git a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.inl b/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.inl deleted file mode 100644 index 14853100039..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.inl +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -ACE_INLINE -CIAO::NodeApplicationManager_Impl_Base:: -NodeApplicationManager_Impl_Base (CORBA::ORB_ptr o, - PortableServer::POA_ptr p) - : orb_ (CORBA::ORB::_duplicate (o)), - poa_ (PortableServer::POA::_duplicate (p)), - callback_poa_ (PortableServer::POA::_nil ()), - nodeapp_ (Deployment::NodeApplication::_nil ()), - spawn_delay_ (5), - waitCond_ (this->mutex_) - // @@ (OO) The default size for an ACE_Hash_Map_Mapanger is quiet - // large. The maximum size of an ACE_Hash_Map_Manager is - // also fixed, i.e. it does not grow dynamically on demand. - // Make sure the default size of component_map_ is - // appropriate for your needs. You may also want to make - // the size configurable at compile-time, at least. -{ -} - -ACE_INLINE -void -CIAO::NodeApplicationManager_Impl_Base:: -parse_config_value (ACE_CString &) -{ - throw CORBA::NO_IMPLEMENT(); -} - -ACE_INLINE -Deployment::NodeApplicationManager_ptr -CIAO::NodeApplicationManager_Impl_Base::get_nodeapp_manager (void) -{ - return this->objref_.in (); -} - -ACE_INLINE void -CIAO::NodeApplicationManager_Impl_Base:: -reset_plan (const ::Deployment::DeploymentPlan & plan) -{ - this->plan_ = plan; -} - diff --git a/CIAO/DAnCE/NodeApplicationManager/URL_Parser.cpp b/CIAO/DAnCE/NodeApplicationManager/URL_Parser.cpp deleted file mode 100644 index 5d211603614..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/URL_Parser.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// $Id$ - -#include "URL_Parser.h" - -#include "ace/ACE.h" -#include "ace/OS_NS_string.h" - -bool -URL_Parser::parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("rwu:h:p:f:d")); - - bool success = true; - int c; - - while ((c = get_opt ()) != -1) - { - switch (c) - { - case 'd': - this->debug_ = 1; - break; - case 'u': - success = parseURL (get_opt.opt_arg ()); - break; - // Usage fallthrough. - default: - success = false; - break; - } - } - - if (this->hostname_ == 0 || this->filename_ == 0) - { - success = false; - } - - return success; -} - -URL_Parser::URL_Parser (void) - : hostname_ (ACE::strnew ("127.0.0.1")), - port_ (ACE_DEFAULT_HTTP_SERVER_PORT), - filename_ (0), - debug_ (0) -{ -} - -bool URL_Parser::parseURL (char* url) -{ - char* ptr = ACE_OS::strstr (url, "http://"); - bool success = true; - - if (0 != ptr) - { - url += ACE_OS::strlen ("http://"); - } - - if (url[0] == '/') - { - this->filename_ = ACE_OS::strdup (url); - } - else - { - ptr = ACE_OS::strstr (url, ":"); - - if (0 != ptr) - { - this->port_ = ACE_OS::atoi (ptr + 1); - } - else - { - ptr = ACE_OS::strstr (url, "/"); - } - - if (0 == ptr) - { - success = false; - } - else - { - size_t host_len = ptr - url; - ACE::strdelete (this->hostname_); - ACE_NEW_RETURN (this->hostname_, char [host_len + 1], false); - ACE_OS::strncpy (this->hostname_, url, host_len); - this->hostname_ [host_len] = '\0'; - ptr = ACE_OS::strstr (ptr, "/"); - - if (0 != ptr) - { - this->filename_ = ACE_OS::strdup (ptr); - } - else - { - success = false; - } - } - } - - return success; -} - - -void URL_Parser::Error (void) -{ - ACE_DEBUG ((LM_DEBUG, - "./http_client -u http://hostname:port/filename [-d]\n")); -} - - -URL_Parser::~URL_Parser (void) -{ - delete [] this->hostname_; - ACE_OS::free (this->filename_); -} diff --git a/CIAO/DAnCE/NodeApplicationManager/URL_Parser.h b/CIAO/DAnCE/NodeApplicationManager/URL_Parser.h deleted file mode 100644 index 0aec98cec65..00000000000 --- a/CIAO/DAnCE/NodeApplicationManager/URL_Parser.h +++ /dev/null @@ -1,67 +0,0 @@ - -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file URL_Parser.h - * - * $Id$ - * - * Parses a URL into its logical chunks - * - * @author Stoyan Paunov - */ -//============================================================================= - - -#ifndef URL_PARSER_H -#define URL_PARSER_H - -#include "ace/Get_Opt.h" -#include "ace/ARGV.h" -#include "ace/Singleton.h" //for ACE_Singleton -#include "ace/Null_Mutex.h" //for ACE_Null_Mutex - -//forward declaration -class URL_Parser; - -typedef ACE_Singleton <URL_Parser, ACE_Null_Mutex> TheURL_Parser; - - -class URL_Parser -{ -public: - - friend class ACE_Singleton <URL_Parser, ACE_Null_Mutex>; - - /// Parses commandline arguments - bool parse_args (int argc, ACE_TCHAR *argv[]); - - // Return false on failure - bool parseURL (char* url); - - void Error (void); - - /// Hostname to connect to - ACE_TCHAR *hostname_; - - /// Port number to use - u_short port_; - - /// Filename to upload/download - ACE_TCHAR *filename_; - - /// turns on verbosity - int debug_; - - /// Destructor - ~URL_Parser (void); - -protected: - /// protected constructor, singleton - URL_Parser (void); -}; - - - -#endif /* URL_PARSER_H */ diff --git a/CIAO/DAnCE/NodeManager/BaseMonitor.h b/CIAO/DAnCE/NodeManager/BaseMonitor.h deleted file mode 100644 index 5fe6a950908..00000000000 --- a/CIAO/DAnCE/NodeManager/BaseMonitor.h +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ -//---------------------------------------------------------------------------------- -/// Monitor Interface -/* - * @file BaseMonitor.h - * @brief The BaseMonitor.h file. - * This is an abstract class containing the interface to the Monitor plug-in - * - * @author Nilabja R <nilabjar@dre.vanderbilt.edu> - */ -//---------------------------------------------------------------------------------- - -#ifndef MONITOR_BASEH -#define MONITOR_BASEH -#include "tao/ORB.h" -#include "DAnCE/Deployment/Deployment_TargetManagerC.h" - -namespace CIAO -{ - - class MonitorBase - { - public: - virtual ~MonitorBase () {}; - - /** - * This function is called by the controller to initialize - * parameters. - * @param domain The Initital domain for this host - * @param target_manager TargetManager_ptr - * @param interval The time interval after which updates need to be send. - */ - virtual int initialize_params ( - ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target_manager, - int interval - )=0; - /** - * This function is called by the controller - * to start up the monitor. - * @param orb The ORB pointer - */ - virtual int start (CORBA::ORB_ptr orb) = 0; - /** - * This function is called by the controller - * to stop the monitor. - */ - virtual int stop ()=0; - /** - * This function is called by the controller - * to get the current data. - * @return The current Domain data - */ - virtual ::Deployment::Domain* get_current_data ()=0; - }; - - extern "C" ACE_Proper_Export_Flag CIAO::MonitorBase * - createMonitor (void); - -} // CIAO - - -#endif /* MONITOR_BASEH */ diff --git a/CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp b/CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp deleted file mode 100644 index 9d9417da520..00000000000 --- a/CIAO/DAnCE/NodeManager/CIAO_Monitor.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// $Id$ -//========================================================================== -/// The RSS Monitor class defination -/** - * @file CIAO_Monitor.cpp - * - * @brief The Monitor class defination - * - * @author Nilabja Roy <nilabjar@dre.vanderbilt.edu> - */ -//========================================================================== - -#include "CIAO_Monitor.h" -#include "CIAO_common.h" -#include "ace/OS_NS_stdio.h" - -extern "C" ACE_Proper_Export_Flag CIAO::MonitorBase * CIAO::createMonitor () -{ - CIAO::CIAO_Monitor* monitor = 0; - ACE_NEW_RETURN (monitor, CIAO::CIAO_Monitor, 0); - return monitor; -} - -CIAO::CIAO_Monitor::CIAO_Monitor () -{ -} - -/// The Desctructor -CIAO::CIAO_Monitor::~CIAO_Monitor () -{ -} - -int CIAO::CIAO_Monitor::initialize_params ( - ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target_manager, - int interval - ) -{ - current_domain_.reset (new ::Deployment::Domain (domain)); - target_ptr_= target_manager; - this->interval_=interval; - - return 0; -} - -int CIAO::CIAO_Monitor::start (CORBA::ORB_ptr) -{ - return 0; -} - -int CIAO::CIAO_Monitor::stop () -{ - return 0; -} - -::Deployment::Domain* CIAO::CIAO_Monitor::get_current_data () -{ - if (CIAO::debug_level () > 9) - { - // ACE_DEBUG ((LM_DEBUG , - // "CIAO_Monitor::Inside the get_current_data of[%s]\n", - // current_domain_->node[0].name.in ())); - } - - CORBA::Double current_load = 0; - - long user_cpu; - long user_cpu_low; - long sys_cpu; - long idle_time; - - // get the load average value from the /proc/loadavg - - FILE *load_file = 0; - - load_file = ACE_OS::fopen ("/proc/stat", "r"); - - if (load_file == 0) - { - // load file cannot be opened .. - current_load = 0; - } - else - { - char buffer [99]; - - // read in the cpu label - fscanf (load_file, "%s", buffer); - - //read the user_cpu - fscanf (load_file, "%ld", &user_cpu); - - //read the user cpu low priority - fscanf (load_file, "%ld", &user_cpu_low); - - //read the system cpu - fscanf (load_file, "%ld", &sys_cpu); - - //read the cpu in idle time .. - fscanf (load_file, "%ld", &idle_time); - - ACE_OS::fclose (load_file); - - // Calculate the percent CPU - long const current_user_cpu = user_cpu - prev_user_cpu_; - long const total_cpu_usage = user_cpu + user_cpu_low + sys_cpu + - idle_time - prev_user_cpu_ - prev_idle_time_ - prev_sys_cpu_ - - prev_user_cpu_low_; - - current_load = (current_user_cpu * 100)/total_cpu_usage; - - // Save the current cpu values in the previous variables - - prev_user_cpu_ = user_cpu; - - prev_user_cpu_low_ = user_cpu_low; - - prev_sys_cpu_ = sys_cpu; - - prev_idle_time_ = idle_time; - - } - - - CORBA::Any any; - any <<= current_load; - - // here insert the util value, in the right position - - for (unsigned int i = 0; - i < current_domain_->node[0].resource.length (); - i++) - { - if (!ACE_OS::strcmp (current_domain_->node[0].resource[i].name, "Processor")) - { - for (unsigned int j = 0; - j < current_domain_->node[0].resource[i].property.length (); - j++) - { - if (!ACE_OS::strcmp ( - current_domain_ - ->node[0].resource[i].property[j].name.in (), - "LoadAverage")) - { - current_domain_->node[0].resource[i].property[j].kind = - ::Deployment::Quantity; - current_domain_->node[0].resource[i].property[j].value = - any; - } - } - } - } - - return current_domain_.get (); -} diff --git a/CIAO/DAnCE/NodeManager/CIAO_Monitor.h b/CIAO/DAnCE/NodeManager/CIAO_Monitor.h deleted file mode 100644 index 5a134538701..00000000000 --- a/CIAO/DAnCE/NodeManager/CIAO_Monitor.h +++ /dev/null @@ -1,107 +0,0 @@ -// $Id$ -//========================================================================== -/** - * @file CIAO_Monitor.h - * - * @brief The Monitor class. - * - * This class periodically records the loadavg value of the machine in which it - * loaded - * - * @author Nilabja Roy <nilabjar@dre.vanderbilt.edu> - */ -//========================================================================== - - -#ifndef CIAO_MONITORH -#define CIAO_MONITORH - -#include "BaseMonitor.h" -#include "ace/Auto_Ptr.h" - -/** - * @namespace CIAO - * - * @brief The top level CIAO namespace - * - */ -namespace CIAO -{ - class ReceiverThread; - - /** - * @class CIAO_Monitor - * - * @brief The Monitor class - * - */ - class CIAO_Monitor : public MonitorBase - { - public: - - /** @function Constructor - */ - CIAO_Monitor (); - - /** - * This function is called by the controller to initialize - * parameters. - * @param domain The Initial Domain for this host - * @param target_manager TargetManager_ptr - * @param interval The time interval after whic updates need to be send. - */ - virtual int initialize_params ( - ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target_manager, - int interval - ); - /** - * Destructor - */ - virtual ~CIAO_Monitor (); - - /** - * This method will starts up the Monitor in this case, - * @param orb The orb needed for resolving. - * @return -1 on error - */ - int start (CORBA::ORB_ptr orb); - - /** - * This method will stop the Monitor in this case - * @return -1 on error - */ - int stop (); - - /** - * This function retrieves the current Domain data - * @return -1 on error - */ - ::Deployment::Domain* get_current_data (); - - protected: - - /// The TargetManager Object to be sent to the RSSSubscriber .. - ::Deployment::TargetManager_ptr target_ptr_; - - /// The interval after which update is to be returned. - int interval_; - - /// The Domain data structure - auto_ptr <Deployment::Domain> current_domain_; - - /// The previous user cpu - long prev_user_cpu_; - - /// The previous user cpu low priority - long prev_user_cpu_low_; - - /// The previous system cpu - long prev_sys_cpu_; - - /// The previous idle time - long prev_idle_time_; - }; - -} // CIAO -#endif /* CIAO_MONITORH */ diff --git a/CIAO/DAnCE/NodeManager/DAnCE_NodeManager_Module_Export.h b/CIAO/DAnCE/NodeManager/DAnCE_NodeManager_Module_Export.h new file mode 100644 index 00000000000..4eaf82f6fee --- /dev/null +++ b/CIAO/DAnCE/NodeManager/DAnCE_NodeManager_Module_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DAnCE_NodeManager_Module +// ------------------------------ +#ifndef DANCE_NODEMANAGER_MODULE_EXPORT_H +#define DANCE_NODEMANAGER_MODULE_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_NODEMANAGER_MODULE_HAS_DLL) +# define DANCE_NODEMANAGER_MODULE_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DANCE_NODEMANAGER_MODULE_HAS_DLL */ + +#if !defined (DANCE_NODEMANAGER_MODULE_HAS_DLL) +# define DANCE_NODEMANAGER_MODULE_HAS_DLL 1 +#endif /* ! DANCE_NODEMANAGER_MODULE_HAS_DLL */ + +#if defined (DANCE_NODEMANAGER_MODULE_HAS_DLL) && (DANCE_NODEMANAGER_MODULE_HAS_DLL == 1) +# if defined (DANCE_NODEMANAGER_MODULE_BUILD_DLL) +# define DAnCE_NodeManager_Module_Export ACE_Proper_Export_Flag +# define DANCE_NODEMANAGER_MODULE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DANCE_NODEMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DANCE_NODEMANAGER_MODULE_BUILD_DLL */ +# define DAnCE_NodeManager_Module_Export ACE_Proper_Import_Flag +# define DANCE_NODEMANAGER_MODULE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DANCE_NODEMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DANCE_NODEMANAGER_MODULE_BUILD_DLL */ +#else /* DANCE_NODEMANAGER_MODULE_HAS_DLL == 1 */ +# define DAnCE_NodeManager_Module_Export +# define DANCE_NODEMANAGER_MODULE_SINGLETON_DECLARATION(T) +# define DANCE_NODEMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DANCE_NODEMANAGER_MODULE_HAS_DLL == 1 */ + +// Set DANCE_NODEMANAGER_MODULE_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DANCE_NODEMANAGER_MODULE_NTRACE) +# if (ACE_NTRACE == 1) +# define DANCE_NODEMANAGER_MODULE_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DANCE_NODEMANAGER_MODULE_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DANCE_NODEMANAGER_MODULE_NTRACE */ + +#if (DANCE_NODEMANAGER_MODULE_NTRACE == 1) +# define DANCE_NODEMANAGER_MODULE_TRACE(X) +#else /* (DANCE_NODEMANAGER_MODULE_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_NODEMANAGER_MODULE_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DANCE_NODEMANAGER_MODULE_NTRACE == 1) */ + +#endif /* DANCE_NODEMANAGER_MODULE_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/NodeManager/Monitor.mpc b/CIAO/DAnCE/NodeManager/Monitor.mpc deleted file mode 100644 index c14776f773f..00000000000 --- a/CIAO/DAnCE/NodeManager/Monitor.mpc +++ /dev/null @@ -1,28 +0,0 @@ -// $Id$ - - -// MPC file for the Monitor - -project(*monitorlib): ciao_deployment_stub, ciao_events_base_dnc, ace_output { - after += CIAO_TargetManager_stub - includes += $(CIAO_ROOT)/DAnCE/TargetManager - sharedname = ciaomonlib - - libs += TargetManager_stub CIAO_Deployment_stub NodeManager_stub - - IDL_Files { - } - - Header_Files { - } - - Inline_Files { - } - - Template_Files { - } - - Source_Files { - CIAO_Monitor.cpp - } -} diff --git a/CIAO/DAnCE/NodeManager/MonitorCB.cpp b/CIAO/DAnCE/NodeManager/MonitorCB.cpp deleted file mode 100644 index 538b7262fa8..00000000000 --- a/CIAO/DAnCE/NodeManager/MonitorCB.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ -//---------------------------------------------------------------------------------- -/** - * @file MonitorCB.cpp - * - * @brief The Monitor Update class - * - * The class which updates the resource data - * - * @author Nilabja Roy <nilabjar@dre.vanderbilt.edu> - */ -//---------------------------------------------------------------------------------- - -#include "MonitorCB.h" -#include "CIAO_common.h" - - -CIAO::MonitorCB::MonitorCB ( - CORBA::ORB_ptr orb, - Deployment::TargetManager_ptr target, - int interval) : - orb_ (orb), - target_mgr_ (target), - interval_ (interval) -{ -} - -int CIAO::MonitorCB::update_data (::Deployment::Domain& data) -{ - CORBA::StringSeq elements; - elements.length (0); - - // data to be updated ... - ::Deployment::DomainUpdateKind update_kind - = ::Deployment::UpdateDynamic; - - // The copy of the domain variable - ::Deployment::Domain_var domain - = new ::Deployment::Domain (data); - - try - { - if (CIAO::debug_level () > 20) - { - ACE_DEBUG ((LM_DEBUG , "CIAO::NM::MonitorCB::Making a call to update\n")); - } - target_mgr_->updateDomain (elements , domain , update_kind); - } - catch (CORBA::Exception& ) - { - //ACE_DEBUG ((LM_DEBUG, "CIAO::NM::MonitorCB::Unknown Exception\n")); - //ex._tao_print_exception ("NM::MonitorCB::updateDomain"); - } - catch (...) - { - // ignore - } - return 0; -} diff --git a/CIAO/DAnCE/NodeManager/MonitorCB.h b/CIAO/DAnCE/NodeManager/MonitorCB.h deleted file mode 100644 index 5d4f2d8a58a..00000000000 --- a/CIAO/DAnCE/NodeManager/MonitorCB.h +++ /dev/null @@ -1,73 +0,0 @@ -// $Id$ -//============================================================== -/** - * @file MonitorCB.h - * - * @brief The Monitor Callback Function - * - * This class updates data back to the Target Manager - * - * @author Nilabja Roy <nilabjar.vanderbilt.edu> -*/ -//============================================================== - -#ifndef MONITOR_CBH -#define MONITOR_CBH - -#include "DAnCE/Deployment/Deployment_TargetManagerC.h" - -/** - * @namespace CIAO - * - * @brief The top level CIAO namespace - * - */ - -namespace CIAO -{ - /** - * @class MonitorCB - * - * @brief Updates data back to the TM. - * - */ - - class MonitorCB - { - public: - /** - * @param orb The ORB pointer - * @param target The TargetManager reference - * @param interval The time interval to sent update - */ - MonitorCB (CORBA::ORB_ptr orb, Deployment::TargetManager_ptr target, int interval); - /** - * This function is called by the monitor to - * update Domain data, which is then sent to - * TM. - * @param data Contains the updated Domain data - * @return int indicates success. - * @todo Check return value, seems not used at this moment - */ - int update_data (::Deployment::Domain& data); - private: - /// The ORB pointer - /// @todo Make this a _var - CORBA::ORB_ptr orb_; - - /// The Target Manager pointer to send back the - /// update - /// @todo Make this a _var - ::Deployment::TargetManager_ptr target_mgr_; - - /// The interval after which updates need to be send - int interval_; - - }; - - /// The Callback function pointer - typedef int (MonitorCB::*CallBack) (::Deployment::Domain &); - -} // CIAO namespace - -#endif /* MONITOR_CBH */ diff --git a/CIAO/DAnCE/NodeManager/MonitorController.cpp b/CIAO/DAnCE/NodeManager/MonitorController.cpp deleted file mode 100644 index 774d9a022f9..00000000000 --- a/CIAO/DAnCE/NodeManager/MonitorController.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// $Id$ - -//---------------------------------------------------------------------------------- -/** - * @file MonitorController.cpp - * - * @brief The Monitor Controller implementation. - * - * This is the facade class for Monitor - * - * @author Nilabja Roy <nilabjar@dre.vanderbilt.edu> - */ -//---------------------------------------------------------------------------------- - -#include "MonitorController.h" -#include "BaseMonitor.h" -#include "MonitorCB.h" -#include "CIAO_common.h" - -#include "ace/Log_Msg.h" -#include "ace/DLL.h" -#include "ace/SString.h" - -#include "NodeManager_Impl.h" - -namespace CIAO -{ - typedef MonitorBase* (*MonitorFactory) (void); - - /// for the CIAO monitor - const char* monitor_lib_name = "ciaomonlib"; - - // The interval after which update will be sent. - // This value will sent by the EM in the later implementation - const int interval = 10; - - static const char* factory_func = "createMonitor"; -} - -CIAO::MonitorController::MonitorController ( - ::CORBA::ORB_ptr orb, - ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target, - ::CIAO::NodeManager_Impl_Base* node_mgr - ) - : target_facet_i_ (::Deployment::TargetManager::_duplicate (target)), - terminate_flag_ (0), - orb_ (orb), - initial_domain_ (domain), - node_mgr_ (node_mgr), - monitor_cpu_usage_ (false), - add_component_pid_ (true) -{ -} - -int -CIAO::MonitorController::svc (void) -{ - // @todo. Investigate whether we can't use the reactor with a timer - // eventhandler for this monitor controller, would safe us a thread - ACE_DLL dll; - - // Forming the library name. - ACE_CString lib_name = ACE_DLL_PREFIX; - lib_name += monitor_lib_name; - int retval = dll.open (lib_name.c_str ()); - - if (retval != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.open"), - -1); - } - - // Cast the void* to non-pointer type first - it's not legal to - // cast a pointer-to-object directly to a pointer-to-function. - void *void_ptr = dll.symbol (factory_func); - ptrdiff_t tmp = reinterpret_cast<ptrdiff_t> (void_ptr); - MonitorFactory factory = reinterpret_cast<MonitorFactory> (tmp); - - if (factory == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "%p", - "dll.symbol"), - -1); - } - - { - ACE_TRACE ((LM_DEBUG, "Inside the init call\n")); - - // Creating the monitor object. - monitor_.reset ((MonitorBase*) factory ()); - monitor_->initialize_params (initial_domain_, - target_facet_i_.in (), - interval); - - - // Start the Monitor. - monitor_->start (orb_); - auto_ptr <CIAO::MonitorCB> monitor_callback (new CIAO::MonitorCB (orb_, - target_facet_i_.in (), - interval)); - - // check if cpu needs to be monitored or not - for (unsigned int i = 0;i < initial_domain_.node[0].resource.length ();i++) - { - if (!ACE_OS::strcmp (initial_domain_.node[0].resource[i].name, "Processor")) - monitor_cpu_usage_ = true; - } - - // Wait for system to stabilize itself - ACE_OS::sleep (interval); - - // The loop in which UpdateData is called - while (!terminating ()) - { - - //ACE_DEBUG ((LM_DEBUG , "=The Terminate is %d\n", terminate_flag_)); - - - // if monitoring of cpu is enable , monitor , else dont do - // anything - ::Deployment::Domain* domain = 0; - - if (monitor_cpu_usage_) - domain = monitor_->get_current_data (); - else - domain = &initial_domain_; - - // ****** add component data ******************* - - NodeManager_Impl_Base::Component_Ids cids = - node_mgr_->get_component_detail (); - - // Here save the old resource length - int counter = domain->node[0].resource.length (); - - // if pid is already added , dont add - if (add_component_pid_) - { - // then add more resource element to the - // domain structure - // ACE_DEBUG ((LM_DEBUG , "Going to add CID/PID data\n")); - int new_res_size = domain->node[0].resource.length () + - cids.cid_seq_.size (); - - domain->node[0].resource.length (new_res_size); - - ACE_Unbounded_Set_Iterator<ACE_CString> iter (cids.cid_seq_); - - for (iter = cids.cid_seq_.begin (); - iter != cids.cid_seq_.end (); - iter++,counter++) - { - domain->node[0].resource[counter].name = - CORBA::string_dup ("Component"); - domain->node[0].resource[counter].resourceType.length (0); - - // Have one property for now - domain->node[0].resource[counter].property.length (1); - domain->node[0].resource[counter].property[0].name = - CORBA::string_dup ((*iter).c_str ()); - domain->node[0].resource[counter].property[0].kind = - ::Deployment::Quantity; - domain->node[0].resource[counter].property[0].dynamic = - 0; - domain->node[0].resource[counter].property[0].value <<= - CORBA::Long (cids.process_id_); - - // ACE_DEBUG ((LM_DEBUG , "The process id is [%d]\n", - // CORBA::Long (cids.process_id_))); - } - // set the add_component_pid_ to 0 - add_component_pid_ = false; - } - - //******add compoennt data - - monitor_callback->update_data (*domain); - - // data will be updated in intervals of 10 secs. - // in the latest version of spec , this value will - // come from Execution Manager - ACE_OS::sleep (interval); - - } - - monitor_->stop (); - } - - // here delete the monitor object before - // unloading the library - monitor_.reset (); - - // unload the library - dll.close (); - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG , "CIAO::Monitor::Terminating Monitor\n")); - } - - return 0; -} - -CIAO::MonitorController::~MonitorController () -{ - this->terminate (); - this->wait (); -} - -void -CIAO::MonitorController::terminate () -{ - // make the terminate flag false - ACE_GUARD (TAO_SYNCH_MUTEX, - guard, - lock_); - - terminate_flag_ = true; -} - -bool -CIAO::MonitorController::terminating () -{ - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - lock_, - 0); - - return terminate_flag_; -} diff --git a/CIAO/DAnCE/NodeManager/MonitorController.h b/CIAO/DAnCE/NodeManager/MonitorController.h deleted file mode 100644 index c6cbbcf5255..00000000000 --- a/CIAO/DAnCE/NodeManager/MonitorController.h +++ /dev/null @@ -1,123 +0,0 @@ -// $Id$ - -//--------------------------------------------------------------------------------- -/** - * @file MonitorController.h - * - * @brief The Monitor Controller class. - * - * This class is invoked by the Nodemanager object and it - * in turn loads the proper Monitor which is strategised. - * - * @author Nilabja Roy - */ -//---------------------------------------------------------------------------------- -#ifndef MONITOR_CONTROLLER_H -#define MONITOR_CONTROLLER_H - -#include "NodeManager_svnt_export.h" -#include "DAnCE/Deployment/Deployment_BaseC.h" - -#include "DAnCE/TargetManager/TargetManagerImplC.h" -#include "ace/Task.h" -#include "ace/Auto_Ptr.h" - -#include "ace/Synch_Traits.h" -#include "ace/Synch.h" - - -/** - * @namespace CIAO - * - * @brief The top level CIAO namespace - * - */ - -namespace CIAO -{ - - class MonitorBase; - - class NodeManager_Impl_Base; - - /** - * @class MonitorController - * - * @brief The Controller class - * - * Acts as a facade to the Monitor - * module - * - */ - class NodeManager_svnt_Export MonitorController : public ACE_Task_Base - { - public: - /** - * @brief The main function containing the - * entire activity. - * - * This function runs in the context of the - * thread - * @return int The status of the function - */ - int svc (void); - /** - * @brief The terminate function - * - * This function is called to terminate the - * thread - */ - void terminate (); - - - /// The Constructor. - MonitorController (CORBA::ORB_ptr orb, - ::Deployment::Domain& domain, - ::Deployment::TargetManager_ptr target, - ::CIAO::NodeManager_Impl_Base* node_mgr - ); - - ~MonitorController (); - protected: - - /** - * @brief returns the terminating flag - * @return bool The terminating state of the thread - */ - bool terminating (); - - /// The monitor object - auto_ptr <MonitorBase> monitor_; - - /// The TargetManagerImpl object - CIAO::TargetManagerImpl_var target_impl_cmp_; - - /// The TargetManager Facet .... - Deployment::TargetManager_var target_facet_i_; - - /// The terminate flag_ - bool terminate_flag_; - - /// Thread Mutex for synchronizing call - TAO_SYNCH_MUTEX lock_; - - /// the ORB pointer .. - /// @todo Make this a _var - CORBA::ORB_ptr orb_; - - /// The initial domain - ::Deployment::Domain initial_domain_; - - /// The Node Manager - ::CIAO::NodeManager_Impl_Base* node_mgr_; - - /// Flag tells ; what to monitor - bool monitor_cpu_usage_; - - /// To add component pid or not .. - bool add_component_pid_; - }; - -} // CIAO - -#endif diff --git a/CIAO/DAnCE/NodeManager/NAM_Map.cpp b/CIAO/DAnCE/NodeManager/NAM_Map.cpp deleted file mode 100644 index f3aebb307a2..00000000000 --- a/CIAO/DAnCE/NodeManager/NAM_Map.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// $Id$ -#include "NAM_Map.h" -#include "ciao/CIAO_Config.h" -#include "ciao/CIAO_common.h" - -namespace CIAO -{ - NAM_Map::NAM_Map (void) - : map_ (CIAO_DEFAULT_MAP_SIZE) - { - } - - bool - NAM_Map::is_available (const ACE_CString &str) const - { - if (this->map_.find (str) == 0) - return true; - - return false; - } - - bool - NAM_Map::insert_nam (const ACE_CString &str, - const PortableServer::ObjectId &oid) - { - return (this->map_.bind (str, oid) == 0); - } - - ::PortableServer::ObjectId - NAM_Map::get_nam (const ACE_CString &str) - { - MAP::ENTRY *entry = 0; - - if (this->map_.find (str, entry) != 0) - return ::PortableServer::ObjectId (); - - return entry->int_id_.in (); - } - - bool - NAM_Map::remove_nam (const PortableServer::ObjectId &oid) - { - for (Iterator i = this->map_.begin (); - i != this->map_.end (); - ++i) - { - if ((*i).int_id_.in() == oid) - return this->map_.unbind ((*i).ext_id_) == 0; - } - return false; - } -} diff --git a/CIAO/DAnCE/NodeManager/NAM_Map.h b/CIAO/DAnCE/NodeManager/NAM_Map.h deleted file mode 100644 index 4b398d51927..00000000000 --- a/CIAO/DAnCE/NodeManager/NAM_Map.h +++ /dev/null @@ -1,72 +0,0 @@ - /** - * @file NAM_Map.h - * @author Will Otte <wotte@dre.vanderbilt.edu> - * - * Map of NodeApplicationManagers, inspired by the DAM_Map - * class. - * - * $Id$ - */ - -#ifndef CIAO_NAM_MAP_H -#define CIAO_NAM_MAP_H - -#include /**/ "ace/pre.h" - -#include "tao/PortableServer/PortableServer.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Null_Mutex.h" -#include "ace/Hash_Map_Manager.h" -#include "ace/SString.h" - -namespace CIAO -{ - /** - * @class NAM_Map - * @brief Implementation of a map of NodeApplicationManagers. - * - * This table is used by the NodeManager to keep track of - * NAMs started for multiple assemblies. - */ - class NAM_Map - { - public: - /// Constructor - NAM_Map (void); - - /// Determine if there is a NAM associated with a UUID - bool is_available (const ACE_CString &str) const; - - /// Insert a NAM OID into the collection - bool insert_nam (const ACE_CString &str, - const PortableServer::ObjectId &oid); - - /// Get a specified NAM. - ::PortableServer::ObjectId - get_nam (const ACE_CString &str); - - /// Remove a nam from the map, given its oid. - bool remove_nam (const PortableServer::ObjectId &oid); - - private: - typedef - ACE_Hash_Map_Manager_Ex <ACE_CString, - ::PortableServer::ObjectId_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> MAP; - - typedef MAP::iterator Iterator; - - MAP map_; - - }; -} - -#include /**/ "ace/post.h" - -#endif /*CIAO_NAM_MAP_H*/ diff --git a/CIAO/DAnCE/NodeManager/NodeManager.mpc b/CIAO/DAnCE/NodeManager/NodeManager.mpc index 29bdefabdd6..495602554af 100644 --- a/CIAO/DAnCE/NodeManager/NodeManager.mpc +++ b/CIAO/DAnCE/NodeManager/NodeManager.mpc @@ -1,33 +1,22 @@ // -*- MPC -*- // $Id$ -//For static D&C, the NodeManager should be available as a linkable library -project(NodeManager_svnt): ciao_component_dnc, ciao_deployment_svnt, iortable, ifr_client, dance_extension_stub, ciao_server_dnc, ciao_nodeapplicationmanager, ciao_nodemanager_stub, ace_output { - sharedname = NodeManager - dynamicflags = NODEMANAGER_SVNT_BUILD_DLL - - IDL_Files { - } +project(Node_Manager_Module) : dance_lib, naming_serv, dance_node_application_manager, dance_node_application, dance_deployment_svnt, dance_deployment_stub, dynamicinterface, utils, gen_ostream { + sharedname = DAnCE_NodeManager + dynamicflags = NODEMANAGER_BUILD_DLL DANCE_NODEMANAGER_MODULE_BUILD_DLL Source_Files { - ../Interfaces/NodeManagerDaemonS.cpp NodeManager_Impl.cpp - NAM_Map.cpp - MonitorController.cpp - MonitorCB.cpp + Node_Manager_Module.cpp } } -project(NodeManager): ciao_server_dnc, iortable, ifr_client, dance_extension_stub, ciao_nodeapplicationmanager, ciao_targetmanager_stub, ciao_nodemanager_stub, ciaoexe { - after += NodeManager_svnt - libs += NodeManager - exename = NodeManager - - IDL_Files { - } +project(Node_Manager_Exec) : dance_exe, dance_node_manager, naming_serv { + exename = dance_node_manager + after += Node_Manager_Module + libs += DAnCE_NodeManager Source_Files { - Node_Manager.cpp + Node_Manager_Exec.cpp } } - diff --git a/CIAO/DAnCE/NodeManager/NodeManager_Export.h b/CIAO/DAnCE/NodeManager/NodeManager_Export.h new file mode 100644 index 00000000000..b7240baeb80 --- /dev/null +++ b/CIAO/DAnCE/NodeManager/NodeManager_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NodeManager +// ------------------------------ +#ifndef NODEMANAGER_EXPORT_H +#define NODEMANAGER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEMANAGER_HAS_DLL) +# define NODEMANAGER_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && NODEMANAGER_HAS_DLL */ + +#if !defined (NODEMANAGER_HAS_DLL) +# define NODEMANAGER_HAS_DLL 1 +#endif /* ! NODEMANAGER_HAS_DLL */ + +#if defined (NODEMANAGER_HAS_DLL) && (NODEMANAGER_HAS_DLL == 1) +# if defined (NODEMANAGER_BUILD_DLL) +# define NodeManager_Export ACE_Proper_Export_Flag +# define NODEMANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define NODEMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* NODEMANAGER_BUILD_DLL */ +# define NodeManager_Export ACE_Proper_Import_Flag +# define NODEMANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define NODEMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* NODEMANAGER_BUILD_DLL */ +#else /* NODEMANAGER_HAS_DLL == 1 */ +# define NodeManager_Export +# define NODEMANAGER_SINGLETON_DECLARATION(T) +# define NODEMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NODEMANAGER_HAS_DLL == 1 */ + +// Set NODEMANAGER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NODEMANAGER_NTRACE) +# if (ACE_NTRACE == 1) +# define NODEMANAGER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NODEMANAGER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NODEMANAGER_NTRACE */ + +#if (NODEMANAGER_NTRACE == 1) +# define NODEMANAGER_TRACE(X) +#else /* (NODEMANAGER_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define NODEMANAGER_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (NODEMANAGER_NTRACE == 1) */ + +#endif /* NODEMANAGER_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp b/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp index bb8a90e5112..2c84c84ceb9 100644 --- a/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp +++ b/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp @@ -1,679 +1,183 @@ // $Id$ #include "NodeManager_Impl.h" -#include "DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h" -#include "ace/Log_Msg.h" - -CIAO::NodeManager_Impl_Base::NodeManager_Impl_Base (const char *name, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - const char * nodeapp_loc, - const char * nodeapp_options, - int spawn_delay) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - name_ (CORBA::string_dup (name)), - nodeapp_location_ (CORBA::string_dup (nodeapp_loc)), - nodeapp_options_ (CORBA::string_dup (nodeapp_options)), - callback_poa_ (PortableServer::POA::_nil ()), - spawn_delay_ (spawn_delay) -{ -} - -CIAO::NodeManager_Impl_Base::~NodeManager_Impl_Base () -{ -} - -void -CIAO::NodeManager_Impl_Base::init () -{ - try - { - // Create the call back poa for NAM. - PortableServer::POAManager_var mgr - = this->poa_->the_POAManager (); - - this->callback_poa_ = - this->poa_->create_POA ("callback_poa", - mgr.in (), - 0); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("NodeManager_Impl::init\t\n"); - throw; - } -} - -PortableServer::POA_ptr -CIAO::NodeManager_Impl_Base::_default_POA (void) -{ - return PortableServer::POA::_duplicate (this->poa_.in ()); -} - - -char * -CIAO::NodeManager_Impl_Base::name () -{ - return CORBA::string_dup (this->name_.in ()); -} - -void -CIAO::NodeManager_Impl_Base::shutdown () -{ - - this->orb_->shutdown (0); -} - -void -CIAO::NodeManager_Impl_Base::joinDomain (const Deployment::Domain & domain, - Deployment::TargetManager_ptr target, - Deployment::Logger_ptr) -{ - // Here start the Monitor - CIAO_TRACE("CIAO::NodeManager_Impl_Base::joinDomain"); - ::Deployment::Domain this_domain = domain; - - monitor_controller_.reset ( - new MonitorController (orb_.in (), - this_domain, - target, - this)); - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG , "Before Activate\n")); - } - - // Activate the Monitor Controller to - // start the monitoring - monitor_controller_->activate (); +#include "ace/Log_Msg.h" +#include "ace/streams.h" - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG , "Monitor Activated\n")); - } -} +#include "DAnCE/Logger/Log_Macros.h" -void -CIAO::NodeManager_Impl_Base::leaveDomain () -{ - // Delete the monitor , this will also terminate the thread - monitor_controller_.reset (); -} +#include "ace/OS_Memory.h" -CORBA::Long -CIAO::NodeManager_Impl_Base::set_priority ( - const char * plan_id, - const char * cid, - const ::Deployment::Sched_Params & nm_params - ) +#ifdef GEN_OSTREAM_OPS +#include <iostream> +#include <sstream> +#endif /* GEN_OSTREAM_OPS */ +namespace DAnCE { - ACE_CString key (plan_id); - key += "@"; - key += this->name_.in (); - - if (CIAO::debug_level () > 10) - { - ACE_DEBUG ((LM_DEBUG , "Inside the set_priority\n")); - ACE_DEBUG ((LM_DEBUG , "pid = [%s] , cid = [%s]\n", key.c_str () , cid)); - } - - try { - CORBA::Object_var obj = - this->poa_->id_to_reference (this->map_.get_nam (key)); - - Deployment::NodeApplicationManager_var nam = - Deployment::NodeApplicationManager::_narrow (obj.in ()); - - return nam->set_priority (cid, nm_params); + NodeManager_Impl::NodeManager_Impl(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char* name, + RedirectionService& redirection, + const PROPERTY_MAP &properties) + : orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)), + name_ (name), + redirection_ (redirection), + properties_ (properties.current_size ()) + { + DANCE_TRACE ( "NodeManager_Impl::NodeManager_Impl"); + redirection.add_node (name); + DANCE_DEBUG ((LM_INFO, DLINFO "NodeManager_impl::NodeManager_impl has been created\n")); + + PROPERTY_MAP::const_iterator i = properties.begin (); + while (!i.done ()) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeManager_Impl::NodeManager_Impl - " + "Binding property %s provided by caller.\n", i->key ().c_str ())); + this->properties_.bind (i->key (), i->item ()); + i.advance (); + } } - catch (CORBA::Exception& ex) - { - - ex._tao_print_exception ("(%P|%t) NodeManager_Impl::set_priority ()\t\n"); - throw; - } -} - -::Components::FacetDescriptions * -CIAO::NodeManager_Impl_Base:: -get_all_facets (ACE_CString & name) -{ - Component_Facets_Map::ENTRY *entry = 0; - - if (this->comp_facets_map_.find (name.c_str (), entry) != 0) - { - ACE_ERROR ((LM_ERROR, "(%P|%t) - NodeManager_Impl_Base::get_all_facets - " - "No component with name [%s] was found in the NodeManager\n", name.c_str ())); - } - - CORBA::ULong const facet_len = entry->int_id_->length (); - - Components::FacetDescriptions_var retv; - ACE_NEW_RETURN (retv, - Components::FacetDescriptions, - 0); - - retv->length (facet_len); - - for (CORBA::ULong i = 0; i < facet_len; ++i) - { - retv[i] = entry->int_id_[i]; - } - - return retv._retn (); -} - -::Components::ConsumerDescriptions * -CIAO::NodeManager_Impl_Base:: -get_all_consumers (ACE_CString & name) -{ - Component_Consumers_Map::ENTRY *entry = 0; - - if (this->comp_consumers_map_.find (name.c_str (), entry) != 0) - { - ACE_ERROR ((LM_ERROR, "(%P|%t) - NodeManager_Impl_Base::get_all_facets - " - "Component [%s] was not found in the NodeManager\n", name.c_str ())); - } - - CORBA::ULong const consumer_len = entry->int_id_->length (); - - Components::ConsumerDescriptions_var retv; - ACE_NEW_RETURN (retv, - Components::ConsumerDescriptions, - 0); - - retv->length (consumer_len); - - for (CORBA::ULong i = 0; i < consumer_len; ++i) - { - retv[i] = entry->int_id_[i]; - } - - return retv._retn (); -} - -void -CIAO::NodeManager_Impl_Base:: -set_all_facets (ACE_CString &name, - const ::Components::FacetDescriptions_var & facets) -{ - this->comp_facets_map_.rebind (name, facets); -} - -void -CIAO::NodeManager_Impl_Base:: -set_all_consumers (ACE_CString &name, - const ::Components::ConsumerDescriptions_var & consumers) -{ - this->comp_consumers_map_.rebind (name, consumers); -} - - -Deployment::NodeApplicationManager_ptr -CIAO::NodeManager_Impl_Base:: -preparePlan (const Deployment::DeploymentPlan &plan) -{ - CIAO_TRACE("CIAO::NodeManager_Impl::preparePlan"); - - if (! this->validate_plan (plan)) - { - ACE_ERROR ((LM_ERROR, "(%P|%t) NodeManager <%s>:prepare_plan:Plan_Error.\n", - plan.instance[0].node.in ())); - ACE_ERROR ((LM_ERROR, "(%P|%t) All component instances hosted in the " - "same component server must have the " - "same \"resourceName\" defined.\n")); - - throw Deployment::PlanError (); - } - - // Update the reference count map based on the deployment plan input - for (CORBA::ULong i = 0; i < plan.instance.length (); ++i) - { - Reference_Count_Map::ENTRY *entry = 0; - if (this->ref_count_map_.find (plan.instance[i].name.in (), entry) != 0) - { - // Create a new entry, set the initial ref count "1", and insert to the map. - Ref_Count_Info new_entry; - new_entry.plan_uuid_ = plan.UUID.in (); - new_entry.count_ = 1; - this->ref_count_map_.bind (plan.instance[i].name.in (), new_entry); - } - else - { - // If the instance is within the same deployment plan, e.g., - // when ReDaC service is used, then just do nothing since it is NOT - // actually a shared component at all. - if (ACE_OS::strcmp (plan.UUID.in (), - entry->int_id_.plan_uuid_.c_str ()) == 0) - continue; - - // Otherwise, it is really a shared component, so let's increase - // the ref count by 1 - this->shared_components_.insert (plan.instance[i].name.in ()); - ++ entry->int_id_.count_; - } - } - - // Create/find NodeApplicationManager and set/reset plan on it - try - { - if (!this->map_.is_available (plan.UUID.in ())) - { - if (CIAO::debug_level () > 10) - { - ACE_DEBUG ((LM_DEBUG, "NM:prepare_plan: " - "creating a new NAM with UUID: %s\n", - plan.UUID.in ())); - } - - // Implementation undefined. - CIAO::NodeApplicationManager_Impl_Base *node_app_mgr = - this->create_node_app_manager (this->orb_.in (), this->poa_.in ()); - - PortableServer::ServantBase_var safe (node_app_mgr); - - //@@ Note: after the init call the servant ref count would - // become 2. so we can leave the safeservant along and be - // dead. Also note that I added - PortableServer::ObjectId_var oid = - node_app_mgr->init (this->nodeapp_location_.in (), - this->nodeapp_options_.in (), - this->spawn_delay_, - plan, - this->callback_poa_.in (), - this // pass in a copy of ourself (servant object) - ); - - this->map_.insert_nam (plan.UUID.in (), oid.in ()); - - CORBA::Object_var obj = - this->poa_->id_to_reference (this->map_.get_nam (plan.UUID.in ())); - - // We should inform NAM about "shared" components, so they - // won't be instantiated again - Deployment::NodeApplicationManager_var nam = - Deployment::NodeApplicationManager::_narrow (obj.in ()); - - // Convert the ACE Set into CORBA sequence, and make the remote invocation - Deployment::ComponentPlans_var shared = - this->get_shared_components_i (); - nam->set_shared_components (shared.in ()); - - // narrow should return a nil reference if it fails. - return Deployment::NodeApplicationManager::_narrow (nam.in ()); - } - else - { - if (CIAO::debug_level () > 10) - { - ACE_DEBUG ((LM_DEBUG, "NM:prepare_plan: reusing an old NAM " - "with UUID: %s\n", - plan.UUID.in ())); - } - - CORBA::Object_var obj = - this->poa_->id_to_reference (this->map_.get_nam (plan.UUID.in ())); - Deployment::NodeApplicationManager_var nam = - Deployment::NodeApplicationManager::_narrow (obj.in ()); - - nam->reset_plan (plan); - - // Similarly, we should inform NAM about "shared" components, so - // they won't be instantiated again - Deployment::ComponentPlans_var shared = - this->get_shared_components_i (); - nam->set_shared_components (shared.in ()); - - // Potentially we could reset many other configuration settings - // such as command line options, service configuration file, etc. - return nam._retn (); - } - } - catch (const PortableServer::POA::ObjectNotActive&) - { - throw Deployment::StartError (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("(%P|%t) NodeManager_Impl::preparePlan\t\n"); - throw; - } - - return Deployment::NodeApplicationManager::_nil (); -} - -void -CIAO::NodeManager_Impl_Base::destroyManager -(Deployment::NodeApplicationManager_ptr manager) -{ - CIAO_TRACE("CIAO::NodeManager_Impl::destroyManager"); - try - { - // Deactivate this object - PortableServer::ObjectId_var id = - this->poa_->reference_to_id (manager); - - if (!this->map_.remove_nam (id.in ())) - { - ACE_ERROR ((LM_ERROR, - "NodeManager_Impl::destroyManager: " - "Unable to remove object from map!\n")); - } - - this->poa_->deactivate_object (id.in ()); - } - catch (const PortableServer::POA::WrongAdapter&) - { - ACE_ERROR ((LM_ERROR, - "NodeManager_Impl::destroyManager: EXCEPTION - " - "Invalid reference passed to destroyManager\n")); - - throw ::Deployment::InvalidReference (); - } - catch (const PortableServer::POA::ObjectNotActive&) - { - ACE_ERROR ((LM_ERROR, - "NodeManager_Impl::destroyManager: EXCEPTION - " - " asked to destroy an already inactive object.\n")); - throw ::Deployment::InvalidReference (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("NodeManager_Impl::destroyManager\t\n"); - throw; - } -} - -void -CIAO::NodeManager_Impl_Base:: -destroyPlan (const Deployment::DeploymentPlan & plan) -{ - // Update the reference counting map (subtract by 1 for each instance) - // If the ref count becomes 0, then remove this component, otherwise, - // we should remove the necesary bindings on this component specified - // in the deployment plan. - - // Clean up the cached "Facets" and "Consumers" map of the components - // if their ref count become 0 - CORBA::ULong const length = plan.instance.length (); - for (CORBA::ULong i = 0; i < length; ++i) - { - ACE_DEBUG ((LM_DEBUG, "NM_DP - forloop instance %s\n", - plan.instance[i].name.in ())); - - Reference_Count_Map::ENTRY *entry = 0; - if (this->ref_count_map_.find (plan.instance[i].name.in (), entry) == 0) - { - --entry->int_id_.count_; // decrease ref count by 1 - - if (entry->int_id_.count_ == 0) - { - // Remove this component from the shared set - ACE_DEBUG ((LM_DEBUG, "\tremoving shared...\n")); - this->shared_components_.remove (plan.instance[i].name.in ()); - ACE_DEBUG ((LM_DEBUG, "\tunbinding from the ref count map\n")); - // Unbind this component from the ref_count_map_ - this->ref_count_map_.unbind (plan.instance[i].name.in ()); - - ACE_DEBUG ((LM_DEBUG, "\tunbinding from the facet/consumer maps\n")); - // Unbind this component from the facet/consumer maps - if (this->comp_facets_map_.unbind ( - plan.instance[i].name.in ()) != 0 || - this->comp_consumers_map_.unbind ( - plan.instance[i].name.in ()) != 0) - { - throw - (Deployment::StopError ("NodeManager_Impl_Base::destroyPlan ", - "Unable to find component instance")); - } - } - } - } - - // Find the NAM from the map and invoke the destroyPlan() operation on - // it, which will actuall remove components and connections in this plan. - // If - CORBA::Object_var obj = - this->poa_->id_to_reference (this->map_.get_nam (plan.UUID.in ())); - - Deployment::NodeApplicationManager_var nam = - Deployment::NodeApplicationManager::_narrow (obj.in ()); - - - // Reset each NAM about the shared components information - Deployment::ComponentPlans_var shared = this->get_shared_components_i (); - nam->set_shared_components (shared.in ()); - - nam->destroyApplication (0); - - // @@ The problem is that we should NOT actually kill the NA process if - // there are some components that are shared by other plans. -} - -Deployment::ComponentPlans * -CIAO::NodeManager_Impl_Base:: -get_shared_components () -{ - return this->get_shared_components_i (); -} - -Deployment::ComponentPlans * -CIAO::NodeManager_Impl_Base::get_shared_components_i (void) -{ - Deployment::ComponentPlans_var retv; - ACE_NEW_RETURN (retv, - Deployment::ComponentPlans, - 0); - retv->length (0); - - ACE_Unbounded_Set<ACE_CString>::iterator - end = this->shared_components_.end (); - - for (ACE_Unbounded_Set<ACE_CString>::iterator - iter = this->shared_components_.begin (); - iter != end; - ++iter) - { - CORBA::ULong const curr_len = retv->length (); - retv->length (curr_len + 1); - (*retv)[curr_len].name = (*iter).c_str (); - - // Fill in the plan_uuid information about this component, by - // searching in the ref_count_map_ - Reference_Count_Map::ENTRY *entry = 0; - if (this->ref_count_map_.find ((*iter).c_str (), entry) == 0) - { - // Get the plan_uuid_ info and populate the field - (*retv)[curr_len].plan_uuid = entry->int_id_.plan_uuid_.c_str (); - } - else - { - // should never happen - ACE_ERROR ((LM_ERROR, "Component [%s] in the list of shared component, " - "was not found in the NodeManager ref count map.\n", - (*iter).c_str ())); - } - } - - return retv._retn (); -} - - -CORBA::StringSeq * -CIAO::NodeManager_Impl_Base::shared_components_seq (void) -{ - CORBA::StringSeq * retv = 0; - ACE_NEW_RETURN (retv, CORBA::StringSeq, 0); - retv->length (0); - - // @todo rewrite to just set the length once and then copy the strings - // to reduce allocations - - ACE_Unbounded_Set<ACE_CString>::iterator end = this->shared_components_.end (); - for (ACE_Unbounded_Set<ACE_CString>::iterator - iter = this->shared_components_.begin (); - iter != end; - ++iter) - { - CORBA::ULong const curr_len = retv->length (); - retv->length (curr_len + 1); - (*retv)[curr_len] = (*iter).c_str (); - } - - return retv; -} - -bool -CIAO::NodeManager_Impl_Base:: -validate_plan (const Deployment::DeploymentPlan &plan) -{ - const char * resource_id = 0; - CORBA::ULong i = 0; - - // Update the name of ourself - this->name_ = plan.instance[0].node.in (); - - for (i = 0; i < plan.instance.length (); ++i) - { - if (plan.instance[i].deployedResource.length () != 0) - { - // Since the "name" field represents the server_resource_id, and - // the "resourceValue" field represents the policy_set_id, so we - // are checking to make sure that all component instances have - // the same server_resource_id. - - resource_id = - plan.instance[i].deployedResource[0].resourceName.in (); - break; - } - } - if (i == plan.instance.length ()) // No server resource id has been set for any instance - return true; - - for (i = 0; i < plan.instance.length (); ++i) - { - const char * my_resource_id = 0; - if (plan.instance[i].deployedResource.length () == 0) - { - continue; - } - else - { - my_resource_id = - plan.instance[i].deployedResource[0].resourceName.in ();; - if (ACE_OS::strcmp (resource_id, my_resource_id) != 0) - { - // Error, inconsistent server resource id found. - return false; - } - } - } - return true; -} - - -void CIAO::NodeManager_Impl_Base:: -push_component_id_info (Component_Ids comps) -{ - components_ = comps; -} - -CIAO::NodeManager_Impl_Base::Component_Ids -CIAO::NodeManager_Impl_Base:: -get_component_detail () -{ - return components_; -} - -CIAO::NodeManager_Impl::~NodeManager_Impl () -{ -} - -///////////////////////////////////////////////////////////////////// - -CIAO::NodeManager_Impl:: -NodeManager_Impl (const char *name, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - const char * nodeapp_loc, - const char * nodeapp_options, - int spawn_delay, - bool is_multi_threaded) - : NodeManager_Impl_Base (name, orb, poa, nodeapp_loc, nodeapp_options, spawn_delay) - , is_multi_threaded_ (is_multi_threaded) -{} - - -::CIAO::NodeApplicationManager_Impl_Base * -CIAO::NodeManager_Impl:: -create_node_app_manager (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) -{ - CIAO::NodeApplicationManager_Impl_Base *app_mgr = 0; - ACE_NEW_THROW_EX (app_mgr, - CIAO::NodeApplicationManager_Impl (orb, - poa, - this->is_multi_threaded_), - CORBA::NO_MEMORY ()); - return app_mgr; -} - -CIAO::Static_NodeManager_Impl::~Static_NodeManager_Impl () -{ -} - -CIAO::Static_NodeManager_Impl:: -Static_NodeManager_Impl (const char *name, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - const char * nodeapp_loc, - const char * nodeapp_options, - int spawn_delay, - Static_Config_EntryPoints_Maps* static_config_entrypoints_maps) - : NodeManager_Impl_Base (name, orb, poa, nodeapp_loc, nodeapp_options, spawn_delay), - static_config_entrypoints_maps_ (static_config_entrypoints_maps) -{} + NodeManager_Impl::~NodeManager_Impl() + { + DANCE_TRACE ( "NodeManager_Impl::~NodeManager_Impl()"); + for (TManagers::iterator iter = this->managers_.begin(); + iter != this->managers_.end(); + ++iter) + { + try + { + PortableServer::ObjectId_var id = this->poa_->servant_to_id ( (*iter).int_id_); + DANCE_DEBUG ((LM_TRACE, DLINFO + "NodeManager_impl::~NodeManager_impl - Deactivating NodeApplicationManager %s\n", + (*iter).ext_id_.c_str ())); + this->poa_->deactivate_object (id.in()); + DANCE_DEBUG ((LM_TRACE, DLINFO + "NodeManager_impl::~NodeManager_impl - deleting NodeApplicationManager\n")); + delete (*iter).int_id_; + DANCE_DEBUG ((LM_DEBUG, DLINFO + "NodeManager_impl::~NodeManager_impl - NodeApplicationManager deleted\n")); + } + catch (...) + { + DANCE_ERROR ((LM_WARNING, DLINFO + "NodeManager_impl::~NodeManager_impl - Caught exception while removing " + "NodeApplicationManager %s\n", (*iter).ext_id_.c_str ())); + } + } + } -::CIAO::NodeApplicationManager_Impl_Base * -CIAO::Static_NodeManager_Impl:: -create_node_app_manager (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) -{ - if (CIAO::debug_level () > 10) - { - ACE_DEBUG ((LM_DEBUG, "creating static_node_app_manager\n")); - } + void + NodeManager_Impl::joinDomain (const ::Deployment::Domain & /*theDomain*/, + ::Deployment::TargetManager_ptr /*manager*/, + ::Deployment::Logger_ptr /*log*/, + ::CORBA::Long /*updateInterval*/) + { + DANCE_TRACE ( "NodeManager_Impl::joinDomain"); + ACE_DEBUG ((LM_ERROR, DLINFO "NodeManager_Impl::joinDomain - " + "joinDomain not implemented\n")); + throw CORBA::NO_IMPLEMENT (); + } - CIAO::NodeApplicationManager_Impl_Base *app_mgr = 0; - ACE_NEW_THROW_EX (app_mgr, - CIAO::Static_NodeApplicationManager_Impl (orb, - poa, - this->static_config_entrypoints_maps_), - CORBA::NO_MEMORY ()); - return app_mgr; -} + void + NodeManager_Impl::leaveDomain () + { + DANCE_TRACE ( "NodeManager_Impl::leaveDomain"); + ACE_DEBUG ((LM_ERROR, DLINFO "NodeManager_Impl::leaveDomain - " + "leave not implemented\n")); + throw CORBA::NO_IMPLEMENT (); + } -void -CIAO::Static_NodeManager_Impl::destroyManager -(Deployment::NodeApplicationManager_ptr manager) -{ - CIAO_TRACE("CIAO::Static_NodeManager_Impl::destroyManager"); - try - { - CIAO::NodeManager_Impl_Base::destroyManager (manager); + ::Deployment::NodeApplicationManager_ptr + NodeManager_Impl::preparePlan (const ::Deployment::DeploymentPlan & plan, + ::Deployment::ResourceCommitmentManager_ptr /*resourceCommitment*/) + { + DANCE_TRACE ( "NodeManager_Impl::preparePlan"); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeManager_impl::preparePlan - " + "started for node %s and plan %s\n", this->name_.c_str(), plan.UUID.in())); + +#ifdef GEN_OSTREAM_OPS + { + std::ostringstream plan_stream; + plan_stream << plan << std::endl; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeManager_impl::preparePlan - $s", + plan_stream.str ().c_str ())); + } +#endif /* GEN_OSTREAM_OPS */ + + // resourceCommitment will be used on next development stage + if (0 == this->managers_.find (plan.UUID.in())) + { + // What should we do here if we already have application for this plan? + // Probably it is mistake because we should previously call destroyApplication + // before performe relaunching of application + DANCE_ERROR ((LM_ERROR, DLINFO "NodeManager_impl::preparePlan - " + "ApplicationManager for UUID %s already exists\n", + plan.UUID.in ())); + throw ::Deployment::PlanError(); + } + ACE_DEBUG ((LM_DEBUG, "*** size of properties_:%u\n", properties_.current_size ())); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeManager_impl::preparePlan - creating NodeApplicationManager...\n")); + NodeApplicationManager_Impl* manager = 0; + ACE_NEW_THROW_EX (manager, + NodeApplicationManager_Impl (this->orb_.in(), + this->poa_.in(), + plan, + this->redirection_, + this->name_, + this->properties_), + CORBA::NO_MEMORY()); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeManager_impl::preparePlan - activating NodeApplicationManager...\n")); + PortableServer::ObjectId_var id = this->poa_->activate_object (manager); + CORBA::Object_var nam = this->poa_->id_to_reference (id.in()); + + //there is an idea to check if plan.UUID really exists + this->managers_.bind (plan.UUID.in(), manager); + // narrow should return a nil reference if it fails. + DANCE_DEBUG ((LM_INFO, DLINFO "NodeManager_impl::preparePlan - NodeApplicationManager for plan %s completed\n", + plan.UUID.in ())); + return Deployment::NodeApplicationManager::_narrow (nam.in ()); + } - this->orb_->shutdown (0); + void + NodeManager_Impl::destroyManager (::Deployment::NodeApplicationManager_ptr appManager) + { + DANCE_TRACE ( "NodeManager_Impl::destroyManager"); + + for (TManagers::iterator iter = this->managers_.begin(); + iter != this->managers_.end(); + ++iter) + { + if (appManager->_is_equivalent (this->poa_->servant_to_reference ( (*iter).int_id_))) + { + PortableServer::ObjectId_var id = this->poa_->reference_to_id (appManager); + this->poa_->deactivate_object (id.in()); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeManager_impl::destroyManager - deleting NodeApplicationManager\n")); + delete (*iter).int_id_; + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeManager_impl::destroyManager - NodeApplicationManager deleted\n")); + this->managers_.unbind ( (*iter).ext_id_); + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeManager_impl::destroyManager - finished\n")); + return; + } + } + + DANCE_ERROR((LM_ERROR, DLINFO "NodeManager_impl::destroyManager - " + "correponding NodeApplicationManager cannot be found\n")); + throw ::Deployment::InvalidReference(); + } - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Static_NodeManager_Impl::destroyManager\t\n"); - throw; - } + ::Deployment::Resources * + NodeManager_Impl::getDynamicResources () + { + DANCE_TRACE ( "NodeManager_Impl::getDynamicResources ()"); + ACE_DEBUG ((LM_ERROR, DLINFO "NodeManager_Impl::getDynamicResources - " + "getDynamicResources not implemented\n")); + throw CORBA::NO_IMPLEMENT (); + return 0; + } +} //DAnCE -} diff --git a/CIAO/DAnCE/NodeManager/NodeManager_Impl.h b/CIAO/DAnCE/NodeManager/NodeManager_Impl.h index 45edfb63899..2df92d203f4 100644 --- a/CIAO/DAnCE/NodeManager/NodeManager_Impl.h +++ b/CIAO/DAnCE/NodeManager/NodeManager_Impl.h @@ -1,324 +1,69 @@ // -*- C++ -*- + //============================================================================= /** - * @file NodeManager_Impl.h + * @file NodeManager_Impl.h * * $Id$ * - * This file contains servant implementation for Deployment:NodeManager - * interface. In the current design of the NodeManager, each NodeManager - * could manage one or more NodeApplication Managers. - * Though, the name intuitively suggests - * that there be one NodeManager for every node, our design, allows - * the end-user to have multiple components run on the same node. + * @Brief Implementation of POA_Deployment::NodeManager * - * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> - * @author Gan Deng <dengg@dre.vanderbilt.edu> + * @author Erwin Gottlieb <eg@prismtech.com> + * @author William R. Otte <wotte@dre.vanderbilt.edu> */ //============================================================================= +#ifndef NODEMANAGER_IMPL_H_ +#define NODEMANAGER_IMPL_H_ -#ifndef CIAO_NODEMANAGER_IMPL_H -#define CIAO_NODEMANAGER_IMPL_H -#include /**/ "ace/pre.h" - -#include "Interfaces/NodeManagerDaemonS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (_MSC_VER) -# pragma warning(push) -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -#include "NodeManager_svnt_export.h" -#include "NAM_Map.h" -#include "MonitorController.h" -#include "ace/Vector_T.h" +#include "NodeManager_Export.h" +#include "tao/Object.h" +#include "tao/ORB.h" +#include "Deployment/Deployment_common.h" +#include "Deployment/Deployment_NodeManagerS.h" +#include "NodeApplicationManager/NodeApplicationManager_Impl.h" +#include "RedirectionService/RedirectionService.h" -namespace CIAO +namespace DAnCE { - class NodeApplicationManager_Impl_Base; - - /** - * @class NodeManager_Impl - * - * @brief Servant implementation CIAO's daemon process control - * interface - * - * This class implements the CIAO:NodeManagerDaemon interface. - * - */ - class NodeManager_svnt_Export NodeManager_Impl_Base - : public virtual POA_CIAO::NodeManagerDaemon + class NodeManager_Export NodeManager_Impl : public virtual POA_Deployment::NodeManager { public: - /// A struct that tracks the reference count of a particular - /// component as well as the "child_plan_uuid" where the component is - /// actually installed - typedef struct _ref_count_info - { - ACE_CString plan_uuid_; - size_t count_; - } Ref_Count_Info; - - /// Constructor - NodeManager_Impl_Base (const char *name, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr p, - const char * nodeapp_loc, - const char* nodeapp_options, - int spawn_delay); - - /// Initializes the NodeManager. - virtual void init (); - - /// POA operation.. - virtual PortableServer::POA_ptr _default_POA (void); + // the fixed listener port is caused by the usage of CCM Object locator + NodeManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char* name, + RedirectionService& redirection, + const PROPERTY_MAP &options); - /// CIAO::Daemon defined attributes/operations. - virtual char * name (); + virtual ~NodeManager_Impl(); - virtual void shutdown (); - - virtual void joinDomain (const Deployment::Domain & domain, - Deployment::TargetManager_ptr manager, - Deployment::Logger_ptr log - ); + virtual void joinDomain (const ::Deployment::Domain & theDomain, + ::Deployment::TargetManager_ptr manager, + ::Deployment::Logger_ptr log, + ::CORBA::Long updateInterval); virtual void leaveDomain (); - virtual ::Deployment::NodeApplicationManager_ptr - preparePlan (const Deployment::DeploymentPlan &plan); - - virtual void - destroyManager (Deployment::NodeApplicationManager_ptr appManager); - - /// CIAO specific extension, which is particularly useful for dealing with - /// shared components issue - virtual void destroyPlan (const Deployment::DeploymentPlan & plan); - - /// CIAO specific extension, return a set of shared components - virtual ::Deployment::ComponentPlans * - get_shared_components (); - - /// RACE specific extension. Modify the priority of a node application - /// process. - - virtual ::CORBA::Long - set_priority ( - const char * plan_id, - const char * cid, - const ::Deployment::Sched_Params & nm_params); - - // ********* CIAO Specific Helper functions ************ - - virtual ::Components::FacetDescriptions * - get_all_facets (ACE_CString & name); + virtual ::Deployment::NodeApplicationManager_ptr preparePlan ( + const ::Deployment::DeploymentPlan & plan, + ::Deployment::ResourceCommitmentManager_ptr resourceCommitment); - virtual ::Components::ConsumerDescriptions * - get_all_consumers (ACE_CString & name); + virtual void destroyManager (::Deployment::NodeApplicationManager_ptr appManager); - virtual void - set_all_facets (ACE_CString &name, - const ::Components::FacetDescriptions_var & facets); + virtual ::Deployment::Resources * getDynamicResources (); - virtual void - set_all_consumers (ACE_CString &name, - const ::Components::ConsumerDescriptions_var & consumers); - - // ********* Function added for getting component ids... - - struct Component_Ids - { - ACE_Unbounded_Set <ACE_CString> cid_seq_; - pid_t process_id_; - }; - - virtual void push_component_id_info (Component_Ids comps); - - - Component_Ids get_component_detail (); + const char* getName(); private: - /// Validate the child deployment plan. In particular, we are - /// trying to verify that all the component instances within this - /// child deployment plan have the same "server_resource_id" - /// assigned. - bool validate_plan (const Deployment::DeploymentPlan &plan); - - protected: - /// Since this class is reference counted, making this - /// destructor protected to enforce proper memory managment - /// through the reference counting mechanism (i.e. to - /// disallow calling operator delete() on an instance of - /// this class. - virtual ~NodeManager_Impl_Base (void); - - virtual ::CIAO::NodeApplicationManager_Impl_Base * - create_node_app_manager (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) - =0; - - /// Actual implementation of the @c get_shared_components IDL operation - virtual ::Deployment::ComponentPlans * - get_shared_components_i (void); - - /// A helper method that convert ACE_Unbounded_Set to CORBA StringSeq - CORBA::StringSeq * shared_components_seq (void); - - /// Keep a pointer to the managing ORB serving this servant. CORBA::ORB_var orb_; - - /// Keep a pointer to the managing POA. PortableServer::POA_var poa_; - - /// My Canonical name. - CORBA::String_var name_; - - /// NodeApplication location - CORBA::String_var nodeapp_location_; - - /// NodeApplication options - CORBA::String_var nodeapp_options_; - - /// Cached callback POA. - PortableServer::POA_var callback_poa_; - - /// Spawn delay for the NodeAppMgr - int spawn_delay_; - - /// Cache reference of last NodeAppManager - /// Deployment::NodeApplicationManager_var manager_; - NAM_Map map_; - - /// A reference count map for the components installed on this node - /// @@TODO We should also keep the information about *where* the - /// component is installed - typedef - ACE_Hash_Map_Manager_Ex <ACE_CString, - Ref_Count_Info, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Reference_Count_Map; - typedef Reference_Count_Map::iterator Ref_Count_Iterator; - - Reference_Count_Map ref_count_map_; - - /// A set to track the names of shared component instances - ACE_Unbounded_Set<ACE_CString> shared_components_; - - /// Cached object references of ports (facets/consumers) of - /// all components. This is useful for getting the port object - /// references of "shared components". The key in the map - /// is the component instance name. - typedef - ACE_Hash_Map_Manager_Ex <ACE_CString, - Components::FacetDescriptions_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Component_Facets_Map; - - Component_Facets_Map comp_facets_map_; - - typedef - ACE_Hash_Map_Manager_Ex <ACE_CString, - Components::ConsumerDescriptions_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> Component_Consumers_Map; - - Component_Consumers_Map comp_consumers_map_; - - /// The MonitorController pointer - auto_ptr <MonitorController> monitor_controller_; - - /// The set of Components - Component_Ids components_; - }; - - - /** - * @class NodeManager_Impl - * - */ - class NodeManager_svnt_Export NodeManager_Impl - : public virtual NodeManager_Impl_Base - { - public: - - /// Constructor - NodeManager_Impl (const char *name, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr p, - const char * nodeapp_loc, - const char * nodeapp_options, - int spawn_delay, - bool is_multi_threaded); - - protected: - /// Since this class is reference counted, making this - /// destructor protected to enforce proper memory managment - /// through the reference counting mechanism (i.e. to - /// disallow calling operator delete() on an instance of - /// this class. - virtual ~NodeManager_Impl (void); - - virtual ::CIAO::NodeApplicationManager_Impl_Base * - create_node_app_manager (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa); - - private: - bool is_multi_threaded_; - }; - - class NodeApplicationManager_Impl; - struct Static_Config_EntryPoints_Maps; - - /** - * @class Static_NodeManager_Impl - * - */ - class NodeManager_svnt_Export Static_NodeManager_Impl - : public virtual NodeManager_Impl_Base - { - public: - - /// Constructor - Static_NodeManager_Impl (const char *name, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr p, - const char * nodeapp_loc, - const char * nodeapp_options, - int spawn_delay, - Static_Config_EntryPoints_Maps* static_config_entrypoints_maps - ); - - void destroyManager - (Deployment::NodeApplicationManager_ptr manager); - - protected: - /// Since this class is reference counted, making this - /// destructor protected to enforce proper memory managment - /// through the reference counting mechanism (i.e. to - /// disallow calling operator delete() on an instance of - /// this class. - virtual ~Static_NodeManager_Impl (void); - - virtual ::CIAO::NodeApplicationManager_Impl_Base * - create_node_app_manager (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa); - - Static_Config_EntryPoints_Maps* static_config_entrypoints_maps_; + ACE_CString name_; + typedef ACE_Map_Manager<ACE_CString, NodeApplicationManager_Impl*, ACE_Null_Mutex > TManagers; + TManagers managers_; + RedirectionService& redirection_; + PROPERTY_MAP properties_; }; +}; -} - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#include /**/ "ace/post.h" -#endif /* CIAO_NODEMANAGER_IMPL_H */ +#endif /*NODEMANAGER_IMPL_H_*/ diff --git a/CIAO/DAnCE/NodeManager/Node_Manager.cpp b/CIAO/DAnCE/NodeManager/Node_Manager.cpp deleted file mode 100644 index db17269b707..00000000000 --- a/CIAO/DAnCE/NodeManager/Node_Manager.cpp +++ /dev/null @@ -1,293 +0,0 @@ -// $Id$ - -#include "NodeManager_Impl.h" -#include "orbsvcs/CosNamingC.h" -#include "tao/IORTable/IORTable.h" -#include "ace/SString.h" -#include "ace/Read_Buffer.h" -#include "ace/Get_Opt.h" -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_unistd.h" -#include "ace/os_include/os_netdb.h" -#include "ciao/Server_init.h" -#include "ciao/CIAO_common.h" - -const char *ior_file_name_ = "nodedaemon.ior"; -char *nodeapp_location_ = 0; -const char *pid_file_name_ = 0; -bool write_to_ior_ = false; -bool register_with_ns_ = false; -int nodeapp_loc_ = 0; -int spawn_delay = 1; -bool is_multi_threaded = false; - -ACE_CString nodeapp_options_; - -int -parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:c:ms:d:na:p:z:")); - int c; - - while ((c = get_opts ()) != -1) - { - switch (c) - { - case 'z': - nodeapp_options_ += " -ORBDebugLevel "; - nodeapp_options_ += get_opts.opt_arg (); - break; - - case 'o': // Get the file name to write to. - ior_file_name_ = get_opts.opt_arg (); - write_to_ior_ = true; - break; - - case 'c': // Get the default svc.conf filename. - nodeapp_options_ += " -ORBSvcConf "; - nodeapp_options_ += get_opts.opt_arg (); - break; - - case 's': // Get the location to spawn the NodeApplication. - nodeapp_location_ = get_opts.opt_arg (); - nodeapp_loc_ = 1; - break; - - case 'a': // Nodeapplication arguments. - nodeapp_options_ = get_opts.opt_arg (); - break; - - case 'd': // Get the spawn delay argument. - spawn_delay = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case 'n': - register_with_ns_ = true; - break; - - case 'p': - pid_file_name_ = get_opts.opt_arg (); - break; - - case 'm': - is_multi_threaded = true; - break; - - case '?': // Display help for use of the server. - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s\n" - "-o <ior_output_file>\n" - "-c <svc.conf file>\n" - "-n <use naming service>\n" - "-s <NodeApplication executable path>\n" - "-a <arguments to NodeApplication>\n" - "-d <spawn delay for nodeapplication>\n" - "-p <pid file>\n" - "-m <running in multi-threaded mode>\n" - "\n", - argv [0]), - -1); - break; - } - } - - return 0; -} - -int -write_IOR (const char* ior) -{ - FILE* ior_output_file_ = - ACE_OS::fopen (ior_file_name_, "w"); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, - "%s", - ior); - ACE_OS::fclose (ior_output_file_); - } - - return 0; -} - -void -write_pid (void) -{ - if (pid_file_name_ == 0) - { - return; - } - - FILE* pid_file = ACE_OS::fopen (pid_file_name_, "w"); - - if (pid_file) - { - ACE_OS::fprintf (pid_file, - "%i", - ACE_OS::getpid ()); - ACE_OS::fclose (pid_file); - } -} - -bool -register_with_ns (const char * name_context, - CORBA::ORB_ptr orb, - CIAO::NodeManagerDaemon_ptr obj) -{ - // Naming Service related operations - CORBA::Object_var naming_context_object = - orb->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_context_object.in ()); - - // Initialize the Naming Sequence - CosNaming::Name name (1); - name.length (1); - name[0].id = name_context; - - try - { - // Register the servant with the Naming Service - naming_context->bind (name, obj); - } - catch (CosNaming::NamingContext::AlreadyBound &) - { - ACE_DEBUG ((LM_DEBUG, "Node_Manager.cpp: Name already bound, rebinding....\n")); - naming_context->rebind (name, obj); - } - - return true; -} - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize orb - // @@TODO: Add error checking. There is absoluteley none. - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - CIAO::Server_init (orb.in ()); - - if (parse_args (argc, argv) != 0) - return -1; - - // Check if NodeApplication executable location has been - // specified - if (! nodeapp_loc_) - { - ACE_DEBUG ((LM_DEBUG, "Use -s <NodeApplicationPath> to specify \ - executable path\n")); - ACE_OS::exit (1); - } - - // Get reference to Root POA. - CORBA::Object_var obj - = orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var poa - = PortableServer::POA::_narrow (obj.in ()); - - CORBA::Object_var table_object = - orb->resolve_initial_references ("IORTable"); - - IORTable::Table_var adapter = - IORTable::Table::_narrow (table_object.in ()); - - if (CORBA::is_nil (adapter.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, "Nil IORTable\n"), -1); - } - - // Create and install the CIAO NodeManager servant - CIAO::NodeManager_Impl *node_manager_servant = 0; - ACE_NEW_RETURN (node_manager_servant, - CIAO::NodeManager_Impl("NodeManager", - orb.in (), - poa.in (), - nodeapp_location_, - nodeapp_options_.c_str (), - spawn_delay, - is_multi_threaded), - -1); - - PortableServer::ServantBase_var safe_daemon (node_manager_servant); - - node_manager_servant->init (); - - // Implicit activation - CIAO::NodeManagerDaemon_var node_manager = - node_manager_servant->_this (); - - CORBA::String_var str = - orb->object_to_string (node_manager.in ()); - - adapter->bind ("NodeManager", - str.in ()); - - if (write_to_ior_) - { - write_IOR (str.in ()); - } - else if (register_with_ns_) - { - char name [MAXHOSTNAMELEN + 1]; - - if (ACE_OS::hostname (name, MAXHOSTNAMELEN + 1) == -1) - { - ACE_ERROR ((LM_ERROR, - "gethostname call failed! \n")); - ACE_OS::exit (1); - } - - // Register this name with the Naming Service - (void) register_with_ns (name, - orb.in (), - node_manager.in ()); - } - - ACE_DEBUG ((LM_INFO, "CIAO_NodeManager IOR: %s\n", str.in ())); - - // Activate POA manager - PortableServer::POAManager_var mgr - = poa->the_POAManager (); - - mgr->activate (); - - // Here start the Monitor - /* - MonitorController* monitor_controller - = new MonitorController (orb); - - ACE_DEBUG ((LM_DEBUG , "Before Activate")); - monitor_controller->activate (); - ACE_DEBUG ((LM_DEBUG , "After Activate")); - */ - - // Finishing Deployment part - ACE_DEBUG ((LM_DEBUG, - "CIAO_NodeManager is running...\n")); - - write_pid (); - - // Run the main event loop for the ORB. - orb->run (); - - poa->destroy (1, 1); - - orb->destroy (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("CIAO_NodeManager::main\t\n"); - return 1; - } - - ACE_DEBUG ((LM_DEBUG, - "CIAO_NodeManager has closed\n")); - return 0; -} diff --git a/CIAO/DAnCE/NodeManager/Node_Manager_Exec.cpp b/CIAO/DAnCE/NodeManager/Node_Manager_Exec.cpp new file mode 100644 index 00000000000..889604048c5 --- /dev/null +++ b/CIAO/DAnCE/NodeManager/Node_Manager_Exec.cpp @@ -0,0 +1,6 @@ +// $Id$ +#include "Node_Manager_Module.h" + +#define DANCE_MODULE_MAIN_CLASS_NAME DAnCE_NodeManager_Module +#include "Deployment/Module_Main.h" + diff --git a/CIAO/DAnCE/NodeManager/Node_Manager_Module.cpp b/CIAO/DAnCE/NodeManager/Node_Manager_Module.cpp new file mode 100644 index 00000000000..1df77501dd6 --- /dev/null +++ b/CIAO/DAnCE/NodeManager/Node_Manager_Module.cpp @@ -0,0 +1,653 @@ +// -*- C++ -*- +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/OS.h" + +#include "tao/TAO_Singleton_Manager.h" +#include "tao/StringSeqC.h" +#include "tao/IORTable/IORTable.h" +#include "tao/Utils/PolicyList_Destroyer.h" +#include "orbsvcs/CosNamingC.h" +#include "orbsvcs/orbsvcs/Naming/Naming_Loader.h" +#include "ciao/CIAO_common.h" +#include "ciao/Valuetype_Factories/Cookies.h" +#include "ciao/ComponentServer/CIAO_PropertiesC.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "DAnCE/Deployment/DAnCE_PropertiesC.h" +#include "Node_Manager_Module.h" +#include "NodeManager_Impl.h" +#include "RedirectionService/RedirectionService.h" + +ACE_RCSID (DAnCE, + Node_Manager_Module, + "$Id$") + +namespace DAnCE +{ + namespace Node_Manager + { + bool + write_IOR (const ACE_TCHAR * ior_file_name, const char* ior) + { + FILE* ior_output_file_ = + ACE_OS::fopen (ior_file_name, ACE_TEXT("w")); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + return true; + } + return false; + } + } +} + +DAnCE_NodeManager_Module::DAnCE_NodeManager_Module (void) + : redirection_ (0) +{ + DANCE_TRACE("DAnCE_NodeManager_Module::DAnCE_NodeManager_Module"); +} + +DAnCE_NodeManager_Module::~DAnCE_NodeManager_Module (void) +{ + DANCE_TRACE ("DAnCE_NodeManager_Module::~DAnCE_NodeManager_Module"); + + for (Servant_Map::iterator it = this->nm_map_.begin (); + it != this->nm_map_.end (); + ++it) + { + delete (*it).int_id_; + } + + delete this->redirection_; +} + +const char * +DAnCE_NodeManager_Module::usage (void) +{ + DANCE_TRACE ("DAnCE_NodeManager_Module::usage"); + return "Node Manager Options:\n" + "\t-e,--exec-mgr\t\t [execution manager ior file name]\n" + "\t-n,--node-mgr\t\t <node name> [=node manager ior file name]\n" + // "\t-p,--process-ns\t\t\t [file name] create process name service and store its ior to file name\n" + "\t-c,--create-plan-ns [NC] create plan objects (components and ports) representation in name context with ior NC\n" + "\t-r,--rebind-plan-ns [NC] bind plan representation name context to NC\n" + "\t-i,--port-indirection\t enable plan objects indirection via servant locator\n" + //"\t-f,--ignore-failure\t\t ignore deployment failures\n" + "\t-s,--server-executable\t default component server executable\n" + "\t--server-args\t\t additional arguments to supply to the component server\n" + "\t--standalone-nm\t\t Indicates that this NodeManager is not managed by an ExecutionManager\n" + "\t-t,--timeout\t\t default timeout in seconds to wait for component server spawn\n" + "\t-d,--domain-nc [NC]\t Default naming context for domain objects.\n" + "\t--instance-nc [NC]\t Default naming context for instance registration directives. No argument indicates Domain NC.\n" + "\t-h,help\t\t\t print this help message\n"; +} + +bool +DAnCE_NodeManager_Module::parse_args (int argc, ACE_TCHAR * argv[]) +{ + ACE_Get_Opt get_opts (argc, + argv, + ACE_TEXT("e:n:p::c::r::ifs:t:h"), + 0, + 0, + ACE_Get_Opt::RETURN_IN_ORDER); + + get_opts.long_option (ACE_TEXT("exec-mgr"), 'e', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("node-mgr"), 'n', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("process-ns"), 'p', ACE_Get_Opt::ARG_OPTIONAL); + get_opts.long_option (ACE_TEXT("create-plan-ns"), 'c', ACE_Get_Opt::ARG_OPTIONAL); + get_opts.long_option (ACE_TEXT("rebind-plan-ns"), 'r', ACE_Get_Opt::ARG_OPTIONAL); + get_opts.long_option (ACE_TEXT("port-indirection"), 'i', ACE_Get_Opt::NO_ARG); + get_opts.long_option (ACE_TEXT("ignore-failure"), 'f', ACE_Get_Opt::NO_ARG); + get_opts.long_option (ACE_TEXT("server-executable"), 's', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("server-args"), ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("standalone-nm"), ACE_Get_Opt::NO_ARG); + get_opts.long_option (ACE_TEXT("timeout"), 't', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("domain-nc"), 'd', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); + get_opts.long_option (ACE_TEXT("instance-nc"), ACE_Get_Opt::ARG_REQUIRED); + + //get_opts.long_option ("help", '?'); + + char c; + while ( (c = get_opts ()) != -1) + { + switch (c) + { + case 'n': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Provided Node Manager name: %C\n", get_opts.opt_arg ())); + this->options_.node_managers_.push_back (get_opts.opt_arg ()); + break; + + case 'p': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Instructed to create process ns with file %C\n", get_opts.opt_arg ())); + this->options_.process_ns_ = true; + this->options_.process_ns_file_ = get_opts.opt_arg (); + break; + + case 'c': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Instructed to create plan NS in context: %C\n", get_opts.opt_arg ())); + this->options_.create_plan_ns_ = true; + this->options_.create_plan_ns_ior_ = get_opts.opt_arg (); + break; + + case 'r': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Instructed to rebind plan NS in context: %C\n", get_opts.opt_arg ())); + this->options_.rebind_plan_ns_ = true; + this->options_.rebind_plan_ns_ior_ = get_opts.opt_arg (); + break; + + case 'i': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Instructed to create port indirection service\n")); + this->options_.port_indirection_ = true; + break; + + case 'f': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Instructed to ignore deployment errors\n")); + this->options_.ignore_failure_ = true; + break; + + case 's': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Using provided component server executable:%C\n", + get_opts.opt_arg ())); + this->options_.cs_path_ = get_opts.opt_arg (); + break; + + case 't': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Using provided component server spawn timeout:%C\n", + get_opts.opt_arg ())); + this->options_.timeout_ = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Binding to provided Domain Naming Context: '%s'\n", + get_opts.opt_arg ())); + this->options_.domain_nc_ = get_opts.opt_arg (); + break; + + case 'h': + //case '?': // Display help for use of the server. + //default: + DANCE_ERROR_RETURN ( (LM_ERROR, + this->usage (), + argv [0], c), + false); + break; + + case 0: + if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("standalone-nm")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Found option directing NodeManager to run as standalone entity.\n")); + this->options_.standalone_ = true; + } + else if (ACE_OS::strcmp (get_opts.long_option (), + ACE_TEXT("server-args")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Using provided compoent server arguments: '%C'\n", + get_opts.opt_arg ())); + this->options_.server_args_ = get_opts.opt_arg (); + } + else if (ACE_OS::strcmp (get_opts.long_option (), + "instance-nc") == 0) + { + if (get_opts.opt_arg () == 0) + { + if (this->options_.domain_nc_ == 0) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Manager_Module::parse_args - " + "ERROR: instance-nc provided no argument, but domain-nc did not appear before.\n")); + DANCE_ERROR_RETURN ((LM_ERROR, this->usage (), argv[0], c), false); + } + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Instance NC defaulting to Domain NC\n")); + this->options_.instance_nc_ = this->options_.domain_nc_; + } + else + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Manager_Module::parse_args - " + "Using provided instance NC: %C\n", + get_opts.opt_arg ())); + this->options_.instance_nc_ = get_opts.opt_arg (); + } + } + else + { + DANCE_ERROR ((LM_ERROR, DLINFO "Node_Manager_Module::parse_args - " + "ERROR: unknown long option %C\n", + get_opts.long_option ())); + } + + break; + + default: + DANCE_DEBUG ((LM_TRACE, DLINFO "Node_Manager_Module::parse_args - ignoring unknown option %i\n", + c)); + } + } + return true; +} + +CORBA::Object_ptr +DAnCE_NodeManager_Module::create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv[]) +{ + try + { + if (CORBA::is_nil(orb)) + { + DANCE_ERROR((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Attempted to create Node Manager with a nil orb.\n")); + return CORBA::Object::_nil(); + } + + if (CORBA::is_nil(this->orb_.in())) + { + DANCE_DEBUG((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "NM's orb is nil.\n")); + this->orb_ = CORBA::ORB::_duplicate (orb); + } + else if (ACE_OS::strcmp(orb->id(), this->orb_->id()) != 0) + { + DANCE_DEBUG((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Resetting NM's orb.\n")); + this->orb_ = CORBA::ORB::_duplicate (orb); + this->domain_nc_ = CosNaming::NamingContext::_nil(); + } + + if (!this->parse_args (argc, argv)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Failed to parse command line arguments, exiting\n")); + return CORBA::Object::_nil (); + } + + + /* @@CDMW stuff, figure out what to do with this later.... + try + { + CORBA::Object_var obj = orb->resolve_initial_references ("ProcessDestinationNC"); + if (CORBA::is_nil(obj)) + { + DANCE_ERROR((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "ProcessDestinationNC can not be resolved. RIR returned nil.\n")); + return CORBA::Object::_nil(); + } + + CosNaming::NamingContext_var pdnc = CosNaming::NamingContext::_narrow(obj.in()); + if (CORBA::is_nil(pdnc.in())) + { + DANCE_ERROR((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "ProcessDestinationNC can not be narrowed to NC.\n")); + return CORBA::Object::_nil(); + } + } + catch (CORBA::ORB::InvalidName &) + { + DANCE_ERROR((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "ProcessDestinationNC can not be resolved. InvalidName.\n")); + return CORBA::Object::_nil(); + } + catch(...) + { + DANCE_ERROR((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "ProcessDestinationNC can not be retrieved. Unknown exception.\n")); + return CORBA::Object::_nil(); + } + */ + + + this->register_value_factories (); + this->create_poas (); + + if (this->options_.domain_nc_) + { + try + { + DANCE_DEBUG((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Resolving DomainNC.\n")); + CORBA::Object_var domain_obj = this->orb_->string_to_object (this->options_.domain_nc_); + if (!CORBA::is_nil (domain_obj.in ())) + { + this->domain_nc_ = CosNaming::NamingContext::_narrow (domain_obj.in()); + if (CORBA::is_nil (this->domain_nc_.in ())) + { + DANCE_ERROR ((LM_ERROR,DLINFO "DAnCE_NodeManager_Module::create_object - " + "Narrow to NamingContext return nil for DomainNC.\n")); + return CORBA::Object::_nil (); + } + } + } + catch (CORBA::Exception&) + { + DANCE_DEBUG ((LM_WARNING, DLINFO "DAnCE_NodeManager_Module::create_object - " + "DomainNC context not found!\n")); + } + } + + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Resolving plan NS naming context.\n")); + CosNaming::NamingContext_var rebind_nc; + if (this->options_.rebind_plan_ns_) + { + if (!this->options_.create_plan_ns_) + { + DANCE_ERROR((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Rebind_plan_ns option is enabled but Create_plan_ns is not.\n")); + return CORBA::Object::_nil(); + } + CORBA::Object_var tmp_obj; + if (0 != this->options_.rebind_plan_ns_ior_) + { + tmp_obj = orb->string_to_object (this->options_.rebind_plan_ns_ior_); + rebind_nc = CosNaming::NamingContext::_narrow (tmp_obj); + } + else + { + if (CORBA::is_nil (this->domain_nc_.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "The rebind plan is enabled but neither NC " + "nor DomainNC are not supplied. No rebinding will be done.\n" + "Use the \"-rebind-plan-ns NC ior\" " + "or \"-ORBInitRef DomainNC\" option.\n")); + return CORBA::Object::_nil (); + } + rebind_nc = CosNaming::NamingContext::_duplicate (this->domain_nc_.in ()); + } + } + + // Initialize IOR table + CORBA::Object_var table_object = orb->resolve_initial_references ("IORTable"); + + IORTable::Table_var adapter = IORTable::Table::_narrow (table_object.in ()); + + if (CORBA::is_nil (adapter.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Unable to RIR the IORTable.\n")); + return CORBA::Object::_nil (); + } + + // Creating in process nameservice + CosNaming::NamingContext_var plan_nc; + TAO_Naming_Loader loader; + if (this->options_.create_plan_ns_) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Resolving plan-specific naming context.\n")); + CORBA::Object_var naming_obj; + if (0 != this->options_.create_plan_ns_ior_) + { + naming_obj = orb->string_to_object (this->options_.create_plan_ns_ior_); + plan_nc = CosNaming::NamingContext::_narrow (naming_obj.in()); + if (CORBA::is_nil (plan_nc.in())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Failed trying to narrow naming context " + "for dance creating plan NC.\n" + "Use the \"--create-plan-ns NC ior\" " + "or \"--process-ns\" option.\n")); + return CORBA::Object::_nil (); + } + } + else if (this->options_.process_ns_) + { + const int argc_ns = 1; + char* argv_ns[argc_ns]; + argv_ns[0] = argv[0]; + naming_obj = orb->resolve_initial_references ("NameService"); + if (0 != this->options_.process_ns_file_) + { + CORBA::String_var ior = orb->object_to_string (naming_obj.in ()); + DAnCE::Node_Manager::write_IOR (this->options_.process_ns_file_, ior.in ()); + } + plan_nc = CosNaming::NamingContext::_narrow (naming_obj.in ()); + if (CORBA::is_nil (plan_nc.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Fails trying to narrow naming context " + "for dance creating plan NC.\n" + "Use the \"--create-plan-ns NC ior\" " + "or \"--process-ns\" option.\n")); + return CORBA::Object::_nil (); + } + } + else if (CORBA::is_nil (this->domain_nc_.in ())) + { + DANCE_ERROR ((LM_ERROR,DLINFO "DAnCE_NodeManager_Module::create_object - " + "The create plan is enabled but neither NC ior " + "nor --process-ns or DomainNC option are not supplied.\n" + "Use the \"--create-plan-ns NC ior\", \"--process-ns\" " + "or \"-ORBInitRef DomainNC\" option.\n")); + return CORBA::Object::_nil (); + } + else + { + plan_nc = CosNaming::NamingContext::_duplicate (this->domain_nc_.in ()); + } + } + + //Creating redirection object + if (this->redirection_ == 0) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Creating redirection service object\n")); + this->redirection_ = new DAnCE::RedirectionService (orb, + this->root_poa_.in (), + plan_nc.in (), + rebind_nc.in (), + this->options_.create_plan_ns_, + this->options_.port_indirection_); + } + + // Make sure that we have only one Node Manager + if (this->options_.node_managers_.size () != 1) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "For now only one node manager creation is supported.\n")); + return CORBA::Object::_nil (); + } + + DANCE_DEBUG ((LM_DEBUG, DLINFO "DAnCE_NodeManager_Module::create_object - " + "DAnCE_NodeManager::run_main - creating NodeManager for node %C\n", + this->options_.node_managers_[0].c_str())); + + // Parsing Node name and node manager ior file name + ACE_CString node_name = this->options_.node_managers_[0].c_str (); + ACE_CString node_file; + size_t npos = node_name.find ('='); + if (ACE_CString::npos != npos) + { + node_file = node_name.substring (npos + 1, node_name.length() - npos + 1); + node_name = node_name.substring (0, npos); + } + + DANCE_DEBUG ((LM_INFO, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Creating node named '%C' and outputting ior to file '%C'\n", + node_name.c_str (), + node_file.c_str ())); + + //Creating node manager servant + DAnCE::NodeManager_Impl * nm = 0; + if (this->nm_map_.find (node_name, nm) == -1) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Allocating new NodeManger servant instance for NodeManager\n")); + int size = 64; + DAnCE::PROPERTY_MAP properties (size); + this->create_nm_properties (properties); + + ACE_NEW_RETURN (nm, + DAnCE::NodeManager_Impl (orb, + this->root_poa_.in (), + node_name.c_str(), + *this->redirection_, + properties), + CORBA::Object::_nil ()); + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "New NodeManger servant instance for NodeManager allocated.\n")); + this->nm_map_.bind (node_name, nm); + } + + ACE_CString node_manager_oid = node_name + ".NodeManager"; + + // Registering servant in poa + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (node_manager_oid.c_str()); + this->nm_poa_->activate_object_with_id (oid, nm); + + // Getting node manager ior + CORBA::Object_var nm_obj = this->nm_poa_->id_to_reference (oid.in ()); + CORBA::String_var ior = orb->object_to_string (nm_obj.in ()); + + // Binding ior to IOR Table + adapter->bind (node_manager_oid.c_str (), ior.in ()); + + // Binding node menager to DomainNC + if (!CORBA::is_nil (this->domain_nc_.in ())) + { + DANCE_DEBUG((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Registering NM in NC as \"%C.NodeManager\".\n", node_name.c_str ())); + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup (node_name.c_str ()); + name[0].kind = CORBA::string_dup ("NodeManager"); + this->domain_nc_->rebind (name, nm_obj.in ()); + } + + // Writing ior to file + if (0 != node_file.length ()) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Writing node IOR %C to file %C.\n", node_file.c_str (), ior.in ())); + if (!DAnCE::Node_Manager::write_IOR (node_file.c_str (), ior.in ())) + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Error: Unable to write IOR to file %C\n", + node_file.c_str ())); + } + + // Activate POA manager + PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); + mgr->activate (); + + // Finishing Deployment part + DANCE_DEBUG ((LM_NOTICE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "DAnCE_NodeManager is running...\n")); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "DAnCE_NodeManager_Module::create_object - " + "NodeManager IOR: %s\n", ior.in ())); + + return nm_obj._retn (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("DAnCE_NodeManager::main\t\n"); + return CORBA::Object::_nil (); + } +} + +void +DAnCE_NodeManager_Module::register_value_factories (void) +{ + DANCE_TRACE("DAnCE_Node_Manager_Module::register_value_factories (void)"); + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_object - " + "Registering Cookie value factory.\n")); + CORBA::ValueFactory_var vf = new Components::Cookie_init(); + vf = this->orb_->register_value_factory ("IDL:omg.org/Components/Cookie:1.0", vf.in()); +} + +void +DAnCE_NodeManager_Module::create_poas (void) +{ + DANCE_TRACE("DAnCE_Node_Manager_Module::create_poas"); + // Get reference to Root POA. + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_poas - " + "Resolving root POA\n")); + CORBA::Object_var obj = this->orb_->resolve_initial_references ("RootPOA"); + + this->root_poa_ = PortableServer::POA::_narrow (obj.in ()); + + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_poas - " + "Obtaining the POAManager\n")); + PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); + + TAO::Utils::PolicyList_Destroyer policies (2); + policies.length (2); + + try + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_NodeManager_Module::create_poas - " + "DAnCE_NodeManager_Module::create_poas - " + "Creating the \"Managers\" POA.\n")); + + policies[0] = this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID); + policies[1] = this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT); + this->nm_poa_ = this->root_poa_->create_POA ("Managers", + mgr.in(), + policies); + } + catch (const PortableServer::POA::AdapterAlreadyExists &) + { + DANCE_DEBUG ((LM_INFO, DLINFO "DAnCE_NodeManager_Module::create_poas - " + "Using exiswting \"Managers\" POA\n")); + this->nm_poa_ = this->root_poa_->find_POA ("Managers", 0); + } +} + +void +DAnCE_NodeManager_Module::create_nm_properties (DAnCE::PROPERTY_MAP &props) +{ + { + CORBA::Any val; + val <<= this->options_.timeout_; + props.bind (CIAO::Deployment::SERVER_TIMEOUT, val); + } + { + CORBA::Any val; + val <<= CORBA::Any::from_string (CORBA::string_dup (this->options_.cs_path_),0); + props.bind (CIAO::Deployment::SERVER_EXECUTABLE, val); + } + { + CORBA::Any val; + val <<= CORBA::Any::from_boolean (this->options_.standalone_); + props.bind (DAnCE::STANDALONE_NM, val); + } + { + CORBA::Any val; + val <<= CORBA::Any::from_string (CORBA::string_dup (this->options_.server_args_),0); + props.bind (CIAO::Deployment::SERVER_ARGUMENTS, val); + } + if (this->options_.instance_nc_) + { + CORBA::Any val; + val <<= CORBA::Any::from_string (CORBA::string_dup (this->options_.instance_nc_), 0); + props.bind (DAnCE::INSTANCE_NC, val); + } + if (this->options_.domain_nc_) + { + CORBA::Any val; + val <<= CORBA::Any::from_string (CORBA::string_dup (this->options_.domain_nc_), 0); + props.bind (DAnCE::DOMAIN_NC, val); + } +} + +#ifndef BUILD_NODE_MANAGER_EXE +ACE_FACTORY_DEFINE (DAnCE_NodeManager_Module, DAnCE_NodeManager_Module) +#endif /*BUILD_NODE_MANAGER_EXE */ diff --git a/CIAO/DAnCE/NodeManager/Node_Manager_Module.h b/CIAO/DAnCE/NodeManager/Node_Manager_Module.h new file mode 100644 index 00000000000..97487f15328 --- /dev/null +++ b/CIAO/DAnCE/NodeManager/Node_Manager_Module.h @@ -0,0 +1,133 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Node_Manager_Module.h + * + * $Id$ + * + * @Brief To start NodeManager by starter + * + * @author Vinzenz Tornow <vt@prismtech.com> + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef NODE_MANAGER_MODULE_H +#define NODE_MANAGER_MODULE_H + +#include /**/ "ace/pre.h" + +#include "DAnCE_NodeManager_Module_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" +#include "ace/Vector_T.h" +#include "ace/Map_Manager.h" +#include "ace/Null_Mutex.h" +#include "tao/ORB.h" +#include "tao/PortableServer/POAC.h" +#include "orbsvcs/CosNamingC.h" +#include "tao/Object_Loader.h" +#include "Deployment/DAnCE_Loader.h" +#include "DAnCE/Deployment/Deployment_common.h" + +namespace DAnCE +{ + class NodeManager_Impl; + class RedirectionService; +} + +/** + * @class Node_Manager_Module + * + * @brief The shared object that is instantiated when the node manager + * module/library is dynamically loaded. + * + * This class runs the node manager instance + */ +class DAnCE_NodeManager_Module_Export DAnCE_NodeManager_Module + : public DAnCE::DAnCE_Object_Loader +{ + public: + struct SOptions + { + bool process_ns_; + const char* process_ns_file_; + bool create_plan_ns_; + const char* create_plan_ns_ior_; + bool rebind_plan_ns_; + const char* rebind_plan_ns_ior_; + bool port_indirection_; + ACE_Vector<ACE_CString> node_managers_; + bool ignore_failure_; + const char * cs_path_; + unsigned int timeout_; + CORBA::Boolean standalone_; + const char * server_args_; + const char * domain_nc_; + const char * instance_nc_; + + SOptions() + : process_ns_ (false), + process_ns_file_ (0), + create_plan_ns_ (false), + create_plan_ns_ior_ (0), + rebind_plan_ns_ (false), + rebind_plan_ns_ior_ (0), + ignore_failure_ (false), + cs_path_ (0), + timeout_ (5), + standalone_ (false), + server_args_ (0), + domain_nc_ (0), + instance_nc_ (0) + { + } + }; + + /// Constructor. + DAnCE_NodeManager_Module (void); + + /// Destructor. + ~DAnCE_NodeManager_Module (void); + + /// Overload the base class method to create a new instance + /// of a DAnCE_NodeManager_Module object. + virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv []); + + virtual const char * usage (void); + + virtual bool parse_args (int argc, ACE_TCHAR *argv []); + + private: + void register_value_factories (void); + void create_poas (void); + void create_nm_properties (DAnCE::PROPERTY_MAP &props); + + /// Here we store the servants. + typedef ACE_Map_Manager < ACE_CString, + DAnCE::NodeManager_Impl *, + ACE_Null_Mutex > Servant_Map; + Servant_Map nm_map_; + CORBA::ORB_var orb_; + CosNaming::NamingContext_var domain_nc_; + + /// Single redirection service for all NMs. + DAnCE::RedirectionService * redirection_; + SOptions options_; + + PortableServer::POA_var root_poa_; + PortableServer::POA_var nm_poa_; +}; + +ACE_FACTORY_DECLARE (DAnCE_NodeManager_Module, DAnCE_NodeManager_Module) + +#include /**/ "ace/post.h" + +#endif /* NODE_MANAGER_MODULE_H */ diff --git a/CIAO/DAnCE/Plan_Generator/Plan_Generator.mpc b/CIAO/DAnCE/Plan_Generator/Plan_Generator.mpc index 082fb9b47df..8a1091e5c58 100644 --- a/CIAO/DAnCE/Plan_Generator/Plan_Generator.mpc +++ b/CIAO/DAnCE/Plan_Generator/Plan_Generator.mpc @@ -1,7 +1,8 @@ // -*- MPC -*- //$Id$ -project (Plan_Generator): ciao_component_dnc, ace_output { +project (Plan_Generator) { //: ciao_component_dnc, ace_output { + requires += dummy_label sharedname = Plan_Generator after += RepositoryManager diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp index 4365434bcc4..9ca8632e434 100644 --- a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp @@ -1,359 +1,42 @@ // $Id$ -#include "Plan_Launcher_Benchmark_Impl.h" +#include "Plan_Launcher_Impl.h" -#include "ace/OS.h" -#include "ace/Get_Opt.h" -#include <iostream> - -#include "DAnCE/Interfaces/ExecutionManagerDaemonC.h" - -namespace CIAO -{ - namespace Plan_Launcher +namespace DAnCE { - // deployment plan URL - const char* deployment_plan_url = 0; - bool use_package_name = true; - const char* package_names = 0; - const char* package_types = 0; - const char* new_deployment_plan_url = 0; - const char* plan_uuid = 0; - bool em_use_naming = false; - const char* em_ior_file = "file://em.ior"; - bool rm_use_naming = false; - bool use_repoman = false; - const char* rm_ior_file = "file://rm.ior"; - const char* repoman_name_ = "RepositoryManager"; - const char* dap_ior_filename = 0; - const char* dap_ior = 0; - bool do_benchmarking = false; - size_t niterations = 0; - CORBA::Short priority = 0; - - enum mode_type { - pl_mode_start, - pl_mode_interactive, - pl_mode_stop_by_dam, - pl_mode_stop_by_uuid, - pl_mode_redeployment - }; - - // default mode - mode_type mode = pl_mode_interactive; - - static void - usage (const ACE_TCHAR* program) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("[(%P|%t) Executor] Usage: %s\n") - ACE_TEXT ("-a <PACKAGE_NAMES>\n") - ACE_TEXT ("-b <BENCHMARKING_ITERATIONS>\n") - ACE_TEXT ("-e <PACKAGE_TYPES>\n") - ACE_TEXT ("-i <DOMAIN_APPLICATION_MANAGER_IOR_FOR_INPUT>: Tear down the application launched by this Domain Application Manager\n") - ACE_TEXT ("-k <EXECUTION_MANAGER_IOR>") - ACE_TEXT (" : Default file://em.ior\n") - ACE_TEXT ("-l <REPOSITORY_MANAGER_IOR>") - ACE_TEXT (" : Default file://rm.ior\n") - ACE_TEXT ("-n : Use naming service to fetch EM\n") - ACE_TEXT ("-o <DOMAIN_APPLICATION_MANAGER_IOR_OUTPUT_FILE>: Use this option to dump out the IOR of the Domain Application Manager\n") - ACE_TEXT ("-p <DEPLOYMENT_PLAN_URL>\n") - ACE_TEXT ("-r <NEW_PLAN_DESCRIPTOR_FOR_REDEPLOYMENT>\n") - ACE_TEXT ("-t <PLAN_UUID>\n") - ACE_TEXT ("-v <REPOSITORY_MANAGER_NAME>: Use naming service to fetch RM with the given name") - ACE_TEXT (" : Default RepositoryManager\n") - ACE_TEXT ("-z <DESIRED_CORBA_PRIORITY_FOR_EXECUTION_MANAGER>\n") - ACE_TEXT ("-h : Show this usage information\n"), - program)); - } - - static bool - parse_args (int argc, - ACE_TCHAR *argv[]) - { - ACE_Get_Opt get_opt (argc, - argv, - ACE_TEXT ("a:b:e:p:nk:l:v:t:o:i:r:z:h")); - int c; - - while ((c = get_opt ()) != EOF) - { - switch (c) - { - case 'a': - package_names = get_opt.opt_arg (); - use_package_name = true; - break; - case 'b': - do_benchmarking = true; - niterations = ACE_OS::atoi (get_opt.opt_arg ()); - break; - case 'e': - package_types = get_opt.opt_arg (); - use_package_name = false; - break; - case 'p': - deployment_plan_url = get_opt.opt_arg (); - break; - case 'n': - em_use_naming = true; - break; - case 'k': - em_ior_file = get_opt.opt_arg (); - break; - case 'l': - use_repoman = true; - rm_ior_file = get_opt.opt_arg (); - break; - case 'v': - use_repoman = true; - rm_use_naming = true; - repoman_name_ = get_opt.opt_arg (); - break; - case 'o': - dap_ior_filename = get_opt.opt_arg (); - mode = pl_mode_start; - break; - case 'i': - dap_ior = get_opt.opt_arg (); - mode = pl_mode_stop_by_dam; - break; - case 't': - plan_uuid = get_opt.opt_arg (); - mode = pl_mode_stop_by_uuid; - break; - case 'r': - new_deployment_plan_url = get_opt.opt_arg (); - mode = pl_mode_redeployment; - break; - case 'z': - priority = ACE_OS::atoi (get_opt.opt_arg ()); - break; - case 'h': - default: - usage(argv[0]); - return false; - } - } - - if ((mode != pl_mode_stop_by_dam) && - (mode != pl_mode_stop_by_uuid) && - (package_names == 0) && - (package_types == 0) && - (deployment_plan_url == 0) && - (new_deployment_plan_url == 0)) - { - usage (argv[0]); - return false; - } - - return true; - } - - static ::Deployment::DomainApplicationManager_ptr - read_dap_ior (CORBA::ORB_ptr orb) - { - CORBA::Object_var obj = orb->string_to_object (dap_ior); - return - Deployment::DomainApplicationManager::_narrow (obj.in ()); - } - - static int - write_dap_ior (CORBA::ORB_ptr orb, - ::Deployment::DomainApplicationManager_ptr dap) + namespace Plan_Launcher { - CORBA::String_var ior = orb->object_to_string (dap); - FILE* ior_output_file = ACE_OS::fopen (dap_ior_filename, "w"); - - if (ior_output_file) - { - ACE_OS::fprintf (ior_output_file, "%s", ior.in ()); - ACE_OS::fclose (ior_output_file); - return 0; - } - else - { - ACE_DEBUG ((LM_DEBUG, - "Error in opening file %s to write DAM IOR: %m", - dap_ior_filename)); - return -1; - } - } - - static int + int run_main_implementation (int argc, char *argv[]) { - try { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv); - - if (parse_args (argc, argv) == false) - return -1; - - Plan_Launcher_i * launcher = 0; - - if (do_benchmarking) - { - ACE_NEW_RETURN (launcher, - Plan_Launcher_Benchmark_i, - -1); - } - else - { - ACE_NEW_RETURN (launcher, - Plan_Launcher_i, - -1); - } - - if (!launcher->init (em_use_naming ? 0 : em_ior_file, - orb.in (), - use_repoman, - rm_use_naming, - rm_use_naming ? repoman_name_ : rm_ior_file, - priority, - niterations)) - { - ACE_ERROR ((LM_ERROR, "(%P|%t) Plan_Launcher: Error initializing the EM.\n")); - return -1; - } - - ::Deployment::DomainApplicationManager_var dapp_mgr; - - if (mode == pl_mode_start || mode == pl_mode_interactive) // initial deployment - { - CORBA::String_var uuid; - - if (package_names != 0) - uuid = launcher->launch_plan (deployment_plan_url, - package_names, - use_package_name, - use_repoman); - else - uuid = launcher->launch_plan (deployment_plan_url, - package_types, - use_package_name, - use_repoman); - - if (uuid.in () == 0) - { - ACE_ERROR ((LM_ERROR, "(%P|%t) Plan_Launcher: Error launching plan\n")); - return -1; - } - - ACE_DEBUG ((LM_DEBUG, "Plan_Launcher returned UUID is %s\n", - uuid.in ())); - dapp_mgr = launcher->get_dam (uuid.in ()); - - // Write out DAM ior if requested - if (mode == pl_mode_start) - { - if (write_dap_ior (orb.in (), dapp_mgr.in ()) != 0) - return -1; - } - else // if (pl_mode_interactive) - { - ACE_DEBUG ((LM_DEBUG, - "Press <Enter> to tear down application\n")); - char dummy [256]; - std::cin.getline (dummy, 256); - - // Tear down the assembly - ACE_DEBUG ((LM_DEBUG, - "Plan_Launcher: destroy the application.....\n")); - if (! launcher->teardown_plan (uuid)) - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) CIAO_PlanLauncher:tear down assembly failed: " - "unknown plan uuid.\n")); - } - } - else if (mode == pl_mode_redeployment && new_deployment_plan_url != 0) // do redeployment - { - ACE_DEBUG ((LM_DEBUG, - "Plan_Launcher: reconfigure application assembly.....\n")); - - CORBA::String_var uuid; - - if (package_names != 0) - uuid = launcher->re_launch_plan (new_deployment_plan_url, - package_names, - use_package_name, - use_repoman); - else - uuid = launcher->re_launch_plan (new_deployment_plan_url, - package_types, - use_package_name, - use_repoman); - - if (uuid.in () == 0) - { - ACE_ERROR ((LM_ERROR, "(%P|%t) Plan_Launcher: Error re-launching plan\n")); - return -1; - } - } - else if (mode == pl_mode_stop_by_dam) // tear down by DAM - { - dapp_mgr = read_dap_ior (orb.in ()); - - if (CORBA::is_nil (dapp_mgr.in ())) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) CIAO_PlanLauncher:tear down assembly failed: " - "nil DomainApplicationManager reference\n")); - return -1; - } - - // Tear down the assembly - ACE_DEBUG ((LM_DEBUG, - "Plan_Launcher: destroy the application.....\n")); - launcher->teardown_plan (dapp_mgr.in ()); - } - else if (mode == pl_mode_stop_by_uuid) // tear down by plan_uuid - { - // Tear down the assembly - ACE_DEBUG ((LM_DEBUG, - "Plan_Launcher: destroy the application.....\n")); - if (! launcher->teardown_plan (plan_uuid)) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) CIAO_PlanLauncher:tear down assembly failed: " - "unkown plan uuid.\n")); - } - } - - orb->destroy (); + Plan_Launcher_Impl pl (argc, argv); + pl.execute(); } - catch (const Plan_Launcher_i::Deployment_Failure&) + catch (const Plan_Launcher_Impl::Deployment_Failure& e) { - ACE_ERROR ((LM_ERROR, - "Deployment failed. Plan_Launcher exiting.\n")); + DANCE_ERROR ( (LM_ERROR, "[%M] PlanLauncher error : %s.\n", e.error_.c_str())); } catch (const CORBA::Exception& ex) { - ex._tao_print_exception ("(%P|%t) Plan_Launcher: "); - + ex._tao_print_exception ("Plan_Launcher.cpp::run_main_implementation "); return -1; } catch (...) { - ACE_ERROR ((LM_ERROR, - "(%P|%t) Plan_Launcher: Unknown exception.\n")); + DANCE_ERROR ( (LM_ERROR, "[%M] Plan_Launcher.cpp::run_main_implementation Unknown exception.\n")); return -1; } - return 0; } - } -} -using namespace CIAO::Plan_Launcher; -int -ACE_TMAIN (int argc, - ACE_TCHAR *argv[]) -{ - return run_main_implementation (argc, argv); -} + } // Plan_Launcher +} // DAnCE + + + + diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.h new file mode 100644 index 00000000000..b2e7bfee44c --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.h @@ -0,0 +1,26 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Plan_Launcher.h + * + * $Id$ + * + * @Brief Run PlanLauncher + * + * @author Vinzenz Tornow <vt@prismtech.com> + */ +//============================================================================= + +#ifndef PLAN_LAUNCHER_H +#define PLAN_LAUNCHER_H + +namespace DAnCE + { + namespace Plan_Launcher + { + int run_main_implementation (int, char*[]); + } +} + +#endif /* PLAN_LAUNCHER_H */ diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc index 371672bdeb0..1863d60c249 100644 --- a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc @@ -1,46 +1,47 @@ // -*- MPC -*- // $Id$ -project(Plan_Launcher_Impl) : ciao_servant_dnc \ - , ciao_config_handlers \ - , ciao_executionmanager_stub \ - , ciao_plan_generator \ - , rtcorba \ - , dance_utils \ - , ace_output \ -{ - sharedname = Plan_Launcher_Impl - dynamicflags = PLAN_LAUNCHER_IMPL_BUILD_DLL +project(Plan_Launcher_Base) : dance_lib, taolib, tao_output, naming, dance_executionmanager_stub { + sharedname = DAnCE_Plan_Launcher_Base + dynamicflags = PLAN_LAUNCHER_BASE_IMPL_BUILD_DLL DANCE_PLAN_LAUNCHER_BASE_MODULE_BUILD_DLL Source_Files { - ../ExecutionManager/DAM_Map.cpp - Plan_Launcher_Impl.cpp - Plan_Launcher_Benchmark_Impl.cpp + Plan_Launcher_Base_Impl.cpp + Plan_Launcher_Base_Module.cpp } Header_Files { - ../ExecutionManager/DAM_Map.h - Plan_Launcher_Impl.h - Plan_Launcher_Impl_Export.h + Plan_Launcher_Base_Impl.h + Plan_Launcher_Base_Module.h + Plan_Launcher_Base_Impl_Export.h + Plan_Launcher_Base_Module_Export.h } } -project(Plan_Launcher) : ciao_server_dnc \ - , ciao_config_handlers \ - , ciao_executionmanager_stub \ - , ciao_plan_generator \ - , ciaoexe \ - , rtcorba \ - , dance_utils \ -{ - exename = plan_launcher - after += Plan_Launcher_Impl - libs += Plan_Launcher_Impl - +project(Plan_Launcher) : dance_lib, taolib, tao_output, xerces, naming, dance_executionmanager_stub, ciao_config_handlers { + sharedname = DAnCE_Plan_Launcher + dynamicflags = PLAN_LAUNCHER_IMPL_BUILD_DLL DANCE_PLAN_LAUNCHER_MODULE_BUILD_DLL + after += Plan_Launcher_Base + libs += DAnCE_Plan_Launcher_Base Source_Files { - Plan_Launcher.cpp + Plan_Launcher_Impl.cpp + Plan_Launcher_Module.cpp } Header_Files { + Plan_Launcher_Impl.h + Plan_Launcher_Module.h + Plan_Launcher_Impl_Export.h + Plan_Launcher_Module_Export.h } } + +project(Plan_Launcher_Exec) : dance_exe, xerces, naming, dance_executionmanager_stub, ciao_config_handlers { + after += Plan_Launcher + libs += DAnCE_Plan_Launcher DAnCE_Plan_Launcher_Base + exename = dance_plan_launcher + + Source_Files { + Plan_Launcher_Exec.cpp + } +}
\ No newline at end of file diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.cpp b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.cpp new file mode 100644 index 00000000000..d1f6d0ce32b --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.cpp @@ -0,0 +1,816 @@ +// $Id$ +#include "Plan_Launcher_Base_Impl.h" +#include "orbsvcs/CosNamingC.h" +#include "tao/ORB_Core.h" +#include "ace/Sched_Params.h" +#include "ccm/CCM_ObjectC.h" +#include "ace/Env_Value_T.h" +#include "ace/OS.h" +#include "ace/Get_Opt.h" +#include "DAnCE/Logger/Log_Macros.h" + +namespace DAnCE +{ +namespace Plan_Launcher +{ + +Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl(CORBA::ORB_ptr orb, int argc, + ACE_TCHAR *argv[]) : + orb_(CORBA::is_nil (orb) ? 0 : CORBA::ORB::_duplicate (orb)), + em_(DAnCE::ExecutionManagerDaemon::_nil()), em_ior_("file://em.ior") //default + , mode_(0x0) +{ + DANCE_TRACE ("Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl"); + if (CORBA::is_nil (this->orb_)) + { + DANCE_DEBUG ((LM_INFO, DLINFO "Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "Creating internal ORB.\n")); + this->orb_ = CORBA::ORB_init (argc, argv); + } + this->parse_args(argc, argv); + + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_i::init - em_ior = \"%s\"\n" + , is_empty (this->em_ior_) ? "NULL" : this->em_ior_.c_str())); + + if (this->mode_ & (MODE_START_PLAN | MODE_STOP_PLAN)) + { + CORBA::Object_var obj; + if (this->em_ior_.length() > 0) + { + obj = this->orb_->string_to_object(this->em_ior_.c_str()); + if (CORBA::is_nil(obj)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "Failed to retrieve EM object from \"%s\"\n", this->em_ior_.c_str())); + throw Deployment_Failure ("Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "failed to retrieve EM object"); + } + } + try + { + this->em_ = ::DAnCE::ExecutionManagerDaemon::_narrow (obj.in()); + } + catch(CORBA::Exception&) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "Failed to retrieve EM object from \"%s\"\n", this->em_ior_.c_str())); + throw Deployment_Failure ("Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "failed to retrieve EM object"); + } + + if (CORBA::is_nil (this->em_.in())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "failed to get an execution manager.\n")); + throw Deployment_Failure ("Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "failed to get an execution manager"); + } + } + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - " + "Obtained Execution Manager ref \n")); +} + +Plan_Launcher_Base_Impl::~Plan_Launcher_Base_Impl() +{ +} + +void Plan_Launcher_Base_Impl::execute() +{ + DANCE_TRACE ("Plan_Launcher_Base_Impl::execute - "); + + if (this->mode_ & MODE_START_PLAN) + { + size_t sz = this->cdr_plan_urls_.size(); + for (size_t i= 0; i < sz; ++i) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_Base_Impl::execute - " + "launching plan \"%s\"...\n", this->cdr_plan_urls_[i].c_str())); + ::Deployment::DeploymentPlan_var plan = this->read_cdr_plan_file(this->cdr_plan_urls_[i].c_str()); + try + { + CORBA::String_var uuid = this->launch_plan (plan.in()); + if (0 == uuid.in ()) + { + throw Deployment_Failure ("Plan_Launcher_Base_Impl::execute - " + "Error launching plan\n"); + } + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::execute - " + "returned plan UUID is \"%s\"\n", uuid.in ())); + } + catch (...) + { + this->teardown_plan (plan->UUID.in()); + throw; + } + } + } + else if (this->mode_ & MODE_STOP_PLAN) + { + this->stop_plan(); + } +} + +const char * +Plan_Launcher_Base_Impl::launch_plan(const ::Deployment::DeploymentPlan &plan) +{ + DANCE_TRACE ("Plan_Launcher_Base_Impl::launch_plan"); + + try + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - Starting...\n")); + if (CORBA::is_nil (this->em_.in ())) + { + DANCE_ERROR ( (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher_Base_Impl::launch_plan - ") + ACE_TEXT ("launch_plan called witn an uninitialized EM.\n"))); + return 0; + } + + DANCE_DEBUG ( (LM_DEBUG, DLINFO + ACE_TEXT ("Plan_Launcher_Base_Impl::launch_plan - ") + ACE_TEXT ("about to call this->em_->preparePlan\n"))); + + ::Deployment::DomainApplicationManager_var dam; + try + { + dam = this->em_->preparePlan (plan, 0); + } + catch(...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "An exception was thrown during EM->preparePlan.\n")); + throw; + } + + DANCE_DEBUG ( (LM_DEBUG, DLINFO + ACE_TEXT ("Plan_Launcher_Base_Impl::launch_plan - ") + ACE_TEXT ("after to call this->em_->preparePlan\n"))); + + if (CORBA::is_nil (dam.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "CIAO_PlanLauncher:preparePlan call failed: " + "nil DomainApplicationManager reference\n")); + return 0; + } + else + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "DAM was received from preparePlan.\n")); + } + + this->write_dam_ior (dam.in()); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "Obtained DAM ref \n")); + + ::Deployment::Properties_var properties; + ACE_NEW_RETURN (properties, + Deployment::Properties, + 0); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "before startLaunch...\n")); + + ::Deployment::Connections_var conns; + Deployment::Application_var da; + try + { + da = dam->startLaunch (properties.in (), conns.out()); + } + catch(...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "An exception was thrown during DAM->startLaunch.\n")); + throw; + } + //Deployment::DomainApplication_var da = Deployment::DomainApplication::_narrow(obj) + if (CORBA::is_nil (da.in())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "CIAO_PlanLauncher:startLaunch call failed: " + "nil DomainApplication reference\n")); + return 0; + } + else + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "DomainApplication was received from startLaunch\n")); + } + //this is temporal workaround while cdmw checks object type in connect call + /* + DANCE_DEBUG ((LM_DEBUG, DLINFO "Press any key after deployment on other node finished\n")); + getchar(); + */ + this->create_external_connections (plan, conns.inout()); + + // Call finish Launch to complete the connections + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "before finishLaunch\n")); + try + { + da->finishLaunch (conns.in(), false); // is_ReDAC by default is <false> + } + catch(...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "An exception was thrown during DA->finishLaunch.\n")); + throw; + } + + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "after finishLaunch\n")); + + // Call start to activate components + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "before start activating components...\n")); + + try + { + da->start (); + } + catch(...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::launch_plan - " + "An exception was thrown during DA->start.\n")); + throw; + } + + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::launch_plan - [success]\n")); + DANCE_DEBUG ( (LM_DEBUG, DLINFO + ACE_TEXT ("[%M] Plan_Launcher_Base_Impl::launch_plan - ") + ACE_TEXT ("Application Deployed successfully\n"))); + + } + catch (const Deployment::ResourceNotAvailable& ex) + { + char buf[1024]; + ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - EXCEPTION: ResourceNotAvaiable exception caught: %s,\n" + "Type: %s\n" + "Property: %s\n" + "Element: %s\n" + "Resource: %s\n", + ex.name.in (), + ex.resourceType.in (), + ex.propertyName.in (), + ex.elementName.in (), + ex.resourceName.in ()); + DANCE_ERROR ((LM_ERROR, DLINFO "%s", buf)); + throw Deployment_Failure (buf); + } + catch (const Deployment::StartError& ex) + { + char buf[1024]; + ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - EXCEPTION: StartError exception caught: %s, %s\n", + ex.name.in (), + ex.reason.in ()); + DANCE_ERROR ((LM_ERROR, DLINFO "%s", buf)); + throw Deployment_Failure (buf); + } + catch (const Deployment::InvalidProperty& ex) + { + char buf[1024]; + ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - EXCEPTION: InvalidProperty exception caught: %s, %s\n", + ex.name.in (), + ex.reason.in ()); + DANCE_ERROR ((LM_ERROR, DLINFO "%s", buf)); + throw Deployment_Failure (buf); + } + catch (const Deployment::InvalidConnection& ex) + { + char buf[1024]; + ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - EXCEPTION: InvalidConnection exception caught: %s, %s\n", + ex.name.in (), + ex.reason.in ()); + DANCE_ERROR ((LM_ERROR, DLINFO "%s", buf)); + throw Deployment_Failure (buf); + } + catch (const CORBA::Exception& ex) + { + char buf[1024]; + ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - CORBA EXCEPTION: %s\n", + ex._info().fast_rep()); + DANCE_ERROR ((LM_ERROR, DLINFO "%s", buf)); + throw Deployment_Failure (buf); + } + catch (...) + { + char buf[1024]; + ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - EXCEPTION: non-CORBA exception\n"); + DANCE_ERROR ((LM_ERROR, DLINFO "%s", buf)); + throw Deployment_Failure (buf); + } + + return CORBA::string_dup (plan.UUID.in()); +} + +bool Plan_Launcher_Base_Impl::teardown_plan(const char *uuid) +{ + DANCE_TRACE ("Plan_Launcher_Base_Impl::teardown_plan"); + + try + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::teardown_plan - looking for uuid=\"%s\"\n", uuid)); + ::Deployment::DomainApplicationManagers_var mgrs = this->em_->getManagers(); + ::Deployment::DomainApplicationManager_var dapp_mgr; + for (size_t i = 0; i < mgrs->length(); ++i) + { + ACE_CString s = (*mgrs) [i]->getPlan()->UUID.in(); + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::teardown_plan - " + "comparing with existing uuid=\"%s\"\n", s.c_str())); + if (s == uuid) + { + dapp_mgr = ::Deployment::DomainApplicationManager::_duplicate ( (*mgrs) [i].in()); + break; + } + } + + if (!::CORBA::is_nil (dapp_mgr.in())) + { + this->teardown_plan (dapp_mgr.in()); + } + else + { + throw Deployment_Failure ("Failed to find DAM by UUID"); + } + } + catch (const CORBA::Exception&) + { + // @todo the destroy_dam_by_plan could give a stoperror exception + // we should handle + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::teardown_plan - " + "Unable to find DomainApplicationManager " + "for plan with uuid: %s\n", uuid)); + return false; + } + + return true; +} + +void +Plan_Launcher_Base_Impl::teardown_plan(::Deployment::DomainApplicationManager_ptr dam) +{ + DANCE_DEBUG ((LM_DEBUG, DLINFO + "Plan_Launcher_Base_Impl::teardown_plan - destroy the application.....\n")); + ::Deployment::Applications_var apps = dam->getApplications(); + if (0 == apps->length()) + { + DANCE_DEBUG((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::teardown_plan - " + "DAM has no application.\n")); + } + for (size_t i = 0; i < apps->length(); ++i) + { + dam->destroyApplication(apps[i]); + } + this->destroy_dam(dam); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::teardown_plan - [success]\n")); +} + +void Plan_Launcher_Base_Impl::destroy_dam( + ::Deployment::DomainApplicationManager_ptr dam) +{ + DANCE_DEBUG ((LM_DEBUG, DLINFO + "Plan_Launcher_Base_Impl::destroy_dam - destroy the manager.....\n")); + this->em_->destroyManager(dam); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "Plan_Launcher_Base_Impl::destroy_dam - [success]\n")); +} + +void Plan_Launcher_Base_Impl::usage(const ACE_TCHAR* program) +{ + if (0 == program) + { + DANCE_ERROR ( (LM_ERROR, ACE_TEXT ("[(%P|%t) Executor] Usage: %s <options>\n"), program)); + } + + DANCE_ERROR ( (LM_ERROR, ACE_TEXT ("Options : \n") + ACE_TEXT ("-k|--em-ior <EXECUTION_MANAGER_IOR>") + ACE_TEXT (" : Default file://em.ior\n") + ACE_TEXT ("-d|--read-cdr-plan <CDR_DEPLOYMENT_PLAN_URL>\n") + ACE_TEXT ("-w|--write-cdr-plan <CDR_DEPLOYMENT_PLAN_URL>\n") + ACE_TEXT ("-t|--plan-uuid <PLAN_UUID>\n") + // ACE_TEXT ("-a|dam-ior <DOMAIN_APPLICATION_MANAGER_IOR>\n") + // ACE_TEXT ("-n|--node-mgr : Use naming service to fetch EM\n") + ACE_TEXT ("-q|--stop-plan : Stop the plan\n") + ACE_TEXT ("-h|--help : Show this usage information\n") + ACE_TEXT ("-x|--read-plan <XML_DEPLOYMENT_PLAN_URL>"))); +} + +void Plan_Launcher_Base_Impl::parse_args(int argc, ACE_TCHAR *argv[]) +{ + DANCE_DEBUG ((LM_TRACE, DLINFO "PL options : \"")); + for (int i = 0; i < argc; ++i) + { + DANCE_DEBUG ( (LM_TRACE, " %s", argv[i])); + } + DANCE_DEBUG ( (LM_TRACE, "\"\n")); + + ACE_Get_Opt get_opt(argc, argv, + ACE_TEXT ("k:d:w:t:a:qx:h"), 0); + get_opt.long_option("em-ior", 'k', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option("read-cdr-plan", 'd', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option("write-cdr-plan", 'w', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option("plan-uuid", 't', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option("dam-ior", 'a', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option("stop-plan", 'q', ACE_Get_Opt::NO_ARG); + get_opt.long_option("read-plan", 'x', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option("help", 'h', ACE_Get_Opt::NO_ARG); + + int c; + ACE_CString s; + while ( (c = get_opt ()) != EOF) + { + switch (c) + { + case 'k': + this->em_ior_ = expand_env_vars (get_opt.opt_arg()); + break; + case 'd': + s = expand_env_vars (get_opt.opt_arg()); + // trim leading file:// + if (0 < s.length()) + { + ssize_t pos = s.find("file://"); + if (0 == pos) + { + s = s.substring(7); + } + this->cdr_plan_urls_.push_back(s); + } + break; + case 'w': + if (0 < this->cdr_dest_url_.length()) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Ambiguity: more then one --write-cdr-plan option.\n")); + throw Deployment_Failure("Ambiguity: more then one --write-cdr-plan option."); + } + this->cdr_dest_url_ = expand_env_vars (get_opt.opt_arg()); + this->mode_ |= MODE_WRITE_CDR; + // trim leading file:// + if (0 < this->cdr_dest_url_.length()) + { + ssize_t pos = this->cdr_dest_url_.find("file://"); + if (0 == pos) + { + this->cdr_dest_url_= this->cdr_dest_url_.substring(7); + } + } + break; + case 't': + this->plan_uuid_ = get_opt.opt_arg(); + break; + case 'a': + this->dam_ior_ = expand_env_vars (get_opt.opt_arg()); + DANCE_DEBUG((LM_TRACE, "[%M] Parsed DAM IOR : %s\n", this->dam_ior_.c_str())); + break; + case 'q': + this->mode_ |= MODE_STOP_PLAN; + break; + case 'x': + this->xml_plan_urls_.push_back(expand_env_vars (get_opt.opt_arg())); + break; + case 'h': + default: + usage (argv[0]); + throw Deployment_Failure ("parse_args : invalid arguments"); + } + } + if (0 == (this->mode_ & (MODE_STOP_PLAN | MODE_WRITE_CDR))) + { + this->mode_ |= MODE_START_PLAN; + } + // Post-check + this->check_mode_consistentness(); +} + +void Plan_Launcher_Base_Impl::write_dam_ior( + ::Deployment::DomainApplicationManager_ptr dam) +{ + if (is_empty (this->dam_ior_)) + return; + + CORBA::String_var ior = this->orb_->object_to_string(dam); + + FILE* ior_output_file = ACE_OS::fopen (this->dam_ior_.c_str(), "w"); + + if (ior_output_file) + { + ACE_OS::fprintf (ior_output_file, "%s", ior.in()); + ACE_OS::fclose (ior_output_file); + } + else + { + DANCE_ERROR ((LM_ERROR, DLINFO "PlanLauncher.cpp::write_dap_ior - Error in opening file %s to write DAM IOR: %m", + this->dam_ior_.c_str())); + throw Deployment_Failure (ACE_CString ("write_dap_ior - Error in opening file %s to write DAM IOR: %m") + + this->dam_ior_); + } +} + +void +Plan_Launcher_Base_Impl::stop_plan() +{ + bool stopped = false; + if (!is_empty (this->plan_uuid_)) + { + stopped = true; + DANCE_DEBUG((LM_TRACE, DLINFO "Plan_Launcher_Base_Impl::stop_plan - " + "Stopping plan \"%s\"\n", this->plan_uuid_.c_str())); + + if (!this->teardown_plan(this->plan_uuid_.c_str())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::stop_plan - " + "tear down assembly failed: unknown plan uuid.\n")); + } + } + + if (!is_empty (this->dam_ior_)) + { + stopped = true; + DANCE_DEBUG((LM_TRACE, DLINFO "Plan_Launcher_Base_Impl::stop_plan - " + "Stopping plan by DAM IOR.\n")); + CORBA::Object_var + obj = this->orb_->string_to_object(this->dam_ior_.c_str()); + if (CORBA::is_nil (obj.in ())) + { + DANCE_ERROR ((LM_ERROR, DLINFO + "Plan_Launcher_Base_Impl::stop_plan - " + "tear down assembly failed: DAM IOR is invalid.\n")); + } + else + { + Deployment::DomainApplicationManager_var + dam = Deployment::DomainApplicationManager::_narrow (obj.in()); + this->teardown_plan(dam.in()); + } + } + + if (0 < this->cdr_plan_urls_.size()) + { + stopped = true; + size_t sz = this->cdr_plan_urls_.size(); + for (size_t i = 0; i < sz; ++i) + { + DANCE_DEBUG((LM_TRACE, DLINFO "Plan_Launcher_Base_Impl::stop_plan - " + "Stopping plan by plan file : %s\n", this->cdr_plan_urls_[i].c_str())); + ::Deployment::DeploymentPlan_var plan = this->read_cdr_plan_file(this->cdr_plan_urls_[i].c_str()); + if (!this->teardown_plan(plan->UUID.in())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::stop_plan - " + "tear down assembly failed: unknown plan uuid.\n")); + } + } + } + + if (!stopped && 0 == this->xml_plan_urls_.size()) + { + DANCE_DEBUG((LM_TRACE, DLINFO "Plan_Launcher_Base_Impl::stop_plan - " + "Stopping plan all running plans.\n")); + ::Deployment::DomainApplicationManagers_var + mgrs = this->em_->getManagers(); + ::Deployment::DomainApplicationManager_var dapp_mgr; + for (size_t i = 0; i < mgrs->length(); ++i) + { + this->teardown_plan((*mgrs) [i]); + } + } +} + +void Plan_Launcher_Base_Impl::create_external_connections( + const ::Deployment::DeploymentPlan &plan, Deployment::Connections& conn) +{ + DANCE_DEBUG ((LM_DEBUG, DLINFO "create_external_connections - start\n")); + /* CORBA::Object_var obj = this->orb_->resolve_initial_references("NameService"); + CosNaming::NamingContext_var naming = CosNaming::NamingContext::_narrow(obj.in()); + CosNaming::BindingList_var bl; + CosNaming::BindingIterator_var bi; + //naming->list(10L, bl.out(), bi.out()); + CosNaming::Name name(1); + name.length(3); + name[0].id = CORBA::string_dup("CDMW");//CORBA::string_dup("CcmDance1Test"); + name[1].id = CORBA::string_dup ("SERVICES"); + name[2].id = CORBA::string_dup("ASSEMBLYANDDEPLOYMENT"); + obj = naming->resolve(name); + DANCE_DEBUG((LM_DEBUG, "[%M] create_external_connections - After resolve\n")); + CosNaming::NamingContext_var CcmDance1Test = CosNaming::NamingContext::_narrow(obj.in()); + CcmDance1Test->list(10L, bl.out(), bi.out()); + bool exit = false; + while (!exit) + { + char buf[1024]; + ACE_OS::sprintf(buf, "create_external_connections - naming size is %u\n", bl->length()); + DANCE_DEBUG((LM_DEBUG, buf)); + for ( size_t i = 0; i< bl->length(); i++ ) + { + for ( size_t j = 0; j < (*bl)[i].binding_name.length(); j++ ) + { + ACE_OS::sprintf(buf, "create_external_connections - Binding name %s, binding kind %s, binding type %i\n" + , (*bl)[i].binding_name[j].id.in() + , (*bl)[i].binding_name[j].kind.in() + , (*bl)[i].binding_type); + DANCE_DEBUG((LM_DEBUG, buf)); + } + } + if(!bi->next_n(10L, bl.out())) + { + exit = true; + } + } + */ + for (unsigned int i = 0; i < plan.connection.length(); i++) + { + if (plan.connection[i].externalReference.length() > 0 + && plan.connection[i].externalReference[0].provider) + { + DANCE_DEBUG ( (LM_DEBUG, + "Plan_Launcher_i::create_external_connections - create connection %C from IOR %C\n", + plan.connection[i].name.in(), + plan.connection[i].externalReference[0].location.in())); + unsigned int indx = conn.length(); + conn.length(indx + 1); + conn[indx].name= CORBA::string_dup (plan.connection[i].name.in()); + conn[indx].endpoint.length(1L); + CORBA::Object_ptr + obj = this->orb_->string_to_object(plan.connection[i].externalReference[0].location.in()); + if (!CORBA::is_nil (obj)) + { + //Components::CCMObject_ptr ccmobj = Components::CCMObject::_narrow (obj); + conn[indx].endpoint[0] = obj; + } + else + { + DANCE_DEBUG ( (LM_DEBUG, + "Plan_Launcher_i::create_external_connections - can't create object for IOR %C\n", + plan.connection[i].externalReference[0].location.in())); + throw 0; + } + } + } +} + +Deployment::DeploymentPlan*Plan_Launcher_Base_Impl::read_cdr_plan_file( + const char *cdr_plan_uri) +{ + Deployment::DeploymentPlan* res = 0; + try + { + FILE* file = ACE_OS::fopen (cdr_plan_uri, "r"); + if (0 == file) + { + ACE_CString s = "read_cdr_plan_file : failed to open file \""; + s += cdr_plan_uri; + s += "\""; + throw Deployment_Failure (s.c_str()); + } + + size_t buf_size; + ACE_OS::fread (&buf_size, sizeof (buf_size), 1, file); + + char * buf = new char[buf_size]; + ACE_OS::fread (buf, 1, buf_size, file); + + { + TAO_InputCDR cdr (buf, buf_size); + ACE_NEW_THROW_EX (res, + Deployment::DeploymentPlan (), + CORBA::NO_MEMORY ()); + cdr >> *res; + } + delete [] buf; + ACE_OS::fclose (file); + } + catch(...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Failed to read CDR plan file.\n")); + throw Deployment_Failure("Failed to read CDR plan file."); + } + return res; +} + +void +Plan_Launcher_Base_Impl::write_cdr_plan_file(const char * filename, + const Deployment::DeploymentPlan & plan) +{ + try + { + TAO_OutputCDR cdr; + cdr << plan; + size_t buf_size = cdr.total_length(); + FILE * file = ACE_OS::fopen (filename, "w"); + if (0 == file) + { + throw Deployment_Failure ("write_cdr_plan_file : failed to open file."); + } + ACE_OS::fwrite (&buf_size, sizeof (buf_size), 1, file); + for (const ACE_Message_Block *i = cdr.begin (); + i != 0; + i = i->cont ()) + { + ACE_OS::fwrite (i->rd_ptr (), 1, i->length (), file); + } + ACE_OS::fclose (file); + } + catch(...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Base_Impl::write_cdr_plan_file - " + "Failed to write CDR plan file.\n")); + throw Deployment_Failure("Failed to write CDR plan file."); + } +} + +void +Plan_Launcher_Base_Impl::check_mode_consistentness() +{ + if (this->mode_ & MODE_START_PLAN) + { + if (0 == this->cdr_plan_urls_.size() && 0 == this->xml_plan_urls_.size()) + { + throw Deployment_Failure ("check_mode_consistentness : no plan to start"); + } + } + else if (this->mode_ & MODE_STOP_PLAN) + { + // if (is_empty (this->cdr_plan_url_) + // && is_empty (this->xml_plan_url_) + // && is_empty (this->plan_uuid_) + // && is_empty (this->dam_ior_)) + // { + // throw Deployment_Failure ("check_mode_consistentness : no plan to stop"); + // } + } + else if (this->mode_ & MODE_WRITE_CDR) + { + if (is_empty (this->cdr_dest_url_)) + { + throw Deployment_Failure ("check_mode_consistentness : no cdr url for writing plan."); + } + if (1 != this->xml_plan_urls_.size()) + { + throw Deployment_Failure ("check_mode_consistentness : not one source url for writing plan."); + } + } + else + { + throw Deployment_Failure ("check_mode_consistentness : no action specified"); + } + } + +ACE_CString +Plan_Launcher_Base_Impl::expand_env_vars (const char * s) + { + ACE_CString src = s; + ACE_CString res; + size_t pos_done = 0; + while (pos_done < (size_t) src.length()) + { + size_t pos_start = src.find ('$', pos_done); + if (ACE_CString::npos == pos_start) + { + res += src.substring (pos_done); + pos_done = src.length(); + } + else // take the substring before '$' and append value + + { + if (pos_start > pos_done) + { + res += src.substring (pos_done, pos_start - pos_done); + pos_done = pos_start; + } + + size_t pos_end = src.length(); + + size_t p; + + p = src.find (' ', pos_start + 1); + if (ACE_CString::npos != p && pos_end > p) pos_end = p; + + p = src.find ('/', pos_start + 1); + if (ACE_CString::npos != p && pos_end > p) pos_end = p; + + p = src.find ('\\', pos_start + 1); + if (ACE_CString::npos != p && pos_end > p) pos_end = p; + + p = src.find ('$', pos_start + 1); + if (ACE_CString::npos != p && pos_end > p) pos_end = p; + + if (pos_end - pos_start > 1) + { + ACE_Env_Value<const char*> val (src.substring (pos_start + 1, pos_end - pos_start - 1).c_str(), 0); + res += val; + pos_done = pos_end; + } + else + { + DANCE_DEBUG ((LM_WARNING, DLINFO "Plan_Launcher_Base_Impl::expand_env_vars - " + "Envvar can not be parsed out at %i in \"%s\"", + pos_start, + src.c_str())); + } + } + } + return res; + } + +} // Plan_Launcher +} // DAnCE diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.h new file mode 100644 index 00000000000..5e6f5e60cc6 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.h @@ -0,0 +1,114 @@ +/** + * $Id$ + * @file Plan_Launcher_Base_Impl.h + * @author Will Otte <wotte@dre.vanderbilt.edu> + * + * Contains the Plan_Launcher_i class, which can be used by + * applications to launch component assemblies. + */ +#ifndef PLAN_LAUNCHER_BASE_IMPL_H +#define PLAN_LAUNCHER_BASE_IMPL_H + +#include "Plan_Launcher_Base_Impl_Export.h" +#include "ciao/CIAO_common.h" +#include "DAnCE/Interfaces/ExecutionManagerDaemonC.h" +#include "DAnCE/Deployment/Deployment_ConnectionC.h" +#include "ace/Map_Manager.h" +#include "DAnCE/Deployment/Deployment_DeploymentPlanC.h" +#include "ace/Vector_T.h" + +namespace DAnCE +{ +namespace Plan_Launcher +{ + +/** + * @class Plan_Launcher_Impl + * @brief This class launches and manages deployment plans. + */ +class Plan_Launcher_Base_Impl_Export Plan_Launcher_Base_Impl +{ +public: + class Deployment_Failure + { +public: + Deployment_Failure(const ACE_CString &error) : + error_(error) + { + } + ; + ACE_CString error_; + }; + + Plan_Launcher_Base_Impl(CORBA::ORB_ptr orb, int argc, ACE_TCHAR *argv[]); + + virtual ~Plan_Launcher_Base_Impl(); + + void execute(); + + static Deployment::DeploymentPlan* read_cdr_plan_file( + const char *deployment_plan_uri); + static void write_cdr_plan_file(const char * filename, + const Deployment::DeploymentPlan & plan); + +protected: + + /** + * @brief Launch a plan, given an IDL deployment plan + * @param plan A valid IDL deployment plan + * @returns a string containing the UUID of the plan. Null indicates failure. + */ + virtual const char * launch_plan(const ::Deployment::DeploymentPlan &plan); + + /// Returns the DAM associated with a given plan URI + ::Deployment::DomainApplicationManager_ptr get_dam(const char *uuid); + + /// Tears down a plan given the UUID + bool teardown_plan(const char *uuid); + + void teardown_plan(::Deployment::DomainApplicationManager_ptr dam); + + void destroy_dam(::Deployment::DomainApplicationManager_ptr dam); + + virtual void stop_plan(); + void usage(const ACE_TCHAR* program = 0); + void parse_args(int argc, ACE_TCHAR *argv[]); + + static bool is_empty(const ACE_CString & s) + { + return 0 == s.length(); + } + ; + void write_dam_ior(::Deployment::DomainApplicationManager_ptr dam); + + void create_external_connections(const ::Deployment::DeploymentPlan &plan, + Deployment::Connections& conn); + + virtual void check_mode_consistentness(); + static ACE_CString expand_env_vars(const char * src); + + /// Cached ORB pointer + CORBA::ORB_var orb_; + /// Object reference of the ExecutionManager + ::DAnCE::ExecutionManagerDaemon_var em_; + + ACE_Vector<ACE_CString> cdr_plan_urls_; + ACE_CString plan_uuid_; + ACE_CString em_ior_; + ACE_CString dam_ior_; + ACE_Vector<ACE_CString> xml_plan_urls_; + ACE_CString cdr_dest_url_; + + unsigned long mode_; + static const unsigned long MODE_START_PLAN = 0x0001; + static const unsigned long MODE_STOP_PLAN = 0x0002; + static const unsigned long MODE_USE_NAMING = 0x0004; + static const unsigned long MODE_WRITE_CDR = 0x0008; + +}; // class Plan_Launcher_Impl + +} // Plan_Launcher +} // DAnCE + + +#endif /* PLAN_LAUNCHER_BASE_IMPL_H */ diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl_Export.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl_Export.h new file mode 100644 index 00000000000..5dcb51be117 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl Plan_Launcher_Base_Impl +// ------------------------------ +#ifndef PLAN_LAUNCHER_BASE_IMPL_EXPORT_H +#define PLAN_LAUNCHER_BASE_IMPL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (PLAN_LAUNCHER_BASE_IMPL_HAS_DLL) +# define PLAN_LAUNCHER_BASE_IMPL_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && PLAN_LAUNCHER_BASE_IMPL_HAS_DLL */ + +#if !defined (PLAN_LAUNCHER_BASE_IMPL_HAS_DLL) +# define PLAN_LAUNCHER_BASE_IMPL_HAS_DLL 1 +#endif /* ! PLAN_LAUNCHER_BASE_IMPL_HAS_DLL */ + +#if defined (PLAN_LAUNCHER_BASE_IMPL_HAS_DLL) && (PLAN_LAUNCHER_BASE_IMPL_HAS_DLL == 1) +# if defined (PLAN_LAUNCHER_BASE_IMPL_BUILD_DLL) +# define Plan_Launcher_Base_Impl_Export ACE_Proper_Export_Flag +# define PLAN_LAUNCHER_BASE_IMPL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PLAN_LAUNCHER_BASE_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PLAN_LAUNCHER_BASE_IMPL_BUILD_DLL */ +# define Plan_Launcher_Base_Impl_Export ACE_Proper_Import_Flag +# define PLAN_LAUNCHER_BASE_IMPL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PLAN_LAUNCHER_BASE_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PLAN_LAUNCHER_BASE_IMPL_BUILD_DLL */ +#else /* PLAN_LAUNCHER_BASE_IMPL_HAS_DLL == 1 */ +# define Plan_Launcher_Base_Impl_Export +# define PLAN_LAUNCHER_BASE_IMPL_SINGLETON_DECLARATION(T) +# define PLAN_LAUNCHER_BASE_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PLAN_LAUNCHER_BASE_IMPL_HAS_DLL == 1 */ + +// Set PLAN_LAUNCHER_BASE_IMPL_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PLAN_LAUNCHER_BASE_IMPL_NTRACE) +# if (ACE_NTRACE == 1) +# define PLAN_LAUNCHER_BASE_IMPL_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PLAN_LAUNCHER_BASE_IMPL_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PLAN_LAUNCHER_BASE_IMPL_NTRACE */ + +#if (PLAN_LAUNCHER_BASE_IMPL_NTRACE == 1) +# define PLAN_LAUNCHER_BASE_IMPL_TRACE(X) +#else /* (PLAN_LAUNCHER_BASE_IMPL_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PLAN_LAUNCHER_BASE_IMPL_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PLAN_LAUNCHER_BASE_IMPL_NTRACE == 1) */ + +#endif /* PLAN_LAUNCHER_BASE_IMPL_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.cpp b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.cpp new file mode 100644 index 00000000000..65feab0df60 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.cpp @@ -0,0 +1,47 @@ +// -*- C++ -*- +// $Id$ + +#include "Plan_Launcher_Base_Module.h" +#include "tao/TAO_Singleton_Manager.h" +#include "tao/StringSeqC.h" +#include "ace/Get_Opt.h" +#include "Plan_Launcher_Base_Impl.h" +#include "DAnCE/Logger/Log_Macros.h" + +ACE_RCSID (DAnCE, + DAnCE_Plan_Launcher_Base_Module, + "$Id$") + +using namespace DAnCE::Plan_Launcher; + +DAnCE_Plan_Launcher_Base_Module::DAnCE_Plan_Launcher_Base_Module (void) +{ +} + +CORBA::Object_ptr +DAnCE_Plan_Launcher_Base_Module::create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv[]) +{ + try + { + Plan_Launcher_Base_Impl pl (orb, argc, argv); + pl.execute(); + } + catch (const Plan_Launcher_Base_Impl::Deployment_Failure& e) + { + DANCE_ERROR ( (LM_ERROR, "[%M] PlanLauncher error : %s.\n", e.error_.c_str())); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Plan_Launcher_Base_Module.cpp::run_main_implementation "); + } + catch (...) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Plan_Launcher_Base_Module.cpp::run_main_implementation Unknown exception.\n")); + } + return CORBA::Object::_nil (); +} + + +ACE_FACTORY_DEFINE (DAnCE_Plan_Launcher_Base_Module, DAnCE_Plan_Launcher_Base_Module) diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.h new file mode 100644 index 00000000000..308ae3c3c00 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Plan_Launcher_Base_Module.h + * + * $Id$ + * + * @Brief Uses to run PlanLauncher from starter + * + * @author Vinzenz Tornow <vt@prismtech.com> + */ +//============================================================================= + +#ifndef PLAN_LAUNCHER_MODULE_H +#define PLAN_LAUNCHER_MODULE_H + +#include /**/ "ace/pre.h" + +#include "Plan_Launcher_Base_Module_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" +#include "tao/Object_Loader.h" + + +/** + * @class Plan_Launcher_Module + * + * @brief The shared object that is instantiated when the plan launcher + * module/library is dynamically loaded. + * + * This class runs the plan launcher instance + */ +class DAnCE_Plan_Launcher_Base_Module_Export DAnCE_Plan_Launcher_Base_Module + : public TAO_Object_Loader + { + public: + /// Constructor. + DAnCE_Plan_Launcher_Base_Module (void); + + /// Overload the base class method to create a new instance + /// of a DAnCE_NodeManager_Module object. + virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv []); + + private: + }; + +ACE_FACTORY_DECLARE (DAnCE_Plan_Launcher_Base_Module, DAnCE_Plan_Launcher_Base_Module) + +#include /**/ "ace/post.h" + +#endif /* PLAN_LAUNCHER_MODULE_H */ diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module_Export.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module_Export.h new file mode 100644 index 00000000000..f9e3f7a7961 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DAnCE_Plan_Launcher_Base_Module +// ------------------------------ +#ifndef DANCE_PLAN_LAUNCHER_BASE_MODULE_EXPORT_H +#define DANCE_PLAN_LAUNCHER_BASE_MODULE_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL) +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL */ + +#if !defined (DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL) +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL 1 +#endif /* ! DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL */ + +#if defined (DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL) && (DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL == 1) +# if defined (DANCE_PLAN_LAUNCHER_BASE_MODULE_BUILD_DLL) +# define DAnCE_Plan_Launcher_Base_Module_Export ACE_Proper_Export_Flag +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DANCE_PLAN_LAUNCHER_BASE_MODULE_BUILD_DLL */ +# define DAnCE_Plan_Launcher_Base_Module_Export ACE_Proper_Import_Flag +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DANCE_PLAN_LAUNCHER_BASE_MODULE_BUILD_DLL */ +#else /* DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL == 1 */ +# define DAnCE_Plan_Launcher_Base_Module_Export +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_SINGLETON_DECLARATION(T) +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DANCE_PLAN_LAUNCHER_BASE_MODULE_HAS_DLL == 1 */ + +// Set DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE) +# if (ACE_NTRACE == 1) +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE */ + +#if (DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE == 1) +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_TRACE(X) +#else /* (DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_PLAN_LAUNCHER_BASE_MODULE_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DANCE_PLAN_LAUNCHER_BASE_MODULE_NTRACE == 1) */ + +#endif /* DANCE_PLAN_LAUNCHER_BASE_MODULE_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Benchmark_Impl.cpp b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Benchmark_Impl.cpp deleted file mode 100644 index e0b4ab85023..00000000000 --- a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Benchmark_Impl.cpp +++ /dev/null @@ -1,245 +0,0 @@ -// $Id$ -#include "Plan_Launcher_Benchmark_Impl.h" - -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" -#include "ace/Throughput_Stats.h" -#include "ace/Sample_History.h" -#include "DAnCE/Utils/Plan_Handler.h" - -namespace CIAO -{ - namespace Plan_Launcher - { - Plan_Launcher_Benchmark_i::~Plan_Launcher_Benchmark_i () - { - } - - const char * - Plan_Launcher_Benchmark_i::launch_plan ( - const ::Deployment::DeploymentPlan &plan) - { - try - { - ///// Start Test //////////////////////////////////////////// - ACE_Sample_History history_prepare_plan (this->niterations_); - ACE_Sample_History history_start_launch (this->niterations_); - ACE_Sample_History history_finish_launch (this->niterations_); - ACE_Sample_History history_start_system (this->niterations_); - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - ACE_hrtime_t call_start, call_end; - - while (this->niterations_ > 0) - { - --this->niterations_; - - if (CORBA::is_nil (this->em_.in ())) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("CIAO::Plan_Launcher_Benchmark_i: ") - ACE_TEXT ("launch_plan called witn an uninitialized EM.\n"))); - return 0; - } - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO::Plan_Launcher_Benchmark_i: " ) - ACE_TEXT ("about to call this->em_->preparePlan\n"))); - } - - //////// Measure the latency for preparePlan() //////////////// - call_start = ACE_OS::gethrtime (); - ::Deployment::DomainApplicationManager_var dam (this->em_->preparePlan (plan, 1)); - call_end = ACE_OS::gethrtime (); - history_prepare_plan.sample (call_end - call_start); - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO::Plan_Launcher_Benchmark_i: " ) - ACE_TEXT ("after to call this->em_->preparePlan\n"))); - } - - if (CORBA::is_nil (dam.in ())) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) CIAO_PlanLauncher:preparePlan call failed: " - "nil DomainApplicationManager reference\n")); - return 0; - } - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: Obtained DAM ref \n")); - } - - ::Deployment::Properties_var properties; - ACE_NEW_RETURN (properties, - Deployment::Properties, - 0); - - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: start Launch application...\n")); - } - - - - // Do not start the Application immediately since it violates - // the semantics of component activation sequence - int start = 0; - - //////// Measure the latency for startLaunch() //////////////// - call_start = ACE_OS::gethrtime (); - dam->startLaunch (properties.in (), 0); - call_end = ACE_OS::gethrtime (); - history_start_launch.sample (call_end - call_start); - - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - - // Call finish Launch to complete the connections - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: finish Launch application...\n")); - - - //////// Measure the latency for finishLaunch() //////////////// - call_start = ACE_OS::gethrtime (); - dam->finishLaunch (start, false); // is_ReDAC by default is <false> - call_end = ACE_OS::gethrtime (); - history_finish_launch.sample (call_end - call_start); - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - - // Call start to activate components - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: start activating components...\n")); - - //////// Measure the latency for start() //////////////// - call_start = ACE_OS::gethrtime (); - dam->start (); - call_end = ACE_OS::gethrtime (); - history_start_system.sample (call_end - call_start); - - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO_PlanLauncher: ") - ACE_TEXT ("Application Deployed successfully\n"))); - - map_.bind_dam_reference (plan.UUID.in (), - Deployment::DomainApplicationManager::_duplicate (dam.in ())); - - // In order to run the launch_plan() multiple times to collect benchmarking - // results, we have to tear down the plan and then redeploy. - if (this->niterations_ > 0) - { - dam->destroyApplication (); - this->destroy_dam_by_plan (plan.UUID.in ()); - } - } - - - ///// End Test //////////////////////////////////////////// - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "test finished\n")); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - ACE_Basic_Stats stats_1; - history_prepare_plan.dump_samples ("HISTORY -- pareparePlan", gsf); - history_prepare_plan.collect_basic_stats (stats_1); - stats_1.dump_results ("TOTAL -- pareparePlan", gsf); - - ACE_Basic_Stats stats_2; - history_start_launch.dump_samples ("HISTORY -- startLaunch", gsf); - history_start_launch.collect_basic_stats (stats_2); - stats_2.dump_results ("TOTAL -- startLaunch", gsf); - - ACE_Basic_Stats stats_3; - history_finish_launch.dump_samples ("HISTORY -- finishLaunch", gsf); - history_finish_launch.collect_basic_stats (stats_3); - stats_3.dump_results ("TOTAL -- finishLaunch", gsf); - - ACE_Basic_Stats stats_4; - history_start_system.dump_samples ("HISTORY -- activateSystem", gsf); - history_start_system.collect_basic_stats (stats_4); - stats_4.dump_results ("TOTAL -- activateSystem", gsf); - - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - stats_1.samples_count ()); - - } - catch (Deployment::ResourceNotAvailable& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: ResourceNotAvaiable exception caught: %s,\n" - "Type: %s\n" - "Property: %s\n" - "Element: %s\n" - "Resource: %s\n", - ex.name.in (), - ex.resourceType.in (), - ex.propertyName.in (), - ex.elementName.in (), - ex.resourceName.in ())); - throw Deployment_Failure (""); - } - catch (Deployment::StartError& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: StartError exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (Deployment::InvalidProperty& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: InvalidProperty exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (Deployment::InvalidConnection& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: InvalidConnection exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (const CORBA::Exception& ex) - { - ACE_ERROR ((LM_ERROR, - "CORBA EXCEPTION: %s\n", - ex._info().fast_rep())); - throw Deployment_Failure (""); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: non-CORBA exception\n")); - throw Deployment_Failure (""); - } - - return CORBA::string_dup (plan.UUID.in ()); - } - } -} diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Benchmark_Impl.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Benchmark_Impl.h deleted file mode 100644 index de36701449d..00000000000 --- a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Benchmark_Impl.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * $Id$ - * @file Plan_Launcher_Benchmark_Impl.h - * @author Gan Deng <dengg@dre.vanderbilt.edu> - * - * A subclass of the Plan_Launcher_i class, which overrides the method - * called lauch_plan() to collect benchmarking results.. - */ -#ifndef PLAN_LAUNCHER_BENCHMARK_IMPL_H -#define PLAN_LAUNCHER_BENCHMARK_IMPL_H - -#include "Plan_Launcher_Impl.h" - -namespace CIAO -{ - namespace Plan_Launcher - { - /** - * @class Plan_Launcher_Benchmark_i - * @brief This class is a subclass of Plan_Launcher_i which is solely for - * benchmarking purpose. - */ - class Plan_Launcher_Impl_Export Plan_Launcher_Benchmark_i - : public Plan_Launcher_i - { - public: - - virtual ~Plan_Launcher_Benchmark_i (); - - /** - * @brief Launch a plan, given an IDL deployment plan - * @param plan A valid IDL deployment plan - * @returns a string containing the UUID of the plan. Null indicates failure. - */ - virtual const char * launch_plan (const ::Deployment::DeploymentPlan &plan); - - protected: - - }; - - } -} - -#endif /* PLAN_LAUNCHER_BENCHMARK_IMPL_H */ diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Exec.cpp b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Exec.cpp new file mode 100644 index 00000000000..bd832e3dd31 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Exec.cpp @@ -0,0 +1,8 @@ +// $Id$ +#include "Plan_Launcher_Module.h" + +#define DANCE_MODULE_MAIN_SKIP_ORB_RUN +#define DANCE_MODULE_MAIN_CLASS_NAME DAnCE_Plan_Launcher_Module +#include "Deployment/Module_Main.h" + + diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp index 88829fdd1e0..bd1c5f49425 100644 --- a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp @@ -1,569 +1,120 @@ // $Id$ #include "Plan_Launcher_Impl.h" #include "orbsvcs/CosNamingC.h" -#include "Config_Handlers/XML_File_Intf.h" -#include "Config_Handlers/DnC_Dump.h" -#include "tao/RTCORBA/RTCORBA.h" -#include "tao/RTCORBA/Priority_Mapping_Manager.h" +#include "tools/Config_Handlers/XML_File_Intf.h" +#include "tools/Config_Handlers/DnC_Dump.h" +//#include "tao/RTCORBA/RTCORBA.h" +//#include "tao/RTCORBA/Priority_Mapping_Manager.h" #include "tao/ORB_Core.h" #include "ace/Sched_Params.h" +#include "ccm/CCM_ObjectC.h" -namespace CIAO -{ - namespace Plan_Launcher - { - // @todo make this a private method - static CORBA::Object_ptr - fetch_reference_naming (CORBA::ORB_ptr orb) - { - CORBA::Object_var tmp = orb->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var pns = - CosNaming::NamingContext::_narrow (tmp.in ()); - - if (CORBA::is_nil (pns.in ())) - { - return CORBA::Object::_nil (); - } - - CosNaming::Name name (1); - name.length (1); - - name[0].id = CORBA::string_dup ("ExecutionManager"); - - return pns->resolve (name); - } - - Plan_Launcher_i::Plan_Launcher_i () - : orb_ (0), em_ (), pg_ () - { - } - - Plan_Launcher_i::~Plan_Launcher_i () - { - } - - bool - Plan_Launcher_i::init (const char *em_ior, - CORBA::ORB_ptr orb, - bool use_repoman, - bool rm_use_naming, - const char *rm_name, - CORBA::Short priority, - size_t niterations) - { - this->orb_ = CORBA::ORB::_duplicate (orb); - this->niterations_ = niterations; - this->desired_priority_ = priority; - - CORBA::Object_var obj; - - // EM - if (em_ior == 0) - { - obj = fetch_reference_naming (orb); - } - else - { - obj = orb->string_to_object (em_ior); - } - - this->em_ = ::CIAO::ExecutionManagerDaemon::_narrow (obj.in ()); - - if (CORBA::is_nil (this->em_.in ())) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) CIAO_PlanLauncher: nil Execution" - " Manager reference, narrow failed\n")); - return false; - } - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) CIAO_PlanLauncher: Obtained Execution" - " Manager ref \n")); - } - - // Check whether the client_propagate priority model has been set - // on the ExecutionManager - if (this->is_client_propagated_model ()) - { - // Set the priority of the current thread, so it can be propagated - // to the ExecutionManager - this->set_current_priority (this->desired_priority_); - } +#include "ace/OS.h" +#include "ace/Get_Opt.h" +#include "DAnCE/Logger/Log_Macros.h" - if (use_repoman) - { - return pg_.init (orb, rm_use_naming, rm_name); - } - else - { - return true; - } - } +namespace DAnCE +{ +namespace Plan_Launcher +{ +::Deployment::DeploymentPlan * +Plan_Launcher_Impl::load_xml_plan(const char *deployment_plan_uri) +{ + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_Impl::load_xml_plan - " + "Parsing plan \"%s\"...\n", deployment_plan_uri)); - const char * - Plan_Launcher_i::launch_plan (const char *deployment_plan_uri, - const char *package_uri, - bool use_package_name, - bool use_repoman) + ::Deployment::DeploymentPlan * plan = 0; + try { - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, "Parsing plan...\n")); - } - CIAO::Config_Handlers::XML_File_Intf intf (deployment_plan_uri); - - ::Deployment::DeploymentPlan_var plan = intf.get_plan (); - - // Use the package name(s) or type(s) to modify the location of all the - // artifacts in DeploymentPlan. - if (use_repoman) - { - // @todo check return value - pg_.generate_plan (plan, package_uri, use_package_name); - } - - if (CIAO::debug_level () > 9) + intf.add_search_path ("CIAO_ROOT", "/docs/schema/"); + intf.add_search_path ("TAO_ROOT", "/docs/schema/"); + plan = intf.release_plan (); + if (0 == plan) { - ACE_DEBUG ((LM_DEBUG, "Parsing complete....\n")); + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Impl::load_xml_plan - " + "Failed to parse plan \"%C\".\n", deployment_plan_uri)); + throw Deployment_Failure("Failed to parse plan."); } - - return this->launch_plan (plan.in ()); } - - const char * - Plan_Launcher_i::launch_plan (const ::Deployment::DeploymentPlan &plan) + catch (...) { - try - { - if (CORBA::is_nil (this->em_.in ())) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("CIAO::Plan_Launcher_i: ") - ACE_TEXT ("launch_plan called witn an uninitialized EM.\n"))); - return 0; - } - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO::Plan_Launcher_i: " ) - ACE_TEXT ("about to call this->em_->preparePlan\n"))); - } - - ::Deployment::DomainApplicationManager_var dam (this->em_->preparePlan (plan, 1)); - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO::Plan_Launcher_i: " ) - ACE_TEXT ("after to call this->em_->preparePlan\n"))); - } - - if (CORBA::is_nil (dam.in ())) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) CIAO_PlanLauncher:preparePlan call failed: " - "nil DomainApplicationManager reference\n")); - return 0; - } - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: Obtained DAM ref \n")); - } - - ::Deployment::Properties_var properties; - ACE_NEW_RETURN (properties, - Deployment::Properties, - 0); - - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: start Launch application...\n")); - } - - // Dont not start the Application immediately since it violates - // the semantics of component activation sequence - int start = 0; - - dam->startLaunch (properties.in (), 0); - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - - // Call finish Launch to complete the connections - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: finish Launch application...\n")); - dam->finishLaunch (start, false); // is_ReDAC by default is <false> - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - - // Call start to activate components - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: start activating components...\n")); - dam->start (); - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - - if (CIAO::debug_level ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO_PlanLauncher: ") - ACE_TEXT ("Application Deployed successfully\n"))); - - map_.bind_dam_reference (plan.UUID.in (), - Deployment::DomainApplicationManager::_duplicate (dam.in ())); - } - catch (const Deployment::ResourceNotAvailable& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: ResourceNotAvaiable exception caught: %s,\n" - "Type: %s\n" - "Property: %s\n" - "Element: %s\n" - "Resource: %s\n", - ex.name.in (), - ex.resourceType.in (), - ex.propertyName.in (), - ex.elementName.in (), - ex.resourceName.in ())); - throw Deployment_Failure (""); - } - catch (const Deployment::StartError& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: StartError exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (const Deployment::InvalidProperty& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: InvalidProperty exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (const Deployment::InvalidConnection& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: InvalidConnection exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (const CORBA::Exception& ex) - { - ACE_ERROR ((LM_ERROR, - "CORBA EXCEPTION: %s\n", - ex._info().fast_rep())); - throw Deployment_Failure (""); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: non-CORBA exception\n")); - throw Deployment_Failure (""); - } - - return CORBA::string_dup (plan.UUID.in ()); - } - - ::Deployment::DomainApplicationManager_ptr - Plan_Launcher_i::get_dam (const char *uuid) - { - if (!this->map_.is_plan_available (uuid)) - { - // Note: we could do an exhaustive (and expensive!) search of the DAMS - // on our EM at this point, if we wanted. In most cases, though, this - // would not produce a different result. - return Deployment::DomainApplicationManager::_nil (); - } - return this->map_.fetch_dam_reference (uuid); + ACE_CString s = "failed to parse deployment plan \""; + s += deployment_plan_uri; + s += "\""; + DANCE_DEBUG ((LM_ERROR, DLINFO "Plan_Launcher_Impl::load_xml_plan - %C\n", s.c_str())); + throw Deployment_Failure (s.c_str()); } - bool - Plan_Launcher_i::teardown_plan (const char *uuid) - { - // Since people could always run another instance of the Plan_Launcher - // executable to tear down a plan, so we could NOT rely on the local - // DAM_Map to fetch DAM obj reference. Instead, we make a remote call - // on ExecutionManager to fetch it. - try - { - ::Deployment::DomainApplicationManager_var dapp_mgr = - this->em_->getManager (uuid); - - if (!::CORBA::is_nil (dapp_mgr.in ())) - { - dapp_mgr->destroyApplication (); - - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - } - - // Note that we should ask the DAM to tell EM whether the DAM should - // be destroyed - this->destroy_dam_by_plan (uuid); - } - } - catch (const CORBA::Exception&) - { - // @todo the destroy_dam_by_plan could give a stoperror exception - // we should handle - ACE_ERROR ((LM_ERROR, "Unable to find DomainApplicationManager " - "for plan with uuid: %s\n", uuid)); - return false; - } + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_Impl::load_xml_plan - Parsing complete....\n")); + return plan; +} - return true; - } +void Plan_Launcher_Impl::execute() +{ + DANCE_TRACE ("Plan_Launcher_Impl::execute()"); - bool - Plan_Launcher_i::teardown_plan (::Deployment::DomainApplicationManager_ptr dam) + if (this->mode_ & MODE_START_PLAN) { - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: destroy the application.....\n")); - } - - dam->destroyApplication (); - - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - } - - this->destroy_dam (dam); - - return true; + size_t sz = this->xml_plan_urls_.size(); + for (size_t i= 0; i < sz; ++i) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_Impl::execute - " + "launching plan \"%C\"...\n", this->xml_plan_urls_[i].c_str())); + ::Deployment::DeploymentPlan_var plan = + this->load_xml_plan(this->xml_plan_urls_[i].c_str()); + try + { + CORBA::String_var uuid = this->launch_plan (plan.in()); + if (0 == uuid.in ()) + { + throw Deployment_Failure ("execute - Error launching plan\n"); + } + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_Impl::execute - " + "returned plan UUID is \"%s\"\n", uuid.in ())); + } + catch (...) + { + this->teardown_plan (plan->UUID.in()); + throw; + } + } + this->Plan_Launcher_Base_Impl::execute(); } - void - Plan_Launcher_i::destroy_dam (::Deployment::DomainApplicationManager_ptr dam) + if (this->mode_ & MODE_STOP_PLAN) { - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: destroy the manager.....\n")); - } - - this->em_->destroyManager (dam); - - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - } + this->stop_plan(); } - void - Plan_Launcher_i::destroy_dam_by_plan (const char* plan_uuid) + if (this->mode_ & MODE_WRITE_CDR) { - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: destroy the manager.....\n")); - } - - this->em_->destroyManagerByPlan (plan_uuid); - - if (CIAO::debug_level ()) - { - ACE_DEBUG ((LM_DEBUG, "[success]\n")); - } + ::Deployment::DeploymentPlan_var plan = this->load_xml_plan(this->xml_plan_urls_[0].c_str()); + this->write_cdr_plan_file(this->cdr_dest_url_.c_str(), plan); } - - const char * - Plan_Launcher_i::re_launch_plan (const char *deployment_plan_uri, - const char *package_uri, - bool use_package_name, - bool use_repoman) - { - CIAO::Config_Handlers::XML_File_Intf intf (deployment_plan_uri); - - ::Deployment::DeploymentPlan_var plan = intf.get_plan (); - - // Use the package name(s) or type(s) to modify the location of all the - // artifacts in DeploymentPlan. - if (use_repoman) - { - // @todo use return value - pg_.generate_plan (plan, package_uri, use_package_name); - } - - return this->re_launch_plan (plan.in ()); - } - - const char * - Plan_Launcher_i::re_launch_plan (const ::Deployment::DeploymentPlan &plan) +} +void Plan_Launcher_Impl::stop_plan() +{ + DANCE_TRACE ("Plan_Launcher_Impl::stop_plan"); + + if (0 < this->xml_plan_urls_.size()) { - try + size_t sz = this->xml_plan_urls_.size(); + for (size_t i= 0; i < sz; ++i) { - if (CORBA::is_nil (this->em_.in ())) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("CIAO::Plan_Launcher_i: ") - ACE_TEXT ("re_launch_plan called witn an uninitialized EM.\n"))); - return 0; - } - - this->em_->perform_redeployment (plan); - - if (CIAO::debug_level ()) + DANCE_DEBUG((LM_TRACE, DLINFO "Plan_Launcher_Impl::stop_plan - " + "Stopping plan by plan file: %C\n", this->xml_plan_urls_[i].c_str())); + ::Deployment::DeploymentPlan_var plan = this->load_xml_plan(this->xml_plan_urls_[i].c_str()); + if (!this->teardown_plan(plan->UUID.in())) { - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: new plan redeployed ...\n")); + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Impl::stop_plan - " + "tear down assembly failed: unknown plan uuid.\n")); } - - return CORBA::string_dup (plan.UUID.in ()); } - catch (const Deployment::ResourceNotAvailable& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: ResourceNotAvaiable exception caught: %s,\n" - "Type: %s\n" - "Property: %s\n" - "Element: %s\n" - "Resource: %s\n", - ex.name.in (), - ex.resourceType.in (), - ex.propertyName.in (), - ex.elementName.in (), - ex.resourceName.in ())); - throw Deployment_Failure (""); - } - catch (const Deployment::StartError& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: StartError exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (const Deployment::InvalidProperty& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: InvalidProperty exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (const Deployment::InvalidConnection& ex) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: InvalidConnection exception caught: %s, %s\n", - ex.name.in (), - ex.reason.in ())); - throw Deployment_Failure (""); - } - catch (const CORBA::Exception& ex) - { - ACE_ERROR ((LM_ERROR, - "CORBA EXCEPTION: %s\n", - ex._info().fast_rep())); - throw Deployment_Failure (""); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, - "EXCEPTION: non-CORBA exception\n")); - throw Deployment_Failure (""); - } - - return CORBA::string_dup (plan.UUID.in ()); - } - - bool - Plan_Launcher_i::set_current_priority (CORBA::Short desired_priority) - { - CORBA::Object_var object = - this->orb_->resolve_initial_references ("RTCurrent"); - RTCORBA::Current_var current = - RTCORBA::Current::_narrow (object.in ()); - - object = this->orb_->resolve_initial_references ("PriorityMappingManager"); - RTCORBA::PriorityMappingManager_var mapping_manager = - RTCORBA::PriorityMappingManager::_narrow (object.in ()); - - RTCORBA::PriorityMapping *pm = - mapping_manager->mapping (); - - int sched_policy = - this->orb_->orb_core ()->orb_params ()->ace_sched_policy (); - - int max_priority = - ACE_Sched_Params::priority_max (sched_policy); - int min_priority = - ACE_Sched_Params::priority_min (sched_policy); - - CORBA::Short native_priority = - (max_priority + min_priority) / 2; - - if (pm->to_CORBA (native_priority, desired_priority) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot convert native priority %d to corba priority\n", - native_priority), - false); - - current->the_priority (desired_priority); - - CORBA::Short priority = - current->the_priority (); - - if (desired_priority != priority) - ACE_ERROR_RETURN ((LM_ERROR, - "ERROR: Unable to set thread " - "priority to %d\n", desired_priority), - false); - - return true; } - - bool - Plan_Launcher_i::is_client_propagated_model () - { - CORBA::Policy_var policy = - this->em_->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE); - - RTCORBA::PriorityModelPolicy_var priority_policy = - RTCORBA::PriorityModelPolicy::_narrow (policy.in ()); - - if (CORBA::is_nil (priority_policy.in ())) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO::Plan_Launcher_i: " ) - ACE_TEXT ("In ExecutionManager, the Priority Model Policy is not exposed. ") - ACE_TEXT ("Use non-RT mode.\n"))); - return false; - } - - RTCORBA::PriorityModel priority_model = - priority_policy->priority_model (); - - if (priority_model != RTCORBA::CLIENT_PROPAGATED) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("CIAO::Plan_Launcher_i: " ) - ACE_TEXT ("The Priority Model of ExecutionManager is not CLIENT_PROPAGATED! ") - ACE_TEXT ("Use non-RT mode instead.\n"))); - return false; - } - - return true; - } - } + this->Plan_Launcher_Base_Impl::stop_plan(); } + +} // Plan_Launcher +} // DAnCE diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h index 057fdfaeac2..a21a0fe65d5 100644 --- a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h @@ -10,108 +10,34 @@ #define PLAN_LAUNCHER_IMPL_H #include "Plan_Launcher_Impl_Export.h" -#include "ciao/CIAO_common.h" -#include "DAnCE/ExecutionManager/DAM_Map.h" -#include "DAnCE/Interfaces/ExecutionManagerDaemonC.h" -#include "DAnCE/Plan_Generator/Plan_Generator_Impl.h" +#include "Plan_Launcher_Base_Impl.h" - -namespace CIAO -{ - namespace Plan_Launcher +namespace DAnCE { - /** - * @class Plan_Launcher_i - * @brief This class launches and manages deployment plans. - */ - class Plan_Launcher_Impl_Export Plan_Launcher_i + namespace Plan_Launcher { - public: - class Deployment_Failure { - public: - Deployment_Failure (const ACE_CString &error) - : error_ (error) - { - } - - ACE_CString error_; - }; - - Plan_Launcher_i (); - virtual ~Plan_Launcher_i (); - - bool init (const char *em_ior, - CORBA::ORB_ptr orb, - bool use_repoman = false, - bool rm_use_naming = false, - const char *rm_name = 0, - CORBA::Short priority = 0, - size_t niterations = 0); - - /** - * @brief Launch a plan, given a deployment plan URI - * @param deployment_plan_uri A uri that points ot a valid deployment plan - * @returns a string containing the UUID of the plan. Null indicates failure. - */ - const char * launch_plan (const char *deployment_plan_uri, - const char *package_uri = 0, - bool use_package_name = true, - bool use_repoman = false); - - const char * re_launch_plan (const char *deployment_plan_uri, - const char *package_uri = 0, - bool use_package_name = true, - bool use_repoman = false); - - /** - * @brief Launch a plan, given an IDL deployment plan - * @param plan A valid IDL deployment plan - * @returns a string containing the UUID of the plan. Null indicates failure. - */ - virtual const char * launch_plan (const ::Deployment::DeploymentPlan &plan); - - virtual const char * re_launch_plan (const ::Deployment::DeploymentPlan &plan); - /// Returns the DAM associated with a given plan URI - ::Deployment::DomainApplicationManager_ptr get_dam (const char *uuid); - - /// Tears down a plan given the UUID - bool teardown_plan (const char *uuid); - - bool teardown_plan (::Deployment::DomainApplicationManager_ptr dam); - - void destroy_dam (::Deployment::DomainApplicationManager_ptr dam); - - void destroy_dam_by_plan (const char * plan_uuid); - - // Change the priority of this thread - bool set_current_priority (CORBA::Short priority); - - protected: - // Check that the object is configured with CLIENT_PROPAGATED - // PriorityModelPolicy. - bool is_client_propagated_model (void); - - /// Cached ORB pointer - CORBA::ORB_var orb_; - - /// Object reference of the ExecutionManager - ::CIAO::ExecutionManagerDaemon_var em_; - - /// Local map for DAMs, to save expensive UUID lookups. - Execution_Manager::DAM_Map map_; + /** + * @class Plan_Launcher_Impl + * @brief This class launches and manages deployment plans. + */ + class Plan_Launcher_Impl_Export Plan_Launcher_Impl : public Plan_Launcher_Base_Impl + { + public: + Plan_Launcher_Impl (CORBA::ORB_ptr orb, int argc, ACE_TCHAR *argv[]) + : Plan_Launcher_Base_Impl (orb, argc, argv) {}; - CIAO::Plan_Generator::Plan_Generator_i pg_; + virtual ~Plan_Launcher_Impl () {}; - /// Desired CORBA prioirty to be propagated to EM - CORBA::Short desired_priority_; + void execute(); + static ::Deployment::DeploymentPlan* load_xml_plan (const char *deployment_plan_uri); - /// Number of iterations to run benchmarking, if specified - size_t niterations_; - }; + protected: + virtual void stop_plan(); + }; // class Plan_Launcher_Impl - } -} + } // Plan_Launcher +} // DAnCE #endif /* PLAN_LAUNCHER_IMPL_H */ diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.cpp b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.cpp new file mode 100644 index 00000000000..0312707a66c --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.cpp @@ -0,0 +1,55 @@ +// -*- C++ -*- +// $Id$ + +#include "Plan_Launcher_Module.h" +#include "tao/TAO_Singleton_Manager.h" +#include "tao/StringSeqC.h" +#include "Plan_Launcher_Impl.h" +#include "ace/Get_Opt.h" +#include "DAnCE/Logger/Log_Macros.h" + +ACE_RCSID (DAnCE, + DAnCE_Plan_Launcher_Module, + "$Id$") + +using namespace DAnCE::Plan_Launcher; + +DAnCE_Plan_Launcher_Module::DAnCE_Plan_Launcher_Module (void) +{ +} + +CORBA::Object_ptr +DAnCE_Plan_Launcher_Module::create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv[]) +{ + try + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_Plan_Launcher_Module::create_object - " + "Creating Plan Launcher object.")); + + Plan_Launcher_Impl pl (orb, argc, argv); + pl.execute(); + } + catch (const Plan_Launcher_Base_Impl::Deployment_Failure& e) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_Plan_Launcher_Module::create_object - " + "Eerror : %s.\n", e.error_.c_str())); + } + catch (const CORBA::Exception& ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_Plan_Launcher_Module::create_object - " + "Caught CORBA Exception %C", + ex._info ().c_str ())); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_Plan_Launcher_Module::create_object - " + "Unknown exception.\n")); + } + return CORBA::Object::_nil (); +} + +ACE_FACTORY_DEFINE (DAnCE_Plan_Launcher_Module, DAnCE_Plan_Launcher_Module) + + diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.h new file mode 100644 index 00000000000..cb0895694d9 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Plan_Launcher_Module.h + * + * $Id$ + * + * @Brief Uses to run PlanLauncher from starter + * + * @author Vinzenz Tornow <vt@prismtech.com> + */ +//============================================================================= + +#ifndef PLAN_LAUNCHER_MODULE_H +#define PLAN_LAUNCHER_MODULE_H + +#include /**/ "ace/pre.h" + +#include "Plan_Launcher_Module_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" +#include "tao/Object_Loader.h" + + +/** + * @class Plan_Launcher_Module + * + * @brief The shared object that is instantiated when the plan launcher + * module/library is dynamically loaded. + * + * This class runs the plan launcher instance + */ +class DAnCE_Plan_Launcher_Module_Export DAnCE_Plan_Launcher_Module + : public TAO_Object_Loader + { + public: + /// Constructor. + DAnCE_Plan_Launcher_Module (void); + + /// Overload the base class method to create a new instance + /// of a DAnCE_NodeManager_Module object. + virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv []); + + private: + }; + +ACE_FACTORY_DECLARE (DAnCE_Plan_Launcher_Module, DAnCE_Plan_Launcher_Module) + +#include /**/ "ace/post.h" + +#endif /* PLAN_LAUNCHER_MODULE_H */ diff --git a/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module_Export.h b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module_Export.h new file mode 100644 index 00000000000..cdeb11e8abf --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl DAnCE_Plan_Launcher_Module +// ------------------------------ +#ifndef DANCE_PLAN_LAUNCHER_MODULE_EXPORT_H +#define DANCE_PLAN_LAUNCHER_MODULE_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL) +# define DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL */ + +#if !defined (DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL) +# define DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL 1 +#endif /* ! DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL */ + +#if defined (DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL) && (DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL == 1) +# if defined (DANCE_PLAN_LAUNCHER_MODULE_BUILD_DLL) +# define DAnCE_Plan_Launcher_Module_Export ACE_Proper_Export_Flag +# define DANCE_PLAN_LAUNCHER_MODULE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DANCE_PLAN_LAUNCHER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DANCE_PLAN_LAUNCHER_MODULE_BUILD_DLL */ +# define DAnCE_Plan_Launcher_Module_Export ACE_Proper_Import_Flag +# define DANCE_PLAN_LAUNCHER_MODULE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DANCE_PLAN_LAUNCHER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DANCE_PLAN_LAUNCHER_MODULE_BUILD_DLL */ +#else /* DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL == 1 */ +# define DAnCE_Plan_Launcher_Module_Export +# define DANCE_PLAN_LAUNCHER_MODULE_SINGLETON_DECLARATION(T) +# define DANCE_PLAN_LAUNCHER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DANCE_PLAN_LAUNCHER_MODULE_HAS_DLL == 1 */ + +// Set DANCE_PLAN_LAUNCHER_MODULE_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DANCE_PLAN_LAUNCHER_MODULE_NTRACE) +# if (ACE_NTRACE == 1) +# define DANCE_PLAN_LAUNCHER_MODULE_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DANCE_PLAN_LAUNCHER_MODULE_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DANCE_PLAN_LAUNCHER_MODULE_NTRACE */ + +#if (DANCE_PLAN_LAUNCHER_MODULE_NTRACE == 1) +# define DANCE_PLAN_LAUNCHER_MODULE_TRACE(X) +#else /* (DANCE_PLAN_LAUNCHER_MODULE_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_PLAN_LAUNCHER_MODULE_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DANCE_PLAN_LAUNCHER_MODULE_NTRACE == 1) */ + +#endif /* DANCE_PLAN_LAUNCHER_MODULE_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/Plan_Launcher/launcher.cpp b/CIAO/DAnCE/Plan_Launcher/launcher.cpp new file mode 100644 index 00000000000..4a93cdfdd77 --- /dev/null +++ b/CIAO/DAnCE/Plan_Launcher/launcher.cpp @@ -0,0 +1,11 @@ +// $Id$ + +#include "ace/OS.h" +#include "Plan_Launcher.h" + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + return DAnCE::Plan_Launcher::run_main_implementation (argc, argv); +} + + diff --git a/CIAO/DAnCE/RedirectionService/CCMObjectLocator.cpp b/CIAO/DAnCE/RedirectionService/CCMObjectLocator.cpp new file mode 100644 index 00000000000..63487b08874 --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/CCMObjectLocator.cpp @@ -0,0 +1,390 @@ +// $Id$ + +#include "CCMObjectLocator.h" +#include "ace/String_Base.h" +#include "tao/IORTable/IORTable.h" +#include "DAnCE/Logger/Log_Macros.h" + +namespace DAnCE + { + + CCMObjectLocator::CCMObjectLocator (CORBA::ORB_ptr orb, PortableServer::POA_ptr parent_poa, const char * poa_name) + : orb_ (CORBA::ORB::_duplicate (orb)) + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::CCMObjectLocator - started\n")); + CORBA::PolicyList policies (4); + policies.length (4); + policies[0] = parent_poa->create_id_assignment_policy (PortableServer::USER_ID); + policies[1] = parent_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER); + policies[2] = parent_poa->create_servant_retention_policy (PortableServer::NON_RETAIN); + policies[3] = parent_poa->create_lifespan_policy (PortableServer::PERSISTENT); + PortableServer::POAManager_var mgr = parent_poa->the_POAManager (); + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::CCMObjectLocator - before create_POA\n")); + this->myPOA_ = parent_poa->create_POA (poa_name + , mgr.in() + , policies); + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::CCMObjectLocator - after create_POA\n")); + for (CORBA::ULong i = 0; i < policies.length(); ++i) + { + policies[i]->destroy(); + } + + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::CCMObjectLocator - before set_servant_manager\n")); + this->myPOA_->set_servant_manager (this); + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::CCMObjectLocator - CCMObjectLocator started on POA \"%s\"\n" + , poa_name)); + } + + CCMObjectLocator::~CCMObjectLocator() + {} + + void + CCMObjectLocator::postinvoke ( + const ::PortableServer::ObjectId & /*oid*/, + ::PortableServer::POA_ptr /*adapter*/, + const char * /*operation*/, + ::PortableServer::ServantLocator::Cookie /*the_cookie*/, + ::PortableServer::Servant /*the_servant*/ + ) + { + } + + ::PortableServer::Servant + CCMObjectLocator::preinvoke ( + const ::PortableServer::ObjectId & oid, + ::PortableServer::POA_ptr , + const char * , + ::PortableServer::ServantLocator::Cookie & + ) + { + CORBA::String_var s = PortableServer::ObjectId_to_string (oid); + ACE_CString path = s.in(); + CORBA::Object_var res = this->db_.getValue (path.c_str()); + if (!CORBA::is_nil (res)) + { + throw ::PortableServer::ForwardRequest (res._retn()); + } + else + { + int level = this->db_.missingNodeLevel (path.c_str()); + if (0 > level // all levels (app(1), inst(2), port(3) exist but object is nil yet + || 1 == level) // application is not registered + { + throw CORBA::TRANSIENT(); + } + else + { + throw CORBA::OBJECT_NOT_EXIST(); + } + } + } + + void + CCMObjectLocator::start_register (const ACE_CString& plan) + { + TreeNode* tree = 0; + if (0 != this->transactions_.find (plan, tree)) + { + tree = new TreeNode(); + } + else + { + DANCE_ERROR ( (LM_ERROR, "[%M] CCMObjectLocator::start_register - transaction for plan \"%s\" alreday started!\n" + , plan.c_str())); + ///TODO Deside correcet processing of this error - probably finish_register should be called + delete tree; + tree = new TreeNode(); + } + this->transactions_.rebind (plan, tree); + } + + + CORBA::Object_ptr + CCMObjectLocator::register_object (const ACE_CString & plan + , const ACE_CString & inst + , const ACE_CString & port + , CORBA::Object_ptr obj) + { + TreeNode* transaction = 0; + ACE_CString s; + s = plan + TreeNode::delimiter_ + inst; + if (0 < port.length()) + { + s += TreeNode::delimiter_ + port; + } + + if (0 == this->transactions_.find (plan, transaction)) + { + ACE_CString path = inst; + if (0 < port.length()) + { + path += TreeNode::delimiter_ + port; + } + transaction->addChild (path.c_str(), obj); + } + else + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::register_object - transaction record for \"%s\" doesn't exist.\n" + , plan.c_str())); + + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::register_object - registering \"%s\"\n" + , s.c_str())); + this->db_.addChild (s.c_str(), obj); + } + + PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId (s.c_str()); + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::register_object obj id : \"%s\"\n", PortableServer::ObjectId_to_string (oid.in()))); + CORBA::Object_var o = this->myPOA_->create_reference_with_id (oid.in(), "IDL:omg.org/CORBA/Object:1.0"); + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::register_object url : \"%s\"\n", this->orb_->object_to_string (o))); + + //--------------- Temporal workaround +// CORBA::Object_var table_object = +// this->orb_->resolve_initial_references ("IORTable" ); +// +// IORTable::Table_var adapter = +// IORTable::Table::_narrow (table_object.in () ); +// +// adapter->bind(s.c_str(), this->orb_->object_to_string(o)); + //--------------- + return o._retn(); + } + + CORBA::Object_ptr + CCMObjectLocator::register_object (const ACE_CString & app + , const ACE_CString & inst + , CORBA::Object_ptr obj) + { + return this->register_object (app, inst, "", obj); + } + + void + CCMObjectLocator::register_objects (const char * name, TreeNode & node) + { + this->db_.addChild (name, node); + } + + void + CCMObjectLocator::finish_register (const ACE_CString& plan) + { + TreeNode* tree = 0; + if (0 != this->transactions_.find (plan, tree)) + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::finish_register - can't find \"%s\" record for register\n", plan.c_str())); + return; + } + this->register_objects (plan.c_str(), *tree); + this->transactions_.unbind (plan); + delete tree; + + } + + void + CCMObjectLocator::unregister_object (const ACE_CString & app + , const ACE_CString & inst + , const ACE_CString & port) + { + ACE_CString s = app + TreeNode::delimiter_ + inst; + if (0 < inst.length()) + { + s += TreeNode::delimiter_ + inst; + if (0 < port.length()) + { + s += TreeNode::delimiter_ + port; + } + } + this->db_.removeChild (s.c_str()); + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::unregister_object - unregistering \"%s\"\n" + , s.c_str())); + } + + ACE_CString + CCMObjectLocator::TreeNode::mergePath (const char * parent, const char * child) + { + return ACE_CString (parent) + delimiter_ + child; + } + + ACE_CString + CCMObjectLocator::TreeNode::splitPath (ACE_CString & path, bool first) + { + size_t pos = first + ? path.find (CCMObjectLocator::TreeNode::delimiter_) + : path.rfind (CCMObjectLocator::TreeNode::delimiter_); + /* if ( 0 == pos ) + { + path = path.substring(1); Cuts off a leading delimiter + }*/ + ACE_CString res; + if (ACE_CString::npos == pos) + { + res = path; + path = ""; + } + else + { + res = path.substring (0, pos); + path = path.substring (pos + 1); + } + return res; + } + + CCMObjectLocator::TreeNode::TreeNode (const TreeNode & src) + : obj_ (src.obj_) + { + TNodes::const_iterator it (src.children_); + for (;!it.done(); ++it) + { + this->children_.bind ( (*it).ext_id_, new TreeNode (* (*it).int_id_)); + } + } + + CCMObjectLocator::TreeNode::~TreeNode() + { + for (TNodes::iterator it = this->children_.begin(); !it.done(); ++it) + { + TreeNode * p = (*it).int_id_; + (*it).int_id_ = 0; + delete p; + } + this->children_.unbind_all(); + } + + CORBA::Object_ptr + CCMObjectLocator::TreeNode::getValue (const char * path) const + { + const TreeNode * p = this->getChild (path); + if (0 != p) + { + return p->getValue(); + } + else + { + return CORBA::Object::_nil(); + } + } + + CCMObjectLocator::TreeNode * + CCMObjectLocator::TreeNode::getChild (const char * path) const + { + ACE_CString path_loc = path; + ACE_CString s = splitPath (path_loc); + + TreeNode * res = 0; + if (0 == this->children_.find (s, res)) + { + return 0 == path_loc.length() ? res : res->getChild (path_loc.c_str()); + } + else + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::TreeNode::getChild - Node \"%s\" not found.\n" + , s.c_str())); + return 0; + } + } + + void + CCMObjectLocator::TreeNode::addChild (const char * path, CORBA::Object_ptr obj) + { + ACE_CString path_loc = path; + ACE_CString child = splitPath (path_loc); + + TreeNode * p = 0; +// DANCE_DEBUG((LM_DEBUG, "[%M] CCMObjectLocator::TreeNode::addChild looking for %C in map with %i.\n" +// , child.c_str() +// , this->children_.current_size())); + + if (0 != this->children_.find (child, p)) + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::TreeNode::addChild - create new Node.\n")); + p = new TreeNode; + this->children_.bind (child, p); + } +// DANCE_DEBUG((LM_DEBUG, "[%M] CCMObjectLocator::TreeNode::addChild - Check for path.")); + if (0 == path_loc.length()) // i.e. empty + { + p->setValue (obj); + } + else + { + p->addChild (path_loc.c_str(), obj); + } + } + + void + CCMObjectLocator::TreeNode::removeChild (const char * path) + { + ACE_CString path_loc = path; + ACE_CString child = splitPath (path_loc); + + TreeNode * p = 0; + if (0 != this->children_.find (child, p)) + { + DANCE_ERROR ( (LM_ERROR, "[%M] CCMObjectLocator::TreeNode::removeChild failed. Node \"%s\" is missing.\n" + , child.c_str())); + } + if (0 == path_loc.length()) // i.e. empty + { + delete p; + } + else + { + p->removeChild (path_loc.c_str()); + } + } + + int + CCMObjectLocator::TreeNode::missingNodeLevel (const char * path) + { + ACE_CString path_loc = path; + ACE_CString child = splitPath (path_loc); + + TreeNode * p = 0; + if (0 != this->children_.find (child, p)) + { + return 1; + } + else + { + if (0 == path_loc.length()) + { + return -1; + } + else + { + int i = p->missingNodeLevel (path_loc.c_str()); + return 0 > i ? -1 : i + 1; + } + } + } + + void + CCMObjectLocator::TreeNode::addChild (const char * path, TreeNode & node) + { + ACE_CString path_loc = path; + ACE_CString child = splitPath (path_loc); + if (0 == path_loc.length()) + { + TreeNode * p = 0; + if (0 == this->children_.find (child, p)) + { + DANCE_DEBUG ( (LM_DEBUG, "[%M] CCMObjectLocator::TreeNode::register_objects - " + "node \"%s\" already exists. Replacing.\n" + , child.c_str())); + this->children_.unbind (child); + delete p; + p = 0; + } + this->children_.bind (child, new TreeNode (node)); + } + else + { + TreeNode * p = 0; + if (0 != this->children_.find (child, p)) + { + p = new TreeNode(); + } + p->addChild (path_loc.c_str(), node); + } + } + +} // DAnCE + diff --git a/CIAO/DAnCE/RedirectionService/CCMObjectLocator.h b/CIAO/DAnCE/RedirectionService/CCMObjectLocator.h new file mode 100644 index 00000000000..127d940bfa2 --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/CCMObjectLocator.h @@ -0,0 +1,107 @@ +// $Id$ + +#ifndef CCMOBJECTLOCATOR_H_ +#define CCMOBJECTLOCATOR_H_ + +#include "ace/Map_Manager.h" +#include "ace/Null_Mutex.h" +#include "ace/SStringfwd.h" +#include "ace/String_Base.h" +#include "tao/corba.h" +#include "tao/ORB.h" +#include "tao/Object.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantLocatorC.h" + +#include "RedirectionService_Export.h" + +namespace DAnCE +{ + + class RedirectionService_Export CCMObjectLocator + : public PortableServer::ServantLocator + , public ::CORBA::LocalObject + { + public: + class TreeNode; + typedef ACE_Map_Manager<ACE_CString, TreeNode*, ACE_Null_Mutex> TNodes; + class TreeNode + { + public: + static const char delimiter_ = '/'; + TreeNode() {}; + TreeNode (const TreeNode & src); + ~TreeNode(); + CORBA::Object_ptr getValue() const + { + return CORBA::Object::_duplicate (this->obj_.in()); + }; + CORBA::Object_ptr getValue (const char * path) const; + void setValue (CORBA::Object_ptr obj) + { + this->obj_ = CORBA::Object::_duplicate (obj); + }; + void addChild (const char * path, CORBA::Object_ptr obj = CORBA::Object::_nil()); + void addChild (const char * path, TreeNode & node); + void removeChild (const char * path); + int missingNodeLevel (const char * path); + static ACE_CString mergePath (const char * parent, const char * child); + private: + CORBA::Object_var obj_; + TNodes children_; + TreeNode * getChild (const char * path) const; + static ACE_CString splitPath (ACE_CString & path, bool first = true); + }; + + CCMObjectLocator (CORBA::ORB_ptr orb, PortableServer::POA_ptr parent_poa, const char * poa_name); + + + ~CCMObjectLocator(); + + virtual ::PortableServer::Servant preinvoke ( + const ::PortableServer::ObjectId & oid, + ::PortableServer::POA_ptr adapter, + const char * operation, + ::PortableServer::ServantLocator::Cookie & the_cookie + ); + + virtual void postinvoke ( + const ::PortableServer::ObjectId & /*oid*/, + ::PortableServer::POA_ptr /*adapter*/, + const char * /*operation*/, + ::PortableServer::ServantLocator::Cookie /*the_cookie*/, + ::PortableServer::Servant /*the_servant*/ + ); + + void start_register (const ACE_CString& plan); + + CORBA::Object_ptr register_object (const ACE_CString & plan + , const ACE_CString & inst + , const ACE_CString & port + , CORBA::Object_ptr obj); + + CORBA::Object_ptr register_object (const ACE_CString & plan + , const ACE_CString & inst + , CORBA::Object_ptr obj); + + void unregister_object (const ACE_CString & plan + , const ACE_CString & inst + , const ACE_CString & port); + + void finish_register (const ACE_CString& plan); + + void register_objects (const char * name, TreeNode & node); + + private: + TreeNode db_; + CORBA::ORB_var orb_; + PortableServer::POA_var myPOA_; + + TNodes transactions_; + CCMObjectLocator() {}; + // to ban the usage + }; // CCMObjectLocator + +} //DAnCE + +#endif /*CCMOBJECTLOCATOR_H_*/ diff --git a/CIAO/DAnCE/RedirectionService/NameServiceRedirection.cpp b/CIAO/DAnCE/RedirectionService/NameServiceRedirection.cpp new file mode 100644 index 00000000000..c5c5c0c86b2 --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/NameServiceRedirection.cpp @@ -0,0 +1,271 @@ +// $Id$ + +#include "NameServiceRedirection.h" +#include "DAnCE/Logger/Log_Macros.h" + +using namespace DAnCE; + +NameServiceRedirection::NameServiceRedirection (CosNaming::NamingContext_ptr naming, + CosNaming::NamingContext_ptr domain) + : naming_ (CosNaming::NamingContext::_duplicate (naming)), + domain_ (CosNaming::NamingContext::_duplicate (domain)) +{ +} + +NameServiceRedirection::~NameServiceRedirection() +{ +} + +void +NameServiceRedirection::start_binding (const ACE_CString& node, const ACE_CString& plan) +{ + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::start_binding for node %s plan %s.\n", + node.c_str(), + plan.c_str())); + ACE_CString key = node + plan; + TRecords* records = 0; + if (0 != this->transactions_.find (key, records)) + { + records = new TRecords(); + this->transactions_.rebind (key, records); + } + else + { + records->clear(); + } +} + +void +NameServiceRedirection::bind (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, const ACE_CString& port, CORBA::Object_ptr obj) +{ + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::bind for node %s plan %s component %s and port %s is started.\n", + node.c_str(), + plan.c_str(), + component.c_str(), + port.c_str())); + SRecord record; + record.name.length (4); + + ACE_CString kind = ""; + CosNaming::NamingContext_var node_context = this->resolve_context (node, kind, this->naming_.in()); + record.name[0].id = CORBA::string_dup (node.c_str()); + record.name[0].kind = CORBA::string_dup (kind.c_str()); + + kind = "DeploymentPlan"; + CosNaming::NamingContext_var plan_context = this->resolve_context (plan, kind, node_context.in()); + record.name[1].id = CORBA::string_dup (plan.c_str()); + record.name[1].kind = CORBA::string_dup (kind.c_str()); + + kind = ""; + CosNaming::NamingContext_var component_context = this->resolve_context (component, kind, plan_context.in()); + record.name[2].id = CORBA::string_dup (component.c_str()); + record.name[2].kind = CORBA::string_dup (kind.c_str()); + + record.name[3].id = CORBA::string_dup (port.c_str()); + record.name[3].kind = CORBA::string_dup ("Port"); + + ACE_CString key = node + plan; + TRecords* records = 0; + if (0 != this->transactions_.find (key, records)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NameServiceRedirection::bind - Cann't find record %C for closing transaction.\n", key.c_str())); + return; + } + + record.obj = CORBA::Object::_duplicate (obj); + records->push_back (record); + + // try{ + // component_context->bind(name, obj); + // } + // catch(CosNaming::NamingContext::AlreadyBound&) + // { + // component_context->rebind(name, obj); + // } + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::bind has finished.\n")); +} + +void +NameServiceRedirection::bind (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, CORBA::Object_ptr obj) +{ + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::bind for node %s plan %s and component %s is started.\n", + node.c_str(), + plan.c_str(), + component.c_str())); + SRecord record; + record.name.length (3); + + ACE_CString kind = ""; + CosNaming::NamingContext_var node_context = this->resolve_context (node, kind, this->naming_.in()); + + record.name[0].id = CORBA::string_dup (node.c_str()); + record.name[0].kind = CORBA::string_dup (kind.c_str()); + + kind = "DeploymentPlan"; + CosNaming::NamingContext_var plan_context = this->resolve_context (plan, kind, node_context.in()); + + record.name[1].id = CORBA::string_dup (plan.c_str()); + record.name[1].kind = CORBA::string_dup (kind.c_str()); + + ACE_CString key = node + plan; + TRecords* records = 0; + if (0 != this->transactions_.find (key, records)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NameServiceRedirection::bind - Cann't find record %s for closing transaction.\n", key.c_str())); + return; + } + + record.name[2].id = CORBA::string_dup (component.c_str()); + record.name[2].kind = CORBA::string_dup ("Component"); + + record.obj = CORBA::Object::_duplicate (obj); + + records->push_back (record); + // try{ + // plan_context->bind(name, obj); + // } + // catch(CosNaming::NamingContext::AlreadyBound&) + // { + // DANCE_DEBUG((LM_DEBUG, "[%M] NameServiceRedirection::bind - Already bound exception was thrown. Rebinding\n")); + // plan_context->rebind(name, obj); + // } + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::bind has finished.\n")); +} + +void +NameServiceRedirection::finish_binding (const ACE_CString& node, const ACE_CString& plan) +{ + ACE_CString key = node + plan; + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::finish_binding started for %s.\n", key.c_str())); + TRecords* records = 0; + if (0 != this->transactions_.find (key, records)) + { + DANCE_ERROR ((LM_ERROR, DLINFO "NameServiceRedirection::finish_binding - Cann't find record %s for closing transaction.\n", key.c_str())); + return; + } + for (unsigned int i = 0; i < records->size(); i++) + { + //this->naming_->bind((*records)[i].name, (*records)[i].obj.in()); + try + { + this->naming_->bind ( (*records) [i].name, (*records) [i].obj.in()); + } + catch (CosNaming::NamingContext::AlreadyBound&) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::finish_bind - Already bound exception was thrown. Rebinding\n")); + this->naming_->rebind ( (*records) [i].name, (*records) [i].obj.in()); + } + + } + if (!CORBA::is_nil (this->domain_.in())) + { + ACE_CString kind = ""; + CosNaming::NamingContext_var context = this->resolve_context (node, kind, this->naming_.in()); + CosNaming::Name name; + name.length (1); + name[0].id = CORBA::string_dup (node.c_str()); + name[0].kind = CORBA::string_dup (kind.c_str()); + try + { + this->domain_->bind_context (name, context.in()); + } + catch (CosNaming::NamingContext::AlreadyBound&) + { + this->domain_->rebind_context (name, context.in()); + } + } + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::finish_bind has finished.\n")); +} + +void +NameServiceRedirection::unbind_context (const ACE_CString& node, const ACE_CString& plan) +{ + DANCE_DEBUG ( (LM_TRACE, "[%M] NameServiceRedirection::unbind_context started...\n")); + ACE_CString kind = ""; + CosNaming::NamingContext_var node_context = this->resolve_context (node, kind, this->naming_.in()); + kind = "DeploymentPlan"; + CosNaming::NamingContext_var plan_context = this->resolve_context (plan, kind, node_context.in()); + DANCE_DEBUG ( (LM_TRACE, "[%M] NameServiceRedirection::unbind_context before clear_context for %s.%s\n", plan.c_str(), kind.c_str())); + this->clear_context (plan_context.inout()); + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup (plan.c_str()); + name[0].kind = CORBA::string_dup (kind.c_str()); + DANCE_DEBUG ( (LM_TRACE, "[%M] NameServiceRedirection::unbind_context before unbinding %s.%s\n" + , name[0].id.in(), name[0].kind.in())); + node_context->unbind (name); + DANCE_DEBUG ( (LM_TRACE, "[%M] NameServiceRedirection::unbind_context before destroying plan context.\n")); + plan_context->destroy(); + DANCE_DEBUG ( (LM_TRACE, "[%M] NameServiceRedirection::unbind_context fininshed.\n")); +} + +CosNaming::NamingContext_ptr +NameServiceRedirection::resolve_context (const ACE_CString& context_name, const ACE_CString& context_kind, CosNaming::NamingContext_ptr naming) +{ + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::resolve_context is started for context %s.%s\n", context_name.c_str(), context_kind.c_str())); + if (CORBA::is_nil (naming)) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::resolve_context source context is nil!.\n")); + return CosNaming::NamingContext::_nil (); + } + CORBA::Object_var obj; + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup (context_name.c_str()); + name[0].kind = CORBA::string_dup (context_kind.c_str()); + try + { + obj = naming->resolve (name); + } + catch (const CosNaming::NamingContext::NotFound&) + { + obj = naming->bind_new_context (name); + } + DANCE_DEBUG ((LM_DEBUG, DLINFO "NameServiceRedirection::resolve_context has finished.\n")); + return CosNaming::NamingContext::_narrow (obj._retn()); +} + +void +NameServiceRedirection::clear_context (CosNaming::NamingContext_ptr& naming) +{ + CosNaming::BindingList_var bl; + CosNaming::BindingIterator_var bi; + naming->list (0, bl.out(), bi.out()); + + if (CORBA::is_nil (bi.in())) + { + return; + } + while (bi->next_n (100, bl.out())) + { + for (unsigned int i = 0; i < bl->length(); i++) + { + if (bl[i].binding_type == CosNaming::ncontext) + { + CORBA::Object_var obj = naming->resolve ( (*bl) [i].binding_name); + CosNaming::NamingContext_var sub_context = CosNaming::NamingContext::_narrow (obj); + this->clear_context (sub_context.inout()); + naming->unbind ( (*bl) [i].binding_name); + sub_context->destroy(); + } + else + { + naming->unbind ( (*bl) [i].binding_name); + } + } + } +} + +void +NameServiceRedirection::add_node (const ACE_CString& node) +{ + CosNaming::NamingContext_var new_nc = this->resolve_context (node, "", this->naming_); + if (!CORBA::is_nil (this->domain_.in())) + { + CosNaming::Name name; + name.length (1); + name[0].id = CORBA::string_dup (node.c_str()); + name[0].kind = CORBA::string_dup (""); + this->domain_->bind_context (name, new_nc.in()); + } +} diff --git a/CIAO/DAnCE/RedirectionService/NameServiceRedirection.h b/CIAO/DAnCE/RedirectionService/NameServiceRedirection.h new file mode 100644 index 00000000000..f58fa65f1cd --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/NameServiceRedirection.h @@ -0,0 +1,57 @@ +// $Id$ + +#ifndef NAMESERVICEREDIRECTION_H_ +#define NAMESERVICEREDIRECTION_H_ + +#include "ace/SString.h" +#include "ace/Vector_T.h" +#include "ace/Map_Manager.h" +#include "ace/Null_Mutex.h" +#include "orbsvcs/orbsvcs/CosNamingC.h" + +#include "RedirectionService_Export.h" + +namespace DAnCE + { + + class RedirectionService_Export NameServiceRedirection + { + public: + NameServiceRedirection (CosNaming::NamingContext_ptr hosting_naming, + CosNaming::NamingContext_ptr domain_naming); + + ~NameServiceRedirection(); + + void start_binding (const ACE_CString& node, const ACE_CString& plan); + /// Registration for port object + void bind (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, const ACE_CString& port, CORBA::Object_ptr obj); + /// Registration for component object + void bind (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, CORBA::Object_ptr obj); + + void finish_binding (const ACE_CString& node, const ACE_CString& plan); + // Removes all records for specified plan + void unbind_context (const ACE_CString& node, const ACE_CString& plan); + + void add_node (const ACE_CString& node); + + protected: + CosNaming::NamingContext_ptr resolve_context (const ACE_CString& name, const ACE_CString& kind, CosNaming::NamingContext_ptr naming); + + void clear_context (CosNaming::NamingContext_ptr& naming); + + private: + CosNaming::NamingContext_var naming_; + CosNaming::NamingContext_var domain_; + + struct SRecord + { + CosNaming::Name name; + CORBA::Object_var obj; + }; + + typedef ACE_Vector<SRecord> TRecords; + typedef ACE_Map_Manager<ACE_CString, TRecords*, ACE_Null_Mutex> TTransactions; + TTransactions transactions_; + }; +}; +#endif /*NAMESERVICEREDIRECTION_H_*/ diff --git a/CIAO/DAnCE/RedirectionService/RedirectionService.cpp b/CIAO/DAnCE/RedirectionService/RedirectionService.cpp new file mode 100644 index 00000000000..e79673bfa4c --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/RedirectionService.cpp @@ -0,0 +1,162 @@ +// $Id$ + +#include "RedirectionService.h" +#include "DAnCE/Logger/Log_Macros.h" + +using namespace DAnCE; + +RedirectionService::RedirectionService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNaming::NamingContext_ptr hosting_naming, + CosNaming::NamingContext_ptr domain_naming, + bool ns, + bool sl) + : orb_ (CORBA::ORB::_duplicate (orb)) + , poa_ (PortableServer::POA::_duplicate (poa)) + , naming_ (hosting_naming, domain_naming) + , ns_ (ns) + , sl_ (sl) +{ + DANCE_TRACE ("RedirectionService::RedirectionService"); + if (this->ns_) + { + if (CORBA::is_nil (hosting_naming)) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "RedirectionService::RedirectionService - " + "Name Service redirection is enabled but name context is nil.\n")); + } + } +} + +RedirectionService::~RedirectionService() +{ + DANCE_TRACE ("RedirectionService::~RedirectionService"); + for (TLocators::iterator it = this->locators_.begin (); + it != this->locators_.end (); + ++it) + { + delete (*it).int_id_; + } +} + +void +RedirectionService::add_node (const ACE_CString& node) +{ + DANCE_TRACE ("RedirectionService::add_node"); + if (this->sl_) + { + CCMObjectLocator* locator = 0; + if (0 != this->locators_.find (node, locator)) + { + locator = new CCMObjectLocator (this->orb_.in(), this->poa_.in(), node.c_str()); + this->locators_.rebind (node, locator); + } + } + + if (this->ns_) + { + this->naming_.add_node (node); + } +} + +void +RedirectionService::registration_start (const ACE_CString& node, const ACE_CString& plan) +{ + DANCE_TRACE ("RedirectionService::registration_start"); + if (this->sl_) + { + CCMObjectLocator* locator = 0; + if (0 != this->locators_.find (node, locator)) + { + locator = new CCMObjectLocator (this->orb_.in(), this->poa_.in(), node.c_str()); + this->locators_.rebind (node, locator); + } + locator->start_register (plan); + } + if (this->ns_) + { + this->naming_.start_binding (node, plan); + } +} + +void +RedirectionService::registration (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, const ACE_CString& port, CORBA::Object_ptr obj) +{ + DANCE_TRACE ("RedirectionService::registration"); + DANCE_DEBUG ((LM_DEBUG, DLINFO "RedirectionService::registration - " + "for node %s plan %s component %s and port %s is started.\n", + node.c_str(), + plan.c_str(), + component.c_str(), + port.c_str())); + CORBA::Object_var ns_obj = CORBA::Object::_duplicate (obj); + if (this->sl_) + { + CCMObjectLocator* locator = 0; + if (0 != this->locators_.find (node, locator)) + { + locator = new CCMObjectLocator (this->orb_.in(), this->poa_.in(), node.c_str()); + this->locators_.rebind (node, locator); + } + ns_obj = locator->register_object (plan, component, port, obj); + } + if (this->ns_) + { + if (0 == port.length()) + { + this->naming_.bind (node, plan, component, ns_obj.in()); + } + else + { + this->naming_.bind (node, plan, component, port, ns_obj.in()); + } + } + DANCE_DEBUG ((LM_DEBUG, DLINFO "RedirectionService::registration - " + "Registration has been finished.\n")); +} + +void +RedirectionService::registration (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, CORBA::Object_ptr obj) +{ + DANCE_TRACE ("RedirectionService::registration"); + this->registration (node, plan, component, "", obj); +} + +void +RedirectionService::registration_finish (const ACE_CString& node, const ACE_CString& plan) +{ + DANCE_TRACE ("RedirectionService::registration_finish"); + if (this->sl_) + { + CCMObjectLocator* locator; + if (0 != this->locators_.find (node, locator)) + { + locator = new CCMObjectLocator (this->orb_.in(), this->poa_.in(), node.c_str()); + this->locators_.rebind (node, locator); + } + locator->finish_register (plan); + } + if (this->ns_) + { + this->naming_.finish_binding (node, plan); + } +} + +void +RedirectionService::unregister (const ACE_CString& node, const ACE_CString& plan) +{ + DANCE_TRACE ("RedirectionService::unregister"); + DANCE_DEBUG((LM_TRACE, DLINFO "RedirectionService::unregister - " + "unregistering %s/%s...\n", node.c_str(), plan.c_str())); + if (this->ns_) + { + this->naming_.unbind_context (node, plan); + DANCE_DEBUG((LM_TRACE, DLINFO "RedirectionService::unregister - " + "finished.\n")); + } + else + { + DANCE_DEBUG((LM_TRACE, DLINFO "RedirectionService::unregister - " + "nothing to do.\n")); + } +} diff --git a/CIAO/DAnCE/RedirectionService/RedirectionService.h b/CIAO/DAnCE/RedirectionService/RedirectionService.h new file mode 100644 index 00000000000..9b039f19206 --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/RedirectionService.h @@ -0,0 +1,74 @@ +#ifndef REDIRECTIONSERVICE_H_ +#define REDIRECTIONSERVICE_H_ + +#include "ace/Map_Manager.h" +#include "tao/PortableServer/PortableServer.h" +#include "orbsvcs/orbsvcs/CosNamingC.h" + +#include "RedirectionService_Export.h" + +#include "CCMObjectLocator.h" +#include "NameServiceRedirection.h" + +/* + This class encapsulates redirection mechanisms for dance offline deployment. + It contains NameService and ServantLocator classes with correspondent poas + and hides from NodeApplication all specific steps required for supporting redirection + If no NameService nor ServantLocator is not required when registration methods do nothing. +*/ +namespace DAnCE + { + class RedirectionService_Export RedirectionService + { + public: + /// Constructor for redirection service object + /// In general, redirection service should be singleton in scope of dance agent process + /// but probably it is not compulsory + /// parameter hosting_context is compulsory if ns is true + /// parameter domain_context should be specified if we need to bind local contextes to external context + /// parameter ns should be passed as true if NameService redirection mechanism should be used + /// parameter sl should be passed as true if ServantLocator redirection should be used + /// parameter poa should be root poa (? probably this parameter is unnecessary and this class can obtains from orb) + RedirectionService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNaming::NamingContext_ptr hosting_context, + CosNaming::NamingContext_ptr domain_context, + bool ns = false, + bool sl = false); + + ~RedirectionService (); + /// Creates record in redirection service for correspondent node + void add_node (const ACE_CString& node); + /// Opens transaction for registering node ccm objects. + /// Parameters node and plan are the keys + void registration_start (const ACE_CString& node, const ACE_CString& plan); + /// Registration for port object + void registration (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, const ACE_CString& port, CORBA::Object_ptr obj); + /// Registration for component object + void registration (const ACE_CString& node, const ACE_CString& plan, const ACE_CString& component, CORBA::Object_ptr obj); + /// Closes transaction for registering node ccm objects + /// and insert node to correspondent ServantLocator and/or NameService + /// Parameters node and plan are the keys + void registration_finish (const ACE_CString& node, const ACE_CString& plan); + // Removes all records for specified plan + void unregister (const ACE_CString& node, const ACE_CString& plan); + private: + /// Orb variable + CORBA::ORB_var orb_; + + /// Root POA variable + PortableServer::POA_var poa_; + + NameServiceRedirection naming_; + + bool ns_; + + bool sl_; + + /// Map of servant locators (node name is a key) + typedef ACE_Map_Manager<ACE_CString, DAnCE::CCMObjectLocator*, ACE_Null_Mutex> TLocators; + TLocators locators_; + }; +}; + +#endif /*REDIRECTIONSERVICE_H_*/ diff --git a/CIAO/DAnCE/RedirectionService/RedirectionService.mpc b/CIAO/DAnCE/RedirectionService/RedirectionService.mpc new file mode 100644 index 00000000000..08f0cd6f462 --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/RedirectionService.mpc @@ -0,0 +1,14 @@ +// -*- MPC -*- +// $Id$ + +project : taolib, tao_output, iortable, naming, dance_logger { + sharedname = DAnCE_RedirectionService + dynamicflags += REDIRECTIONSERVICE_BUILD_DLL + + Source_Files { + RedirectionService.cpp + NameServiceRedirection.cpp + CCMObjectLocator.cpp + } +} + diff --git a/CIAO/DAnCE/RedirectionService/RedirectionService_Export.h b/CIAO/DAnCE/RedirectionService/RedirectionService_Export.h new file mode 100644 index 00000000000..af8e613acfc --- /dev/null +++ b/CIAO/DAnCE/RedirectionService/RedirectionService_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RedirectionService +// ------------------------------ +#ifndef REDIRECTIONSERVICE_EXPORT_H +#define REDIRECTIONSERVICE_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (REDIRECTIONSERVICE_HAS_DLL) +# define REDIRECTIONSERVICE_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && REDIRECTIONSERVICE_HAS_DLL */ + +#if !defined (REDIRECTIONSERVICE_HAS_DLL) +# define REDIRECTIONSERVICE_HAS_DLL 1 +#endif /* ! REDIRECTIONSERVICE_HAS_DLL */ + +#if defined (REDIRECTIONSERVICE_HAS_DLL) && (REDIRECTIONSERVICE_HAS_DLL == 1) +# if defined (REDIRECTIONSERVICE_BUILD_DLL) +# define RedirectionService_Export ACE_Proper_Export_Flag +# define REDIRECTIONSERVICE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define REDIRECTIONSERVICE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* REDIRECTIONSERVICE_BUILD_DLL */ +# define RedirectionService_Export ACE_Proper_Import_Flag +# define REDIRECTIONSERVICE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define REDIRECTIONSERVICE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* REDIRECTIONSERVICE_BUILD_DLL */ +#else /* REDIRECTIONSERVICE_HAS_DLL == 1 */ +# define RedirectionService_Export +# define REDIRECTIONSERVICE_SINGLETON_DECLARATION(T) +# define REDIRECTIONSERVICE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* REDIRECTIONSERVICE_HAS_DLL == 1 */ + +// Set REDIRECTIONSERVICE_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (REDIRECTIONSERVICE_NTRACE) +# if (ACE_NTRACE == 1) +# define REDIRECTIONSERVICE_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define REDIRECTIONSERVICE_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !REDIRECTIONSERVICE_NTRACE */ + +#if (REDIRECTIONSERVICE_NTRACE == 1) +# define REDIRECTIONSERVICE_TRACE(X) +#else /* (REDIRECTIONSERVICE_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define REDIRECTIONSERVICE_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (REDIRECTIONSERVICE_NTRACE == 1) */ + +#endif /* REDIRECTIONSERVICE_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc b/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc index d14d97843cd..ed13535d7ad 100644 --- a/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc +++ b/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc @@ -4,8 +4,8 @@ //RepositoryManager project: implementation of a repository manager //compleint with the D&C spec -project (RepositoryManager) : ciao_server_dnc, ciao_config_handlers, zlib, ciaoexe { - +project (RepositoryManager) : ccm_stub { //ciao_server_dnc, ciao_config_handlers, zlib, ciaoexe { + requires += dummy_label includes += $(CIAO_ROOT)/tools/Config_Handlers $(ACE_ROOT)/contrib/minizip //to circumvent an improper include resolution //in the Package_Handlers/PC_Intf.h @@ -36,7 +36,8 @@ project (RepositoryManager) : ciao_server_dnc, ciao_config_handlers, zlib, ciaoe // RMadmin project: a sample client for the RM. -project (RMAdmin) : ciao_servant_dnc, ciao_config_handlers, ciaoexe { +project (RMAdmin) : ccm_stub { //ciao_servant_dnc, ciao_config_handlers, ciaoexe { + requires += dummy_label exename = RMadmin after += RepositoryManager diff --git a/CIAO/DAnCE/Starter/DAnCELoggerFactory.h b/CIAO/DAnCE/Starter/DAnCELoggerFactory.h new file mode 100644 index 00000000000..1efd071621d --- /dev/null +++ b/CIAO/DAnCE/Starter/DAnCELoggerFactory.h @@ -0,0 +1,18 @@ +#ifndef LOGGERFACTORY_H_ +#define LOGGERFACTORY_H_ + +#include "ace/Service_Object.h" +#include "tao/ORB.h" +#include "ace/Log_Msg_Backend.h" + +namespace DAnCE + { + + class DAnCELoggerFactory : public ACE_Service_Object + { + public: + virtual ACE_Log_Msg_Backend * get_logger_backend (CORBA::ORB_ptr orb) = 0; + }; +} // DAnCE + +#endif /*LOGGERFACTORY_H_*/ diff --git a/CIAO/DAnCE/Starter/Starter.cpp b/CIAO/DAnCE/Starter/Starter.cpp new file mode 100644 index 00000000000..4a21110f722 --- /dev/null +++ b/CIAO/DAnCE/Starter/Starter.cpp @@ -0,0 +1,925 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Starter.cpp + * + * $Id$ + * + * @Brief Dynamically runs libraries + * + * @author Vinzenz Tornow <vt@prismtech.com> + */ +//============================================================================= + +#include "Starter.h" +#include "ace/Service_Config.h" +#include "ace/Thread_Manager.h" +#include "ace/DLL.h" +#include "ace/Get_Opt.h" +#include "tao/ORB.h" +#include "tao/Object.h" +#include "tao/PortableServer/PortableServer.h" +#include "DAnCELoggerFactory.h" +#include "tao/Object_Loader.h" +#include "tao/IORTable/IORTable.h" +#include "DAnCE/Logger/Log_Macros.h" + +using namespace DAnCE; + +#ifdef DANCE_BUILD_STARTER_EXE + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + Starter starter (argc, argv); + starter.execute(); + return 0; + } + catch (ACE_CString & e) + { + DANCE_ERROR ( (LM_ERROR, "[%M] dance starter failed with an exception : \"%s\"\n", e.c_str())); + } + catch (CORBA::Exception & e) + { + DANCE_ERROR ( (LM_ERROR, "[%M] dance starter failed with an CORBA exception : \"%s\"\n", e._info().c_str())); + } + catch (...) + { + DANCE_ERROR ( (LM_ERROR, "[%M] dance starter failed with an unknown exception.\n")); + } + return -1; +} + +#endif /* DANCE_BUILD_STARTER_EXE */ + +namespace DAnCE +{ + +Starter::Starter(int argc, ACE_TCHAR * argv[]) : + orb_(CORBA::ORB_init (argc, argv, "")), + optLogLevel_(5), //default + argc_(argc), + argv_(argv), + optNS_(false), + optEM_(false), + optPLB_(false), + optPL_(false) +{ + DANCE_TRACE ("DAnCE::Starter::Starter ()"); + + Logger_Service + * dlf = ACE_Dynamic_Service<Logger_Service>::instance ("DAnCE_Logger_Backend_Factory"); + + if (!dlf) + dlf = new Logger_Service; + + this->logger_.reset (dlf); + this->logger_->init (argc, argv); + + DANCE_DEBUG ((LM_TRACE, DLINFO + "Starter::Starter - Creating starter...\n")); + + this->parseArgs(argc, argv); + + this->configure_logging_backend (); + + DANCE_DEBUG ((LM_TRACE, DLINFO + "Starter::Starter - Starter was created successfully.\n")); +} + +Starter::~Starter() +{ + DANCE_TRACE ("Starter::~Starter"); +/* TAO_Object_Loader + * loader = ACE_Dynamic_Service<TAO_Object_Loader>::instance ("ExecutionManager_Loader"); + if (0 != loader) + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Starter::~Starter - removing EM ...\n")); + loader = 0; + ACE_Service_Config::remove ("ExecutionManager_Loader"); + } + loader + = ACE_Dynamic_Service<TAO_Object_Loader>::instance ("NodeManager_Loader"); + if (0 != loader) + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Starter::~Starter - removing NM ...\n")); + loader = 0; + ACE_Service_Config::remove ("NodeManager_Loader"); + } + + this->orb_._retn()->destroy(); */ +} + +void Starter::parseArgs(int argc, ACE_TCHAR * argv[]) +{ + DANCE_DEBUG ( (LM_TRACE, "[%M] Parsing starter's arguments...\n")); + + ACE_Get_Opt opts(argc, argv, "p::n:e::c::r::il:hg:x:d:qk:w:t:a:", 1, 0, + ACE_Get_Opt::RETURN_IN_ORDER); + opts.long_option("process-ns", 'p', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option("process-ns-options", ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("node-mgr", 'n', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("exec-mgr", 'e', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option("create-plan-ns", 'c', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option("rebind-plan-ns", 'r', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option("port-indirection", 'i', ACE_Get_Opt::NO_ARG); + opts.long_option("log-level", 'l', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("help", 'h', ACE_Get_Opt::NO_ARG); + opts.long_option("gen-object-key", 'g', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("read-plan", 'x', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("read-cdr-plan", 'd', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("stop-plan", 'q', ACE_Get_Opt::NO_ARG); + opts.long_option("em-ior", 'k', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("write-cdr-plan", 'w', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("plan-uuid", 't', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option("dam-ior", 'a', ACE_Get_Opt::ARG_REQUIRED); + + int j; + char c; + ACE_CString s; + while ( (c = opts ()) != -1) + { + DANCE_DEBUG((LM_TRACE, "[%M] Option : \"%s\" with argument \"%s\"\n", opts.last_option(), opts.opt_arg())); + switch (c) + { + case '?': + DANCE_ERROR ( (LM_ERROR, "[%M] Wrong option \"%s\" or this option is requred attribute!\n", opts.last_option())); + this->usage(); + throw ACE_CString("Error parsing starter arguments"); + break; + case 'p': + this->optNS_ = true; + DANCE_DEBUG ( (LM_TRACE, "[%M] Naming will be started.\n")); + this->optNSFile_ = opts.opt_arg(); + break; + case 'n': + s = opts.opt_arg(); + if (0 < s.length()) + { + ACE_CString nodename; + Node node; + size_t pos = s.find("="); + if (ACE_CString::npos != pos) + { + nodename = s.substring(0, pos); + node.ior_ = s.substring(pos + 1); + /* + node.obj = this->orb_->string_to_object(objstr.c_str()); + if (CORBA::is_nil (node.obj)) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed create object for node \"%s\"\n", nodename.c_str())); + throw ACE_CString ("Invalid IOR in --node-mgr option"); + } + */ + } + else + { + nodename = s; + DANCE_DEBUG ( (LM_TRACE, "[%M] Node \"%s\" will be started.\n", nodename.c_str())); + if (opts.optind < opts.argc_&& '-' != (s = opts.argv_[opts.optind])[0]) + { + ++opts.optind; + node.iorfile_ = s; + DANCE_DEBUG ( (LM_TRACE, "[%M] and its IOR will be written to file \"%s\".\n", node.iorfile_.c_str())); + } + + } + if (0 == this->nodes_.find(nodename)) + { + DANCE_ERROR((LM_ERROR, "[%M] Duplication of NM name \"%s\"\n", nodename.c_str())); + this->usage(); + throw ACE_CString("Duplication of NM name"); + } + this->nodes_.bind(nodename, node); + } + else + { + DANCE_ERROR ( (LM_ERROR, "[%M] --node-mgr option without arguments.\n")); + this->usage(); + throw ACE_CString ("--node-mgr option without arguments."); + } + break; + case 'e': + if (this->optEM_) + { + DANCE_DEBUG((LM_WARNING, "[%M] ExecutionManager option is encountered more than once. Second and following ignored.\n")); + break; + } + this->optEM_ = true; + DANCE_DEBUG ( (LM_TRACE, "[%M] ExecutionManager will be started.\n")); + this->optEMFile_ = opts.opt_arg(); + break; + case 'l': + j = ACE_OS::atoi (opts.opt_arg()); + if (j != 0) + { + this->optLogLevel_ = j; + } + else + { + DANCE_ERROR ( (LM_WARNING, "--log-level without argument. Using default.\n")); + } + break; + case 'h': + this->usage(); + break; + case 'x': + this->optPL_ = true; + DANCE_DEBUG ( (LM_TRACE, "[%M] PlanLauncher will be started.\n")); + break; + case 'd': + case 'q': + this->optPLB_ = true; + DANCE_DEBUG ( (LM_TRACE, "[%M] PlanLauncherBase will be started.\n")); + break; + case 'g': + DANCE_DEBUG ( (LM_TRACE, "[%M] Object key will be generated.\n")); + this->optGenObjKey_ = opts.opt_arg(); + if (0 == this->optGenObjKey_.length()) + { + DANCE_ERROR ( (LM_ERROR, "[%M] --gen-object-key without argument. Doing nothing.\n")); + } + break; + case 0: // long options that do not have short + s = opts.last_option(); + if (s == "process-ns-options") + { + this->optNSOptions_ = opts.opt_arg(); + if (0 == this->optNSOptions_.length()) + { + DANCE_ERROR ( (LM_ERROR, "[%M] --process-ns-options without argument\n")); + } + } + else + { + if (!isPossibleOption(s.c_str())) + { + DANCE_ERROR((LM_ERROR, "[%M] Invalid option : %s\n", s.c_str())); + } + } + break; + default: + if (!isPossibleOption(opts.last_option())) + { + DANCE_ERROR((LM_ERROR, "[%M] Invalid option : %s\n", opts.last_option())); + this->usage(); + } + break; + }//switch + }//while + + DANCE_DEBUG ( (LM_TRACE, "[%M] Parsing starter's arguments completed.\n")); +} + +void Starter::execute() +{ + DANCE_DEBUG ( (LM_TRACE, "[%M] Executing starter...\n")); + bool orb_run = false; + + // Generate object key + if (0 < this->optGenObjKey_.length()) + { + this->generateObjectKey(this->optGenObjKey_.c_str()); + } + + // Naming + if (this->optNS_) + { + this->initNaming(); + orb_run = true; + } + + // NodeManagers + for (ACE_Map_Manager<ACE_CString, Node, ACE_Null_Mutex>::iterator + it = this->nodes_.begin(); it != this->nodes_.end(); ++it) + { + if (!CORBA::is_nil ((*it).int_id_.obj) || 0 < (*it).int_id_.ior_.length()) + continue; + orb_run = true; + (*it).int_id_.obj = this->initNodeManager((*it).ext_id_.c_str()); + if (0 != (*it).int_id_.iorfile_.length()) + { + this->write_IOR((*it).int_id_.iorfile_.c_str(), this->orb_->object_to_string((*it).int_id_.obj)); + } + } + + // ExecutionManager + CORBA::Object_var em; + if (this->optEM_) + { + em = this->initExecutionManager(); + if ( !CORBA::is_nil(em) && 0 < this->optEMFile_.length()) + { + this->write_IOR(this->optEMFile_.c_str(), + this->orb_->object_to_string(em.in())); + } + orb_run = true; + } + + if (this->optPLB_ || this->optPL_) + { + this->runPlanLauncher(); + } + + if (orb_run) + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Running starter's ORB...\n")); + this->orb_->run(); + } + else + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Skipping starter's ORB->run.\n")); + } + DANCE_DEBUG ( (LM_TRACE, "[%M] Executing starter has completed.\n")); +} + +void Starter::usage() +{ + DANCE_ERROR ( (LM_EMERGENCY, "Usage : dance <options>\n" + "Options :\n" + "\t-l|--log-level <log level> - sets log level (default 5). 1 - most detailed.\n" + "\t-g|--gen-object-key \"<NODE_NAME> <PLAN_ID> <COMPONENT_ID> [<PORT_NAME>]\" - generates a corbaloc URL\n" + "\t-h|--help - shows this help\n" + "\t-p|--process-ns [IOR_FILE_NAME] - Instantiate a local name service within the DAnCE process. Export the root context to IOR_FILE if any.\n" + "\t--process-ns-options <options> - Specifies quoted string of options to be passed to name service. Depends on --process-ns option.\n" + "\t-e|--exec-mgr [IOR_FILE_NAME] - This process will have an execution manager and it's IOR will optionally be exported to IOR_FILE_NAME.\n" + "\t-n|--node-mgr name [IOR_FILE_NAME] - Create a named NodeManager in process and optionally export its IOR to IOR_FILE_NAME\n" + "\t-n|--node-mgr name=<IOR> - Place the NodeManager instance whose reference is IOR under the control of the ExecutionManager in this process (requires --exec-mgr).\n" + "In addition to the options above, the Service Configurator options are processed too.\n")); +} + +void Starter::generateObjectKey(const char * keyargs) +{ + ACE_CString args = keyargs; + ssize_t pos_start = 0; + ACE_CString node; + ACE_CString plan; + ACE_CString component; + ACE_CString port; + + // node + if (pos_start < (ssize_t) args.length()) + { + size_t pos_end = args.find(' ', pos_start); + if (ACE_CString::npos == pos_end) + { + node = args.substring(pos_start); + pos_start = args.length(); + } + else + { + node = args.substring(pos_start, pos_end - pos_start); + pos_start = pos_end + 1; + } + } + + // plan + if (pos_start < (ssize_t) args.length()) + { + size_t pos_end = args.find(' ', pos_start); + if (ACE_CString::npos == pos_end) + { + plan = args.substring(pos_start); + pos_start = args.length(); + } + else + { + plan = args.substring(pos_start, pos_end - pos_start); + pos_start = pos_end + 1; + } + } + + // component + if (pos_start < (ssize_t) args.length()) + { + size_t pos_end = args.find(' ', pos_start); + if (ACE_CString::npos == pos_end) + { + component = args.substring(pos_start); + pos_start = args.length(); + } + else + { + component = args.substring(pos_start, pos_end - pos_start); + pos_start = pos_end + 1; + } + } + + // port + if (pos_start < (ssize_t) args.length()) + { + size_t pos_end = args.find(' ', pos_start); + if (ACE_CString::npos == pos_end) + { + port = args.substring(pos_start); + pos_start = args.length(); + } + else + { + port = args.substring(pos_start, pos_end - pos_start); + pos_start = pos_end + 1; + } + } + + // check + if (0 == node.length() || 0 == plan.length() || 0 == component.length()) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Invalid object attributes received : \"s\"\n", args.c_str())); + this->usage(); + return; + } + + this->generateObjectKey(node.c_str(), plan.c_str(), component.c_str(), 0 + == port.length() ? 0 : port.c_str()); +} + +void Starter::generateObjectKey(const char * node, const char * plan, + const char * component, const char * port) +{ + DANCE_DEBUG ( (LM_TRACE, "[%M] Starter::generateObjectKey starting...\n")); + CORBA::Boolean prev_format = this->orb_->_use_omg_ior_format(); + this->orb_->_use_omg_ior_format(false); + // warning : parent POA supposed to be RootPOA + CORBA::Object_var obj = this->orb_->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in()); + + CORBA::PolicyList policies(4); + policies.length(4); + policies[0]= root_poa->create_id_assignment_policy(PortableServer::USER_ID); + policies[1] + = root_poa->create_request_processing_policy(PortableServer::USE_SERVANT_MANAGER); + policies[2] + = root_poa->create_servant_retention_policy(PortableServer::NON_RETAIN); + policies[3] = root_poa->create_lifespan_policy(PortableServer::PERSISTENT); + PortableServer::POAManager_var mgr = root_poa->the_POAManager(); + PortableServer::POA_var + myPOA = root_poa->create_POA(node, mgr.in(), policies); + for (size_t i = 0; i < policies.length(); ++i) + { + policies[i]->destroy(); + } + + const char delim = '/'; + + ACE_CString s = plan; + s += delim; + s += component; + if (0 != port) + { + s += delim; + s += port; + } + + PortableServer::ObjectId_var + oid = PortableServer::string_to_ObjectId (s.c_str()); + CORBA::Object_var o = myPOA->create_reference_with_id(oid.in(), + "IDL:omg.org/CORBA/Object:1.0"); + s = this->orb_->object_to_string(o); + size_t pos = s.find(delim); + if (ACE_CString::npos != pos) + { + s = s.substr(pos + 1); + } + else + { + DANCE_ERROR ( (LM_WARNING, "Failed to cut off the host specific part of URL.\n")); + } + DANCE_DEBUG ( (LM_TRACE, "[%M] Starter::generateObjectKey printing result : %s\n", s.c_str())); + ACE_OS::printf ("%s\n", s.c_str()); + + this->orb_->_use_omg_ior_format(prev_format); + DANCE_DEBUG ( (LM_TRACE, "[%M] Starter::generateObjectKey completed.\n")); +} + +void Starter::write_IOR(const char * ior_file_name, const char* ior) +{ + FILE* ior_output_file_ = ACE_OS::fopen (ior_file_name, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, "%s", ior); + ACE_OS::fclose (ior_output_file_); + DANCE_DEBUG ( (LM_DEBUG, "[%M] ior was written into file \"%s\"\n", ior_file_name)); + } + else + { + DANCE_ERROR ( (LM_ERROR, "[%M] Unable to open IOR output file %s : %m\n", + ior_file_name)); + } +} + +void Starter::initNaming() +{ + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting naming...\n")); + TAO_Object_Loader + * loader = ACE_Dynamic_Service<TAO_Object_Loader>::instance ("Naming_Loader"); + if (0 == loader) + { + ACE_CString directive = + "dynamic Naming_Loader Service_Object * TAO_CosNaming_Serv:_make_TAO_Naming_Loader() \""; + directive += this->optNSOptions_ + "\""; + ACE_Service_Config::process_directive(directive.c_str()); + } + + DANCE_DEBUG ( (LM_TRACE, "[%M] Putting ior to file if necessary...\n")); + if (0 < this->optNSFile_.length()) + { + CORBA::Object_var obj = this->orb_->resolve_initial_references("NameService"); + if (CORBA::is_nil(obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] Failed to rir \"NameService\" after creation to write it to file.\n")); + } + else + { + this->write_IOR(this->optNSFile_.c_str(), this->orb_->object_to_string(obj)); + } + } + +/* CORBA::Object_var table_object = this->orb_->resolve_initial_references ("IORTable"); + IORTable::Table_var table = IORTable::Table::_narrow (table_object.in ()); + if (CORBA::is_nil (table.in())) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed to register Naming in IORTable.Nil IORTable\n")); + return; + } + try + { + table->bind ("NameService", this->orb_->object_to_string (this->process_naming_)); + } + catch (...) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed to register Naming in IORTable with \"NameService\". Exception is caught.\n")); + }*/ + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting naming completed.\n")); + } + +CORBA::Object_ptr +Starter::initNodeManager (const char * node) + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting NodeManager \"%s\"...\n", node)); + TAO_Object_Loader * loader = ACE_Dynamic_Service<TAO_Object_Loader>::instance ("NodeManager_Loader"); + if (0 == loader) + { + ACE_Service_Config::process_directive (ACE_DYNAMIC_SERVICE_DIRECTIVE ("NodeManager_Loader", + "DAnCE_NodeManager", + "_make_DAnCE_NodeManager_Module", + "")); + loader = ACE_Dynamic_Service<TAO_Object_Loader>::instance ("NodeManager_Loader"); + } + if (0 == loader) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed to load node manager \"%s\".\n", node)); + throw ACE_CString ("Failed to load NodeManager."); + } + int c = 0; + char ** v = 0; + this->argCopyForNode (node, c, v); + CORBA::Object_var res = loader->create_object (this->orb_, c, v); + this->releaseArgs (c, v); + if (CORBA::is_nil(res.in())) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed to create node manager \"%s\".\n", node)); + throw ACE_CString ("Failed to create NodeManager."); + } + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting NodeManager \"%s\" completed.\n", node)); + return res._retn(); + } + +CORBA::Object_ptr +Starter::initExecutionManager() + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting ExecutionManager...\n")); + ACE_Service_Config::process_directive ( + ACE_DYNAMIC_SERVICE_DIRECTIVE ("ExecutionManager_Loader" + , "DAnCE_ExecutionManager" + , "_make_DAnCE_ExecutionManager_Module" + , "")); + TAO_Object_Loader * loader = ACE_Dynamic_Service<TAO_Object_Loader>::instance ("ExecutionManager_Loader"); + if (0 == loader) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed to load execution manager .\n")); + throw ACE_CString ("Failed to load ExecutionManager."); + } + int c = 0; + char ** v = 0; + this->argCopyForEM (c, v); + CORBA::Object_var em = loader->create_object (this->orb_, c, v); + this->releaseArgs (c, v); + if (CORBA::is_nil(em.in())) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed to create execution manager.\n")); + throw ACE_CString ("Failed to create ExecutionManager."); + } + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting ExecutionManager completed.\n")); + return em._retn(); + } + +void +Starter::runPlanLauncher() + { + if (this->optPL_) + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting PlanLauncher...\n")); + ACE_Service_Config::process_directive ( + ACE_DYNAMIC_SERVICE_DIRECTIVE ("PlanLauncher_Loader" + , "DAnCE_Plan_Launcher" + , "_make_DAnCE_Plan_Launcher_Module" + , "")); + } + else + { + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting PlanLauncherBase...\n")); + ACE_Service_Config::process_directive ( + ACE_DYNAMIC_SERVICE_DIRECTIVE ("PlanLauncher_Loader" + , "DAnCE_Plan_Launcher_Base" + , "_make_DAnCE_Plan_Launcher_Base_Module" + , "")); + } + TAO_Object_Loader * loader = ACE_Dynamic_Service<TAO_Object_Loader>::instance ("PlanLauncher_Loader"); + if (0 == loader) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Failed to load plan launcher.\n")); + throw ACE_CString ("Failed to load PlanLauncher."); + } + int c = 0; + char ** v = 0; + this->argCopyForPL (c, v); + loader->create_object (this->orb_, c, v); + this->releaseArgs (c, v); + DANCE_DEBUG ( (LM_TRACE, "[%M] Starting PlanLauncher(Base) completed.\n")); + } + +void +Starter::argCopyForNaming (int & c, char **& v) + { + int total_sz = 2; + for (size_t pos = this->optNSOptions_.find (' '); + ACE_CString::npos != pos; + pos = this->optNSOptions_.find (' ', pos + 1)) + { + ++total_sz; + } + v = new char*[total_sz]; + c = 0; + //take the 0-th argument anyway + v[c++] = CORBA::string_dup (this->argv_[0]); + + for (int i = 1; i < total_sz; ++i) v[i] = 0; + + ssize_t p0 = 0; + + for (ssize_t p1 = this->optNSOptions_.find (' '); + (size_t) p0 < this->optNSOptions_.length(); + p1 = this->optNSOptions_.find (' ', p0)) + { + if (p1 == p0) + { + p0 = p1 + 1; + continue; + } + v[c++] = CORBA::string_dup (this->optNSOptions_.substring (p0, p1 - p0).c_str()); + p0 = p1 + 1; + } + } + +void +Starter::argCopyForNode (const char * node, int & c, char **& v) + { + const char * validOptions[] = + { //"--node-mgr", "-n" + "--process-ns", "-p" + , "--create-plan-ns", "-c" + , "--rebind-plan-ns", "-r" + , "--port-indirection", "-i" + , 0 + }; + + int total_sz = this->argc_ + 1; + v = new char*[total_sz]; + for (int i = 0; i < total_sz; ++i) v[i] = 0; + + c = 0; + v[c++] = CORBA::string_dup ("-n"); + v[c++] = CORBA::string_dup (node); + Node n; + if (0 == this->nodes_.find(node, n) && 0 < n.iorfile_.length()) + { + v[c++] = CORBA::string_dup (n.iorfile_.c_str()); + } + + bool take = false; + for (int i = 0; i < this->argc_; ++i) + { + if ('-' == this->argv_[i][0]) + { + take = false; + for (int j = 0; 0 != validOptions[j]; ++j) + { + if (this->argv_[i] == ACE_OS::strstr (this->argv_[i], validOptions[j])) + { + if (i + 1 < this->argc_ + && (0 == ACE_OS::strcmp (this->argv_[i], "--node-mgr") || 0 == ACE_OS::strcmp (this->argv_[i], "-n"))) + { + ACE_CString s = this->argv_[i+1]; + if (ACE_CString::npos != s.find ('=')) + { + break; + } + else if (s == node) + { + v[c++] = CORBA::string_dup (this->argv_[i]); + take = true; + break; + } + } + else + { + v[c++] = CORBA::string_dup (this->argv_[i]); + take = true; + break; + } + } + } + } + else if (take) + { + v[c++] = CORBA::string_dup (this->argv_[i]); + } + } + v[c] = 0; + } + +void +Starter::argCopyForEM (int & c, char **& v) + { + const char * validOptions[] = + { + //"--node-mgr", "-n" + "--exec-mgr", "-e" + , "--process-ns", "-p" + , "--create-plan-ns", "-c" + , "--rebind-plan-ns", "-r" + , "--port-indirection", "-i" + , 0 + }; + + int total_sz = this->argc_ + 2 * this->nodes_.total_size() + 1; + v = new char*[total_sz]; + for (int i = 0; i < total_sz; ++i) v[i] = 0; + + bool take = false; + c = 0; + for (int i = 0; i < this->argc_; ++i) + { + if ('-' == this->argv_[i][0]) + { + take = false; + for (int j = 0; 0 != validOptions[j]; ++j) + { + if (this->argv_[i] == ACE_OS::strstr (this->argv_[i], validOptions[j])) + { + v[c++] = CORBA::string_dup (this->argv_[i]); + take = true; + break; + } + } + } + else if (take) + { + v[c++] = CORBA::string_dup (this->argv_[i]); + } + } + + for (ACE_Map_Manager<ACE_CString, Node, ACE_Null_Mutex>::iterator it = this->nodes_.begin(); + it != this->nodes_.end(); + ++it) + { + //v[c++] = CORBA::string_dup("--node-mgr"); + v[c++] = CORBA::string_dup ("-n"); + ACE_CString s = (*it).ext_id_; + s += "="; + if ( 0 < (*it).int_id_.ior_.length() ) + { + s += (*it).int_id_.ior_; + } + else if (!CORBA::is_nil((*it).int_id_.obj.in())) + { + s += this->orb_->object_to_string ( (*it).int_id_.obj.in()); + } + else + { + DANCE_ERROR((LM_ERROR, "[%M] No IOR for node \"%s\"\n", (*it).ext_id_.c_str())); + continue; + } + v[c++] = CORBA::string_dup (s.c_str()); + } + + v[c] = 0; + } + +void +Starter::argCopyForPL (int & c, char **& v) + { + const char * validOptions[] = + { "--em-ior", "-k" + , "--read-plan", "-x" + , "--read-cdr-plan", "-d" + , "--write-cdr-plan", "-w" + , "--plan-uuid", "-t" + , "--dam-ior", "-a" + , "--stop-plan", "-q" + , 0 + }; + + int total_sz = this->argc_ + 1; + v = new char*[total_sz]; + for (int i = 0; i < total_sz; ++i) v[i] = 0; + + bool take = false; + c = 0; + for (int i = 0; i < this->argc_; ++i) + { + if ('-' == this->argv_[i][0]) + { + take = false; + for (int j = 0; 0 != validOptions[j]; ++j) + { + if (this->argv_[i] == ACE_OS::strstr (this->argv_[i], validOptions[j])) + { + v[c++] = CORBA::string_dup (this->argv_[i]); + take = true; + break; + } + } + } + else if (take) + { + v[c++] = CORBA::string_dup (this->argv_[i]); + } + } + v[c] = 0; + } + +void +Starter::releaseArgs (int c, char ** v) + { + for (int i = 0; i < c && 0 != v[i]; ++i) + { + CORBA::string_free (v[i]); + v[i] = 0; + } + delete [] v; + } + +bool +Starter::isPossibleOption(const char* opt) +{ + const char * validOptions[] = + { "node-mgr", "n" + , "exec-mgr", "e" + , "process-ns", "p" + , "create-plan-ns", "c" + , "rebind-plan-ns", "r" + , "port-indirection", "i" + , "gen-object-key", "g" + , "log-level", "l" + , "em-ior", "k" + , "read-plan", "x" + , "read-cdr-plan", "d" + , "write-cdr-plan", "w" + , "plan-uuid", "t" + , "dam-ior", "a" + , "stop-plan", "q" + , 0 + }; + + ACE_CString option = opt; + for (int i = 0; 0 != validOptions[i]; ++i) + { + if ( option == validOptions[i]) return true; + } + return false; +} + +void +Starter::configure_logging_backend (void) +{ + Logger_Service + *clf = ACE_Dynamic_Service<Logger_Service>::instance ("DAnCE_Logger_Backend_Factory"); + if (clf) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "Starter::configure_logging_backend - " + "Replacing logger backend\n")); + ACE_Log_Msg_Backend * backend = clf->get_logger_backend(this->orb_); + backend->open(0); + ACE_Log_Msg::msg_backend (backend); + ACE_Log_Msg * ace = ACE_Log_Msg::instance(); + ace->clr_flags(ace->flags()); + ace->set_flags(ACE_Log_Msg::CUSTOM); + } +} + +} // DAnCE + diff --git a/CIAO/DAnCE/Starter/Starter.h b/CIAO/DAnCE/Starter/Starter.h new file mode 100644 index 00000000000..2bf08442651 --- /dev/null +++ b/CIAO/DAnCE/Starter/Starter.h @@ -0,0 +1,72 @@ +#ifndef STARTER_H_ +#define STARTER_H_ + +#include "ace/String_Base.h" +#include "tao/ORB.h" +#include "tao/Object.h" +#include "ace/Map_Manager.h" +#include "ace/Null_Mutex.h" + +#include "DAnCE/Logger/Logger_Service.h" + +namespace DAnCE + { + + class Starter + { + public: + Starter (int argc, ACE_TCHAR* argv[]); + ~Starter(); + void execute(); + private: + struct Node + { + ACE_CString iorfile_; + ACE_CString ior_; + CORBA::Object_var obj; + + Node() : obj (CORBA::Object::_nil()) {}; + }; + + auto_ptr<DAnCE::Logger_Service> logger_; + + CORBA::ORB_var orb_; + int optLogLevel_; + int argc_; + ACE_TCHAR** argv_; + bool optNS_; + ACE_CString optNSFile_; + ACE_CString optNSOptions_; + ACE_Map_Manager<ACE_CString, Node, ACE_Null_Mutex> nodes_; + bool optEM_; + ACE_CString optEMFile_; + ACE_CString optGenObjKey_; + bool optPLB_; + bool optPL_; + + void parseArgs (int argc, ACE_TCHAR* argv[]); + void usage (); + void generateObjectKey (const char * keyargs); + void generateObjectKey (const char * node + , const char * plan + , const char * component + , const char * port); + void write_IOR (const char * ior_file_name, const char* ior); + + void initNaming(); + CORBA::Object_ptr initNodeManager (const char * node); + CORBA::Object_ptr initExecutionManager(); + void runPlanLauncher(); + void argCopyForNaming (int & c, char **& v); + void argCopyForNode (const char * node, int & c, char **& v); + void argCopyForEM (int & c, char **& v); + void argCopyForPL (int & c, char **& v); + void releaseArgs (int c, char ** v); + static bool isPossibleOption(const char* opt); + + void configure_logging_backend (void); + }; + +} // DAnCE + +#endif /*STARTER_H_*/ diff --git a/CIAO/DAnCE/Starter/Starter.mpc b/CIAO/DAnCE/Starter/Starter.mpc new file mode 100644 index 00000000000..d2b04efd734 --- /dev/null +++ b/CIAO/DAnCE/Starter/Starter.mpc @@ -0,0 +1,9 @@ + +project(Starter) : taoexe, dance_exe, dance_logger, messaging, naming, iortable { + exename = dance + macros += DANCE_BUILD_STARTER_EXE + Source_Files { + Starter.cpp + } +} + diff --git a/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc b/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc index 98e868eef7e..3ebe3271730 100644 --- a/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc +++ b/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc @@ -1,17 +1,17 @@ // -*- MPC -*- // $Id$ -project(StaticDAnCEParser): ciao_component_dnc \ - , taoexe \ - , ciao_config_handlers \ - , ciao_domainapplicationmanager_dnc \ - , iortable \ - , ciao_server_dnc \ - , ciao_nodeapplicationmanager \ -{ - exename = StaticDAnCEParser - - Source_Files { - StaticDAnCEParser.cpp - } -} +//project(StaticDAnCEParser): ciao_component_dnc \ +// , taoexe \ +// , ciao_config_handlers \ +// , ciao_domainapplicationmanager_dnc \ +// , iortable \ +// , ciao_server_dnc \ +// , ciao_nodeapplicationmanager \ +//{ +// exename = StaticDAnCEParser +// +// Source_Files { +// StaticDAnCEParser.cpp +// } +//} diff --git a/CIAO/DAnCE/TargetManager/TM_Client.mpc b/CIAO/DAnCE/TargetManager/TM_Client.mpc index 0a203ab1476..3bbf415126a 100644 --- a/CIAO/DAnCE/TargetManager/TM_Client.mpc +++ b/CIAO/DAnCE/TargetManager/TM_Client.mpc @@ -2,7 +2,8 @@ // Client.mpc,v 1.6 2005/02/18 09:07:06 jwillemsen Exp -project(TMClient): ciao_client_dnc,ciao_deployment_stub, ciao_config_handlers, ciao_events_dnc, ciao_targetmanager_stub { +project(TMClient): ccm_stub { //ciao_deployment_stub, ciao_config_handlers, ciao_events_dnc, ciao_targetmanager_stub { + requires += dummy_label IDL_Files { } diff --git a/CIAO/DAnCE/TargetManager/TargetManager.mpc b/CIAO/DAnCE/TargetManager/TargetManager.mpc index 1df4ff3808d..d2bcf25eae4 100644 --- a/CIAO/DAnCE/TargetManager/TargetManager.mpc +++ b/CIAO/DAnCE/TargetManager/TargetManager.mpc @@ -1,6 +1,7 @@ // $Id$ -project(CIAO_TargetManager_stub): ciao_client_dnc, ciao_deployment_stub, ciao_nodemanager_stub, ace_output { +project(CIAO_TargetManager_stub) : ccm_stub { //: ciao_client_dnc, ciao_deployment_stub, ciao_nodemanager_stub, ace_output { + requires += dummy_label sharedname = TargetManager_stub idlflags += -Wb,stub_export_macro=TARGETMANAGER_STUB_Export \ -Wb,stub_export_include=TargetManager_stub_export.h \ @@ -21,7 +22,8 @@ project(CIAO_TargetManager_stub): ciao_client_dnc, ciao_deployment_stub, ciao_no } } -project(CIAO_TargetManager_svnt) : ciao_servant_dnc, ciao_targetmanager_stub, ace_output { +project(CIAO_TargetManager_svnt) : ciao_servant { // : ciao_servant_dnc, ciao_targetmanager_stub, ace_output { + requires += dummy_label sharedname = TargetManager_svnt idlflags += -Wb,export_macro=TARGETMANAGER_SVNT_Export \ @@ -47,7 +49,8 @@ project(CIAO_TargetManager_svnt) : ciao_servant_dnc, ciao_targetmanager_stub, ac } -project(CIAO_TargetManager_exec) : ciao_component_dnc, ciao_config_handlers, ciao_domainapplicationmanager_dnc, ciao_targetmanager_svnt, ace_output { +project(CIAO_TargetManager_exec) : ciao_executor { //: ciao_component_dnc, ciao_config_handlers, ciao_domainapplicationmanager_dnc, ciao_targetmanager_svnt, ace_output { + requires += dummy_label sharedname = TargetManager_exec dynamicflags = TARGETMANAGER_EXEC_BUILD_DLL diff --git a/CIAO/DAnCE/Utils/DAnCE_Utils.mpc b/CIAO/DAnCE/Utils/DAnCE_Utils.mpc index dfe9f1e5be5..cf8d3db5c49 100644 --- a/CIAO/DAnCE/Utils/DAnCE_Utils.mpc +++ b/CIAO/DAnCE/Utils/DAnCE_Utils.mpc @@ -1,9 +1,8 @@ // -*- MPC -*- // $Id$ -project (DAnCE_Utils): ciao_deployment_svnt, naming, ace_output { +project (DAnCE_Utils): dance_lib, dance_deployment_svnt, naming { sharedname = DAnCE_Utils - dynamicflags = DANCE_UTILS_BUILD_DLL Source_Files { diff --git a/CIAO/DAnCE/Utils/Plan_Handler.cpp b/CIAO/DAnCE/Utils/Plan_Handler.cpp index 3dd0eab8845..f464bf5058f 100644 --- a/CIAO/DAnCE/Utils/Plan_Handler.cpp +++ b/CIAO/DAnCE/Utils/Plan_Handler.cpp @@ -1,20 +1,20 @@ // $Id$ #include "Plan_Handler.h" -#include "ace/OS_NS_stdlib.h" +#include "DAnCE/Logger/Log_Macros.h" -namespace CIAO +namespace DAnCE { - void + void DAnCE_Utils::add_instance ( - ::Deployment::DeploymentPlan &deployment_plan, - const char *instance_name, - const char *node_name, - const char *impl_name, + ::Deployment::DeploymentPlan &deployment_plan, + const char *instance_name, + const char *node_name, + const char *impl_name, const char *ns_name) { // Modifying the deployment plan in order to include the new instance ... - ::Deployment::InstanceDeploymentDescriptions instance = + ::Deployment::InstanceDeploymentDescriptions instance = deployment_plan.instance; instance.length (instance.length()+1); @@ -24,10 +24,10 @@ namespace CIAO instance[instance.length()-1].source.length(0); // Looking for implementation block with name equals to type ... - ::Deployment::MonolithicDeploymentDescriptions implementation = + ::Deployment::MonolithicDeploymentDescriptions implementation = deployment_plan.implementation; - CORBA::ULong i; + CORBA::ULong i = 0; for (i = 0; i < implementation.length(); ++i) if (ACE_OS::strcmp (implementation[i].name.in(), impl_name) == 0) break; @@ -36,7 +36,7 @@ namespace CIAO instance[instance.length()-1].implementationRef = i; else throw ImplementationNotFound(); - + if (ns_name != 0) { instance[instance.length()-1].configProperty.length(1); @@ -48,37 +48,6 @@ namespace CIAO deployment_plan.instance = instance; } - - void - DAnCE_Utils::add_instances ( - int num, - ::Deployment::DeploymentPlan &deployment_plan, - const char *instance_name, - const char *node_name, - const char *impl_name, - const char *ns_name) - { - for (int i = 1; i <= num; ++i) - { - ACE_CString inst_name (instance_name); - //ACE_CString naming (ns_name); - - const int BUF_SIZE = 256; - char buf[BUF_SIZE]; - ACE_OS::itoa (i, buf, 10); - inst_name += buf; - //naming += buf; - - DAnCE_Utils::add_instance (deployment_plan, - inst_name.c_str (), - node_name, - impl_name, - ns_name); - } - } - - - /* void DAnCE_Utils::add_connection (::Deployment::DeploymentPlan_var &deployment_plan, const char *connection_name, const char *port_name, const char *facet_instance, const char *receptacle_instance) @@ -104,7 +73,7 @@ namespace CIAO ::Deployment::InstanceDeploymentDescriptions instance = deployment_plan->instance; for (i = 0; i < instance.length(); i++) - if (!ACE_OS::strcmp(instance[i].name.in(), facet_instance)) + if (!strcmp(instance[i].name.in(), facet_instance)) break; if (i < instance.length()) @@ -119,7 +88,7 @@ namespace CIAO // Looking for instance block with name equals to receptacle_instance ... for (i = 0; i < instance.length(); i++) - if (!ACE_OS::strcmp(instance[i].name.in(), receptacle_instance)) + if (!strcmp(instance[i].name.in(), receptacle_instance)) break; if (i < instance.length()) @@ -145,7 +114,7 @@ namespace CIAO unsigned int instance_ref = 0, i; for (i = 0; i < instance.length(); i++) - if (!ACE_OS::strcmp(instance[i].name.in(), instance_name)) + if (!strcmp(instance[i].name.in(), instance_name)) { instance_ref = i; break; @@ -159,14 +128,14 @@ namespace CIAO for (i = 0; i < connection.length(); i++) for (unsigned int j = 0; j < connection[i].internalEndpoint.length(); j++) if (connection[i].internalEndpoint[j].instanceRef == instance_ref) - { - remove_connection(deployment_plan, connection[i].name.in()); - // Updating i in order to verify the shifted connection ... - i--; - // Re-acquiring instances from the deployment plan ... - connection = deployment_plan->connection; - break; - } + { + remove_connection(deployment_plan, connection[i].name.in()); + // Updating i in order to verify the shifted connection ... + i--; + // Re-acquiring instances from the deployment plan ... + connection = deployment_plan->connection; + break; + } // And then, removing the instance itself ... @@ -204,13 +173,13 @@ namespace CIAO void DAnCE_Utils::remove_connection ( - ::Deployment::DeploymentPlan_var &deployment_plan, + ::Deployment::DeploymentPlan_var &deployment_plan, const char *connection_name) { ::Deployment::PlanConnectionDescriptions connection = deployment_plan->connection; for (unsigned int i = 0; i < connection.length(); i++) - if (!ACE_OS::strcmp(connection[i].name.in(), connection_name)) + if (!strcmp(connection[i].name.in(), connection_name)) { for (unsigned int k = i; k < connection.length() - 1; k++) { @@ -252,8 +221,8 @@ namespace CIAO } } connection.length(connection.length()-1); - // Re-assigning connection to the deployment plan ... - deployment_plan->connection = connection; + // Re-assigning connection to the deployment plan ... + deployment_plan->connection = connection; return; } // Throw exception if connection name not found ... @@ -263,119 +232,115 @@ namespace CIAO void DAnCE_Utils::print_instances (const ::Deployment::DeploymentPlan &deployment_plan) { - const ::Deployment::InstanceDeploymentDescriptions instance = + const ::Deployment::InstanceDeploymentDescriptions instance = deployment_plan.instance; for (CORBA::ULong i = 0; i < instance.length(); ++i) { - ACE_DEBUG ((LM_DEBUG, "\nInstance no. %d\n", i)); - ACE_DEBUG ((LM_DEBUG, "\tName: %s\n", instance[i].name.in())); - ACE_DEBUG ((LM_DEBUG, "\tNode: %s\n", instance[i].node.in())); + DANCE_DEBUG((LM_DEBUG, "[%M] \nInstance no. %d\n", i)); + DANCE_DEBUG((LM_DEBUG, "[%M] \tName: %C\n", instance[i].name.in())); + DANCE_DEBUG((LM_DEBUG, "[%M] \tNode: %C\n", instance[i].node.in())); - ACE_DEBUG ((LM_DEBUG, "\tImplementationRef: %d\n", instance[i].implementationRef)); - ACE_DEBUG ((LM_DEBUG, "\tNumber of properties: %d\n", instance[i].configProperty.length())); + DANCE_DEBUG((LM_DEBUG, "[%M] \tImplementationRef: %d\n", instance[i].implementationRef)); + DANCE_DEBUG((LM_DEBUG, "[%M] \tNumber of properties: %d\n", instance[i].configProperty.length())); for (CORBA::ULong k = 0; k < instance[i].configProperty.length(); k++) - ACE_DEBUG ((LM_DEBUG, "\t\tName: %s\n", instance[i].configProperty[k].name.in())); + DANCE_DEBUG((LM_DEBUG, "[%M] \t\tName: %C\n", instance[i].configProperty[k].name.in())); } } void DAnCE_Utils::print_connections (const ::Deployment::DeploymentPlan &deployment_plan) { - const ::Deployment::PlanConnectionDescriptions connection = + const ::Deployment::PlanConnectionDescriptions connection = deployment_plan.connection; for (CORBA::ULong i = 0; i < connection.length(); ++i) { - ACE_DEBUG ((LM_DEBUG, "\nConnection no. %d\n", i)); - ACE_DEBUG ((LM_DEBUG, "\tName: %s\n", connection[i].name.in())); + DANCE_DEBUG((LM_DEBUG, "[%M] \nConnection no. %d\n", i)); + DANCE_DEBUG((LM_DEBUG, "[%M] \tName: %C\n", connection[i].name.in())); - ACE_DEBUG ((LM_DEBUG, - "\tNo of deployRequirements: %d\n", + DANCE_DEBUG((LM_DEBUG, "[%M] \tNo of deployRequirements: %d\n", connection[i].deployRequirement.length())); for (CORBA::ULong j = 0; j < connection[i].deployRequirement.length(); ++j) { - ACE_DEBUG ((LM_DEBUG, - "\t\tDeploy Requirement %d:\n", + DANCE_DEBUG((LM_DEBUG, + "\t\tDeploy Requirement %d:\n", j+1)); - ACE_DEBUG ((LM_DEBUG, - "\t\t\tResource Type: %s\n", + DANCE_DEBUG((LM_DEBUG, + "\t\t\tResource Type: %C\n", connection[i].deployRequirement[j].resourceType.in())); - ACE_DEBUG ((LM_DEBUG, - "\t\t\tName: %s\n", + DANCE_DEBUG((LM_DEBUG, + "\t\t\tName: %C\n", connection[i].deployRequirement[j].name.in())); - ACE_DEBUG ((LM_DEBUG, + DANCE_DEBUG((LM_DEBUG, "\t\t\tNo of Properties: %d\n", connection[i].deployRequirement[j].property.length())); for (CORBA::ULong k = 0; k < connection[i].deployRequirement[j].property.length(); ++k) { - ACE_DEBUG ((LM_DEBUG, "\t\t\tProperty %d:\n", k+1)); - ACE_DEBUG ((LM_DEBUG, - "\t\t\t\tName: %s\n", + DANCE_DEBUG((LM_DEBUG, "[%M] \t\t\tProperty %d:\n", k+1)); + DANCE_DEBUG((LM_DEBUG, + "\t\t\t\tName: %C\n", connection[i].deployRequirement[j].property[k].name.in())); } } - ACE_DEBUG ((LM_DEBUG, + DANCE_DEBUG((LM_DEBUG, "\tNo of externalEndpoints: %d\n", connection[i].externalEndpoint.length())); for (CORBA::ULong j = 0; j < connection[i].externalEndpoint.length(); j++) - ACE_DEBUG ((LM_DEBUG, - "\t\tPortname %d: %s\n", j+1, + DANCE_DEBUG((LM_DEBUG, + "\t\tPortname %d: %C\n", j+1, connection[i].externalEndpoint[j].portName.in())); - ACE_DEBUG ((LM_DEBUG, + DANCE_DEBUG((LM_DEBUG, "\tNo of internalEndpoints: %d\n", connection[i].internalEndpoint.length())); for (CORBA::ULong j = 0; j < connection[i].internalEndpoint.length(); j++) { - ACE_DEBUG ((LM_DEBUG, "\t\tInternalEndpoint %d:\n", j+1)); - ACE_DEBUG ((LM_DEBUG, "\t\t\tPortname: %s\n", connection[i].internalEndpoint[j].portName.in())); - ACE_DEBUG ((LM_DEBUG, "\t\t\tProvider: %d\n", connection[i].internalEndpoint[j].provider)); + DANCE_DEBUG((LM_DEBUG, "[%M] \t\tInternalEndpoint %d:\n", j+1)); + DANCE_DEBUG((LM_DEBUG, "[%M] \t\t\tPortname: %C\n", connection[i].internalEndpoint[j].portName.in())); + DANCE_DEBUG((LM_DEBUG, "\t\t\tProvider: %d\n", connection[i].internalEndpoint[j].provider)); - if (connection[i].internalEndpoint[j].kind == ::Deployment::Facet || + if (connection[i].internalEndpoint[j].kind == ::Deployment::Facet || connection[i].internalEndpoint[j].kind == ::Deployment::SimplexReceptacle) - ACE_DEBUG ((LM_DEBUG, - "\t\t\tKind: %s\n", - (connection[i].internalEndpoint[j].kind == ::Deployment::Facet) ? + DANCE_DEBUG((LM_DEBUG, + "\t\t\tKind: %C\n", + (connection[i].internalEndpoint[j].kind == ::Deployment::Facet) ? "Facet" : "SimplexReceptacle")); else - ACE_DEBUG ((LM_DEBUG, + DANCE_DEBUG((LM_DEBUG, "\t\t\tKind: %d\n", connection[i].internalEndpoint[j].kind)); - ACE_DEBUG ((LM_DEBUG, + DANCE_DEBUG((LM_DEBUG, "\t\t\tInstanceRef: %ld", (long) connection[i].internalEndpoint[j].instanceRef)); - ACE_DEBUG ((LM_DEBUG, - "\tInstanceName: %s\n", + DANCE_DEBUG((LM_DEBUG, "[%M] \tInstanceName: %C\n", deployment_plan.instance[connection[i].internalEndpoint[j].instanceRef].name.in())); } - ACE_DEBUG ((LM_DEBUG, + DANCE_DEBUG((LM_DEBUG, "\tNo of externalReferenceEndpoints: %d\n", connection[i].externalReference.length())); for (CORBA::ULong j = 0; j < connection[i].externalReference.length(); ++j) - ACE_DEBUG ((LM_DEBUG, - "\t\tLocation %d: %s\n", + DANCE_DEBUG((LM_DEBUG, + "\t\tLocation %d: %C\n", j+1, connection[i].externalReference[j].location.in())); - ACE_DEBUG ((LM_DEBUG, + DANCE_DEBUG((LM_DEBUG, "\tNo of deployedResources: %d\n", connection[i].deployedResource.length())); for (CORBA::ULong j = 0; j < connection[i].deployedResource.length(); j++) { - ACE_DEBUG ((LM_DEBUG, - "\t\tTargetName: %s\n", + DANCE_DEBUG((LM_DEBUG, + "\t\tTargetName: %C\n", connection[i].deployedResource[j].targetName.in())); - ACE_DEBUG ((LM_DEBUG, - "\t\tRequirementName: %s\n", + DANCE_DEBUG((LM_DEBUG, "[%M] \t\tRequirementName: %C\n", connection[i].deployedResource[j].requirementName.in())); - ACE_DEBUG ((LM_DEBUG, - "\t\tResourceName: %s\n", + DANCE_DEBUG((LM_DEBUG, "[%M] \t\tResourceName: %C\n", connection[i].deployedResource[j].resourceName.in())); } } diff --git a/CIAO/DAnCE/Utils/Plan_Handler.h b/CIAO/DAnCE/Utils/Plan_Handler.h index 39bcde869d9..f65e976ed19 100644 --- a/CIAO/DAnCE/Utils/Plan_Handler.h +++ b/CIAO/DAnCE/Utils/Plan_Handler.h @@ -15,7 +15,7 @@ #include "DAnCE_Utils_Export.h" #include "Deployment/DeploymentC.h" -namespace CIAO +namespace DAnCE { class ImplementationNotFound {}; class InstanceNotFound {}; @@ -48,17 +48,6 @@ namespace CIAO const char *impl_name, const char *ns_name = 0); - /// Add a certain number of instances - /// The name of the instances will be "instance_name_X" where - /// <X> is a positive integer number starting from 1 to <num>. - static void add_instances ( - int num, - ::Deployment::DeploymentPlan &deployment_plan, - const char *instance_name, - const char *node_name, - const char *impl_name, - const char *ns_name = 0); - static void add_connection ( ::Deployment::DeploymentPlan &deployment_plan, const char *connection_name, diff --git a/CIAO/DAnCE/bin/.empty b/CIAO/DAnCE/bin/.empty new file mode 100644 index 00000000000..eb0e403e06a --- /dev/null +++ b/CIAO/DAnCE/bin/.empty @@ -0,0 +1 @@ +This file keeps the directory around even when using cvs update -dP diff --git a/CIAO/DAnCE/bin/PythonDAnCE/__init__.py b/CIAO/DAnCE/bin/PythonDAnCE/__init__.py new file mode 100755 index 00000000000..0ebbdbeba93 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/__init__.py @@ -0,0 +1 @@ +import generator diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/__init__.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/__init__.py new file mode 100755 index 00000000000..641e463cdaa --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/__init__.py @@ -0,0 +1,46 @@ +temp_path = "" + + +# # The following is the initialization logic that is executed +# # when the fuzz module is loaded +# from os import listdir, chdir, getcwd +# from sys import stderr, path +# oldwd = getcwd () + +# try: +# # The following is a trick to get the directory THIS SCRIPT - note, not necessarily the CWD - +# # is located. We use this path later to load all of the available templates +# import _path +# script_path = str (_path).split ()[3][1:-11] +# if script_path == "": +# script_path = "." + +# chdir (script_path + "/templates") + +# path.append (getcwd ()) + +# files = listdir (".") + +# modules = list () + + +# for item in files: +# if (item[0] != '_') and (item[-3:] == ".py"): +# print "Registering " + item [:-3] +# try: +# __import__ (item[:-3]) +# except: +# stderr.write ("ERROR: Unable to load the " + item[:-3] + " template\n") + +# finally: +# chdir (oldwd) + +import header +import comp_impl +import comp_inst +import footer +import homed_comp_impl +import homed_comp_inst +import home_impl +import home_inst +import artifact diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/_path.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/_path.py new file mode 100755 index 00000000000..e69de29bb2d --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/_path.py diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/artifact.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/artifact.py new file mode 100755 index 00000000000..dbebad5291d --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/artifact.py @@ -0,0 +1,24 @@ +from templet import stringfunction + +@stringfunction +def template (component_name): + """ + <artifact xmi:id="${component_name}_ExecArtifact"> + <name>${component_name}_exec</name> + <source/> + <node/> + <location>${component_name}_exec</location> + </artifact> + <artifact xmi:id="${component_name}_SvntArtifact"> + <name>${component_name}_svnt</name> + <source/> + <node/> + <location>${component_name}_svnt</location> + </artifact> + <artifact xmi:id="${component_name}_StubArtifact"> + <name>${component_name}_stub</name> + <source/> + <node/> + <location>${component_name}_stub</location> + </artifact> + """ diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_impl.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_impl.py new file mode 100755 index 00000000000..e807fc6f58a --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_impl.py @@ -0,0 +1,58 @@ +from templet import stringfunction + +@stringfunction +def template (component_name, namespace) : + """ + + <implementation xmi:id="${component_name}ComponentImplementation"> + <name>${component_name}ComponentImplementation</name> + <source/> + <artifact xmi:idref="${component_name}_ExecArtifact" /> + <artifact xmi:idref="${component_name}_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_${namespace}${component_name}_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_${namespace}${component_name}_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>${component_name}_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>${component_name}_exec</string> + </value> + </value> + </execParameter> + </implementation> + """ diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_inst.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_inst.py new file mode 100755 index 00000000000..7bacf681616 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_inst.py @@ -0,0 +1,13 @@ +from templet import stringfunction + +@stringfunction +def template (component_name) : + """ + <instance xmi:id="${component_name}ComponentInstance"> + <name>${component_name}Component</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="${component_name}ComponentImplementation" /> + </instance> + """ diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/footer.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/footer.py new file mode 100755 index 00000000000..687cfb78a02 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/footer.py @@ -0,0 +1,8 @@ +from templet import stringfunction + +@stringfunction +def template (): + """ +</Deployment:DeploymentPlan> +""" + diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/header.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/header.py new file mode 100755 index 00000000000..c16146ae028 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/header.py @@ -0,0 +1,14 @@ +from templet import stringfunction + +@stringfunction +def template (uuid): + """ +<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>${uuid}</label> + <UUID>${uuid}</UUID> + +""" diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/home_impl.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/home_impl.py new file mode 100755 index 00000000000..87c14a68070 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/home_impl.py @@ -0,0 +1,57 @@ +from templet import stringfunction + +@stringfunction +def template (component_name, namespace) : + """ + <implementation xmi:id="${component_name}HomeImplementation"> + <name>${component_name}HomeImplementation</name> + <source/> + <artifact xmi:idref="${component_name}_ExecArtifact" /> + <artifact xmi:idref="${component_name}_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_${namespace}${component_name}Home_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_${namespace}${component_name}Home_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>${component_name}_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>${component_name}_exec</string> + </value> + </value> + </execParameter> + </implementation> + """ diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/home_inst.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/home_inst.py new file mode 100755 index 00000000000..6d24a5c5986 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/home_inst.py @@ -0,0 +1,13 @@ +from templet import stringfunction + +@stringfunction +def template (component_name) : + """ + <instance xmi:id="${component_name}HomeInstance"> + <name>${component_name}Home</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="${component_name}HomeImplementation" /> + </instance> + """ diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_impl.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_impl.py new file mode 100755 index 00000000000..ab8a7ee9517 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_impl.py @@ -0,0 +1,13 @@ +from templet import stringfunction + +@stringfunction +def template (component_name) : + """ + <implementation xmi:id="${component_name}ComponentImplementation"> + <name>${component_name}ComponentImplementation</name> + <source/> + <artifact xmi:idref="${component_name}_ExecArtifact" /> + <artifact xmi:idref="${component_name}_SvntArtifact" /> + <artifact xmi:idref="${component_name}_StubArtifact" /> + </implementation> + """ diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_inst.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_inst.py new file mode 100755 index 00000000000..ee1218d4539 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_inst.py @@ -0,0 +1,24 @@ +from templet import stringfunction + +@stringfunction +def template (component_name) : + """ + <instance xmi:id="${component_name}ComponentInstance"> + <name>${component_name}Component</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="${component_name}ComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>${component_name}Home</string> + </value> + </value> + </configProperty> + </instance> + """ diff --git a/CIAO/DAnCE/bin/PythonDAnCE/generator/templet.py b/CIAO/DAnCE/bin/PythonDAnCE/generator/templet.py new file mode 100755 index 00000000000..85cfb9f0389 --- /dev/null +++ b/CIAO/DAnCE/bin/PythonDAnCE/generator/templet.py @@ -0,0 +1,325 @@ +"""A lightweight python templating engine. Templet version 2 beta. + +Supports two templating idioms: + 1. template functions using @stringfunction and @unicodefunction + 2. template classes inheriting from StringTemplate and UnicodeTemplate + +Each template function is marked with the attribute @stringfunction +or @unicodefunction. Template functions will be rewritten to expand +their document string as a template and return the string result. +For example: + + @stringtemplate + def myTemplate(animal, thing): + "the $animal jumped over the $thing." + + print myTemplate('cow', 'moon') + +The template language understands the following forms: + + $myvar - inserts the value of the variable 'myvar' + ${...} - evaluates the expression and inserts the result + ${{...}} - executes enclosed code; use 'out.append(text)' to insert text + $$ - an escape for a single $ + $ (at the end of the line) - a line continuation + +Template functions are compiled into code that accumulates a list of +strings in a local variable 'out', and then returns the concatenation +of them. If you want do do complicated computation, you can append +to 'out' directly inside a ${{...}} block. + +Another alternative is to use template classes. + +Each template class is a subclass of StringTemplate or UnicodeTemplate. +Template classes should define a class attribute 'template' that +contains the template code. Also, any class attribute ending with +'_template' will be compiled into a template method. + +Use a template class by instantiating it with a dictionary or +keyword arguments. Get the expansion by converting the instance +to a string. For example: + + class MyTemplate(templet.Template): + template = "the $animal jumped over the $thing." + + print MyTemplate(animal='cow', thing='moon') + +Within a template class, the template language is similar to a template +function, but 'self.write' should be used to build the string inside +${{..}} blocks. Also, there is a shorthand for calling template methods: + + $<sub_template> - shorthand for '${{self.sub_template(vars())}}' + +This idiom is helpful for decomposing a template and when subclassing. + +A longer example: + + import cgi + class RecipeTemplate(templet.Template): + template = r''' + <html><head><title>$dish</title></head> + <body> + $<header_template> + $<body_template> + </body></html> + ''' + header_template = r''' + <h1>${cgi.escape(dish)}</h1> + ''' + body_template = r''' + <ol> + ${{ + for item in ingredients: + self.write('<li>', item, '\n') + }} + </ol> + ''' + +This template can be expanded as follows: + + print RecipeTemplate(dish='burger', ingredients=['bun', 'beef', 'lettuce']) + +And it can be subclassed like this: + + class RecipeWithPriceTemplate(RecipeTemplate): + header_template = "<h1>${cgi.escape(dish)} - $$$price</h1>\n" + +Templet is by David Bau and was inspired by Tomer Filiba's Templite class. +For details, see http://davidbau.com/templet + +Templet is posted by David Bau under BSD-license terms. + +Copyright (c) 2007, David Bau +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of Templet nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +""" + +import sys, re, inspect + +class _TemplateBuilder(object): + __pattern = re.compile(r"""\$( # Directives begin with a $ + \$ | # $$ is an escape for $ + [^\S\n]*\n | # $\n is a line continuation + [_a-z][_a-z0-9]* | # $simple Python identifier + \{(?!\{)[^\}]*\} | # ${...} expression to eval + \{\{.*?\}\} | # ${{...}} multiline code to exec + <[_a-z][_a-z0-9]*> | # $<sub_template> method call + )(?:(?:(?<=\}\})|(?<=>))[^\S\n]*\n)? # eat some trailing newlines + """, re.IGNORECASE | re.VERBOSE | re.DOTALL) + + def __init__(self, constpat, emitpat, callpat=None): + self.constpat, self.emitpat, self.callpat = constpat, emitpat, callpat + + def __realign(self, str, spaces=''): + """Removes any leading empty columns of spaces and an initial empty line""" + lines = str.splitlines(); + if lines and not lines[0].strip(): del lines[0] + lspace = [len(l) - len(l.lstrip()) for l in lines if l.lstrip()] + margin = len(lspace) and min(lspace) + return '\n'.join((spaces + l[margin:]) for l in lines) + + def build(self, template, filename, s=''): + code = [] + for i, part in enumerate(self.__pattern.split(self.__realign(template))): + if i % 2 == 0: + if part: code.append(s + self.constpat % repr(part)) + else: + if not part or (part.startswith('<') and self.callpat is None): + raise SyntaxError('Unescaped $ in ' + filename) + elif part.endswith('\n'): continue + elif part == '$': code.append(s + self.emitpat % '"$"') + elif part.startswith('{{'): code.append(self.__realign(part[2:-2], s)) + elif part.startswith('{'): code.append(s + self.emitpat % part[1:-1]) + elif part.startswith('<'): code.append(s + self.callpat % part[1:-1]) + else: code.append(s + self.emitpat % part) + return '\n'.join(code) + +class _TemplateMetaClass(type): + __builder = _TemplateBuilder( + 'self.out.append(%s)', 'self.write(%s)', 'self.%s(vars())') + + def __compile(cls, template, n): + globals = sys.modules[cls.__module__].__dict__ + if '__file__' not in globals: filename = '<%s %s>' % (cls.__name__, n) + else: filename = '%s: <%s %s>' % (globals['__file__'], cls.__name__, n) + code = compile(cls.__builder.build(template, filename), filename, 'exec') + def expand(self, __dict = None, **kw): + if __dict: kw.update([i for i in __dict.iteritems() if i[0] not in kw]) + kw['self'] = self + exec code in globals, kw + return expand + + def __init__(cls, *args): + for attr, val in cls.__dict__.items(): + if attr == 'template' or attr.endswith('_template'): + if isinstance(val, basestring): + setattr(cls, attr, cls.__compile(val, attr)) + type.__init__(cls, *args) + +class StringTemplate(object): + """A base class for string template classes.""" + __metaclass__ = _TemplateMetaClass + + def __init__(self, *args, **kw): + self.out = [] + self.template(*args, **kw) + + def write(self, *args): + self.out.extend([str(a) for a in args]) + + def __str__(self): + return ''.join(self.out) + +# The original version of templet called StringTemplate "Template" +Template = StringTemplate + +class UnicodeTemplate(object): + """A base class for unicode template classes.""" + __metaclass__ = _TemplateMetaClass + + def __init__(self, *args, **kw): + self.out = [] + self.template(*args, **kw) + + def write(self, *args): + self.out.extend([unicode(a) for a in args]) + + def __unicode__(self): + return u''.join(self.out) + + def __str__(self): + return unicode(self).encode('utf-8') + +def _templatefunction(func, listname, stringtype): + globals, locals = sys.modules[func.__module__].__dict__, {} + if '__file__' not in globals: filename = '<%s>' % func.__name__ + else: filename = '%s: <%s>' % (globals['__file__'], func.__name__) + builder = _TemplateBuilder('%s.append(%%s)' % listname, + '%s.append(%s(%%s))' % (listname, stringtype)) + args = inspect.getargspec(func) + code = [ + 'def %s%s:' % (func.__name__, inspect.formatargspec(*args)), + ' %s = []' % listname, + builder.build(func.__doc__, filename, ' '), + ' return "".join(%s)' % listname] + code = compile('\n'.join(code), filename, 'exec') + exec code in globals, locals + return locals[func.__name__] + +def stringfunction(func): + """Function attribute for string template functions""" + return _templatefunction(func, listname='out', stringtype='str') + +def unicodefunction(func): + """Function attribute for unicode template functions""" + return _templatefunction(func, listname='out', stringtype='unicode') + +# When executed as a script, run some testing code. +if __name__ == '__main__': + ok = True + def expect(actual, expected): + global ok + if expected != actual: + print "error - got:\n%s" % repr(actual) + ok = False + class TestAll(Template): + """A test of all the $ forms""" + template = r""" + Bought: $count ${name}s$ + at $$$price. + ${{ + for i in xrange(count): + self.write(TestCalls(vars()), "\n") # inherit all the local $vars + }} + Total: $$${"%.2f" % (count * price)} + """ + class TestCalls(Template): + """A recursive test""" + template = "$name$i ${*[TestCalls(name=name[0], i=n) for n in xrange(i)]}" + expect( + str(TestAll(count=5, name="template call", price=1.23)), + "Bought: 5 template calls at $1.23.\n" + "template call0 \n" + "template call1 t0 \n" + "template call2 t0 t1 t0 \n" + "template call3 t0 t1 t0 t2 t0 t1 t0 \n" + "template call4 t0 t1 t0 t2 t0 t1 t0 t3 t0 t1 t0 t2 t0 t1 t0 \n" + "Total: $6.15\n") + class TestBase(Template): + template = r""" + <head>$<head_template></head> + <body>$<body_template></body> + """ + class TestDerived(TestBase): + head_template = "<title>$name</title>" + body_template = "${TestAll(vars())}" + expect( + str(TestDerived(count=4, name="template call", price=2.88)), + "<head><title>template call</title></head>\n" + "<body>" + "Bought: 4 template calls at $2.88.\n" + "template call0 \n" + "template call1 t0 \n" + "template call2 t0 t1 t0 \n" + "template call3 t0 t1 t0 t2 t0 t1 t0 \n" + "Total: $11.52\n" + "</body>\n") + class TestUnicode(UnicodeTemplate): + template = u""" + \N{Greek Small Letter Pi} = $pi + """ + expect( + unicode(TestUnicode(pi = 3.14)), + u"\N{Greek Small Letter Pi} = 3.14\n") + goterror = False + try: + class TestError(Template): + template = 'Cost of an error: $0' + except SyntaxError: + goterror = True + if not goterror: + print 'TestError failed' + ok = False + @stringfunction + def testBasic(name): + "Hello $name." + expect(testBasic('Henry'), "Hello Henry.") + @stringfunction + def testReps(a, count=5): r""" + ${{ if count == 0: return '' }} + $a${testReps(a, count - 1)}""" + expect( + testReps('foo'), + "foofoofoofoofoo") + @unicodefunction + def testUnicode(count=4): u""" + ${{ if not count: return '' }} + \N{BLACK STAR}${testUnicode(count - 1)}""" + expect( + testUnicode(count=10), + u"\N{BLACK STAR}" * 10) + if ok: print "OK" diff --git a/CIAO/DAnCE/bin/generate_plan.py b/CIAO/DAnCE/bin/generate_plan.py new file mode 100755 index 00000000000..15310877bec --- /dev/null +++ b/CIAO/DAnCE/bin/generate_plan.py @@ -0,0 +1,90 @@ +#!/usr/bin/python +import sys, os + +sys.path.append (os.getenv ("DANCE_ROOT")) + + +def parse_args (): + from optparse import OptionParser + + parser = OptionParser ("""usage %prog [options] + Note that this script is very simple. It assumes that the idl and mpc follow + canonical and predictable patterns.""") + + parser.add_option ("-o", "--output", dest="output", action="store", type="string", + help="Output filename", default="Plan.cdp") + parser.add_option ("--home", dest="homes", action="append", type="string", + help="Home types to be included") + parser.add_option ("-c", "--component", dest="components", action="append", + type="string", help="Component types to be included") + parser.add_option ("--homed-component", dest="homed_components", action="append", + type="string", help="Homed component types to be included") + parser.add_option ("-u", "--uuid", dest="uuid", action="store", + type="string", help="UUID for the generated plan") + parser.add_option ("-n", "--namespace", dest="namespace", action="store", default="", + type="string", help="IDL namespace any components may be in") + + (options, arguments) = parser.parse_args () + + return (options, arguments) + +def main (): + (opts, args) = parse_args () + + # compset = set (opts.homes) | set (opts.components) | set (homed_components) + + from PythonDAnCE import generator + retval = "" + retval += generator.header.template (opts.uuid) + + artifacts = {} + + if opts.namespace != "": + opts.namespace += "_" + + #implementations + if opts.homes is not None: + for item in opts.homes: + retval += generator.home_impl.template (item, opts.namespace) + artifacts[item] = 1 + + if opts.homed_components is not None: + for item in opts.homed_components: + retval += generator.homed_comp_impl.template (item) + artifacts[item] = 1 + + if opts.components is not None: + for item in opts.components: + retval += generator.comp_impl.template (item, opts.namespace) + artifacts[item] = 1 + + #instances + if opts.homes is not None: + for item in opts.homes: + retval += generator.home_inst.template (item) + + if opts.homed_components is not None: + for item in opts.homed_components: + retval += generator.homed_comp_inst.template (item) + + if opts.components is not None: + for item in opts.components: + retval += generator.comp_inst.template (item) + + #artifacts + if artifacts is not None: + for item in artifacts.keys(): + retval += generator.artifact.template(item) + + retval += generator.footer.template () + + outfile = open (opts.output, 'w') + outfile.write (retval) + outfile.close () + + +if __name__ == "__main__": + main () + + + diff --git a/CIAO/DAnCE/lib/.empty b/CIAO/DAnCE/lib/.empty new file mode 100644 index 00000000000..eb0e403e06a --- /dev/null +++ b/CIAO/DAnCE/lib/.empty @@ -0,0 +1 @@ +This file keeps the directory around even when using cvs update -dP diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.cidl new file mode 100644 index 00000000000..fe2ff8f2859 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.cidl @@ -0,0 +1,11 @@ +// $Id$ +#include "SimpleAttribute.idl" + +composition session SimpleAttribute_Impl +{ + home executor SimpleAttributeHome_Exec + { + implements Simple::SimpleAttributeHome; + manages SimpleAttribute_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.idl new file mode 100644 index 00000000000..7d41978b4de --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.idl @@ -0,0 +1,25 @@ +// $Id$ + +#ifndef SIMPLE_ATTRIBUTE_IDL +#define SIMPLE_ATTRIBUTE_IDL + +#include "Components.idl" + +module Simple +{ + component SimpleAttribute + { + attribute string str_attr; + attribute long long_attr; + attribute short short_attr; + }; + + home SimpleAttributeHome manages SimpleAttribute + { + attribute string str_attr; + attribute long long_attr; + attribute short short_attr; + }; +}; + +#endif /*SIMPLE_ATTRIBUTE_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.mpc new file mode 100644 index 00000000000..6f552eaee25 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.mpc @@ -0,0 +1,119 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl SimpleAttribute" + +project(SimpleAttribute_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLEATTRIBUTE_STUB_Export \ + -Wb,stub_export_include=SimpleAttribute_stub_export.h \ + -Wb,skel_export_macro=SIMPLEATTRIBUTE_SVNT_Export \ + -Wb,skel_export_include=SimpleAttribute_svnt_export.h + + IDL_Files { + SimpleAttribute.idl + } +} + +project(SimpleAttribute_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLEATTRIBUTE_SVNT_Export \ + --svnt-export-include SimpleAttribute_svnt_export.h + idlflags += -Wb,export_macro=SIMPLEATTRIBUTE_EXEC_Export \ + -Wb,export_include=SimpleAttribute_exec_export.h \ + -SS + + CIDL_Files { + SimpleAttribute.cidl + } + + IDL_Files { + SimpleAttributeE.idl + } +} + +project(SimpleAttribute_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleAttribute_idl_gen + libs += + + sharedname = SimpleAttribute_stub + dynamicflags = SIMPLEATTRIBUTE_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleAttributeC.cpp + } + + Header_Files { + SimpleAttributeC.h + SimpleAttribute_stub_export.h + } + + Inline_Files { + SimpleAttributeC.inl + } +} + +project(SimpleAttribute_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleAttribute_cidl_gen SimpleAttribute_stub + sharedname = SimpleAttribute_exec + libs += SimpleAttribute_stub + + dynamicflags = SIMPLEATTRIBUTE_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleAttributeEC.cpp + SimpleAttribute_exec.cpp + } + + Header_Files { + SimpleAttributeEC.h + SimpleAttribute_exec.h + SimpleAttribute_exec_export.h + } + + Inline_Files { + SimpleAttributeEC.inl + } +} + + +project(SimpleAttribute_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleAttribute_exec + sharedname = SimpleAttribute_svnt + libs += SimpleAttribute_exec \ + SimpleAttribute_stub + + dynamicflags = SIMPLEATTRIBUTE_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimpleAttributeS.cpp + SimpleAttribute_svnt.cpp + } + + Header_Files { + SimpleAttributeS.h + SimpleAttribute_svnt.h + SimpleAttribute_svnt_export.h + } + + Inline_Files { + SimpleAttributeS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.cpp new file mode 100644 index 00000000000..675e7dcc386 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.cpp @@ -0,0 +1,259 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimpleAttribute_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimpleAttribute_Impl +{ + //================================================================== + // Component Executor Implementation Class: SimpleAttribute_exec_i + //================================================================== + + SimpleAttribute_exec_i::SimpleAttribute_exec_i (void) + : str_ (""), + long_(-1), + short_(-1) + { + } + + SimpleAttribute_exec_i::~SimpleAttribute_exec_i (void) + { + } + + // Supported or inherited operations. + + // Attribute operations. + + char * + SimpleAttribute_exec_i::str_attr () + { + // Your code here. + return CORBA::string_dup (str_.c_str ()); + } + + void + SimpleAttribute_exec_i::str_attr (const char * str) + { + CIAO_TRACE ("SimpleAttribute_exec_i::str_attr"); + // Your code here. + this->str_ = str; + } + + ::CORBA::Long + SimpleAttribute_exec_i::long_attr () + { + CIAO_TRACE ("SimpleAttribute_exec_i::long_attr"); + // Your code here. + return long_; + } + + void + SimpleAttribute_exec_i::long_attr (::CORBA::Long long_attr ) + { + CIAO_TRACE ("SimpleAttribute_exec_i::long_attr"); + // Your code here. + this->long_ = long_attr; + } + + ::CORBA::Short + SimpleAttribute_exec_i::short_attr () + { + // Your code here. + return short_; + } + + void + SimpleAttribute_exec_i::short_attr (::CORBA::Short short_attr ) + { + CIAO_TRACE ("SimpleAttribute_exec_i::short_attr"); + // Your code here. + this->short_ = short_attr; + } + + // Port operations. + + // Operations from Components::SessionComponent + + void + SimpleAttribute_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::Simple::CCM_SimpleAttribute_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimpleAttribute_exec_i::configuration_complete () + { + // Your code here. + } + + void + SimpleAttribute_exec_i::ccm_activate () + { + // Your code here. + if (this->str_ == "" || + this->long_ == -1 || + this->short_ == -1) + { + CIAO_ERROR ((LM_ERROR, "SimpleAttribute_exec_i::ccm_activate - " + "Error: Attribute values didin't initialize correctly!\n")); + } + else + { + CIAO_DEBUG ((LM_EMERGENCY, "SimpleAttribute_exec_i::ccm_activate - " + "Test passed! String attribute is %s\n", + this->str_.c_str ())); + } + + } + + void + SimpleAttribute_exec_i::ccm_passivate () + { + // Your code here. + } + + void + SimpleAttribute_exec_i::ccm_remove () + { + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: SimpleAttributeHome_exec_i + //================================================================== + + SimpleAttributeHome_exec_i::SimpleAttributeHome_exec_i (void) + : str_ (""), + long_(-1), + short_(-1) + { + } + + SimpleAttributeHome_exec_i::~SimpleAttributeHome_exec_i (void) + { + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + + char * + SimpleAttributeHome_exec_i::str_attr () + { + // Your code here. + return CORBA::string_dup (str_.c_str ()); + } + + void + SimpleAttributeHome_exec_i::str_attr (const char * str) + { + CIAO_TRACE ("SimpleAttributeHome_exec_i::str_attr"); + // Your code here. + this->str_ = str; + } + + ::CORBA::Long + SimpleAttributeHome_exec_i::long_attr () + { + CIAO_TRACE ("SimpleAttributeHome_exec_i::long_attr"); + // Your code here. + return long_; + } + + void + SimpleAttributeHome_exec_i::long_attr (::CORBA::Long long_attr ) + { + CIAO_TRACE ("SimpleAttributeHome_exec_i::long_attr"); + // Your code here. + this->long_ = long_attr; + } + + ::CORBA::Short + SimpleAttributeHome_exec_i::short_attr () + { + // Your code here. + return short_; + } + + void + SimpleAttributeHome_exec_i::short_attr (::CORBA::Short short_attr ) + { + CIAO_TRACE ("SimpleAttributeHome_exec_i::short_attr"); + // Your code here. + this->short_ = short_attr; + } + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimpleAttributeHome_exec_i::create () + { + if (this->str_ == "" || + this->long_ == -1 || + this->short_ == -1) + { + CIAO_ERROR ((LM_ERROR, "SimpleAttribute_exec_i::ccm_activate - " + "Error: Attribute values didin't initialize correctly!\n")); + } + else + { + CIAO_DEBUG ((LM_EMERGENCY, "SimpleAttributeHome_exec_i::create - " + "Test passed! String attribute is %s\n", + this->str_.c_str ())); + } + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimpleAttribute_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLEATTRIBUTE_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleAttributeHome_Impl (void) + { + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimpleAttributeHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.h new file mode 100644 index 00000000000..2913eeb8d07 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.h @@ -0,0 +1,141 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLEATTRIBUTE_EXEC_H +#define CIAO_SIMPLEATTRIBUTE_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimpleAttributeEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimpleAttribute_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimpleAttribute_Impl +{ + class SIMPLEATTRIBUTE_EXEC_Export SimpleAttribute_exec_i + : public virtual SimpleAttribute_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleAttribute_exec_i (void); + virtual ~SimpleAttribute_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + virtual char * + str_attr (); + + virtual void + str_attr (const char * str_attr); + + virtual ::CORBA::Long + long_attr (); + + virtual void + long_attr (::CORBA::Long long_attr); + + virtual ::CORBA::Short + short_attr (); + + virtual void + short_attr (::CORBA::Short short_attr); + + // Port operations. + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimpleAttribute_Context_var context_; + ACE_CString str_; + ::CORBA::Long long_; + ::CORBA::Short short_; + }; + + class SIMPLEATTRIBUTE_EXEC_Export SimpleAttributeHome_exec_i + : public virtual SimpleAttributeHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleAttributeHome_exec_i (void); + virtual ~SimpleAttributeHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + virtual char * + str_attr (); + + virtual void + str_attr (const char * str_attr); + + virtual ::CORBA::Long + long_attr (); + + virtual void + long_attr (::CORBA::Long long_attr); + + virtual ::CORBA::Short + short_attr (); + + virtual void + short_attr (::CORBA::Short short_attr); + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + private: + ACE_CString str_; + ::CORBA::Long long_; + ::CORBA::Short short_; + }; + + extern "C" SIMPLEATTRIBUTE_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleAttributeHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLEATTRIBUTE_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec_export.h new file mode 100644 index 00000000000..1b9481804a3 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEATTRIBUTE_EXEC +// ------------------------------ +#ifndef SIMPLEATTRIBUTE_EXEC_EXPORT_H +#define SIMPLEATTRIBUTE_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEATTRIBUTE_EXEC_HAS_DLL) +# define SIMPLEATTRIBUTE_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEATTRIBUTE_EXEC_HAS_DLL */ + +#if !defined (SIMPLEATTRIBUTE_EXEC_HAS_DLL) +# define SIMPLEATTRIBUTE_EXEC_HAS_DLL 1 +#endif /* ! SIMPLEATTRIBUTE_EXEC_HAS_DLL */ + +#if defined (SIMPLEATTRIBUTE_EXEC_HAS_DLL) && (SIMPLEATTRIBUTE_EXEC_HAS_DLL == 1) +# if defined (SIMPLEATTRIBUTE_EXEC_BUILD_DLL) +# define SIMPLEATTRIBUTE_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLEATTRIBUTE_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEATTRIBUTE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEATTRIBUTE_EXEC_BUILD_DLL */ +# define SIMPLEATTRIBUTE_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLEATTRIBUTE_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEATTRIBUTE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEATTRIBUTE_EXEC_BUILD_DLL */ +#else /* SIMPLEATTRIBUTE_EXEC_HAS_DLL == 1 */ +# define SIMPLEATTRIBUTE_EXEC_Export +# define SIMPLEATTRIBUTE_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLEATTRIBUTE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEATTRIBUTE_EXEC_HAS_DLL == 1 */ + +// Set SIMPLEATTRIBUTE_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEATTRIBUTE_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEATTRIBUTE_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEATTRIBUTE_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEATTRIBUTE_EXEC_NTRACE */ + +#if (SIMPLEATTRIBUTE_EXEC_NTRACE == 1) +# define SIMPLEATTRIBUTE_EXEC_TRACE(X) +#else /* (SIMPLEATTRIBUTE_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEATTRIBUTE_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEATTRIBUTE_EXEC_NTRACE == 1) */ + +#endif /* SIMPLEATTRIBUTE_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_stub_export.h new file mode 100644 index 00000000000..00e32efd226 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEATTRIBUTE_STUB +// ------------------------------ +#ifndef SIMPLEATTRIBUTE_STUB_EXPORT_H +#define SIMPLEATTRIBUTE_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEATTRIBUTE_STUB_HAS_DLL) +# define SIMPLEATTRIBUTE_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEATTRIBUTE_STUB_HAS_DLL */ + +#if !defined (SIMPLEATTRIBUTE_STUB_HAS_DLL) +# define SIMPLEATTRIBUTE_STUB_HAS_DLL 1 +#endif /* ! SIMPLEATTRIBUTE_STUB_HAS_DLL */ + +#if defined (SIMPLEATTRIBUTE_STUB_HAS_DLL) && (SIMPLEATTRIBUTE_STUB_HAS_DLL == 1) +# if defined (SIMPLEATTRIBUTE_STUB_BUILD_DLL) +# define SIMPLEATTRIBUTE_STUB_Export ACE_Proper_Export_Flag +# define SIMPLEATTRIBUTE_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEATTRIBUTE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEATTRIBUTE_STUB_BUILD_DLL */ +# define SIMPLEATTRIBUTE_STUB_Export ACE_Proper_Import_Flag +# define SIMPLEATTRIBUTE_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEATTRIBUTE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEATTRIBUTE_STUB_BUILD_DLL */ +#else /* SIMPLEATTRIBUTE_STUB_HAS_DLL == 1 */ +# define SIMPLEATTRIBUTE_STUB_Export +# define SIMPLEATTRIBUTE_STUB_SINGLETON_DECLARATION(T) +# define SIMPLEATTRIBUTE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEATTRIBUTE_STUB_HAS_DLL == 1 */ + +// Set SIMPLEATTRIBUTE_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEATTRIBUTE_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEATTRIBUTE_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEATTRIBUTE_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEATTRIBUTE_STUB_NTRACE */ + +#if (SIMPLEATTRIBUTE_STUB_NTRACE == 1) +# define SIMPLEATTRIBUTE_STUB_TRACE(X) +#else /* (SIMPLEATTRIBUTE_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEATTRIBUTE_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEATTRIBUTE_STUB_NTRACE == 1) */ + +#endif /* SIMPLEATTRIBUTE_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_svnt_export.h new file mode 100644 index 00000000000..6c1f3cf5a6f --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEATTRIBUTE_SVNT +// ------------------------------ +#ifndef SIMPLEATTRIBUTE_SVNT_EXPORT_H +#define SIMPLEATTRIBUTE_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEATTRIBUTE_SVNT_HAS_DLL) +# define SIMPLEATTRIBUTE_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEATTRIBUTE_SVNT_HAS_DLL */ + +#if !defined (SIMPLEATTRIBUTE_SVNT_HAS_DLL) +# define SIMPLEATTRIBUTE_SVNT_HAS_DLL 1 +#endif /* ! SIMPLEATTRIBUTE_SVNT_HAS_DLL */ + +#if defined (SIMPLEATTRIBUTE_SVNT_HAS_DLL) && (SIMPLEATTRIBUTE_SVNT_HAS_DLL == 1) +# if defined (SIMPLEATTRIBUTE_SVNT_BUILD_DLL) +# define SIMPLEATTRIBUTE_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLEATTRIBUTE_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEATTRIBUTE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEATTRIBUTE_SVNT_BUILD_DLL */ +# define SIMPLEATTRIBUTE_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLEATTRIBUTE_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEATTRIBUTE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEATTRIBUTE_SVNT_BUILD_DLL */ +#else /* SIMPLEATTRIBUTE_SVNT_HAS_DLL == 1 */ +# define SIMPLEATTRIBUTE_SVNT_Export +# define SIMPLEATTRIBUTE_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLEATTRIBUTE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEATTRIBUTE_SVNT_HAS_DLL == 1 */ + +// Set SIMPLEATTRIBUTE_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEATTRIBUTE_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEATTRIBUTE_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEATTRIBUTE_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEATTRIBUTE_SVNT_NTRACE */ + +#if (SIMPLEATTRIBUTE_SVNT_NTRACE == 1) +# define SIMPLEATTRIBUTE_SVNT_TRACE(X) +#else /* (SIMPLEATTRIBUTE_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEATTRIBUTE_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEATTRIBUTE_SVNT_NTRACE == 1) */ + +#endif /* SIMPLEATTRIBUTE_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.idl new file mode 100644 index 00000000000..6f943e9d1d5 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef SIMPLE_COMMON_IDL +#define SIMPLE_COMMON_IDL + +#include "Components.idl" + +module Simple +{ + interface Trigger + { + void hello (in string hello); + }; + + eventtype Hello + { + public string hello_; + }; +}; + +#endif /*SIMPLE_COMMON_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.mpc new file mode 100644 index 00000000000..b1f86554639 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.mpc @@ -0,0 +1,67 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl SimpleCommon" + +project(SimpleCommon_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLECOMMON_STUB_Export \ + -Wb,stub_export_include=SimpleCommon_stub_export.h \ + -Wb,skel_export_macro=SIMPLECOMMON_SVNT_Export \ + -Wb,skel_export_include=SimpleCommon_svnt_export.h + + IDL_Files { + SimpleCommon.idl + } +} + +project(SimpleCommon_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleCommon_idl_gen + libs += + + sharedname = SimpleCommon_stub + dynamicflags = SIMPLECOMMON_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleCommonC.cpp + } + + Header_Files { + SimpleCommonC.h + SimpleCommon_stub_export.h + } + + Inline_Files { + SimpleCommonC.inl + } +} + +project(SimpleCommon_skel) : ccm_svnt { + avoids += ace_for_tao + after += SimpleCommon_stub + sharedname = SimpleCommon_skel + libs += SimpleCommon_stub + + dynamicflags = SIMPLECOMMON_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleCommonS.cpp + } + + Header_Files { + SimpleCommonS.h + SimpleCommon_svnt_export.h + } + + Inline_Files { + SimpleCommonS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_stub_export.h new file mode 100644 index 00000000000..79aac6677b7 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLECOMMON_STUB +// ------------------------------ +#ifndef SIMPLECOMMON_STUB_EXPORT_H +#define SIMPLECOMMON_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLECOMMON_STUB_HAS_DLL) +# define SIMPLECOMMON_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLECOMMON_STUB_HAS_DLL */ + +#if !defined (SIMPLECOMMON_STUB_HAS_DLL) +# define SIMPLECOMMON_STUB_HAS_DLL 1 +#endif /* ! SIMPLECOMMON_STUB_HAS_DLL */ + +#if defined (SIMPLECOMMON_STUB_HAS_DLL) && (SIMPLECOMMON_STUB_HAS_DLL == 1) +# if defined (SIMPLECOMMON_STUB_BUILD_DLL) +# define SIMPLECOMMON_STUB_Export ACE_Proper_Export_Flag +# define SIMPLECOMMON_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLECOMMON_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLECOMMON_STUB_BUILD_DLL */ +# define SIMPLECOMMON_STUB_Export ACE_Proper_Import_Flag +# define SIMPLECOMMON_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLECOMMON_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLECOMMON_STUB_BUILD_DLL */ +#else /* SIMPLECOMMON_STUB_HAS_DLL == 1 */ +# define SIMPLECOMMON_STUB_Export +# define SIMPLECOMMON_STUB_SINGLETON_DECLARATION(T) +# define SIMPLECOMMON_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLECOMMON_STUB_HAS_DLL == 1 */ + +// Set SIMPLECOMMON_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLECOMMON_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLECOMMON_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLECOMMON_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLECOMMON_STUB_NTRACE */ + +#if (SIMPLECOMMON_STUB_NTRACE == 1) +# define SIMPLECOMMON_STUB_TRACE(X) +#else /* (SIMPLECOMMON_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLECOMMON_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLECOMMON_STUB_NTRACE == 1) */ + +#endif /* SIMPLECOMMON_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_svnt_export.h new file mode 100644 index 00000000000..0190bfeebab --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLECOMMON_SVNT +// ------------------------------ +#ifndef SIMPLECOMMON_SVNT_EXPORT_H +#define SIMPLECOMMON_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLECOMMON_SVNT_HAS_DLL) +# define SIMPLECOMMON_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLECOMMON_SVNT_HAS_DLL */ + +#if !defined (SIMPLECOMMON_SVNT_HAS_DLL) +# define SIMPLECOMMON_SVNT_HAS_DLL 1 +#endif /* ! SIMPLECOMMON_SVNT_HAS_DLL */ + +#if defined (SIMPLECOMMON_SVNT_HAS_DLL) && (SIMPLECOMMON_SVNT_HAS_DLL == 1) +# if defined (SIMPLECOMMON_SVNT_BUILD_DLL) +# define SIMPLECOMMON_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLECOMMON_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLECOMMON_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLECOMMON_SVNT_BUILD_DLL */ +# define SIMPLECOMMON_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLECOMMON_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLECOMMON_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLECOMMON_SVNT_BUILD_DLL */ +#else /* SIMPLECOMMON_SVNT_HAS_DLL == 1 */ +# define SIMPLECOMMON_SVNT_Export +# define SIMPLECOMMON_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLECOMMON_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLECOMMON_SVNT_HAS_DLL == 1 */ + +// Set SIMPLECOMMON_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLECOMMON_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLECOMMON_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLECOMMON_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLECOMMON_SVNT_NTRACE */ + +#if (SIMPLECOMMON_SVNT_NTRACE == 1) +# define SIMPLECOMMON_SVNT_TRACE(X) +#else /* (SIMPLECOMMON_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLECOMMON_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLECOMMON_SVNT_NTRACE == 1) */ + +#endif /* SIMPLECOMMON_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.cidl new file mode 100644 index 00000000000..ff5081f82dd --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.cidl @@ -0,0 +1,11 @@ +// $Id$ +#include "SimpleConsumer.idl" + +composition session SimpleConsumer_Impl +{ + home executor SimpleConsumerHome_Exec + { + implements Simple::SimpleConsumerHome; + manages SimpleConsumer_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.idl new file mode 100644 index 00000000000..3895eacda3c --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef SIMPLE_CONSUMER_IDL +#define SIMPLE_CONSUMER_IDL + +#include "SimpleCommon.idl" +#include <Components.idl> + +module Simple +{ + component SimpleConsumer + { + consumes Hello hello_; + }; + + home SimpleConsumerHome manages SimpleConsumer + { + }; +}; + +#endif /*SIMPLE_CONSUMER_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.mpc new file mode 100644 index 00000000000..bece676d798 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.mpc @@ -0,0 +1,121 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleConsumer" + +project(SimpleCommon_SimpleConsumer_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLECONSUMER_STUB_Export \ + -Wb,stub_export_include=SimpleConsumer_stub_export.h \ + -Wb,skel_export_macro=SIMPLECONSUMER_SVNT_Export \ + -Wb,skel_export_include=SimpleConsumer_svnt_export.h + + IDL_Files { + SimpleConsumer.idl + } +} + +project(SimpleCommon_SimpleConsumer_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLECONSUMER_SVNT_Export \ + --svnt-export-include SimpleConsumer_svnt_export.h + idlflags += -Wb,export_macro=SIMPLECONSUMER_EXEC_Export \ + -Wb,export_include=SimpleConsumer_exec_export.h \ + -SS + + CIDL_Files { + SimpleConsumer.cidl + } + + IDL_Files { + SimpleConsumerE.idl + } +} + +project(SimpleCommon_SimpleConsumer_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleCommon_SimpleConsumer_idl_gen SimpleCommon_stub + libs += SimpleCommon_stub + + sharedname = SimpleConsumer_stub + dynamicflags = SIMPLECONSUMER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleConsumerC.cpp + } + + Header_Files { + SimpleConsumerC.h + SimpleConsumer_stub_export.h + } + + Inline_Files { + SimpleConsumerC.inl + } +} + +project(SimpleCommon_SimpleConsumer_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleCommon_SimpleConsumer_cidl_gen SimpleCommon_SimpleConsumer_stub + sharedname = SimpleConsumer_exec + libs += SimpleConsumer_stub SimpleCommon_stub + + dynamicflags = SIMPLECONSUMER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleConsumerEC.cpp + SimpleConsumer_exec.cpp + } + + Header_Files { + SimpleConsumerEC.h + SimpleConsumer_exec.h + SimpleConsumer_exec_export.h + } + + Inline_Files { + SimpleConsumerEC.inl + } +} + + +project(SimpleCommon_SimpleConsumer_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleCommon_skel SimpleCommon_SimpleConsumer_exec + sharedname = SimpleConsumer_svnt + libs += SimpleConsumer_exec \ + SimpleConsumer_stub \ + SimpleCommon_skel \ + SimpleCommon_stub + + dynamicflags = SIMPLECONSUMER_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimpleConsumerS.cpp + SimpleConsumer_svnt.cpp + } + + Header_Files { + SimpleConsumerS.h + SimpleConsumer_svnt.h + SimpleConsumer_svnt_export.h + } + + Inline_Files { + SimpleConsumerS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.cpp new file mode 100644 index 00000000000..f8201a17fb9 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.cpp @@ -0,0 +1,156 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimpleConsumer_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimpleConsumer_Impl +{ + //================================================================== + // Component Executor Implementation Class: SimpleConsumer_exec_i + //================================================================== + + SimpleConsumer_exec_i::SimpleConsumer_exec_i (void) + { + CIAO_TRACE ("SimpleConsumer_exec_i::SimpleConsumer_exec_i (void)"); + } + + SimpleConsumer_exec_i::~SimpleConsumer_exec_i (void) + { + CIAO_TRACE ("SimpleConsumer_exec_i::~SimpleConsumer_exec_i (void)"); + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + void + SimpleConsumer_exec_i::push_hello_ ( + ::Simple::Hello * ev ) + { + CIAO_TRACE ("SimpleConsumer_exec_i::push_hello_ ()"); + // Your code here. + + CIAO_DEBUG ((LM_EMERGENCY, "SimpleConsumer_exec_i::push_hello_ - " + "Received hello event, value is %s\n", ev->hello_ ())); + } + + // Operations from Components::SessionComponent + + void + SimpleConsumer_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + CIAO_TRACE ("SimpleConsumer_exec_i::set_session_context ()"); + + this->context_ = + ::Simple::CCM_SimpleConsumer_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimpleConsumer_exec_i::configuration_complete () + { + CIAO_TRACE ("SimpleConsumer_exec_i::configuration_complete ()"); + // Your code here. + } + + void + SimpleConsumer_exec_i::ccm_activate () + { + CIAO_TRACE ("SimpleConsumer_exec_i::ccm_activate ()"); + // Your code here. + } + + void + SimpleConsumer_exec_i::ccm_passivate () + { + CIAO_TRACE ("SimpleConsumer_exec_i::ccm_passivate ()"); + // Your code here. + } + + void + SimpleConsumer_exec_i::ccm_remove () + { + CIAO_TRACE ("SimpleConsumer_exec_i::ccm_remove ()"); + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: SimpleConsumerHome_exec_i + //================================================================== + + SimpleConsumerHome_exec_i::SimpleConsumerHome_exec_i (void) + { + CIAO_TRACE ("SimpleConsumerHome_exec_i::SimpleConsumerHome_exec_i (void)"); + } + + SimpleConsumerHome_exec_i::~SimpleConsumerHome_exec_i (void) + { + CIAO_TRACE ("SimpleConsumerHome_exec_i::~SimpleConsumerHome_exec_i (void)"); + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimpleConsumerHome_exec_i::create () + { + CIAO_TRACE ("SimpleConsumerHome_exec_i::create ()"); + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimpleConsumer_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLECONSUMER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleConsumerHome_Impl (void) + { + CIAO_TRACE ("create_Simple_SimpleConsumerHome_Impl (void)"); + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimpleConsumerHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.h new file mode 100644 index 00000000000..e4b9607bb45 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.h @@ -0,0 +1,102 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLECONSUMER_EXEC_H +#define CIAO_SIMPLECONSUMER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimpleConsumerEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimpleConsumer_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimpleConsumer_Impl +{ + class SIMPLECONSUMER_EXEC_Export SimpleConsumer_exec_i + : public virtual SimpleConsumer_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleConsumer_exec_i (void); + virtual ~SimpleConsumer_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + virtual void + push_hello_ ( + ::Simple::Hello *ev); + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimpleConsumer_Context_var context_; + }; + + class SIMPLECONSUMER_EXEC_Export SimpleConsumerHome_exec_i + : public virtual SimpleConsumerHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleConsumerHome_exec_i (void); + virtual ~SimpleConsumerHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SIMPLECONSUMER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleConsumerHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLECONSUMER_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec_export.h new file mode 100644 index 00000000000..a8074c4c81f --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLECONSUMER_EXEC +// ------------------------------ +#ifndef SIMPLECONSUMER_EXEC_EXPORT_H +#define SIMPLECONSUMER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLECONSUMER_EXEC_HAS_DLL) +# define SIMPLECONSUMER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLECONSUMER_EXEC_HAS_DLL */ + +#if !defined (SIMPLECONSUMER_EXEC_HAS_DLL) +# define SIMPLECONSUMER_EXEC_HAS_DLL 1 +#endif /* ! SIMPLECONSUMER_EXEC_HAS_DLL */ + +#if defined (SIMPLECONSUMER_EXEC_HAS_DLL) && (SIMPLECONSUMER_EXEC_HAS_DLL == 1) +# if defined (SIMPLECONSUMER_EXEC_BUILD_DLL) +# define SIMPLECONSUMER_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLECONSUMER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLECONSUMER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLECONSUMER_EXEC_BUILD_DLL */ +# define SIMPLECONSUMER_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLECONSUMER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLECONSUMER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLECONSUMER_EXEC_BUILD_DLL */ +#else /* SIMPLECONSUMER_EXEC_HAS_DLL == 1 */ +# define SIMPLECONSUMER_EXEC_Export +# define SIMPLECONSUMER_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLECONSUMER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLECONSUMER_EXEC_HAS_DLL == 1 */ + +// Set SIMPLECONSUMER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLECONSUMER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLECONSUMER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLECONSUMER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLECONSUMER_EXEC_NTRACE */ + +#if (SIMPLECONSUMER_EXEC_NTRACE == 1) +# define SIMPLECONSUMER_EXEC_TRACE(X) +#else /* (SIMPLECONSUMER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLECONSUMER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLECONSUMER_EXEC_NTRACE == 1) */ + +#endif /* SIMPLECONSUMER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_stub_export.h new file mode 100644 index 00000000000..89e5e37b32e --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLECONSUMER_STUB +// ------------------------------ +#ifndef SIMPLECONSUMER_STUB_EXPORT_H +#define SIMPLECONSUMER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLECONSUMER_STUB_HAS_DLL) +# define SIMPLECONSUMER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLECONSUMER_STUB_HAS_DLL */ + +#if !defined (SIMPLECONSUMER_STUB_HAS_DLL) +# define SIMPLECONSUMER_STUB_HAS_DLL 1 +#endif /* ! SIMPLECONSUMER_STUB_HAS_DLL */ + +#if defined (SIMPLECONSUMER_STUB_HAS_DLL) && (SIMPLECONSUMER_STUB_HAS_DLL == 1) +# if defined (SIMPLECONSUMER_STUB_BUILD_DLL) +# define SIMPLECONSUMER_STUB_Export ACE_Proper_Export_Flag +# define SIMPLECONSUMER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLECONSUMER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLECONSUMER_STUB_BUILD_DLL */ +# define SIMPLECONSUMER_STUB_Export ACE_Proper_Import_Flag +# define SIMPLECONSUMER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLECONSUMER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLECONSUMER_STUB_BUILD_DLL */ +#else /* SIMPLECONSUMER_STUB_HAS_DLL == 1 */ +# define SIMPLECONSUMER_STUB_Export +# define SIMPLECONSUMER_STUB_SINGLETON_DECLARATION(T) +# define SIMPLECONSUMER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLECONSUMER_STUB_HAS_DLL == 1 */ + +// Set SIMPLECONSUMER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLECONSUMER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLECONSUMER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLECONSUMER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLECONSUMER_STUB_NTRACE */ + +#if (SIMPLECONSUMER_STUB_NTRACE == 1) +# define SIMPLECONSUMER_STUB_TRACE(X) +#else /* (SIMPLECONSUMER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLECONSUMER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLECONSUMER_STUB_NTRACE == 1) */ + +#endif /* SIMPLECONSUMER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_svnt_export.h new file mode 100644 index 00000000000..eab50bcfd0a --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLECONSUMER_SVNT +// ------------------------------ +#ifndef SIMPLECONSUMER_SVNT_EXPORT_H +#define SIMPLECONSUMER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLECONSUMER_SVNT_HAS_DLL) +# define SIMPLECONSUMER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLECONSUMER_SVNT_HAS_DLL */ + +#if !defined (SIMPLECONSUMER_SVNT_HAS_DLL) +# define SIMPLECONSUMER_SVNT_HAS_DLL 1 +#endif /* ! SIMPLECONSUMER_SVNT_HAS_DLL */ + +#if defined (SIMPLECONSUMER_SVNT_HAS_DLL) && (SIMPLECONSUMER_SVNT_HAS_DLL == 1) +# if defined (SIMPLECONSUMER_SVNT_BUILD_DLL) +# define SIMPLECONSUMER_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLECONSUMER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLECONSUMER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLECONSUMER_SVNT_BUILD_DLL */ +# define SIMPLECONSUMER_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLECONSUMER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLECONSUMER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLECONSUMER_SVNT_BUILD_DLL */ +#else /* SIMPLECONSUMER_SVNT_HAS_DLL == 1 */ +# define SIMPLECONSUMER_SVNT_Export +# define SIMPLECONSUMER_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLECONSUMER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLECONSUMER_SVNT_HAS_DLL == 1 */ + +// Set SIMPLECONSUMER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLECONSUMER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLECONSUMER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLECONSUMER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLECONSUMER_SVNT_NTRACE */ + +#if (SIMPLECONSUMER_SVNT_NTRACE == 1) +# define SIMPLECONSUMER_SVNT_TRACE(X) +#else /* (SIMPLECONSUMER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLECONSUMER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLECONSUMER_SVNT_NTRACE == 1) */ + +#endif /* SIMPLECONSUMER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.cidl new file mode 100644 index 00000000000..9de9153b267 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.cidl @@ -0,0 +1,11 @@ +// $Id$ +#include "SimpleEmitter.idl" + +composition session SimpleEmitter_Impl +{ + home executor SimpleEmitterHome_Exec + { + implements Simple::SimpleEmitterHome; + manages SimpleEmitter_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.idl new file mode 100644 index 00000000000..37431ca8134 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef SIMPLE_EMITTER_IDL +#define SIMPLE_EMITTER_IDL + +#include "SimpleCommon.idl" +#include "Components.idl" + +module Simple +{ + component SimpleEmitter + { + emits Hello hello; + }; + + home SimpleEmitterHome manages SimpleEmitter + { + }; +}; + +#endif /*SIMPLE_EMITTER_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.mpc new file mode 100644 index 00000000000..6a68a0a5376 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.mpc @@ -0,0 +1,121 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleEmitter" + +project(SimpleCommon_SimpleEmitter_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLEEMITTER_STUB_Export \ + -Wb,stub_export_include=SimpleEmitter_stub_export.h \ + -Wb,skel_export_macro=SIMPLEEMITTER_SVNT_Export \ + -Wb,skel_export_include=SimpleEmitter_svnt_export.h + + IDL_Files { + SimpleEmitter.idl + } +} + +project(SimpleCommon_SimpleEmitter_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLEEMITTER_SVNT_Export \ + --svnt-export-include SimpleEmitter_svnt_export.h + idlflags += -Wb,export_macro=SIMPLEEMITTER_EXEC_Export \ + -Wb,export_include=SimpleEmitter_exec_export.h \ + -SS + + CIDL_Files { + SimpleEmitter.cidl + } + + IDL_Files { + SimpleEmitterE.idl + } +} + +project(SimpleCommon_SimpleEmitter_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleCommon_SimpleEmitter_idl_gen SimpleCommon_stub + libs += SimpleCommon_stub + + sharedname = SimpleEmitter_stub + dynamicflags = SIMPLEEMITTER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleEmitterC.cpp + } + + Header_Files { + SimpleEmitterC.h + SimpleEmitter_stub_export.h + } + + Inline_Files { + SimpleEmitterC.inl + } +} + +project(SimpleCommon_SimpleEmitter_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleCommon_SimpleEmitter_cidl_gen SimpleCommon_SimpleEmitter_stub + sharedname = SimpleEmitter_exec + libs += SimpleEmitter_stub SimpleCommon_stub + + dynamicflags = SIMPLEEMITTER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleEmitterEC.cpp + SimpleEmitter_exec.cpp + } + + Header_Files { + SimpleEmitterEC.h + SimpleEmitter_exec.h + SimpleEmitter_exec_export.h + } + + Inline_Files { + SimpleEmitterEC.inl + } +} + + +project(SimpleCommon_SimpleEmitter_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleCommon_skel SimpleCommon_SimpleEmitter_exec + sharedname = SimpleEmitter_svnt + libs += SimpleEmitter_exec \ + SimpleEmitter_stub \ + SimpleCommon_skel \ + SimpleCommon_stub + + dynamicflags = SIMPLEEMITTER_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimpleEmitterS.cpp + SimpleEmitter_svnt.cpp + } + + Header_Files { + SimpleEmitterS.h + SimpleEmitter_svnt.h + SimpleEmitter_svnt_export.h + } + + Inline_Files { + SimpleEmitterS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.cpp new file mode 100644 index 00000000000..99a3d01f161 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.cpp @@ -0,0 +1,149 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimpleEmitter_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimpleEmitter_Impl +{ + //================================================================== + // Component Executor Implementation Class: SimpleEmitter_exec_i + //================================================================== + + SimpleEmitter_exec_i::SimpleEmitter_exec_i (void) + { + CIAO_TRACE ("SimpleEmitter_exec_i::SimpleEmitter_exec_i (void)"); + } + + SimpleEmitter_exec_i::~SimpleEmitter_exec_i (void) + { + CIAO_TRACE ("SimpleEmitter_exec_i::~SimpleEmitter_exec_i (void)"); + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + void + SimpleEmitter_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + CIAO_TRACE ("SimpleEmitter_exec_i::set_session_context ()"); + this->context_ = + ::Simple::CCM_SimpleEmitter_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimpleEmitter_exec_i::configuration_complete () + { + CIAO_TRACE ("SimpleEmitter_exec_i::configuration_complete ()"); + // Your code here. + } + + void + SimpleEmitter_exec_i::ccm_activate () + { + CIAO_TRACE ("SimpleEmitter_exec_i::ccm_activate ()"); + // Your code here. + + ::Simple::Hello_var hello = new OBV_Simple::Hello ("Test successful, hello from SimpleEmitter_exec_i"); + + this->context_->push_hello (hello._retn ()); + } + + void + SimpleEmitter_exec_i::ccm_passivate () + { + CIAO_TRACE ("SimpleEmitter_exec_i::ccm_passivate ()"); + // Your code here. + } + + void + SimpleEmitter_exec_i::ccm_remove () + { + CIAO_TRACE ("SimpleEmitter_exec_i::ccm_remove ()"); + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: SimpleEmitterHome_exec_i + //================================================================== + + SimpleEmitterHome_exec_i::SimpleEmitterHome_exec_i (void) + { + CIAO_TRACE ("SimpleEmitterHome_exec_i::SimpleEmitterHome_exec_i (void)"); + } + + SimpleEmitterHome_exec_i::~SimpleEmitterHome_exec_i (void) + { + CIAO_TRACE ("SimpleEmitterHome_exec_i::~SimpleEmitterHome_exec_i (void)"); + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimpleEmitterHome_exec_i::create () + { + CIAO_TRACE ("SimpleEmitterHome_exec_i::create ()"); + + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimpleEmitter_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLEEMITTER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleEmitterHome_Impl (void) + { + CIAO_TRACE ("create_Simple_SimpleEmitterHome_Impl (void)"); + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimpleEmitterHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.h new file mode 100644 index 00000000000..a5008a85ea5 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.h @@ -0,0 +1,98 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLEEMITTER_EXEC_H +#define CIAO_SIMPLEEMITTER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimpleEmitterEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimpleEmitter_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimpleEmitter_Impl +{ + class SIMPLEEMITTER_EXEC_Export SimpleEmitter_exec_i + : public virtual SimpleEmitter_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleEmitter_exec_i (void); + virtual ~SimpleEmitter_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimpleEmitter_Context_var context_; + }; + + class SIMPLEEMITTER_EXEC_Export SimpleEmitterHome_exec_i + : public virtual SimpleEmitterHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleEmitterHome_exec_i (void); + virtual ~SimpleEmitterHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SIMPLEEMITTER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleEmitterHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLEEMITTER_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec_export.h new file mode 100644 index 00000000000..53fef48b799 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEEMITTER_EXEC +// ------------------------------ +#ifndef SIMPLEEMITTER_EXEC_EXPORT_H +#define SIMPLEEMITTER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEEMITTER_EXEC_HAS_DLL) +# define SIMPLEEMITTER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEEMITTER_EXEC_HAS_DLL */ + +#if !defined (SIMPLEEMITTER_EXEC_HAS_DLL) +# define SIMPLEEMITTER_EXEC_HAS_DLL 1 +#endif /* ! SIMPLEEMITTER_EXEC_HAS_DLL */ + +#if defined (SIMPLEEMITTER_EXEC_HAS_DLL) && (SIMPLEEMITTER_EXEC_HAS_DLL == 1) +# if defined (SIMPLEEMITTER_EXEC_BUILD_DLL) +# define SIMPLEEMITTER_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLEEMITTER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEEMITTER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEEMITTER_EXEC_BUILD_DLL */ +# define SIMPLEEMITTER_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLEEMITTER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEEMITTER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEEMITTER_EXEC_BUILD_DLL */ +#else /* SIMPLEEMITTER_EXEC_HAS_DLL == 1 */ +# define SIMPLEEMITTER_EXEC_Export +# define SIMPLEEMITTER_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLEEMITTER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEEMITTER_EXEC_HAS_DLL == 1 */ + +// Set SIMPLEEMITTER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEEMITTER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEEMITTER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEEMITTER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEEMITTER_EXEC_NTRACE */ + +#if (SIMPLEEMITTER_EXEC_NTRACE == 1) +# define SIMPLEEMITTER_EXEC_TRACE(X) +#else /* (SIMPLEEMITTER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEEMITTER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEEMITTER_EXEC_NTRACE == 1) */ + +#endif /* SIMPLEEMITTER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_stub_export.h new file mode 100644 index 00000000000..797140271a4 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEEMITTER_STUB +// ------------------------------ +#ifndef SIMPLEEMITTER_STUB_EXPORT_H +#define SIMPLEEMITTER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEEMITTER_STUB_HAS_DLL) +# define SIMPLEEMITTER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEEMITTER_STUB_HAS_DLL */ + +#if !defined (SIMPLEEMITTER_STUB_HAS_DLL) +# define SIMPLEEMITTER_STUB_HAS_DLL 1 +#endif /* ! SIMPLEEMITTER_STUB_HAS_DLL */ + +#if defined (SIMPLEEMITTER_STUB_HAS_DLL) && (SIMPLEEMITTER_STUB_HAS_DLL == 1) +# if defined (SIMPLEEMITTER_STUB_BUILD_DLL) +# define SIMPLEEMITTER_STUB_Export ACE_Proper_Export_Flag +# define SIMPLEEMITTER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEEMITTER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEEMITTER_STUB_BUILD_DLL */ +# define SIMPLEEMITTER_STUB_Export ACE_Proper_Import_Flag +# define SIMPLEEMITTER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEEMITTER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEEMITTER_STUB_BUILD_DLL */ +#else /* SIMPLEEMITTER_STUB_HAS_DLL == 1 */ +# define SIMPLEEMITTER_STUB_Export +# define SIMPLEEMITTER_STUB_SINGLETON_DECLARATION(T) +# define SIMPLEEMITTER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEEMITTER_STUB_HAS_DLL == 1 */ + +// Set SIMPLEEMITTER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEEMITTER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEEMITTER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEEMITTER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEEMITTER_STUB_NTRACE */ + +#if (SIMPLEEMITTER_STUB_NTRACE == 1) +# define SIMPLEEMITTER_STUB_TRACE(X) +#else /* (SIMPLEEMITTER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEEMITTER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEEMITTER_STUB_NTRACE == 1) */ + +#endif /* SIMPLEEMITTER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_svnt_export.h new file mode 100644 index 00000000000..0fdc781a895 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEEMITTER_SVNT +// ------------------------------ +#ifndef SIMPLEEMITTER_SVNT_EXPORT_H +#define SIMPLEEMITTER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEEMITTER_SVNT_HAS_DLL) +# define SIMPLEEMITTER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEEMITTER_SVNT_HAS_DLL */ + +#if !defined (SIMPLEEMITTER_SVNT_HAS_DLL) +# define SIMPLEEMITTER_SVNT_HAS_DLL 1 +#endif /* ! SIMPLEEMITTER_SVNT_HAS_DLL */ + +#if defined (SIMPLEEMITTER_SVNT_HAS_DLL) && (SIMPLEEMITTER_SVNT_HAS_DLL == 1) +# if defined (SIMPLEEMITTER_SVNT_BUILD_DLL) +# define SIMPLEEMITTER_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLEEMITTER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEEMITTER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEEMITTER_SVNT_BUILD_DLL */ +# define SIMPLEEMITTER_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLEEMITTER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEEMITTER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEEMITTER_SVNT_BUILD_DLL */ +#else /* SIMPLEEMITTER_SVNT_HAS_DLL == 1 */ +# define SIMPLEEMITTER_SVNT_Export +# define SIMPLEEMITTER_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLEEMITTER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEEMITTER_SVNT_HAS_DLL == 1 */ + +// Set SIMPLEEMITTER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEEMITTER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEEMITTER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEEMITTER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEEMITTER_SVNT_NTRACE */ + +#if (SIMPLEEMITTER_SVNT_NTRACE == 1) +# define SIMPLEEMITTER_SVNT_TRACE(X) +#else /* (SIMPLEEMITTER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEEMITTER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEEMITTER_SVNT_NTRACE == 1) */ + +#endif /* SIMPLEEMITTER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.cidl new file mode 100644 index 00000000000..638efe0cb30 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.cidl @@ -0,0 +1,11 @@ +// $Id$ +#include "SimpleMultipleUser.idl" + +composition session SimpleMultipleUser_Impl +{ + home executor SimpleMultipleUserHome_Exec + { + implements Simple::SimpleMultipleUserHome; + manages SimpleMultipleUser_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.idl new file mode 100644 index 00000000000..60aec58f9af --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef SIMPLE_MULTIPLEUSER_IDL +#define SIMPLE_MULTIPLEUSER_IDL + +#include "SimpleCommon.idl" +#include "Components.idl" + +module Simple +{ + component SimpleMultipleUser + { + uses multiple Trigger trig; + }; + + home SimpleMultipleUserHome manages SimpleMultipleUser + { + }; +}; + +#endif /*SIMPLE_MULTIPLEUSER_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.mpc new file mode 100644 index 00000000000..841ba3c2c99 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.mpc @@ -0,0 +1,121 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleMultipleUser" + +project(SimpleCommon_SimpleMultipleUser_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLEMULTIPLEUSER_STUB_Export \ + -Wb,stub_export_include=SimpleMultipleUser_stub_export.h \ + -Wb,skel_export_macro=SIMPLEMULTIPLEUSER_SVNT_Export \ + -Wb,skel_export_include=SimpleMultipleUser_svnt_export.h + + IDL_Files { + SimpleMultipleUser.idl + } +} + +project(SimpleCommon_SimpleMultipleUser_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLEMULTIPLEUSER_SVNT_Export \ + --svnt-export-include SimpleMultipleUser_svnt_export.h + idlflags += -Wb,export_macro=SIMPLEMULTIPLEUSER_EXEC_Export \ + -Wb,export_include=SimpleMultipleUser_exec_export.h \ + -SS + + CIDL_Files { + SimpleMultipleUser.cidl + } + + IDL_Files { + SimpleMultipleUserE.idl + } +} + +project(SimpleCommon_SimpleMultipleUser_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleCommon_SimpleMultipleUser_idl_gen SimpleCommon_stub + libs += SimpleCommon_stub + + sharedname = SimpleMultipleUser_stub + dynamicflags = SIMPLEMULTIPLEUSER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleMultipleUserC.cpp + } + + Header_Files { + SimpleMultipleUserC.h + SimpleMultipleUser_stub_export.h + } + + Inline_Files { + SimpleMultipleUserC.inl + } +} + +project(SimpleCommon_SimpleMultipleUser_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleCommon_SimpleMultipleUser_cidl_gen SimpleCommon_SimpleMultipleUser_stub + sharedname = SimpleMultipleUser_exec + libs += SimpleMultipleUser_stub SimpleCommon_stub + + dynamicflags = SIMPLEMULTIPLEUSER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleMultipleUserEC.cpp + SimpleMultipleUser_exec.cpp + } + + Header_Files { + SimpleMultipleUserEC.h + SimpleMultipleUser_exec.h + SimpleMultipleUser_exec_export.h + } + + Inline_Files { + SimpleMultipleUserEC.inl + } +} + + +project(SimpleCommon_SimpleMultipleUser_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleCommon_skel SimpleCommon_SimpleMultipleUser_exec + sharedname = SimpleMultipleUser_svnt + libs += SimpleMultipleUser_exec \ + SimpleMultipleUser_stub \ + SimpleCommon_skel \ + SimpleCommon_stub + + dynamicflags = SIMPLEMULTIPLEUSER_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimpleMultipleUserS.cpp + SimpleMultipleUser_svnt.cpp + } + + Header_Files { + SimpleMultipleUserS.h + SimpleMultipleUser_svnt.h + SimpleMultipleUser_svnt_export.h + } + + Inline_Files { + SimpleMultipleUserS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.cpp new file mode 100644 index 00000000000..e69a11e6e0e --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.cpp @@ -0,0 +1,176 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimpleMultipleUser_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimpleMultipleUser_Impl +{ + //================================================================== + // Component Executor Implementation Class: SimpleMultipleUser_exec_i + //================================================================== + + SimpleMultipleUser_exec_i::SimpleMultipleUser_exec_i (void) + { + CIAO_TRACE ("SimpleMultipleUser_exec_i::SimpleMultipleUser_exec_i (void)"); + } + + SimpleMultipleUser_exec_i::~SimpleMultipleUser_exec_i (void) + { + CIAO_TRACE ("SimpleMultipleUser_exec_i::~SimpleMultipleUser_exec_i (void)"); + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + void + SimpleMultipleUser_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + CIAO_TRACE ("SimpleMultipleUser_exec_i::set_session_context ()"); + this->context_ = + ::Simple::CCM_SimpleMultipleUser_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimpleMultipleUser_exec_i::configuration_complete () + { + CIAO_TRACE ("SimpleMultipleUser_exec_i::configuration_complete ()"); + // Your code here. + } + + void + SimpleMultipleUser_exec_i::ccm_activate () + { + CIAO_TRACE ("SimpleMultipleUser_exec_i::ccm_activate ()"); + + ::Simple::SimpleMultipleUser::trigConnections_var conns = + this->context_->get_connections_trig (); + + CIAO_DEBUG ((LM_NOTICE, "SimpleMultipleUser_exec_i::ccm_activate - " + "Got %u connections to my receptacle\n", + conns->length ())); + + for (CORBA::ULong i = 0; i < conns->length (); ++i) + { + try + { + CIAO_DEBUG ((LM_NOTICE, "SimpleMultipleUser_exec_i::ccm_activate - " + "Invoking %u'th connection\n", i)); + ::Simple::Trigger_var trig (conns[i].objref); + + trig->hello ("Test succeeded, hello from SimpleMultipleUser_exec"); + } + catch (CORBA::Exception &ex) + { + CIAO_ERROR ((LM_ERROR, "SimpleMultipleUser_exec_i::ccm_activate () - " + "Caught CORBA exception on %u'th reference, details follow:\n", + i)); + ex._tao_print_exception ("SimpleUser_exec_i::ccm_activate () - "); + } + catch (...) + { + CIAO_ERROR ((LM_ERROR, "SimpleMultipleUser_exec_i::ccm_activate () - " + "Error: Caught unknown exception whilst invoking reference for port trig.\n")); + } + } + + // Your code here. + } + + void + SimpleMultipleUser_exec_i::ccm_passivate () + { + CIAO_TRACE ("SimpleMultipleUser_exec_i::ccm_passivate ()"); + // Your code here. + } + + void + SimpleMultipleUser_exec_i::ccm_remove () + { + CIAO_TRACE ("SimpleMultipleUser_exec_i::ccm_remove ()"); + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: SimpleMultipleUserHome_exec_i + //================================================================== + + SimpleMultipleUserHome_exec_i::SimpleMultipleUserHome_exec_i (void) + { + CIAO_TRACE ("SimpleMultipleUserHome_exec_i::SimpleMultipleUserHome_exec_i (void)"); + } + + SimpleMultipleUserHome_exec_i::~SimpleMultipleUserHome_exec_i (void) + { + CIAO_TRACE ("SimpleMultipleUserHome_exec_i::~SimpleMultipleUserHome_exec_i (void)"); + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimpleMultipleUserHome_exec_i::create () + { + CIAO_TRACE ("SimpleMultipleUserHome_exec_i::create ()"); + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimpleMultipleUser_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLEMULTIPLEUSER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleMultipleUserHome_Impl (void) + { + CIAO_TRACE ("create_Simple_SimpleMultipleUserHome_Impl (void)"); + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimpleMultipleUserHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.h new file mode 100644 index 00000000000..180cce92554 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.h @@ -0,0 +1,98 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLEMULTIPLEUSER_EXEC_H +#define CIAO_SIMPLEMULTIPLEUSER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimpleMultipleUserEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimpleMultipleUser_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimpleMultipleUser_Impl +{ + class SIMPLEMULTIPLEUSER_EXEC_Export SimpleMultipleUser_exec_i + : public virtual SimpleMultipleUser_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleMultipleUser_exec_i (void); + virtual ~SimpleMultipleUser_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimpleMultipleUser_Context_var context_; + }; + + class SIMPLEMULTIPLEUSER_EXEC_Export SimpleMultipleUserHome_exec_i + : public virtual SimpleMultipleUserHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleMultipleUserHome_exec_i (void); + virtual ~SimpleMultipleUserHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SIMPLEMULTIPLEUSER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleMultipleUserHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLEMULTIPLEUSER_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec_export.h new file mode 100644 index 00000000000..79cec9f8fe7 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEMULTIPLEUSER_EXEC +// ------------------------------ +#ifndef SIMPLEMULTIPLEUSER_EXEC_EXPORT_H +#define SIMPLEMULTIPLEUSER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEMULTIPLEUSER_EXEC_HAS_DLL) +# define SIMPLEMULTIPLEUSER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEMULTIPLEUSER_EXEC_HAS_DLL */ + +#if !defined (SIMPLEMULTIPLEUSER_EXEC_HAS_DLL) +# define SIMPLEMULTIPLEUSER_EXEC_HAS_DLL 1 +#endif /* ! SIMPLEMULTIPLEUSER_EXEC_HAS_DLL */ + +#if defined (SIMPLEMULTIPLEUSER_EXEC_HAS_DLL) && (SIMPLEMULTIPLEUSER_EXEC_HAS_DLL == 1) +# if defined (SIMPLEMULTIPLEUSER_EXEC_BUILD_DLL) +# define SIMPLEMULTIPLEUSER_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLEMULTIPLEUSER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEMULTIPLEUSER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEMULTIPLEUSER_EXEC_BUILD_DLL */ +# define SIMPLEMULTIPLEUSER_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLEMULTIPLEUSER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEMULTIPLEUSER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEMULTIPLEUSER_EXEC_BUILD_DLL */ +#else /* SIMPLEMULTIPLEUSER_EXEC_HAS_DLL == 1 */ +# define SIMPLEMULTIPLEUSER_EXEC_Export +# define SIMPLEMULTIPLEUSER_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLEMULTIPLEUSER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEMULTIPLEUSER_EXEC_HAS_DLL == 1 */ + +// Set SIMPLEMULTIPLEUSER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEMULTIPLEUSER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEMULTIPLEUSER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEMULTIPLEUSER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEMULTIPLEUSER_EXEC_NTRACE */ + +#if (SIMPLEMULTIPLEUSER_EXEC_NTRACE == 1) +# define SIMPLEMULTIPLEUSER_EXEC_TRACE(X) +#else /* (SIMPLEMULTIPLEUSER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEMULTIPLEUSER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEMULTIPLEUSER_EXEC_NTRACE == 1) */ + +#endif /* SIMPLEMULTIPLEUSER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_stub_export.h new file mode 100644 index 00000000000..bf0be40ece3 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEMULTIPLEUSER_STUB +// ------------------------------ +#ifndef SIMPLEMULTIPLEUSER_STUB_EXPORT_H +#define SIMPLEMULTIPLEUSER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEMULTIPLEUSER_STUB_HAS_DLL) +# define SIMPLEMULTIPLEUSER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEMULTIPLEUSER_STUB_HAS_DLL */ + +#if !defined (SIMPLEMULTIPLEUSER_STUB_HAS_DLL) +# define SIMPLEMULTIPLEUSER_STUB_HAS_DLL 1 +#endif /* ! SIMPLEMULTIPLEUSER_STUB_HAS_DLL */ + +#if defined (SIMPLEMULTIPLEUSER_STUB_HAS_DLL) && (SIMPLEMULTIPLEUSER_STUB_HAS_DLL == 1) +# if defined (SIMPLEMULTIPLEUSER_STUB_BUILD_DLL) +# define SIMPLEMULTIPLEUSER_STUB_Export ACE_Proper_Export_Flag +# define SIMPLEMULTIPLEUSER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEMULTIPLEUSER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEMULTIPLEUSER_STUB_BUILD_DLL */ +# define SIMPLEMULTIPLEUSER_STUB_Export ACE_Proper_Import_Flag +# define SIMPLEMULTIPLEUSER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEMULTIPLEUSER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEMULTIPLEUSER_STUB_BUILD_DLL */ +#else /* SIMPLEMULTIPLEUSER_STUB_HAS_DLL == 1 */ +# define SIMPLEMULTIPLEUSER_STUB_Export +# define SIMPLEMULTIPLEUSER_STUB_SINGLETON_DECLARATION(T) +# define SIMPLEMULTIPLEUSER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEMULTIPLEUSER_STUB_HAS_DLL == 1 */ + +// Set SIMPLEMULTIPLEUSER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEMULTIPLEUSER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEMULTIPLEUSER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEMULTIPLEUSER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEMULTIPLEUSER_STUB_NTRACE */ + +#if (SIMPLEMULTIPLEUSER_STUB_NTRACE == 1) +# define SIMPLEMULTIPLEUSER_STUB_TRACE(X) +#else /* (SIMPLEMULTIPLEUSER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEMULTIPLEUSER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEMULTIPLEUSER_STUB_NTRACE == 1) */ + +#endif /* SIMPLEMULTIPLEUSER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_svnt_export.h new file mode 100644 index 00000000000..97f0fdf0f00 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEMULTIPLEUSER_SVNT +// ------------------------------ +#ifndef SIMPLEMULTIPLEUSER_SVNT_EXPORT_H +#define SIMPLEMULTIPLEUSER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEMULTIPLEUSER_SVNT_HAS_DLL) +# define SIMPLEMULTIPLEUSER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEMULTIPLEUSER_SVNT_HAS_DLL */ + +#if !defined (SIMPLEMULTIPLEUSER_SVNT_HAS_DLL) +# define SIMPLEMULTIPLEUSER_SVNT_HAS_DLL 1 +#endif /* ! SIMPLEMULTIPLEUSER_SVNT_HAS_DLL */ + +#if defined (SIMPLEMULTIPLEUSER_SVNT_HAS_DLL) && (SIMPLEMULTIPLEUSER_SVNT_HAS_DLL == 1) +# if defined (SIMPLEMULTIPLEUSER_SVNT_BUILD_DLL) +# define SIMPLEMULTIPLEUSER_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLEMULTIPLEUSER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEMULTIPLEUSER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEMULTIPLEUSER_SVNT_BUILD_DLL */ +# define SIMPLEMULTIPLEUSER_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLEMULTIPLEUSER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEMULTIPLEUSER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEMULTIPLEUSER_SVNT_BUILD_DLL */ +#else /* SIMPLEMULTIPLEUSER_SVNT_HAS_DLL == 1 */ +# define SIMPLEMULTIPLEUSER_SVNT_Export +# define SIMPLEMULTIPLEUSER_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLEMULTIPLEUSER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEMULTIPLEUSER_SVNT_HAS_DLL == 1 */ + +// Set SIMPLEMULTIPLEUSER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEMULTIPLEUSER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEMULTIPLEUSER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEMULTIPLEUSER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEMULTIPLEUSER_SVNT_NTRACE */ + +#if (SIMPLEMULTIPLEUSER_SVNT_NTRACE == 1) +# define SIMPLEMULTIPLEUSER_SVNT_TRACE(X) +#else /* (SIMPLEMULTIPLEUSER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEMULTIPLEUSER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEMULTIPLEUSER_SVNT_NTRACE == 1) */ + +#endif /* SIMPLEMULTIPLEUSER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.cidl new file mode 100644 index 00000000000..8c10398272a --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.cidl @@ -0,0 +1,12 @@ +// $Id$ + +#include "SimpleNull.idl" + +composition session SimpleNull_Impl +{ + home executor SimpleNullHome_Exec + { + implements Simple::SimpleNullHome; + manages SimpleProvider_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.idl new file mode 100644 index 00000000000..d8f02901be4 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.idl @@ -0,0 +1,14 @@ +// $Id$ + +#include <Components.idl> + +module Simple +{ + component SimpleNull + { + }; + + home SimpleNullHome manages SimpleNull + { + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.mpc new file mode 100644 index 00000000000..3e64dd78d9b --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.mpc @@ -0,0 +1,119 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl SimpleNull" + +project(SimpleNull_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLENULL_STUB_Export \ + -Wb,stub_export_include=SimpleNull_stub_export.h \ + -Wb,skel_export_macro=SIMPLENULL_SVNT_Export \ + -Wb,skel_export_include=SimpleNull_svnt_export.h + + IDL_Files { + SimpleNull.idl + } +} + +project(SimpleNull_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLENULL_SVNT_Export \ + --svnt-export-include SimpleNull_svnt_export.h + idlflags += -Wb,export_macro=SIMPLENULL_EXEC_Export \ + -Wb,export_include=SimpleNull_exec_export.h \ + -SS + + CIDL_Files { + SimpleNull.cidl + } + + IDL_Files { + SimpleNullE.idl + } +} + +project(SimpleNull_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleNull_idl_gen + libs += + + sharedname = SimpleNull_stub + dynamicflags = SIMPLENULL_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleNullC.cpp + } + + Header_Files { + SimpleNullC.h + SimpleNull_stub_export.h + } + + Inline_Files { + SimpleNullC.inl + } +} + +project(SimpleNull_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleNull_cidl_gen SimpleNull_stub + sharedname = SimpleNull_exec + libs += SimpleNull_stub + + dynamicflags = SIMPLENULL_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleNullEC.cpp + SimpleNull_exec.cpp + } + + Header_Files { + SimpleNullEC.h + SimpleNull_exec.h + SimpleNull_exec_export.h + } + + Inline_Files { + SimpleNullEC.inl + } +} + + +project(SimpleNull_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleNull_exec + sharedname = SimpleNull_svnt + libs += SimpleNull_exec \ + SimpleNull_stub + + dynamicflags = SIMPLENULL_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimpleNullS.cpp + SimpleNull_svnt.cpp + } + + Header_Files { + SimpleNullS.h + SimpleNull_svnt.h + SimpleNull_svnt_export.h + } + + Inline_Files { + SimpleNullS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.cpp new file mode 100644 index 00000000000..15ee5ee2dbb --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.cpp @@ -0,0 +1,168 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimpleNull_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimpleNull_Impl +{ + //================================================================== + // Component Executor Implementation Class: SimpleNull_exec_i + //================================================================== + + SimpleNull_exec_i::SimpleNull_exec_i (void) + { + CIAO_TRACE ("SimpleNull_exec_i::SimpleNull_exec_i (void)"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNull_exec_i::SimpleNull_exec_i (void)\n")); + } + + SimpleNull_exec_i::~SimpleNull_exec_i (void) + { + CIAO_TRACE ("SimpleNull_exec_i::~SimpleNull_exec_i"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNull_exec_i::~SimpleNull_exec_i\n")); + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + void + SimpleNull_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + CIAO_TRACE ("SimpleNull_exec_i::set_session_context"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNull_exec_i::set_session_context\n")); + this->context_ = + ::Simple::CCM_SimpleNull_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimpleNull_exec_i::configuration_complete () + { + CIAO_TRACE ("SimpleNull_exec_i::configuration_complete\n"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNull_exec_i::configuration_complete\n")); + // Your code here. + } + + void + SimpleNull_exec_i::ccm_activate () + { + CIAO_TRACE ("SimpleNull_exec_i::ccm_activate"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNull_exec_i::ccm_activate\n")); + // Your code here. + } + + void + SimpleNull_exec_i::ccm_passivate () + { + CIAO_TRACE ("SimpleNull_exec_i::ccm_passivate"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNull_exec_i::ccm_passivate\n")); + // Your code here. + } + + void + SimpleNull_exec_i::ccm_remove () + { + CIAO_TRACE ("SimpleNull_exec_i::ccm_remove"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNull_exec_i::ccm_remove\n")); + // Your code here. + } + + extern "C" SIMPLENULL_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Simple_SimpleNull_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN (retval, + SimpleNull_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + return retval; + } + + //================================================================== + // Home Executor Implementation Class: SimpleNullHome_exec_i + //================================================================== + + SimpleNullHome_exec_i::SimpleNullHome_exec_i (void) + { + CIAO_TRACE ("SimpleNullHome_exec_i::SimpleNullHome_exec_i"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNullHome_exec_i::SimpleNullHome_exec_i\n")); + } + + SimpleNullHome_exec_i::~SimpleNullHome_exec_i (void) + { + CIAO_TRACE ("SimpleNullHome_exec_i::~SimpleNullHome_exec_i"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNullHome_exec_i::~SimpleNullHome_exec_i\n")); + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimpleNullHome_exec_i::create () + { + CIAO_TRACE ("SimpleNullHome_exec_i::create"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - SimpleNullHome_exec_i::create\n")); + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimpleNull_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLENULL_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleNullHome_Impl (void) + { + CIAO_TRACE ("create_Simple_SimpleNullHome_Impl"); + CIAO_DEBUG ((LM_EMERGENCY, "SimpleNull - Test - Lifecycle event - create_Simple_SimpleNullHome_Impl\n")); + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimpleNullHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.h new file mode 100644 index 00000000000..e5887e7afdc --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.h @@ -0,0 +1,101 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLENULL_EXEC_H +#define CIAO_SIMPLENULL_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimpleNullEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimpleNull_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimpleNull_Impl +{ + class SIMPLENULL_EXEC_Export SimpleNull_exec_i + : public virtual SimpleProvider_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleNull_exec_i (void); + virtual ~SimpleNull_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimpleNull_Context_var context_; + }; + + extern "C" SIMPLENULL_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Simple_SimpleNull_Impl (void); + + class SIMPLENULL_EXEC_Export SimpleNullHome_exec_i + : public virtual SimpleNullHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleNullHome_exec_i (void); + virtual ~SimpleNullHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SIMPLENULL_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleNullHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLENULL_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec_export.h new file mode 100644 index 00000000000..5d0ff473419 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLENULL_EXEC +// ------------------------------ +#ifndef SIMPLENULL_EXEC_EXPORT_H +#define SIMPLENULL_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLENULL_EXEC_HAS_DLL) +# define SIMPLENULL_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLENULL_EXEC_HAS_DLL */ + +#if !defined (SIMPLENULL_EXEC_HAS_DLL) +# define SIMPLENULL_EXEC_HAS_DLL 1 +#endif /* ! SIMPLENULL_EXEC_HAS_DLL */ + +#if defined (SIMPLENULL_EXEC_HAS_DLL) && (SIMPLENULL_EXEC_HAS_DLL == 1) +# if defined (SIMPLENULL_EXEC_BUILD_DLL) +# define SIMPLENULL_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLENULL_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLENULL_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLENULL_EXEC_BUILD_DLL */ +# define SIMPLENULL_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLENULL_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLENULL_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLENULL_EXEC_BUILD_DLL */ +#else /* SIMPLENULL_EXEC_HAS_DLL == 1 */ +# define SIMPLENULL_EXEC_Export +# define SIMPLENULL_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLENULL_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLENULL_EXEC_HAS_DLL == 1 */ + +// Set SIMPLENULL_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLENULL_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLENULL_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLENULL_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLENULL_EXEC_NTRACE */ + +#if (SIMPLENULL_EXEC_NTRACE == 1) +# define SIMPLENULL_EXEC_TRACE(X) +#else /* (SIMPLENULL_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLENULL_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLENULL_EXEC_NTRACE == 1) */ + +#endif /* SIMPLENULL_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_stub_export.h new file mode 100644 index 00000000000..17eef930019 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLENULL_STUB +// ------------------------------ +#ifndef SIMPLENULL_STUB_EXPORT_H +#define SIMPLENULL_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLENULL_STUB_HAS_DLL) +# define SIMPLENULL_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLENULL_STUB_HAS_DLL */ + +#if !defined (SIMPLENULL_STUB_HAS_DLL) +# define SIMPLENULL_STUB_HAS_DLL 1 +#endif /* ! SIMPLENULL_STUB_HAS_DLL */ + +#if defined (SIMPLENULL_STUB_HAS_DLL) && (SIMPLENULL_STUB_HAS_DLL == 1) +# if defined (SIMPLENULL_STUB_BUILD_DLL) +# define SIMPLENULL_STUB_Export ACE_Proper_Export_Flag +# define SIMPLENULL_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLENULL_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLENULL_STUB_BUILD_DLL */ +# define SIMPLENULL_STUB_Export ACE_Proper_Import_Flag +# define SIMPLENULL_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLENULL_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLENULL_STUB_BUILD_DLL */ +#else /* SIMPLENULL_STUB_HAS_DLL == 1 */ +# define SIMPLENULL_STUB_Export +# define SIMPLENULL_STUB_SINGLETON_DECLARATION(T) +# define SIMPLENULL_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLENULL_STUB_HAS_DLL == 1 */ + +// Set SIMPLENULL_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLENULL_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLENULL_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLENULL_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLENULL_STUB_NTRACE */ + +#if (SIMPLENULL_STUB_NTRACE == 1) +# define SIMPLENULL_STUB_TRACE(X) +#else /* (SIMPLENULL_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLENULL_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLENULL_STUB_NTRACE == 1) */ + +#endif /* SIMPLENULL_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_svnt_export.h new file mode 100644 index 00000000000..9afa614f9a4 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLENULL_SVNT +// ------------------------------ +#ifndef SIMPLENULL_SVNT_EXPORT_H +#define SIMPLENULL_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLENULL_SVNT_HAS_DLL) +# define SIMPLENULL_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLENULL_SVNT_HAS_DLL */ + +#if !defined (SIMPLENULL_SVNT_HAS_DLL) +# define SIMPLENULL_SVNT_HAS_DLL 1 +#endif /* ! SIMPLENULL_SVNT_HAS_DLL */ + +#if defined (SIMPLENULL_SVNT_HAS_DLL) && (SIMPLENULL_SVNT_HAS_DLL == 1) +# if defined (SIMPLENULL_SVNT_BUILD_DLL) +# define SIMPLENULL_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLENULL_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLENULL_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLENULL_SVNT_BUILD_DLL */ +# define SIMPLENULL_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLENULL_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLENULL_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLENULL_SVNT_BUILD_DLL */ +#else /* SIMPLENULL_SVNT_HAS_DLL == 1 */ +# define SIMPLENULL_SVNT_Export +# define SIMPLENULL_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLENULL_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLENULL_SVNT_HAS_DLL == 1 */ + +// Set SIMPLENULL_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLENULL_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLENULL_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLENULL_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLENULL_SVNT_NTRACE */ + +#if (SIMPLENULL_SVNT_NTRACE == 1) +# define SIMPLENULL_SVNT_TRACE(X) +#else /* (SIMPLENULL_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLENULL_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLENULL_SVNT_NTRACE == 1) */ + +#endif /* SIMPLENULL_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.cidl new file mode 100644 index 00000000000..cff76c14b89 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.cidl @@ -0,0 +1,11 @@ +// $Id$ +#include "SimpleProvider.idl" + +composition session SimpleProvider_Impl +{ + home executor SimpleProviderHome_Exec + { + implements Simple::SimpleProviderHome; + manages SimpleProvider_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.idl new file mode 100644 index 00000000000..97e2c80984b --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef SIMPLE_PROVIDER_IDL +#define SIMPLE_PROVIDER_IDL + +#include "SimpleCommon.idl" +#include "Components.idl" + +module Simple +{ + component SimpleProvider + { + provides Trigger trig; + }; + + home SimpleProviderHome manages SimpleProvider + { + }; +}; + +#endif /*SIMPLE_PROVIDER_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.mpc new file mode 100644 index 00000000000..c917d235490 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.mpc @@ -0,0 +1,121 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleProvider" + +project(SimpleCommon_SimpleProvider_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLEPROVIDER_STUB_Export \ + -Wb,stub_export_include=SimpleProvider_stub_export.h \ + -Wb,skel_export_macro=SIMPLEPROVIDER_SVNT_Export \ + -Wb,skel_export_include=SimpleProvider_svnt_export.h + + IDL_Files { + SimpleProvider.idl + } +} + +project(SimpleCommon_SimpleProvider_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLEPROVIDER_SVNT_Export \ + --svnt-export-include SimpleProvider_svnt_export.h + idlflags += -Wb,export_macro=SIMPLEPROVIDER_EXEC_Export \ + -Wb,export_include=SimpleProvider_exec_export.h \ + -SS + + CIDL_Files { + SimpleProvider.cidl + } + + IDL_Files { + SimpleProviderE.idl + } +} + +project(SimpleCommon_SimpleProvider_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleCommon_SimpleProvider_idl_gen SimpleCommon_stub + libs += SimpleCommon_stub + + sharedname = SimpleProvider_stub + dynamicflags = SIMPLEPROVIDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleProviderC.cpp + } + + Header_Files { + SimpleProviderC.h + SimpleProvider_stub_export.h + } + + Inline_Files { + SimpleProviderC.inl + } +} + +project(SimpleCommon_SimpleProvider_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleCommon_SimpleProvider_cidl_gen SimpleCommon_SimpleProvider_stub + sharedname = SimpleProvider_exec + libs += SimpleProvider_stub SimpleCommon_stub + + dynamicflags = SIMPLEPROVIDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleProviderEC.cpp + SimpleProvider_exec.cpp + } + + Header_Files { + SimpleProviderEC.h + SimpleProvider_exec.h + SimpleProvider_exec_export.h + } + + Inline_Files { + SimpleProviderEC.inl + } +} + + +project(SimpleCommon_SimpleProvider_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleCommon_skel SimpleCommon_SimpleProvider_exec + sharedname = SimpleProvider_svnt + libs += SimpleProvider_exec \ + SimpleProvider_stub \ + SimpleCommon_skel \ + SimpleCommon_stub + + dynamicflags = SIMPLEPROVIDER_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimpleProviderS.cpp + SimpleProvider_svnt.cpp + } + + Header_Files { + SimpleProviderS.h + SimpleProvider_svnt.h + SimpleProvider_svnt_export.h + } + + Inline_Files { + SimpleProviderS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.cpp new file mode 100644 index 00000000000..63453474a67 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.cpp @@ -0,0 +1,178 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimpleProvider_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimpleProvider_Impl +{ + //================================================================== + // Facet Executor Implementation Class: Trigger_exec_i + //================================================================== + + Trigger_exec_i::Trigger_exec_i (void) + { + CIAO_TRACE ("Trigger_exec_i::Trigger_exec_i (void)"); + } + + Trigger_exec_i::~Trigger_exec_i (void) + { + CIAO_TRACE ("Trigger_exec_i::~Trigger_exec_i (void)"); + } + + // Operations from ::Simple::Trigger + + void + Trigger_exec_i::hello ( + const char * hello ) + { + CIAO_TRACE ("Trigger_exec_i::hello ()"); + // Your code here. + CIAO_DEBUG ((LM_EMERGENCY, "Trigger_exec_i::hello - " + "Got the following intofrmation from trig port: %s\n", + hello)); + } + + //================================================================== + // Component Executor Implementation Class: SimpleProvider_exec_i + //================================================================== + + SimpleProvider_exec_i::SimpleProvider_exec_i (void) + { + CIAO_TRACE ("SimpleProvider_exec_i::SimpleProvider_exec_i (void)"); + } + + SimpleProvider_exec_i::~SimpleProvider_exec_i (void) + { + CIAO_TRACE ("SimpleProvider_exec_i::~SimpleProvider_exec_i (void)"); + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + ::Simple::CCM_Trigger_ptr + SimpleProvider_exec_i::get_trig () + { + CIAO_TRACE ("SimpleProvider_exec_i::get_trig ()"); + return new Trigger_exec_i (); + } + + // Operations from Components::SessionComponent + + void + SimpleProvider_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + CIAO_TRACE ("SimpleProvider_exec_i::set_session_context ()"); + this->context_ = + ::Simple::CCM_SimpleProvider_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimpleProvider_exec_i::configuration_complete () + { + CIAO_TRACE ("SimpleProvider_exec_i::configuration_complete ()"); + // Your code here. + } + + void + SimpleProvider_exec_i::ccm_activate () + { + CIAO_TRACE ("SimpleProvider_exec_i::ccm_activate ()"); + // Your code here. + } + + void + SimpleProvider_exec_i::ccm_passivate () + { + CIAO_TRACE ("SimpleProvider_exec_i::ccm_passivate ()"); + // Your code here. + } + + void + SimpleProvider_exec_i::ccm_remove () + { + CIAO_TRACE ("SimpleProvider_exec_i::ccm_remove ()"); + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: SimpleProviderHome_exec_i + //================================================================== + + SimpleProviderHome_exec_i::SimpleProviderHome_exec_i (void) + { + CIAO_TRACE ("SimpleProviderHome_exec_i::SimpleProviderHome_exec_i (void)"); + } + + SimpleProviderHome_exec_i::~SimpleProviderHome_exec_i (void) + { + CIAO_TRACE ("SimpleProviderHome_exec_i::~SimpleProviderHome_exec_i (void)"); + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimpleProviderHome_exec_i::create () + { + CIAO_TRACE ("SimpleProviderHome_exec_i::create ()"); + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimpleProvider_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLEPROVIDER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleProviderHome_Impl (void) + { + CIAO_TRACE ("create_Simple_SimpleProviderHome_Impl (void)"); + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimpleProviderHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.h new file mode 100644 index 00000000000..044c9aa56e3 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.h @@ -0,0 +1,116 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLEPROVIDER_EXEC_H +#define CIAO_SIMPLEPROVIDER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimpleProviderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimpleProvider_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimpleProvider_Impl +{ + class SIMPLEPROVIDER_EXEC_Export Trigger_exec_i + : public virtual ::Simple::CCM_Trigger, + public virtual ::CORBA::LocalObject + { + public: + Trigger_exec_i (void); + virtual ~Trigger_exec_i (void); + + // Operations from ::Simple::Trigger + + virtual void + hello ( + const char * hello); + }; + + class SIMPLEPROVIDER_EXEC_Export SimpleProvider_exec_i + : public virtual SimpleProvider_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleProvider_exec_i (void); + virtual ~SimpleProvider_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + virtual ::Simple::CCM_Trigger_ptr + get_trig (); + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimpleProvider_Context_var context_; + }; + + class SIMPLEPROVIDER_EXEC_Export SimpleProviderHome_exec_i + : public virtual SimpleProviderHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleProviderHome_exec_i (void); + virtual ~SimpleProviderHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SIMPLEPROVIDER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleProviderHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLEPROVIDER_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec_export.h new file mode 100644 index 00000000000..c5e9182f61f --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEPROVIDER_EXEC +// ------------------------------ +#ifndef SIMPLEPROVIDER_EXEC_EXPORT_H +#define SIMPLEPROVIDER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEPROVIDER_EXEC_HAS_DLL) +# define SIMPLEPROVIDER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEPROVIDER_EXEC_HAS_DLL */ + +#if !defined (SIMPLEPROVIDER_EXEC_HAS_DLL) +# define SIMPLEPROVIDER_EXEC_HAS_DLL 1 +#endif /* ! SIMPLEPROVIDER_EXEC_HAS_DLL */ + +#if defined (SIMPLEPROVIDER_EXEC_HAS_DLL) && (SIMPLEPROVIDER_EXEC_HAS_DLL == 1) +# if defined (SIMPLEPROVIDER_EXEC_BUILD_DLL) +# define SIMPLEPROVIDER_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLEPROVIDER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPROVIDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEPROVIDER_EXEC_BUILD_DLL */ +# define SIMPLEPROVIDER_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLEPROVIDER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPROVIDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEPROVIDER_EXEC_BUILD_DLL */ +#else /* SIMPLEPROVIDER_EXEC_HAS_DLL == 1 */ +# define SIMPLEPROVIDER_EXEC_Export +# define SIMPLEPROVIDER_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLEPROVIDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEPROVIDER_EXEC_HAS_DLL == 1 */ + +// Set SIMPLEPROVIDER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEPROVIDER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEPROVIDER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEPROVIDER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEPROVIDER_EXEC_NTRACE */ + +#if (SIMPLEPROVIDER_EXEC_NTRACE == 1) +# define SIMPLEPROVIDER_EXEC_TRACE(X) +#else /* (SIMPLEPROVIDER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEPROVIDER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEPROVIDER_EXEC_NTRACE == 1) */ + +#endif /* SIMPLEPROVIDER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_stub_export.h new file mode 100644 index 00000000000..795f3fec902 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEPROVIDER_STUB +// ------------------------------ +#ifndef SIMPLEPROVIDER_STUB_EXPORT_H +#define SIMPLEPROVIDER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEPROVIDER_STUB_HAS_DLL) +# define SIMPLEPROVIDER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEPROVIDER_STUB_HAS_DLL */ + +#if !defined (SIMPLEPROVIDER_STUB_HAS_DLL) +# define SIMPLEPROVIDER_STUB_HAS_DLL 1 +#endif /* ! SIMPLEPROVIDER_STUB_HAS_DLL */ + +#if defined (SIMPLEPROVIDER_STUB_HAS_DLL) && (SIMPLEPROVIDER_STUB_HAS_DLL == 1) +# if defined (SIMPLEPROVIDER_STUB_BUILD_DLL) +# define SIMPLEPROVIDER_STUB_Export ACE_Proper_Export_Flag +# define SIMPLEPROVIDER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPROVIDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEPROVIDER_STUB_BUILD_DLL */ +# define SIMPLEPROVIDER_STUB_Export ACE_Proper_Import_Flag +# define SIMPLEPROVIDER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPROVIDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEPROVIDER_STUB_BUILD_DLL */ +#else /* SIMPLEPROVIDER_STUB_HAS_DLL == 1 */ +# define SIMPLEPROVIDER_STUB_Export +# define SIMPLEPROVIDER_STUB_SINGLETON_DECLARATION(T) +# define SIMPLEPROVIDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEPROVIDER_STUB_HAS_DLL == 1 */ + +// Set SIMPLEPROVIDER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEPROVIDER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEPROVIDER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEPROVIDER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEPROVIDER_STUB_NTRACE */ + +#if (SIMPLEPROVIDER_STUB_NTRACE == 1) +# define SIMPLEPROVIDER_STUB_TRACE(X) +#else /* (SIMPLEPROVIDER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEPROVIDER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEPROVIDER_STUB_NTRACE == 1) */ + +#endif /* SIMPLEPROVIDER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_svnt_export.h new file mode 100644 index 00000000000..5f6be2501b6 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEPROVIDER_SVNT +// ------------------------------ +#ifndef SIMPLEPROVIDER_SVNT_EXPORT_H +#define SIMPLEPROVIDER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEPROVIDER_SVNT_HAS_DLL) +# define SIMPLEPROVIDER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEPROVIDER_SVNT_HAS_DLL */ + +#if !defined (SIMPLEPROVIDER_SVNT_HAS_DLL) +# define SIMPLEPROVIDER_SVNT_HAS_DLL 1 +#endif /* ! SIMPLEPROVIDER_SVNT_HAS_DLL */ + +#if defined (SIMPLEPROVIDER_SVNT_HAS_DLL) && (SIMPLEPROVIDER_SVNT_HAS_DLL == 1) +# if defined (SIMPLEPROVIDER_SVNT_BUILD_DLL) +# define SIMPLEPROVIDER_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLEPROVIDER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPROVIDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEPROVIDER_SVNT_BUILD_DLL */ +# define SIMPLEPROVIDER_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLEPROVIDER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPROVIDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEPROVIDER_SVNT_BUILD_DLL */ +#else /* SIMPLEPROVIDER_SVNT_HAS_DLL == 1 */ +# define SIMPLEPROVIDER_SVNT_Export +# define SIMPLEPROVIDER_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLEPROVIDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEPROVIDER_SVNT_HAS_DLL == 1 */ + +// Set SIMPLEPROVIDER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEPROVIDER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEPROVIDER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEPROVIDER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEPROVIDER_SVNT_NTRACE */ + +#if (SIMPLEPROVIDER_SVNT_NTRACE == 1) +# define SIMPLEPROVIDER_SVNT_TRACE(X) +#else /* (SIMPLEPROVIDER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEPROVIDER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEPROVIDER_SVNT_NTRACE == 1) */ + +#endif /* SIMPLEPROVIDER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.cidl new file mode 100644 index 00000000000..d5bae5c32ee --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.cidl @@ -0,0 +1,11 @@ +// $Id$ +#include "SimplePublisher.idl" + +composition session SimplePublisher_Impl +{ + home executor SimplePublisherHome_Exec + { + implements Simple::SimplePublisherHome; + manages SimplePublisher_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.idl b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.idl new file mode 100644 index 00000000000..cee261fd15a --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef SIMPLE_PUBLISHER_IDL +#define SIMPLE_PUBLISHER_IDL + +#include "SimpleCommon.idl" +#include "Components.idl" + +module Simple +{ + component SimplePublisher + { + publishes Hello hello; + }; + + home SimplePublisherHome manages SimplePublisher + { + }; +}; + +#endif /*SIMPLE_PUBLISHER_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.mpc new file mode 100644 index 00000000000..232a4d462be --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.mpc @@ -0,0 +1,121 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimplePublisher" + +project(SimpleCommon_SimplePublisher_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLEPUBLISHER_STUB_Export \ + -Wb,stub_export_include=SimplePublisher_stub_export.h \ + -Wb,skel_export_macro=SIMPLEPUBLISHER_SVNT_Export \ + -Wb,skel_export_include=SimplePublisher_svnt_export.h + + IDL_Files { + SimplePublisher.idl + } +} + +project(SimpleCommon_SimplePublisher_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLEPUBLISHER_SVNT_Export \ + --svnt-export-include SimplePublisher_svnt_export.h + idlflags += -Wb,export_macro=SIMPLEPUBLISHER_EXEC_Export \ + -Wb,export_include=SimplePublisher_exec_export.h \ + -SS + + CIDL_Files { + SimplePublisher.cidl + } + + IDL_Files { + SimplePublisherE.idl + } +} + +project(SimpleCommon_SimplePublisher_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleCommon_SimplePublisher_idl_gen SimpleCommon_stub + libs += SimpleCommon_stub + + sharedname = SimplePublisher_stub + dynamicflags = SIMPLEPUBLISHER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimplePublisherC.cpp + } + + Header_Files { + SimplePublisherC.h + SimplePublisher_stub_export.h + } + + Inline_Files { + SimplePublisherC.inl + } +} + +project(SimpleCommon_SimplePublisher_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleCommon_SimplePublisher_cidl_gen SimpleCommon_SimplePublisher_stub + sharedname = SimplePublisher_exec + libs += SimplePublisher_stub SimpleCommon_stub + + dynamicflags = SIMPLEPUBLISHER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimplePublisherEC.cpp + SimplePublisher_exec.cpp + } + + Header_Files { + SimplePublisherEC.h + SimplePublisher_exec.h + SimplePublisher_exec_export.h + } + + Inline_Files { + SimplePublisherEC.inl + } +} + + +project(SimpleCommon_SimplePublisher_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleCommon_skel SimpleCommon_SimplePublisher_exec + sharedname = SimplePublisher_svnt + libs += SimplePublisher_exec \ + SimplePublisher_stub \ + SimpleCommon_skel \ + SimpleCommon_stub + + dynamicflags = SIMPLEPUBLISHER_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimplePublisherS.cpp + SimplePublisher_svnt.cpp + } + + Header_Files { + SimplePublisherS.h + SimplePublisher_svnt.h + SimplePublisher_svnt_export.h + } + + Inline_Files { + SimplePublisherS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.cpp new file mode 100644 index 00000000000..d15ab0ce667 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.cpp @@ -0,0 +1,148 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimplePublisher_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimplePublisher_Impl +{ + //================================================================== + // Component Executor Implementation Class: SimplePublisher_exec_i + //================================================================== + + SimplePublisher_exec_i::SimplePublisher_exec_i (void) + { + CIAO_TRACE ("SimplePublisher_exec_i::SimplePublisher_exec_i (void)"); + } + + SimplePublisher_exec_i::~SimplePublisher_exec_i (void) + { + CIAO_TRACE ("SimplePublisher_exec_i::~SimplePublisher_exec_i (void)"); + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + void + SimplePublisher_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + CIAO_TRACE ("SimplePublisher_exec_i::set_session_context ()"); + this->context_ = + ::Simple::CCM_SimplePublisher_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimplePublisher_exec_i::configuration_complete () + { + CIAO_TRACE ("SimplePublisher_exec_i::configuration_complete ()"); + // Your code here. + } + + void + SimplePublisher_exec_i::ccm_activate () + { + CIAO_TRACE ("SimplePublisher_exec_i::ccm_activate ()"); + ::Simple::Hello_var hello = new OBV_Simple::Hello ("Test successful, hello from SimplePublisher_exec_i"); + + this->context_->push_hello (hello._retn ()); + // Your code here. + } + + void + SimplePublisher_exec_i::ccm_passivate () + { + CIAO_TRACE ("SimplePublisher_exec_i::ccm_passivate ()"); + // Your code here. + } + + void + SimplePublisher_exec_i::ccm_remove () + { + CIAO_TRACE ("SimplePublisher_exec_i::ccm_remove ()"); + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: SimplePublisherHome_exec_i + //================================================================== + + SimplePublisherHome_exec_i::SimplePublisherHome_exec_i (void) + { + CIAO_TRACE ("SimplePublisherHome_exec_i::SimplePublisherHome_exec_i (void)"); + } + + SimplePublisherHome_exec_i::~SimplePublisherHome_exec_i (void) + { + CIAO_TRACE ("SimplePublisherHome_exec_i::~SimplePublisherHome_exec_i (void)"); + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimplePublisherHome_exec_i::create () + { + CIAO_TRACE ("SimplePublisherHome_exec_i::create ()"); + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimplePublisher_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLEPUBLISHER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimplePublisherHome_Impl (void) + { + CIAO_TRACE ("create_Simple_SimplePublisherHome_Impl (void)"); + + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimplePublisherHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.h new file mode 100644 index 00000000000..b25191f0a4a --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.h @@ -0,0 +1,98 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLEPUBLISHER_EXEC_H +#define CIAO_SIMPLEPUBLISHER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimplePublisherEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimplePublisher_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimplePublisher_Impl +{ + class SIMPLEPUBLISHER_EXEC_Export SimplePublisher_exec_i + : public virtual SimplePublisher_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimplePublisher_exec_i (void); + virtual ~SimplePublisher_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimplePublisher_Context_var context_; + }; + + class SIMPLEPUBLISHER_EXEC_Export SimplePublisherHome_exec_i + : public virtual SimplePublisherHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimplePublisherHome_exec_i (void); + virtual ~SimplePublisherHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SIMPLEPUBLISHER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimplePublisherHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLEPUBLISHER_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec_export.h new file mode 100644 index 00000000000..2f18677399f --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEPUBLISHER_EXEC +// ------------------------------ +#ifndef SIMPLEPUBLISHER_EXEC_EXPORT_H +#define SIMPLEPUBLISHER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEPUBLISHER_EXEC_HAS_DLL) +# define SIMPLEPUBLISHER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEPUBLISHER_EXEC_HAS_DLL */ + +#if !defined (SIMPLEPUBLISHER_EXEC_HAS_DLL) +# define SIMPLEPUBLISHER_EXEC_HAS_DLL 1 +#endif /* ! SIMPLEPUBLISHER_EXEC_HAS_DLL */ + +#if defined (SIMPLEPUBLISHER_EXEC_HAS_DLL) && (SIMPLEPUBLISHER_EXEC_HAS_DLL == 1) +# if defined (SIMPLEPUBLISHER_EXEC_BUILD_DLL) +# define SIMPLEPUBLISHER_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLEPUBLISHER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPUBLISHER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEPUBLISHER_EXEC_BUILD_DLL */ +# define SIMPLEPUBLISHER_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLEPUBLISHER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPUBLISHER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEPUBLISHER_EXEC_BUILD_DLL */ +#else /* SIMPLEPUBLISHER_EXEC_HAS_DLL == 1 */ +# define SIMPLEPUBLISHER_EXEC_Export +# define SIMPLEPUBLISHER_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLEPUBLISHER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEPUBLISHER_EXEC_HAS_DLL == 1 */ + +// Set SIMPLEPUBLISHER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEPUBLISHER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEPUBLISHER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEPUBLISHER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEPUBLISHER_EXEC_NTRACE */ + +#if (SIMPLEPUBLISHER_EXEC_NTRACE == 1) +# define SIMPLEPUBLISHER_EXEC_TRACE(X) +#else /* (SIMPLEPUBLISHER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEPUBLISHER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEPUBLISHER_EXEC_NTRACE == 1) */ + +#endif /* SIMPLEPUBLISHER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_stub_export.h new file mode 100644 index 00000000000..8ab3300c5ca --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEPUBLISHER_STUB +// ------------------------------ +#ifndef SIMPLEPUBLISHER_STUB_EXPORT_H +#define SIMPLEPUBLISHER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEPUBLISHER_STUB_HAS_DLL) +# define SIMPLEPUBLISHER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEPUBLISHER_STUB_HAS_DLL */ + +#if !defined (SIMPLEPUBLISHER_STUB_HAS_DLL) +# define SIMPLEPUBLISHER_STUB_HAS_DLL 1 +#endif /* ! SIMPLEPUBLISHER_STUB_HAS_DLL */ + +#if defined (SIMPLEPUBLISHER_STUB_HAS_DLL) && (SIMPLEPUBLISHER_STUB_HAS_DLL == 1) +# if defined (SIMPLEPUBLISHER_STUB_BUILD_DLL) +# define SIMPLEPUBLISHER_STUB_Export ACE_Proper_Export_Flag +# define SIMPLEPUBLISHER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPUBLISHER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEPUBLISHER_STUB_BUILD_DLL */ +# define SIMPLEPUBLISHER_STUB_Export ACE_Proper_Import_Flag +# define SIMPLEPUBLISHER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPUBLISHER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEPUBLISHER_STUB_BUILD_DLL */ +#else /* SIMPLEPUBLISHER_STUB_HAS_DLL == 1 */ +# define SIMPLEPUBLISHER_STUB_Export +# define SIMPLEPUBLISHER_STUB_SINGLETON_DECLARATION(T) +# define SIMPLEPUBLISHER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEPUBLISHER_STUB_HAS_DLL == 1 */ + +// Set SIMPLEPUBLISHER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEPUBLISHER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEPUBLISHER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEPUBLISHER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEPUBLISHER_STUB_NTRACE */ + +#if (SIMPLEPUBLISHER_STUB_NTRACE == 1) +# define SIMPLEPUBLISHER_STUB_TRACE(X) +#else /* (SIMPLEPUBLISHER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEPUBLISHER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEPUBLISHER_STUB_NTRACE == 1) */ + +#endif /* SIMPLEPUBLISHER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_svnt_export.h new file mode 100644 index 00000000000..cbc5f4e56be --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEPUBLISHER_SVNT +// ------------------------------ +#ifndef SIMPLEPUBLISHER_SVNT_EXPORT_H +#define SIMPLEPUBLISHER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEPUBLISHER_SVNT_HAS_DLL) +# define SIMPLEPUBLISHER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEPUBLISHER_SVNT_HAS_DLL */ + +#if !defined (SIMPLEPUBLISHER_SVNT_HAS_DLL) +# define SIMPLEPUBLISHER_SVNT_HAS_DLL 1 +#endif /* ! SIMPLEPUBLISHER_SVNT_HAS_DLL */ + +#if defined (SIMPLEPUBLISHER_SVNT_HAS_DLL) && (SIMPLEPUBLISHER_SVNT_HAS_DLL == 1) +# if defined (SIMPLEPUBLISHER_SVNT_BUILD_DLL) +# define SIMPLEPUBLISHER_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLEPUBLISHER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPUBLISHER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEPUBLISHER_SVNT_BUILD_DLL */ +# define SIMPLEPUBLISHER_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLEPUBLISHER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEPUBLISHER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEPUBLISHER_SVNT_BUILD_DLL */ +#else /* SIMPLEPUBLISHER_SVNT_HAS_DLL == 1 */ +# define SIMPLEPUBLISHER_SVNT_Export +# define SIMPLEPUBLISHER_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLEPUBLISHER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEPUBLISHER_SVNT_HAS_DLL == 1 */ + +// Set SIMPLEPUBLISHER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEPUBLISHER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEPUBLISHER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEPUBLISHER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEPUBLISHER_SVNT_NTRACE */ + +#if (SIMPLEPUBLISHER_SVNT_NTRACE == 1) +# define SIMPLEPUBLISHER_SVNT_TRACE(X) +#else /* (SIMPLEPUBLISHER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEPUBLISHER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEPUBLISHER_SVNT_NTRACE == 1) */ + +#endif /* SIMPLEPUBLISHER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.cidl b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.cidl new file mode 100644 index 00000000000..e3afe5e12f6 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.cidl @@ -0,0 +1,11 @@ +// $Id$ +#include "SimpleUser.idl" + +composition session SimpleUser_Impl +{ + home executor SimpleUserHome_Exec + { + implements Simple::SimpleUserHome; + manages SimpleUser_Exec; + }; +}; diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.idl b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.idl new file mode 100644 index 00000000000..90d4e67e542 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef SIMPLE_USER_IDL +#define SIMPLE_USER_IDL + +#include "SimpleCommon.idl" +#include "Components.idl" + +module Simple +{ + component SimpleUser + { + uses Trigger trig; + }; + + home SimpleUserHome manages SimpleUser + { + }; +}; + +#endif /*SIMPLE_USER_IDL*/ diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.mpc b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.mpc new file mode 100644 index 00000000000..c33c4120a77 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.mpc @@ -0,0 +1,121 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleUser" + +project(SimpleCommon_SimpleUser_idl_gen) : taoidldefaults, anytypecode { + avoids += ace_for_tao + custom_only = 1 + idlflags += -Wb,stub_export_macro=SIMPLEUSER_STUB_Export \ + -Wb,stub_export_include=SimpleUser_stub_export.h \ + -Wb,skel_export_macro=SIMPLEUSER_SVNT_Export \ + -Wb,skel_export_include=SimpleUser_svnt_export.h + + IDL_Files { + SimpleUser.idl + } +} + +project(SimpleCommon_SimpleUser_cidl_gen) : ciaocidldefaults, taoidldefaults { + avoids += ace_for_tao + custom_only = 1 + cidlflags += --svnt-export-macro SIMPLEUSER_SVNT_Export \ + --svnt-export-include SimpleUser_svnt_export.h + idlflags += -Wb,export_macro=SIMPLEUSER_EXEC_Export \ + -Wb,export_include=SimpleUser_exec_export.h \ + -SS + + CIDL_Files { + SimpleUser.cidl + } + + IDL_Files { + SimpleUserE.idl + } +} + +project(SimpleCommon_SimpleUser_stub) : ccm_stub { + avoids += ace_for_tao + after += SimpleCommon_SimpleUser_idl_gen SimpleCommon_stub + libs += SimpleCommon_stub + + sharedname = SimpleUser_stub + dynamicflags = SIMPLEUSER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleUserC.cpp + } + + Header_Files { + SimpleUserC.h + SimpleUser_stub_export.h + } + + Inline_Files { + SimpleUserC.inl + } +} + +project(SimpleCommon_SimpleUser_exec) : ciao_executor { + avoids += ace_for_tao + after += SimpleCommon_SimpleUser_cidl_gen SimpleCommon_SimpleUser_stub + sharedname = SimpleUser_exec + libs += SimpleUser_stub SimpleCommon_stub + + dynamicflags = SIMPLEUSER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SimpleUserEC.cpp + SimpleUser_exec.cpp + } + + Header_Files { + SimpleUserEC.h + SimpleUser_exec.h + SimpleUser_exec_export.h + } + + Inline_Files { + SimpleUserEC.inl + } +} + + +project(SimpleCommon_SimpleUser_svnt) : ciao_servant { + avoids += ace_for_tao + after += SimpleCommon_skel SimpleCommon_SimpleUser_exec + sharedname = SimpleUser_svnt + libs += SimpleUser_exec \ + SimpleUser_stub \ + SimpleCommon_skel \ + SimpleCommon_stub + + dynamicflags = SIMPLEUSER_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + SimpleUserS.cpp + SimpleUser_svnt.cpp + } + + Header_Files { + SimpleUserS.h + SimpleUser_svnt.h + SimpleUser_svnt_export.h + } + + Inline_Files { + SimpleUserS.inl + } +} + + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.cpp b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.cpp new file mode 100644 index 00000000000..accb8f8f949 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.cpp @@ -0,0 +1,169 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "SimpleUser_exec.h" +#include "ciao/CIAO_common.h" + +namespace CIDL_SimpleUser_Impl +{ + //================================================================== + // Component Executor Implementation Class: SimpleUser_exec_i + //================================================================== + + SimpleUser_exec_i::SimpleUser_exec_i (void) + { + CIAO_TRACE ("SimpleUser_exec_i::SimpleUser_exec_i (void)"); + } + + SimpleUser_exec_i::~SimpleUser_exec_i (void) + { + CIAO_TRACE ("SimpleUser_exec_i::~SimpleUser_exec_i (void)"); + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + void + SimpleUser_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + CIAO_TRACE ("SimpleUser_exec_i::set_session_context ()"); + this->context_ = + ::Simple::CCM_SimpleUser_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + SimpleUser_exec_i::configuration_complete () + { + CIAO_TRACE ("SimpleUser_exec_i::configuration_complete ()"); + // Your code here. + } + + void + SimpleUser_exec_i::ccm_activate () + { + CIAO_TRACE ("SimpleUser_exec_i::ccm_activate ()"); + + ::Simple::Trigger_var trig (this->context_->get_connection_trig ()); + + if (CORBA::is_nil (trig.in ())) + { + CIAO_ERROR ((LM_ERROR, "SimpleUser_exec_i::ccm_activate () - " + "Error: Reference nil for port trig\n")); + return; + } + + // Your code here. + try + { + trig->hello ("Test successful; hello from SimpleUser."); + } + catch (CORBA::Exception &ex) + { + CIAO_ERROR ((LM_ERROR, "SimpleUser_exec_i::ccm_activate () - " + "Caught CORBA exception, details follow:\n")); + ex._tao_print_exception ("SimpleUser_exec_i::ccm_activate () - "); + } + catch (...) + { + CIAO_ERROR ((LM_ERROR, "SimpleUser_exec_i::ccm_activate () - " + "Error: Caught unknown exception whilst invoking reference for port trig.\n")); + } + } + + void + SimpleUser_exec_i::ccm_passivate () + { + CIAO_TRACE ("SimpleUser_exec_i::ccm_passivate ()"); + // Your code here. + } + + void + SimpleUser_exec_i::ccm_remove () + { + CIAO_TRACE ("SimpleUser_exec_i::ccm_remove ()"); + // Your code here. + } + + //================================================================== + // Home Executor Implementation Class: SimpleUserHome_exec_i + //================================================================== + + SimpleUserHome_exec_i::SimpleUserHome_exec_i (void) + { + CIAO_TRACE ("SimpleUserHome_exec_i::SimpleUserHome_exec_i (void)"); + } + + SimpleUserHome_exec_i::~SimpleUserHome_exec_i (void) + { + CIAO_TRACE ("SimpleUserHome_exec_i::~SimpleUserHome_exec_i (void)"); + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + SimpleUserHome_exec_i::create () + { + CIAO_TRACE ("SimpleUserHome_exec_i::create ()"); + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + SimpleUser_exec_i, + ::CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" SIMPLEUSER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleUserHome_Impl (void) + { + CIAO_TRACE ("create_Simple_SimpleUserHome_Impl (void)"); + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + SimpleUserHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.h new file mode 100644 index 00000000000..9b28f1e36f2 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.h @@ -0,0 +1,98 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_SIMPLEUSER_EXEC_H +#define CIAO_SIMPLEUSER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "SimpleUserEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "SimpleUser_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_SimpleUser_Impl +{ + class SIMPLEUSER_EXEC_Export SimpleUser_exec_i + : public virtual SimpleUser_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleUser_exec_i (void); + virtual ~SimpleUser_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + // Operations from Components::SessionComponent + + virtual void + set_session_context ( + ::Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + private: + ::Simple::CCM_SimpleUser_Context_var context_; + }; + + class SIMPLEUSER_EXEC_Export SimpleUserHome_exec_i + : public virtual SimpleUserHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + SimpleUserHome_exec_i (void); + virtual ~SimpleUserHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" SIMPLEUSER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_Simple_SimpleUserHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SIMPLEUSER_EXEC_H */ + diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec_export.h new file mode 100644 index 00000000000..fcc935919a3 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEUSER_EXEC +// ------------------------------ +#ifndef SIMPLEUSER_EXEC_EXPORT_H +#define SIMPLEUSER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEUSER_EXEC_HAS_DLL) +# define SIMPLEUSER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEUSER_EXEC_HAS_DLL */ + +#if !defined (SIMPLEUSER_EXEC_HAS_DLL) +# define SIMPLEUSER_EXEC_HAS_DLL 1 +#endif /* ! SIMPLEUSER_EXEC_HAS_DLL */ + +#if defined (SIMPLEUSER_EXEC_HAS_DLL) && (SIMPLEUSER_EXEC_HAS_DLL == 1) +# if defined (SIMPLEUSER_EXEC_BUILD_DLL) +# define SIMPLEUSER_EXEC_Export ACE_Proper_Export_Flag +# define SIMPLEUSER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEUSER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEUSER_EXEC_BUILD_DLL */ +# define SIMPLEUSER_EXEC_Export ACE_Proper_Import_Flag +# define SIMPLEUSER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEUSER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEUSER_EXEC_BUILD_DLL */ +#else /* SIMPLEUSER_EXEC_HAS_DLL == 1 */ +# define SIMPLEUSER_EXEC_Export +# define SIMPLEUSER_EXEC_SINGLETON_DECLARATION(T) +# define SIMPLEUSER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEUSER_EXEC_HAS_DLL == 1 */ + +// Set SIMPLEUSER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEUSER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEUSER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEUSER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEUSER_EXEC_NTRACE */ + +#if (SIMPLEUSER_EXEC_NTRACE == 1) +# define SIMPLEUSER_EXEC_TRACE(X) +#else /* (SIMPLEUSER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEUSER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEUSER_EXEC_NTRACE == 1) */ + +#endif /* SIMPLEUSER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_stub_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_stub_export.h new file mode 100644 index 00000000000..a31d19d5614 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEUSER_STUB +// ------------------------------ +#ifndef SIMPLEUSER_STUB_EXPORT_H +#define SIMPLEUSER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEUSER_STUB_HAS_DLL) +# define SIMPLEUSER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEUSER_STUB_HAS_DLL */ + +#if !defined (SIMPLEUSER_STUB_HAS_DLL) +# define SIMPLEUSER_STUB_HAS_DLL 1 +#endif /* ! SIMPLEUSER_STUB_HAS_DLL */ + +#if defined (SIMPLEUSER_STUB_HAS_DLL) && (SIMPLEUSER_STUB_HAS_DLL == 1) +# if defined (SIMPLEUSER_STUB_BUILD_DLL) +# define SIMPLEUSER_STUB_Export ACE_Proper_Export_Flag +# define SIMPLEUSER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEUSER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEUSER_STUB_BUILD_DLL */ +# define SIMPLEUSER_STUB_Export ACE_Proper_Import_Flag +# define SIMPLEUSER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEUSER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEUSER_STUB_BUILD_DLL */ +#else /* SIMPLEUSER_STUB_HAS_DLL == 1 */ +# define SIMPLEUSER_STUB_Export +# define SIMPLEUSER_STUB_SINGLETON_DECLARATION(T) +# define SIMPLEUSER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEUSER_STUB_HAS_DLL == 1 */ + +// Set SIMPLEUSER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEUSER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEUSER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEUSER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEUSER_STUB_NTRACE */ + +#if (SIMPLEUSER_STUB_NTRACE == 1) +# define SIMPLEUSER_STUB_TRACE(X) +#else /* (SIMPLEUSER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEUSER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEUSER_STUB_NTRACE == 1) */ + +#endif /* SIMPLEUSER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_svnt_export.h b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_svnt_export.h new file mode 100644 index 00000000000..897f82c3081 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SIMPLEUSER_SVNT +// ------------------------------ +#ifndef SIMPLEUSER_SVNT_EXPORT_H +#define SIMPLEUSER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (SIMPLEUSER_SVNT_HAS_DLL) +# define SIMPLEUSER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && SIMPLEUSER_SVNT_HAS_DLL */ + +#if !defined (SIMPLEUSER_SVNT_HAS_DLL) +# define SIMPLEUSER_SVNT_HAS_DLL 1 +#endif /* ! SIMPLEUSER_SVNT_HAS_DLL */ + +#if defined (SIMPLEUSER_SVNT_HAS_DLL) && (SIMPLEUSER_SVNT_HAS_DLL == 1) +# if defined (SIMPLEUSER_SVNT_BUILD_DLL) +# define SIMPLEUSER_SVNT_Export ACE_Proper_Export_Flag +# define SIMPLEUSER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SIMPLEUSER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SIMPLEUSER_SVNT_BUILD_DLL */ +# define SIMPLEUSER_SVNT_Export ACE_Proper_Import_Flag +# define SIMPLEUSER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SIMPLEUSER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SIMPLEUSER_SVNT_BUILD_DLL */ +#else /* SIMPLEUSER_SVNT_HAS_DLL == 1 */ +# define SIMPLEUSER_SVNT_Export +# define SIMPLEUSER_SVNT_SINGLETON_DECLARATION(T) +# define SIMPLEUSER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SIMPLEUSER_SVNT_HAS_DLL == 1 */ + +// Set SIMPLEUSER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SIMPLEUSER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SIMPLEUSER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SIMPLEUSER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SIMPLEUSER_SVNT_NTRACE */ + +#if (SIMPLEUSER_SVNT_NTRACE == 1) +# define SIMPLEUSER_SVNT_TRACE(X) +#else /* (SIMPLEUSER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SIMPLEUSER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SIMPLEUSER_SVNT_NTRACE == 1) */ + +#endif /* SIMPLEUSER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome.cdp new file mode 100644 index 00000000000..01c13b3f3d1 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome.cdp @@ -0,0 +1,227 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleEmitterHomeImplementation"> + <name>SimpleEmitterHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleEmitter_ExecArtifact" /> + <artifact xmi:idref="SimpleEmitter_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleEmitterHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleEmitterHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitter_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitter_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleEmitterComponentImplementation"> + <name>SimpleEmitterComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleEmitter_ExecArtifact" /> + <artifact xmi:idref="SimpleEmitter_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleConsumerHomeImplementation"> + <name>SimpleConsumerHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleConsumerComponentImplementation"> + <name>SimpleConsumerComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleEmitterHomeInstance"> + <name>SimpleEmitterHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleEmitterHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleEmitterComponentInstance"> + <name>SimpleEmitterComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleEmitterComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitterHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleConsumerHomeInstance"> + <name>SimpleConsumerHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleConsumerComponentInstance"> + <name>SimpleConsumerComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumerHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>hello</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance xmi:idref="SimpleEmitterComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>hello_</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="SimpleConsumerComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleEmitter_ExecArtifact"> + <name>SimpleEmitter_exec</name> + <source/> + <node/> + <location>SimpleEmitter_exec</location> + </artifact> + <artifact xmi:id="SimpleEmitter_SvntArtifact"> + <name>SimpleEmitter_svnt</name> + <source/> + <node/> + <location>SimpleEmitter_svnt</location> + </artifact> + + <artifact xmi:id="SimpleConsumer_ExecArtifact"> + <name>SimpleConsumer_exec</name> + <source/> + <node/> + <location>SimpleConsumer_exec</location> + </artifact> + <artifact xmi:id="SimpleConsumer_SvntArtifact"> + <name>SimpleConsumer_svnt</name> + <source/> + <node/> + <location>SimpleConsumer_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome_NS.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..6c01f6d36d6 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome_NS.cdp @@ -0,0 +1,238 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleEmitterHomeImplementation"> + <name>SimpleEmitterHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleEmitter_ExecArtifact" /> + <artifact xmi:idref="SimpleEmitter_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleEmitterHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleEmitterHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitter_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitter_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleEmitterComponentImplementation"> + <name>SimpleEmitterComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleEmitter_ExecArtifact" /> + <artifact xmi:idref="SimpleEmitter_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleConsumerHomeImplementation"> + <name>SimpleConsumerHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleConsumerComponentImplementation"> + <name>SimpleConsumerComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleEmitterHomeInstance"> + <name>SimpleEmitterHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleEmitterHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleEmitterComponentInstance"> + <name>SimpleEmitterComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleEmitterComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitterHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitterComponent</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleConsumerHomeInstance"> + <name>SimpleConsumerHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleConsumerComponentInstance"> + <name>SimpleConsumerComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumerHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>hello_</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="SimpleConsumerComponentInstance" /> + </internalEndpoint> + <externalReference> + <location>corbaname:rir:/NameService#SimpleEmitterComponent</location> + <provider>false</provider> + <portName>hello</portName> + <supportedType>Meaningless</supportedType> + </externalReference> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleEmitter_ExecArtifact"> + <name>SimpleEmitter_exec</name> + <source/> + <node/> + <location>SimpleEmitter_exec</location> + </artifact> + <artifact xmi:id="SimpleEmitter_SvntArtifact"> + <name>SimpleEmitter_svnt</name> + <source/> + <node/> + <location>SimpleEmitter_svnt</location> + </artifact> + + <artifact xmi:id="SimpleConsumer_ExecArtifact"> + <name>SimpleConsumer_exec</name> + <source/> + <node/> + <location>SimpleConsumer_exec</location> + </artifact> + <artifact xmi:id="SimpleConsumer_SvntArtifact"> + <name>SimpleConsumer_svnt</name> + <source/> + <node/> + <location>SimpleConsumer_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..c5bc81c852a --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome.cdp @@ -0,0 +1,262 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleProviderHomeImplementation"> + <name>SimpleProviderHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleProviderComponentImplementation"> + <name>SimpleProviderComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleMultipleUserHomeImplementation"> + <name>SimpleMultipleUserHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleMultipleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleMultipleUser_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleMultipleUserHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleMultipleUserHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUser_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUser_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleMultipleUserComponentImplementation"> + <name>SimpleMultipleUserComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleMultipleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleMultipleUser_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleProviderHomeInstance"> + <name>SimpleProviderHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleProviderComponentInstance"> + <name>SimpleProviderComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProviderHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleMultipleUserHomeInstance"> + <name>SimpleMultipleUserHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleMultipleUserComponentInstance"> + <name>SimpleMultipleUserComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleMultipleUserComponentInstanceReverse"> + <name>SimpleMultipleUserComponentReverse</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>MultiplexReceptacle</kind> + <instance xmi:idref="SimpleMultipleUserComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>TestConnectionReverse</name> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>MultiplexReceptacle</kind> + <instance xmi:idref="SimpleMultipleUserComponentInstanceReverse" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleProvider_ExecArtifact"> + <name>SimpleProvider_exec</name> + <source/> + <node/> + <location>SimpleProvider_exec</location> + </artifact> + <artifact xmi:id="SimpleProvider_SvntArtifact"> + <name>SimpleProvider_svnt</name> + <source/> + <node/> + <location>SimpleProvider_svnt</location> + </artifact> + + <artifact xmi:id="SimpleMultipleUser_ExecArtifact"> + <name>SimpleMultipleUser_exec</name> + <source/> + <node/> + <location>SimpleMultipleUser_exec</location> + </artifact> + <artifact xmi:id="SimpleMultipleUser_SvntArtifact"> + <name>SimpleMultipleUser_svnt</name> + <source/> + <node/> + <location>SimpleMultipleUser_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome_NS.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..dc865e8d0a3 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome_NS.cdp @@ -0,0 +1,286 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleProviderHomeImplementation"> + <name>SimpleProviderHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleProviderComponentImplementation"> + <name>SimpleProviderComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleMultipleUserHomeImplementation"> + <name>SimpleMultipleUserHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleMultipleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleMultipleUser_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleMultipleUserHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleMultipleUserHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUser_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUser_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleMultipleUserComponentImplementation"> + <name>SimpleMultipleUserComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleMultipleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleMultipleUser_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleProviderHomeInstance"> + <name>SimpleProviderHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleProviderComponentInstance"> + <name>SimpleProviderComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProviderHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleMultipleUserHomeInstance"> + <name>SimpleMultipleUserHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleMultipleUserComponentInstance"> + <name>SimpleMultipleUserComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUserHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUserComponent</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleMultipleUserComponentInstanceReverse"> + <name>SimpleMultipleUserComponentReverse</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + <externalReference> + <location>corbaname:rir:/NameService#SimpleMultipleUserComponent</location> + <provider>false</provider> + <portName>trig</portName> + <supportedType>Meaningless</supportedType> + </externalReference> +<!-- <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>MultiplexReceptacle</kind> + <instance xmi:idref="SimpleMultipleUserComponentInstance" /> + </internalEndpoint> --> + </connection> + + <connection> + <name>TestConnectionReverse</name> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + <externalReference> + <location>corbaname:rir:/NameService#SimpleMultipleUserComponent</location> + <provider>false</provider> + <portName>trig</portName> + <supportedType>Meaningless</supportedType> + </externalReference> +<!-- + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>MultiplexReceptacle</kind> + <instance xmi:idref="SimpleMultipleUserComponentInstanceReverse" /> + </internalEndpoint> --> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleProvider_ExecArtifact"> + <name>SimpleProvider_exec</name> + <source/> + <node/> + <location>SimpleProvider_exec</location> + </artifact> + <artifact xmi:id="SimpleProvider_SvntArtifact"> + <name>SimpleProvider_svnt</name> + <source/> + <node/> + <location>SimpleProvider_svnt</location> + </artifact> + + <artifact xmi:id="SimpleMultipleUser_ExecArtifact"> + <name>SimpleMultipleUser_exec</name> + <source/> + <node/> + <location>SimpleMultipleUser_exec</location> + </artifact> + <artifact xmi:id="SimpleMultipleUser_SvntArtifact"> + <name>SimpleMultipleUser_svnt</name> + <source/> + <node/> + <location>SimpleMultipleUser_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome.cdp new file mode 100644 index 00000000000..32747bfc1bf --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome.cdp @@ -0,0 +1,227 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimplePublisherHomeImplementation"> + <name>SimplePublisherHomeImplementation</name> + <source/> + <artifact xmi:idref="SimplePublisher_ExecArtifact" /> + <artifact xmi:idref="SimplePublisher_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimplePublisherHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimplePublisherHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisher_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisher_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimplePublisherComponentImplementation"> + <name>SimplePublisherComponentImplementation</name> + <source/> + <artifact xmi:idref="SimplePublisher_ExecArtifact" /> + <artifact xmi:idref="SimplePublisher_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleConsumerHomeImplementation"> + <name>SimpleConsumerHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleConsumerComponentImplementation"> + <name>SimpleConsumerComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimplePublisherHomeInstance"> + <name>SimplePublisherHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimplePublisherHomeImplementation" /> + </instance> + + <instance xmi:id="SimplePublisherComponentInstance"> + <name>SimplePublisherComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimplePublisherComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisherHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleConsumerHomeInstance"> + <name>SimpleConsumerHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleConsumerComponentInstance"> + <name>SimpleConsumerComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumerHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>hello</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="SimplePublisherComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>hello_</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="SimpleConsumerComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimplePublisher_ExecArtifact"> + <name>SimplePublisher_exec</name> + <source/> + <node/> + <location>SimplePublisher_exec</location> + </artifact> + <artifact xmi:id="SimplePublisher_SvntArtifact"> + <name>SimplePublisher_svnt</name> + <source/> + <node/> + <location>SimplePublisher_svnt</location> + </artifact> + + <artifact xmi:id="SimpleConsumer_ExecArtifact"> + <name>SimpleConsumer_exec</name> + <source/> + <node/> + <location>SimpleConsumer_exec</location> + </artifact> + <artifact xmi:id="SimpleConsumer_SvntArtifact"> + <name>SimpleConsumer_svnt</name> + <source/> + <node/> + <location>SimpleConsumer_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome_NS.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..054e7964bea --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome_NS.cdp @@ -0,0 +1,244 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimplePublisherHomeImplementation"> + <name>SimplePublisherHomeImplementation</name> + <source/> + <artifact xmi:idref="SimplePublisher_ExecArtifact" /> + <artifact xmi:idref="SimplePublisher_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimplePublisherHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimplePublisherHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisher_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisher_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimplePublisherComponentImplementation"> + <name>SimplePublisherComponentImplementation</name> + <source/> + <artifact xmi:idref="SimplePublisher_ExecArtifact" /> + <artifact xmi:idref="SimplePublisher_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleConsumerHomeImplementation"> + <name>SimpleConsumerHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleConsumerComponentImplementation"> + <name>SimpleConsumerComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimplePublisherHomeInstance"> + <name>SimplePublisherHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimplePublisherHomeImplementation" /> + </instance> + + <instance xmi:id="SimplePublisherComponentInstance"> + <name>SimplePublisherComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimplePublisherComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisherHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisherComponentInstance</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleConsumerHomeInstance"> + <name>SimpleConsumerHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleConsumerComponentInstance"> + <name>SimpleConsumerComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumerHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <!--<internalEndpoint> + <portName>hello</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="SimplePublisherComponentInstance" /> + </internalEndpoint>--> + <internalEndpoint> + <portName>hello_</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="SimpleConsumerComponentInstance" /> + </internalEndpoint> + <externalReference> + <location>corbaname:rir:/NameService#SimplePublisherComponentInstance</location> + <provider>false</provider> + <portName>hello</portName> + <supportedType>Meaningless</supportedType> + </externalReference> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimplePublisher_ExecArtifact"> + <name>SimplePublisher_exec</name> + <source/> + <node/> + <location>SimplePublisher_exec</location> + </artifact> + <artifact xmi:id="SimplePublisher_SvntArtifact"> + <name>SimplePublisher_svnt</name> + <source/> + <node/> + <location>SimplePublisher_svnt</location> + </artifact> + + <artifact xmi:id="SimpleConsumer_ExecArtifact"> + <name>SimpleConsumer_exec</name> + <source/> + <node/> + <location>SimpleConsumer_exec</location> + </artifact> + <artifact xmi:id="SimpleConsumer_SvntArtifact"> + <name>SimpleConsumer_svnt</name> + <source/> + <node/> + <location>SimpleConsumer_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimpleComponentExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimpleComponentExplicitHome.cdp new file mode 100644 index 00000000000..e9af75b1ac4 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimpleComponentExplicitHome.cdp @@ -0,0 +1,113 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation xmi:id="SimpleNullHomeImplementation"> + <name>SimpleNullHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleNull_ExecArtifact" /> + <artifact xmi:idref="SimpleNull_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNullHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNullHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleNullComponentImplementation"> + <name>SimpleNullComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleNull_ExecArtifact" /> + <artifact xmi:idref="SimpleNull_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleNullHomeInstance"> + <name>SimpleNullHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleNullHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleNullComponentInstance"> + <name>SimpleNullComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleNullComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNullHome</string> + </value> + </value> + </configProperty> + </instance> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleNull_ExecArtifact"> + <name>SimpleNull_exec</name> + <source/> + <node/> + <location>SimpleNull_exec</location> + </artifact> + <artifact xmi:id="SimpleNull_SvntArtifact"> + <name>SimpleNull_svnt</name> + <source/> + <node/> + <location>SimpleNull_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..8283e9e869a --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome.cdp @@ -0,0 +1,262 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleProviderHomeImplementation"> + <name>SimpleProviderHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleProviderComponentImplementation"> + <name>SimpleProviderComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleUserHomeImplementation"> + <name>SimpleUserHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleUser_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleUserHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleUserHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUser_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUser_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleUserComponentImplementation"> + <name>SimpleUserComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleUser_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleProviderHomeInstance"> + <name>SimpleProviderHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleProviderComponentInstance"> + <name>SimpleProviderComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProviderHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleUserHomeInstance"> + <name>SimpleUserHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleUserComponentInstance"> + <name>SimpleUserComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleUserComponentInstanceReverse"> + <name>SimpleUserComponentReverse</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SimpleUserComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>TestConnectionReverse</name> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SimpleUserComponentInstanceReverse" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleProvider_ExecArtifact"> + <name>SimpleProvider_exec</name> + <source/> + <node/> + <location>SimpleProvider_exec</location> + </artifact> + <artifact xmi:id="SimpleProvider_SvntArtifact"> + <name>SimpleProvider_svnt</name> + <source/> + <node/> + <location>SimpleProvider_svnt</location> + </artifact> + + <artifact xmi:id="SimpleUser_ExecArtifact"> + <name>SimpleUser_exec</name> + <source/> + <node/> + <location>SimpleUser_exec</location> + </artifact> + <artifact xmi:id="SimpleUser_SvntArtifact"> + <name>SimpleUser_svnt</name> + <source/> + <node/> + <location>SimpleUser_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome_NS.cdp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..c60ad818d6f --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome_NS.cdp @@ -0,0 +1,279 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleProviderHomeImplementation"> + <name>SimpleProviderHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleProviderComponentImplementation"> + <name>SimpleProviderComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleUserHomeImplementation"> + <name>SimpleUserHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleUser_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleUserHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleUserHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUser_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUser_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleUserComponentImplementation"> + <name>SimpleUserComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleUser_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleProviderHomeInstance"> + <name>SimpleProviderHome</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleProviderComponentInstance"> + <name>SimpleProviderComponent</name> + <node>NodeOne</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProviderHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleUserHomeInstance"> + <name>SimpleUserHome</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleUserComponentInstance"> + <name>SimpleUserComponent</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUserHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.RegisterNaming</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUserComponent</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleUserComponentInstanceReverse"> + <name>SimpleUserComponentReverse</name> + <node>NodeTwo</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> +<!-- <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SimpleUserComponentInstance" /> + </internalEndpoint>--> + <externalReference> + <location>corbaname:rir:/NameService#SimpleUserComponent</location> + <provider>false</provider> + <portName>trig</portName> + <supportedType>Meaningless</supportedType> + </externalReference> + </connection> + + <connection> + <name>TestConnectionReverse</name> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SimpleUserComponentInstanceReverse" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleProvider_ExecArtifact"> + <name>SimpleProvider_exec</name> + <source/> + <node/> + <location>SimpleProvider_exec</location> + </artifact> + <artifact xmi:id="SimpleProvider_SvntArtifact"> + <name>SimpleProvider_svnt</name> + <source/> + <node/> + <location>SimpleProvider_svnt</location> + </artifact> + + <artifact xmi:id="SimpleUser_ExecArtifact"> + <name>SimpleUser_exec</name> + <source/> + <node/> + <location>SimpleUser_exec</location> + </artifact> + <artifact xmi:id="SimpleUser_SvntArtifact"> + <name>SimpleUser_svnt</name> + <source/> + <node/> + <location>SimpleUser_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/em_launcher.mpc b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/em_launcher.mpc new file mode 100644 index 00000000000..bfe2a2d6dba --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/em_launcher.mpc @@ -0,0 +1,5 @@ +project(simple_em_launcher) : ciao_config_handlers, dance_nodemanager_stub, ciao_logger { + Source_Files { + simple_em_launcher.cpp + } +}
\ No newline at end of file diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl new file mode 100755 index 00000000000..b738049952b --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl @@ -0,0 +1,173 @@ +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::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE"; +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; +$daemons = 2; +@ports = ( 60001, 60002 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" ); +@nodenames = ( "NodeOne", "NodeTwo" ); +$status = 0; +$dat_file = "NodeManagerMap.dat"; +$controller_exec = "$CIAO_ROOT/examples/Hello/Sender/starter"; + +$nsior = PerlACE::LocalFile ("ns.ior"); + +$E = 0; +$EM = 0; +$retval = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("Receiver.ior"); + unlink PerlACE::LocalFile ("Sender.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); + unlink PerlACE::LocalFile ("ns.ior"); +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); + $NS->TimedWait (1); + } + +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + + $d_cmd = "$DAnCE/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService --instance-nc corbaloc:rir:/NameService"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + 30) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +if ($#ARGV == -1) +{ + opendir(DIR, "."); + @files = grep(/\.cdp$/,readdir(DIR)); + closedir(DIR); +} else { + @files = @ARGV; +} + +foreach $file (@files) { + print "Starting test for deployment $file\n"; + delete_ior_files (); + + print STDERR "Starting Naming Service\n"; + + $NS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:60003 -o ns.ior"); + $NS->Spawn (); + + if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) + { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); + exit 1; + } + $ns_running = 1; + +# Set up NamingService environment + $ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + + +# Invoke node daemons. + print "Invoking node daemons\n"; + $status = run_node_daemons (); + + if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + kill_open_processes (); + exit 1; + } + + $daemons_running = 1; + + # Invoke execution manager. + print "Invoking execution manager\n"; + $EM = new PerlACE::Process ("$DAnCE/bin/dance_execution_manager", + "-eEM.ior --domain-nc corbaloc:rir:/NameService"); + $EM->Spawn (); + + if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -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 - start the application -\n"; + $E = new PerlACE::Process ("simple_em_launcher", + "file://EM.ior $file"); + + $status = $E->SpawnWaitKill (5000); + + if ($status != 0) + { + print "ERROR: simple_em_launcher returned an error code while deploying $file\n"; + $retval = -1; + } + + delete_ior_files (); + kill_open_processes (); +} + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/simple_em_launcher.cpp b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/simple_em_launcher.cpp new file mode 100644 index 00000000000..be325f6d09a --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/simple_em_launcher.cpp @@ -0,0 +1,128 @@ +/** + * @file simple_em_launcher.cpp + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * Launches then immediately tears down a plan. + */ + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_unistd.h" +#include "tao/ORB.h" +#include "ciao/Logger/Logger_Service.h" +#include "ciao/Logger/Log_Macros.h" +#include "Deployment/Deployment_DomainApplicationC.h" +#include "Deployment/Deployment_ExecutionManagerC.h" +#include "Deployment/Deployment_DeploymentPlanC.h" +#include "tools/Config_Handlers/XML_File_Intf.h" + +int usage () +{ + ACE_ERROR ((LM_ERROR, "simple_nm_launcher <nm_url> <plan>\n")); + return -1; +} + +#include <iostream> + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + CIAO_DISABLE_TRACE (); + + auto_ptr<CIAO::Logger_Service> logger; + + CIAO::Logger_Service + * dlf = ACE_Dynamic_Service<CIAO::Logger_Service>::instance ("CIAO_Logger_Backend_Factory"); + + if (!dlf) + dlf = new CIAO::Logger_Service; + + logger.reset (dlf); + logger->init (argc, argv); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (argc != 3) + return usage (); + + try + { + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: parsing XML\n")); + // Parse plan + CIAO::Config_Handlers::XML_File_Intf xml (argv[2]); + xml.add_search_path ("CIAO_ROOT", "/docs/schema/"); + + auto_ptr< ::Deployment::DeploymentPlan> plan (xml.release_plan ()); + + if (plan.get () == 0) + { + ACE_ERROR ((LM_ERROR, "*** error parsing XML document\n")); + throw 1; + } + + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: resoling execution manager reference.\n")); + CORBA::Object_var obj = orb->string_to_object (argv[1]); + Deployment::ExecutionManager_var em = Deployment::ExecutionManager::_narrow (obj.in ()); + + if (CORBA::is_nil (em.in ())) + { + ACE_ERROR ((LM_ERROR, "*** simple_em_launcher: ExecutionManager reference is nil.")); + throw 1; + } + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: calling prepareplan.\n")); + Deployment::DomainApplicationManager_var dam = em->preparePlan (*plan, + Deployment::ResourceCommitmentManager::_nil ()); + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: calling startLaunch\n")); + Deployment::Connections_var conns; + Deployment::Properties props; + Deployment::Application_var app = dam->startLaunch (props, conns.out ()); + Deployment::DomainApplication_var da = Deployment::DomainApplication::_narrow (app.in ()); + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: calling finishLaunch\n")); + da->finishLaunch (conns.in (), false); + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: calling start\n")); + da->start (); + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: start finished, sleeping 5 seconds.\n")); + ACE_OS::sleep (5); + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: waking up from sleep, calling destroyApplication\n")); + + dam->destroyApplication (da.in ()); + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: calling destroyManager\n")); + + em->destroyManager (dam.in ()); + + ACE_DEBUG ((LM_INFO, "*** simple_em_launcher: destroyManager completed.\n")); + + orb->destroy (); + } + catch (const Deployment::StopError &ex) + { + ACE_ERROR ((LM_ERROR, "*** Caught StopError exception with name %s and reason %s\n", + ex.name.in (), ex.reason.in ())); + return -1; + } + catch (const Deployment::StartError &ex) + { + ACE_ERROR ((LM_ERROR, "*** Caught StartError exception with name %s and reason %s\n", + ex.name.in (), ex.reason.in ())); + return -1; + } + catch (const CORBA::Exception &ex) + { + ACE_ERROR ((LM_ERROR, "*** Caught CORBA exception: %s\n", + ex._info ().c_str ())); + return -1; + + } + catch (...) + { + orb->destroy (); + ACE_ERROR ((LM_ERROR, "*** Caugn unknown exception\n")); + return -1; + } + return 0; +} diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/EmitsConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/EmitsConnectionExplicitHome.cdp new file mode 100644 index 00000000000..6ac17b1e9e9 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/EmitsConnectionExplicitHome.cdp @@ -0,0 +1,227 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleEmitterHomeImplementation"> + <name>SimpleEmitterHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleEmitter_ExecArtifact" /> + <artifact xmi:idref="SimpleEmitter_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleEmitterHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleEmitterHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitter_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitter_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleEmitterComponentImplementation"> + <name>SimpleEmitterComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleEmitter_ExecArtifact" /> + <artifact xmi:idref="SimpleEmitter_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleConsumerHomeImplementation"> + <name>SimpleConsumerHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleConsumerComponentImplementation"> + <name>SimpleConsumerComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleEmitterHomeInstance"> + <name>SimpleEmitterHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleEmitterHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleEmitterComponentInstance"> + <name>SimpleEmitterComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleEmitterComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleEmitterHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleConsumerHomeInstance"> + <name>SimpleConsumerHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleConsumerComponentInstance"> + <name>SimpleConsumerComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumerHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>hello</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance xmi:idref="SimpleEmitterComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>hello_</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="SimpleConsumerComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleEmitter_ExecArtifact"> + <name>SimpleEmitter_exec</name> + <source/> + <node/> + <location>SimpleEmitter_exec</location> + </artifact> + <artifact xmi:id="SimpleEmitter_SvntArtifact"> + <name>SimpleEmitter_svnt</name> + <source/> + <node/> + <location>SimpleEmitter_svnt</location> + </artifact> + + <artifact xmi:id="SimpleConsumer_ExecArtifact"> + <name>SimpleConsumer_exec</name> + <source/> + <node/> + <location>SimpleConsumer_exec</location> + </artifact> + <artifact xmi:id="SimpleConsumer_SvntArtifact"> + <name>SimpleConsumer_svnt</name> + <source/> + <node/> + <location>SimpleConsumer_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/MultiplexConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/MultiplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..45ff31929c3 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/MultiplexConnectionExplicitHome.cdp @@ -0,0 +1,262 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleProviderHomeImplementation"> + <name>SimpleProviderHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleProviderComponentImplementation"> + <name>SimpleProviderComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleMultipleUserHomeImplementation"> + <name>SimpleMultipleUserHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleMultipleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleMultipleUser_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleMultipleUserHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleMultipleUserHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUser_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUser_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleMultipleUserComponentImplementation"> + <name>SimpleMultipleUserComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleMultipleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleMultipleUser_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleProviderHomeInstance"> + <name>SimpleProviderHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleProviderComponentInstance"> + <name>SimpleProviderComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProviderHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleMultipleUserHomeInstance"> + <name>SimpleMultipleUserHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleMultipleUserComponentInstance"> + <name>SimpleMultipleUserComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleMultipleUserComponentInstanceReverse"> + <name>SimpleMultipleUserComponentReverse</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleMultipleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleMultipleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>MultiplexReceptacle</kind> + <instance xmi:idref="SimpleMultipleUserComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>TestConnectionReverse</name> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>MultiplexReceptacle</kind> + <instance xmi:idref="SimpleMultipleUserComponentInstanceReverse" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleProvider_ExecArtifact"> + <name>SimpleProvider_exec</name> + <source/> + <node/> + <location>SimpleProvider_exec</location> + </artifact> + <artifact xmi:id="SimpleProvider_SvntArtifact"> + <name>SimpleProvider_svnt</name> + <source/> + <node/> + <location>SimpleProvider_svnt</location> + </artifact> + + <artifact xmi:id="SimpleMultipleUser_ExecArtifact"> + <name>SimpleMultipleUser_exec</name> + <source/> + <node/> + <location>SimpleMultipleUser_exec</location> + </artifact> + <artifact xmi:id="SimpleMultipleUser_SvntArtifact"> + <name>SimpleMultipleUser_svnt</name> + <source/> + <node/> + <location>SimpleMultipleUser_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/PublishConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/PublishConnectionExplicitHome.cdp new file mode 100644 index 00000000000..53a0a54482d --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/PublishConnectionExplicitHome.cdp @@ -0,0 +1,227 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimplePublisherHomeImplementation"> + <name>SimplePublisherHomeImplementation</name> + <source/> + <artifact xmi:idref="SimplePublisher_ExecArtifact" /> + <artifact xmi:idref="SimplePublisher_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimplePublisherHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimplePublisherHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisher_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisher_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimplePublisherComponentImplementation"> + <name>SimplePublisherComponentImplementation</name> + <source/> + <artifact xmi:idref="SimplePublisher_ExecArtifact" /> + <artifact xmi:idref="SimplePublisher_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleConsumerHomeImplementation"> + <name>SimpleConsumerHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleConsumerHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumer_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleConsumerComponentImplementation"> + <name>SimpleConsumerComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleConsumer_ExecArtifact" /> + <artifact xmi:idref="SimpleConsumer_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimplePublisherHomeInstance"> + <name>SimplePublisherHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimplePublisherHomeImplementation" /> + </instance> + + <instance xmi:id="SimplePublisherComponentInstance"> + <name>SimplePublisherComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimplePublisherComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimplePublisherHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleConsumerHomeInstance"> + <name>SimpleConsumerHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleConsumerComponentInstance"> + <name>SimpleConsumerComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleConsumerComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleConsumerHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>hello</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance xmi:idref="SimplePublisherComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>hello_</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance xmi:idref="SimpleConsumerComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimplePublisher_ExecArtifact"> + <name>SimplePublisher_exec</name> + <source/> + <node/> + <location>SimplePublisher_exec</location> + </artifact> + <artifact xmi:id="SimplePublisher_SvntArtifact"> + <name>SimplePublisher_svnt</name> + <source/> + <node/> + <location>SimplePublisher_svnt</location> + </artifact> + + <artifact xmi:id="SimpleConsumer_ExecArtifact"> + <name>SimpleConsumer_exec</name> + <source/> + <node/> + <location>SimpleConsumer_exec</location> + </artifact> + <artifact xmi:id="SimpleConsumer_SvntArtifact"> + <name>SimpleConsumer_svnt</name> + <source/> + <node/> + <location>SimpleConsumer_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleAttributeExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleAttributeExplicitHome.cdp new file mode 100644 index 00000000000..d66eef2c70b --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleAttributeExplicitHome.cdp @@ -0,0 +1,179 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation xmi:id="SimpleAttributeHomeImplementation"> + <name>SimpleAttributeHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleAttribute_ExecArtifact" /> + <artifact xmi:idref="SimpleAttribute_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleAttributeHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleAttributeHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleAttribute_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleAttribute_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleAttributeComponentImplementation"> + <name>SimpleAttributeComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleAttribute_ExecArtifact" /> + <artifact xmi:idref="SimpleAttribute_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleAttributeHomeInstance"> + <name>SimpleAttributeHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleAttributeHomeImplementation" /> + <configProperty> + <name>str_attr</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Initialized Attribute!</string> + </value> + </value> + </configProperty> + <configProperty> + <name>long_attr</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>1</long> + </value> + </value> + </configProperty> + <configProperty> + <name>short_attr</name> + <value> + <type> + <kind>tk_short</kind> + </type> + <value> + <short>1</short> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleAttributeComponentInstance"> + <name>SimpleAttributeComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleAttributeComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleAttributeHome</string> + </value> + </value> + </configProperty> + <configProperty> + <name>str_attr</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Initialized Attribute!</string> + </value> + </value> + </configProperty> + <configProperty> + <name>long_attr</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>1</long> + </value> + </value> + </configProperty> + <configProperty> + <name>short_attr</name> + <value> + <type> + <kind>tk_short</kind> + </type> + <value> + <short>1</short> + </value> + </value> + </configProperty> + </instance> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleAttribute_ExecArtifact"> + <name>SimpleAttribute_exec</name> + <source/> + <node/> + <location>SimpleAttribute_exec</location> + </artifact> + <artifact xmi:id="SimpleAttribute_SvntArtifact"> + <name>SimpleAttribute_svnt</name> + <source/> + <node/> + <location>SimpleAttribute_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentExplicitHome.cdp new file mode 100644 index 00000000000..5632d219c48 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentExplicitHome.cdp @@ -0,0 +1,113 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation xmi:id="SimpleNullHomeImplementation"> + <name>SimpleNullHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleNull_ExecArtifact" /> + <artifact xmi:idref="SimpleNull_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNullHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNullHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleNullComponentImplementation"> + <name>SimpleNullComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleNull_ExecArtifact" /> + <artifact xmi:idref="SimpleNull_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleNullHomeInstance"> + <name>SimpleNullHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleNullHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleNullComponentInstance"> + <name>SimpleNullComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleNullComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNullHome</string> + </value> + </value> + </configProperty> + </instance> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleNull_ExecArtifact"> + <name>SimpleNull_exec</name> + <source/> + <node/> + <location>SimpleNull_exec</location> + </artifact> + <artifact xmi:id="SimpleNull_SvntArtifact"> + <name>SimpleNull_svnt</name> + <source/> + <node/> + <location>SimpleNull_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp new file mode 100644 index 00000000000..e31930188d2 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp @@ -0,0 +1,86 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <implementation xmi:id="SimpleNullComponentImplementation"> + <name>SimpleNullComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleNull_ExecArtifact" /> + <artifact xmi:idref="SimpleNull_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNull_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNull_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="SimpleNullComponentInstance"> + <name>SimpleNullComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleNullComponentImplementation" /> + </instance> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleNull_ExecArtifact"> + <name>SimpleNull_exec</name> + <source/> + <node/> + <location>SimpleNull_exec</location> + </artifact> + <artifact xmi:id="SimpleNull_SvntArtifact"> + <name>SimpleNull_svnt</name> + <source/> + <node/> + <location>SimpleNull_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleHome.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleHome.cdp new file mode 100644 index 00000000000..a63da21f0f6 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleHome.cdp @@ -0,0 +1,90 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation xmi:id="SimpleNullHomeImplementation"> + <name>SimpleNullHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleNull_ExecArtifact" /> + <artifact xmi:idref="SimpleNull_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNullHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleNullHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleNull_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <!-- Instances declarations --> + + <!-- Server Dance instances--> + <instance xmi:id="SimpleNullHomeInstance"> + <name>SimpleNullHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleNullHomeImplementation" /> + </instance> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleNull_ExecArtifact"> + <name>SimpleNull_exec</name> + <source/> + <node/> + <location>SimpleNull_exec</location> + </artifact> + <artifact xmi:id="SimpleNull_SvntArtifact"> + <name>SimpleNull_svnt</name> + <source/> + <node/> + <location>SimpleNull_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimplexConnectionExplicitHome.cdp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..f3f1e1ca6e9 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimplexConnectionExplicitHome.cdp @@ -0,0 +1,262 @@ +<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>SimpleComponent_Home</label> + <UUID>SimpleComponent_Home</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="SimpleProviderHomeImplementation"> + <name>SimpleProviderHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleProviderHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProvider_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleProviderComponentImplementation"> + <name>SimpleProviderComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleProvider_ExecArtifact" /> + <artifact xmi:idref="SimpleProvider_SvntArtifact" /> + </implementation> + + <implementation xmi:id="SimpleUserHomeImplementation"> + <name>SimpleUserHomeImplementation</name> + <source/> + <artifact xmi:idref="SimpleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleUser_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleUserHome_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Simple_SimpleUserHome_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUser_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUser_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SimpleUserComponentImplementation"> + <name>SimpleUserComponentImplementation</name> + <source/> + <artifact xmi:idref="SimpleUser_ExecArtifact" /> + <artifact xmi:idref="SimpleUser_SvntArtifact" /> + </implementation> + + <instance xmi:id="SimpleProviderHomeInstance"> + <name>SimpleProviderHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleProviderComponentInstance"> + <name>SimpleProviderComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleProviderComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleProviderHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleUserHomeInstance"> + <name>SimpleUserHome</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserHomeImplementation" /> + </instance> + + <instance xmi:id="SimpleUserComponentInstance"> + <name>SimpleUserComponent</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SimpleUserComponentInstanceReverse"> + <name>SimpleUserComponentReverse</name> + <node>Node</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SimpleUserComponentImplementation" /> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SimpleUserHome</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>TestConnection</name> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SimpleUserComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>TestConnectionReverse</name> + <internalEndpoint> + <portName>trig</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SimpleUserComponentInstanceReverse" /> + </internalEndpoint> + <internalEndpoint> + <portName>trig</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SimpleProviderComponentInstance" /> + </internalEndpoint> + </connection> + + <!-- Artifacts declarations --> + <artifact xmi:id="SimpleProvider_ExecArtifact"> + <name>SimpleProvider_exec</name> + <source/> + <node/> + <location>SimpleProvider_exec</location> + </artifact> + <artifact xmi:id="SimpleProvider_SvntArtifact"> + <name>SimpleProvider_svnt</name> + <source/> + <node/> + <location>SimpleProvider_svnt</location> + </artifact> + + <artifact xmi:id="SimpleUser_ExecArtifact"> + <name>SimpleUser_exec</name> + <source/> + <node/> + <location>SimpleUser_exec</location> + </artifact> + <artifact xmi:id="SimpleUser_SvntArtifact"> + <name>SimpleUser_svnt</name> + <source/> + <node/> + <location>SimpleUser_svnt</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/nm_launcher.mpc b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/nm_launcher.mpc new file mode 100644 index 00000000000..479e04f2acc --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/nm_launcher.mpc @@ -0,0 +1,5 @@ +project(simple_nm_launcher) : ciao_config_handlers, dance_nodemanager_stub, ciao_logger { + Source_Files { + simple_nm_launcher.cpp + } +}
\ No newline at end of file diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/run_test.pl b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/run_test.pl new file mode 100755 index 00000000000..27b9f7987e8 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/run_test.pl @@ -0,0 +1,115 @@ +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::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE"; +$daemons_running = 0; +$daemons = 1; +@ports = ( 60001 ); +@iorfiles = ( "NodeApp1.ior" ); +@nodenames = ( "Node" ); +$status = 0; + +$E = 0; +$EM = 0; + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $daemons; ++$i) { + unlink $iorfiles[$i]; + } +} + +sub kill_node_daemons { + for ($i = 0; $i < $daemons; ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + + $d_cmd = "$DAnCE/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + 30) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +if ($#ARGV == -1) +{ + opendir(DIR, "."); + @files = grep(/\.cdp$/,readdir(DIR)); + closedir(DIR); +} else { + @files = @ARGV; +} + +foreach $file (@files) { + delete_ior_files (); + + print "Running test for plan $file\n"; + + # Invoke node daemons. + 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 executor - start the application -. + print "Launching the plan. file://NodeApp1.ior \n"; + $E = new PerlACE::Process ("simple_nm_launcher", + "file://NodeApp1.ior $file"); + + $status = $E->SpawnWaitKill (5000); + + if ($status != 0) + { + print "ERROR: simple_nm_launcher returned error status $status\n"; + } + + print "Test for plan $file succeeded\n"; + kill_open_processes (); +} + + +exit $status; diff --git a/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/simple_nm_launcher.cpp b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/simple_nm_launcher.cpp new file mode 100644 index 00000000000..8b4d5531816 --- /dev/null +++ b/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/simple_nm_launcher.cpp @@ -0,0 +1,128 @@ +/** + * @file simple_nm_launcher.cpp + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * Launches then immediately tears down a plan. + */ + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_unistd.h" +#include "tao/ORB.h" +#include "ciao/Logger/Logger_Service.h" +#include "ciao/Logger/Log_Macros.h" +#include "Deployment/Deployment_NodeApplicationC.h" +#include "Deployment/Deployment_NodeManagerC.h" +#include "Deployment/Deployment_DeploymentPlanC.h" +#include "tools/Config_Handlers/XML_File_Intf.h" + +int usage () +{ + ACE_ERROR ((LM_ERROR, "simple_nm_launcher <nm_url> <plan>\n")); + return -1; +} + +#include <iostream> + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + CIAO_DISABLE_TRACE (); + + auto_ptr<CIAO::Logger_Service> logger; + + CIAO::Logger_Service + * dlf = ACE_Dynamic_Service<CIAO::Logger_Service>::instance ("CIAO_Logger_Backend_Factory"); + + if (!dlf) + dlf = new CIAO::Logger_Service; + + logger.reset (dlf); + logger->init (argc, argv); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (argc != 3) + return usage (); + + try + { + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: parsing XML\n")); + // Parse plan + CIAO::Config_Handlers::XML_File_Intf xml (argv[2]); + xml.add_search_path ("CIAO_ROOT", "/docs/schema/"); + + auto_ptr< ::Deployment::DeploymentPlan> plan (xml.release_plan ()); + + if (plan.get () == 0) + { + ACE_ERROR ((LM_ERROR, "*** error parsing XML document\n")); + throw 1; + } + + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: resoling node manager reference.\n")); + CORBA::Object_var obj = orb->string_to_object (argv[1]); + Deployment::NodeManager_var nm = Deployment::NodeManager::_narrow (obj.in ()); + + if (CORBA::is_nil (nm.in ())) + { + ACE_ERROR ((LM_ERROR, "*** simple_nm_launcher: NodeManager reference is nil.")); + throw 1; + } + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: calling prepareplan.\n")); + Deployment::NodeApplicationManager_var nam = nm->preparePlan (*plan, + Deployment::ResourceCommitmentManager::_nil ()); + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: calling startLaunch\n")); + Deployment::Connections_var conns; + Deployment::Properties props; + Deployment::Application_var app = nam->startLaunch (props, conns.out ()); + Deployment::NodeApplication_var na = Deployment::NodeApplication::_narrow (app.in ()); + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: calling finishLaunch\n")); + na->finishLaunch (conns.in (), false); + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: calling start\n")); + na->start (); + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: start finished, sleeping 5 seconds.\n")); + ACE_OS::sleep (5); + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: waking up from sleep, calling destroyApplication\n")); + + nam->destroyApplication (na.in ()); + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: calling destroyManager\n")); + + nm->destroyManager (nam.in ()); + + ACE_DEBUG ((LM_DEBUG, "*** simple_nm_launcher: destroyManager completed.\n")); + + orb->destroy (); + } + catch (Deployment::StopError &ex) + { + ACE_ERROR ((LM_ERROR, "*** Caught StopError exception with name %s and reason %s\n", + ex.name.in (), ex.reason.in ())); + return -1; + } + catch (Deployment::StartError &ex) + { + ACE_ERROR ((LM_ERROR, "*** Caught StartError exception with name %s and reason %s\n", + ex.name.in (), ex.reason.in ())); + return -1; + } + catch (CORBA::Exception &ex) + { + ACE_ERROR ((LM_ERROR, "*** Caught CORBA exception: %s\n", + ex._info ().c_str ())); + return -1; + + } + catch (...) + { + orb->destroy (); + ACE_ERROR ((LM_ERROR, "*** Caugn unknown exception\n")); + return -1; + } + return 0; +} diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host1.cdp b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host1.cdp new file mode 100644 index 00000000000..7aa477fae74 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host1.cdp @@ -0,0 +1,639 @@ +<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>CCmDance2_1</label> + <UUID>CcmDance2_1</UUID> + + <realizes></realizes> + + <!-- Implementations declarations --> + + <!-- Client Dance implementation--> + <!-- Home implementation --> + <implementation id="ClientDanceHomeImplementation"> + <name>ClientDanceHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ClientDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/ClientModule/ClientDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2Test.ClientModule.SessionClientDanceHome_impl</string> + </value> + </value> + </execParameter> + +<!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> +<!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/HostnameResult:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createHostnameResultFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="ClientDanceImplementation"> + <name>ClientDanceImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + + <!-- Test Driver implementation--> + <!-- Home implementation --> + <implementation id="TestDriverHomeImplementation"> + <name>TestDriverHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_TestDriverHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/DriverModule/TestDriverHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2Test.DriverModule.SessionTestDriverHome_impl</string> + </value> + </value> + </execParameter> + + </implementation> + + <!-- Component implementation --> + <implementation id="TestDriverImplementation"> + <name>TestDriverImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + + + + + + <!-- Instances declarations --> + + <!-- Client Dance instances--> + <instance id="ClientDanceHome1"> + <name>ClientDanceHome1</name> + <node>Host1</node> + <!-- hostname --> + <source/> + <implementation>ClientDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess2@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ClientDance1"> + <name>ClientDance1</name> + <node>Host1</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + <!-- Test Driver instances--> + <instance id="TestDriverHome"> + <name>TestDriverHome</name> + <node>Host1</node> + <!-- hostname --> + <source/> + <implementation>TestDriverHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess2@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="TestDriver1"> + <name>TestDriver1</name> + <node>Host1</node> + <source/> + <implementation>TestDriverImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriverHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriver1</string> + </value> + </value> + </configProperty> + </instance> + + + + + + <!-- Connections declarations --> + + <connection> + <name>client1_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ServerDance/serverHostInfo1.Port</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>server_receptacle1</name> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ServerDance.Component</location> + <provider>false</provider> + <portName>clientHostInfo1</portName> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client1_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ServerDance.Component</location> + <provider>false</provider> + <portName>hostnamePublishes</portName> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>server_consumer_to_emits1</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ServerDance/commands.Port</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client1_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ServerDance/supports.Port</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client1_naming</name> + <internalEndpoint> + <portName>naming</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4x.prismtech.com:21869</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_server</name> + <internalEndpoint> + <portName>server</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ServerDance/supports.Port</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_client1</name> + <internalEndpoint> + <portName>client1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_client2</name> + <internalEndpoint> + <portName>client2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ClientDance2/supports.Port</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_sayHello</name> + <internalEndpoint> + <portName>handshake</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:12345#Host2/CcmDance2_1.DeploymentPlan/ServerDance/supports.Port</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <!-- Artifacts declarations --> + <artifact id="ClientDanceArtifact"> + <name>ClientDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2/c++/i686-pc-linux-gnu/libClientCcmDance2Demo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/HostnameResult:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createHostnameResultFactory</string> + </value> + </value> + </execParameter> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host2.cdp b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host2.cdp new file mode 100644 index 00000000000..57a44321b09 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host2.cdp @@ -0,0 +1,969 @@ +<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>CCmDance2_1</label> + <UUID>CcmDance2_1</UUID> + + <realizes></realizes> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation id="ServerDanceHomeImplementation"> + <name>ServerDanceHomeImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + <artifact>ServerDanceArtifact2</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ServerDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/ServerModule/ServerDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2Test.ServerModule.SessionServerDanceHome_impl</string> + </value> + </value> + </execParameter> + +<!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> +<!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/Command:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createCommandFactory</string> + </value> + </member> + </element> + </value> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/CcmDance2Test/FooValueType:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createFooValueTypeFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="ServerDanceImplementation"> + <name>ServerDanceImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + </implementation> + + + + <!-- Client Dance implementation--> + <!-- Home implementation --> + <implementation id="ClientDanceHomeImplementation"> + <name>ClientDanceHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ClientDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/ClientModule/ClientDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2Test.ClientModule.SessionClientDanceHome_impl</string> + </value> + </value> + </execParameter> + +<!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> +<!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/HostnameResult:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createHostnameResultFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="ClientDanceImplementation"> + <name>ClientDanceImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + <!-- Instances declarations --> + + <!-- Server Dance instances--> + <instance id="ServerDanceHome"> + <name>ServerDanceHome</name> + <node>Host2</node> + <!-- hostname --> + <source/> + <implementation>ServerDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceProcess@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ServerDance"> + <name>ServerDance</name> + <node>Host2</node> + <source/> + <implementation>ServerDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDance</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooStruct--> + <name>fooStruct</name> + <value> + <type> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2Test/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </type> + <value> + <member> + <name>fooString</name> + <value> + <string>hello</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>250</long> + </value> + </member> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnum--> + <name>fooEnum</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2Test/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </type> + <value> + <enum>B</enum> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooStructSeq--> + <name>fooStructSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2Test/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>fooString</name> + <value> + <string>hello1</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>123</long> + </value> + </member> + </element> + <element> + <member> + <name>fooString</name> + <value> + <string>hello2</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>456</long> + </value> + </member> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnumSeq--> + <name>fooEnumSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2Test/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </elementType> + </sequence> + </type> + <value> + <element> + <enum>A</enum> + </element> + <element> + <enum>C</enum> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname1--> + <name>expectedClientHostname1</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x.prismtech.com</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname2--> + <name>expectedClientHostname2</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + + <instance id="ClientDanceHome2"> + <name>ClientDanceHome2</name> + <node>Host2</node> + <!-- hostname --> + <source/> + <implementation>ClientDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess1@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ClientDance2"> + <name>ClientDance2</name> + <node>Host2</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + <!-- Connections declarations --> + + <connection> + <name>client1_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo1</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>serverHostInfo2</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_receptacle1</name> + <internalEndpoint> + <portName>clientHostInfo1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <externalReference> + <location>corbaloc:iiop:1.2@rhel4x.prismtech.com:12345/%14%01%0f%00NUP%00%00%00%16%02%00%00%00%01%00%00%00RootPOA%00Host1%00CcmDance2_1/ClientDance1/clientHostInfo</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>server_receptacle2</name> + <internalEndpoint> + <portName>clientHostInfo2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <externalReference> + <location>corbaloc:iiop:1.2@rhel4x.prismtech.com:12345/%14%01%0f%00NUP%00%00%00%16%02%00%00%00%01%00%00%00RootPOA%00Host1%00CcmDance2_1/ClientDance1/hostnameResults</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client2_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_consumer_to_emits1</name> + <internalEndpoint> + <portName>commands</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_consumer_to_emits2</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>commands</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_sayHello</name> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_naming</name> + <internalEndpoint> + <portName>naming</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4x.prismtech.com:21869</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_server</name> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_client2</name> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_sayHello</name> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + + + + + <!-- Artifacts declarations --> + <artifact id="ServerDanceArtifact1"> + <name>ServerDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2/c++/i686-pc-linux-gnu/libServerCcmDance2Demo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/Command:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createCommandFactory</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ServerDanceArtifact2"> + <name>ServerDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2/c++/i686-pc-linux-gnu/libServerCcmDance2Demo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/FooValueType:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createFooValueTypeFactory</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ClientDanceArtifact"> + <name>ClientDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2/c++/i686-pc-linux-gnu/libClientCcmDance2Demo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/HostnameResult:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createHostnameResultFactory</string> + </value> + </value> + </execParameter> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2.cdp b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2.cdp new file mode 100644 index 00000000000..bc761b07268 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2.cdp @@ -0,0 +1,1300 @@ +<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>CCmDance2_1</label> + <UUID>CcmDance2_1</UUID> + + <realizes></realizes> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation id="ServerDanceHomeImplementation"> + <name>ServerDanceHomeImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + <artifact>ServerDanceArtifact2</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ServerDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/ServerModule/ServerDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2Test.ServerModule.SessionServerDanceHome_impl</string> + </value> + </value> + </execParameter> + +<!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> +<!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/Command:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createCommandFactory</string> + </value> + </member> + </element> + </value> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/CcmDance2Test/FooValueType:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createFooValueTypeFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="ServerDanceImplementation"> + <name>ServerDanceImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + </implementation> + + + + <!-- Client Dance implementation--> + <!-- Home implementation --> + <implementation id="ClientDanceHomeImplementation"> + <name>ClientDanceHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ClientDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/ClientModule/ClientDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2Test.ClientModule.SessionClientDanceHome_impl</string> + </value> + </value> + </execParameter> + +<!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> +<!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/HostnameResult:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createHostnameResultFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="ClientDanceImplementation"> + <name>ClientDanceImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + + <!-- Test Driver implementation--> + <!-- Home implementation --> + <implementation id="TestDriverHomeImplementation"> + <name>TestDriverHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_TestDriverHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/DriverModule/TestDriverHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2Test.DriverModule.SessionTestDriverHome_impl</string> + </value> + </value> + </execParameter> + + </implementation> + + <!-- Component implementation --> + <implementation id="TestDriverImplementation"> + <name>TestDriverImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + + + + + + <!-- Instances declarations --> + + <!-- Server Dance instances--> + <instance id="ServerDanceHome"> + <name>ServerDanceHome</name> + <node>Host2</node> + <!-- hostname --> + <source/> + <implementation>ServerDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceProcess@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ServerDance"> + <name>ServerDance</name> + <node>Host2</node> + <source/> + <implementation>ServerDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDance</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooStruct--> + <name>fooStruct</name> + <value> + <type> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2Test/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </type> + <value> + <member> + <name>fooString</name> + <value> + <string>hello</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>250</long> + </value> + </member> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnum--> + <name>fooEnum</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2Test/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </type> + <value> + <enum>B</enum> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooStructSeq--> + <name>fooStructSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2Test/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>fooString</name> + <value> + <string>hello1</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>123</long> + </value> + </member> + </element> + <element> + <member> + <name>fooString</name> + <value> + <string>hello2</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>456</long> + </value> + </member> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnumSeq--> + <name>fooEnumSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2Test/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </elementType> + </sequence> + </type> + <value> + <element> + <enum>A</enum> + </element> + <element> + <enum>C</enum> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname1--> + <name>expectedClientHostname1</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x.prismtech.com</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname2--> + <name>expectedClientHostname2</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + + <!-- Client Dance instances--> + <instance id="ClientDanceHome1"> + <name>ClientDanceHome1</name> + <node>Host1</node> + <!-- hostname --> + <source/> + <implementation>ClientDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess2@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ClientDance1"> + <name>ClientDance1</name> + <node>Host1</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + <instance id="ClientDanceHome2"> + <name>ClientDanceHome2</name> + <node>Host2</node> + <!-- hostname --> + <source/> + <implementation>ClientDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess1@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ClientDance2"> + <name>ClientDance2</name> + <node>Host2</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + <!-- Test Driver instances--> + <instance id="TestDriverHome"> + <name>TestDriverHome</name> + <node>Host1</node> + <!-- hostname --> + <source/> + <implementation>TestDriverHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess2@CcmDance2Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="TestDriver1"> + <name>TestDriver1</name> + <node>Host1</node> + <source/> + <implementation>TestDriverImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriverHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriver1</string> + </value> + </value> + </configProperty> + </instance> + + + + + + <!-- Connections declarations --> + + <connection> + <name>client1_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>serverHostInfo1</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>serverHostInfo2</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_receptacle1</name> + <internalEndpoint> + <portName>clientHostInfo1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_receptacle2</name> + <internalEndpoint> + <portName>clientHostInfo2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_consumer_to_emits1</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>commands</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_consumer_to_emits2</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>commands</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_naming</name> + <internalEndpoint> + <portName>naming</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:21869</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client2_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_naming</name> + <internalEndpoint> + <portName>naming</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::rhel4y.prismtech.com:21869</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_server</name> + <internalEndpoint> + <portName>server</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_client1</name> + <internalEndpoint> + <portName>client1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_client2</name> + <internalEndpoint> + <portName>client2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_sayHello</name> + <internalEndpoint> + <portName>handshake</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + + + + + <!-- Artifacts declarations --> + <artifact id="ServerDanceArtifact1"> + <name>ServerDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2/c++/i686-pc-linux-gnu/libServerCcmDance2Demo.so</location> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createCommandFactory</string> + </value> + </value> + </execParameter> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/Command:1.0</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ServerDanceArtifact2"> + <name>ServerDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2/c++/i686-pc-linux-gnu/libServerCcmDance2Demo.so</location> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createFooValueTypeFactory</string> + </value> + </value> + </execParameter> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/FooValueType:1.0</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ClientDanceArtifact"> + <name>ClientDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2/c++/i686-pc-linux-gnu/libClientCcmDance2Demo.so</location> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createHostnameResultFactory</string> + </value> + </value> + </execParameter> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2Test/EventTypeModule/HostnameResult:1.0</string> + </value> + </value> + </execParameter> + + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host1.cdp b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host1.cdp new file mode 100644 index 00000000000..8626b5275a9 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host1.cdp @@ -0,0 +1,1055 @@ +<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>CCmDance2_1</label> + <UUID>CcmDance2_1</UUID> + + <realizes></realizes> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation id="ServerDanceHomeImplementation"> + <name>ServerDanceHomeImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + <artifact>ServerDanceArtifact2</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ServerDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/ServerModule/ServerDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2WithFTTest.ServerModule.FTSessionServerDanceHome_impl</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- FAULT_TOLERANCE_REPLICATION_STYLE --> + <name>cdmw.config.FaultToleranceReplicationStyle</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>FTReplicationStyleValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/FTReplicationStyleValue:1.0</typeId> + <member>STATELSESS</member> + <member>COLD_PASSIVE</member> + <member>WARM_PASSIVE</member> + <member>ACTIVE</member> + <member>ACTIVE_WITH_VOTING</member> + </enum> + </type> + <value> + <enum>WARM_PASSIVE</enum> + </value> + </value> + </execParameter> + + </implementation> + + <!-- Component implementation --> + <implementation id="ServerDanceImplementation"> + <name>ServerDanceImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + <artifact>ServerDanceArtifact2</artifact> + </implementation> + + + + <!-- Client Dance implementation--> + <!-- Home implementation --> + <implementation id="ClientDanceHomeImplementation"> + <name>ClientDanceHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + <artifact>ServerDanceArtifact1</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ClientDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/ClientModule/ClientDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2WithFTTest.ClientModule.SessionClientDanceHome_impl</string> + </value> + </value> + </execParameter> + </implementation> + + <!-- Component implementation --> + <implementation id="ClientDanceImplementation"> + <name>ClientDanceImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + <artifact>ServerDanceArtifact1</artifact> + </implementation> + + + <!-- Test Driver implementation--> + <!-- Home implementation --> + <implementation id="TestDriverHomeImplementation"> + <name>TestDriverHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_TestDriverHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/DriverModule/TestDriverHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2WithFTTest.DriverModule.SessionTestDriverHome_impl</string> + </value> + </value> + </execParameter> + + </implementation> + + <!-- Component implementation --> + <implementation id="TestDriverImplementation"> + <name>TestDriverImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + <!-- Instances declarations --> + + <!-- Server Dance instances--> + <instance id="ServerDanceHome1"> + <name>ServerDanceHome1</name> + <node>Host1</node> + <!-- hostname --> + <source/> + <implementation>ServerDanceHomeImplementation</implementation> + + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceProcess1@CcmDance2WithFTApplication</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ServerDance1"> + <name>ServerDance1</name> + <node>Host1</node> + <source/> + <implementation>ServerDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceHome1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDance1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- FAULT_TOLERANT GROUP NAME--> + <name>cdmw.config.FaultToleranceGroupName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceFT</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooStruct--> + <name>fooStruct</name> + <value> + <type> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </type> + <value> + <member> + <name>fooString</name> + <value> + <string>hello</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>250</long> + </value> + </member> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnum--> + <name>fooEnum</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </type> + <value> + <enum>B</enum> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooStructSeq--> + <name>fooStructSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>fooString</name> + <value> + <string>hello1</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>123</long> + </value> + </member> + </element> + <element> + <member> + <name>fooString</name> + <value> + <string>hello2</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>456</long> + </value> + </member> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnumSeq--> + <name>fooEnumSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </elementType> + </sequence> + </type> + <value> + <element> + <enum>A</enum> + </element> + <element> + <enum>C</enum> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname1--> + <name>expectedClientHostname1</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x.prismtech.com</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname2--> + <name>expectedClientHostname2</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + + <!-- Client Dance instances--> + <instance id="ClientDanceHome1"> + <name>ClientDanceHome1</name> + <node>Host1</node> + <!-- hostname --> + <source/> + <implementation>ClientDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess1@CcmDance2WithFTApplication</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ClientDance1"> + <name>ClientDance1</name> + <node>Host1</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + <!-- Test Driver instances--> + <instance id="TestDriverHome"> + <name>TestDriverHome</name> + <node>Host1</node> + <!-- hostname --> + <source/> + <implementation>TestDriverHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess1@CcmDance2WithFTApplication</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="TestDriver1"> + <name>TestDriver1</name> + <node>Host1</node> + <source/> + <implementation>TestDriverImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriverHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriver1</string> + </value> + </value> + </configProperty> + </instance> + + + + + + <!-- Connections declarations --> + + <connection> + <name>client1_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>server_receptacle1</name> + <internalEndpoint> + <portName>clientHostInfo1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_receptacle2</name> + <internalEndpoint> + <portName>clientHostInfo2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaloc:iiop:1.2@rhel4y.prismtech.com:12345/%14%01%0f%00NUP%00%00%00%16%02%00%00%00%01%00%00%00RootPOA%00Host2%00CcmDance2_1/ClientDance2/clientHostInfo</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client1_consumer_to_publishes</name> +<!-- <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance1</instance> + </internalEndpoint> --> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>false</provider> + <portName>hostnamePublishes</portName> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client2_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaloc:iiop:1.2@rhel4y.prismtech.com:12345/%14%01%0f%00NUP%00%00%00%16%02%00%00%00%01%00%00%00RootPOA%00Host2%00CcmDance2_1/ClientDance2/hostnameResults</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>server_consumer_to_emits1</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client1_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_server</name> + <internalEndpoint> + <portName>server</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_client1</name> + <internalEndpoint> + <portName>client1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_client2</name> + <internalEndpoint> + <portName>client2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <externalReference> + <location>corbaloc:iiop:1.2@rhel4y.prismtech.com:12345/%14%01%0f%00NUP%00%00%00%16%02%00%00%00%01%00%00%00RootPOA%00Host2%00CcmDance2_1/ClientDance2/supports</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_sayHello</name> + <internalEndpoint> + <portName>handshake</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + + + + + <!-- Artifacts declarations --> + <artifact id="ServerDanceArtifact1"> + <name>ServerDanceArtifact1</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2_with_ft/c++/i686-pc-linux-gnu/libServerCcmDance2WithFTDemo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/EventTypeModule/Command:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createCommandFactory</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ServerDanceArtifact2"> + <name>ServerDanceArtifact2</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2_with_ft/c++/i686-pc-linux-gnu/libServerCcmDance2WithFTDemo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>DL:acme.com/CcmDance2WithFTTest/FooValueType:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createFooValueTypeFactory</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ClientDanceArtifact"> + <name>ClientDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2_with_ft/c++/i686-pc-linux-gnu/libClientCcmDance2WithFTDemo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/EventTypeModule/HostnameResult:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createHostnameResultFactory</string> + </value> + </value> + </execParameter> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host2.cdp b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host2.cdp new file mode 100644 index 00000000000..801ebf4b60f --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host2.cdp @@ -0,0 +1,941 @@ +<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>CCmDance2_1</label> + <UUID>CcmDance2_1</UUID> + + <realizes></realizes> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation id="ServerDanceHomeImplementation"> + <name>ServerDanceHomeImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + <artifact>ServerDanceArtifact2</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ServerDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/ServerModule/ServerDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2WithFTTest.ServerModule.FTSessionServerDanceHome_impl</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- FAULT_TOLERANCE_REPLICATION_STYLE --> + <name>cdmw.config.FaultToleranceReplicationStyle</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>FTReplicationStyleValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/FTReplicationStyleValue:1.0</typeId> + <member>STATELSESS</member> + <member>COLD_PASSIVE</member> + <member>WARM_PASSIVE</member> + <member>ACTIVE</member> + <member>ACTIVE_WITH_VOTING</member> + </enum> + </type> + <value> + <enum>WARM_PASSIVE</enum> + </value> + </value> + </execParameter> + + </implementation> + + <!-- Component implementation --> + <implementation id="ServerDanceImplementation"> + <name>ServerDanceImplementation</name> + <source/> + <artifact>ServerDanceArtifact1</artifact> + <artifact>ServerDanceArtifact2</artifact> + </implementation> + + + + <!-- Client Dance implementation--> + <!-- Home implementation --> + <implementation id="ClientDanceHomeImplementation"> + <name>ClientDanceHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + <artifact>ServerDanceArtifact1</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ClientDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/ClientModule/ClientDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2WithFTTest.ClientModule.SessionClientDanceHome_impl</string> + </value> + </value> + </execParameter> + </implementation> + + <!-- Component implementation --> + <implementation id="ClientDanceImplementation"> + <name>ClientDanceImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + <artifact>ServerDanceArtifact1</artifact> + </implementation> + + + <!-- Test Driver implementation--> + <!-- Home implementation --> + <implementation id="TestDriverHomeImplementation"> + <name>TestDriverHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_TestDriverHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/DriverModule/TestDriverHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance2WithFTTest.DriverModule.SessionTestDriverHome_impl</string> + </value> + </value> + </execParameter> + + </implementation> + + <!-- Component implementation --> + <implementation id="TestDriverImplementation"> + <name>TestDriverImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + + + + + + <!-- Instances declarations --> + + <!-- Server Dance instances--> + <instance id="ServerDanceHome2"> + <name>ServerDanceHome2</name> + <node>Host2</node> + <!-- hostname --> + <source/> + <implementation>ServerDanceHomeImplementation</implementation> + + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceProcess2@CcmDance2WithFTApplication</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ServerDance2"> + <name>ServerDance2</name> + <node>Host2</node> + <source/> + <implementation>ServerDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceHome2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDance2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- FAULT_TOLERANT GROUP NAME--> + <name>cdmw.config.FaultToleranceGroupName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceFT</string> + </value> + </value> + </configProperty> + + + <configProperty> + <!-- Attribute: fooStruct--> + <name>fooStruct</name> + <value> + <type> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </type> + <value> + <member> + <name>fooString</name> + <value> + <string>hello</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>250</long> + </value> + </member> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnum--> + <name>fooEnum</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </type> + <value> + <enum>B</enum> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooStructSeq--> + <name>fooStructSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>FooStruct</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooStruct:1.0</typeId> + <member> + <name>fooString</name> + <type> + <kind>tk_string</kind> + </type> + </member> + <member> + <name>fooLong</name> + <type> + <kind>tk_long</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>fooString</name> + <value> + <string>hello1</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>123</long> + </value> + </member> + </element> + <element> + <member> + <name>fooString</name> + <value> + <string>hello2</string> + </value> + </member> + <member> + <name>fooLong</name> + <value> + <long>456</long> + </value> + </member> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: fooEnumSeq--> + <name>fooEnumSeq</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_enum</kind> + <enum> + <name>FooEnum</name> + <typeId>IDL:acme.com/CcmDance2WithFTTest/FooEnum:1.0</typeId> + <member>A</member> + <member>B</member> + <member>C</member> + </enum> + </elementType> + </sequence> + </type> + <value> + <element> + <enum>A</enum> + </element> + <element> + <enum>C</enum> + </element> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname1--> + <name>expectedClientHostname1</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x.prismtech.com</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname2--> + <name>expectedClientHostname2</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + + + <!-- Client Dance instances--> + <instance id="ClientDanceHome2"> + <name>ClientDanceHome2</name> + <node>Host2</node> + <!-- hostname --> + <source/> + <implementation>ClientDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess2@CcmDance2WithFTApplication</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ClientDance2"> + <name>ClientDance2</name> + <node>Host2</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4y.prismtech.com</string> + </value> + </value> + </configProperty> + </instance> + + <!-- Connections declarations --> + <connection> + <name>client2_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>server_receptacle1</name> + <internalEndpoint> + <portName>clientHostInfo1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance2</instance> + </internalEndpoint> + <externalReference> + <location>corbaloc:iiop:1.2@rhel4x.prismtech.com:12345/%14%01%0f%00NUP%00%00%00%16%02%00%00%00%01%00%00%00RootPOA%00Host1%00CcmDance2_1/ClientDance1/clientHostInfo</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + + <connection> + <name>server_receptacle2</name> + <internalEndpoint> + <portName>clientHostInfo2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance2</instance> + </internalEndpoint> + <externalReference> + <location>corbaloc:iiop:1.2@rhel4x.prismtech.com:12345/%14%01%0f%00NUP%00%00%00%16%02%00%00%00%01%00%00%00RootPOA%00Host1%00CcmDance2_1/ClientDance1/hostnameResults</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client2_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_consumer_to_emits2</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>client2_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <externalReference> + <location>corbaname::localhost:21869#CDMW__FaultToleranceDomain/ServerDanceFT</location> + <provider>true</provider> + <portName/> + <supportedType/> + </externalReference> + </connection> + + <connection> + <name>testDriver_client2</name> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + + <!-- Artifacts declarations --> + <!-- Artifacts declarations --> + <artifact id="ServerDanceArtifact1"> + <name>ServerDanceArtifact1</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2_with_ft/c++/i686-pc-linux-gnu/libServerCcmDance2WithFTDemo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/EventTypeModule/Command:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createCommandFactory</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ServerDanceArtifact2"> + <name>ServerDanceArtifact2</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2_with_ft/c++/i686-pc-linux-gnu/libServerCcmDance2WithFTDemo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>DL:acme.com/CcmDance2WithFTTest/FooValueType:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createFooValueTypeFactory</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="ClientDanceArtifact"> + <name>ClientDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance2_with_ft/c++/i686-pc-linux-gnu/libClientCcmDance2WithFTDemo.so</location> + <execParameter> + <name>repid</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance2WithFTTest/EventTypeModule/HostnameResult:1.0</string> + </value> + </value> + </execParameter> + <execParameter> + <name>factory_entrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createHostnameResultFactory</string> + </value> + </value> + </execParameter> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/DeploymentPlanDump.mpc b/CIAO/DAnCE/tests/DeploymentPlanDump/DeploymentPlanDump.mpc new file mode 100644 index 00000000000..090283f81ee --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/DeploymentPlanDump.mpc @@ -0,0 +1,9 @@ + +project : dance, taoexe, xerces, aceexe, ciao_config_handlers, dance_logger { + exename = DeploymentPlanDump + + Source_Files { + test.cpp + } +} + diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/NewCcmDance1.cdp b/CIAO/DAnCE/tests/DeploymentPlanDump/NewCcmDance1.cdp new file mode 100644 index 00000000000..be02b05aade --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/NewCcmDance1.cdp @@ -0,0 +1,1063 @@ +<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>CCmDance1</label> + <UUID>CcmDance1</UUID> + + <realizes></realizes> + + <!-- Implementations declarations --> + + <!-- Server Dance implementation--> + <!-- Home implementation --> + <implementation id="ServerDanceHomeImplementation"> + <name>ServerDanceHomeImplementation</name> + <source/> + <artifact>ServerDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ServerDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance1Test/ServerModule/ServerDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance1Test.ServerModule.SessionServerDanceHome_impl</string> + </value> + </value> + </execParameter> + +<!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> +<!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/Example/SaySomethingElse:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createSaySomethingElseFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="ServerDanceImplementation"> + <name>ServerDanceImplementation</name> + <source/> + <artifact>ServerDanceArtifact</artifact> + </implementation> + + + + <!-- Client Dance implementation--> + <!-- Home implementation --> + <implementation id="ClientDanceHomeImplementation"> + <name>ClientDanceHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_ClientDanceHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance1Test/ClientModule/ClientDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance1Test.ClientModule.SessionClientDanceHome_impl</string> + </value> + </value> + </execParameter> + + <!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> + <!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/Example/SaySomethingElse:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createSaySomethingElseFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="ClientDanceImplementation"> + <name>ClientDanceImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + + <!-- Test Driver implementation--> + <!-- Home implementation --> + <implementation id="TestDriverHomeImplementation"> + <name>TestDriverHomeImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CCM_TestDriverHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance1Test/DriverModule/TestDriverHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance1Test.DriverModule.SessionTestDriverHome_impl</string> + </value> + </value> + </execParameter> + + <!-- <execParameter> --> + <!-- VALUETYPE_FACTORY_DEPENDENCIES --> + <!-- <name>cdmw.config.ValuetypeFactoryDependencies</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_struct</kind> + <struct> + <name>ValuetypeFactoryDescription</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ValuetypeFactoryDescription:1.0</typeId> + <member> + <name>repid</name> + <type> + <kind>tk_alias</kind> + <alias> + <name>RepositoryId</name> + <typeId>IDL:omg.org/CORBA/RepositoryId</typeId> + <elementType> + <kind>tk_string</kind> + </elementType> + </alias> + </type> + </member> + <member> + <name>factory_entrypoint</name> + <type> + <kind>tk_string</kind> + </type> + </member> + </struct> + </elementType> + </sequence> + </type> + <value> + <element> + <member> + <name>repid</name> + <value> + <string>IDL:acme.com/Example/SaySomethingElse:1.0</string> + </value> + </member> + <member> + <name>factory_entrypoint</name> + <value> + <string>createSaySomethingElseFactory</string> + </value> + </member> + </element> + </value> + </value> + </execParameter> --> + </implementation> + + <!-- Component implementation --> + <implementation id="TestDriverImplementation"> + <name>TestDriverImplementation</name> + <source/> + <artifact>ClientDanceArtifact</artifact> + </implementation> + + + + + + + + + + + <!-- Instances declarations --> + + <!-- Server Dance instances--> + <instance id="ServerDanceHome"> + <name>ServerDanceHome</name> + <node>MyHost</node> + <!-- hostname --> + <source/> + <implementation>ServerDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceProcess@CcmDance1Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ServerDance"> + <name>ServerDance</name> + <node>MyHost</node> + <source/> + <implementation>ServerDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDanceHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ServerDance</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname1--> + <name>expectedClientHostname1</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedClientHostname2--> + <name>expectedClientHostname2</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x</string> + </value> + </value> + </configProperty> + </instance> + + + + <!-- Client Dance instances--> + <instance id="ClientDanceHome"> + <name>ClientDanceHome</name> + <node>MyHost</node> + <!-- hostname --> + <source/> + <implementation>ClientDanceHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess@CcmDance1Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="ClientDance1"> + <name>ClientDance1</name> + <node>MyHost</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client1</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x</string> + </value> + </value> + </configProperty> + </instance> + + + <instance id="ClientDance2"> + <name>ClientDance2</name> + <node>MyHost</node> + <source/> + <implementation>ClientDanceImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDance2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: configuration--> + <name>configuration</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Client2</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- Attribute: expectedServerHostname--> + <name>expectedServerHostname</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rhel4x</string> + </value> + </value> + </configProperty> + </instance> + + + <!-- Test Driver instances--> + <instance id="TestDriverHome"> + <name>TestDriverHome</name> + <node>MyHost</node> + <!-- hostname --> + <source/> + <implementation>TestDriverHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ClientDanceProcess@CcmDance1Application</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="TestDriver1"> + <name>TestDriver1</name> + <node>MyHost</node> + <source/> + <implementation>TestDriverImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriverHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestDriver1</string> + </value> + </value> + </configProperty> + </instance> + + + + + + <!-- Connections declarations --> + + <connection> + <name>client1_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>serverHostInfo1</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_receptacle</name> + <internalEndpoint> + <portName>serverHostInfo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>serverHostInfo2</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_receptacle1</name> + <internalEndpoint> + <portName>clientHostInfo1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_receptacle2</name> + <internalEndpoint> + <portName>clientHostInfo2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>clientHostInfo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_consumer_to_publishes</name> + <internalEndpoint> + <portName>hostnamePublishes</portName> + <provider>false</provider> + <kind>EventPublisher</kind> + <instance>ServerDance</instance> + </internalEndpoint> + <internalEndpoint> + <portName>hostnameResults</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_consumer_to_emits1</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>commands</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>server_consumer_to_emits2</name> + <internalEndpoint> + <portName>commandEmits</portName> + <provider>false</provider> + <kind>EventEmitter</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>commands</portName> + <provider>true</provider> + <kind>EventConsumer</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client1_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>client2_sayHello</name> + <internalEndpoint> + <portName>sayHello</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_server</name> + <internalEndpoint> + <portName>server</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_client1</name> + <internalEndpoint> + <portName>client1</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance1</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_client2</name> + <internalEndpoint> + <portName>client2</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ClientDance2</instance> + </internalEndpoint> + </connection> + + <connection> + <name>testDriver_sayHello</name> + <internalEndpoint> + <portName>handshake</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance>TestDriver1</instance> + </internalEndpoint> + <internalEndpoint> + <portName>supports</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance>ServerDance</instance> + </internalEndpoint> + </connection> + + + + + + <!-- Artifacts declarations --> + <artifact id="ServerDanceArtifact"> + <name>ServerDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance1/c++/i686-pc-linux-gnu/libServerCcmDance1Demo.so</location> + </artifact> + + <artifact id="ClientDanceArtifact"> + <name>ClientDanceArtifact</name> + <source/> + <node/> + <location>/home/sl/install/ofccm_v0/demos/demo_dance1/c++/i686-pc-linux-gnu/libClientCcmDance1Demo.so</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/DeploymentPlanDump/test.cpp b/CIAO/DAnCE/tests/DeploymentPlanDump/test.cpp new file mode 100644 index 00000000000..3fd058f2131 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanDump/test.cpp @@ -0,0 +1,33 @@ +#include "tools/Config_Handlers/DnC_Dump.h" +#include "tools/Config_Handlers/XML_File_Intf.h" +#include "DAnCE/Logger/Log_Macros.h" + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + if (argc < 1) + { + DANCE_ERROR((LM_ERROR, "[%M] Incorrect count of arguments. Path to deployment plan has not been specified.\n")); + return 1; + } + CIAO::Config_Handlers::XML_File_Intf file (argv[1]); + file.add_search_path ("CIAO_ROOT", "/docs/schema/"); + file.add_search_path ("TAO_ROOT", "/docs/schema/"); + Deployment::DeploymentPlan * plan = file.release_plan(); + Deployment::DnC_Dump::dump (*plan); + delete plan; + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("DAnCE_DeploymentPlanDump::main\n"); + return -1; + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] Unexpected exception\n")); + return 1; + } + + return 0; +} diff --git a/CIAO/DAnCE/tests/DeploymentPlanTestReferences/DeploymentPlanTestReferences.mpc b/CIAO/DAnCE/tests/DeploymentPlanTestReferences/DeploymentPlanTestReferences.mpc new file mode 100644 index 00000000000..86a4bb93ff0 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanTestReferences/DeploymentPlanTestReferences.mpc @@ -0,0 +1,9 @@ + +project : dance, taolib, tao_output, xerces, ciao_config_handlers, dance_logger { + exename = DeploymentPlanTestReferences + + Source_Files { + test.cpp + } +} + diff --git a/CIAO/DAnCE/tests/DeploymentPlanTestReferences/test.cpp b/CIAO/DAnCE/tests/DeploymentPlanTestReferences/test.cpp new file mode 100644 index 00000000000..0f89c40ea72 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentPlanTestReferences/test.cpp @@ -0,0 +1,51 @@ +#include "ace/Auto_Ptr.h" +#include "tools/Config_Handlers/DnC_Dump.h" +#include "tools/Config_Handlers/XML_File_Intf.h" +#include "DAnCE/Logger/Log_Macros.h" + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + if (argc < 1) + { + DANCE_ERROR((LM_ERROR, "[%M] Incorrect count of arguments. Path to deployment plan has not been specified.\n")); + return 1; + } + //parsing plan + CIAO::Config_Handlers::XML_File_Intf file (argv[1]); + file.add_search_path ("CIAO_ROOT", "/docs/schema/"); + file.add_search_path ("TAO_ROOT", "/docs/schema/"); + auto_ptr<Deployment::DeploymentPlan> plan (file.release_plan()); + + //check instance references to corresponding implementations + for (unsigned int i = 0; i < plan->instance.length(); i++) + { + if (plan->instance[i].implementationRef > plan->implementation.length() - 1) + { + DANCE_ERROR((LM_ERROR, "[%M] incorrect implementationRef in instance %s.\n", plan->instance[i].name.in())); + return 1; + } + } + + //check artifact reference for implementations of Home objects + for (unsigned int i = 0; i < plan->implementation.length(); i++) + { + if (plan->implementation[i].artifactRef.length() > 0) + { + if (plan->implementation[i].artifactRef[0] > plan->artifact.length() - 1) + { + DANCE_ERROR((LM_ERROR, "[%M] incorrect artifactRef in the implementation %s.\n", plan->implementation[i].name.in())); + return 1; + } + } + } + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] Unexpected exception")); + return 1; + } + + return 0; +} diff --git a/CIAO/DAnCE/tests/DeploymentTest1/DeploymentTest1.mpc b/CIAO/DAnCE/tests/DeploymentTest1/DeploymentTest1.mpc new file mode 100644 index 00000000000..efcdaec3203 --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentTest1/DeploymentTest1.mpc @@ -0,0 +1,8 @@ +project : dance, taolib, tao_output, xerces, ciao_config_handlers, dance_logger { + exename = DeploymentTest1 + + Source_Files { + test.cpp + } +} + diff --git a/CIAO/DAnCE/tests/DeploymentTest1/test.cpp b/CIAO/DAnCE/tests/DeploymentTest1/test.cpp new file mode 100644 index 00000000000..aaccef082fc --- /dev/null +++ b/CIAO/DAnCE/tests/DeploymentTest1/test.cpp @@ -0,0 +1,66 @@ +#include "ace/Auto_Ptr.h" +#include "DAnCE/Deployment/Deployment_DeploymentPlanC.h" +#include "DAnCE/Deployment/Deployment_ExecutionManagerC.h" +#include "DAnCE/Deployment/Deployment_DomainApplicationManagerC.h" +#include "DAnCE/Deployment/Deployment_DomainApplicationC.h" +#include "DAnCE/Deployment/Deployment_NodeManagerC.h" +#include "DAnCE/Deployment/Deployment_NodeApplicationManagerC.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "tools/Config_Handlers/DnC_Dump.h" +#include "tools/Config_Handlers/XML_File_Intf.h" + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + CIAO::Config_Handlers::XML_File_Intf file (argv[1]); + file.add_search_path ("CIAO_ROOT", "/docs/schema/"); + file.add_search_path ("TAO_ROOT", "/docs/schema/"); + auto_ptr<Deployment::DeploymentPlan> pplan (file.release_plan()); + + DANCE_DEBUG((LM_DEBUG, "[%M] Test starts.\n")); + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + const char * ior = "file://execution_manager.ior"; + + CORBA::Object_var obj = orb->string_to_object (ior); + if (CORBA::is_nil (obj. in())) + { + throw 0; + } + + Deployment::ExecutionManager_var em = Deployment::ExecutionManager::_narrow (obj); + if (CORBA::is_nil (em.in ())) + { + throw 0; + } + DANCE_DEBUG((LM_DEBUG, "[%M] preparePlan\n")); + Deployment::DomainApplicationManager_var dam = em->preparePlan (*pplan, Deployment::ResourceCommitmentManager::_nil()); + DANCE_DEBUG((LM_DEBUG, "[%M] startLaunch\n")); + //call startLaunch + Deployment::Properties dp; + Deployment::Connections_var dc; + Deployment::Application_var na = dam->startLaunch (dp, dc.out()); + Deployment::DomainApplication_var da = Deployment::DomainApplication::_narrow (na); + if (CORBA::is_nil (da.in ())) + { + DANCE_DEBUG((LM_DEBUG, "[%M] narrow fails\n")); + } + DANCE_DEBUG((LM_DEBUG, "[%M] finishLaunch\n")); + da->finishLaunch (dc.in(), true); + DANCE_DEBUG((LM_DEBUG, "[%M] Test succeded!\n")); + + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception ("DeploymentTest1::main\t\n"); + DANCE_ERROR((LM_ERROR, "[%M] Uncaught CORBA exception\n")); + return 1; + } + catch (...) + { + return 1; + } + + return 0; +} diff --git a/CIAO/DAnCE/tests/MocksTest/MockObjectHome.cpp b/CIAO/DAnCE/tests/MocksTest/MockObjectHome.cpp new file mode 100644 index 00000000000..35a522bb9f6 --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/MockObjectHome.cpp @@ -0,0 +1,18 @@ +#include "MockObjectHome.h" + +::Components::CCMObject_ptr +MockObjectHome::create_component_with_config_values ( + const ::Components::ConfigValues & config +) + { + return MockHome_Impl::create_component_with_config_values (config); + } + +extern "C" MocksTest_Export MockHome_Impl *create_MockHome (void); + +MockHome_Impl*create_MockHome (void) + { + MockHome_Impl* home = 0; + ACE_NEW_RETURN (home, MockObjectHome (), 0); + return home; + } diff --git a/CIAO/DAnCE/tests/MocksTest/MockObjectHome.h b/CIAO/DAnCE/tests/MocksTest/MockObjectHome.h new file mode 100644 index 00000000000..056e90a1244 --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/MockObjectHome.h @@ -0,0 +1,23 @@ +#ifndef MOCKOBJECTHOME_H_ +#define MOCKOBJECTHOME_H_ + +#include "MocksTest_Export.h" +#include "Mocks/MockHome_Impl.h" + +class MocksTest_Export MockObjectHome : public MockHome_Impl + { + public: + MockObjectHome() + {}; + virtual ~MockObjectHome() + {}; + + virtual ::Components::CCMObject_ptr create_component_with_config_values ( + const ::Components::ConfigValues & config + ); + + protected: + private: + }; + +#endif /*MOCKOBJECTHOME_H_*/ diff --git a/CIAO/DAnCE/tests/MocksTest/MockTest.cdp b/CIAO/DAnCE/tests/MocksTest/MockTest.cdp new file mode 100644 index 00000000000..f3478812063 --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/MockTest.cdp @@ -0,0 +1,196 @@ +<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>MockTest</label> + <UUID>MockTest</UUID> + + <realizes></realizes> + + <!-- Implementations declarations --> + + <!-- Mock object implementation--> + <!-- Home implementation --> + <implementation id="MockObjectHomeImplementation"> + <name>MockObjectHomeImplementation</name> + <source/> + <artifact>MockObjectArtifact</artifact> + + <execParameter> + <!-- entrypoint as exec parameter (see §10.6.1) --> + <name>home factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_MockHome</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- COMPONENT_KIND --> + <name>cdmw.config.ComponentKind</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ComponentKindValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ComponentKindValue:1.0</typeId> + <member>SERVICE</member> + <member>SESSION</member> + <member>PROCESS</member> + <member>ENTITY</member> + <member>UNCLASSIFIED</member> + </enum> + </type> + <value> + <enum>SESSION</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- SERVANT_LIFETIME --> + <name>cdmw.config.ServantLifeTime</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ServantLifeTimeValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ServantLifetimeValue:1.0</typeId> + <member>COMPONENT_LIFETIME</member> + <member>METHOD_LIFETIME</member> + <member>TRANSACTION_LIFETIME</member> + <member>CONTAINER_LIFETIME</member> + </enum> + </type> + <value> + <enum>CONTAINER_LIFETIME</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- THREADING_POLICY --> + <name>cdmw.config.ThreadingPolicy</name> + <value> + <type> + <kind>tk_enum</kind> + <enum> + <name>ThreadingPolicyValue</name> + <typeId>IDL:thalesgroup.com/CdmwDeployment/ThreadingPolicyValue:1.0</typeId> + <member>SERIALIZE</member> + <member>MULTITHREAD</member> + </enum> + </type> + <value> + <enum>MULTITHREAD</enum> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_REPOSITORY_ID --> + <name>cdmw.config.HomeRepositoryId</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>IDL:acme.com/CcmDance1Test/ServerModule/ServerDanceHome:1.0</string> + </value> + </value> + </execParameter> + + <execParameter> + <!-- HOME_SERVANT_CLASSNAME --> + <name>cdmw.config.HomeServantClassName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Cdmw.CCM.CIF.CdmwCcmDance1Test.ServerModule.SessionServerDanceHome_impl</string> + </value> + </value> + </execParameter> + </implementation> + + <!-- Component implementation --> + <implementation id="MockObjectImplementation"> + <name>MockObjectImplementation</name> + <source/> + <artifact>MockObjectArtifact</artifact> + </implementation> + + + + + <!-- Instances declarations --> + + <!-- MockObjectHome instances--> + <instance id="MockObjectHome"> + <name>MockObjectHome</name> + <node>MyHost</node> + <!-- hostname --> + <source/> + <implementation>MockObjectHomeImplementation</implementation> + <configProperty> + <!-- PROCESS_DESTINATION --> + <name>cdmw.config.ProcessDestination</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>MockTest</string> + </value> + </value> + </configProperty> + </instance> + + <instance id="MockObject"> + <name>MockObject</name> + <node>MyHost</node> + <source/> + <implementation>MockObjectImplementation</implementation> + + <configProperty> + <!-- HOME --> + <name>cdmw.component_home</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>MockObjectHome</string> + </value> + </value> + </configProperty> + + <configProperty> + <!-- COMPONENT_NAME --> + <name>cdmw.config.ComponentName</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>MockObject</string> + </value> + </value> + </configProperty> + </instance> + + <!-- Artifacts declarations --> + <artifact id="MockObjectArtifact"> + <name>MockObjectArtifact</name> + <source/> + <node/> + <location>./libMockObject.so</location> + </artifact> + + </Deployment:DeploymentPlan> diff --git a/CIAO/DAnCE/tests/MocksTest/MockTest.mpc b/CIAO/DAnCE/tests/MocksTest/MockTest.mpc new file mode 100644 index 00000000000..2de6e7bf904 --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/MockTest.mpc @@ -0,0 +1,28 @@ +// -*- MPC -*- +// $Id$ + +project(*MockTest): dance, taoserver, naming, dance_mocks { + requires += ofccm + exename = MockTest + after += MockObject + + Source_Files { + MocksTest.cpp + } + +} + +project(*MockObject): dance_mocks{ + requires += ofccm + sharedname = MockObject + dynamicflags = MOCKTEST_BUILD_DLL + + Source_Files { + MockObjectHome.cpp + } + + Header_Files { + MockObjectHome.h + } +} + diff --git a/CIAO/DAnCE/tests/MocksTest/MocksTest.cpp b/CIAO/DAnCE/tests/MocksTest/MocksTest.cpp new file mode 100644 index 00000000000..dbe6117c2be --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/MocksTest.cpp @@ -0,0 +1,36 @@ +#include "orbsvcs/orbsvcs/CosNamingC.h" +#include "Mocks/ComponentServer_Impl.h" +#include "tao/ORB.h" + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) + { + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in ()); + PortableServer::POAManager_var poa_manager = poa->the_POAManager (); + poa_manager->activate (); + + obj = orb->resolve_initial_references ("NameService"); + CosNaming::NamingContext_var naming = CosNaming::NamingContext::_narrow (obj.in ()); + + ComponentServer_Impl* comp_server = 0; + + ACE_NEW_THROW_EX (comp_server, + ComponentServer_Impl (orb.in (), poa.in ()), + CORBA::NO_MEMORY()); + + PortableServer::ObjectId_var oid = poa->activate_object (comp_server); + obj = poa->id_to_reference (oid.in ()); + CdmwCcmComponentServer::ComponentServer_var server = CdmwCcmComponentServer::ComponentServer::_narrow (obj.in ()); + + CosNaming::Name name(1); + name.length(1); + name[0].id = CORBA::string_dup("MockTest"); + name[0].kind = CORBA::string_dup("ComponentServer"); + naming->bind (name, server.in ()); + + orb->run (); + return 0; + } diff --git a/CIAO/DAnCE/tests/MocksTest/MocksTest_Export.h b/CIAO/DAnCE/tests/MocksTest/MocksTest_Export.h new file mode 100644 index 00000000000..984e865bf1f --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/MocksTest_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl MocksTest +// ------------------------------ +#ifndef MOCKSTEST_EXPORT_H +#define MOCKSTEST_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (MOCKSTEST_HAS_DLL) +# define MOCKSTEST_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && MOCKSTEST_HAS_DLL */ + +#if !defined (MOCKSTEST_HAS_DLL) +# define MOCKSTEST_HAS_DLL 1 +#endif /* ! MOCKSTEST_HAS_DLL */ + +#if defined (MOCKSTEST_HAS_DLL) && (MOCKSTEST_HAS_DLL == 1) +# if defined (MOCKSTEST_BUILD_DLL) +# define MocksTest_Export ACE_Proper_Export_Flag +# define MOCKSTEST_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define MOCKSTEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* MOCKSTEST_BUILD_DLL */ +# define MocksTest_Export ACE_Proper_Import_Flag +# define MOCKSTEST_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define MOCKSTEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* MOCKSTEST_BUILD_DLL */ +#else /* MOCKSTEST_HAS_DLL == 1 */ +# define MocksTest_Export +# define MOCKSTEST_SINGLETON_DECLARATION(T) +# define MOCKSTEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* MOCKSTEST_HAS_DLL == 1 */ + +// Set MOCKSTEST_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (MOCKSTEST_NTRACE) +# if (ACE_NTRACE == 1) +# define MOCKSTEST_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define MOCKSTEST_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !MOCKSTEST_NTRACE */ + +#if (MOCKSTEST_NTRACE == 1) +# define MOCKSTEST_TRACE(X) +#else /* (MOCKSTEST_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define MOCKSTEST_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (MOCKSTEST_NTRACE == 1) */ + +#endif /* MOCKSTEST_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/tests/MocksTest/plCommand.In b/CIAO/DAnCE/tests/MocksTest/plCommand.In new file mode 100644 index 00000000000..ca7b0873bab --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/plCommand.In @@ -0,0 +1,5 @@ +I +am +the +chatter +quit diff --git a/CIAO/DAnCE/tests/MocksTest/run_test.pl b/CIAO/DAnCE/tests/MocksTest/run_test.pl new file mode 100755 index 00000000000..5ecaae833c6 --- /dev/null +++ b/CIAO/DAnCE/tests/MocksTest/run_test.pl @@ -0,0 +1,97 @@ +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::Run_Test; + +#delete IOR files +if (-e em.ior) { + unlink "em.ior" +} +if (-e ns.ior) { + unlink "ns.ior" +} + +$ns_status = 0; +$mt_status = 0; +$pl_status = 0; +$em_status = 0; + +if (PerlACE::is_vxworks_test()) { + $ns = new PerlACE::ProcessVX ("$ENV{'ACE_ROOT'}/TAO/orbsvcs/Naming_Service/Naming_Service", "-o ns.ior"); +} +else { + $ns = new PerlACE::Process ("$ENV{'ACE_ROOT'}/TAO/orbsvcs/Naming_Service/Naming_Service", "-o ns.ior"); +} + +$ns_status = $ns->Spawn(); +sleep 10; + +#read NameService IOR +$data_file = "ns.ior"; +open(DAT, $data_file) || die("ERROR: Could not open file!"); +$ior = <DAT>; +close(DAT); + +if (PerlACE::is_vxworks_test()) { + $mt = new PerlACE::ProcessVX ("./MockTest", "-ORBInitRef NameService=file://ns.ior"); +} +else { + $mt = new PerlACE::Process ("./MockTest", "-ORBInitRef NameService=file://ns.ior"); +} + +$mt_status = $mt->Spawn(); +sleep 10; + +if (PerlACE::is_vxworks_test()) { + $em = new PerlACE::ProcessVX ("$ENV{'ACE_ROOT'}/bin/dance", "--log-level 1 -eem.ior --node-mgr MyHost -ORBListenEndpoints iiop://localhost:12345 -ORBInitRef ProcessDestinationNC=file://ns.ior"); + $pl = new PerlACE::ProcessVX ("$ENV{'ACE_ROOT'}/bin/dance", "--log-level 1 -x MockTest.cdp -k file://em.ior"); +} +else { + $em = new PerlACE::Process ("$ENV{'ACE_ROOT'}/bin/dance", "--log-level 1 -eem.ior --node-mgr MyHost -ORBListenEndpoints iiop://localhost:12345 -ORBInitRef ProcessDestinationNC=file://ns.ior"); +#open (OLD_STDIN, "<STDIN"); +#open (STDIN, "") + $pl = new PerlACE::Process ("$ENV{'ACE_ROOT'}/bin/dance", "--log-level 1 -x MockTest.cdp -k file://em.ior"); +} + +$em_status = $em->Spawn(); +sleep 30; +#print STDIN "c\n"; +#open (OLD_STDIN, "<STDIN"); +#open (kid, "|-"); +open (STDIN, "<./plCommand.In"); +$pl_status = $pl->Spawn(); +sleep 10; +#print kid "c\n"; + +#print STDIN "c\n"; +sleep 10; + + +$pl_status = $pl->Kill(); +close (STDIN); +$em_status = $em->Kill(); + +$ns_status = $ns->Kill(); + +$mt_status = $mt->Kill(); + +#delete IOR files +if (-e em.ior) { + unlink "em.ior" +} +if (-e ns.ior) { + unlink "ns.ior" +} + +if ($pl_status != 0) +{ + print "\n ERROR: test returned $pl_status \n"; +} + +exit $pl_status; + diff --git a/CIAO/DAnCE/tests/NameServiceTest/Dummy.idl b/CIAO/DAnCE/tests/NameServiceTest/Dummy.idl new file mode 100644 index 00000000000..1f0edee59cd --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/Dummy.idl @@ -0,0 +1,14 @@ +// $Id$ + +#ifndef DUMMY_IDL +#define DUMMY_IDL + +module NameServiceTest +{ + interface Dummy { + string sayHello(); + }; +}; + +#endif /* DUMMY_IDL */ + diff --git a/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.cpp b/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.cpp new file mode 100644 index 00000000000..7066f38cbc4 --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.cpp @@ -0,0 +1,13 @@ +#include "DummyImpl.h" + +namespace NameServiceTest + { + + char * DummyImpl::sayHello ( + ) + { + return CORBA::string_dup (this->helloSentence); + } + + } // namespace ObjectLocatorTest + diff --git a/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.h b/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.h new file mode 100644 index 00000000000..cca7e1de8f9 --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.h @@ -0,0 +1,24 @@ +#ifndef DUMMYIMPL_H_ +#define DUMMYIMPL_H_ + +#include "DummyS.h" + +namespace NameServiceTest + { + + class DummyImpl + : public virtual POA_NameServiceTest::Dummy + { + public: + DummyImpl() : helloSentence ("A dummy hello sentence.") {}; + + virtual char * sayHello ( + ); + + private: + const char * helloSentence; + }; + + } // namespace POA_ObjectLocatorTest + +#endif /*DUMMYIMPL_H_*/ diff --git a/CIAO/DAnCE/tests/NameServiceTest/NameServiceTest.mpc b/CIAO/DAnCE/tests/NameServiceTest/NameServiceTest.mpc new file mode 100644 index 00000000000..091c461d669 --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/NameServiceTest.mpc @@ -0,0 +1,30 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Dummy.idl + } + custom_only = 1 +} + +project (*NameServiceTestServer): dance, taoserver, iortable, naming_serv, dance_logger { + after += *idl + IDL_Files { + } + Source_Files { + srv_main.cpp + DummyC.cpp + DummyS.cpp + DummyImpl.cpp + } +} + +project (NameServiceTestClient): dance, taoclient, naming, dance_logger { + after += *idl + IDL_Files { + } + Source_Files { + clt_main.cpp + DummyC.cpp + } +} diff --git a/CIAO/DAnCE/tests/NameServiceTest/RegistrationPath.h b/CIAO/DAnCE/tests/NameServiceTest/RegistrationPath.h new file mode 100644 index 00000000000..6ecf9197ad3 --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/RegistrationPath.h @@ -0,0 +1,8 @@ +#ifndef REGISTRATIONPATH_H_ +#define REGISTRATIONPATH_H_ + +const char * app_name = "app1"; +const char * inst_name = "inst1"; +const char * port_name = "port1"; + +#endif /*REGISTRATIONPATH_H_*/ diff --git a/CIAO/DAnCE/tests/NameServiceTest/clt_main.cpp b/CIAO/DAnCE/tests/NameServiceTest/clt_main.cpp new file mode 100644 index 00000000000..f25da11c9bd --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/clt_main.cpp @@ -0,0 +1,85 @@ + +#include "ace/String_Base.h" +#include <orbsvcs/orbsvcs/CosNamingC.h> +#include "DAnCE/Logger/Log_Macros.h" +#include "RegistrationPath.h" +#include "DummyC.h" + +using namespace NameServiceTest; + + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + CORBA::Object_var naming_obj = orb->resolve_initial_references ("NameService"); +// CosNaming::NamingContext_var naming = CosNaming::NamingContext::_narrow(naming_obj.in()); +// CosNaming::Name name(1); +// +// name.length(1); +// +// name[0].id = CORBA::string_dup("Dummy"); +// name[0].kind = CORBA::string_dup(""); +// +// CORBA::Object_ptr res_obj = naming->resolve(name); +// if ( CORBA::is_nil(res_obj) ) +// { +// DANCE_ERROR((LM_ERROR, "[%M] Failed to resolve object. The test failed.\n")); +// return 1; +// } +// DANCE_DEBUG((LM_DEBUG, "[%M] resolve object : ok.\n")); +// +// Dummy_var res_dummy_obj = Dummy::_narrow(res_obj); +// if ( CORBA::is_nil(res_dummy_obj) ) +// { +// DANCE_ERROR((LM_ERROR, "[%M] Failed to narrow the resolved object to custom type. The test failed.\n")); +// return 1; +// } +// DANCE_DEBUG((LM_DEBUG, "[%M] resolved object -> dummy : ok.\n")); +// +// DANCE_DEBUG((LM_DEBUG, "[%M] Dummy object returned : %s.", res_dummy_obj->sayHello())); +// DANCE_DEBUG((LM_DEBUG, "[%M] The test succeeded.")); + //glasgow.headquarters.eclipsesp.com:12345 + ACE_CString url = "corbaname:rir:#app1.DeploymentPlan/Dummy"; +// url += app_name; +// url += "/"; +// url += inst_name; +// url += "/"; +// url += port_name; + DANCE_DEBUG((LM_DEBUG, "[%M] URL : %s\n", url.c_str())); + + CORBA::Object_var obj = orb->string_to_object (url.c_str()); + if (CORBA::is_nil (obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] Failed to convert url to object. The test failed.\n")); + return 1; + } + DANCE_DEBUG((LM_DEBUG, "[%M] URL -> object : ok.\n")); + + Dummy_var dummy_obj = Dummy::_narrow (obj); + if (CORBA::is_nil (dummy_obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] Failed to narrow the object to custom type. The test failed.\n")); + return 1; + } + DANCE_DEBUG((LM_DEBUG, "[%M] object -> dummy : ok.\n")); + + DANCE_DEBUG((LM_DEBUG, "[%M] Dummy object returned : %C.", dummy_obj->sayHello())); + DANCE_DEBUG((LM_DEBUG, "[%M] The test succeeded.")); + return 0; + } + catch (const CORBA::Exception & e) + { + DANCE_ERROR((LM_ERROR, "[%M] A CORBA exception \"%s\" (%s) was thrown. The test failed." + , e._name(), e._info().c_str())); + return 1; + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] An exception was thrown. The test failed.")); + return 1; + } +} + diff --git a/CIAO/DAnCE/tests/NameServiceTest/run_test.pl b/CIAO/DAnCE/tests/NameServiceTest/run_test.pl new file mode 100755 index 00000000000..719974e5c50 --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/run_test.pl @@ -0,0 +1,73 @@ +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; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/CIAO/DAnCE/tests/NameServiceTest/srv_main.cpp b/CIAO/DAnCE/tests/NameServiceTest/srv_main.cpp new file mode 100644 index 00000000000..74794ce420b --- /dev/null +++ b/CIAO/DAnCE/tests/NameServiceTest/srv_main.cpp @@ -0,0 +1,71 @@ +#include "ace/OS_NS_stdio.h" +#include <orbsvcs/orbsvcs/CosNamingC.h> +#include <orbsvcs/orbsvcs/Naming/Naming_Loader.h> +#include "DAnCE/Logger/Log_Macros.h" + +#include "DummyC.h" +#include "DummyImpl.h" +#include "RegistrationPath.h" + +using namespace NameServiceTest; + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + int argcm = argc + 2; + char ** argvm = new char* [argcm+1]; + for (int i = 0; i < argc; ++i) + { + argvm[i] = argv[i]; + } + char buf1[32]; + ACE_OS::sprintf (buf1, "-ORBListenEndpoints"); + argvm[argcm-2] = buf1; + char buf2[32]; + ACE_OS::sprintf (buf2, "iiop://:12345"); + argvm[argcm-1] = buf2; + argvm[argcm] = 0; + + CORBA::ORB_var orb = CORBA::ORB_init (argcm, argvm); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager(); + poa_manager->activate(); + + DummyImpl servant; + + PortableServer::ObjectId_var id = root_poa->activate_object (&servant); + + Dummy_var dummy_obj = Dummy::_narrow (root_poa->id_to_reference (id));//servant._this(); + + TAO_Naming_Loader loader; + + CORBA::Object_var obj_tmp = loader.create_object (orb.in(), argcm, argvm); + CORBA::Object_var naming_obj = orb->resolve_initial_references ("NameService"); + CosNaming::NamingContext_var naming = CosNaming::NamingContext::_narrow (naming_obj.in()); + + CosNaming::Name name (1); + + name.length (1); + + name[0].id = CORBA::string_dup (app_name); + name[0].kind = CORBA::string_dup ("DeploymentPlan"); + + CosNaming::NamingContext_var naming_app = naming->bind_new_context (name); + + name[0].id = CORBA::string_dup ("Dummy"); + name[0].kind = CORBA::string_dup (""); + naming_app->bind (name, dummy_obj.in()); + + orb->run(); + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] An error has occured.")); + } + return 0; +} + diff --git a/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/NodeApplicationManager-NodeApplication.mpc b/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/NodeApplicationManager-NodeApplication.mpc new file mode 100644 index 00000000000..5f82007e24e --- /dev/null +++ b/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/NodeApplicationManager-NodeApplication.mpc @@ -0,0 +1,8 @@ + +project : dance, dance_deployment_svnt, dance_deployment_stub, dance_node_application_manager, dance_node_application, dance_logger { + exename = NodeApplicationManagerNodeApplicationTest + + Source_Files { + test.cpp + } +} diff --git a/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/test.cpp b/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/test.cpp new file mode 100644 index 00000000000..727f691b970 --- /dev/null +++ b/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/test.cpp @@ -0,0 +1,47 @@ +#include "DAnCE/Deployment/Deployment_NodeManagerC.h" +#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" +#include "DAnCE/Logger/Log_Macros.h" + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + const char * ior = "file://node_manager.ior"; + CORBA::Object_var obj = orb->string_to_object (ior); + if (CORBA::is_nil (obj)) + { + throw 0; + } + + Deployment::NodeManager_var nm = Deployment::NodeManager::_narrow (obj); + if (CORBA::is_nil (nm)) + { + throw 0; + } + + //get NodeApplicationManager + Deployment::DeploymentPlan plan; + Deployment::NodeApplicationManager_var nam; + nam = nm->preparePlan (plan, Deployment::ResourceCommitmentManager::_nil()); + + //call startLaunch + Deployment::Properties dp; + Deployment::Connections_var dc; + Deployment::Application_ptr app = nam->startLaunch (dp, dc.out()); + Deployment::NodeApplication_var na = Deployment::NodeApplication::_narrow (app); + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception ("DAnCE_NodeManager::main\t\n"); + DANCE_ERROR((LM_ERROR, "[%M] Uncaught CORBA exception\n")); + return 1; + } + catch (...) + { + return 1; + } + + return 0; +} diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc b/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc deleted file mode 100644 index 2cc04a9a18a..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc +++ /dev/null @@ -1,163 +0,0 @@ -// $Id$ - -project(NodeAppTest_RoundTrip_stub): ciao_client_dnc { - sharedname = NodeAppTest_RoundTrip_stub - after += CIAO_DnC_Server - - idlflags += -Wb,stub_export_macro=NODEAPPTEST_ROUNDTRIP_STUB_Export \ - -Wb,stub_export_include=RoundTrip_stub_export.h \ - -Wb,skel_export_macro=NODEAPPTEST_ROUNDTRIP_SVNT_Export \ - -Wb,skel_export_include=RoundTrip_svnt_export.h - dynamicflags = NODEAPPTEST_ROUNDTRIP_STUB_BUILD_DLL - - IDL_Files { - NodeAppTest_RoundTrip.idl - } - - Source_Files { - NodeAppTest_RoundTripC.cpp - } - - Header_Files { - NodeAppTest_RoundTripC.h - } - - Inline_Files { - NodeAppTest_RoundTripC.inl - } -} - -project(NodeAppTest_RoundTrip_svnt) : ciao_servant_dnc { - after += NodeAppTest_RoundTrip_stub - sharedname = NodeAppTest_RoundTrip_svnt - - libs += NodeAppTest_RoundTrip_stub - idlflags += -Wb,export_macro=NODEAPPTEST_ROUNDTRIP_SVNT_Export \ - -Wb,export_include=RoundTrip_svnt_export.h - dynamicflags = NODEAPPTEST_ROUNDTRIP_SVNT_BUILD_DLL - - CIDL_Files { - NodeAppTest_RoundTrip.cidl - } - - IDL_Files { - NodeAppTest_RoundTripE.idl - } - - Source_Files { - NodeAppTest_RoundTripEC.cpp - NodeAppTest_RoundTripS.cpp - NodeAppTest_RoundTrip_svnt.cpp - } - - Header_Files { - NodeAppTest_RoundTripEC.h - NodeAppTest_RoundTripS.h - NodeAppTest_RoundTrip_svnt.h - } - - Inline_Files { - NodeAppTest_RoundTripEC.inl - NodeAppTest_RoundTripS.inl - } -} - -project(NodeAppTest_RoundTrip_exec) : ciao_component_dnc, ciao_events_dnc, ciao_server_dnc { - after += NodeAppTest_RoundTrip_stub NodeAppTest_RoundTrip_svnt - - sharedname = NodeAppTest_RoundTrip_exec - libs += NodeAppTest_RoundTrip_stub NodeAppTest_RoundTrip_svnt - idlflags += -Wb,export_macro=NODEAPPTEST_ROUNDTRIP_EXEC_Export \ - -Wb,export_include=RoundTrip_exec_export.h - dynamicflags = NODEAPPTEST_ROUNDTRIP_EXEC_BUILD_DLL - - IDL_Files { - } - - Source_Files { - RoundTrip_exec.cpp - } - - Header_Files { - RoundTrip_exec.h - } - - Inline_Files { - } -} - -project (NodeAppTest_client_simple) : ciao_deployment_stub { - after += NodeAppTest_RoundTrip_stub - libs += NodeAppTest_RoundTrip_stub - exename += client_simple - - IDL_Files { - } - - Source_Files { - NodeApp_test_client_simple.cpp - } - - Header_Files { - } - - Inline_Files { - } -} - -project (NodeAppTest_client) : ciao_deployment_stub { - after += NodeAppTest_RoundTrip_stub - libs += NodeAppTest_RoundTrip_stub - exename += client - - IDL_Files { - } - - Source_Files { - NodeApp_test_client.cpp - } - - Header_Files { - } - - Inline_Files { - } -} - -project (NodeAppTest_client_ex) : ciao_deployment_stub { - after += NodeAppTest_RoundTrip_stub - libs += NodeAppTest_RoundTrip_stub - exename += client_ex - - IDL_Files { - } - - Source_Files { - NodeApp_test_client_ex.cpp - } - - Header_Files { - } - - Inline_Files { - } -} - -project (NodeAppTest_client_dynamic) : ciao_deployment_stub { - after += NodeAppTest_RoundTrip_stub - libs += NodeAppTest_RoundTrip_stub - exename += client_dynamic - - IDL_Files { - } - - Source_Files { - NodeApp_test_client_dynamic.cpp - } - - Header_Files { - } - - Inline_Files { - } -} diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest_RoundTrip.cidl b/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest_RoundTrip.cidl deleted file mode 100644 index 3063a673d5a..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest_RoundTrip.cidl +++ /dev/null @@ -1,19 +0,0 @@ -// $Id$ - -#ifndef NODEAPPTEST_ROUNDTRIP_CIDL -#define NODEAPPTEST_ROUNDTRIP_CIDL - -#include "NodeAppTest_RoundTrip.idl" - -composition session RoundTrip_Impl -{ - - home executor RoundTripHome_Exec - { - implements NodeAppTest::NodeAppTest_RoundTripHome; - manages RoundTrip_Exec; - }; - -}; - -#endif /* NODEAPPTEST_ROUNDTRIP_CIDL */ diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest_RoundTrip.idl b/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest_RoundTrip.idl deleted file mode 100644 index ca7397916b8..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest_RoundTrip.idl +++ /dev/null @@ -1,34 +0,0 @@ -// $Id$ - -//============================================================================= -/** - * @file NodeAppTest_RoundTrip.idl - * - * Definition of the Component that provides the LatencyTest interface - * - */ -//============================================================================= -#ifndef NODEAPP_ROUNDTRIP_IDL -#define NODEAPP_ROUNDTRIP_IDL - -#include <Components.idl> - -module NodeAppTest -{ - interface LatencyTest - { - long cube_long (in long param); - }; - - component NodeAppTest_RoundTrip supports LatencyTest - { - provides LatencyTest facet_1; - provides LatencyTest facet_2; - }; - - home NodeAppTest_RoundTripHome manages NodeAppTest_RoundTrip - { - }; - -}; -#endif /* NODEAPP_ROUNDTRIP_IDL */ diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp b/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp deleted file mode 100644 index 08950a08b9b..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp +++ /dev/null @@ -1,254 +0,0 @@ -// $Id$ - -// This test tries to install a set of components in 2 different containers, which -// is hosted in the same NodeApplication. - -#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" -#include "Client_init.h" -#include "NodeAppTest_RoundTripC.h" -#include "ace/Get_Opt.h" -#include <sstream> -#include <vector> -#include <stdlib.h> -#include "assert.h" - -const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); -int comp_number = 4; -int counter = 0; - -int parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:n:")); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'n': - comp_number = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s \n" - "-k <NodeApplication ior> \n" - "-n <The number of component instances> \n" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) -{ - std::vector<NodeAppTest::NodeAppTest_RoundTrip_var> comp_list; - //std::vector<NodeAppTest::NodeAppTest_RoundTrip_var>::const_iterator iter; - - try - { - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::ULong comp_num (comp_number); - ACE_DEBUG ((LM_DEBUG, "CompNum: %d\n",comp_num)); - - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv); - - CIAO::Client_init (orb.in ()); - - CORBA::Object_var tmp = - orb->string_to_object(ior); - - Deployment::NodeApplication_var node_app = - Deployment::NodeApplication::_narrow (tmp.in ()); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil nodeapplication reference <%s>\n", ior), - 1); - } - - // This is what we will send out of the ContainerImplmentationInfo for the - // first container - - Deployment::ContainerImplementationInfo container_info_1; - CORBA::ULong length_1 = comp_num/2; - container_info_1.impl_infos.length (CORBA::ULong (length_1)); - - CORBA::ULong i; - for (i = 0; i < length_1; ++i) - { - Deployment::ComponentImplementationInfo info; - - std::stringstream tmp; - tmp << "NodeAppTest_RoundTrip:" << counter; - counter = counter + 1; - - // Add the names and entry points of each of the DLLs - info.component_instance_name = - CORBA::string_dup (tmp.str ().c_str ()); - info.executor_dll = CORBA::string_dup ("NodeAppTest_RoundTrip_exec"); - info.executor_entrypt = - CORBA::string_dup ("createRoundTripHome_Impl"); - info.servant_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_svnt"); - info.servant_entrypt = - CORBA::string_dup ( - "create_NodeAppTest_NodeAppTest_RoundTripHome_Servant" - ); - - //Now add the info into the infos - container_info_1.impl_infos[i] = info; - } - - // For debug purpose. - for (i = 0; i < comp_num/2; ++i) - { - std::stringstream tmp; - tmp << "NodeAppTest_RoundTrip:" << i; - - // Add the names and entry points of each of the DLLs - ACE_DEBUG ((LM_DEBUG, - "The info I will send out: \n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n", - container_info_1.impl_infos[i].component_instance_name.in (), - container_info_1.impl_infos[i].executor_dll.in (), - container_info_1.impl_infos[i].executor_entrypt.in (), - container_info_1.impl_infos[i].servant_dll.in (), - container_info_1.impl_infos[i].servant_entrypt.in () )); - } - - // This is what we will send out of the ContainerImplmentationInfo for the - // first container - - Deployment::ContainerImplementationInfo container_info_2; - CORBA::ULong length_2 = comp_num - comp_num/2; - container_info_2.impl_infos.length (CORBA::ULong (length_2)); - - for (i = 0; i < length_2; ++i) - { - Deployment::ComponentImplementationInfo info; - - std::stringstream tmp; - tmp << "NodeAppTest_RoundTrip:" << counter; - counter = counter + 1; - - // Add the names and entry points of each of the DLLs - info.component_instance_name = - CORBA::string_dup (tmp.str ().c_str ()); - info.executor_dll = CORBA::string_dup ("NodeAppTest_RoundTrip_exec"); - info.executor_entrypt = - CORBA::string_dup ("createRoundTripHome_Impl"); - info.servant_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_svnt"); - info.servant_entrypt = - CORBA::string_dup ( - "create_NodeAppTest_NodeAppTest_RoundTripHome_Servant" - ); - - //Now add the info into the infos - container_info_2.impl_infos[i] = info; - } - - // For debug purpose. - for (i = 0; i < length_2; ++i) - { - std::stringstream tmp; - tmp << "NodeAppTest_RoundTrip:" << i; - - // Add the names and entry points of each of the DLLs - ACE_DEBUG ((LM_DEBUG, - "The info I will send out: \n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n", - container_info_2.impl_infos[i].component_instance_name.in (), - container_info_2.impl_infos[i].executor_dll.in (), - container_info_2.impl_infos[i].executor_entrypt.in (), - container_info_2.impl_infos[i].servant_dll.in (), - container_info_2.impl_infos[i].servant_entrypt.in () )); - } - - // container_info.container_config is not set for now - - ACE_DEBUG ((LM_DEBUG, "Try installing Homes and Components\n")); - - // Create a NodeImplementationInfo sequence - Deployment::NodeImplementationInfo node_info; - node_info.impl_infos.length (2); - node_info.impl_infos[0] = container_info_1; - node_info.impl_infos[1] = container_info_2; - - // Install test component and its home on NodeApplication - Deployment::ComponentInfos_var comp_info = - node_app->install (node_info); - - // store the component refs - for (i = 0; i < comp_num; ++i) - { - comp_list.push_back (NodeAppTest::NodeAppTest_RoundTrip::_narrow - (comp_info[i].component_ref.in ())); - - if (CORBA::is_nil (comp_list[i].in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil RoundTripHome reference: %s \n", - comp_info[i].component_instance_name.in ()), - 1); - } - } - - ACE_DEBUG ((LM_DEBUG, "Installation finished successfully.\n")); - - // Before we can start we have to start. - node_app->start (); - - // Invoke Operation on the components - ACE_DEBUG ((LM_DEBUG, "Try cube_long operation on the Interface \n")); - - for (i = 0; i < comp_num; ++i) - { - - CORBA::Long input = i; - - CORBA::Long output = - (comp_list[i])->cube_long (input); - - if (input*input*input == output) - { - ACE_DEBUG ((LM_DEBUG, - "Return values matched!! on Component: %d \n", - i)); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "Return values did not match: on Component: %d \n", - i)); - ACE_OS::exit (1); - } - } - - ACE_DEBUG ((LM_DEBUG, "Try removing everything\n")); - node_app->remove (); - - ACE_DEBUG ((LM_DEBUG, "Homes and components removed successfully\n")); - - orb->destroy (); - - ACE_DEBUG ((LM_DEBUG, "Test success!!\n")); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Exception caught:"); - return 1; - } - - return 0; -} diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_dynamic.cpp b/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_dynamic.cpp deleted file mode 100644 index 4cf7065221c..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_dynamic.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// $Id$ - -#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" -#include "Client_init.h" -#include "NodeAppTest_RoundTripC.h" -#include "ace/Get_Opt.h" -#include "assert.h" - -const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); - -int -parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s \n" - "-k <ComponentServer ior> \n" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv); - - if (parse_args (argc, argv) != 0) - return 1; - - CIAO::Client_init (orb.in ()); - - CORBA::Object_var tmp = - orb->string_to_object(ior); - - Deployment::NodeApplication_var node_app = - Deployment::NodeApplication::_narrow(tmp.in ()); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil nodeapplication reference <%s>\n", - ior), - 1); - } - - - ACE_DEBUG ((LM_DEBUG, "Try installing Home and Component\n")); - - Deployment::ComponentImplementationInfo info; - - // Add the names and entry points of each of the DLLs - info.component_instance_name = - CORBA::string_dup ("NodeAppTest_RoundTrip"); - info.executor_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_exec"); - info.executor_entrypt = - CORBA::string_dup ("createRoundTripHome_Impl"); - info.servant_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_svnt"); - info.servant_entrypt = - CORBA::string_dup ( - "create_NodeAppTest_NodeAppTest_RoundTripHome_Servant" - ); - - // Create a ContainerImplementationInfo sequence - Deployment::ContainerImplementationInfo container_info; - container_info.impl_infos.length (1); - container_info.impl_infos[0] = info; - - // Create a NodeImplementationInfo sequence - Deployment::NodeImplementationInfo node_info; - node_info.impl_infos.length (1); - node_info.impl_infos[0] = container_info; - - // Install test component and its home on NodeApplication - Deployment::ComponentInfos_var comp_info = - node_app->install (node_info); - - assert (comp_info->length () == 1); //return 1 component objeref - - const CORBA::ULong i = 0; - Components::CCMObject_var objref = (comp_info[i]).component_ref; - - NodeAppTest::NodeAppTest_RoundTrip_var roundtrip_var = - NodeAppTest::NodeAppTest_RoundTrip::_narrow (objref.in ()); - - if (CORBA::is_nil (roundtrip_var.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil RoundTrip reference\n"), - 1); - } - - // Invoke Operation on the Interface - ACE_DEBUG ((LM_DEBUG, "Try cube_long operation on the Interface \n")); - CORBA::Long input = 1L; - CORBA::Long output = - roundtrip_var->cube_long (input); - - if (input == output) - ACE_DEBUG ((LM_DEBUG, "Retrun values matched!!\n")); - else - { - ACE_DEBUG ((LM_DEBUG, "Return values did not match: failure\n")); - ACE_OS::exit (1); - } - - // Install another set of components - ACE_DEBUG ((LM_DEBUG, "Try installing another component dynamically\n")); - - // Modifying the component instance name since it must be unique - (node_info.impl_infos[0]).impl_infos[0].component_instance_name = - CORBA::string_dup ("NodeAppTest_RoundTrip_2"); - Deployment::ComponentInfos_var comp_info_new = - node_app->install (node_info); - - assert (comp_info_new->length () == 1); //return 1 component objeref - - ACE_DEBUG ((LM_DEBUG, "Try removing the second component and its home\n")); - node_app->remove_component ("NodeAppTest_RoundTrip"); - ACE_DEBUG ((LM_DEBUG, "Component and Home removed successfully\n")); - - ACE_DEBUG ((LM_DEBUG, "=====Try removing all remaining components and homes\n")); - node_app->remove (); - ACE_DEBUG ((LM_DEBUG, "=====Components and Homes removed successfully\n")); - - orb->destroy (); - ACE_DEBUG ((LM_DEBUG, "=====Test success!!\n")); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Exception caught:"); - return 1; - } - - return 0; -} diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp b/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp deleted file mode 100644 index 9207b2886af..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// $Id$ - -#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" -#include "ciao/Client_init.h" -#include "NodeAppTest_RoundTripC.h" -#include "ace/Get_Opt.h" -#include "assert.h" - -const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); - -int -parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s \n" - "-k <NodeApplication ior> \n" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv); - - if (parse_args (argc, argv) != 0) - return 1; - - CIAO::Client_init (orb.in ()); - - CORBA::Object_var tmp = - orb->string_to_object(ior); - - Deployment::NodeApplication_var node_app = - Deployment::NodeApplication::_narrow(tmp.in ()); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil NodeApplication reference <%s>\n", - ior), - 1); - } - - - ACE_DEBUG ((LM_DEBUG, "Try installing Home and Component\n")); - - Deployment::ComponentImplementationInfo info; - - // Add the names and entry points of each of the DLLs - info.component_instance_name = - CORBA::string_dup ("NodeAppTest_RoundTrip"); - info.executor_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_exec"); - info.executor_entrypt = - CORBA::string_dup ("createRoundTripHome_Impl"); - info.servant_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_svnt"); - info.servant_entrypt = - CORBA::string_dup ( - "create_NodeAppTest_NodeAppTest_RoundTripHome_Servant" - ); - - // Create a ContainerImplementationInfo sequence - Deployment::ContainerImplementationInfo container_info; - container_info.impl_infos.length (1); - container_info.impl_infos[0] = info; - - // Create a NodeImplementationInfo sequence - Deployment::NodeImplementationInfo node_info; - node_info.impl_infos.length (1); - node_info.impl_infos[0] = container_info; - - // Install test component and its home on NodeApplication - Deployment::ComponentInfos_var comp_info = - node_app->install (node_info); - - assert (comp_info->length () == 1); //return 1 component objeref - - CORBA::ULong i = 0; - Components::CCMObject_var objref = (comp_info[i]).component_ref; - - NodeAppTest::NodeAppTest_RoundTrip_var roundtrip_var = - NodeAppTest::NodeAppTest_RoundTrip::_narrow (objref.in ()); - - if (CORBA::is_nil (roundtrip_var.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil RoundTrip reference\n"), - 1); - } - - // initialize the component - roundtrip_var->ciao_postactivate (); - - //get the provided facets info. - Components::FacetDescriptions_var facets_info = - roundtrip_var->get_all_facets () ; - - if ( facets_info->length () != 2 ) - { - ACE_DEBUG((LM_DEBUG, "Didn't get 2 facet back! but only %d\n", - facets_info->length ())); - return 1; - } - - // Invoke Operation on the Interface - ACE_DEBUG ((LM_DEBUG, "Try cube_long operation on the Interface \n")); - - for (i = 0; i < 2; ++i ) - { - NodeAppTest::LatencyTest_var latency_var - = NodeAppTest::LatencyTest::_narrow ( (facets_info[i]->facet_ref ())); - ACE_DEBUG((LM_DEBUG, "Calling on facet %s\n", (facets_info[i]->name ()))); - - - if ( CORBA::is_nil (latency_var.in ()) ) - { - ACE_DEBUG((LM_DEBUG, "get nil latency ref for facet%d\n", i)); - return 1; - } - - CORBA::Long input = 1L; - CORBA::Long output = - latency_var->cube_long (input); - - if (input == output) - ACE_DEBUG ((LM_DEBUG, "Retrun values matched!!\n")); - else - { - ACE_DEBUG ((LM_DEBUG, "Return values did not match: failure\n")); - ACE_OS::exit (1); - } - } - - ACE_DEBUG ((LM_DEBUG, "Try removing test component and its home\n")); - node_app->remove (); - ACE_DEBUG ((LM_DEBUG, "Component and Home removed successfully\n")); - - orb->destroy (); - ACE_DEBUG ((LM_DEBUG, "Test success!!\n")); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Exception caught:"); - return 1; - } - - return 0; -} diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp b/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp deleted file mode 100644 index e29470f3d95..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// $Id$ - -#include "DAnCE/Deployment/Deployment_NodeApplicationC.h" -#include "Client_init.h" -#include "NodeAppTest_RoundTripC.h" -#include "ace/Get_Opt.h" -#include "assert.h" - -const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); - -int -parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s \n" - "-k <ComponentServer ior> \n" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -ACE_TMAIN(int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv); - - if (parse_args (argc, argv) != 0) - return 1; - - CIAO::Client_init (orb.in ()); - - CORBA::Object_var tmp = - orb->string_to_object(ior); - - Deployment::NodeApplication_var node_app = - Deployment::NodeApplication::_narrow(tmp.in ()); - - if (CORBA::is_nil (node_app.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil nodeapplication reference <%s>\n", - ior), - 1); - } - - - ACE_DEBUG ((LM_DEBUG, "Try installing Home and Component\n")); - - Deployment::ComponentImplementationInfo info; - - // Add the names and entry points of each of the DLLs - info.component_instance_name = - CORBA::string_dup ("NodeAppTest_RoundTrip"); - info.executor_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_exec"); - info.executor_entrypt = - CORBA::string_dup ("createRoundTripHome_Impl"); - info.servant_dll = - CORBA::string_dup ("NodeAppTest_RoundTrip_svnt"); - info.servant_entrypt = - CORBA::string_dup ( - "create_NodeAppTest_NodeAppTest_RoundTripHome_Servant" - ); - - // Create a ContainerImplementationInfo sequence - Deployment::ContainerImplementationInfo container_info; - container_info.impl_infos.length (1); - container_info.impl_infos[0] = info; - - // Create a NodeImplementationInfo sequence - Deployment::NodeImplementationInfo node_info; - node_info.impl_infos.length (1); - node_info.impl_infos[0] = container_info; - - // Install test component and its home on NodeApplication - Deployment::ComponentInfos_var comp_info = - node_app->install (node_info); - - assert (comp_info->length () == 1); //return 1 component objeref - - const CORBA::ULong i = 0; - Components::CCMObject_var objref = (comp_info[i]).component_ref; - - NodeAppTest::NodeAppTest_RoundTrip_var roundtrip_var = - NodeAppTest::NodeAppTest_RoundTrip::_narrow (objref.in ()); - - if (CORBA::is_nil (roundtrip_var.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil RoundTrip reference\n"), - 1); - } - - // Invoke Operation on the Interface - ACE_DEBUG ((LM_DEBUG, "Try cube_long operation on the Interface \n")); - CORBA::Long input = 1L; - CORBA::Long output = - roundtrip_var->cube_long (input); - - if (input == output) - ACE_DEBUG ((LM_DEBUG, "Retrun values matched!!\n")); - else - { - ACE_DEBUG ((LM_DEBUG, "Return values did not match: failure\n")); - ACE_OS::exit (1); - } - - ACE_DEBUG ((LM_DEBUG, "Try removing test component and its home\n")); - node_app->remove (); - ACE_DEBUG ((LM_DEBUG, "Component and Home removed successfully\n")); - - orb->destroy (); - ACE_DEBUG ((LM_DEBUG, "Test success!!\n")); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("Exception caught:"); - return 1; - } - - return 0; -} diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/README b/CIAO/DAnCE/tests/NodeApplicationTest/README deleted file mode 100644 index ea8fc438089..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/README +++ /dev/null @@ -1,12 +0,0 @@ -$Id$ -This directory contains the basic testing program for NodeApplication. - -client_simple: Test the basic home installation and component creation. - -client: Test the installation of several homes and components. - In this test I use the more convenient method provided - by the NodeApplication to insall multiple components. Aslo - a remove method is called to easily remove all homes and components. - -client_ex: Test the get_all_facet methods provided in the servant of the - component. diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec.cpp b/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec.cpp deleted file mode 100644 index 044e6acc8af..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// $Id$ - -#include "RoundTrip_exec.h" -#include "CIAO_common.h" - -//-- ACE Scheduling Params -#include "ace/OS_NS_errno.h" - -//================================================================= - -namespace CIDL_RoundTrip_Impl -{ - RoundTrip_exec_i::RoundTrip_exec_i () - { - - } - - RoundTrip_exec_i::~RoundTrip_exec_i () - { - } - - NodeAppTest::CCM_LatencyTest_ptr - RoundTrip_exec_i::get_facet_1 () - { - return new LatencyTest_Impl; - } - - NodeAppTest::CCM_LatencyTest_ptr - RoundTrip_exec_i::get_facet_2 () - { - return new LatencyTest_Impl; - } - - CORBA::Long - RoundTrip_exec_i::cube_long (CORBA::Long data) - { - return data * data * data; - } - - // Operations from Components::SessionComponent - void - RoundTrip_exec_i::set_session_context (Components::SessionContext_ptr) - { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, - "RoundTrip_exec_i::set_session_context\n")); - } - } - - void - RoundTrip_exec_i::ccm_activate () - { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, "RoundTrip_exec_i::ccm_activate\n")); - } - - } - - void - RoundTrip_exec_i::ccm_passivate () - { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, "RoundTrip_exec_i::ccm_passivate\n")); - } - } - - void - RoundTrip_exec_i::ccm_remove () - { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, "RoundTrip_exec_i::ccm_remove\n")); - } - } - - void - RoundTrip_exec_i::ciao_preactivate () - { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, "RoundTrip_exec_i::ciao_preactivate\n")); - } - - } - - void - RoundTrip_exec_i::ciao_postactivate () - { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, "RoundTrip_exec_i::ciao_postactivate\n")); - } - } - - RoundTripHome_exec_i::RoundTripHome_exec_i () - { - } - - RoundTripHome_exec_i::~RoundTripHome_exec_i () - { - } - - ::Components::EnterpriseComponent_ptr - RoundTripHome_exec_i::create () - { - return new RoundTrip_exec_i; - } - - // Implementation for the probided inferface. - CORBA::Long - LatencyTest_Impl::cube_long (CORBA::Long data) - { - return data*data*data; - } - - extern "C" NODEAPPTEST_ROUNDTRIP_EXEC_Export - ::Components::HomeExecutorBase_ptr - createRoundTripHome_Impl (void) - { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, "Creating Round_trip impl\n")); - } - - return new RoundTripHome_exec_i (); - } -} - diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec.h b/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec.h deleted file mode 100644 index d3ac7acd995..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec.h +++ /dev/null @@ -1,129 +0,0 @@ -// -*- C++ -*- - -//============================================================ -/** - * @file RoundTrip_exec.h - * - * $Id$ - * - * Header file for the Executor implementation. - * - * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> - */ -//============================================================ - -#ifndef NODEAPP_ROUNDTRIP_EXEC_H -#define NODEAPP_ROUNDTRIP_EXEC_H - -#include "NodeAppTest_RoundTripEC.h" -#include "RoundTrip_exec_export.h" -#include "tao/LocalObject.h" - -namespace CIDL_RoundTrip_Impl -{ - - /** - * @class RoundTrip_exec_i - * - * RoundTrip executor implementation class. - */ - class NODEAPPTEST_ROUNDTRIP_EXEC_Export RoundTrip_exec_i - : public virtual NodeAppTest::LatencyTest, - public virtual RoundTrip_Exec, - public virtual ::CORBA::LocalObject - { - - public: - /// Default constructor. - RoundTrip_exec_i (); - - /// Operation to test the data - virtual CORBA::Long cube_long (CORBA::Long data); - - /* - virtual ::NodeAppTest::CCM_LatencyTest* - get_latency (); - */ - - NodeAppTest::CCM_LatencyTest_ptr get_facet_1(); - - - NodeAppTest::CCM_LatencyTest_ptr - get_facet_2(); - - // Operations from Components::SessionComponent - virtual void set_session_context (Components::SessionContext_ptr ctx); - - virtual void ccm_activate (); - - virtual void ccm_passivate (); - - virtual void ccm_remove (); - - /// Helper function to be called back by timeout_Handler - void pulse (void); - - // CIAO defined methods - virtual void ciao_preactivate (); - - virtual void ciao_postactivate (); - - protected: - - /// Destructor. - /** - * Protected destructor to enforce proper memory management - * through the reference counting mechanism. - */ - ~RoundTrip_exec_i (); - - }; - - // - // - // - class LatencyTest_Impl : public virtual NodeAppTest::CCM_LatencyTest, - public virtual ::CORBA::LocalObject - { - public: - LatencyTest_Impl () - { - } - - virtual CORBA::Long cube_long (CORBA::Long data); - }; - - /** - * @class RoundTripHome_exec_i - * - * RoundTrip home executor implementation class. - */ - class NODEAPPTEST_ROUNDTRIP_EXEC_Export RoundTripHome_exec_i : - public virtual RoundTripHome_Exec, - public virtual ::CORBA::LocalObject - { - public: - /// Default ctor. - RoundTripHome_exec_i (); - - // Implicit home operations. - - virtual ::Components::EnterpriseComponent_ptr - create (); - - protected: - - /// Destructor. - /** - * Protected destructor to enforce proper memory management - * through the reference counting mechanism. - */ - ~RoundTripHome_exec_i (); - - }; - - extern "C" NODEAPPTEST_ROUNDTRIP_EXEC_Export - ::Components::HomeExecutorBase_ptr createRoundTripHome_Impl (void); -} - -#endif /* NODEAPP_ROUNDTRIPGEN_EXEC_H */ diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec_export.h b/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec_export.h deleted file mode 100644 index 30f8c3b38d9..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_exec_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NODEAPPTEST_ROUNDTRIP_EXEC -// ------------------------------ -#ifndef NODEAPPTEST_ROUNDTRIP_EXEC_EXPORT_H -#define NODEAPPTEST_ROUNDTRIP_EXEC_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL) -# define NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL */ - -#if !defined (NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL) -# define NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL 1 -#endif /* ! NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL */ - -#if defined (NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL) && (NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL == 1) -# if defined (NODEAPPTEST_ROUNDTRIP_EXEC_BUILD_DLL) -# define NODEAPPTEST_ROUNDTRIP_EXEC_Export ACE_Proper_Export_Flag -# define NODEAPPTEST_ROUNDTRIP_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define NODEAPPTEST_ROUNDTRIP_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* NODEAPPTEST_ROUNDTRIP_EXEC_BUILD_DLL */ -# define NODEAPPTEST_ROUNDTRIP_EXEC_Export ACE_Proper_Import_Flag -# define NODEAPPTEST_ROUNDTRIP_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define NODEAPPTEST_ROUNDTRIP_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* NODEAPPTEST_ROUNDTRIP_EXEC_BUILD_DLL */ -#else /* NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL == 1 */ -# define NODEAPPTEST_ROUNDTRIP_EXEC_Export -# define NODEAPPTEST_ROUNDTRIP_EXEC_SINGLETON_DECLARATION(T) -# define NODEAPPTEST_ROUNDTRIP_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* NODEAPPTEST_ROUNDTRIP_EXEC_HAS_DLL == 1 */ - -// Set NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE) -# if (ACE_NTRACE == 1) -# define NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE */ - -#if (NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE == 1) -# define NODEAPPTEST_ROUNDTRIP_EXEC_TRACE(X) -#else /* (NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define NODEAPPTEST_ROUNDTRIP_EXEC_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (NODEAPPTEST_ROUNDTRIP_EXEC_NTRACE == 1) */ - -#endif /* NODEAPPTEST_ROUNDTRIP_EXEC_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_stub_export.h b/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_stub_export.h deleted file mode 100644 index 1ad37f8e51e..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_stub_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NODEAPPTEST_ROUNDTRIP_STUB -// ------------------------------ -#ifndef NODEAPPTEST_ROUNDTRIP_STUB_EXPORT_H -#define NODEAPPTEST_ROUNDTRIP_STUB_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL) -# define NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL */ - -#if !defined (NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL) -# define NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL 1 -#endif /* ! NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL */ - -#if defined (NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL) && (NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL == 1) -# if defined (NODEAPPTEST_ROUNDTRIP_STUB_BUILD_DLL) -# define NODEAPPTEST_ROUNDTRIP_STUB_Export ACE_Proper_Export_Flag -# define NODEAPPTEST_ROUNDTRIP_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define NODEAPPTEST_ROUNDTRIP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* NODEAPPTEST_ROUNDTRIP_STUB_BUILD_DLL */ -# define NODEAPPTEST_ROUNDTRIP_STUB_Export ACE_Proper_Import_Flag -# define NODEAPPTEST_ROUNDTRIP_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define NODEAPPTEST_ROUNDTRIP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* NODEAPPTEST_ROUNDTRIP_STUB_BUILD_DLL */ -#else /* NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL == 1 */ -# define NODEAPPTEST_ROUNDTRIP_STUB_Export -# define NODEAPPTEST_ROUNDTRIP_STUB_SINGLETON_DECLARATION(T) -# define NODEAPPTEST_ROUNDTRIP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* NODEAPPTEST_ROUNDTRIP_STUB_HAS_DLL == 1 */ - -// Set NODEAPPTEST_ROUNDTRIP_STUB_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (NODEAPPTEST_ROUNDTRIP_STUB_NTRACE) -# if (ACE_NTRACE == 1) -# define NODEAPPTEST_ROUNDTRIP_STUB_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define NODEAPPTEST_ROUNDTRIP_STUB_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !NODEAPPTEST_ROUNDTRIP_STUB_NTRACE */ - -#if (NODEAPPTEST_ROUNDTRIP_STUB_NTRACE == 1) -# define NODEAPPTEST_ROUNDTRIP_STUB_TRACE(X) -#else /* (NODEAPPTEST_ROUNDTRIP_STUB_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define NODEAPPTEST_ROUNDTRIP_STUB_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (NODEAPPTEST_ROUNDTRIP_STUB_NTRACE == 1) */ - -#endif /* NODEAPPTEST_ROUNDTRIP_STUB_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_svnt_export.h b/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_svnt_export.h deleted file mode 100644 index 96b74f356bb..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/RoundTrip_svnt_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NODEAPPTEST_ROUNDTRIP_SVNT -// ------------------------------ -#ifndef NODEAPPTEST_ROUNDTRIP_SVNT_EXPORT_H -#define NODEAPPTEST_ROUNDTRIP_SVNT_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL) -# define NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL */ - -#if !defined (NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL) -# define NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL 1 -#endif /* ! NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL */ - -#if defined (NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL) && (NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL == 1) -# if defined (NODEAPPTEST_ROUNDTRIP_SVNT_BUILD_DLL) -# define NODEAPPTEST_ROUNDTRIP_SVNT_Export ACE_Proper_Export_Flag -# define NODEAPPTEST_ROUNDTRIP_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define NODEAPPTEST_ROUNDTRIP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* NODEAPPTEST_ROUNDTRIP_SVNT_BUILD_DLL */ -# define NODEAPPTEST_ROUNDTRIP_SVNT_Export ACE_Proper_Import_Flag -# define NODEAPPTEST_ROUNDTRIP_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define NODEAPPTEST_ROUNDTRIP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* NODEAPPTEST_ROUNDTRIP_SVNT_BUILD_DLL */ -#else /* NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL == 1 */ -# define NODEAPPTEST_ROUNDTRIP_SVNT_Export -# define NODEAPPTEST_ROUNDTRIP_SVNT_SINGLETON_DECLARATION(T) -# define NODEAPPTEST_ROUNDTRIP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* NODEAPPTEST_ROUNDTRIP_SVNT_HAS_DLL == 1 */ - -// Set NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE) -# if (ACE_NTRACE == 1) -# define NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE */ - -#if (NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE == 1) -# define NODEAPPTEST_ROUNDTRIP_SVNT_TRACE(X) -#else /* (NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define NODEAPPTEST_ROUNDTRIP_SVNT_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (NODEAPPTEST_ROUNDTRIP_SVNT_NTRACE == 1) */ - -#endif /* NODEAPPTEST_ROUNDTRIP_SVNT_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/run_test.pl b/CIAO/DAnCE/tests/NodeApplicationTest/run_test.pl deleted file mode 100755 index 65e97232ac6..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/run_test.pl +++ /dev/null @@ -1,47 +0,0 @@ -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::Run_Test; - -$status = 0; -$iorfile = PerlACE::LocalFile ("test.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 $iorfile; -$CIAO_ROOT=$ENV{'CIAO_ROOT'}; - -$SV = new PerlACE::Process ("$CIAO_ROOT/bin/NodeApplication", - "-n -o $iorfile"); - -$CL = new PerlACE::Process ("client", - "-k file://$iorfile -n 4"); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; -} - -$CL->SpawnWaitKill (30); -$status = $SV->Kill (); $SV->TimedWait (1); - -unlink $iorfile; - -exit $status; diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/run_test_ex.pl b/CIAO/DAnCE/tests/NodeApplicationTest/run_test_ex.pl deleted file mode 100755 index 6a39f451377..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/run_test_ex.pl +++ /dev/null @@ -1,47 +0,0 @@ -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::Run_Test; - -$status = 0; -$iorfile = PerlACE::LocalFile ("test.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 $iorfile; -$CIAO_ROOT=$ENV{'CIAO_ROOT'}; - -$SV = new PerlACE::Process ("$CIAO_ROOT/bin/NodeApplication", - "-n -o $iorfile"); - -$CL = new PerlACE::Process ("client_ex", - "-k file://$iorfile"); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; -} - -$CL->SpawnWaitKill (30); -$status = $SV->Kill (); $SV->TimedWait (1); - -unlink $iorfile; - -exit $status; diff --git a/CIAO/DAnCE/tests/NodeApplicationTest/run_test_simple.pl b/CIAO/DAnCE/tests/NodeApplicationTest/run_test_simple.pl deleted file mode 100755 index 4d2a1c9df9d..00000000000 --- a/CIAO/DAnCE/tests/NodeApplicationTest/run_test_simple.pl +++ /dev/null @@ -1,47 +0,0 @@ -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::Run_Test; - -$status = 0; -$iorfile = PerlACE::LocalFile ("test.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 $iorfile; -$CIAO_ROOT=$ENV{'CIAO_ROOT'}; - -$SV = new PerlACE::Process ("$CIAO_ROOT/bin/NodeApplication", - "-n -o $iorfile"); - -$CL = new PerlACE::Process ("client_simple", - "-k file://$iorfile "); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; -} - -$CL->SpawnWaitKill (10); -$status = $SV->Kill (); $SV->TimedWait (1); - -unlink $iorfile; - -exit $status; diff --git a/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/NodeManager-NodeApplicationManager.mpc b/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/NodeManager-NodeApplicationManager.mpc new file mode 100644 index 00000000000..5864a4df895 --- /dev/null +++ b/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/NodeManager-NodeApplicationManager.mpc @@ -0,0 +1,8 @@ + +project : dance_exe, dance_deployment_svnt, dance_deployment_stub, dance_node_application_manager, dance_node_application, dance_logger { + exename = NodeManagerNodeApplicationManagerTest + + Source_Files { + test.cpp + } +} diff --git a/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/test.cpp b/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/test.cpp new file mode 100644 index 00000000000..2b60ad8bb9a --- /dev/null +++ b/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/test.cpp @@ -0,0 +1,41 @@ +#include "DAnCE/Deployment/Deployment_NodeManagerC.h" +#include "DAnCE/Logger/Log_Macros.h" + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + const char * ior = "file://node_manager.ior"; + CORBA::Object_var obj = orb->string_to_object (ior); + if (CORBA::is_nil (obj)) + { + throw 0; + } + + Deployment::NodeManager_var nm = Deployment::NodeManager::_narrow (obj); + if (CORBA::is_nil (nm)) + { + throw 0; + } + + Deployment::DeploymentPlan plan; + Deployment::NodeApplicationManager_ptr nam_ptr = nm->preparePlan (plan, Deployment::ResourceCommitmentManager::_nil()); + DANCE_DEBUG((LM_DEBUG, "[%M] Plan prepared\n")); + + nm->destroyManager (nam_ptr); + DANCE_DEBUG((LM_DEBUG, "[%M] NodeApplicationManager object destroyed\n")); + } + catch (const CORBA::Exception &) + { + DANCE_ERROR((LM_ERROR, "[%M] Uncaught CORBA exception\n")); + return 1; + } + catch (...) + { + return 1; + } + + return 0; +} diff --git a/CIAO/DAnCE/tests/ObjectLocatorTest/Dummy.idl b/CIAO/DAnCE/tests/ObjectLocatorTest/Dummy.idl new file mode 100644 index 00000000000..b91938cb4df --- /dev/null +++ b/CIAO/DAnCE/tests/ObjectLocatorTest/Dummy.idl @@ -0,0 +1,13 @@ +// $Id$ +#ifndef DUMMY_IDL +#define DUMMY_IDL + +module ObjectLocatorTest +{ + interface Dummy { + string sayHello(); + }; +}; + +#endif /* DUMMY_IDL */ + diff --git a/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.cpp b/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.cpp new file mode 100644 index 00000000000..a84441fe146 --- /dev/null +++ b/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.cpp @@ -0,0 +1,13 @@ +#include "DummyImpl.h" + +namespace ObjectLocatorTest + { + + char * DummyImpl::sayHello ( + ) + { + return CORBA::string_dup (this->helloSentence); + } + + } // namespace ObjectLocatorTest + diff --git a/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.h b/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.h new file mode 100644 index 00000000000..83671cbf84e --- /dev/null +++ b/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.h @@ -0,0 +1,24 @@ +#ifndef DUMMYIMPL_H_ +#define DUMMYIMPL_H_ + +#include "DummyS.h" + +namespace ObjectLocatorTest + { + + class DummyImpl + : public virtual POA_ObjectLocatorTest::Dummy + { + public: + DummyImpl() : helloSentence ("A dummy hello sentence.") {}; + + virtual char * sayHello ( + ); + + private: + const char * helloSentence; + }; + + } // namespace POA_ObjectLocatorTest + +#endif /*DUMMYIMPL_H_*/ diff --git a/CIAO/DAnCE/tests/ObjectLocatorTest/ObjectLocatorTest.mpc b/CIAO/DAnCE/tests/ObjectLocatorTest/ObjectLocatorTest.mpc new file mode 100644 index 00000000000..caf05417148 --- /dev/null +++ b/CIAO/DAnCE/tests/ObjectLocatorTest/ObjectLocatorTest.mpc @@ -0,0 +1,27 @@ + +project (ObjectLocatorTestServer): dance, taoserver, iortable, dance_redirection_service, dance_logger { + exename = ObjectLocatorTestServer + + IDL_Files { + Dummy.idl + } + + Source_Files { + srv_main.cpp + DummyC.cpp + DummyS.cpp + DummyImpl.cpp + } +} + +project (ObjectLocatorTestClient): dance, taoclient, anytypecode, dance_logger { + + after += ObjectLocatorTestServer + exename = ObjectLocatorTestClient + + Source_Files { + clt_main.cpp + DummyC.cpp + DummyS.cpp + } +} diff --git a/CIAO/DAnCE/tests/ObjectLocatorTest/RegistrationPath.h b/CIAO/DAnCE/tests/ObjectLocatorTest/RegistrationPath.h new file mode 100644 index 00000000000..6ecf9197ad3 --- /dev/null +++ b/CIAO/DAnCE/tests/ObjectLocatorTest/RegistrationPath.h @@ -0,0 +1,8 @@ +#ifndef REGISTRATIONPATH_H_ +#define REGISTRATIONPATH_H_ + +const char * app_name = "app1"; +const char * inst_name = "inst1"; +const char * port_name = "port1"; + +#endif /*REGISTRATIONPATH_H_*/ diff --git a/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp b/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp new file mode 100644 index 00000000000..361d70dbc00 --- /dev/null +++ b/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp @@ -0,0 +1,56 @@ + +#include "ace/String_Base.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "RegistrationPath.h" +#include "DummyC.h" + +using namespace ObjectLocatorTest; + + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + ACE_CString url = "corbaloc:iiop:glasgow.headquarters.eclipsesp.com:12345/"; + url += app_name; + url += "/"; + url += inst_name; + url += "/"; + url += port_name; + DANCE_DEBUG((LM_DEBUG, "[%M] URL : %s\n", url.c_str())); + + CORBA::Object_var obj = orb->string_to_object (url.c_str()); + if (CORBA::is_nil (obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] Failed to convert url to object. The test failed.\n")); + return 1; + } + DANCE_DEBUG((LM_DEBUG, "[%M] URL -> object : ok.\n")); + + Dummy_var dummy_obj = Dummy::_narrow (obj); + if (CORBA::is_nil (dummy_obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] Failed to narrow the object to custom type. The test failed.\n")); + return 1; + } + DANCE_DEBUG((LM_DEBUG, "[%M] object -> dummy : ok.\n")); + + DANCE_DEBUG((LM_DEBUG, "[%M] Dummy object returned : %s.", dummy_obj->sayHello())); + DANCE_DEBUG((LM_DEBUG, "[%M] The test succeeded.")); + return 0; + } + catch (CORBA::Exception & e) + { + DANCE_ERROR((LM_ERROR, "[%M] A CORBA exception \"%s\" (%s) was thrown. The test failed." + , e._name(), e._info().c_str())); + return 1; + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] An exception was thrown. The test failed.")); + return 1; + } +} + diff --git a/CIAO/DAnCE/tests/ObjectLocatorTest/srv_main.cpp b/CIAO/DAnCE/tests/ObjectLocatorTest/srv_main.cpp new file mode 100644 index 00000000000..45086a67704 --- /dev/null +++ b/CIAO/DAnCE/tests/ObjectLocatorTest/srv_main.cpp @@ -0,0 +1,55 @@ + +#include "ace/OS_NS_stdio.h" + +#include "DummyC.h" +#include "DummyImpl.h" +#include "RedirectionService/CCMObjectLocator.h" +#include "RegistrationPath.h" +#include "DAnCE/Logger/Log_Macros.h" + +using namespace ObjectLocatorTest; + + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + try + { + int argcm = argc + 2; + char ** argvm = new ACE_TCHAR* [argcm+1]; + for (int i = 0; i < argc; ++i) + { + argvm[i] = argv[i]; + } + ACE_TCHAR buf1[32]; + ACE_OS::sprintf (buf1, ACE_TEXT("-ORBListenEndpoints")); + argvm[argcm-2] = buf1; + char buf2[32]; + ACE_OS::sprintf (buf2, ACE_TEXT("iiop://:12345")); + argvm[argcm-1] = buf2; + argvm[argcm] = 0; + CORBA::ORB_var orb = CORBA::ORB_init (argcm, argvm); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager(); + poa_manager->activate(); + + DAnCE::CCMObjectLocator locator (orb.in(), root_poa.in(), "Dummy"); + + DummyImpl servant; + + PortableServer::ObjectId_var id = root_poa->activate_object (&servant); + Dummy_var dummy_obj = Dummy::_narrow (root_poa->id_to_reference (id));//servant._this(); + + locator.register_object (app_name, inst_name, port_name, dummy_obj); + + orb->run(); + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] An error has occured.")); + } + return 0; +} + diff --git a/CIAO/DAnCE/tests/RedirectionServiceTest/Dummy.idl b/CIAO/DAnCE/tests/RedirectionServiceTest/Dummy.idl new file mode 100644 index 00000000000..5925a4ceeba --- /dev/null +++ b/CIAO/DAnCE/tests/RedirectionServiceTest/Dummy.idl @@ -0,0 +1,13 @@ +// $Id$ +#ifndef DUMMY_IDL +#define DUMMY_IDL + +module Test +{ + interface Dummy { + string sayHello(); + }; +}; + +#endif /* DUMMY_IDL */ + diff --git a/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.cpp b/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.cpp new file mode 100644 index 00000000000..92a0f9bf474 --- /dev/null +++ b/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.cpp @@ -0,0 +1,13 @@ +#include "DummyImpl.h" + +namespace Test + { + + char * DummyImpl::sayHello ( + ) + { + return CORBA::string_dup (this->helloSentence); + } + + } // namespace ObjectLocatorTest + diff --git a/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.h b/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.h new file mode 100644 index 00000000000..c75204b0495 --- /dev/null +++ b/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.h @@ -0,0 +1,24 @@ +#ifndef DUMMYIMPL_H_ +#define DUMMYIMPL_H_ + +#include "DummyS.h" + +namespace Test + { + + class DummyImpl + : public virtual POA_Test::Dummy + { + public: + DummyImpl() : helloSentence ("A dummy hello sentence.") {}; + + virtual char * sayHello ( + ); + + private: + const char * helloSentence; + }; + + } // namespace POA_ObjectLocatorTest + +#endif /*DUMMYIMPL_H_*/ diff --git a/CIAO/DAnCE/tests/RedirectionServiceTest/RedirectionServiceTest.mpc b/CIAO/DAnCE/tests/RedirectionServiceTest/RedirectionServiceTest.mpc new file mode 100644 index 00000000000..b587494e045 --- /dev/null +++ b/CIAO/DAnCE/tests/RedirectionServiceTest/RedirectionServiceTest.mpc @@ -0,0 +1,25 @@ + +project (*RedirectionServiceTestServer): dance, taoserver, iortable, naming, dance_redirection_service, dance_logger, naming_serv { + exename = RedirectionServiceTestServer + + IDL_Files { + Dummy.idl + } + + Source_Files { + srv_main.cpp + DummyC.cpp + DummyS.cpp + DummyImpl.cpp + } +} + +project (*RedirectionServiceTestClient): dance, taoclient, naming, dance_logger { + after = *RedirectionServiceTestServer + exename = RedirectionServiceTestClient + + Source_Files { + clt_main.cpp + DummyC.cpp + } +} diff --git a/CIAO/DAnCE/tests/RedirectionServiceTest/RegistrationPath.h b/CIAO/DAnCE/tests/RedirectionServiceTest/RegistrationPath.h new file mode 100644 index 00000000000..21a4b5dd91e --- /dev/null +++ b/CIAO/DAnCE/tests/RedirectionServiceTest/RegistrationPath.h @@ -0,0 +1,10 @@ +#ifndef REGISTRATIONPATH_H_ +#define REGISTRATIONPATH_H_ +#include "ace/SString.h" + +const ACE_CString node_name = "MyNode"; +const ACE_CString app_name = "app1"; +const ACE_CString inst_name = "inst1"; +const ACE_CString port_name = "port1"; + +#endif /*REGISTRATIONPATH_H_*/ diff --git a/CIAO/DAnCE/tests/RedirectionServiceTest/clt_main.cpp b/CIAO/DAnCE/tests/RedirectionServiceTest/clt_main.cpp new file mode 100644 index 00000000000..af42d33e8f1 --- /dev/null +++ b/CIAO/DAnCE/tests/RedirectionServiceTest/clt_main.cpp @@ -0,0 +1,110 @@ + +#include "ace/String_Base.h" +#include <orbsvcs/orbsvcs/CosNamingC.h> +#include "DAnCE/Logger/Log_Macros.h" +#include "RegistrationPath.h" +#include "DummyC.h" +#include "ace/OS.h" + +using namespace Test; + +CORBA::ORB_var orb; +CORBA::Object_var naming_obj; + +void inspect () + { + CORBA::Object_var obj = orb->resolve_initial_references("NameService"); + CosNaming::NamingContext_var naming = CosNaming::NamingContext::_narrow(obj.in()); + CosNaming::BindingList_var bl; + CosNaming::BindingIterator_var bi; + //naming->list(10L, bl.out(), bi.out()); + CosNaming::Name name(1); + name.length(2); + name[0].id = CORBA::string_dup("Host1");//CORBA::string_dup("CcmDance1Test"); + name[1].id = CORBA::string_dup ("CcmDance2_1@Host1"); + name[1].kind = CORBA::string_dup ("DeploymentPlan"); + //name[2].id = CORBA::string_dup("ASSEMBLYANDDEPLOYMENT"); + obj = naming->resolve(name); + DANCE_DEBUG((LM_DEBUG, "[%M] create_external_connections - After resolve\n")); + CosNaming::NamingContext_var CcmDance1Test = CosNaming::NamingContext::_narrow(obj.in()); + CcmDance1Test->list(10L, bl.out(), bi.out()); + bool exit = false; + while (!exit) + { + DANCE_DEBUG((LM_DEBUG, "[%M] create_external_connections - naming size is %u\n", bl->length())); + for ( size_t i = 0; i< bl->length(); i++ ) + { + for ( size_t j = 0; j < (*bl)[i].binding_name.length(); j++ ) + { + DANCE_DEBUG((LM_DEBUG, "create_external_connections - Binding name %s, binding kind %s, binding type %i\n" + , (*bl)[i].binding_name[j].id.in() + , (*bl)[i].binding_name[j].kind.in() + , (*bl)[i].binding_type)); + } + } + if(!bi->next_n(10L, bl.out())) + { + exit = true; + } + } + + } +bool test (const ACE_CString& url) +{ + bool res = false; + try + { + DANCE_DEBUG((LM_DEBUG, "[%M] URL : %s\n", url.c_str())); + + CORBA::Object_var obj = orb->string_to_object (url.c_str()); + if (CORBA::is_nil (obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] Failed to convert url to object. The test failed.\n")); + return 1; + } + DANCE_DEBUG((LM_DEBUG, "[%M] URL -> object : ok.\n")); + + Dummy_var dummy_obj = Dummy::_narrow (obj); + if (CORBA::is_nil (dummy_obj)) + { + DANCE_ERROR((LM_ERROR, "[%M] Failed to narrow the object to custom type. The test failed.\n")); + return 1; + } + DANCE_DEBUG((LM_DEBUG, "[%M] object -> dummy : ok.\n")); + + DANCE_DEBUG((LM_DEBUG, "[%M] Dummy object returned : %s.\n", dummy_obj->sayHello())); + DANCE_DEBUG((LM_DEBUG, "[%M] The test succeeded.\n")); + res = true; + } + catch (CORBA::Exception & e) + { + DANCE_ERROR((LM_ERROR, "[%M] A CORBA exception \"%s\" (%s) was thrown. The test failed." + , e._name(), e._info().c_str())); + } + catch (...) + { + DANCE_ERROR((LM_ERROR, "[%M] An exception was thrown. The test failed.\n")); + } + + return res; +}; + + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ + orb = CORBA::ORB_init (argc, argv); + + //naming_obj = orb->resolve_initial_references("NameService"); + //glasgow.headquarters.eclipsesp.com:12345 + ACE_CString url = "corbaname::glasgow:12345#" + node_name + "/" + app_name + ".DeploymentPlan" + "/" + inst_name + "/" + port_name + ".Port"; + test (url); + url = "corbaname::glasgow:12345#" + node_name + "/" + app_name + ".DeploymentPlan" + "/" + inst_name + ".Component"; + test (url); + //node_name + "/" + %14%01%0f%00NUP%00%00%00%17%01%00%00%00%01%00%00%00RootPOA%00MyNode%00 + url = "corbaloc:iiop:1.2@glasgow.headquarters.eclipsesp.com:12345/%14%01%0f%00NUP%00%00%00%17%01%00%00%00%01%00%00%00RootPOA%00MyNode%00" + app_name + "/" + inst_name + "/" + port_name; + test (url); + url = "corbaloc:iiop:1.2@glasgow.headquarters.eclipsesp.com:12345/%14%01%0f%00NUP%00%00%00%17%01%00%00%00%01%00%00%00RootPOA%00MyNode%00" + app_name + "/" + inst_name; + test (url); + + return 0; +} diff --git a/CIAO/DAnCE/tests/RedirectionServiceTest/srv_main.cpp b/CIAO/DAnCE/tests/RedirectionServiceTest/srv_main.cpp new file mode 100644 index 00000000000..1158a27e6b1 --- /dev/null +++ b/CIAO/DAnCE/tests/RedirectionServiceTest/srv_main.cpp @@ -0,0 +1,67 @@ +#include "ace/OS_NS_stdio.h" +#include "ace/Get_Opt.h" +#include <orbsvcs/orbsvcs/Naming/Naming_Loader.h> +#include "DAnCE/Logger/Log_Macros.h" +#include "RedirectionService/RedirectionService.h" + +#include "DummyC.h" +#include "DummyImpl.h" +#include "RegistrationPath.h" + +using namespace Test; + +int ACE_TMAIN (int argc, ACE_TCHAR * argv[]) +{ +// try + { + int argcm = argc + 2; + char ** argvm = new char* [argcm+1]; + for (int i = 0; i < argc; ++i) + { + argvm[i] = argv[i]; + } + char buf1[32]; + ACE_OS::sprintf (buf1, "-ORBListenEndpoints"); + argvm[argcm-2] = buf1; + char buf2[32]; + ACE_OS::sprintf (buf2, "iiop://:12345"); + argvm[argcm-1] = buf2; + argvm[argcm] = 0; + + CORBA::ORB_var orb = CORBA::ORB_init (argcm, argvm); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager(); + poa_manager->activate(); + + DummyImpl servant; + + PortableServer::ObjectId_var id = root_poa->activate_object (&servant); + + Dummy_var dummy_obj = Dummy::_narrow (root_poa->id_to_reference (id));//servant._this(); + + TAO_Naming_Loader loader; + + CORBA::Object_var obj_tmp = loader.create_object (orb.in(), argcm, argvm); + CORBA::Object_var naming_obj = orb->resolve_initial_references ("NameService"); + CosNaming::NamingContext_var naming = CosNaming::NamingContext::_narrow (naming_obj.in()); + + DAnCE::RedirectionService redirection (orb.in(), root_poa.in(), naming.in(), CosNaming::NamingContext::_nil(), true, true); + + redirection.registration_start (node_name, app_name); + redirection.registration (node_name, app_name, inst_name, port_name, dummy_obj.in()); + DANCE_DEBUG((LM_DEBUG, "[%M] Registration for port have finished.\n\n")); + redirection.registration (node_name, app_name, inst_name, /*CORBA::Object::_nil()*/dummy_obj.in()); + DANCE_DEBUG((LM_DEBUG, "[%M] Registration for component have finished.\n\n")); + redirection.registration_finish (node_name, app_name); + orb->run(); + } +// catch (...) +// { +// DANCE_ERROR((LM_ERROR, "[%M] An error has occured.")); +// } + return 0; +} + diff --git a/CIAO/DAnCE/tests/scripts/BasicSP/basicsp.dat b/CIAO/DAnCE/tests/scripts/BasicSP/basicsp.dat index ab4b1faf954..8bd5e6a72f6 100644 --- a/CIAO/DAnCE/tests/scripts/BasicSP/basicsp.dat +++ b/CIAO/DAnCE/tests/scripts/BasicSP/basicsp.dat @@ -1,2 +1,3 @@ BMClosedED corbaloc:iiop:localhost:10000/NodeManager -EC corbaloc:iiop:localhost:20000/NodeManager
\ No newline at end of file +EC corbaloc:iiop:localhost:20000/NodeManager + |