diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-06-01 18:23:45 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-06-01 18:23:45 +0000 |
commit | 9c5a6f34cd042eed0c03d0e1368ccd8cb0194ddc (patch) | |
tree | e722e8b485dd99aaa9efa8679bdde6eb1b71ed76 /modules/CIAO/DAnCE | |
parent | dc25598c5fe36d33b5ff9e94a59e90f79cf42dba (diff) | |
download | ATCD-9c5a6f34cd042eed0c03d0e1368ccd8cb0194ddc.tar.gz |
branching/tagging
Diffstat (limited to 'modules/CIAO/DAnCE')
328 files changed, 39026 insertions, 0 deletions
diff --git a/modules/CIAO/DAnCE/Deployment/DAnCE_Core.mpc b/modules/CIAO/DAnCE/Deployment/DAnCE_Core.mpc new file mode 100644 index 00000000000..3c06d7871a3 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/DAnCE_Core.mpc @@ -0,0 +1,117 @@ +// -*- MPC -*- +// $Id$ + +project(Deployment_IDL) : ciaolib_with_idl, ciao_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 + + IDL_Files { + idlflags += -SS -Sci + Deployment_Packaging_Data.idl + Deployment_PlanError.idl + DAnCE_Properties.idl + } + + IDL_Files { + idlflags += -SS + Deployment_Base.idl + Deployment_Connection.idl + Deployment_Data.idl + Deployment_DeploymentPlan.idl + Deployment_TargetData.idl + } + + IDL_Files { + idlflags += -GC + Deployment_ApplicationManager.idl + Deployment_NodeApplicationManager.idl + } + + IDL_Files { + Deployment_ResourceCommitmentManager.idl + Deployment_TargetManager.idl + Deployment_Core.idl + Deployment_NodeApplication.idl + Deployment_Application.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) : ciaolib_with_idl, ciao_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 + Deployment_ConnectionC.cpp + Deployment_DataC.cpp + Deployment_DeploymentPlanC.cpp + Deployment_TargetDataC.cpp + Deployment_NodeApplicationC.cpp + Deployment_ApplicationC.cpp + Deployment_Packaging_DataC.cpp + Deployment_PlanErrorC.cpp + DeploymentC.cpp + Deployment_TargetManagerC.cpp + Deployment_NodeManagerC.cpp + Deployment_NodeApplicationManagerC.cpp + Deployment_ApplicationManagerC.cpp + Deployment_DomainApplicationManagerC.cpp + Deployment_DomainApplicationC.cpp + Deployment_ExecutionManagerC.cpp + Deployment_RepositoryManagerC.cpp + Deployment_ResourceCommitmentManagerC.cpp + DAnCE_PropertiesC.cpp + } +} + + +// CIAO_DnC_Client library must be linked for this project. +// Please don't remove. dance_deployment_stub, +project(Deployment_svnt) : dance_deployment_stub, ciao_output, ciaolib_with_idl, portableserver, valuetype, ifr_client, naming, dance_lib, dance_logger, messaging, gen_ostream { + sharedname = DAnCE_Deployment_svnt + dynamicflags = DEPLOYMENT_SVNT_BUILD_DLL + after += Deployment_IDL + + // This is necessary for MPC to pull in rules.ciao.GNU + includes += $(CIAO_ROOT) + + IDL_Files { + } + + Source_Files { + Deployment_CoreS.cpp + Deployment_ApplicationS.cpp + Deployment_NodeApplicationS.cpp + DeploymentS.cpp + Deployment_RepositoryManagerS.cpp + Deployment_NodeManagerS.cpp + Deployment_NodeApplicationManagerS.cpp + Deployment_ApplicationManagerS.cpp + Deployment_DomainApplicationManagerS.cpp + Deployment_DomainApplicationS.cpp + Deployment_ExecutionManagerS.cpp + Deployment_TargetManagerS.cpp + Deployment_ResourceCommitmentManagerS.cpp + } + +} diff --git a/modules/CIAO/DAnCE/Deployment/DAnCE_Loader.h b/modules/CIAO/DAnCE/Deployment/DAnCE_Loader.h new file mode 100644 index 00000000000..cf40a32c288 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Deployment/DAnCE_Properties.idl b/modules/CIAO/DAnCE/Deployment/DAnCE_Properties.idl new file mode 100644 index 00000000000..a93fcdc40af --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Deployment/Deployment.idl b/modules/CIAO/DAnCE/Deployment/Deployment.idl new file mode 100644 index 00000000000..dabf69a0662 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment.idl @@ -0,0 +1,37 @@ +// $Id$ + +#ifndef DEPLOYMENT_IDL +#define DEPLOYMENT_IDL + +#include "DAnCE/Deployment/Deployment_Packaging_Data.idl" +#include "DAnCE/Deployment/Deployment_PlanError.idl" + +module Deployment { + 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/modules/CIAO/DAnCE/Deployment/Deployment_Application.idl b/modules/CIAO/DAnCE/Deployment/Deployment_Application.idl new file mode 100644 index 00000000000..4ef117a6546 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_Application.idl @@ -0,0 +1,32 @@ +// $Id$ + +#ifndef DEPLOYMENT_APPLICATION_IDL +#define DEPLOYMENT_APPLICATION_IDL + +#include "DAnCE/Deployment/Deployment_Connection.idl" + +module Deployment +{ + exception StartError { + string name; + string reason; + }; + + exception InvalidConnection { + string name; + string reason; + }; + + 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/modules/CIAO/DAnCE/Deployment/Deployment_ApplicationManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_ApplicationManager.idl new file mode 100644 index 00000000000..6f35ae0bcb7 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_ApplicationManager.idl @@ -0,0 +1,33 @@ +// $Id$ +#ifndef DEPLOYMENT_APPLICATIONMANAGER_IDL +#define DEPLOYMENT_APPLICATIONMANAGER_IDL + +#include "DAnCE/Deployment/Deployment_Core.idl" +#include "DAnCE/Deployment/Deployment.idl" + +module Deployment { + + exception ResourceNotAvailable { + string name; + string resourceType; + string propertyName; + string elementName; + string resourceName; + }; + + interface ApplicationManager { + //@! 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); + }; +}; + +#endif /* DEPLOYMENT_APPLICATIONMANAGER_IDL */ diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_Base.idl b/modules/CIAO/DAnCE/Deployment/Deployment_Base.idl new file mode 100644 index 00000000000..c0db10ecb14 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_Base.idl @@ -0,0 +1,42 @@ +//$Id$ + +#ifndef DEPLOYMENT_BASE_IDL +#define DEPLOYMENT_BASE_IDL + +module Deployment { + + 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/modules/CIAO/DAnCE/Deployment/Deployment_Connection.idl b/modules/CIAO/DAnCE/Deployment/Deployment_Connection.idl new file mode 100644 index 00000000000..d054e7e4602 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_Connection.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef DEPLOYMENT_CONNECTION_IDL +#define DEPLOYMENT_CONNECTION_IDL + +#include "DAnCE/Deployment/Deployment_DeploymentPlan.idl" +//@! From DOCGroup source +//#include "ciaosvcs/Events/CIAO_Events_Base/CIAO_Events.idl" + +module Deployment +{ + 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/modules/CIAO/DAnCE/Deployment/Deployment_Core.idl b/modules/CIAO/DAnCE/Deployment/Deployment_Core.idl new file mode 100644 index 00000000000..1c1dcddc9ad --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_Core.idl @@ -0,0 +1,20 @@ +// $Id$ + +#ifndef DEPLOYMENT_CORE_IDL +#define DEPLOYMENT_CORE_IDL + +//#include "ciao/CCM_Component.idl" +#include "DAnCE/Deployment/Deployment_TargetData.idl" +#include "DAnCE/Deployment/Deployment_Data.idl" +#include "DAnCE/Deployment/Deployment_Application.idl" + +module Deployment { + + //@! in DOCGroup three additional exceptions specified + exception StopError { + string name; + string reason; + }; +}; +#endif /* DEPLOYMENT_CORE_IDL */ + diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_Data.idl b/modules/CIAO/DAnCE/Deployment/Deployment_Data.idl new file mode 100644 index 00000000000..84fa9de5a42 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_Data.idl @@ -0,0 +1,43 @@ +// $Id$ + +#ifndef DEPLOYMENT_DATA_IDL +#define DEPLOYMENT_DATA_IDL + +#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; + +}; + +#endif /* DEPLOYMENT_DATA_IDL */ + + diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_DeploymentPlan.idl b/modules/CIAO/DAnCE/Deployment/Deployment_DeploymentPlan.idl new file mode 100644 index 00000000000..e56d00f99e8 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_DeploymentPlan.idl @@ -0,0 +1,208 @@ +// $Id$ + +#ifndef DEPLOYMENT_DEPLOYMENTPLAN_IDL +#define DEPLOYMENT_DEPLOYMENTPLAN_IDL + +#include "DAnCE/Deployment/Deployment_Base.idl" +#include "tao/StringSeq.pidl" +#include "tao/ULongSeq.pidl" +#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; + 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/modules/CIAO/DAnCE/Deployment/Deployment_DomainApplication.idl b/modules/CIAO/DAnCE/Deployment/Deployment_DomainApplication.idl new file mode 100644 index 00000000000..5bc0941aca9 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_DomainApplication.idl @@ -0,0 +1,18 @@ +// $Id$ + +#ifndef DEPLOYMENT_DOMAINAPPLICATION_IDL +#define DEPLOYMENT_DOMAINAPPLICATION_IDL + +#include "DAnCE/Deployment/Deployment_Application.idl" +#include "DAnCE/Deployment/Deployment_Core.idl" + +module Deployment +{ + interface DomainApplication : + Application + { + }; +}; + + +#endif //DEPLOYMENT_DOMAINAPPLICATION_IDL diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_DomainApplicationManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_DomainApplicationManager.idl new file mode 100644 index 00000000000..37930364044 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_DomainApplicationManager.idl @@ -0,0 +1,23 @@ +// $Id$ +#ifndef DOMAINAPPLICATIONMANAGER_IDL +#define DOMAINAPPLICATIONMANAGER_IDL + +#include "DAnCE/Deployment/Deployment.idl" +#include "DAnCE/Deployment/Deployment_NodeApplication.idl" +#include "DAnCE/Deployment/Deployment_ApplicationManager.idl" + +module Deployment { + /// 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/modules/CIAO/DAnCE/Deployment/Deployment_ExecutionManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_ExecutionManager.idl new file mode 100644 index 00000000000..00d415fde49 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_ExecutionManager.idl @@ -0,0 +1,21 @@ +// $Id$ +#ifndef EXECUTIONMANAGER_IDL +#define EXECUTIONMANAGER_IDL + +#include "DAnCE/Deployment/Deployment.idl" +#include "DAnCE/Deployment/Deployment_DomainApplicationManager.idl" +#include "DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl" + +module Deployment { + //@! 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/modules/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl b/modules/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl new file mode 100644 index 00000000000..7e3900bd4dd --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_NodeApplication.idl @@ -0,0 +1,19 @@ +// $Id$ + +#ifndef DEPLOYMENT_NODEAPPLICATION_IDL +#define DEPLOYMENT_NODEAPPLICATION_IDL + +#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_NODEAPPLICATION_IDL */ + diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl new file mode 100644 index 00000000000..d0026d8408e --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_NodeApplicationManager.idl @@ -0,0 +1,16 @@ +// $Id$ +#ifndef NODEAPPLICATIONMANAGER_IDL +#define NODEAPPLICATIONMANAGER_IDL + +#include "DAnCE/Deployment/Deployment_Core.idl" +#include "DAnCE/Deployment/Deployment_ApplicationManager.idl" +#include "DAnCE/Deployment/Deployment.idl" + +module Deployment { + interface NodeApplicationManager : + ApplicationManager + { + }; +}; + +#endif /* NODEAPPLICATIONMANAGER_IDL */ diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_NodeManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_NodeManager.idl new file mode 100644 index 00000000000..f70aca19928 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_NodeManager.idl @@ -0,0 +1,35 @@ +// $Id$ +#ifndef NODEMANAGER_IDL +#define NODEMANAGER_IDL + +#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 { + }; + + //@! in DOCGroup this interface has a lot extensions + 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, InvalidReference); + + Resources getDynamicResources (); + }; +}; + +#endif /* NODEMANAGER_IDL */ diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_Packaging_Data.idl b/modules/CIAO/DAnCE/Deployment/Deployment_Packaging_Data.idl new file mode 100644 index 00000000000..e64327168f0 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_Packaging_Data.idl @@ -0,0 +1,177 @@ +// $Id$ + +#ifndef PACKAGING_DATA_IDL +#define PACKAGING_DATA_IDL + +#include "DAnCE/Deployment/Deployment_Data.idl" + +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/modules/CIAO/DAnCE/Deployment/Deployment_PlanError.idl b/modules/CIAO/DAnCE/Deployment/Deployment_PlanError.idl new file mode 100644 index 00000000000..2816db930dd --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_PlanError.idl @@ -0,0 +1,14 @@ +// $Id$ + +#ifndef DEPLOYMENT_PLANERROR_IDL +#define DEPLOYMENT_PLANERROR_IDL + +module Deployment { + + exception PlanError { + string name; + string reason; + }; +}; + +#endif /* DEPLOYMENT_PLANERROR_IDL */ diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_RepositoryManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_RepositoryManager.idl new file mode 100644 index 00000000000..5000b487590 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_RepositoryManager.idl @@ -0,0 +1,47 @@ +// $Id$ +#ifndef REPOSITORY_MANAGER_IDL +#define REPOSITORY_MANAGER_IDL + +#include "DAnCE/Deployment/Deployment_Packaging_Data.idl" +#include "DAnCE/Deployment/Deployment.idl" + +module Deployment { + + exception NameExists { + }; + + 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); + }; +}; + +#endif /* REPOSITOR_MANAGER_IDL */ diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl new file mode 100644 index 00000000000..346c2626950 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl @@ -0,0 +1,36 @@ +// $Id$ +// +#ifndef RESOURCE_COMMITMENT_MANAGER_IDL +#define RESOURCE_COMMITMENT_MANAGER_IDL + +#include "DAnCE/Deployment/Deployment_Base.idl" +#include "tao/AnyTypeCode/AnySeq.pidl" + +module Deployment { + + 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 + diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_TargetData.idl b/modules/CIAO/DAnCE/Deployment/Deployment_TargetData.idl new file mode 100644 index 00000000000..f0ec9732afd --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_TargetData.idl @@ -0,0 +1,69 @@ +//$Id$ + +#ifndef DEPLOYMENT_TARGETDATA_IDL +#define DEPLOYMENT_TARGETDATA_IDL + +#include "DAnCE/Deployment/Deployment_Base.idl" +#include "tao/StringSeq.pidl" +#include "tao/ULongSeq.pidl" + +module Deployment { + + struct Resource { + string name; + ::CORBA::StringSeq resourceType; + SatisfierProperties property; + }; + + typedef sequence < Resource > Resources; + + 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 Interconnect { + string name; + string label; + ::CORBA::ULongSeq connectionRef; + ::CORBA::ULongSeq connectRef; + Resources resource; + }; + + 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/modules/CIAO/DAnCE/Deployment/Deployment_TargetManager.idl b/modules/CIAO/DAnCE/Deployment/Deployment_TargetManager.idl new file mode 100644 index 00000000000..d313227a352 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_TargetManager.idl @@ -0,0 +1,39 @@ +// $Id$ + +#ifndef TARGETMANAGER_IDL +#define TARGETMANAGER_IDL + +#include "DAnCE/Deployment/Deployment_PlanError.idl" +#include "DAnCE/Deployment/Deployment_TargetData.idl" +#include "DAnCE/Deployment/Deployment_DeploymentPlan.idl" +// Only needed for ResourceNotAvailable but that should go, so this include also +#include "DAnCE/Deployment/Deployment_ApplicationManager.idl" +#include "DAnCE/Deployment/Deployment_ResourceCommitmentManager.idl" + +module Deployment { + enum DomainUpdateKind { + Add, + Delete, + UpdateAll, + UpdateDynamic + }; + + interface TargetManager { + + Domain getAllResources (); + + Domain getAvailableResources (); + + //@! in DOCGroup renamed to createResourceCommitment + ResourceCommitmentManager commitResources (in ResourceAllocations resources) + raises (ResourceCommitmentFailure); + + void destroyResourceCommitment (in ResourceCommitmentManager manager); + + void updateDomain ( in ::CORBA::StringSeq elements, + in Domain domainSubset, + in DomainUpdateKind updateKind); + }; +}; + +#endif /* TARGETMANAGER_IDL */ diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_common.h b/modules/CIAO/DAnCE/Deployment/Deployment_common.h new file mode 100644 index 00000000000..dfd44797069 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_common.h @@ -0,0 +1,63 @@ +// $Id$ + +/** + * @file Deployment_common.h + * + * This file collects common type definitions used across different + * objects of DAnCE toolchain. + * + * @author Gan Deng <dengg@dre.vanderbilt.edu> + */ + +#ifndef DANCE_COMMON_H +#define DANCE_COMMON_H +#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 +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +/// A struct which captures the binding information about a component + +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 + { + _component_binding () + { + providedReference_ = 0; + } + + ACE_CString name_; + ACE_CString plan_uuid_; + ACE_CString node_; + + Deployment::Connections_var providedReference_; + + bool operator==(const struct _component_binding & comp) + { + if (this->name_ == comp.name_ && + this->plan_uuid_ == comp.plan_uuid_ && + this->node_ == comp.node_) + return true; + else + return false; + } + } Component_Binding_Info; +} + +#include /**/ "ace/post.h" +#endif /* DANCE_COMMON_H */ diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_stub_export.h b/modules/CIAO/DAnCE/Deployment/Deployment_stub_export.h new file mode 100644 index 00000000000..12985a68b5b --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s Deployment_stub +// ------------------------------ +#ifndef DEPLOYMENT_STUB_EXPORT_H +#define DEPLOYMENT_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DEPLOYMENT_STUB_HAS_DLL) +# define DEPLOYMENT_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DEPLOYMENT_STUB_HAS_DLL */ + +#if !defined (DEPLOYMENT_STUB_HAS_DLL) +# define DEPLOYMENT_STUB_HAS_DLL 1 +#endif /* ! DEPLOYMENT_STUB_HAS_DLL */ + +#if defined (DEPLOYMENT_STUB_HAS_DLL) && (DEPLOYMENT_STUB_HAS_DLL == 1) +# if defined (DEPLOYMENT_STUB_BUILD_DLL) +# define Deployment_stub_Export ACE_Proper_Export_Flag +# define DEPLOYMENT_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DEPLOYMENT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DEPLOYMENT_STUB_BUILD_DLL */ +# define Deployment_stub_Export ACE_Proper_Import_Flag +# define DEPLOYMENT_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DEPLOYMENT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DEPLOYMENT_STUB_BUILD_DLL */ +#else /* DEPLOYMENT_STUB_HAS_DLL == 1 */ +# define Deployment_stub_Export +# define DEPLOYMENT_STUB_SINGLETON_DECLARATION(T) +# define DEPLOYMENT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DEPLOYMENT_STUB_HAS_DLL == 1 */ + +// Set DEPLOYMENT_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DEPLOYMENT_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define DEPLOYMENT_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DEPLOYMENT_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DEPLOYMENT_STUB_NTRACE */ + +#if (DEPLOYMENT_STUB_NTRACE == 1) +# define DEPLOYMENT_STUB_TRACE(X) +#else /* (DEPLOYMENT_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DEPLOYMENT_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DEPLOYMENT_STUB_NTRACE == 1) */ + +#endif /* DEPLOYMENT_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Deployment/Deployment_svnt_export.h b/modules/CIAO/DAnCE/Deployment/Deployment_svnt_export.h new file mode 100644 index 00000000000..e403dbf0c41 --- /dev/null +++ b/modules/CIAO/DAnCE/Deployment/Deployment_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s Deployment_svnt +// ------------------------------ +#ifndef DEPLOYMENT_SVNT_EXPORT_H +#define DEPLOYMENT_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DEPLOYMENT_SVNT_HAS_DLL) +# define DEPLOYMENT_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DEPLOYMENT_SVNT_HAS_DLL */ + +#if !defined (DEPLOYMENT_SVNT_HAS_DLL) +# define DEPLOYMENT_SVNT_HAS_DLL 1 +#endif /* ! DEPLOYMENT_SVNT_HAS_DLL */ + +#if defined (DEPLOYMENT_SVNT_HAS_DLL) && (DEPLOYMENT_SVNT_HAS_DLL == 1) +# if defined (DEPLOYMENT_SVNT_BUILD_DLL) +# define Deployment_svnt_Export ACE_Proper_Export_Flag +# define DEPLOYMENT_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DEPLOYMENT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DEPLOYMENT_SVNT_BUILD_DLL */ +# define Deployment_svnt_Export ACE_Proper_Import_Flag +# define DEPLOYMENT_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DEPLOYMENT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DEPLOYMENT_SVNT_BUILD_DLL */ +#else /* DEPLOYMENT_SVNT_HAS_DLL == 1 */ +# define Deployment_svnt_Export +# define DEPLOYMENT_SVNT_SINGLETON_DECLARATION(T) +# define DEPLOYMENT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DEPLOYMENT_SVNT_HAS_DLL == 1 */ + +// Set DEPLOYMENT_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DEPLOYMENT_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define DEPLOYMENT_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DEPLOYMENT_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DEPLOYMENT_SVNT_NTRACE */ + +#if (DEPLOYMENT_SVNT_NTRACE == 1) +# define DEPLOYMENT_SVNT_TRACE(X) +#else /* (DEPLOYMENT_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DEPLOYMENT_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DEPLOYMENT_SVNT_NTRACE == 1) */ + +#endif /* DEPLOYMENT_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Deployment/Module_Main.h b/modules/CIAO/DAnCE/Deployment/Module_Main.h new file mode 100644 index 00000000000..cba4ba4d5e3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/DomainApplication/DomainApplication.mpc b/modules/CIAO/DAnCE/DomainApplication/DomainApplication.mpc new file mode 100644 index 00000000000..93faa7576f9 --- /dev/null +++ b/modules/CIAO/DAnCE/DomainApplication/DomainApplication.mpc @@ -0,0 +1,13 @@ +// -*- MPC -*- +// $Id$ + + +project: dance_lib, taolib, ciao_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/modules/CIAO/DAnCE/DomainApplication/Domain_Application_Export.h b/modules/CIAO/DAnCE/DomainApplication/Domain_Application_Export.h new file mode 100644 index 00000000000..fe9b0133ebb --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.cpp b/modules/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.cpp new file mode 100644 index 00000000000..b9adc2da088 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.h b/modules/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.h new file mode 100644 index 00000000000..8faeedd5ee9 --- /dev/null +++ b/modules/CIAO/DAnCE/DomainApplication/Domain_Application_Impl.h @@ -0,0 +1,81 @@ +// $Id$ +/**======================================================== + * + * @file Domain_Application_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/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager.mpc b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager.mpc new file mode 100644 index 00000000000..08057fe2f04 --- /dev/null +++ b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager.mpc @@ -0,0 +1,19 @@ +// -*- MPC -*- +// $Id$ + +project : dance_lib, taolib, ciao_output, dance_domain_application, naming { + sharedname = DAnCE_DomainApplicationManager + dynamicflags = DOMAINAPPLICATIONMANAGER_BUILD_DLL + + Source_Files { + DomainApplicationManager_Impl.cpp + Node_Locator.cpp + } + + Header_Files { + Node_Locator.h + DomainApplicationManager_Impl.h + DomainApplicationManager_Export.h + } +} + diff --git a/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Export.h b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Export.h new file mode 100644 index 00000000000..31fa9b914b7 --- /dev/null +++ b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s DomainApplicationManager +// ------------------------------ +#ifndef DOMAINAPPLICATIONMANAGER_EXPORT_H +#define DOMAINAPPLICATIONMANAGER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DOMAINAPPLICATIONMANAGER_HAS_DLL) +# define DOMAINAPPLICATIONMANAGER_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DOMAINAPPLICATIONMANAGER_HAS_DLL */ + +#if !defined (DOMAINAPPLICATIONMANAGER_HAS_DLL) +# define DOMAINAPPLICATIONMANAGER_HAS_DLL 1 +#endif /* ! DOMAINAPPLICATIONMANAGER_HAS_DLL */ + +#if defined (DOMAINAPPLICATIONMANAGER_HAS_DLL) && (DOMAINAPPLICATIONMANAGER_HAS_DLL == 1) +# if defined (DOMAINAPPLICATIONMANAGER_BUILD_DLL) +# define DomainApplicationManager_Export ACE_Proper_Export_Flag +# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DOMAINAPPLICATIONMANAGER_BUILD_DLL */ +# define DomainApplicationManager_Export ACE_Proper_Import_Flag +# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DOMAINAPPLICATIONMANAGER_BUILD_DLL */ +#else /* DOMAINAPPLICATIONMANAGER_HAS_DLL == 1 */ +# define DomainApplicationManager_Export +# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) +# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DOMAINAPPLICATIONMANAGER_HAS_DLL == 1 */ + +// Set DOMAINAPPLICATIONMANAGER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DOMAINAPPLICATIONMANAGER_NTRACE) +# if (ACE_NTRACE == 1) +# define DOMAINAPPLICATIONMANAGER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DOMAINAPPLICATIONMANAGER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DOMAINAPPLICATIONMANAGER_NTRACE */ + +#if (DOMAINAPPLICATIONMANAGER_NTRACE == 1) +# define DOMAINAPPLICATIONMANAGER_TRACE(X) +#else /* (DOMAINAPPLICATIONMANAGER_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DOMAINAPPLICATIONMANAGER_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DOMAINAPPLICATIONMANAGER_NTRACE == 1) */ + +#endif /* DOMAINAPPLICATIONMANAGER_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp new file mode 100644 index 00000000000..b9956127f84 --- /dev/null +++ b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp @@ -0,0 +1,500 @@ +// $Id$ + +#include "DomainApplicationManager_Impl.h" +#include "Deployment/Deployment_ConnectionC.h" +#include "DAnCE/Logger/Log_Macros.h" + +using namespace DAnCE; + +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) +{ + 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())); +} + +DomainApplicationManager_Impl::~DomainApplicationManager_Impl() +{ + 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()) + { + 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; + } + + 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) + { + (*iter).int_id_->destroyManager ( (*iter).ext_id_.in()); + } + this->sub_app_mgr_.unbind_all(); +} + +Deployment::Application_ptr +DomainApplicationManager_Impl::startLaunch (const Deployment::Properties & configProperty, + Deployment::Connections_out providedReference) +{ + DANCE_TRACE( "DomainApplicationManager_impl::startLaunch"); + + ::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()); + + providedReference = connections._retn(); + + PortableServer::ObjectId_var id = this->poa_->activate_object (app); + this->running_app_.push_back(app); + + 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 ())); + + CORBA::Object_var ref = this->poa_->id_to_reference (id); + return Deployment::DomainApplication::_narrow (ref.in ()); +} + +void +DomainApplicationManager_Impl::destroyApplication (Deployment::Application_ptr application) +{ + DANCE_TRACE ( "DomainApplicationManager_Impl::destroyApplication"); + + try + { + for (size_t i = 0; i < this->running_app_.size(); ++i) + { + 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())) + { + 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; + } + } + } + catch (const Deployment::StopError &e) + { + ACE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "Propagating a received StopError exception\n")); + throw e; + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "Caught unknown exception.")); + throw Deployment::StopError(); + } + + ACE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_impl::destroyApplication - " + "Provided application reference unknown\n")); + throw Deployment::StopError(); +} + +::Deployment::Applications * +DomainApplicationManager_Impl::getApplications () +{ + DANCE_TRACE ( "DomainApplicationManager_Impl::getApplications ()"); + + 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) + { + CORBA::Object_var ref = this->poa_->servant_to_reference (this->running_app_[i]); + (*running_app) [index++] = + Deployment::DomainApplication::_narrow (ref.in ()); + } + + DANCE_DEBUG((LM_DEBUG, DLINFO "DomainApplicationManager_impl::getApplications - " + "Returning %u running applications\n", + running_app->length ())); + return running_app; +} + +::Deployment::DeploymentPlan * +DomainApplicationManager_Impl::getPlan () +{ + DANCE_TRACE ( DLINFO "DomainApplicationManager_Impl::getPlan ()"); + + Deployment::DeploymentPlan* plan = 0; + + ACE_NEW_THROW_EX (plan, + Deployment::DeploymentPlan (this->plan_), + CORBA::NO_MEMORY()); + + return plan; +} + +// 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")); + + // 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 ())); + // + // DANCE_DEBUG((LM_DEBUG, "[%M] portkind: ")); + // + // 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")); + // } + + DANCE_DEBUG((LM_DEBUG, DLINFO "DomainApplicationManager_impl::dump_connections - finished\n")); +} + +void +DomainApplicationManager_Impl::split_plan (const Deployment::DeploymentPlan & plan, + TNodePlans & sub_plans) +{ + DANCE_TRACE ( "DomainApplicationManager_Impl::split_plan"); + + 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; + + ::Deployment::DeploymentPlan tmp_plan; + + // 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; + + 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 = plan.infoProperty; + + sub_plans.bind (node, tmp_plan); + + 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 ())); + } + + 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 (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 = plan.instance[i]; + + // Get the 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. + + // 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 + = 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; + + // 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] = 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_imp - 1; + + DANCE_DEBUG ((LM_TRACE, DLINFO "DomainApplicationManager_Impl::split_plan - " + "Processing connections.\n")); + // Copy connections + for (CORBA::ULong j = 0; j < plan.connection.length(); ++j) + { + 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) + { + 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 + { + 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; + } + } + } + sub_plans.rebind (ACE_CString (my_instance.node.in()), child_plan); + } + + //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) + { + 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_); + } + DANCE_DEBUG ((LM_DEBUG, DLINFO "DomainApplicationManager_Impl::split_plan - " + "Child plans connection count : %u\n", cnt)); +} + +void +DomainApplicationManager_Impl::preparePlan() +{ + DANCE_TRACE ("DomainApplicationManager_Impl::preparePlan()"); + + try + { + // 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) + { + // 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 ())) + { + 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"); + } + + // 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())); + + Deployment::NodeApplicationManager_ptr nam + = nm->preparePlan ( (*iter_plans).int_id_, + Deployment::ResourceCommitmentManager::_nil()); + + if (CORBA::is_nil (nam)) + { + 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); + + DANCE_DEBUG ((LM_INFO, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Sucessfully prepared node %C for deployment\n", + (*iter_plans).ext_id_.c_str())); + } + } + catch (Deployment::StartError &e) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Propagating StartError exception caught here\n")); + throw e; + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Caught a CORBA exception, propagating StartError: %s\n", + ex._info ().c_str ())); + throw ::Deployment::StartError (); + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DomainApplicationManager_Impl::preparePlan - " + "Caught unknown exception. Propagating StartError\n")); + throw ::Deployment::StartError (); + } +} + + + + diff --git a/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h new file mode 100644 index 00000000000..7fcab5a2091 --- /dev/null +++ b/modules/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h @@ -0,0 +1,73 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DomainApplicationManager_Impl.h + * + * $Id$ + * + * @Brief Implementation of POA_Deployment::DomainApplicationManager + * + * @author Erwin Gottlieb <eg@prismtech.com> + */ +//============================================================================= + +#ifndef DOMAINAPPLICATIONMANAGER_IMPL_H_ +#define DOMAINAPPLICATIONMANAGER_IMPL_H_ + +#include "ace/Vector_T.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 DAnCE + { + class DomainApplicationManager_Export DomainApplicationManager_Impl + : public virtual POA_Deployment::DomainApplicationManager + { + private: + typedef ACE_Map_Manager<ACE_CString, Deployment::DeploymentPlan, ACE_Null_Mutex> TNodePlans; + + public: + DomainApplicationManager_Impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const Deployment::DeploymentPlan& plan, + Node_Locator &nodes); + + virtual ~DomainApplicationManager_Impl(); + + virtual Deployment::Application_ptr + startLaunch (const Deployment::Properties & configProperty, + Deployment::Connections_out providedReference); + + virtual void destroyApplication (Deployment::Application_ptr); + + virtual ::Deployment::Applications * getApplications (void); + + virtual ::Deployment::DeploymentPlan * getPlan (void); + + void dump_connections (const ::Deployment::Connections & connections) const; + + 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_; + + static void split_plan (const Deployment::DeploymentPlan & plan, + TNodePlans & sub_plans); + + void preparePlan(); + }; + +}//DAnCE + +#endif /*DOMAINAPPLICATIONMANAGER_IMPL_H_*/ diff --git a/modules/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp b/modules/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp new file mode 100644 index 00000000000..12db00a8530 --- /dev/null +++ b/modules/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 = "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/modules/CIAO/DAnCE/DomainApplicationManager/Node_Locator.h b/modules/CIAO/DAnCE/DomainApplicationManager/Node_Locator.h new file mode 100644 index 00000000000..f3255d0c230 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/ExecutionManager/DAnCE_ExecutionManager_Module_Export.h b/modules/CIAO/DAnCE/ExecutionManager/DAnCE_ExecutionManager_Module_Export.h new file mode 100644 index 00000000000..6ab710d4044 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc b/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc new file mode 100644 index 00000000000..3230e91fb17 --- /dev/null +++ b/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc @@ -0,0 +1,23 @@ +// -*- MPC -*- +// $Id$ + +project(ExecutionManager_Module): dance_lib, taolib, iortable, ciao_output, utils, strategies, naming, dance_executionmanager_stub, dance_domain_application_manager, dance_deployment_svnt, avoids_minimum_corba { + 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, utils, avoids_minimum_corba { + exename = dance_execution_manager + after += ExecutionManager_Module + libs += DAnCE_ExecutionManager + + Source_Files { + Execution_Manager_Exec.cpp + } +} diff --git a/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Export.h b/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Export.h new file mode 100644 index 00000000000..8633f5d5400 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.cpp b/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.cpp new file mode 100644 index 00000000000..7dd4ba032cb --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.h b/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Impl.h new file mode 100644 index 00000000000..ac4bbcedfa1 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.cpp b/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.cpp new file mode 100644 index 00000000000..7d27710e0db --- /dev/null +++ b/modules/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 (ACE_TEXT("exec-mgr"), 'e', ACE_Get_Opt::ARG_OPTIONAL); + 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("help"), 'h', ACE_Get_Opt::NO_ARG); + get_opts.long_option (ACE_TEXT("node-map"), ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("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/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.h b/modules/CIAO/DAnCE/ExecutionManager/ExecutionManager_Module.h new file mode 100644 index 00000000000..869c2b093d4 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/ExecutionManager/Execution_Manager_Exec.cpp b/modules/CIAO/DAnCE/ExecutionManager/Execution_Manager_Exec.cpp new file mode 100644 index 00000000000..2331ec167df --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Interfaces/ExecutionManagerDaemon.idl b/modules/CIAO/DAnCE/Interfaces/ExecutionManagerDaemon.idl new file mode 100644 index 00000000000..ce88a04a818 --- /dev/null +++ b/modules/CIAO/DAnCE/Interfaces/ExecutionManagerDaemon.idl @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file ExecutionManagerDaemon.idl + * + * @brief Simple interface to control the ExecutionManager. This + * interface currently provides an additional method called shutdown + * to terminate the process cleanly. + */ + +#include "DAnCE/Deployment/Deployment_ExecutionManager.idl" + +module DAnCE +{ + /** + * @brief CIAO Execution Manager Program + * + * This feature addition is added using inheritance mechanism currently + */ + interface ExecutionManagerDaemon : Deployment::ExecutionManager + { + // Shutdown the daemon process. + oneway void shutdown (); + }; +}; diff --git a/modules/CIAO/DAnCE/Interfaces/ExecutionManager_stub_export.h b/modules/CIAO/DAnCE/Interfaces/ExecutionManager_stub_export.h new file mode 100644 index 00000000000..f32c91c5e6e --- /dev/null +++ b/modules/CIAO/DAnCE/Interfaces/ExecutionManager_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ExecutionManager_stub +// ------------------------------ +#ifndef EXECUTIONMANAGER_STUB_EXPORT_H +#define EXECUTIONMANAGER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (EXECUTIONMANAGER_STUB_HAS_DLL) +# define EXECUTIONMANAGER_STUB_HAS_DLL 1 +#endif /* ! EXECUTIONMANAGER_STUB_HAS_DLL */ + +#if defined (EXECUTIONMANAGER_STUB_HAS_DLL) && (EXECUTIONMANAGER_STUB_HAS_DLL == 1) +# if defined (EXECUTIONMANAGER_STUB_BUILD_DLL) +# define ExecutionManager_stub_Export ACE_Proper_Export_Flag +# define EXECUTIONMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define EXECUTIONMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* EXECUTIONMANAGER_STUB_BUILD_DLL */ +# define ExecutionManager_stub_Export ACE_Proper_Import_Flag +# define EXECUTIONMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define EXECUTIONMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* EXECUTIONMANAGER_STUB_BUILD_DLL */ +#else /* EXECUTIONMANAGER_STUB_HAS_DLL == 1 */ +# define ExecutionManager_stub_Export +# define EXECUTIONMANAGER_STUB_SINGLETON_DECLARATION(T) +# define EXECUTIONMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* EXECUTIONMANAGER_STUB_HAS_DLL == 1 */ + +// Set EXECUTIONMANAGER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (EXECUTIONMANAGER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define EXECUTIONMANAGER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define EXECUTIONMANAGER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !EXECUTIONMANAGER_STUB_NTRACE */ + +#if (EXECUTIONMANAGER_STUB_NTRACE == 1) +# define EXECUTIONMANAGER_STUB_TRACE(X) +#else /* (EXECUTIONMANAGER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define EXECUTIONMANAGER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (EXECUTIONMANAGER_STUB_NTRACE == 1) */ + +#endif /* EXECUTIONMANAGER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Interfaces/Interfaces.mpc b/modules/CIAO/DAnCE/Interfaces/Interfaces.mpc new file mode 100644 index 00000000000..9917cda96b3 --- /dev/null +++ b/modules/CIAO/DAnCE/Interfaces/Interfaces.mpc @@ -0,0 +1,63 @@ +// -*- MPC -*- +// $Id$ + +project (DAnCE_ExecutionManager_idl): ciaoidldefaults, anytypecode { + custom_only = 1 + idlflags += -Wb,stub_export_macro=ExecutionManager_stub_Export + idlflags += -Wb,stub_export_include=ExecutionManager_stub_export.h + 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 { + } + + Source_Files { + ExecutionManagerDaemonC.cpp + } +} + +project (DAnCE_NodeManager_idl): ciaoidldefaults, 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 + 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 { + } + + 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/modules/CIAO/DAnCE/Interfaces/NodeManagerDaemon.idl b/modules/CIAO/DAnCE/Interfaces/NodeManagerDaemon.idl new file mode 100644 index 00000000000..540ca31a3c6 --- /dev/null +++ b/modules/CIAO/DAnCE/Interfaces/NodeManagerDaemon.idl @@ -0,0 +1,35 @@ +// $Id$ + +/** + * @file NodeManagerDaemon.idl + * + * @brief Controling interface for managing and controling CIAO daemon. + */ + +#include "DAnCE/Deployment/Deployment_NodeManager.idl" +#include "DAnCE/Deployment/Deployment_NodeApplicationManager.idl" + +module DAnCE +{ + /** + * @brief CIAO daemon process control program. + * + * @@The Inheritage might cause binary code bloating but + * it's an easy way of combining features. In the future we could + * move this definition into Deployment.idl. + */ + interface NodeManagerDaemon : Deployment::NodeManager + { + // Canonical name of this daemon + readonly attribute string name; + + // Shutdown the daemon process. + oneway void shutdown (); + + /// 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); + }; +}; diff --git a/modules/CIAO/DAnCE/Interfaces/NodeManager_stub_export.h b/modules/CIAO/DAnCE/Interfaces/NodeManager_stub_export.h new file mode 100644 index 00000000000..3e708b0ab1f --- /dev/null +++ b/modules/CIAO/DAnCE/Interfaces/NodeManager_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NodeManager_stub +// ------------------------------ +#ifndef NODEMANAGER_STUB_EXPORT_H +#define NODEMANAGER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (NODEMANAGER_STUB_HAS_DLL) +# define NODEMANAGER_STUB_HAS_DLL 1 +#endif /* ! NODEMANAGER_STUB_HAS_DLL */ + +#if defined (NODEMANAGER_STUB_HAS_DLL) && (NODEMANAGER_STUB_HAS_DLL == 1) +# if defined (NODEMANAGER_STUB_BUILD_DLL) +# define NodeManager_stub_Export ACE_Proper_Export_Flag +# define NODEMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define NODEMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* NODEMANAGER_STUB_BUILD_DLL */ +# define NodeManager_stub_Export ACE_Proper_Import_Flag +# define NODEMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define NODEMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* NODEMANAGER_STUB_BUILD_DLL */ +#else /* NODEMANAGER_STUB_HAS_DLL == 1 */ +# define NodeManager_stub_Export +# define NODEMANAGER_STUB_SINGLETON_DECLARATION(T) +# define NODEMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NODEMANAGER_STUB_HAS_DLL == 1 */ + +// Set NODEMANAGER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NODEMANAGER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define NODEMANAGER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NODEMANAGER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NODEMANAGER_STUB_NTRACE */ + +#if (NODEMANAGER_STUB_NTRACE == 1) +# define NODEMANAGER_STUB_TRACE(X) +#else /* (NODEMANAGER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define NODEMANAGER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (NODEMANAGER_STUB_NTRACE == 1) */ + +#endif /* NODEMANAGER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Interfaces/NodeManager_svnt_export.h b/modules/CIAO/DAnCE/Interfaces/NodeManager_svnt_export.h new file mode 100644 index 00000000000..199168ef44d --- /dev/null +++ b/modules/CIAO/DAnCE/Interfaces/NodeManager_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NodeManager_svnt +// ------------------------------ +#ifndef NODEMANAGER_SVNT_EXPORT_H +#define NODEMANAGER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (NODEMANAGER_SVNT_HAS_DLL) +# define NODEMANAGER_SVNT_HAS_DLL 1 +#endif /* ! NODEMANAGER_SVNT_HAS_DLL */ + +#if defined (NODEMANAGER_SVNT_HAS_DLL) && (NODEMANAGER_SVNT_HAS_DLL == 1) +# if defined (NODEMANAGER_SVNT_BUILD_DLL) +# define NodeManager_svnt_Export ACE_Proper_Export_Flag +# define NODEMANAGER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define NODEMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* NODEMANAGER_SVNT_BUILD_DLL */ +# define NodeManager_svnt_Export ACE_Proper_Import_Flag +# define NODEMANAGER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define NODEMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* NODEMANAGER_SVNT_BUILD_DLL */ +#else /* NODEMANAGER_SVNT_HAS_DLL == 1 */ +# define NodeManager_svnt_Export +# define NODEMANAGER_SVNT_SINGLETON_DECLARATION(T) +# define NODEMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NODEMANAGER_SVNT_HAS_DLL == 1 */ + +// Set NODEMANAGER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NODEMANAGER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define NODEMANAGER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NODEMANAGER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NODEMANAGER_SVNT_NTRACE */ + +#if (NODEMANAGER_SVNT_NTRACE == 1) +# define NODEMANAGER_SVNT_TRACE(X) +#else /* (NODEMANAGER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define NODEMANAGER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (NODEMANAGER_SVNT_NTRACE == 1) */ + +#endif /* NODEMANAGER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Interfaces/README b/modules/CIAO/DAnCE/Interfaces/README new file mode 100644 index 00000000000..e2ca262a62f --- /dev/null +++ b/modules/CIAO/DAnCE/Interfaces/README @@ -0,0 +1,2 @@ +To resolve the MPC issue of directory dependency, we have to put some IDL +files into a separate directory. This directory serves for this purpose. diff --git a/modules/CIAO/DAnCE/Logger/DAnCELoggerFactory.h b/modules/CIAO/DAnCE/Logger/DAnCELoggerFactory.h new file mode 100644 index 00000000000..f2ed4800950 --- /dev/null +++ b/modules/CIAO/DAnCE/Logger/DAnCELoggerFactory.h @@ -0,0 +1,19 @@ +// $Id$ +#ifndef DAnCE_LOGGERFACTORY_BASE_H_ +#define DAnCE_LOGGERFACTORY_BASE_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/modules/CIAO/DAnCE/Logger/DAnCE_Logger_Export.h b/modules/CIAO/DAnCE/Logger/DAnCE_Logger_Export.h new file mode 100644 index 00000000000..e8e7cb3c81a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Logger/File_Logger_Backend.cpp b/modules/CIAO/DAnCE/Logger/File_Logger_Backend.cpp new file mode 100644 index 00000000000..64690544947 --- /dev/null +++ b/modules/CIAO/DAnCE/Logger/File_Logger_Backend.cpp @@ -0,0 +1,46 @@ +// $Id$ +#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/modules/CIAO/DAnCE/Logger/File_Logger_Backend.h b/modules/CIAO/DAnCE/Logger/File_Logger_Backend.h new file mode 100644 index 00000000000..abcabe86872 --- /dev/null +++ b/modules/CIAO/DAnCE/Logger/File_Logger_Backend.h @@ -0,0 +1,50 @@ +// $Id$ +#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/modules/CIAO/DAnCE/Logger/Log_Macros.h b/modules/CIAO/DAnCE/Logger/Log_Macros.h new file mode 100644 index 00000000000..828ebe6c9f4 --- /dev/null +++ b/modules/CIAO/DAnCE/Logger/Log_Macros.h @@ -0,0 +1,90 @@ +/** + * @file Log_Macros.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * // $Id$ + * 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/modules/CIAO/DAnCE/Logger/Logger.mpc b/modules/CIAO/DAnCE/Logger/Logger.mpc new file mode 100644 index 00000000000..c6e9436b9ac --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Logger/Logger_Service.cpp b/modules/CIAO/DAnCE/Logger/Logger_Service.cpp new file mode 100644 index 00000000000..d8e9d2b5097 --- /dev/null +++ b/modules/CIAO/DAnCE/Logger/Logger_Service.cpp @@ -0,0 +1,159 @@ +// $Id$ +#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 (ACE_TEXT("DANCE_LOG_LEVEL"), this->log_level_); + + this->log_level_ = log; + + ACE_Env_Value<int> trace (ACE_TEXT("DANCE_TRACE_ENABLE"), this->trace_); + this->trace_ = trace; + + ACE_Env_Value<const char *> filename (ACE_TEXT("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, ACE_TCHAR **argv) + { + const ACE_TCHAR *shortl = ACE_TEXT("-l"); + const ACE_TCHAR *longl = ACE_TEXT("--log-level"); + const ACE_TCHAR *tracel = ACE_TEXT("--trace"); + // const ACE_TCHAR *traces = "-t"; + const ACE_TCHAR *lfl = ACE_TEXT("--log-file"); + const ACE_TCHAR *lfs = ACE_TEXT("-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_ = ACE_TEXT_ALWAYS_CHAR (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/modules/CIAO/DAnCE/Logger/Logger_Service.h b/modules/CIAO/DAnCE/Logger/Logger_Service.h new file mode 100644 index 00000000000..2832fdf209c --- /dev/null +++ b/modules/CIAO/DAnCE/Logger/Logger_Service.h @@ -0,0 +1,31 @@ +// $Id$ +#ifndef LOGGER_SERVICE_H_ +#define LOGGER_SERVICE_H_ + +#include "DAnCE/Logger/DAnCE_Logger_Export.h" +#include "DAnCE/Logger/DAnCELoggerFactory.h" +#include "DAnCE/Logger/File_Logger_Backend.h" + +namespace DAnCE + { + + class DAnCE_Logger_Export Logger_Service : public ::DAnCE::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/modules/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.cpp b/modules/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.cpp new file mode 100644 index 00000000000..a93cbeff4f1 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.h b/modules/CIAO/DAnCE/NodeApplication/ComponentAttributesSetter.h new file mode 100644 index 00000000000..2a36da17cfd --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeApplication/Name_Utilities.cpp b/modules/CIAO/DAnCE/NodeApplication/Name_Utilities.cpp new file mode 100644 index 00000000000..2134f278d55 --- /dev/null +++ b/modules/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) + 1]); + + 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/modules/CIAO/DAnCE/NodeApplication/Name_Utilities.h b/modules/CIAO/DAnCE/NodeApplication/Name_Utilities.h new file mode 100644 index 00000000000..20a7efd5c45 --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplication/Name_Utilities.h @@ -0,0 +1,42 @@ +/** + * @file Name_Utilities.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * // $Id$ + * 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/modules/CIAO/DAnCE/NodeApplication/NodeApplication.mpc b/modules/CIAO/DAnCE/NodeApplication/NodeApplication.mpc new file mode 100644 index 00000000000..9ebd5b13356 --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplication/NodeApplication.mpc @@ -0,0 +1,29 @@ +// -*- MPC -*- +// $Id$ + +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 + + +Source_Files { +// ComponentInstallation_Impl.cpp +// ServerActivator_Impl.cpp + NodeApplication_Impl.cpp + ComponentAttributesSetter.cpp + Name_Utilities.cpp + } + Header_Files { +// ComponentInstallation_Impl.h +// ServerActivator_Impl.h + NodeApplication_Impl.h + ComponentAttributesSetter.h + Name_Utilities.h + } +} + + + diff --git a/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Export.h b/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Export.h new file mode 100644 index 00000000000..bf2c6d7a5cb --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NodeApplication +// ------------------------------ +#ifndef NODEAPPLICATION_EXPORT_H +#define NODEAPPLICATION_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPPLICATION_HAS_DLL) +# define NODEAPPLICATION_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && NODEAPPLICATION_HAS_DLL */ + +#if !defined (NODEAPPLICATION_HAS_DLL) +# define NODEAPPLICATION_HAS_DLL 1 +#endif /* ! NODEAPPLICATION_HAS_DLL */ + +#if defined (NODEAPPLICATION_HAS_DLL) && (NODEAPPLICATION_HAS_DLL == 1) +# if defined (NODEAPPLICATION_BUILD_DLL) +# 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_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_SINGLETON_DECLARATION(T) +# define NODEAPPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NODEAPPLICATION_HAS_DLL == 1 */ + +// Set NODEAPPLICATION_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NODEAPPLICATION_NTRACE) +# if (ACE_NTRACE == 1) +# define NODEAPPLICATION_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NODEAPPLICATION_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NODEAPPLICATION_NTRACE */ + +#if (NODEAPPLICATION_NTRACE == 1) +# define NODEAPPLICATION_TRACE(X) +#else /* (NODEAPPLICATION_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define NODEAPPLICATION_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (NODEAPPLICATION_NTRACE == 1) */ + +#endif /* NODEAPPLICATION_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp new file mode 100644 index 00000000000..b242c1a24af --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp @@ -0,0 +1,2165 @@ +// $Id$ +#include "NodeApplication_Impl.h" + +#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_ComponentInstallation_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)); + + 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; + } + } + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Property value for name '%C' has no value\n", name)); + + return false; + } + + template<> + bool get_property_value (const char *name, PROPERTY_MAP &properties, bool &val) + { + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<bool>"); + CORBA::Any any; + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Finding property value for name '%C'\n", + name)); + + 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; + } + } + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Property value for name '%C' has no value\n", name)); + + return false; + } + + 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; + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Finding property value for name '%C'\n", + name)); + + 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; + } + } + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<bool> - " + "Property value for name '%C' has no value\n", name)); + + return false; + } + + template<class T> + bool get_property_value (const char *name, const Deployment::Properties &properties, T &val) + { + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<T>"); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Finding property value for name '%C'\n", + name)); + + 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; + } + } + } + + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Property value for name '%C' has no value\n", name)); + + return false; + } + + template<> + bool get_property_value (const char *name, const Deployment::Properties &properties, const char * &val) + { + DANCE_TRACE ("NodeApplicion::<anonymous>::get_property_value<const char *>"); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Finding property value for name '%C'\n", + name)); + + 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 >>= 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; + } + } + } + + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplicion::<anonymous>::get_property_value<T> - " + "Unable to find property named %C\n", name)); + + return false; + } + + /// 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 (!flag) + { + flag = true; + exception.name = name; + exception.reason = reason; + } + } + + const char * get_artifact_location (const char * name, + const ::Deployment::ArtifactDeploymentDescriptions &art) + { + DANCE_TRACE ("NodeApplication::<anonymous>::get_artifact_location"); + + for (CORBA::ULong i = 0; i < art.length (); ++i) + { + if (ACE_OS::strcmp (name, art[0].name.in ()) == 0) + return art[0].location[0].in (); + } + + return 0; + } +} + + +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 (); +} + +NodeApplication_Impl::~NodeApplication_Impl() +{ + DANCE_TRACE( "NodeApplication_Impl::~NodeApplication_Impl()"); + + using namespace Components; + ConfigValues config_values; + config_values.length (1L); + CORBA::Any feature_any; + + 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]; + + 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 + { + if (!CORBA::is_nil (container.ref)) + 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)); + } + } + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Removing component server %u\n", i)); + + try + { + if (!CORBA::is_nil (server.ref)) + 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)); + } + + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::~NodeApplication_Impl - " + "Successfully removed container %u on node %C.\n", + i, this->node_name_.c_str ())); + } + } +} + +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::ComponentInstallation_Impl *tmp_ci; + + ACE_NEW_THROW_EX (tmp_ci, + CIAO::Deployment::ComponentInstallation_Impl (), + CORBA::NO_MEMORY ()); + + PortableServer::ServantBase_var safe_servant = tmp_ci; + + this->poa_->activate_object (tmp_ci); + + for (CORBA::ULong i = 0; i < this->plan_.artifact.length (); ++i) + { + tmp_ci->install (this->plan_.artifact[i].name, + this->plan_.artifact[i].location[0]); + } + + CIAO::Deployment::CIAO_ServerActivator_i *tmp_act; + ACE_NEW_THROW_EX (tmp_act, + CIAO::Deployment::CIAO_ServerActivator_i (spawn, + cs_path, + cs_args, + multithread, + tmp_ci->_this (), + this->orb_.in(), + this->poa_.in()), + CORBA::NO_MEMORY ()); + this->activator_.reset (tmp_act); + + PortableServer::ObjectId_var sa_id = + this->poa_->activate_object (this->activator_.get ()); + + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplication_impl::init - ServerActivator object created\n")); + + const ACE_TCHAR *ior; + + if (get_property_value (DAnCE::INSTANCE_NC, this->properties_, ior) || + get_property_value (DAnCE::DOMAIN_NC, this->properties_, ior)) + { + 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")); + } + else DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_impl::init - " + "No instance NC was provided\n")); +} + +void +NodeApplication_Impl::configuration_complete_components () +{ + DANCE_TRACE( "NodeApplication_Impl::configuration_complete_components"); + + bool error (false); + Deployment::StartError exception; + + for (size_t k = 0; k < this->instances_.size (); ++k) + { + if (this->instances_[k]->type == eHome) + { + continue; + } + + 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"; + } + } + } + + if (error) + throw exception; +} + +void +NodeApplication_Impl::start () +{ + DANCE_TRACE( "NodeApplication_Impl::start"); + + bool error (false); + Deployment::StartError exception; + + for (size_t k = 0; k < this->instances_.size (); ++k) + { + if (this->instances_[k]->type == eHome) + { + continue; + } + + 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 ())); + + try + { + CIAO::Deployment::Container_var cont = + CIAO::Deployment::Container::_narrow (this->instances_[k]->container->ref.in()); + + 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 +NodeApplication_Impl::install_home (Container &cont, Instance &inst) +{ + DANCE_TRACE( "NodeApplication_Impl::install_home"); + + 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; + + // need to get significant property values + const char *entrypt = 0; + get_property_value (DAnCE::HOME_FACTORY, mdd.execParameter, entrypt); + + if (entrypt == 0) + { + 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"); + } + + // @@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_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 (CORBA::ULong i = 0; i < idd.configProperty.length (); ++i) + { + 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 ())); + + ::Components::CCMHome_var home = cont.ref->install_home (idd.name.in (), + entrypt, + config); + + 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"); + } + + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::install_home - " + "Home '%C' on node '%C' successfully installed\n", + idd.name.in (), idd.node.in ())); + + inst.ref = CORBA::Object::_narrow (home); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_home - " + "Populating attributes for home %C\n", + idd.name.in ())); + + + 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"); + } +} + +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); + } + + 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 ()); + + 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"); + } + + 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 ())); + + + 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_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"); + } +} + +void +NodeApplication_Impl::install_homed_component (Container &cont, Instance &inst) +{ + 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 ())); + + 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) + { + 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."); + } + + DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_homed_component - " + "Found explicit home property '%C' for component '%C'\n", + home_id, + idd.name.in ())); + + Instance *home_inst (0); + + 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; + } + } + + if (home_inst == 0) + { + 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."); + } + + Components::KeylessCCMHome_var home = + Components::KeylessCCMHome::_narrow (home_inst->ref.in ()); + + 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"); + } + + try + { + 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 ())); + + Components::CCMObject_var ccm_obj = home->create_component (); + + if (CORBA::is_nil (ccm_obj)) + { + 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"); + } + + 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"); + } +} + +void +NodeApplication_Impl::create_component_server (size_t index) +{ + DANCE_TRACE ("NodeApplication_Impl::create_component_server"); + + ComponentServer &server = this->servers_[index]; + + 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"); + } + + 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; + } +} + +void +NodeApplication_Impl::store_instance_ior (Instance &inst) +{ + DANCE_TRACE ("NodeApplication_impl::store_instance_ior"); + + 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)); + + Name_Utilities::bind_object (name, inst.ref.in (), this->instance_nc_.in ()); + } + + if (get_property_value (DAnCE::INSTANCE_IOR_FILE, + this->plan_.instance[inst.idd_idx].configProperty, + name)) + { + CORBA::String_var ior = this->orb_->object_to_string (inst.ref.in ()); + Name_Utilities::write_ior (name, ior.in ()); + } +} + +void +NodeApplication_Impl::create_container (size_t server, size_t cont_idx) +{ + DANCE_TRACE ("NodeApplication_impl::create_container"); + + Container &container = this->servers_[server].containers[cont_idx]; + + DANCE_DEBUG ((LM_TRACE, "NodeApplication_impl::create_container - " + "Creating container\n")); + // TODO: Need to create configvalues + Components::ConfigValues cvs; + + 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)); + + // Configure homes first + for (size_t i = 0; i < container.homes.size (); ++i) + { + this->install_home (container, container.homes[i]); + this->store_instance_ior (container.homes[i]); + } + + 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)); + + // Configure components + for (size_t i = 0; i < container.components.size (); ++i) + { + switch (container.components[i].type) + { + 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 +NodeApplication_Impl::create_container (unsigned int index) +{ + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::create_container - started\n")); + + Components::ConfigValues config_values; + ACE_CString processDest; + CORBA::Any_var feature_any; + + this->create_config_values (this->plan_.instance[index].configProperty, + eCreateComponentServer, + config_values); + + ::Components::Deployment::ComponentServer_var compServer; + + + // COMPONENT_KIND + this->create_config_values (this->plan_.implementation[this->plan_.instance[index].implementationRef].execParameter, + eCreateContainer, + config_values); + try + { + 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")); + } + catch (::Components::CreateFailure& ) + { + DANCE_ERROR((LM_ERROR, DLINFO " NodeApplication_impl::create_container - " + "::Components::Deployment::ComponentServer_var::create_container() " + "returned ::Components::CreateFailure exception\n")); + throw Deployment::StartError(); + } + catch (::Components::Deployment::InvalidConfiguration& ) + { + 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 +NodeApplication_Impl::init_components() +{ + DANCE_TRACE ("NodeApplication_impl::init_components"); + + Components::ConfigValues config_values; + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::init_components - " + "Configuring %u component/home instances\n", + this->plan_.instance.length())); + + // @@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) + { + ComponentServer server; + server.containers.size (1); + this->servers_.size (1); + this->servers_[0] = server; + } + + for (unsigned int i = 0; i < this->plan_.instance.length(); i++) + { + try + { + 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; + } + } + + 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); + } + + + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::init_components - finished\n")); +} + +void +NodeApplication_Impl::passivate_components() +{ + DANCE_TRACE ("NodeApplication_Impl::passivate_components()"); + + bool error (false); + Deployment::StopError exception ("unfilled", "unfilled passivate components"); + + for (size_t k = 0; k < this->instances_.size (); ++k) + { + if (this->instances_[k]->type == eHome || + this->instances_[k]->type == eInvalid) + continue; + + + try + { + CIAO::Deployment::Container_var cont = + CIAO::Deployment::Container::_narrow (this->instances_[k]->container->ref.in()); + + 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 == 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; + } + + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::passivate_components - " + "Component %C successfully passivated.\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + } + catch (const CORBA::Exception &ex) + { + 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 (); + } + } + catch (...) + { + 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 +NodeApplication_Impl::remove_components() +{ + DANCE_TRACE ("NodeApplication_Impl::remove_components()"); + + bool error (false); + Deployment::StopError exception ("unfilled", "unfilled remove_components"); + + // Removing components first. + for (size_t k = 0; k < this->instances_.size (); ++k) + { + try + { + if (this->instances_[k]->type == eInvalid || + this->instances_[k]->type == eHome) + continue; + + 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 (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 ())); + } + + + this->instances_[k]->state = eRemoved; + + DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::remove_components - " + "Component %C successfully removed.\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + + } + catch (const CORBA::Exception &ex) + { + 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"); + } + } + + for (size_t k = 0; k < this->instances_.size (); ++k) + { + try + { + if (this->instances_[k]->type != eHome) + continue; + + DANCE_ERROR ((LM_TRACE, DLINFO "NodeApplication_Impl::remove_components - " + "Removing home %C\n", + this->plan_.instance[this->instances_[k]->idd_idx].name.in ())); + + if (this->instances_[k]->container == 0 || + CORBA::is_nil (this->instances_[k]->container->ref.in ())) + { + 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; + } + + Components::CCMHome_var home = Components::CCMHome::_narrow (this->instances_[k]->ref.in ()); + this->instances_[k]->container->ref->remove_home (home.in ()); + + 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) + { + 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"); + } + } + +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) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::get_instance_type - " + "Checking property %C\n", + prop[i].name.in ())); + + 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) + { + 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; +} + +void +NodeApplication_Impl::create_config_values (const Deployment::Properties& /*prop*/, + const ERequestType request, + Components::ConfigValues& /*cfg*/) const +{ + 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: + { + 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"); + } + } +} + +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()); + + }*/ + 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(); +} + +void +NodeApplication_Impl::finishLaunch (const Deployment::Connections & providedReference, + ::CORBA::Boolean start) +{ + DANCE_TRACE ("NodeApplication_Impl::finishLaunch"); + + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - " + "started for connections sequence with length: %d\n", + providedReference.length())); + +#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 */ + + for (unsigned int j = 0; j < this->plan_.connection.length(); ++j) + { + CORBA::ULong inst (this->plan_.connection[j].internalEndpoint[0].instanceRef); + + DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_impl::finishLaunch - " + "Connection %C, instance %u\n", + this->plan_.connection[j].name.in (), + inst)); + +#ifdef GEN_OSTREAM_OPS + { + 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 */ + + Components::CCMObject_var obj = + Components::CCMObject:: + _narrow (this->instances_[inst]->ref.in ()); + + 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"); + } + + const ::Deployment::PlanConnectionDescription &conn = this->plan_.connection[j]; + + ACE_CString name = conn.name.in(); + + 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()));*/ + + 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(); + } + + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplication_impl::finishLaunch - finished\n")); +} + +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; +} + +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; +} + +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."); + } +} + +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."); + } +} + +Components::Cookie* +NodeApplication_Impl::connect_publisher (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer) +{ + 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; +} + +void NodeApplication_Impl::create_config_values(const Deployment::Properties& prop, + Components::ConfigValues& cfg) const +{ + 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/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h b/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h new file mode 100644 index 00000000000..651d1844731 --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h @@ -0,0 +1,212 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file NodeApplication_Impl.h + * + * $Id$ + * + * @Brief Implementation of Deployment::NodeApplication + * + * @author Erwin Gottlieb <eg@prismtech.com> + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ +//============================================================================= + + +#ifndef NODEAPPLICATION_IMPL_H_ +#define NODEAPPLICATION_IMPL_H_ + +#include "NodeApplication_Export.h" + +#include "ace/Map_Manager.h" +#include "ace/Containers_T.h" +#include "tao/ORB.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 +{ + + class NodeManager_Impl; + + class NodeApplication_Export NodeApplication_Impl : public virtual POA_Deployment::NodeApplication + { + public: + 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); + + virtual ~NodeApplication_Impl(); + + virtual void finishLaunch (const Deployment::Connections & providedReference, + ::CORBA::Boolean start); + + virtual void start (); + + Deployment::Connections * getAllConnections(); + + //TODO Exception specification should be customized + void init_components(); + + void configuration_complete_components (); + + void passivate_components (); + + void remove_components (); + + enum ERequestType + { + eCreateComponentServer, + eCreateContainer, + eInstallHome, + eCreateComponentWithConfigValues + }; + + enum EInstanceType + { + eHome, + eComponent, + eHomedComponent, + eInvalid + }; + + enum EComponentState + { + eUninstalled, + eInstalled, + eConfigured, + eActive, + ePassive, + eRemoved, + eInvalidState + }; + + + protected: + //TODO Add throw specification + void init(); + + struct Container; + + 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; + }; + + typedef ACE_Array<Instance> INSTANCES; + typedef ACE_Array<Instance *> INSTANCE_PTRS; + + struct Container + { + INSTANCES homes; + INSTANCES components; + Deployment::Properties properties; + Components::Deployment::Container_var ref; + }; + + typedef ACE_Array<Container> CONTAINERS; + + struct ComponentServer + { + CONTAINERS containers; + Deployment::Properties properties; + Components::Deployment::ComponentServer_var ref; + }; + + typedef ACE_Array<ComponentServer> COMPONENTSERVERS; + + EInstanceType get_instance_type (const Deployment::Properties& prop) const; + + void create_config_values (const Deployment::Properties& prop, + const ERequestType request, + Components::ConfigValues& cfg) const; + + void create_config_values(const Deployment::Properties& prop, + Components::ConfigValues& cfg) const; + + void create_component_server (size_t index); + + void create_container (size_t server, size_t container); + + void install_home (Container &cont, Instance &inst); + + void install_component (Container &cont, Instance &inst); + + 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); + + void connect_emitter_ext (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer); + + Components::Cookie* connect_publisher (Components::CCMObject_ptr inst, + const ACE_CString& port_name, + CORBA::Object_ptr consumer); + + CORBA::ORB_var orb_; + + PortableServer::POA_var poa_; + + const Deployment::DeploymentPlan& plan_; + + //ComponentInstallation_Impl* installation_; + auto_ptr<CIAO::Deployment::CIAO_ServerActivator_i> activator_; + + RedirectionService & redirection_; + + ACE_CString node_name_; + + PROPERTY_MAP properties_; + + COMPONENTSERVERS servers_; + + INSTANCE_PTRS instances_; + + CosNaming::NamingContext_var instance_nc_; + }; +} +#endif /*NODEAPPLICATION_IMPL_H_*/ diff --git a/modules/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.cpp b/modules/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.cpp new file mode 100644 index 00000000000..541457a9afe --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.h b/modules/CIAO/DAnCE/NodeApplication/ServerActivator_Impl.h new file mode 100644 index 00000000000..8ce81ca1db6 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc b/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc new file mode 100644 index 00000000000..c07575ef68a --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc @@ -0,0 +1,11 @@ +// -*- MPC -*- +// $Id$ + +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 + } +} diff --git a/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Export.h b/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Export.h new file mode 100644 index 00000000000..b86e93b49ab --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp new file mode 100644 index 00000000000..664355b300b --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp @@ -0,0 +1,209 @@ +// $Id$ + +#include "ace/Log_Msg.h" +#include "ace/streams.h" +#include "DAnCE/Deployment/DAnCE_PropertiesC.h" +#include "DAnCE/Logger/Log_Macros.h" + +#include "NodeApplicationManager_Impl.h" +#include "NodeApplication/NodeApplication_Impl.h" +#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 + { + if (this->application_ != 0) + { + 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 (...) + { + DANCE_ERROR ((LM_WARNING, DLINFO "NodeApplicationManager_Impl::~NodeApplicationManager_Impl - " + "Caught exception in NodeApplicationManager destructor\n")); + } +} + +Deployment::Application_ptr +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 ()); + + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplicationManager_impl::startLaunch - " + "Instructing NodeApplication to initialize components.\n")); + this->application_->init_components(); + + DANCE_DEBUG((LM_TRACE, DLINFO "NodeApplicationManager_impl::startLaunch - " + "Collecting connection references\n")); + providedReference = this->application_->getAllConnections(); + //this->parent_.registerConnections(this->plan_.UUID.in(), *providedReference); + + DANCE_DEBUG((LM_DEBUG, DLINFO "NodeApplicationManager_impl::startLaunch - " + "Activating NodeApplication servant\n")); + PortableServer::ObjectId_var as_id = + this->poa_->activate_object (this->application_); + + CORBA::Object_var as_obj = this->poa_->id_to_reference (as_id.in ()); + Deployment::Application_var app = Deployment::Application::_narrow (as_obj.in ()); + + return app._retn (); +} + +void +NodeApplicationManager_Impl::destroyApplication (Deployment::Application_ptr application) +{ + DANCE_TRACE (DLINFO "NodeApplicationManager_Impl::destroyApplication"); + + try + { + if (!application->_is_equivalent (this->poa_->servant_to_reference (this->application_))) + { + DANCE_ERROR((LM_ERROR, DLINFO "NodeApplicationManager_Impl::destroyApplication - " + "application is equivalent to current application\n")); + throw ::Deployment::StopError(); + } + this->redirection_.unregister (this->node_name_, this->plan_.UUID.in()); + + CORBA::Any val; + + 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/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h b/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h new file mode 100644 index 00000000000..ab45d526dcd --- /dev/null +++ b/modules/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h @@ -0,0 +1,59 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file NodeApplicationManager_Impl.h + * + * $Id$ + * + * @Brief Implementation of POA_Deployment::NodeApplicationManager + * + * @author Erwin Gottlieb <eg@prismtech.com> + */ +//============================================================================= + +#ifndef NODEAPPLICATIONMANAGER_IMPL_H_ +#define NODEAPPLICATIONMANAGER_IMPL_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 DAnCE + { + + class NodeManager_Impl; + + class NodeApplicationManager_Export NodeApplicationManager_Impl : public virtual POA_Deployment::NodeApplicationManager + { + public: + 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_; + }; +} +#endif /*NODEAPPLICATIONMANAGER_IMPL_H_*/ diff --git a/modules/CIAO/DAnCE/NodeManager/DAnCE_NodeManager_Module_Export.h b/modules/CIAO/DAnCE/NodeManager/DAnCE_NodeManager_Module_Export.h new file mode 100644 index 00000000000..4eaf82f6fee --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeManager/NodeManager.mpc b/modules/CIAO/DAnCE/NodeManager/NodeManager.mpc new file mode 100644 index 00000000000..d7e55703769 --- /dev/null +++ b/modules/CIAO/DAnCE/NodeManager/NodeManager.mpc @@ -0,0 +1,22 @@ +// -*- MPC -*- +// $Id$ + +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 { + NodeManager_Impl.cpp + Node_Manager_Module.cpp + } +} + +project(Node_Manager_Exec) : utils, dance_exe, dance_node_manager, naming_serv { + exename = dance_node_manager + after += Node_Manager_Module + libs += DAnCE_NodeManager + + Source_Files { + Node_Manager_Exec.cpp + } +} diff --git a/modules/CIAO/DAnCE/NodeManager/NodeManager_Export.h b/modules/CIAO/DAnCE/NodeManager/NodeManager_Export.h new file mode 100644 index 00000000000..b7240baeb80 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp b/modules/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp new file mode 100644 index 00000000000..2c84c84ceb9 --- /dev/null +++ b/modules/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp @@ -0,0 +1,183 @@ +// $Id$ + +#include "NodeManager_Impl.h" + +#include "ace/Log_Msg.h" +#include "ace/streams.h" + +#include "DAnCE/Logger/Log_Macros.h" + +#include "ace/OS_Memory.h" + +#ifdef GEN_OSTREAM_OPS +#include <iostream> +#include <sstream> +#endif /* GEN_OSTREAM_OPS */ + +namespace DAnCE +{ + 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 (); + } + } + + 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 ())); + } + } + } + + 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 (); + } + + 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 (); + } + + ::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 ()); + } + + 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(); + } + + ::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/modules/CIAO/DAnCE/NodeManager/NodeManager_Impl.h b/modules/CIAO/DAnCE/NodeManager/NodeManager_Impl.h new file mode 100644 index 00000000000..0c1311c36ca --- /dev/null +++ b/modules/CIAO/DAnCE/NodeManager/NodeManager_Impl.h @@ -0,0 +1,69 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file NodeManager_Impl.h + * + * $Id$ + * + * @Brief Implementation of POA_Deployment::NodeManager + * + * @author Erwin Gottlieb <eg@prismtech.com> + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef NODEMANAGER_IMPL_H_ +#define NODEMANAGER_IMPL_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 DAnCE +{ + class NodeManager_Export NodeManager_Impl : public virtual POA_Deployment::NodeManager + { + public: + // 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); + + virtual ~NodeManager_Impl(); + + 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, + ::Deployment::ResourceCommitmentManager_ptr resourceCommitment); + + virtual void destroyManager (::Deployment::NodeApplicationManager_ptr appManager); + + virtual ::Deployment::Resources * getDynamicResources (); + + const char* getName(); + + private: + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; + ACE_CString name_; + typedef ACE_Map_Manager<ACE_CString, NodeApplicationManager_Impl*, ACE_Null_Mutex > TManagers; + TManagers managers_; + RedirectionService& redirection_; + PROPERTY_MAP properties_; + }; +} + +#endif /*NODEMANAGER_IMPL_H_*/ diff --git a/modules/CIAO/DAnCE/NodeManager/Node_Manager_Exec.cpp b/modules/CIAO/DAnCE/NodeManager/Node_Manager_Exec.cpp new file mode 100644 index 00000000000..889604048c5 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeManager/Node_Manager_Module.cpp b/modules/CIAO/DAnCE/NodeManager/Node_Manager_Module.cpp new file mode 100644 index 00000000000..839afe1f808 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeManager/Node_Manager_Module.h b/modules/CIAO/DAnCE/NodeManager/Node_Manager_Module.h new file mode 100644 index 00000000000..97487f15328 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/NodeManager/README b/modules/CIAO/DAnCE/NodeManager/README new file mode 100644 index 00000000000..dda9201e240 --- /dev/null +++ b/modules/CIAO/DAnCE/NodeManager/README @@ -0,0 +1,13 @@ +/** + +@page NodeManager README File + + CIAO's NodeManager implementation. NodeManager is the bootstraping +mechanism to create new NodeApplication on the localhost. We +currently depend on starting the NodeApplicationManager process on +some port of all the hosts that have NodeApplication install to +function properly. The port to run this daemon can be set by using the +TAO ORB options command of -ORBEndpoint <port>. This replaces the +earlier CIAO_Daemon implementation of CIAO as defined in the CCM +specification. +*/ diff --git a/modules/CIAO/DAnCE/Plan_Generator/PCVisitor.cpp b/modules/CIAO/DAnCE/Plan_Generator/PCVisitor.cpp new file mode 100644 index 00000000000..99621fcc7c2 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/PCVisitor.cpp @@ -0,0 +1,270 @@ +/* -*- C++ -*- */ + +//======================================================================== +/* + * @file PCVisitor.cpp + * + * $Id$ + * + * This file contains the implementation of the PackageConfiguration + * Visitor class PCVisitor which derives from PCVisitorBase. Each + * Visit function focuses on the functionality necessary to process + * the PackageConfiguration element which is passed to it as an argument + * and on dispatching the next sequence of calls in the correct order! + * + * This implementation takes a PackageConfiguration and tries to modify + * a DeploymentPlan bases on it by expanding the latter in width and depth + * simultaneously. At each level of the PackageConfiguration the + * PCVisitor first expands the DeploymentPlan vertically at the + * corrsponding level and then dispatches the children of the current + * PackageConfiguration element. This in turn might and most probably + * will cause another vertical expansion of the DeploymentPlan, however + * for a different element. This effect is produced due to the flattened + * structure of the DeploymentPlan. + * + * @author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + * Shanshan Jiang <shanshan.jiang@vanderbilt.edu> + */ +//======================================================================== + +#include "PCVisitorBase.h" +#include "PCVisitor.h" + +//Constructor +PCVisitor::PCVisitor (Deployment::DeploymentPlan &plan, + Deployment::PackageConfiguration &pc, + bool modify) + : PCVisitorBase (), + plan_ (plan), + pc_ (pc), + modify_ (modify), + last_impl_index_ (-1) +{ +} + +//entry point for the protected visitor to get it do start +//the visitation process +int PCVisitor::Visit () +{ + Accept (*this, this->pc_); + return last_impl_index_; +} + +// A whole slew of overloaded routines for different IDL +// data types part of the PackageConfiguration. + +void PCVisitor::Visit (Deployment::PackageConfiguration &pc) +{ + //visit the ComponentPackageDescription + if (pc.basePackage.length ()) + { + //currently no support for that anywhere + //for (size_t r = 0; r = pc.selectRequirement.length (); ++r); + + Accept (*this, pc.basePackage); + } + else + ACE_DEBUG ((LM_WARNING, + "[PCVisitor - PackageConfiguration] We currently " + "do NOT support package references, specializedConfigs", + "or imports!\n")); +} + +//ComponentPackageDescription descendents + +void PCVisitor::Visit (Deployment::ComponentPackageDescription &cpd) +{ + Accept (*this, cpd.realizes); + //for (size_t impl = 0; impl < cpd.implementation.length (); ++impl) + Accept (*this, cpd.implementation[0]); +} + + +void PCVisitor::Visit (Deployment::ComponentInterfaceDescription &) +{ + //Might want to populate this too once PICML starts supporting it +} + + +void PCVisitor::Visit (Deployment::PackagedComponentImplementation &pci) +{ + Accept (*this, pci.referencedImplementation); +} + + +void PCVisitor::Visit (Deployment::ComponentImplementationDescription &cid) +{ + if (cid.assemblyImpl.length ()) + Accept (*this, cid.assemblyImpl); + else + //;//Do nothing - monolithic component deployment not supported + Accept (*this, cid.monolithicImpl); +} + + +void PCVisitor::Visit (Deployment::ComponentAssemblyDescription &cad) +{ + //visit the SubcomponentInstantiationDescription + Accept (*this, cad.instance); + //visit the connections + Accept (*this, cad.connection); +} + + +void PCVisitor::Visit (Deployment::SubcomponentInstantiationDescription &sid) +{ + //visit the ComponentPackageDescription (again) + if (sid.basePackage.length ()) + { + Accept (*this, sid.basePackage); + } + else + ACE_DEBUG ((LM_WARNING, + "[PCVisitor - SubcomponentInstantiationDescription] ", + "We currently do NOT support package references, ", + "specializedConfigs or imports!\n")); +} + + +void PCVisitor::Visit (Deployment::MonolithicImplementationDescription &mid) +{ + if (!modify_) + { + //increase the implementation length by one + size_t const impl_len = plan_.implementation.length (); + last_impl_index_ = impl_len; + plan_.implementation.length (impl_len + 1); + } + + //visit the NamedImplementationArtifacts + Accept (*this, mid.primaryArtifact); +} + + +void PCVisitor::Visit (Deployment::NamedImplementationArtifact &nia) +{ + if (!modify_) + { + //increase the artifact length by one + size_t const arti_len = plan_.artifact.length (); + plan_.artifact.length (arti_len + 1); + + //set the name + plan_.artifact[arti_len].name = nia.name; + + // Set the artifactRef of implementation + size_t const last_mdd = plan_.implementation.length () - 1; + Deployment::MonolithicDeploymentDescription& mdd = plan_.implementation[last_mdd]; + size_t const ref_len = mdd.artifactRef.length (); + mdd.artifactRef.length (ref_len + 1); + mdd.artifactRef[ref_len] = arti_len; + } + + //visit the actual ImplementationArtifactDescriptor + Accept (*this, nia.referencedArtifact); +} + + +void PCVisitor::Visit (Deployment::ImplementationArtifactDescription &iad) +{ + if (!modify_) + { + size_t last_arti = plan_.artifact.length (); + Deployment::ArtifactDeploymentDescription& add = plan_.artifact[last_arti - 1]; + + //set the location + size_t plan_loc_len = add.location.length (); + size_t const num_loc = iad.location.length (); + for (size_t i = 0; i < num_loc; ++i) + { + add.location.length (plan_loc_len + 1); + add.location[plan_loc_len] = iad.location[i]; + ++plan_loc_len; + } + + //set the execParameter + update_execParameter (iad, add); + } + + else + { + size_t const num_arti = plan_.artifact.length (); + for (size_t i = 0; i < num_arti; ++i) + { + if (ACE_OS::strstr (iad.location[0], plan_.artifact[i].location[0])) + plan_.artifact[i].location[0] = iad.location[0]; + } + } +} + + +//ComponentPackageReference descendents + +void PCVisitor::Visit (Deployment::ComponentPackageReference &) +{ + //not implemented +} + + +//properties + +void PCVisitor::Visit (Deployment::AssemblyPropertyMapping &) +{ +} + + +void PCVisitor::Visit (Deployment::Property &) +{ +} + + +//requirements & capabilities + +void PCVisitor::Visit (Deployment::Requirement &) +{ +} + + +void PCVisitor::Visit (Deployment::Capability &) +{ +} + + +void PCVisitor::Visit (Deployment::ImplementationRequirement &) +{ +} + + +void PCVisitor::Visit (Deployment::ImplementationDependency &) +{ +} + +//ports and connections + +void PCVisitor::Visit (Deployment::AssemblyConnectionDescription &) +{ +} + + +void PCVisitor::Visit (Deployment::SubcomponentPortEndpoint &) +{ +} + + +void PCVisitor::Visit (Deployment::ComponentExternalPortEndpoint &) +{ +} + +void PCVisitor:: +update_execParameter (Deployment::ImplementationArtifactDescription& iad, + Deployment::ArtifactDeploymentDescription& add) +{ + size_t const num_execP = iad.execParameter.length (); + size_t execP_len = add.execParameter.length (); + for (size_t j = 0; j < num_execP; ++j) + { + add.execParameter.length (execP_len + 1); + add.execParameter[execP_len] = iad.execParameter[j]; + ++execP_len; + } +} diff --git a/modules/CIAO/DAnCE/Plan_Generator/PCVisitor.h b/modules/CIAO/DAnCE/Plan_Generator/PCVisitor.h new file mode 100644 index 00000000000..8417bc8a630 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/PCVisitor.h @@ -0,0 +1,128 @@ +/* -*- C++ -*- */ + +//======================================================================== +/** + * file PCVisitor.h + * + * $Id$ + * + * This file contains a number of Visitor classes which are used to + * traverse the PackageConfiguration element defined in the + * PackagingData.idl + * + * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + * Shanshan Jiang <shanshan.jiang@vanderbilt.edu> + */ +//======================================================================== + +#ifndef PC_VISITOR_H +#define PC_VISITOR_H + +#include /**/ "ace/pre.h" +#include "PCVisitorBase.h" //for the base visitor + +//=========================================================================== +/** + * class PCVisitor + * + * This class is is the actual implementation for the PackageConfiguration + * Visitor. It derives from PCVisitorBase and overloads the functions which + * deal with single elements. Sequences are handled in the base class. + */ +//=========================================================================== + + +class PCVisitor : public PCVisitorBase +{ +public: + /// Constructor + PCVisitor (Deployment::DeploymentPlan &plan, + Deployment::PackageConfiguration &pc, + bool modify); + + /// Entry point to protected Visitor functions + int Visit (); + +protected: + /// A whole slew of overloaded routines for different IDL + /// data types part of the PackageConfiguration. + + virtual + void Visit (Deployment::PackageConfiguration &pc); + + //ComponentPackageDescription descendents + virtual + void Visit (Deployment::ComponentPackageDescription &cpd); + + virtual + void Visit (Deployment::ComponentInterfaceDescription &cid); + + virtual + void Visit (Deployment::PackagedComponentImplementation &pci); + + virtual + void Visit (Deployment::ComponentImplementationDescription &cid); + + virtual + void Visit (Deployment::ComponentAssemblyDescription &cad); + + virtual + void Visit (Deployment::SubcomponentInstantiationDescription &sid); + + virtual + void Visit (Deployment::MonolithicImplementationDescription &mid); + + virtual + void Visit (Deployment::NamedImplementationArtifact &nia); + + virtual + void Visit (Deployment::ImplementationArtifactDescription &iad); + + //ComponentPackageReference descendents + virtual + void Visit (Deployment::ComponentPackageReference &cpr); + + //properties + virtual + void Visit (Deployment::AssemblyPropertyMapping &apm); + + virtual + void Visit (Deployment::Property &property); + + //requirements & capabilities + virtual + void Visit (Deployment::Requirement &requirement); + + virtual + void Visit (Deployment::Capability &capability); + + virtual + void Visit (Deployment::ImplementationRequirement &ir); + + virtual + void Visit (Deployment::ImplementationDependency &id); + + //ports and connections + virtual + void Visit (Deployment::AssemblyConnectionDescription &acd); + + virtual + void Visit (Deployment::SubcomponentPortEndpoint &spe); + + virtual + void Visit (Deployment::ComponentExternalPortEndpoint &cepe); + +protected: + void update_execParameter (Deployment::ImplementationArtifactDescription& iad, + Deployment::ArtifactDeploymentDescription& add); + +private: + Deployment::DeploymentPlan& plan_; + Deployment::PackageConfiguration& pc_; + bool modify_; + int last_impl_index_; +}; + +#include /**/ "ace/post.h" + +#endif /* PC_VISITOR_H */ diff --git a/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.cpp b/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.cpp new file mode 100644 index 00000000000..c8ffc983095 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.cpp @@ -0,0 +1,28 @@ +/* -*- C++ -*- */ + +//======================================================================== +/* + * file PCVisitorBase.cpp + * + * $Id$ + * + * This file is a dummy which either includes the PCVisitorBase.inl or + * is ignored. + * + * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + */ +//======================================================================== + +#include "PCVisitorBase.h" + +PCVisitorBase::PCVisitorBase (void) +{ +} + +PCVisitorBase::~PCVisitorBase (void) +{ +} + +#if !defined (__ACE_INLINE__) +#include "PCVisitorBase.inl" +#endif /* __ACE_INLINE__ */ diff --git a/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.h b/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.h new file mode 100644 index 00000000000..a8bd64ad939 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.h @@ -0,0 +1,171 @@ +/* -*- C++ -*- */ + +//======================================================================== +/** + * file PCVisitorBase.h + * + * $Id$ + * + * This file contains the virtual base class for the PackageConfiguration + * Visitor which is used to traverse the PackageConfiguration element + * defined in the PackagingData.idl. The PackageConfiguration has a + * number of sequence elements. This class actually implements the + * operations which involve sequences and delegates the calls to + * the operations which handle single elements from the sequence type. + * + * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + */ +//======================================================================== + +#ifndef PC_VISITOR_BASE_H +#define PC_VISITOR_BASE_H + +#include /**/ "ace/pre.h" +#include "DAnCE/Deployment/DeploymentC.h" + +//======================================================================== +/** + * class PCVisitorBase + * + * This class is a virtual base class for the PackageConfiguration Visitor + * The operation which deal with sequences are implemented here by means + * of the visit_sequence function above, in order to make the logic of + * derived classes easier to write. Writers of derived classes need only + * overload the functions which deal with single elements. Sequences are + * always handled here. + */ +//======================================================================== + + +class PCVisitorBase +{ +public: + /// Constructor + PCVisitorBase (void); + + /// Destructor + virtual ~PCVisitorBase (void); + + /// Function what dispatches sequences + template <typename SEQ> + friend void visit_sequence (SEQ &seq, PCVisitorBase& v); + + /// A whole slew of overloaded routines for different IDL + /// data types part of the PackageConfiguration. + + virtual + void Visit (Deployment::PackageConfiguration &pc) = 0; + void Visit (Deployment::PackageConfigurations &pcs); + + /// ComponentPackageDescription descendents + virtual + void Visit (Deployment::ComponentPackageDescription &cpd) = 0; + void Visit (Deployment::ComponentPackageDescriptions &cpds); + + virtual + void Visit (Deployment::ComponentInterfaceDescription &cid) = 0; + //void Visit (Deployment::ComponentInterfaceDescriptions &cids); + + virtual + void Visit (Deployment::PackagedComponentImplementation &pci) = 0; + void Visit (Deployment::PackagedComponentImplementations &pcis); + + virtual + void Visit (Deployment::ComponentImplementationDescription &cid) = 0; + //void Visit (Deployment::ComponentImplementationDescriptions &cids); + + virtual + void Visit (Deployment::ComponentAssemblyDescription &cad) = 0; + void Visit (Deployment::ComponentAssemblyDescriptions &cads); + + virtual + void Visit (Deployment::SubcomponentInstantiationDescription &sid) = 0; + void Visit (Deployment::SubcomponentInstantiationDescriptions &sids); + + virtual + void Visit (Deployment::MonolithicImplementationDescription &mid) = 0; + void Visit (Deployment::MonolithicImplementationDescriptions &mids); + + virtual + void Visit (Deployment::NamedImplementationArtifact &nia) = 0; + void Visit (Deployment::NamedImplementationArtifacts &nias); + + virtual + void Visit (Deployment::ImplementationArtifactDescription &iad) = 0; + //void Visit (Deployment::ImplementationArtifactDescriptions &iads); + + //ComponentPackageReference descendents + virtual + void Visit (Deployment::ComponentPackageReference &cpr) = 0; + void Visit (Deployment::ComponentPackageReferences &cprs); + + //properties + virtual + void Visit (Deployment::AssemblyPropertyMapping &apm) = 0; + void Visit (Deployment::AssemblyPropertyMappings &apms); + + virtual + void Visit (Deployment::Property &property) = 0; + void Visit (Deployment::Properties &properties); + + //requirements & capabilities + virtual + void Visit (Deployment::Requirement &requirement) = 0; + void Visit (Deployment::Requirements &requirements); + + virtual + void Visit (Deployment::Capability &capability) = 0; + void Visit (Deployment::Capabilities &capabilities); + + virtual + void Visit (Deployment::ImplementationRequirement &ir) = 0; + void Visit (Deployment::ImplementationRequirements &irs); + + virtual + void Visit (Deployment::ImplementationDependency &id) = 0; + void Visit (Deployment::ImplementationDependencies &ids); + + //ports and connections + virtual + void Visit (Deployment::AssemblyConnectionDescription &acd) = 0; + void Visit (Deployment::AssemblyConnectionDescriptions &acds); + + virtual + void Visit (Deployment::SubcomponentPortEndpoint &spe) = 0; + void Visit (Deployment::SubcomponentPortEndpoints &spes); + + virtual + void Visit (Deployment::ComponentExternalPortEndpoint &cepe) = 0; + void Visit (Deployment::ComponentExternalPortEndpoints &cepes); +}; + +template <typename T> +void Accept (PCVisitorBase &v, T& element_to_visit) +{ + v.Visit (element_to_visit); +} + +/** + * function - visit_sequence + * + * This function is used to handle sequences of elements where each + * element takes the form of a Visitor Node. + */ +template <typename SEQ> +void visit_sequence (SEQ &seq, PCVisitorBase& v) +{ + CORBA::ULong const size = seq.length (); + + for (CORBA::ULong i = 0; i < size; ++i) + { + Accept(v, seq[i]); + } +} + +#if defined (__ACE_INLINE__) +#include "PCVisitorBase.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* PC_VISITOR_BASE_H */ diff --git a/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.inl b/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.inl new file mode 100644 index 00000000000..955aefb7c4e --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.inl @@ -0,0 +1,155 @@ +/* -*- C++ -*- */ + +//======================================================================== +/* + * file PCVisitorBase.inl + * + * $Id$ + * + * This file contains the implementation of the sequence-based + * PackageConfiguration Visitor functions. By implementing these + * we relieve developers of derived classes of the burden of handling + * the correct traversal of sequence-based elements. This implementation + * used the visit_sequence templatized function to do the heavy lifting. + * + * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + */ +//======================================================================== + + +/// A whole slew of overloaded routines for different IDL +/// data types part of the PackageConfiguration. + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::PackageConfigurations &pcs) +{ + visit_sequence (pcs, *this); +} + +//ComponentPackageDescription descendents + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::ComponentPackageDescriptions &cpds) +{ + visit_sequence (cpds, *this); +} + +//NOT a member of Deployment + +//ACE_INLINE void PCVisitorBase::Visit +// (Deployment::ComponentInterfaceDescriptions &cids) +//{ +// visit_sequence (cids, *this); +//} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::PackagedComponentImplementations &pcis) +{ + visit_sequence (pcis, *this); +} + +//NOT a member of Deployment + +//ACE_INLINE void PCVisitorBase::Visit +// (Deployment::ComponentImplementationDescriptions &cids) +//{ +// visit_sequence (cids, *this); +//} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::ComponentAssemblyDescriptions &cads) +{ + visit_sequence (cads, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::SubcomponentInstantiationDescriptions &sids) +{ + visit_sequence (sids, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::MonolithicImplementationDescriptions &mids) +{ + visit_sequence (mids, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::NamedImplementationArtifacts &nias) +{ + visit_sequence (nias, *this); +} + +//ACE_INLINE void PCVisitorBase::Visit +// (Deployment::ImplementationArtifactDescriptions &iads) +//{ +// visit_sequence (iads, *this); +//} + +//ComponentPackageReference descendents + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::ComponentPackageReferences &cprs) +{ + visit_sequence (cprs, *this); +} + +//properties + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::AssemblyPropertyMappings &apms) +{ + visit_sequence (apms, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::Properties &properties) +{ + visit_sequence (properties, *this); +} + +//requirements & capabilities + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::Requirements &requirements) +{ + visit_sequence (requirements, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::Capabilities &capabilities) +{ + visit_sequence (capabilities, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::ImplementationRequirements &irs) +{ + visit_sequence (irs, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::ImplementationDependencies &ids) +{ + visit_sequence (ids, *this); +} + +//ports and connections + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::AssemblyConnectionDescriptions &acds) +{ + visit_sequence (acds, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::SubcomponentPortEndpoints &spes) +{ + visit_sequence (spes, *this); +} + +ACE_INLINE void PCVisitorBase::Visit +(Deployment::ComponentExternalPortEndpoints &cepes) +{ + visit_sequence (cepes, *this); +} diff --git a/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator.mpc b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator.mpc new file mode 100644 index 00000000000..eb1de40723f --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator.mpc @@ -0,0 +1,22 @@ +// -*- MPC -*- +//$Id$ + +project (Plan_Generator) : dance_deployment_stub, naming, dance_lib { + sharedname = DAnCE_Plan_Generator + after += RepositoryManager + + dynamicflags = PLAN_GENERATOR_IMPL_BUILD_DLL + + Source_Files { + Plan_Generator_Impl.cpp + PCVisitorBase.cpp + PCVisitor.cpp + } + + Header_Files { + Plan_Generator_Impl.h + PCVisitor.h + PCVisitorBase.h + Plan_Generator_Impl_Export.h + } +} diff --git a/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl.cpp b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl.cpp new file mode 100644 index 00000000000..6c96e2a9e04 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl.cpp @@ -0,0 +1,150 @@ +/** + * $Id$ + * @file Plan_Generator_Impl.cpp + * @author Shanshan Jiang <shanshan.jiang@vanderbilt.edu> + */ + +#include "Plan_Generator_Impl.h" +#include "orbsvcs/CosNamingC.h" +#include "PCVisitor.h" +#include "PCVisitorBase.h" + +namespace CIAO +{ + namespace Plan_Generator + { + // @todo make this a private method + static CORBA::Object_ptr + fetch_reference_naming (CORBA::ORB_ptr orb, + const char *repoman_name = 0) + { + 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 (repoman_name); + + return pns->resolve (name); + } + + Plan_Generator_i::Plan_Generator_i () + : rm_ () + { + } + + bool + Plan_Generator_i::init (CORBA::ORB_ptr orb, + bool rm_use_naming, + const char *rm_name) + { + CORBA::Object_var obj; + + if (rm_use_naming) + { + obj = fetch_reference_naming (orb, rm_name); + } + else + { + obj = orb->string_to_object (rm_name); + } + + this->rm_ = Deployment::RepositoryManager::_narrow (obj.in ()); + + if (CORBA::is_nil (this->rm_.in ())) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) CIAO_PlanGenerator: nil Repository " + "Manager reference, narrow failed\n")); + return false; + } + + return true; + } + + bool + Plan_Generator_i::generate_plan (Deployment::DeploymentPlan &plan, + const char *package_uri, + bool use_package_name) + { + if (CORBA::is_nil (rm_.in ())) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) CIAO_Repoman: nil Execution\n")); + return false; + } + + ::Deployment::PackageConfiguration_var pc; + + ACE_TCHAR package[PACKAGE_NAME_LEN]; + + size_t length = ACE_OS::strlen (package_uri); + size_t pos1 = 0; + size_t pos2 = ACE_OS::strcspn (package_uri + pos1, "+"); + + while (pos1 < length) + { + ACE_OS::strsncpy (package, package_uri + pos1, pos2 + 1); + + if (use_package_name) + { + pc = this->rm_->findPackageByName (package); + + PCVisitor pcv (plan, *pc, true); + pcv.Visit (); + } + else + { + CORBA::StringSeq_var seq = this->rm_->findNamesByType (package); + + for (CORBA::ULong i = 0; i < seq->length (); ++i) + { + pc = this->rm_->findPackageByName (seq[i]); + + PCVisitor pcv (plan, *pc, true); + pcv.Visit (); + } + } + + pos1 += pos2 + 1; + pos2 = ACE_OS::strcspn (package_uri + pos1, "+"); + } + + return true; + } + + bool + Plan_Generator_i::generate_plan (Deployment::DeploymentPlan &plan, + const char *specific_type, + int &index) + { + if (CORBA::is_nil (rm_.in ())) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) CIAO_Repoman: nil Execution\n")); + return false; + } + + ::Deployment::PackageConfiguration_var pc; + + CORBA::StringSeq_var seq = rm_->findNamesByType (specific_type); + for (CORBA::ULong i = 0; i < seq->length (); ++i) + { + pc = rm_->findPackageByName (seq[i]); + + PCVisitor pcv (plan, *pc, false); + index = pcv.Visit (); + } + + return true; + } + } +} diff --git a/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl.h b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl.h new file mode 100644 index 00000000000..98392e4f549 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl.h @@ -0,0 +1,78 @@ +/** + * $Id$ + * @file Plan_Generator_Impl.h + * @author Shanshan Jiang <shanshan.jiang@vanderbilt.edu> + * + * Contains the Plan_Generator_i class, which can be used to generate/modify + * DeploymentPlans. + */ + +#ifndef PLAN_GENERATOR_IMPL_H +#define PLAN_GENERATOR_IMPL_H + +#include "DAnCE/Deployment/Deployment_RepositoryManagerC.h" +#include "Plan_Generator_Impl_Export.h" + +namespace CIAO +{ + namespace Plan_Generator + { + const size_t PACKAGE_NAME_LEN = 1024; + + /** + * @class Plan_Generator_i + * @brief This class generates or modifies deployment plans. + */ + class Plan_Generator_Impl_Export Plan_Generator_i + { + public: + Plan_Generator_i (); + + /** + * @fn init + * @brief Get the proper Repoman, using naming service or ior file. + * @param orb + * @param rm_use_naming Whether use naming service or not. + * @param rm_name The name of the Repoman. + * @returns a boolean denoting if this operation is successful or not. + */ + bool init (CORBA::ORB_ptr orb, + bool rm_use_naming = 0, + const char *rm_name = 0); + + /** + * @fn generate_plan + * @brief Use the package name(s) or type(s) to get the PackageConfiguration + * provided by Repoman; and then use the PackageConfiguration to + * modify the location of all the artifacts in DeploymentPlan. + * @param plan A DeploymentPlan that need to be updated. + * @param package_uri The package name(s) or type(s). + * @param use_package_name Use package name(s) or type(s). + * @returns a boolean denoting if this operation is successful or not. + */ + bool generate_plan (Deployment::DeploymentPlan &plan, + const char *package_uri, + bool use_package_name); + + /** + * @fn generate_plan + * @brief Use the specific type of a package to get the PackageConfiguration + * provided by Repoman; and then use the PackageConfiguration to + * generate the implementation and artifact fields in DeploymentPlan. + * @param plan A DeploymentPlan that need to be updated. + * @param package_uri The package specific type. + * @param index The index of the newly generated implementation and artifact fields. + * @returns a boolean denoting if this operation is successful or not. + */ + bool generate_plan (Deployment::DeploymentPlan &plan, + const char *specific_type, + int &index); + + private: + Deployment::RepositoryManager_var rm_; + }; + + } +} + +#endif /* PLAN_GENERATOR_IMPL_H */ diff --git a/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl_Export.h b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_Impl_Export.h new file mode 100644 index 00000000000..fd120ff7b73 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Generator/Plan_Generator_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_Generator_Impl +// ------------------------------ +#ifndef PLAN_GENERATOR_IMPL_EXPORT_H +#define PLAN_GENERATOR_IMPL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (PLAN_GENERATOR_IMPL_HAS_DLL) +# define PLAN_GENERATOR_IMPL_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && PLAN_GENERATOR_IMPL_HAS_DLL */ + +#if !defined (PLAN_GENERATOR_IMPL_HAS_DLL) +# define PLAN_GENERATOR_IMPL_HAS_DLL 1 +#endif /* ! PLAN_GENERATOR_IMPL_HAS_DLL */ + +#if defined (PLAN_GENERATOR_IMPL_HAS_DLL) && (PLAN_GENERATOR_IMPL_HAS_DLL == 1) +# if defined (PLAN_GENERATOR_IMPL_BUILD_DLL) +# define Plan_Generator_Impl_Export ACE_Proper_Export_Flag +# define PLAN_GENERATOR_IMPL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PLAN_GENERATOR_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PLAN_GENERATOR_IMPL_BUILD_DLL */ +# define Plan_Generator_Impl_Export ACE_Proper_Import_Flag +# define PLAN_GENERATOR_IMPL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PLAN_GENERATOR_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PLAN_GENERATOR_IMPL_BUILD_DLL */ +#else /* PLAN_GENERATOR_IMPL_HAS_DLL == 1 */ +# define Plan_Generator_Impl_Export +# define PLAN_GENERATOR_IMPL_SINGLETON_DECLARATION(T) +# define PLAN_GENERATOR_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PLAN_GENERATOR_IMPL_HAS_DLL == 1 */ + +// Set PLAN_GENERATOR_IMPL_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PLAN_GENERATOR_IMPL_NTRACE) +# if (ACE_NTRACE == 1) +# define PLAN_GENERATOR_IMPL_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PLAN_GENERATOR_IMPL_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PLAN_GENERATOR_IMPL_NTRACE */ + +#if (PLAN_GENERATOR_IMPL_NTRACE == 1) +# define PLAN_GENERATOR_IMPL_TRACE(X) +#else /* (PLAN_GENERATOR_IMPL_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PLAN_GENERATOR_IMPL_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PLAN_GENERATOR_IMPL_NTRACE == 1) */ + +#endif /* PLAN_GENERATOR_IMPL_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp new file mode 100644 index 00000000000..9ca8632e434 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp @@ -0,0 +1,42 @@ +// $Id$ + +#include "Plan_Launcher_Impl.h" + +namespace DAnCE + { + namespace Plan_Launcher + { + + + int + run_main_implementation (int argc, char *argv[]) + { + try + { + Plan_Launcher_Impl pl (argc, argv); + pl.execute(); + } + catch (const Plan_Launcher_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.cpp::run_main_implementation "); + return -1; + } + catch (...) + { + DANCE_ERROR ( (LM_ERROR, "[%M] Plan_Launcher.cpp::run_main_implementation Unknown exception.\n")); + return -1; + } + return 0; + } + + + } // Plan_Launcher +} // DAnCE + + + + diff --git a/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.h new file mode 100644 index 00000000000..b2e7bfee44c --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc new file mode 100644 index 00000000000..66bd8b70963 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc @@ -0,0 +1,47 @@ +// -*- MPC -*- +// $Id$ + +project(Plan_Launcher_Base) : dance_lib, taolib, ciao_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 { + Plan_Launcher_Base_Impl.cpp + Plan_Launcher_Base_Module.cpp + } + + Header_Files { + 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) : dance_lib, taolib, ciao_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_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 + } +} diff --git a/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.cpp b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.cpp new file mode 100644 index 00000000000..cf775f8f1f2 --- /dev/null +++ b/modules/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>\n\n"))); +} + +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(ACE_TEXT("em-ior"), 'k', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option(ACE_TEXT("read-cdr-plan"), 'd', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option(ACE_TEXT("write-cdr-plan"), 'w', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option(ACE_TEXT("plan-uuid"), 't', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option(ACE_TEXT("dam-ior"), 'a', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option(ACE_TEXT("stop-plan"), 'q', ACE_Get_Opt::NO_ARG); + get_opt.long_option(ACE_TEXT("read-plan"), 'x', ACE_Get_Opt::ARG_REQUIRED); + get_opt.long_option(ACE_TEXT("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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl.h new file mode 100644 index 00000000000..485cc2dccf3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl_Export.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Impl_Export.h new file mode 100644 index 00000000000..5dcb51be117 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.cpp b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.cpp new file mode 100644 index 00000000000..65feab0df60 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module.h new file mode 100644 index 00000000000..308ae3c3c00 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module_Export.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Base_Module_Export.h new file mode 100644 index 00000000000..f9e3f7a7961 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Exec.cpp b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Exec.cpp new file mode 100644 index 00000000000..bd832e3dd31 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp new file mode 100644 index 00000000000..bd1c5f49425 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp @@ -0,0 +1,120 @@ +// $Id$ +#include "Plan_Launcher_Impl.h" +#include "orbsvcs/CosNamingC.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" + +#include "ace/OS.h" +#include "ace/Get_Opt.h" +#include "DAnCE/Logger/Log_Macros.h" + +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)); + + ::Deployment::DeploymentPlan * plan = 0; + try + { + CIAO::Config_Handlers::XML_File_Intf intf (deployment_plan_uri); + intf.add_search_path ("CIAO_ROOT", "/docs/schema/"); + intf.add_search_path ("TAO_ROOT", "/docs/schema/"); + plan = intf.release_plan (); + if (0 == plan) + { + 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."); + } + } + catch (...) + { + 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()); + } + + DANCE_DEBUG ((LM_TRACE, DLINFO "Plan_Launcher_Impl::load_xml_plan - Parsing complete....\n")); + return plan; +} + +void Plan_Launcher_Impl::execute() +{ + DANCE_TRACE ("Plan_Launcher_Impl::execute()"); + + if (this->mode_ & MODE_START_PLAN) + { + 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(); + } + + if (this->mode_ & MODE_STOP_PLAN) + { + this->stop_plan(); + } + + if (this->mode_ & MODE_WRITE_CDR) + { + ::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); + } +} +void Plan_Launcher_Impl::stop_plan() +{ + DANCE_TRACE ("Plan_Launcher_Impl::stop_plan"); + + if (0 < this->xml_plan_urls_.size()) + { + size_t sz = this->xml_plan_urls_.size(); + for (size_t i= 0; i < sz; ++i) + { + 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())) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Plan_Launcher_Impl::stop_plan - " + "tear down assembly failed: unknown plan uuid.\n")); + } + } + } + this->Plan_Launcher_Base_Impl::stop_plan(); +} + +} // Plan_Launcher +} // DAnCE diff --git a/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h new file mode 100644 index 00000000000..a21a0fe65d5 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h @@ -0,0 +1,43 @@ +/** + * $Id$ + * @file Plan_Launcher_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_IMPL_H +#define PLAN_LAUNCHER_IMPL_H + +#include "Plan_Launcher_Impl_Export.h" +#include "Plan_Launcher_Base_Impl.h" + +namespace DAnCE + { + namespace Plan_Launcher + { + + /** + * @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) {}; + + virtual ~Plan_Launcher_Impl () {}; + + void execute(); + static ::Deployment::DeploymentPlan* load_xml_plan (const char *deployment_plan_uri); + + protected: + virtual void stop_plan(); + }; // class Plan_Launcher_Impl + + } // Plan_Launcher +} // DAnCE + + +#endif /* PLAN_LAUNCHER_IMPL_H */ diff --git a/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl_Export.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl_Export.h new file mode 100644 index 00000000000..1c85d1b98c9 --- /dev/null +++ b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s Config_Handlers +// ------------------------------ +#ifndef PLAN_LAUNCHER_IMPL_EXPORT_H +#define PLAN_LAUNCHER_IMPL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (PLAN_LAUNCHER_IMPL_HAS_DLL) +# define PLAN_LAUNCHER_IMPL_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && PLAN_LAUNCHER_IMPL_HAS_DLL */ + +#if !defined (PLAN_LAUNCHER_IMPL_HAS_DLL) +# define PLAN_LAUNCHER_IMPL_HAS_DLL 1 +#endif /* ! PLAN_LAUNCHER_IMPL_HAS_DLL */ + +#if defined (PLAN_LAUNCHER_IMPL_HAS_DLL) && (PLAN_LAUNCHER_IMPL_HAS_DLL == 1) +# if defined (PLAN_LAUNCHER_IMPL_BUILD_DLL) +# define Plan_Launcher_Impl_Export ACE_Proper_Export_Flag +# define PLAN_LAUNCHER_IMPL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PLAN_LAUNCHER_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PLAN_LAUNCHER_IMPL_BUILD_DLL */ +# define Plan_Launcher_Impl_Export ACE_Proper_Import_Flag +# define PLAN_LAUNCHER_IMPL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PLAN_LAUNCHER_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PLAN_LAUNCHER_IMPL_BUILD_DLL */ +#else /* PLAN_LAUNCHER_IMPL_HAS_DLL == 1 */ +# define Plan_Launcher_Impl_Export +# define PLAN_LAUNCHER_IMPL_SINGLETON_DECLARATION(T) +# define PLAN_LAUNCHER_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PLAN_LAUNCHER_IMPL_HAS_DLL == 1 */ + +// Set PLAN_LAUNCHER_IMPL_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PLAN_LAUNCHER_IMPL_NTRACE) +# if (ACE_NTRACE == 1) +# define PLAN_LAUNCHER_IMPL_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PLAN_LAUNCHER_IMPL_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PLAN_LAUNCHER_IMPL_NTRACE */ + +#if (PLAN_LAUNCHER_IMPL_NTRACE == 1) +# define PLAN_LAUNCHER_IMPL_TRACE(X) +#else /* (PLAN_LAUNCHER_IMPL_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PLAN_LAUNCHER_IMPL_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PLAN_LAUNCHER_IMPL_NTRACE == 1) */ + +#endif /* PLAN_LAUNCHER_IMPL_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.cpp b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.cpp new file mode 100644 index 00000000000..0d2c179fb47 --- /dev/null +++ b/modules/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 - " + "Error : %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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module.h new file mode 100644 index 00000000000..cb0895694d9 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module_Export.h b/modules/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Module_Export.h new file mode 100644 index 00000000000..cdeb11e8abf --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/Plan_Launcher/launcher.cpp b/modules/CIAO/DAnCE/Plan_Launcher/launcher.cpp new file mode 100644 index 00000000000..4a93cdfdd77 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/RedirectionService/CCMObjectLocator.cpp b/modules/CIAO/DAnCE/RedirectionService/CCMObjectLocator.cpp new file mode 100644 index 00000000000..63487b08874 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/RedirectionService/CCMObjectLocator.h b/modules/CIAO/DAnCE/RedirectionService/CCMObjectLocator.h new file mode 100644 index 00000000000..cf92d6aa292 --- /dev/null +++ b/modules/CIAO/DAnCE/RedirectionService/CCMObjectLocator.h @@ -0,0 +1,105 @@ +// $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 RedirectionService_Export 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); + + virtual ~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/modules/CIAO/DAnCE/RedirectionService/NameServiceRedirection.cpp b/modules/CIAO/DAnCE/RedirectionService/NameServiceRedirection.cpp new file mode 100644 index 00000000000..c5c5c0c86b2 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/RedirectionService/NameServiceRedirection.h b/modules/CIAO/DAnCE/RedirectionService/NameServiceRedirection.h new file mode 100644 index 00000000000..9de7f179eab --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/RedirectionService/RedirectionService.cpp b/modules/CIAO/DAnCE/RedirectionService/RedirectionService.cpp new file mode 100644 index 00000000000..e79673bfa4c --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/RedirectionService/RedirectionService.h b/modules/CIAO/DAnCE/RedirectionService/RedirectionService.h new file mode 100644 index 00000000000..d5749109600 --- /dev/null +++ b/modules/CIAO/DAnCE/RedirectionService/RedirectionService.h @@ -0,0 +1,75 @@ +// $Id$ +#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/modules/CIAO/DAnCE/RedirectionService/RedirectionService.mpc b/modules/CIAO/DAnCE/RedirectionService/RedirectionService.mpc new file mode 100644 index 00000000000..318c38c2244 --- /dev/null +++ b/modules/CIAO/DAnCE/RedirectionService/RedirectionService.mpc @@ -0,0 +1,14 @@ +// -*- MPC -*- +// $Id$ + +project : taolib, ciao_output, iortable, naming, dance_logger, portableserver, avoids_minimum_corba { + sharedname = DAnCE_RedirectionService + dynamicflags += REDIRECTIONSERVICE_BUILD_DLL + + Source_Files { + RedirectionService.cpp + NameServiceRedirection.cpp + CCMObjectLocator.cpp + } +} + diff --git a/modules/CIAO/DAnCE/RedirectionService/RedirectionService_Export.h b/modules/CIAO/DAnCE/RedirectionService/RedirectionService_Export.h new file mode 100644 index 00000000000..af8e613acfc --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/RepositoryManager/DAnCE_RepositoryManager_Module_Export.h b/modules/CIAO/DAnCE/RepositoryManager/DAnCE_RepositoryManager_Module_Export.h new file mode 100644 index 00000000000..b94621bd39b --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/DAnCE_RepositoryManager_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_RepositoryManager_Module +// ------------------------------ +#ifndef DANCE_REPOSITORYMANAGER_MODULE_EXPORT_H +#define DANCE_REPOSITORYMANAGER_MODULE_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL) +# define DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL */ + +#if !defined (DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL) +# define DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL 1 +#endif /* ! DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL */ + +#if defined (DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL) && (DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL == 1) +# if defined (DANCE_REPOSITORYMANAGER_MODULE_BUILD_DLL) +# define DAnCE_RepositoryManager_Module_Export ACE_Proper_Export_Flag +# define DANCE_REPOSITORYMANAGER_MODULE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DANCE_REPOSITORYMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DANCE_REPOSITORYMANAGER_MODULE_BUILD_DLL */ +# define DAnCE_RepositoryManager_Module_Export ACE_Proper_Import_Flag +# define DANCE_REPOSITORYMANAGER_MODULE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DANCE_REPOSITORYMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DANCE_REPOSITORYMANAGER_MODULE_BUILD_DLL */ +#else /* DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL == 1 */ +# define DAnCE_RepositoryManager_Module_Export +# define DANCE_REPOSITORYMANAGER_MODULE_SINGLETON_DECLARATION(T) +# define DANCE_REPOSITORYMANAGER_MODULE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DANCE_REPOSITORYMANAGER_MODULE_HAS_DLL == 1 */ + +// Set DANCE_REPOSITORYMANAGER_MODULE_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DANCE_REPOSITORYMANAGER_MODULE_NTRACE) +# if (ACE_NTRACE == 1) +# define DANCE_REPOSITORYMANAGER_MODULE_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DANCE_REPOSITORYMANAGER_MODULE_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DANCE_REPOSITORYMANAGER_MODULE_NTRACE */ + +#if (DANCE_REPOSITORYMANAGER_MODULE_NTRACE == 1) +# define DANCE_REPOSITORYMANAGER_MODULE_TRACE(X) +#else /* (DANCE_REPOSITORYMANAGER_MODULE_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_REPOSITORYMANAGER_MODULE_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DANCE_REPOSITORYMANAGER_MODULE_NTRACE == 1) */ + +#endif /* DANCE_REPOSITORYMANAGER_MODULE_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/RepositoryManager/Options.cpp b/modules/CIAO/DAnCE/RepositoryManager/Options.cpp new file mode 100644 index 00000000000..12af68b7013 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/Options.cpp @@ -0,0 +1,147 @@ +// $Id$ + +// Options.cpp,v Stoyan + +#include "ace/Get_Opt.h" +#include "ace/ARGV.h" +#include "Options.h" + + +bool +Options::parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("ov:n:l:u:t:icfdsTNa")); + + int c; + + while ((c = get_opt ()) != -1) + switch (c) + { + case 'o': + this->write_to_ior_ = true; + this->register_with_ns_ = false; + break; + case 'v': + this->write_to_ior_ = false; + this->register_with_ns_ = true; + this->repoman_name_ = get_opt.opt_arg (); + break; + case 'i': + this->install_ = true; + break; + case 'c': + this->create_ = true; + break; + case 'd': + this->delete_ = true; + break; + case 'f': + this->find_ = true; + break; + case 's': + this->shutdown_ = true; + break; + case 'n': + this->name_ = get_opt.opt_arg (); + break; + case 'l': + this->path_ = get_opt.opt_arg (); + break; + case 'u': + this->uuid_ = get_opt.opt_arg (); + break; + case 'N': + this->all_names_ = true; + break; + case 'T': + this->all_types_ = true; + break; + case 't': + this->names_by_type_ = true; + this->type_ = get_opt.opt_arg (); + break; + // Usage fallthrough. + default: + this->usage (); + return false; + } + + if ((this->name_ == "") + && (this->shutdown_ == false) + && (this->uuid_ == "") + && (this->all_names_ == false) + && (this->all_types_ == false) + && (this->names_by_type_ == false)) + { + this->usage (); + return false; + } + else if (this->name_ != "") + { + if (!(this->install_ || this->create_ || this->find_ || this->delete_)) + { + this->usage (); + return false; + } + else if (this->install_ && this->path_ == "") + { + this->usage (); + return false; + } + else if (this->create_ && this->path_ == "") + { + this->usage (); + return false; + } + } + else if (this->uuid_ != "") + { + if (!this->find_) + { + this->usage (); + return false; + } + } + + return true; +} + +/// @todo Exit is not nice, return -1 so that the caller can do something and +/// we don't exit abruptly +void Options::usage (void) +{ + ACE_DEBUG ((LM_INFO, "OPTIONS: \n\ + -o <using ior file> \n\ + -v <: name of naming service> \n\ + -s <shutdown> \n\ + -n <:name> \n\ + [-i <install> -l <:path>] \n\ + [-c <create> -l <:path>] \n\ + [-d <delete>] \n\ + [-f <find>] \n\ + -u <:uuid> \n\ + [-f <find>] \n\ + -a <names by type> \n\ + [-t <:type>] \n\ + -N <all names> \n\ + -T <all types>\n")); +} + +Options::Options (void) + : name_ (""), + uuid_ (""), + type_ (""), + path_ (""), + delete_ (false), + install_ (false), + create_ (false), + find_ (false), + all_names_ (false), + all_types_ (false), + names_by_type_ (false), + shutdown_ (false), + register_with_ns_ (false), + write_to_ior_ (true), + repoman_name_ ("") +{ +} diff --git a/modules/CIAO/DAnCE/RepositoryManager/Options.h b/modules/CIAO/DAnCE/RepositoryManager/Options.h new file mode 100644 index 00000000000..845e339cedd --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/Options.h @@ -0,0 +1,93 @@ +// $Id$ + +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Options.h + * + * $Id$ + * + * TheOptions is an Options class wrapped into an ACE_Singleton + * with Null_Mutex because the client is single-threaded. + * + * + * @author Stoyan Paunov + */ +//============================================================================= + + +#ifndef RM_OPTIONS_H +#define RM_OPTIONS_H + +#include "ace/Get_Opt.h" +#include "ace/SString.h" //for ACE_CString +#include "ace/Singleton.h" //for ACE_Singleton +#include "ace/Null_Mutex.h" //for ACE_Null_Mutex + +//forward declaration +class Options; + +typedef ACE_Singleton <Options, ACE_Null_Mutex> TheOptions; + +class Options +{ +public: + + ///constructor + Options (void); + + /// parses commandline arguments + bool parse_args (int argc, ACE_TCHAR *argv[]); + + /// Name of package + ACE_CString name_; + + /// Name of package + ACE_CString uuid_; + + /// Type of package + ACE_CString type_; + + /// specifies the local path for install + ACE_CString path_; + + /// delete the name_ + bool delete_; + + /// installs the name_ + bool install_; + + /// creates the name_ + bool create_; + + /// finds the name_ + bool find_; + + /// get all Names + bool all_names_; + + /// get all types + bool all_types_; + + /// find all names by type + bool names_by_type_; + + /// shutdown the RepositoryManagerDemon + bool shutdown_; + + // use naming service + bool register_with_ns_; + + // use ior file + bool write_to_ior_; + + // Name of RepoMan + ACE_CString repoman_name_; + +protected: + //usage function + void usage (void); +}; + +#endif /* RM_OPTIONS_H */ diff --git a/modules/CIAO/DAnCE/RepositoryManager/PC_Updater.cpp b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater.cpp new file mode 100644 index 00000000000..1acd3d8c4b9 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater.cpp @@ -0,0 +1,256 @@ +// $Id$ + +#include "ace/Log_Msg.h" +#include "DAnCE/Deployment/Deployment_DataC.h" +#include "PC_Updater.h" +#include "PC_Updater_T.h" +#include "ace/Containers_T.h" //for ACE_Double_Linked_List + +namespace +{ + const size_t TEMP_LEN = 1024; +} + +using namespace PC_Updater_T; + + + //PATH of glory/gory to update the locations of the IADs + // + //PackageConfiguration something; + //ComponentPackageDescriptions basePackage; + //PackagedComponentImplementations implementation; + //ComponentImplementationDescription referencedImplementation; + // + //MONOLITHIC Component: + //MonolithicImplementationDescriptions monolithicImpl; + //NamedImplementationArtifacts primaryArtifact; + //ImplementationArtifactDescription referencedArtifact; + //::CORBA::StringSeq location; + // + //ASSEMBLY-BASED Component + //ComponentAssemblyDescriptions assemblyImpl; + //SubcomponentInstantiationDescriptions instance; + //ComponentPackageDescriptions package; + //... + + + /* + * PC_Updater Constructors + */ + +PC_Updater::PC_Updater (const char* server_path, const char* package) +: server_path_ (server_path), + file_list_ (), + package_ (package), + success_ (true) +{ +} + + +PC_Updater::PC_Updater (ACE_CString& server_path, ACE_CString& package) +: server_path_ (server_path), + file_list_ (), + package_ (package), + success_ (true) +{ +} + + /* + * PC_Updater - Destructor + */ + +PC_Updater::~PC_Updater () +{ + this->clear_list (); +} + + +void PC_Updater::clear_list () +{ + while (!this->file_list_.is_empty ()) + { + ZIP_File_Info* inf = this->file_list_.delete_head (); + + //deallocate the head of the filename list + delete inf; + } +} + + + /* + * PC_Updater - Object update methods + */ + + + // PackageConfiguration + + bool PC_Updater::update (::Deployment::PackageConfiguration &pc) + { + //get the list of files in the package and figure out the names of all necessary files + if (!ZIP_Wrapper::file_list_info (const_cast <char*> (this->package_.c_str ()), this->file_list_)) + return false; + + update_sequence (pc.basePackage, this); + + return this->success_; + } + + + // ComponentInterfaceDescription + + void PC_Updater::update (::Deployment::ComponentInterfaceDescription &) + { + } + + // Requirement + + void PC_Updater::update (::Deployment::Requirement &) + { + } + + + // ComponentExternalPortEndpoint + + void PC_Updater::update (::Deployment::ComponentExternalPortEndpoint &) + { + } + + + + // ImplementationDependency + + void PC_Updater::update (Deployment::ImplementationDependency &) + { + } + + // ComponentPackageReference + + void PC_Updater::update (::Deployment::ComponentPackageReference &) + { + } + + // SubcomponentInstantiationDescription + + void PC_Updater::update (::Deployment::SubcomponentInstantiationDescription &sid) + { + update_sequence (sid.basePackage, this); + } + + // SubcomponentPortEndpoint + + void PC_Updater::update (::Deployment::SubcomponentPortEndpoint& ) + { + } + + // AssemblyConnectionDescription + + void PC_Updater::update (::Deployment::AssemblyConnectionDescription &) + { + } + + + // AssemblyPropertyMapping + + void + PC_Updater::update (::Deployment::AssemblyPropertyMapping &) + { + } + + // ComponentAssemblyDescription + + void PC_Updater::update (::Deployment::ComponentAssemblyDescription& cad) + { + update_sequence (cad.instance, this); + } + + // ImplementationArtifactDescription + + void PC_Updater::update (::Deployment::ImplementationArtifactDescription &iad) + { + const char* location = CORBA::string_dup (iad.location[0]); + + //create an iterator + ACE_Double_Linked_List_Iterator<ZIP_File_Info> iter (this->file_list_); + + //find the correct path and return + while (!iter.done ()) + { + const char* full_path = iter.next ()->name_.c_str (); + //weird. Need to call next to get current ?!?! + + //is it an implementation artifact? + const char* name = ACE_OS::strstr (full_path, "implementations/"); + if (name) + { + //now check if the name matches + name = ACE_OS::strstr (full_path, iad.location[0]); + + if (name) + { + ACE_CString loc (this->server_path_); + loc += "/implementations/"; + loc += location; + + iad.location[0] = CORBA::string_dup (loc.c_str ()); + + //cout << "Location after update: " << iad.location[0] << endl << endl; + return; + } + } + iter++; + } + + ACE_ERROR ((LM_ERROR, + "[PC_Updater::update] Unable to update: %s!\n", + location)); + + this->success_ = false; + } + + // NamedImplementationArtifact + + void PC_Updater::update (::Deployment::NamedImplementationArtifact &nia) + { + update (nia.referencedArtifact); + } + + // ImplementationRequirement + void PC_Updater::update (::Deployment::ImplementationRequirement &) + { + } + + // MonolithicImplementationDescription + void PC_Updater::update (::Deployment::MonolithicImplementationDescription &mid) + { + update_sequence (mid.primaryArtifact, this); + } + + // Capability + void PC_Updater::update (::Deployment::Capability &) + { + } + + // ComponentImplementationDescription + void PC_Updater::update (::Deployment::ComponentImplementationDescription &cid) + { + update_sequence (cid.assemblyImpl, this); + update_sequence (cid.monolithicImpl, this); + } + + // PackagedComponentImplementation + void PC_Updater::update (::Deployment::PackagedComponentImplementation &pci) + { + PC_Updater::update (pci.referencedImplementation); + } + + // ComponentPackageDescription + void PC_Updater::update (::Deployment::ComponentPackageDescription &comppkgdesc) + { + update_sequence (comppkgdesc.implementation, this); + } + + + // Property + void PC_Updater::update (Deployment::Property& ) + { + } diff --git a/modules/CIAO/DAnCE/RepositoryManager/PC_Updater.h b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater.h new file mode 100644 index 00000000000..5b22e249331 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater.h @@ -0,0 +1,113 @@ + +/* -*- C++ -*- */ + +//======================================================================== +/** + * file PC_Updater.h + * + * $Id$ + * + * This class is used to update the location field of the implementation + * artifacts in the PackageConfiguration, so that they point to the + * physical libraries on the collocated HTTP server + * + * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + */ +//======================================================================== + +#ifndef PC_UPDATER_H +#define PC_UPDATER_H +#include /**/ "ace/pre.h" + +#include "DAnCE/Deployment/DeploymentC.h" +#include "ace/SString.h" //for the ACE_CString + +#include "ZIP_Wrapper.h" //Wrapper around zzip +#include "ace/Containers_T.h" //for ACE_Double_Linked_List +#include "ace/Malloc_Allocator.h" //for ACE_New_Allocator needed by the doubly link list + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/** + * @class PC_Updater + * + * This class defines a set of overloaded methods used to update + * the contents of a PackageConfiguration. More specifically the class + * goes through the PackageConfiguration and updates the locations of the + * artifacts, wrt to their location on the HTTP server. + */ +class PC_Updater +{ +public: + + /// Constructors + + PC_Updater (const char* server_path, const char* package); + PC_Updater (ACE_CString& server_path, ACE_CString& package); + + ~PC_Updater (); + + /// A whole slew of overloaded routines for different IDL + /// data types part of the PackageConfiguration. + + bool update (::Deployment::PackageConfiguration &pc); + + void update (::Deployment::Property &property); + + void update (::Deployment::AssemblyConnectionDescription &acd); + + void update (::Deployment::AssemblyPropertyMapping &apm); + + void update (::Deployment::ComponentPackageDescription &comppkgdesc); + + void update (::Deployment::MonolithicImplementationDescription &mid); + + void update (::Deployment::PackagedComponentImplementation &pci); + + void update (::Deployment::SubcomponentPortEndpoint &spe); + + void update (::Deployment::Requirement &requirement); + + void update (::Deployment::ComponentExternalPortEndpoint &cepe); + + void update (::Deployment::ComponentPackageReference &cpr); + + void update (::Deployment::ComponentImplementationDescription &cid); + + void update (::Deployment::SubcomponentInstantiationDescription &sid); + + void update (::Deployment::NamedImplementationArtifact &named_implementation); + + void update (::Deployment::ComponentInterfaceDescription &cid); + + void update (::Deployment::Capability &capability); + + void update (::Deployment::ImplementationArtifactDescription &iad); + + void update (::Deployment::ImplementationRequirement &ir); + + void update (::Deployment::ImplementationDependency &id); + + void update (::Deployment::ComponentAssemblyDescription& cad); + +protected: + + void clear_list (); + +private: + + ACE_CString server_path_; + + /// create a doubly link list + //ACE_New_Allocator allocator_; + ACE_Double_Linked_List<ZIP_File_Info> file_list_; + + ACE_CString package_; + bool success_; +}; + +#include /**/ "ace/post.h" + +#endif /* PC_UPDATER_H */ diff --git a/modules/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp new file mode 100644 index 00000000000..a5f5ec5fb2e --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp @@ -0,0 +1,20 @@ +// $Id$ +#ifndef PC_UPDATER_T_C +#define PC_UPDATER_T_C +#include "PC_Updater.h" +#include "PC_Updater_T.h" + +namespace PC_Updater_T +{ + /// Dumps a sequence + template <typename SEQUENCE> + void update_sequence (SEQUENCE &seq, PC_Updater* updater) + { + CORBA::ULong const size = seq.length (); + + for (CORBA::ULong i = 0; i < size; ++i) + updater->update (seq[i]); + } +} + +#endif /* PC_Updater_C */ diff --git a/modules/CIAO/DAnCE/RepositoryManager/PC_Updater_T.h b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater_T.h new file mode 100644 index 00000000000..0696c685e2b --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/PC_Updater_T.h @@ -0,0 +1,40 @@ + +/* -*- C++ -*- */ + +//================================================================== +/** + * file PC_Updater_T.h + * + * $Id$ + * + * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + */ +//===================================================================== + +#ifndef CIAO_CONFIG_HANDLERS_PC_UPDATER_T_H +#define CIAO_CONFIG_HANDLERS_PC_UPDATER_T_H +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace PC_Updater_T +{ + template <typename SEQUENCE> + static void update_sequence (SEQUENCE &seq); +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "PC_Updater_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("PC_Updater_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + + +#include /**/ "ace/post.h" +#endif /*CIAO_CONFIG_HANDLERS_PC_Updater_T_H*/ diff --git a/modules/CIAO/DAnCE/RepositoryManager/README b/modules/CIAO/DAnCE/RepositoryManager/README new file mode 100644 index 00000000000..322b00098ac --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/README @@ -0,0 +1,46 @@ +This is the README file for the Repository Manager (RM). + +Building RM: +In order to be able to compile the RM you need to have ZLIB lib because the RM +uses it to read the contents of CCM packages. In order to compile the RM +successfully you will need to do the following: +1.Download the binary version of ZLIB or build it yourself +3.Create an "include" and a "lib" subdirectory. Then copy the libraries files into + the "lib" subdirectory and copy zlib.h into the "include" subdirectory. +4.Set $ZLIB_ROOT to point to the directories where you placed the libraries and + the include files. +5.Turn on zzip and zlib in default.features for MPC. +6.MPC will handle the rest. + +If you want to get the component package through http server: +1.Be sure to set JAWS_DOCUMENT_ROOT to the installation path of the RepoMan, i.e., $CIAO_ROOT/DAnCE/RepositoryManager. +2.Start JAWS: $ACE_ROOT/apps/JAWS/server/main + +Start RM: +1.Using ior file: + RepositoryManagerDaemon -o +2.Using Naming Service: + RepositoryManagerDaemon -v [NameofRM] + +Using RMadmin: +1.Install component package: (use BasicSP for example) + Be sure you have BasicSP.cpk in the $CIAO_ROOT/DAnCE/RepositoryManager/packages + > RMadmin -o -n BasicSP -i -l packages/BasicSP.cpk + or + > RMadmin -o -n BasicSP -i -l http://127.0.0.1:5432/packages/BasicSP.cpk (If the JAWS is started) + This will create the BasicSP directory, BasicSP.cpk file and BasicSP.epc file in the + $CIAO_ROOT/DAnCE/RepositoryManager/RepositoryManager/ +2.Delete component package: (use BasicSP for example) + > RMadmin -o -n BasicSP -d +3.Find component package by its name: (use BasicSP for example) + > RMadmin -o -n BasicSP -f +4.Stop RM: + > RMadmin -o -s + This will create the RM_record file in the $CIAO_ROOT/DAnCE/RepositoryManager/RepositoryManager/ which record the + names and UUIDs of the installed component packages. + + + + + + diff --git a/modules/CIAO/DAnCE/RepositoryManager/RM_Helper.cpp b/modules/CIAO/DAnCE/RepositoryManager/RM_Helper.cpp new file mode 100644 index 00000000000..cd4b92669d0 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RM_Helper.cpp @@ -0,0 +1,265 @@ +// $Id$ + +#include "RM_Helper.h" +#include "ace/Auto_Ptr.h" //for Auto_Ptr +#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" + + +void +RM_Helper::pc_to_cdr (const Deployment::PackageConfiguration& pc, TAO_OutputCDR& cdr) +{ + cdr << pc; +} + + +void +RM_Helper::cdr_to_pc (Deployment::PackageConfiguration& pc, TAO_InputCDR& cdr) +{ + cdr >> pc; +} + + +bool +RM_Helper::externalize (const Deployment::PackageConfiguration& pc, const char* path) +{ + size_t bufsiz = 0; + TAO_OutputCDR out (bufsiz); + + RM_Helper::pc_to_cdr (pc, out); + + const ACE_Message_Block* mb = out.begin (); + + return write_pc_to_disk (path, *(const_cast<ACE_Message_Block*> (mb))); +} + + +bool +RM_Helper::reincarnate (Deployment::PackageConfiguration& pc, const char* path) +{ + size_t length = 0; + ACE_Auto_Ptr<ACE_Message_Block> mb (read_pc_from_disk (path, length)); + + if (!mb.get ()) + return false; + + TAO_InputCDR in (mb.get ()); + + RM_Helper::cdr_to_pc (pc, in); + + return true; +} + + +/// This function attempts to copy the file from a specified location +/// to another specified location on the hard disk. +bool +RM_Helper::copy_from_disk_to_disk (const char* from_path, const char* to_path) +{ + if (ACE_OS::strcmp (from_path, to_path) == 0) + return true; + + // Open the files + ACE_HANDLE from_handle = ACE_OS::open (from_path, O_RDONLY); + if (from_handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[RM::copy_from_disk_to_disk] file open error")), + 0); + + ACE_stat file_info; + ACE_OS::fstat (from_handle, &file_info); + ACE_UINT64 file_length = file_info.st_size; + + ACE_HANDLE to_handle = ACE_OS::open (to_path, O_CREAT | O_TRUNC | O_WRONLY); + if (to_handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[RM::copy_from_disk_to_disk] file creation error")), + 0); + + + // Read the contents of the file into the buffer and write the data to another file + ACE_Message_Block *mb = 0; + size_t length; + size_t number = 0; + bool last = false; + + while (true) + { + if ((file_length - BUFSIZ*number) > BUFSIZ) + length = BUFSIZ; + else + { + length = static_cast<size_t> (file_length - BUFSIZ*number); + last = true; + } + + mb = new ACE_Message_Block (length); + + if (ACE_OS::read_n (from_handle, mb->wr_ptr (), length) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[RM::copy_from_disk_to_disk] file read error")), + 0); + + ++number; + + mb->length (length); + + for (ACE_Message_Block *curr = mb; curr != 0; curr = curr->cont ()) + if (ACE_OS::write_n (to_handle, curr->rd_ptr (), curr->length ()) == -1) + { + mb->release (); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[RM::copy_from_disk_to_disk] file write error")), + 0); + } + + mb->release (); + + if (last) + break; + } + + // Close the files + ACE_OS::close (from_handle); + ACE_OS::close (to_handle); + + 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 RM_Helper::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 ("[RM::write_to_disk] 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 ("write error")), + false); + + // Close the file handle + ACE_OS::close (handle); + + 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 +/// +/// @note This function write the contents in a way that preserves the +/// structure of the ACE_Message_Block. It is relevant for +/// PackageConfigurations ONLY +bool RM_Helper::write_pc_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 const 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 ("[RM::write_to_disk] 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 ("write error")), + 0); + + // Close the file handle + ACE_OS::close (handle); + + return true; +} + + +/// Function to read the contents of a file from disk into an ACE_Message_Block +/// returns a pointer to an ACE_Message_Block and updates the lenght on success +/// 0 on failure +ACE_Message_Block* +RM_Helper::read_pc_from_disk ( + const char* full_path, + size_t &length + ) +{ + length = 0; + + // Open the file + ACE_HANDLE const handle = ACE_OS::open (full_path, O_RDONLY); + if (handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[RM::read_mb_from_disk] file open error")), + 0); + + ACE_stat file_info; + ACE_OS::fstat (handle, &file_info); + + // Get and check the length of the file + length = static_cast<size_t> (file_info.st_size); + + ACE_INT64 check = length; + if (check != file_info.st_size) + { + length = 0; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[RM::read_mb_from_disk] file length error")), + 0); + } + + // Read the contents of the file into the buffer + ACE_Message_Block* mb = 0; + ACE_NEW_RETURN (mb, ACE_Message_Block (length + 1), 0); + + if (ACE_OS::read_n (handle, mb->wr_ptr (), length) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[RM::read_mb_from_disk] file read error")), + 0); + + mb->length (length); + + // Close the file handle + ACE_OS::close (handle); + + return mb; +} diff --git a/modules/CIAO/DAnCE/RepositoryManager/RM_Helper.h b/modules/CIAO/DAnCE/RepositoryManager/RM_Helper.h new file mode 100644 index 00000000000..47e46d35a6f --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RM_Helper.h @@ -0,0 +1,81 @@ + +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file RM_Helper.h + * + * $Id$ + * + * This class aggregates a number of helper functions used by the + * CIAO RepositoryManager + * + * + * @author Stoyan Paunov + */ +//============================================================================= + +#ifndef RM_HELPER_H_ +#define RM_HELPER_H_ + + +#include "DAnCE/Deployment/Deployment_Packaging_DataC.h" +#include "tao/CDR.h" +#include "ace/Message_Block.h" + + +class RM_Helper +{ +public: + + static void pc_to_cdr (const Deployment::PackageConfiguration& pc, TAO_OutputCDR& cdr); + + static void cdr_to_pc (Deployment::PackageConfiguration& pc, TAO_InputCDR& cdr); + + static bool externalize (const Deployment::PackageConfiguration& pc, const char* path); + + static bool reincarnate (Deployment::PackageConfiguration& pc, const char* path); + + /** + * Function that copies the file from a specified location to another + * specified location on the hard disk. + * @retval true on success + * @retval false on error + */ + static bool copy_from_disk_to_disk (const char* from_path, const char* to_path); + + /** + * Function that writes out a file to a specified location on the hard disk + * @retval true on success + * @retval false on already exists and replace == false + * @retval false on error + */ + static bool write_to_disk (const char* full_path, + ACE_Message_Block& mb, + bool replace = true + ); + + /** + * Function that writes out a file to a specified location on the hard disk + * @retval true on success + * @retval false on already exists and replace == false + * @retval 0 on error + * @note This function is relevant for PackageConfigurations ONLY + */ + static bool write_pc_to_disk (const char* full_path, + ACE_Message_Block& mb, + bool replace = true); + + /** + * Function to read the contents of a file from disk into an + * ACE_Message_Block returns a pointer to an ACE_Message_Block and updates + * the lenght on success + * @retval 0 on failure + */ + + static ACE_Message_Block* read_pc_from_disk (const char* full_path, + size_t &length); + +}; + +#endif diff --git a/modules/CIAO/DAnCE/RepositoryManager/RMadmin.cpp b/modules/CIAO/DAnCE/RepositoryManager/RMadmin.cpp new file mode 100644 index 00000000000..7b34082daaf --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RMadmin.cpp @@ -0,0 +1,247 @@ +/* -*- C++ -*- */ + +/*** + * file RMClient.cpp + * + * $Id$ + * + * A sample client to the RepositoryManager showcasing how to use it + * + * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> + * Shanshan Jiang <shanshan.jiang@vanderbilt.edu> + **/ + +#include "RepositoryManagerDaemonC.h" +#include "Options.h" + +#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 fstat and mkdir +#include "ace/streams.h" + + +#include "RM_Helper.h" //to be able to externalize/internalize a PackageConfiguration +#include "tao/CDR.h" //for TAO CDR classes +#include "ace/Message_Block.h" //for ACE_Message_Block + +#include "Config_Handlers/Package_Handlers/PCD_Handler.h" + +#include "orbsvcs/CosNamingC.h" + + +//IOR file of the RM +static const char *ior = "file://RepositoryManagerDaemon.ior"; + +// Name service of the RM +static const char *RMname_service; + +/// main function that provides a sample interface for RM clients +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + + Options* options = TheOptions::instance (); + if (!options->parse_args (argc, argv)) + return -1; + + CORBA::Object_var obj; + + if (options->write_to_ior_) + { + obj = orb->string_to_object (ior); + } + + else if (options->register_with_ns_) + { + if (options->repoman_name_ != "") + RMname_service = const_cast<char*> (options->repoman_name_.c_str ()); + + // 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); + + // String dup required for MSVC6 + name[0].id = CORBA::string_dup (RMname_service); + + // Resolve object from name + obj = naming_context->resolve (name); + } + + + CIAO::RepositoryManagerDaemon_var rm = + CIAO::RepositoryManagerDaemon::_narrow (obj.in ()); + + if (CORBA::is_nil (rm.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire RepositoryManagerDaemon's objref\n"), + -1); + } + + if (options->shutdown_) + { + rm->shutdown (); + } + else if (options->all_names_) + { + try + { + CORBA::StringSeq_var seq = rm->getAllNames (); + cout << "Known Names:\n"; + for (size_t i = 0; + i < seq->length (); + ++i) + cout << seq[i] << endl; + } + catch (CORBA::Exception & ex) + { + cout << "\nException caught!" << ex << "\n"; + return 0; + } + } + else if (options->all_types_) + { + try + { + CORBA::StringSeq_var seq = rm->getAllTypes (); + cout << "Known Component Interface Types:\n"; + for (size_t i = 0; + i < seq->length (); + ++i) + cout << seq[i] << endl; + } + catch (CORBA::Exception & ex) + { + cout << "\nException caught!" << ex << "\n"; + return 0; + } + } + else if (options->type_ != "" && options->names_by_type_) + { + try + { + CORBA::StringSeq_var seq = rm->findNamesByType (options->type_.c_str ()); + cout << "Known Component Interface Types:\n"; + for (size_t i = 0; + i < seq->length (); + ++i) + cout << seq[i] << endl; + } + catch (CORBA::Exception & ex) + { + cout << "\nException caught!" << ex << "\n"; + return 0; + } + } + else if (options->install_) + { + try + { + rm->installPackage (options->name_.c_str (), options->path_.c_str (), false); + } + catch (CORBA::Exception & ex) + { + cout << "\nException caught!" << ex << "\n"; + return 0; + } + + cout << "\nReassuring that the package in the repository ..." << endl; + try + { + Deployment::PackageConfiguration_var pc = rm->findPackageByName (options->name_.c_str ()); + cout << "The package was found!" << endl; + cout << "Label: " << pc->label << endl; + cout << "UUID: " << pc->UUID << endl; + } + catch (CORBA::Exception &) + { + cout << "\nError! Package not found!" << endl; + } + } + else if (options->create_) + { + try + { + // Change the working dir. + char cwd [1024]; + ACE_OS::getcwd (cwd, 1024); + ACE_CString descriptor_dir (cwd); + descriptor_dir += "/packageDescriptors/RACE/descriptors/"; + ACE_OS::chdir (descriptor_dir.c_str ()); + + Deployment::PackageConfiguration *pc = new Deployment::PackageConfiguration (); + + // Parse the PCD to make sure that there are no package errors. + try + { + CIAO::Config_Handlers::Packaging::PCD_Handler::package_config ("default.pcd", *pc); + } + catch (...) + { + ACE_ERROR (( + LM_ERROR, + "(%P|%t) [RM::retrieve_PC_from_descriptors] Error parsing the PCD\n")); + + throw Deployment::PackageError (); + } + + ACE_OS::chdir (cwd); + + rm->createPackage (options->name_.c_str (), *pc, options->path_.c_str (), false); + } + catch (CORBA::Exception & ex) + { + cout << "\nException caught!" << ex << "\n"; + return 0; + } + } + else if (options->delete_) + { + try + { + rm->deletePackage (options->name_.c_str ()); + cout << options->name_.c_str () << " deleted" << endl; + } + catch (CORBA::Exception & ex) + { + cout << "\nException: " << ex << endl; + } + + } + else if (options->find_) + { + if (options->name_ != "") + { + Deployment::PackageConfiguration_var pc = rm->findPackageByName (options->name_.c_str ()); + cout << "The package was found!" << endl; + //Deployment::DnC_Dump::dump (pc); + } + else + { + Deployment::PackageConfiguration_var pc = rm->findPackageByUUID (options->uuid_.c_str ()); + cout << "The package was found!" << endl; + //Deployment::DnC_Dump::dump (pc); + } + } + + orb->shutdown (1); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Unknown exception\n"); + return -1; + } + + return 0; +} diff --git a/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager.cpp b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager.cpp new file mode 100644 index 00000000000..3d8f07fa153 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager.cpp @@ -0,0 +1,281 @@ + +/* -*- C++ -*- */ + +//====================================================================== +/** + * @file RepositoryManager.cpp + * + * $Id$ + * + * Description: + * Main driver program for the CIAO RepositoryManager + * Please run as follows: + * RepositoryManagerDaemon [int:nthreads] + * + * @author Stoyan Paunov + */ +//====================================================================== + +#include "RepositoryManager_Impl.h" +#include "ace/OS_NS_stdio.h" +#include "ace/streams.h" +#include "ace/Auto_Ptr.h" +#include "ace/Task.h" +#include "ace/Get_Opt.h" +#include "ace/SString.h" + +#include "orbsvcs/CosNamingC.h" + +namespace CIAO +{ + namespace RepositoryManager + { + /// Name of the file holding the IOR of the RM + const char * RMior = "RepositoryManagerDaemon.ior"; + + // Name of RepoMan + const char * repoman_name_ = "RepositoryManager"; + + //Name service of the RM + const char * RMname_service = "RepositoryManager"; + + /// Default number of worker threads to run in the multi-threaded RM + static unsigned int nthreads = 3; + static ACE_CString HTTPserver = "127.0.0.1:5432"; + + static bool register_with_ns_ = false; + static bool write_to_ior_ = true; + } +} + +// Forward declaration +bool parse_args (int argc, ACE_TCHAR *argv[]); + +/** + * @class Worker + * + * Class that implements the service routine of the worker threads + * of the repository manager + */ +class Worker : public ACE_Task_Base +{ +public: + /// ctor + Worker (CORBA::ORB_ptr orb); + + /// The thread entry point. + virtual int svc (void); + +private: + /// The orb + CORBA::ORB_var orb_; +}; + +bool +write_ior_file (CORBA::ORB_ptr orb, + CIAO::RepositoryManagerDaemon_ptr obj) +{ + CORBA::String_var ior = + orb->object_to_string (obj); + + FILE* RMior_file = + ACE_OS::fopen (CIAO::RepositoryManager::RMior, "w"); + + if (RMior_file) + { + ACE_OS::fprintf (RMior_file, + "%s", + ior.in ()); + ACE_OS::fclose (RMior_file); + } + else + { + return false; + } + + return true; +} + +bool +register_with_ns (CORBA::ORB_ptr orb, + CIAO::RepositoryManagerDaemon_ptr obj) +{ + if (ACE_OS::strlen (CIAO::RepositoryManager::repoman_name_) > 0) + { + CIAO::RepositoryManager::RMname_service = + CIAO::RepositoryManager::repoman_name_; + } + + // 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); + + // String dup required for MSVC6 + name[0].id = CORBA::string_dup (CIAO::RepositoryManager::RMname_service); + + // Register the servant with the Naming Service + naming_context->rebind (name, obj); + + return true; +} + +///Main function + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + //init the ORB + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (!parse_args (argc, argv)) + return -1; + + // Get the root POA object + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + + // Downcast to POA type + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); + + //activate the POA manager + PortableServer::POAManager_var mgr = root_poa->the_POAManager (); + mgr->activate (); + + // Create a servant + CIAO_RepositoryManagerDaemon_i* repo = 0; + ACE_NEW_RETURN (repo, + CIAO_RepositoryManagerDaemon_i ( + orb.in (), + CIAO::RepositoryManager::HTTPserver.c_str (), + CIAO::RepositoryManager::repoman_name_), + 1); + + //transfer ownership to the POA + PortableServer::ServantBase_var owner_transfer(repo); + + //register and implicitly activate servant + CIAO::RepositoryManagerDaemon_var RepositoryManagerDaemon = repo->_this (); + + bool retval = false; + + if (CIAO::RepositoryManager::write_to_ior_) + { + retval = + write_ior_file (orb.in (), + RepositoryManagerDaemon.in ()); + } + else if (CIAO::RepositoryManager::register_with_ns_) + { + retval = + register_with_ns (orb.in (), + RepositoryManagerDaemon.in ()); + } + + if (!retval) + return -1; + + + Worker worker (orb.in ()); + if (worker.activate (THR_NEW_LWP | THR_JOINABLE, + CIAO::RepositoryManager::nthreads) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot activate worker threads\n"), + 1); + + worker.thr_mgr ()->wait (); + + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); + + // done + return 0; + + // todo shutdown orb + } + catch (CORBA::Exception &ex) { + cerr << "CORBA Exception: " << ex << endl; + + return 1; + } + + + return 0; +} + + +// **************************************************************** + +///Code to parse the arguments + + bool + parse_args (int argc, ACE_TCHAR *argv[]) + { + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("ov:s:n:")); + int c; + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + CIAO::RepositoryManager::write_to_ior_ = true; + CIAO::RepositoryManager::register_with_ns_ = false; + break; + case 'v': + CIAO::RepositoryManager::write_to_ior_ = false; + CIAO::RepositoryManager::register_with_ns_ = true; + CIAO::RepositoryManager::repoman_name_ = get_opts.opt_arg (); + break; + case 's': + CIAO::RepositoryManager::HTTPserver = get_opts.opt_arg (); + break; + case 'n': + CIAO::RepositoryManager::nthreads = ACE_OS::atoi (get_opts.opt_arg ()); + break; + case '?': // display help for use of the server. + ACE_DEBUG ((LM_INFO, + "usage: %s\n" + "-o <using ior file>\n" + "-v <name of naming service>\n" + "-s <IP:PORT for HTTP server>\n" + "-n <number of threads>\n", + argv [0])); + return false; + break; + default: + ; + } + + return true; + } + + + +// **************************************************************** + +///Constuctor for the worker class +Worker::Worker (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +///implementation of the service routine inherited from ACE::Task_Base + +int Worker::svc (void) +{ + try + { + this->orb_->run (); + } + catch (const CORBA::Exception&) + { + } + return 0; +} + + diff --git a/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc new file mode 100644 index 00000000000..b9abf0f200b --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc @@ -0,0 +1,53 @@ +// -*- MPC -*- +// $Id$ + +project (DAnCE_RepositoryManager_IDL) : ciaoidldefaults { + custom_only = 1 + IDL_Files { + RepositoryManagerDaemon.idl + } +} + +project (DAnCE_RepositoryManager) : dance_deployment_svnt, ciao_config_handlers, ccm_stub, dance_repository_manager_base, naming, iortable, utils, minizip, zlib { + requires += zlib + libs += Package_Config_Handlers + after += DAnCE_RepositoryManager_IDL + dynamicflags = DANCE_REPOSITORYMANAGER_MODULE_BUILD_DLL + IDL_Files { + } + + Source_Files { + RepositoryManagerDaemonC.cpp + RepositoryManagerDaemonS.cpp + ZIP_Wrapper.cpp + RepositoryManager_Impl.cpp + RM_Helper.cpp + URL_Parser.cpp + PC_Updater_T.cpp + PC_Updater.cpp + Repository_Manager_Module.cpp + } +} + +project (DAnCE_RepositoryManager_Exec) : dance_repository_manager, dance_exe { + exename = dance_repository_manager + Source_Files { + Repository_Manager_Exec.cpp + } + IDL_Files { + } +} + + +// RMadmin project: a sample client for the RM. +project (RMAdmin) : dance_repository_manager, dance_deployment_stub, ciao_config_handlers, naming { + exename = dance_rm_admin + IDL_Files { + } + Source_Files { + RMadmin.cpp + RepositoryManagerDaemonC.cpp + Options.cpp + RM_Helper.cpp + } +} diff --git a/modules/CIAO/DAnCE/RepositoryManager/RepositoryManagerDaemon.idl b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManagerDaemon.idl new file mode 100644 index 00000000000..9deac4abd0e --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManagerDaemon.idl @@ -0,0 +1,13 @@ +// $Id$ + +#include "DAnCE/Deployment/Deployment_RepositoryManager.idl" + +module CIAO +{ + interface RepositoryManagerDaemon : Deployment::RepositoryManager + { + // Shutdown the daemon process. + oneway void shutdown (); + }; +}; + diff --git a/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.cpp b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.cpp new file mode 100644 index 00000000000..10a47e9886c --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.cpp @@ -0,0 +1,1219 @@ +// $Id$ + +//==================================================================== +/** + * @file RepositoryManager_Impl.cpp + * + * $Id$ + * + * Description: Actial implementation of the RepoMan + * + * @author Stoyan Paunov + * Shanshan Jiang <shanshan.jiang@vanderbilt.edu> + */ +//==================================================================== + +#include "RepositoryManager_Impl.h" + +#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 fstat and mkdir +#include "ace/OS_NS_string.h" //for ACE_CString +#include "ace/OS_Memory.h" //for ACE_NEW* macros + + +//to remove a file or dir from the local filesystem need remove () from stdio.h +// ---> need to include ace/OS_NS_stdio.h which would include the correct file for any OS! +#include "ace/OS_NS_stdio.h" + +#include "ZIP_Wrapper.h" //Wrapper around zzip +#include "ace/Containers_T.h" //for ACE_Double_Linked_List +#include "ace/Malloc_Allocator.h" //for ACE_New_Allocator + +//for the PackageConfiguration parsing +#include "DAnCE/Deployment/Deployment_DataC.h" +#include "DAnCE/Deployment/Deployment_Packaging_DataC.h" +#include "Package_Handlers/PCD_Handler.h" + +#include "RM_Helper.h" //to be able to externalize/internalize a PackageConfiguration +#include "ace/Message_Block.h" //for ACE_Message_Block + +#include "ace/Thread.h" //for obtaining the ID of the current thread +#include "ace/OS_NS_stdlib.h" //for itoa () +#include "ace/Dirent.h" + +#include "URL_Parser.h" //for parsing the URL +#include "tao/HTTP_Client.h" //the HTTP client class to downloading packages + +#include "PC_Updater.h" //A visitor class to walk through the elements of the PC + +#include "ace/Configuration_Import_Export.h" + +namespace +{ + static const char* PC_EXTENSION = ".epc"; + + static const char *RM_RECORD_FILE = "RM_record"; + static const char *RM_RECORD_NAME_SECTION = "Names"; + static const char *RM_RECORD_UUID_SECTION = "UUIDs"; +} + +namespace DAnCE +{ + + //----------------------------------------------------------------- + //Constructor + // + //----------------------------------------------------------------- + + RepositoryManagerDaemon_i::RepositoryManagerDaemon_i + (CORBA::ORB_ptr the_orb, const char* server, const char* install_dir) + : the_orb_ (CORBA::ORB::_duplicate (the_orb)), + install_root_ (""), + HTTP_server_ ("http://"), + install_path (install_dir) + { + //form the path + this->HTTP_server_ += server; + this->HTTP_server_ += "/"; + this->HTTP_server_ += install_path; + this->HTTP_server_ += "/"; + + //create directory in which the packages will be stored + ACE_OS::mkdir(install_path.c_str ()); + //if dir already exists a -1 is returned + //we ignore this, just need to make sure the directory exists + + ACE_OS::getcwd (this->cwd_, TEMP_LEN); + + this->install_root_ = this->cwd_; + this->install_root_ += "/"; + this->install_root_ += install_path; + + // Install the configuration files to get the names, UUIDs, & types info. + ACE_Configuration_Heap cfg; + cfg.open (); + ACE_Configuration_Section_Key root = cfg.root_section (); + + ACE_Registry_ImpExp config_importer (cfg); + ACE_OS::chdir (install_path.c_str ()); + config_importer.import_config (RM_RECORD_FILE); + ACE_OS::chdir (this->cwd_); + + ACE_CString name; + ACE_Configuration::VALUETYPE type; + ACE_CString path; + + ACE_Configuration_Section_Key NameSection; + cfg.open_section (root, RM_RECORD_NAME_SECTION, 1, NameSection); + u_int index = 0; + while (!cfg.enumerate_values (NameSection, index, name, type)) + { + cfg.get_string_value (NameSection, name.c_str (), path); + this->names_.bind (name, path); + + ++index; + } + + ACE_Configuration_Section_Key UUIDSection; + cfg.open_section (root, RM_RECORD_UUID_SECTION, 1, UUIDSection); + index = 0; + while (!cfg.enumerate_values (UUIDSection, index, name, type)) + { + cfg.get_string_value (UUIDSection, name.c_str (), path); + this->uuids_.bind (name, path); + + ++index; + } + + // Add types + index = 0; + for (PCMap_Iterator iter = this->names_.begin (); + iter != this->names_.end (); + ++iter, ++index) + { + PCEntry& element = *iter; + + ::Deployment::PackageConfiguration_var pc = this->findPackageByName (element.ext_id_.c_str ()); + + if(!this->add_type (pc, element.ext_id_.c_str ())) + ACE_ERROR ((LM_ERROR, "Failed to add the type\n")); + } + } + + //----------------------------------------------------------------- + //Destructor + // + //----------------------------------------------------------------- + + RepositoryManagerDaemon_i::~RepositoryManagerDaemon_i (void) + { + this->names_.unbind_all (); + this->uuids_.unbind_all (); + this->types_.unbind_all (); + } + + //----------------------------------------------------------------- + //shutdown + // + //----------------------------------------------------------------- + + void RepositoryManagerDaemon_i::shutdown () + + { + // Release resource. + this->names_.unbind_all (); + this->uuids_.unbind_all (); + this->types_.unbind_all (); + + this->the_orb_->shutdown (0); + } + + + //----------------------------------------------------------------- + //installPackage + // + //----------------------------------------------------------------- + + void RepositoryManagerDaemon_i::installPackage (const char * installationName, + const char * location, + ::CORBA::Boolean replace) + { + + PCEntry *entry = 0; + if (this->names_.find (ACE_CString (installationName), entry) == 0) + { + if (!replace) + throw Deployment::NameExists (); + else + deletePackage (installationName); + } + + //Now lets form the path for the local file + //NOTE: I need the absolute path because I will change to a subdirectory + //when I am parsing the descriptors + + ACE_CString path (this->install_root_); + path += "/"; + path += installationName; + + ACE_CString package_path (path); + package_path += ".cpk"; //package extension + + ACE_CString pc_path (path); + pc_path += PC_EXTENSION; //external PackageConfiguration extension + + + ACE_CString descriptor_dir (path); + descriptor_dir += "/descriptors/"; //location of the descriptor directory + + + //check if URL or local file + //download or load into memory + + if (ACE_OS::strstr (location, "http://")) + { + + //TODO: how can I incorporate a Auto_Ptr is explicit release is needed + ACE_Message_Block* mb = 0; + ACE_NEW_THROW_EX (mb, ACE_Message_Block (), CORBA::NO_MEMORY ()); + + //get the remote file + if (!HTTP_Get (location, *mb)) + { + mb->release (); + throw CORBA::INTERNAL (); + } + + // Write file to designated location on disk + if (!RM_Helper::write_to_disk (package_path.c_str (), *mb)) + { + mb->release (); + throw CORBA::INTERNAL (); + } + + mb->release (); + } + else + { + if (!RM_Helper::copy_from_disk_to_disk (location, package_path.c_str ())) + throw CORBA::INTERNAL (); + } + + + ZIP_Wrapper::uncompress (const_cast<char*> (package_path.c_str ()), + const_cast<char*> (this->install_root_.c_str ()), + false //not verbose + ); + + //Start the parsing + + ACE_CString pc_name; + + this->find_PC_name (const_cast<char*> (package_path.c_str ()), pc_name); + + //if the PackageConfiguration name cannot be found, then there is nothing to install + if (pc_name == "") + { + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + + throw Deployment::PackageError (); + } + + //TODO: move exception throwing out of this func. User boolean error handling!!! + //TODO: check for errors! + Deployment::PackageConfiguration_var pc; + pc = this->retrieve_PC_from_descriptors (const_cast<char*> (pc_name.c_str ()), + descriptor_dir.c_str ()); + + + if (this->uuids_.find (ACE_CString (pc->UUID), entry) == 0) + { + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + + throw Deployment::NameExists (); + } + + //forming the server path info + ACE_CString server_path (this->HTTP_server_); + server_path += installationName; + + //NOTE: ComponentPackageReferences are currently NOT supported + if (!(pc->basePackage.length () > 0)) + { + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + + throw CORBA::NO_IMPLEMENT (); + } + + PC_Updater updater (server_path, package_path); + + if (!updater.update (pc)) + { + ACE_DEBUG ((LM_ERROR, "[RM] problem updating the PackageConfiguration!\n")); + + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + throw Deployment::PackageError (); + } + + + //now lets externalize the PackageConfiguration, so that we can access it later on + //without having to do the whole parsing again. + //NOTE: Order here is important. Do not populate maps before the externalization! + RM_Helper::externalize (pc, pc_path.c_str ()); + + //insert the package into the database + if (this->names_.bind (ACE_CString (installationName), path) == -1) + { + ACE_ERROR ((LM_ERROR, + "[RM] could not bind %s.\n", + installationName)); + + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + //remove the PackageConfiguration externalization + remove (pc_path.c_str ()); + + //throw exception + throw CORBA::INTERNAL (); + } + + //ALSO NEED THE UUID here + if (this->uuids_.bind (ACE_CString (pc->UUID), path) == -1) + { + ACE_ERROR ((LM_ERROR, + "[RM] could not bind %s.\n", + ACE_CString (pc->UUID).c_str ())); + + //unbind the name + this->names_.unbind (installationName); + + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + //remove the PackageConfiguration externalization + remove (pc_path.c_str ()); + + //throw exception + throw CORBA::INTERNAL (); + } + + //now add the type interface + if(!this->add_type (pc, installationName)) + ACE_ERROR ((LM_ERROR, "Failed to add the type\n")); + + this->dump (); + + this->save (); + + ACE_DEBUG ((LM_INFO, + "Installed PackageConfiguration \n\tname: %s \n\tuuid: %s\n", + installationName, ACE_CString (pc->UUID).c_str ())); + } + + + //----------------------------------------------------------------- + //createPackage + // + //----------------------------------------------------------------- + + void RepositoryManagerDaemon_i::createPackage (const char * installationName, + const ::Deployment::PackageConfiguration & package, + const char * baseLocation, + ::CORBA::Boolean replace) + { + ::Deployment::PackageConfiguration pc = package; + + // Find if there is a PackageConfiguration with the same name. + PCEntry *entry = 0; + if (this->names_.find (ACE_CString (installationName), entry) == 0) + { + if (!replace) + throw Deployment::NameExists (); + else + deletePackage (installationName); + } + + // Find if there is a PackageConfiguration with the same uuid. + if (this->uuids_.find (ACE_CString (pc.UUID), entry) == 0) + throw Deployment::NameExists (); + + // Find if the PackageConfiguration has a basePackage. + // NOTE: ComponentPackageReferences are currently NOT supported. + if (!(pc.basePackage.length () > 0)) + throw CORBA::NO_IMPLEMENT (); + + // Form the path for the local file + ACE_CString path (this->install_root_); + path += "/"; + path += installationName; + + ACE_CString package_path (path); + package_path += ".cpk"; //package extension + + ACE_CString pc_path (path); + pc_path += PC_EXTENSION; //external PackageConfiguration extension + + // Check if URL or local file, download or load into memory + if (ACE_OS::strstr (baseLocation, "http://")) + { + //TODO: how can I incorporate a Auto_Ptr is explicit release is needed + ACE_Message_Block* mb; + ACE_NEW_THROW_EX (mb, ACE_Message_Block (), CORBA::NO_MEMORY ()); + + //get the remote file + if (!HTTP_Get (baseLocation, *mb)) + { + mb->release (); + throw CORBA::INTERNAL (); + } + + // Write file to designated location on disk + if (!RM_Helper::write_to_disk (package_path.c_str (), *mb)) + { + mb->release (); + throw CORBA::INTERNAL (); + } + + mb->release (); + } + else + { + if (!RM_Helper::copy_from_disk_to_disk (baseLocation, package_path.c_str ())) + throw CORBA::INTERNAL (); + } + + + ZIP_Wrapper::uncompress (const_cast<char*> (package_path.c_str ()), + const_cast<char*> (this->install_root_.c_str ()), + false //not verbose + ); + + // Form the server path info + ACE_CString server_path (this->HTTP_server_); + server_path += installationName; + + // Update the newly installed package configration informantion. + PC_Updater updater (server_path, package_path); + + if (!updater.update (pc)) + { + ACE_ERROR ((LM_ERROR, "[RM] problem updating the PackageConfiguration!\n")); + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + throw Deployment::PackageError (); + } + + // Externalize the PackageConfiguration, so that we can access it later on + // without having to do the whole parsing again. + // NOTE: Order here is important. Do not populate maps before the externalization! + RM_Helper::externalize (pc, pc_path.c_str ()); + + // Insert the name of the package. + if (this->names_.bind (ACE_CString (installationName), path) == -1) + { + ACE_ERROR ((LM_ERROR, + "[RM] could not bind %s.\n", + installationName)); + + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + //remove the PackageConfiguration externalization + remove (pc_path.c_str ()); + + //throw exception + throw CORBA::INTERNAL (); + } + + // Insert the UUID of the package. + if (this->uuids_.bind (ACE_CString (pc.UUID), path) == -1) + { + ACE_ERROR ((LM_ERROR, + "[RM] could not bind %s.\n", + ACE_CString (pc.UUID).c_str ())); + + //unbind the name + this->names_.unbind (installationName); + + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + //remove the PackageConfiguration externalization + remove (pc_path.c_str ()); + + //throw exception + throw CORBA::INTERNAL (); + } + + //now add the type interface + //TODO: CHECK if successful + if(!this->add_type (pc, installationName)) + ACE_ERROR ((LM_ERROR, "Failed to add the type\n")); + + this->dump (); + + this->save (); + + ACE_DEBUG ((LM_INFO, + "Created PackageConfiguration \n directory: %s \n name: %s \n uuid: %s\n", + path.c_str (), installationName, ACE_CString (pc.UUID).c_str ())); + } + + + //----------------------------------------------------------------- + //findPackageByName + // + //----------------------------------------------------------------- + + ::Deployment::PackageConfiguration* + RepositoryManagerDaemon_i::findPackageByName (const char * name) + + { + // Find out if the PackageConfiguration was installed in the repository, + // return it if found or throw and exception otherwise + + PCEntry *entry = 0; + + if (this->names_.find (ACE_CString (name), entry) != 0) + throw Deployment::NoSuchName (); + //PackageConfiguration was not found + + ACE_CString pc_path (entry->int_id_.c_str ()); + pc_path += PC_EXTENSION; + + Deployment::PackageConfiguration_var pc; + ACE_NEW_THROW_EX (pc, + Deployment::PackageConfiguration (), + CORBA::NO_MEMORY ()); + + + if(!RM_Helper::reincarnate (pc, pc_path.c_str ())) + throw CORBA::INTERNAL (); + + ACE_DEBUG ((LM_INFO, "Successfully looked up \'%s\'.\n", name)); + + return pc._retn (); + } + + + //----------------------------------------------------------------- + //findPackageByUUID + // + //----------------------------------------------------------------- + + ::Deployment::PackageConfiguration* + RepositoryManagerDaemon_i::findPackageByUUID (const char * UUID) + + { + // Find out if the PackageConfiguration was installed in the repository, + // return it if found or throw and exception otherwise + + PCEntry *entry = 0; + + if (this->uuids_.find (ACE_CString (UUID), entry) != 0) + throw Deployment::NoSuchName (); + //PackageConfiguration was not found + + ACE_CString pc_path (entry->int_id_.c_str ()); + pc_path += PC_EXTENSION; + + Deployment::PackageConfiguration_var pc; + ACE_NEW_THROW_EX (pc, + Deployment::PackageConfiguration (), + CORBA::NO_MEMORY ()); + + + if(!RM_Helper::reincarnate (pc, pc_path.c_str ())) + throw CORBA::INTERNAL (); + + ACE_DEBUG ((LM_INFO, "Successfully looked up %s.\n", UUID)); + + return pc._retn (); + } + + //----------------------------------------------------------------- + //findPackageByType + // + //----------------------------------------------------------------- + + ::CORBA::StringSeq * RepositoryManagerDaemon_i::findNamesByType (const char * type) + { + CIEntry *entry = 0; + + //find the type in the interface map + if (this->types_.find (ACE_CString (type), entry) != 0) + { + //return an empty sequence + CORBA::StringSeq_var seq; + ACE_NEW_THROW_EX (seq, CORBA::StringSeq (0), CORBA::NO_MEMORY ()); + + return seq._retn (); + } + else + { + CISet ci_set = (*entry).int_id_set_; + + CORBA::ULong len = ci_set.size (); + + //allocate a sequence of the right length + CORBA::StringSeq_var seq; + ACE_NEW_THROW_EX (seq, + CORBA::StringSeq (len), + CORBA::NO_MEMORY ()); + seq->length (len); + + //store the elements in the string sequence + CISet_Iterator ci_set_iter (ci_set); + CORBA::ULong index = 0; + for (ci_set_iter = ci_set.begin (); + ci_set_iter != ci_set.end () && index < len; + ++ci_set_iter, ++index) + { + seq[index] = CORBA::string_dup ((*ci_set_iter).c_str ()); + } + + return seq._retn (); + } + } + + + //----------------------------------------------------------------- + //getAllNames + // + //----------------------------------------------------------------- + + ::CORBA::StringSeq* + RepositoryManagerDaemon_i::getAllNames () + + { + //Map.current_size () gives you the current number with the duplicates + //Map.total_size () gives you the allocated space + the empty slots + //Apparently the only way to figure out the number of keys is to + //count them with an iterator. + + CORBA::ULong num_entries = 0; + + for (PCMap_Iterator i = this->names_.begin (); + i != this->names_.end (); + ++i) + ++num_entries; + + CORBA::StringSeq_var seq; + ACE_NEW_THROW_EX (seq, CORBA::StringSeq (num_entries), CORBA::NO_MEMORY ()); + + + seq->length (num_entries); + + CORBA::ULong index = 0; + for (PCMap_Iterator iter = this->names_.begin (); + iter != this->names_.end () && index < num_entries; + ++iter, ++index) + { + PCEntry& element = *iter; + seq[index] = CORBA::string_dup (element.ext_id_.c_str ()); + } + + ACE_DEBUG ((LM_INFO, "The number of packages %d\n", seq->length ())); + + return seq._retn (); //release the underlying CORBA::StringSeq + } + + + //----------------------------------------------------------------- + //getAllTypes + // + //----------------------------------------------------------------- + + ::CORBA::StringSeq * RepositoryManagerDaemon_i::getAllTypes () + { + //Map.current_size () gives you the current number with the duplicates + //Map.total_size () gives you the allocated space + the empty slots + //Apparently the only way to figure out the number of keys is to + //count them with an iterator. + + CORBA::ULong num_entries = 0; + + for (CIMap_Iterator i = this->types_.begin (); + i != this->types_.end (); + ++i) + ++num_entries; + + CORBA::StringSeq_var seq; + ACE_NEW_THROW_EX (seq, + CORBA::StringSeq (num_entries), + CORBA::NO_MEMORY ()); + + + seq->length (num_entries); + + CORBA::ULong index = 0; + for (CIMap_Iterator iter = this->types_.begin (); + iter != this->types_.end () && index < num_entries; + ++iter, ++index) + + { + CIEntry& element = *iter; + seq[index] = CORBA::string_dup (element.ext_id_.c_str ()); + } + + ACE_DEBUG ((LM_DEBUG, "The number of types: %d\n", num_entries)); + + return seq._retn (); //release the underlying CORBA::StringSeq + } + + + //----------------------------------------------------------------- + //DeletePackage + // + //----------------------------------------------------------------- + + void RepositoryManagerDaemon_i::deletePackage (const char * installationName) + { + bool internal_err = false; + + PCEntry *entry = 0; + + if (this->names_.find (ACE_CString (installationName), entry) != 0) + throw Deployment::NoSuchName (); + + //cache the package path + ACE_CString path (entry->int_id_.c_str ()); + + //remove the name association + if (this->names_.unbind (installationName) == -1) + { + ACE_ERROR ((LM_ERROR, + "Unable to unbind %s.\n", + installationName)); + internal_err = true; + } + + //the package location + ACE_CString package_path (path); + package_path += ".cpk"; //package extension + + //the PackageConfiguration externalization location + ACE_CString pc_path (path); + pc_path += PC_EXTENSION; //external PackageConfiguration extension + + Deployment::PackageConfiguration_var pc; + ACE_NEW_THROW_EX (pc, + Deployment::PackageConfiguration (), + CORBA::NO_MEMORY ()); + + + if(!RM_Helper::reincarnate (pc, pc_path.c_str ())) + { + ACE_ERROR ((LM_ERROR, "Could not reincarnate PC\n")); + internal_err = true; + } + + if (this->uuids_.unbind (ACE_CString (pc->UUID)) == -1) + { + ACE_ERROR ((LM_ERROR, "Could not remove UUID\n")); + internal_err = true; + } + + //remove the type from the interface map + if (!this->remove_type (pc, installationName)) + { + ACE_ERROR ((LM_ERROR, "Could not remove type\n")); + internal_err = true; + } + + //actually delete the package here! + + //clean the extracted files + remove_extracted_package (path.c_str ()); + //remove the package + remove (package_path.c_str ()); + //remove the PackageConfiguration externalization + remove (pc_path.c_str ()); + + this->dump (); + + this->save (); + + if (internal_err) + throw CORBA::INTERNAL (); + else + ACE_DEBUG ((LM_INFO, "Successfully deleted \'%s\'\n", installationName)); + + } + + + //==========================================HELPER METHODS================================================== + + Deployment::PackageConfiguration* + RepositoryManagerDaemon_i::retrieve_PC_from_package (char* package) + { + char temp[128]; + // ACE_thread_t thread_id = ACE_Thread::self (); + char* PID = ACE_OS::itoa (ACE_OS::getpid (), temp, 10); + + ACE_OS::mkdir(PID); + //if dir already exists a -1 is returned + //we ignore this, just need to make sure the directory exists + + //change the working dir + ACE_OS::chdir (PID); + + ACE_CString pcd_name; + //extract the necessary descriptors + if (extract_descriptor_files (package, + pcd_name) < 0) + { + ACE_OS::chdir (this->cwd_); + ACE_ERROR ((LM_ERROR, + "(%P|%t) RepositoryManager: error extracting necessary files\n")); + throw CORBA::INTERNAL (); + } + + Deployment::PackageConfiguration_var pc; + //parse the PCD to make sure that there are no package errors + try + { + //CIAO::Config_Handlers::STD_PC_Intf intf (pcd_name.c_str ()); + //pc = intf.get_PC (); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) RepositoryManager: Error parsing the PCD\n")); + + //change back the the old working dir + ACE_OS::chdir (this->cwd_); + throw Deployment::PackageError (); + } + //able to parse the PC. So lets install the package in the repo + + //we no longer need the descriptors, so lets erase them! + remove_descriptor_files (package); + + //change back the the old working dir + ACE_OS::chdir (this->cwd_); + + //now lets erase the directory! + ACE_OS::rmdir (PID); + //the ACE_OS::rmdir does not work. Possibly because we need to delete + //the contents first. I will look into it more closely when I am back. + + return pc._retn (); + } + + + //function to retvieve a file via HTTP + //stores the file in the passed preallocated ACE_Message_Block + //returns 1 on success + // 0 on error + + int RepositoryManagerDaemon_i::HTTP_Get (const char* URL, ACE_Message_Block &mb) + { + URL_Parser *parser = TheURL_Parser::instance (); + if (!parser->parseURL (const_cast<char*> (URL))) + return 0; + + // Create a client + TAO_HTTP_Client client; + + // Open the client + if (client.open (parser->filename_, + parser->hostname_, + parser->port_) == -1) + { + client.close (); + return 0; + } + + // Read from it + if (client.read (&mb) <= 0) + { + client.close (); + return 0; + } + + return 1; + } + + + + //function to parse and return the PackageConfiguration from the already + //extracted descriptor files + Deployment::PackageConfiguration* + RepositoryManagerDaemon_i::retrieve_PC_from_descriptors (const char* pc_name, + const char* descriptor_dir) + { + //change the working dir + ACE_OS::chdir (descriptor_dir); + + Deployment::PackageConfiguration_var pc = new Deployment::PackageConfiguration (); + //parse the PCD to make sure that there are no package errors + try + { + CIAO::Config_Handlers::Packaging::PCD_Handler::package_config (pc_name, *pc); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) [RM::retrieve_PC_from_descriptors] Error parsing the PCD\n")); + + //change back the the old working dir + ACE_OS::chdir (this->cwd_); + throw Deployment::PackageError (); + } + //able to parse the PC. So lets install the package in the repo + + //change back the the old working dir + ACE_OS::chdir (this->cwd_); + + return pc._retn (); + } + + + //find out what the name of the PackageConfiguration file is + void RepositoryManagerDaemon_i::find_PC_name (char* package, ACE_CString& pcd_name) + { + pcd_name = ""; //empty the contents of the ACE_CString + + //create a doubly link list + ACE_New_Allocator allocator; + ACE_Double_Linked_List<ZIP_File_Info> list (&allocator); + + //get the list of files in the package and figure out the names of all necessary files + if (!(ZIP_Wrapper::file_list_info (package, list))) + return; + + size_t skip_len = ACE_OS::strlen ("descriptors") + 1; + + while (!list.is_empty ()) + { + ZIP_File_Info* inf = list.delete_head (); + + if (ACE_OS::strstr (inf->name_.c_str (), "descriptors")) + if (ACE_OS::strstr (inf->name_.c_str (), ".pcd")) + pcd_name = inf->name_.c_str () + skip_len; + + //deallocate the head of the filename list + delete inf; + } + } + + + //We are using Xercesc in the Config_Handlers and unfortunately its API only + //takes a file in the local file system as an argument, thus need to + //write out the contents of the deployent plan to a file + //in the current directory. I use the thread id to guarrantee + //lack of race conditions if multithreading is enabled + + int RepositoryManagerDaemon_i::extract_descriptor_files (char* package, ACE_CString& pcd_name) + { + //create a doubly link list + ACE_New_Allocator allocator; + ACE_Double_Linked_List<ZIP_File_Info> list (&allocator); + + //get the list of files in the package and figure out the names of all necessary files + if (!(ZIP_Wrapper::file_list_info (package, list))) + return 0; + + size_t skip_len = ACE_OS::strlen ("descriptors") + 1; + + while (!list.is_empty ()) + { + ZIP_File_Info* inf = list.delete_head (); + ACE_Message_Block* file = 0; + if (ACE_OS::strstr (inf->name_.c_str (), "descriptors")) + { + if (ACE_OS::strstr (inf->name_.c_str (), ".pcd")) + pcd_name = inf->name_.c_str () + skip_len; + + //extract the descriptor from the package + ACE_NEW_RETURN (file, ACE_Message_Block (0,0), 0); + if (!ZIP_Wrapper::get_file(const_cast<char*> (package), + const_cast<char*> (inf->name_.c_str ()), + *file)) + { + ACE_ERROR ((LM_ERROR, + "[RM::extract_descriptor_files] Unable to retrieve file!\n")); + //release the message block chain + file->release (); + return 0; + } + + + //write the file to disk + if(!RM_Helper::write_to_disk (inf->name_.c_str () + skip_len, *file)) + { + ACE_ERROR ((LM_ERROR, + "[RM::extract_descriptor_files] Unable to write out descriptor to disk!\n")); + //release the message block chain + file->release (); + return 0; + } + + //release the message block chain + file->release (); + } + + //deallocate the head of the filename list + delete inf; + } + + return 1; + } + + int RepositoryManagerDaemon_i::remove_descriptor_files (char* package) + { + int return_code = 1; + + //create a doubly link list + ACE_New_Allocator allocator; + ACE_Double_Linked_List<ZIP_File_Info> list (&allocator); + + //get the list of files in the package and figure out the names of all necessary files + if (!(ZIP_Wrapper::file_list_info (package, list))) + return 0; + + size_t skip_len = ACE_OS::strlen ("descriptors") + 1; + + while (!list.is_empty ()) + { + ZIP_File_Info* inf = list.delete_head (); + if (ACE_OS::strstr (inf->name_.c_str (), "descriptors")) + { + //delete disk + if(remove (inf->name_.c_str () + skip_len)) + { + ACE_ERROR ((LM_ERROR, + "[RM::remove_descriptor_files] Unable to remove file from disk!\n")); + return_code = 0; + } + } + //deallocate the head of the filename list + delete inf; + } + + return return_code; + } + + int RepositoryManagerDaemon_i::remove_extracted_package (const char* path) + { + ACE_TCHAR full_path[MAXPATHLEN]; + ACE_OS::getcwd (full_path, sizeof(full_path)); + + ACE_OS::chdir (path); + + ACE_Dirent dir (path); + + for (ACE_DIRENT *directory; (directory = dir.read ()) != 0;) + { + if (ACE::isdotdir (directory->d_name) == true) + continue; + + ACE_stat stat_buf; + ACE_OS::lstat (directory->d_name, &stat_buf); + + ACE_CString temp = path; + temp += "/"; + temp += directory->d_name; + switch (stat_buf.st_mode & S_IFMT) + { + case S_IFREG: // Either a regular file or an executable. + remove (temp.c_str ()); + break; + + case S_IFDIR: + remove_extracted_package (temp.c_str ()); + break; + + default: + break; + } + } + + ACE_OS::chdir (full_path); + + ACE_OS::rmdir (path); + + return 0; + } + + //function to extract the type of the component from + //the PackageConfiguration and update the interface map + //returns 1 on success + // 0 on error + + int RepositoryManagerDaemon_i::add_type (Deployment::PackageConfiguration& pc, + const char* name) + { + if (pc.basePackage.length () > 0) + { + ::CORBA::StringSeq supportedTypes = pc.basePackage[0] + .implementation[0] + .referencedImplementation + .implements + .supportedType; + + if (supportedTypes.length () != 0) + { + CORBA::ULong len = supportedTypes.length (); + for (CORBA::ULong i = 0; i < len; ++i) + { + this->types_.bind (ACE_CString (supportedTypes[i]), name); + } + } + } + else //ComponentPackageReference + { + //not implemented yet + return 0; + } + + return 1; + } + + //function to remove the interface type of the component + //being removed from the interface map + //returns 1 on success + // 0 on error + + int RepositoryManagerDaemon_i::remove_type (Deployment::PackageConfiguration& pc, + const char* name) + { + if (pc.basePackage.length () > 0) + { + ::CORBA::StringSeq supportedTypes = pc.basePackage[0] + .implementation[0] + .referencedImplementation + .implements + .supportedType; + + if (supportedTypes.length () != 0) + { + CORBA::ULong len = supportedTypes.length (); + for (CORBA::ULong i = 0; i < len; ++i) + { + if (this->types_.unbind (ACE_CString (supportedTypes[i]), ACE_CString (name)) != 0) + ACE_DEBUG ((LM_DEBUG, "Could not find type %s with package name %s!\n", + ACE_CString (supportedTypes[i]).c_str (), + name)); + } + } + } + else //ComponentPackageReference + { + //not implemented yet + return 0; + } + + return 1; + } + + //function to dump the state of the RepositoryManager + void RepositoryManagerDaemon_i::dump (void) + { +#if defined (ACE_HAS_DUMP) + + ACE_DEBUG(LM_DEBUG, "NAMES:\n"); + this->names_.dump (); + ACE_DEBUG(LM_DEBUG, "UUIDs:\n"); + this->uuids_.dump (); + ACE_DEBUG (LM_DEBUG, "Component Interface Types:\n"); + this->types_.dump (); + +#endif /* ACE_HAS_DUMP */ + } + + //function to save the package info of the RepositoryManager + void RepositoryManagerDaemon_i::save (void) + { + // Save the names, UUIDs, & types info to the configuration files. + ACE_Configuration_Heap cfg; + cfg.open (); + ACE_Configuration_Section_Key root = cfg.root_section (); + + ACE_Configuration_Section_Key NameSection; + cfg.open_section (root, RM_RECORD_NAME_SECTION, 1, NameSection); + for (PCMap_Iterator iter = this->names_.begin (); + iter != this->names_.end (); + ++iter) + { + PCEntry& element = *iter; + cfg.set_string_value (NameSection, element.ext_id_.c_str (), element.int_id_.c_str ()); + } + + ACE_Configuration_Section_Key UUIDSection; + cfg.open_section (root, RM_RECORD_UUID_SECTION, 1, UUIDSection); + for (PCMap_Iterator iter = this->uuids_.begin (); + iter != this->uuids_.end (); + ++iter) + { + PCEntry& element = *iter; + cfg.set_string_value (UUIDSection, element.ext_id_.c_str (), element.int_id_.c_str ()); + } + + ACE_Registry_ImpExp exporter (cfg); + ACE_OS::chdir (install_path.c_str ()); + exporter.export_config (RM_RECORD_FILE); + ACE_OS::chdir (this->cwd_); + } +} diff --git a/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h new file mode 100644 index 00000000000..e7b3a9164a1 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h @@ -0,0 +1,235 @@ + +/* -*- C++ -*- */ + +//====================================================================== +/** + * @file RepositoryManager_Impl.h + * + * $Id$ + * + * Description: + * This file is the main implementation file for the RepositoryManager + * in CIAO. We have used a number of techniques in order to increase + * scalability of the RepoMan while still maintaining complience with + * the D&C spec + * + * @author Stoyan Paunov + * @author Shanshan Jiang <shanshan.jiang@vanderbilt.edu> + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ +//====================================================================== + +#ifndef REPOSITORYMANAGERI_H_ +#define REPOSITORYMANAGERI_H_ + + +//-----------------------------NOTE--------------------------------- +//I need to disable all the code which has to do with interface +//type information because we currently do not support assembly +//interfaces which causes undesired behavior with respect to the +//hash tables because the specificType field in assembly interfaces +//is empty, so two unrelated intefaces appear to be related. + + +#include "RepositoryManagerDaemonS.h" + +#include "ace/Hash_Map_Manager_T.h" //for the ACE_Hash_Map_Manager +#include "ace/Hash_Multi_Map_Manager_T.h" //for the ACE_Hash_MultiMap_Manager +#include "ace/Null_Mutex.h" //for ACE_Null_Mutex +#include "ace/RW_Mutex.h" //for ACE_RW_Mutex +#include "ace/OS_NS_string.h" //for ACE_CString +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace +{ + static const size_t TEMP_LEN = 1024; +} + +namespace DAnCE +{ + class RepositoryManagerDaemon_i : + public virtual POA_CIAO::RepositoryManagerDaemon + { + public: + /// Constructor + RepositoryManagerDaemon_i (CORBA::ORB_ptr the_orb, + const ACE_TCHAR* server = "localhost:5432", + const ACE_TCHAR* install_dir = "RepositoryManager"); + + /// Destructor + virtual ~RepositoryManagerDaemon_i (void); + + virtual void shutdown (); + + virtual + void installPackage (const ACE_TCHAR * installationName, + const ACE_TCHAR * location, + ::CORBA::Boolean replace); + + virtual + void createPackage (const ACE_TCHAR * installationName, + const ::Deployment::PackageConfiguration & package, + const ACE_TCHAR * baseLocation, + ::CORBA::Boolean replace); + + virtual + ::Deployment::PackageConfiguration * findPackageByName (const ACE_TCHAR * name); + + virtual + ::Deployment::PackageConfiguration * findPackageByUUID (const ACE_TCHAR * UUID); + + virtual + ::CORBA::StringSeq * findNamesByType (const ACE_TCHAR * type); + + virtual + ::CORBA::StringSeq * getAllNames (); + + virtual + ::CORBA::StringSeq * getAllTypes (); + + virtual + void deletePackage (const ACE_TCHAR * installationName); + + protected: + + /// Function to parse and return the PackageConfiguration from a specified + /// package + Deployment::PackageConfiguration* retrieve_PC_from_package (ACE_TCHAR* package); + + /// Find out what the name of the PackageConfiguration file is + void find_PC_name (ACE_TCHAR* package, ACE_CString& pcd_name); + + /// Function to parse and return the PackageConfiguration from the already + /// extracted descriptor files + Deployment::PackageConfiguration* retrieve_PC_from_descriptors (const ACE_TCHAR* pc_name, + const ACE_TCHAR* descriptor_dir); + + + /// Function to retrieve a file via HTTP + /// stores the file in the passed preallocated ACE_Message_Block + /// @retval 1 success + /// @retval 0 error + int HTTP_Get (const ACE_TCHAR* URL, ACE_Message_Block &mb); + + /// Function to extract all necessary files for parsing the + /// PackageConfiguration descriptor and populating the idl struct. + /// @retval 1 success + /// @retval 0 error + /// + /// @note ACE_CString& pcd_name is an out parameter + int extract_descriptor_files (ACE_TCHAR* package, + ACE_CString& pcd_name); + + + /// Function to remove the files extracted for parsing the PackageConfiguration + /// descriptor and populating the idl struct. It reads the names of the files + /// from the package. They correspond to the names on disk. + /// @retval 1 on success + /// @retval 0 on error + int remove_descriptor_files (ACE_TCHAR* package); + + + /// Function to remove the files extracted from the package upon istallation + /// It reads the names of the files from the package. They correspond to the + /// names on disk. It deletes each file, then it deletes the directories that + /// contain them. + /// @note extraction location is path/*archive_name*/ + /// @retval 1 on success + /// @retval 0 on error + int remove_extracted_package (const ACE_TCHAR* package_path); + + /// Function to extract the type of the component from + /// the PackageConfiguration and update the interface map + /// @retval 1 on success + /// @retval 0 on error + int add_type (::Deployment::PackageConfiguration& pc, + const ACE_TCHAR* name); + + /// Function to remove the interface type of the component + /// being removed from the interface map + /// @retval 1 on success + /// @retval 0 on error + int remove_type (::Deployment::PackageConfiguration& pc, + const ACE_TCHAR* name); + + /// Function to dump the state of the RepositoryManager + void dump (void); + + /// Function to save the package info of the RepositoryManager + void save (void); + + private: + /// Cached information about the installed PackageConfigurations + /// A separate map for the installation names and their UUID's + /// Key: PackageConfiguration name or its UUID (CString type) + /// Value: The location of the local copy of the package + + ///Based on the synchronization needed we can parametrize this with either + ///ACE_Null_Mutex or ACE_RW_Mutex + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + ACE_CString, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_RW_Mutex> PCMap; + + typedef PCMap::ITERATOR PCMap_Iterator; + typedef PCMap::ENTRY PCEntry; + + + /// Cached information about the installed Component Interfaces + /// A map which associates Component supportedType with the + /// names of packages which implement this component type + /// Key: Component supportedType + /// Value: Unbounded set of the names of installed packages which + /// implement this component type + + ///Based on the synchronization needed we can parametrize this with either + ///ACE_Null_Mutex or ACE_RW_Mutex + + typedef ACE_Hash_Multi_Map_Manager<ACE_CString, + ACE_CString, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_RW_Mutex> CIMap; + + typedef CIMap::ITERATOR CIMap_Iterator; + typedef CIMap::ENTRY CIEntry; + typedef CIEntry::VALUE_SET CISet; + typedef CIEntry::VALUE_SET_ITERATOR CISet_Iterator; + + /// A hash map that associates the names of + /// PackageConfigurations with their location + PCMap names_; + + /// a hash map that associates the UUIDs of + /// PackageConfigurations with their location + PCMap uuids_; + + /// a hash map which associates Component Interface + /// UUIDs with their implementations + CIMap types_; + + /// The ORB + CORBA::ORB_var the_orb_; + + /// Will hold the current working directory + ACE_TCHAR cwd_ [TEMP_LEN]; + + /// Full path for the install directory + ACE_CString install_root_; + + /// Location of the server + ACE_CString HTTP_server_; + + /// Directory where the packages will be stored locally + ACE_CString install_path; +}; + +} + +#endif /* REPOSITORYMANAGER_H_ */ diff --git a/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Exec.cpp b/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Exec.cpp new file mode 100644 index 00000000000..371fabf1406 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Exec.cpp @@ -0,0 +1,6 @@ +// $Id$ +#include "Repository_Manager_Module.h" + +#define DANCE_MODULE_MAIN_CLASS_NAME DAnCE_RepositoryManager_Module +#include "Deployment/Module_Main.h" + diff --git a/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Module.cpp b/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Module.cpp new file mode 100644 index 00000000000..d372e64827a --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Module.cpp @@ -0,0 +1,519 @@ +// -*- C++ -*- +// $Id$ + +#include "Repository_Manager_Module.h" +#include "ace/Get_Opt.h" +#include "ace/OS.h" +#include "ace/Task.h" +#include "ace/Atomic_Op.h" +#include "tao/IORTable/IORTable.h" +#include "tao/Utils/PolicyList_Destroyer.h" +#include "orbsvcs/CosNamingC.h" +#include "orbsvcs/orbsvcs/Naming/Naming_Loader.h" +#include "DAnCE/Logger/Log_Macros.h" +#include "DAnCE/Deployment/DAnCE_PropertiesC.h" + +#ifdef DANCE_RM_USES_JAWS +#include "JAWS/server/HTTP_Server.h" +#endif + +#include "RepositoryManager_Impl.h" + +ACE_RCSID (DAnCE, + Repository_Manager_Module, + "$Id$") + +namespace DAnCE +{ + namespace Repository_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; + } + + class Worker : public virtual ACE_Task_Base + { + public: + Worker (CORBA::ORB_ptr orb) : + orb_(CORBA::ORB::_duplicate (orb)) + { + } + + virtual int svc (void) + { + DANCE_TRACE ("DAnCE::Repository_Manager::Worker::svc"); + + size_t thread_id = ++this->thread_counter_; + + try + { + DANCE_DEBUG ((LM_INFO, DLINFO "DAnCE::Repository_Manager::Worker::svc - " + "Spawning thread %u for the ORB.\n", thread_id)); + this->orb_->run (); + DANCE_DEBUG ((LM_INFO, DLINFO "DAnCE::Repository_Manager::Worker::svc - " + "ORB event loop for thread %u completed successfully.\n", thread_id)); + } + catch (CORBA::Exception &ex) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE::Repository_Manager::Worker::svc - " + "Caught CORBA exception from ORB event loop for thread %u: %s\n", + thread_id, ex._info ().c_str ())); + return -1; + } + catch (...) + { + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE::Repository_Manager::Worker::svc - " + "Caught unknown C++ exception from ORB event loop for thread %u\n", + thread_id)); + return -1; + } + + return 0; + } + + private: + ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> thread_counter_; + CORBA::ORB_var orb_; + }; + } +} + +DAnCE_RepositoryManager_Module::DAnCE_RepositoryManager_Module (void) +{ + DANCE_TRACE("DAnCE_RepositoryManager_Module::DAnCE_RepositoryManager_Module"); +} + +DAnCE_RepositoryManager_Module::~DAnCE_RepositoryManager_Module (void) +{ + DANCE_TRACE ("DAnCE_RepositoryManager_Module::~DAnCE_RepositoryManager_Module"); + + for (Servant_Map::iterator it = this->rm_map_.begin (); + it != this->rm_map_.end (); + ++it) + { + delete (*it).int_id_; + } +} + +const char * +DAnCE_RepositoryManager_Module::usage (void) +{ + DANCE_TRACE ("DAnCE_RepositoryManager_Module::usage"); + return "Node Manager Options:\n" + "\t-n,--name [name]\t Name to register in the naming service\n" + "\t-t,--threads [num]\t Number of threads to run.\n" + "\t-f,--file [name]\t Filename to output IOR.\n" + "\t-p,--package-dir [directory]\t Directory to store packages.\n" + "\t-s,--server-address [address]\t Address of the HTTP server associated with this RM.\n" + "\t-d,--domain-nc [NC]\t Default naming context for domain objects.\n" +#ifdef DANCE_RM_USES_JAWS + "\t--spawn-http\t\t Spawn a JAWS http server, controlled by following options:\n" + "\t--http-port [port]\t Spawn JAWS HTTP server with provided port, default is 5432\n" + "\t--http-threads [number]\t Spawn provided number of threads in HTTP server, default is 1\n" + "\t--http-threading [strategy]\t Use provided threading strategy. POOL (Default), PER_REQUEST, THROTTLE.\n" + "\t--http-io [stratety]\t Use provided I/O strategy. SYNCH (default), ASYNCH.\n" + "\t--http-caching [strategy]\t Use provided caching strategy. NO_CACHE (default), CACHE\n" +#endif + ; + +} + +bool +DAnCE_RepositoryManager_Module::parse_args (int argc, ACE_TCHAR * argv[]) +{ + DANCE_TRACE ("DAnCE_RepositoryManager_Module::parse_args"); + + ACE_Get_Opt get_opts (argc - 1, + argv + 1, + ACE_TEXT(":hd:t:f:p:n:"), + 0, + 0, + ACE_Get_Opt::RETURN_IN_ORDER, + 1); + + get_opts.long_option (ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); + get_opts.long_option (ACE_TEXT("domain-nc"), 'd', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("file"), 'f', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("threads"), 't', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("package-dir"), 'p', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("name"), 'n', ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("server-address"), 's', ACE_Get_Opt::ARG_REQUIRED); +#ifdef DANCE_RM_USES_JAWS + get_opts.long_option (ACE_TEXT("spawn-http"), ACE_Get_Opt::NO_ARG); + get_opts.long_option (ACE_TEXT("http-port"), ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("http-threads"), ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("http-threading"), ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("http-io"), ACE_Get_Opt::ARG_REQUIRED); + get_opts.long_option (ACE_TEXT("http-caching"), ACE_Get_Opt::ARG_REQUIRED); +#endif /* DANCE_RM_USES_JAWS */ + + //get_opts.long_option ("help", '?'); + + char c; + while ( (c = get_opts ()) != -1) + { + switch (c) + { + case 'd': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_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 'f': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Output filename for IOR is %C\n", + get_opts.opt_arg ())); + this->options_.ior_file_ = get_opts.opt_arg (); + break; + + case 't': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Number of threads is %C\n", get_opts.opt_arg ())); + this->options_.threads_ = (ACE_OS::atoi (get_opts.opt_arg ())); + break; + + case 'p': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Package directory is %C\n", + get_opts.opt_arg ())); + this->options_.package_dir_ = get_opts.opt_arg (); + break; + + case 'n': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Name is %C\n", + get_opts.opt_arg ())); + this->options_.name_ = get_opts.opt_arg (); + break; + + case 's': + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Server address is %C\n", + get_opts.opt_arg ())); + this->options_.server_address_ = 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("spawn-http")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Found option to spawn in-process HTTP server\n")); + this->options_.spawn_http_ = true; + } + else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-port")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Using %C as the spawned HTTP server port\n", + get_opts.opt_arg ())); + this->options_.spawn_http_ = true; + this->options_.http_port_ = get_opts.opt_arg (); + } + else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Using %C as the spawned HTTP number of threads\n", + get_opts.opt_arg ())); + this->options_.spawn_http_ = true; + this->options_.http_threads_ = get_opts.opt_arg (); + } + else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Using %C as the spawned HTTP server threading model\n", + get_opts.opt_arg ())); + this->options_.spawn_http_ = true; + this->options_.http_threading_ = get_opts.opt_arg (); + } + else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Using %C as the spawned HTTP server IO strategy\n", + get_opts.opt_arg ())); + this->options_.spawn_http_ = true; + this->options_.http_io_ = get_opts.opt_arg (); + } + else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-")) == 0) + { + DANCE_DEBUG ((LM_DEBUG, DLINFO "Repository_Manager_Module::parse_args - " + "Using %C as the spawned HTTP server caching strategy\n", + get_opts.opt_arg ())); + this->options_.spawn_http_ = true; + this->options_.http_caching_ = get_opts.opt_arg (); + } + else + { + DANCE_ERROR ((LM_ERROR, DLINFO "Repository_Manager_Module::parse_args - " + "ERROR: unknown long option %C\n", + get_opts.long_option ())); + } + + break; + + case '\?': + case ':': + DANCE_ERROR ((LM_ERROR, DLINFO "Repository_Manager_Module::parse_args - " + "Options %c:%C requires an argument\n", c, get_opts.opt_opt ())); + break; + + default: + DANCE_DEBUG ((LM_TRACE, DLINFO "Repository_Manager_Module::parse_args - ignoring unknown option %c:%C\n", + c, get_opts.opt_arg ())); + } + + } + + if (this->options_.server_address_ == 0) + { + DANCE_ERROR ((LM_ERROR, DLINFO "Repository_Manager_Module::parse_args - " + "Must provider server address using --server-address option.\n")); + return false; + } + + return true; +} + +CORBA::Object_ptr +DAnCE_RepositoryManager_Module::create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv[]) +{ + DANCE_TRACE ("DAnCE_RepositoryManager_Module::create_object"); + + try + { + if (CORBA::is_nil(orb)) + { + DANCE_ERROR((LM_ERROR, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "Attempted to create Repository Manager with a nil orb.\n")); + return CORBA::Object::_nil(); + } + else + { + this->orb_ = CORBA::ORB::_duplicate (orb); + } + + if (ACE_OS::strcmp(orb->id(), this->orb_->id()) != 0) + { + DANCE_DEBUG((LM_TRACE, DLINFO "DAnCE_RepositoryManager_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_RepositoryManager_Module::create_object - " + "Failed to parse command line arguments, exiting\n")); + return CORBA::Object::_nil (); + } + + if (this->options_.spawn_http_) + this->spawn_http (); + + this->create_poas (); + + if (this->options_.domain_nc_) + { + try + { + DANCE_DEBUG((LM_TRACE, DLINFO "DAnCE_RepositoryManager_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_RepositoryManager_Module::create_object - " + "Narrow to NamingContext return nil for DomainNC.\n")); + return CORBA::Object::_nil (); + } + } + } + catch (CORBA::Exception&) + { + DANCE_DEBUG ((LM_WARNING, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "DomainNC context not found!\n")); + } + } + + + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "Initializing the IOR Table\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 "DAnCE_RepositoryManager_Module::create_object - " + "Unable to RIR the IORTable.\n")); + return CORBA::Object::_nil (); + } + + + //Creating repository manager servant + DAnCE::RepositoryManagerDaemon_i * rm = new DAnCE::RepositoryManagerDaemon_i (orb, + this->options_.server_address_, + this->options_.package_dir_); + PortableServer::ServantBase_var safe_svt (rm); + + ACE_CString repository_manager_oid; + + if (this->options_.name_ == 0) + repository_manager_oid = "RepositoryManager"; + else + { + repository_manager_oid = this->options_.name_; + repository_manager_oid += ".RepositoryManager"; + } + + // Registering servant in poa + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (repository_manager_oid.c_str()); + this->rm_poa_->activate_object_with_id (oid, rm); + + // Getting repository manager ior + CORBA::Object_var nm_obj = this->rm_poa_->id_to_reference (oid.in ()); + CORBA::String_var ior = orb->object_to_string (nm_obj.in ()); + + // Binding ior to IOR Table + adapter->bind (repository_manager_oid.c_str (), ior.in ()); + + // Binding repository menager to DomainNC + if (!CORBA::is_nil (this->domain_nc_.in ())) + { + ACE_CString ns_name; + if (this->options_.name_ == 0) + ns_name = "RepositoryManager"; + else ns_name = this->options_.name_; + + DANCE_DEBUG((LM_TRACE, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "Registering NM in NC as \"%C\".\n", ns_name.c_str ())); + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup (ns_name.c_str ()); + name[0].kind = CORBA::string_dup ("RepositoryManager"); + this->domain_nc_->rebind (name, nm_obj.in ()); + } + + // Writing ior to file + if (0 != this->options_.ior_file_) + { + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "Writing RM IOR %C to file %C.\n", this->options_.ior_file_, ior.in ())); + if (!DAnCE::Repository_Manager::write_IOR (this->options_.ior_file_, ior.in ())) + DANCE_ERROR ((LM_ERROR, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "Error: Unable to write IOR to file %C\n", + this->options_.ior_file_)); + } + + // Activate POA manager + PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); + mgr->activate (); + + // Finishing Deployment part + DANCE_DEBUG ((LM_NOTICE, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "DAnCE_RepositoryManager is running...\n")); + + DANCE_DEBUG ((LM_DEBUG, DLINFO "DAnCE_RepositoryManager_Module::create_object - " + "RepositoryManager IOR: %s\n", ior.in ())); + + return nm_obj._retn (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("DAnCE_RepositoryManager::main\t\n"); + return CORBA::Object::_nil (); + } +} + +void +DAnCE_RepositoryManager_Module::create_poas (void) +{ + DANCE_TRACE("DAnCE_Repository_Manager_Module::create_poas"); + // Get reference to Root POA. + DANCE_DEBUG ((LM_TRACE, DLINFO "DAnCE_RepositoryManager_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_RepositoryManager_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_RepositoryManager_Module::create_poas - " + "DAnCE_RepositoryManager_Module::create_poas - " + "Creating the \"Repository\" 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->rm_poa_ = this->root_poa_->create_POA ("Repository", + mgr.in(), + policies); + } + catch (const PortableServer::POA::AdapterAlreadyExists &) + { + DANCE_DEBUG ((LM_INFO, DLINFO "DAnCE_RepositoryManager_Module::create_poas - " + "Using exiswting \"Repository\" POA\n")); + this->rm_poa_ = this->root_poa_->find_POA ("Repository", 0); + } +} + +void +DAnCE_RepositoryManager_Module::spawn_http (void) +{ + DANCE_TRACE ("DAnCE_RepositoryManager_Module::spawn_http"); + + const ACE_TCHAR *name = "HTTP_Server"; + + ACE_CString args; + args += "-p "; + args += this->options_.http_port_; + args += " -n "; + args += this->options_.http_threads_; + args += " -i "; + args += this->options_.http_io_; + args += " -t "; + args += this->options_.http_threading_; + args += " -c "; + args += this->options_.http_caching_; + args += " -b 50 -f THR_NEW_LWP"; + + ACE_Service_Config::current ()->initialize (name, args.c_str ()); +} + +#ifndef BUILD_REPOSITORY_MANAGER_EXE +ACE_FACTORY_DEFINE (DAnCE_RepositoryManager_Module, DAnCE_RepositoryManager_Module) +#endif /*BUILD_REPOSITORY_MANAGER_EXE */ diff --git a/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Module.h b/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Module.h new file mode 100644 index 00000000000..21804fec10a --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/Repository_Manager_Module.h @@ -0,0 +1,128 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Repository_Manager_Module.h + * + * $Id$ + * + * @Brief To start RepositoryManager 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_RepositoryManager_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 RepositoryManagerDaemon_i; +} + +/** + * @class Repository_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_RepositoryManager_Module_Export DAnCE_RepositoryManager_Module + : public DAnCE::DAnCE_Object_Loader +{ + public: + struct SOptions + { + const ACE_TCHAR * domain_nc_; + const ACE_TCHAR * ior_file_; + size_t threads_; + const ACE_TCHAR * package_dir_; + const ACE_TCHAR * name_; + const ACE_TCHAR * server_address_; + + bool spawn_http_; + const ACE_TCHAR *http_port_; + const ACE_TCHAR *http_threads_; + const ACE_TCHAR *http_threading_; + const ACE_TCHAR *http_io_; + const ACE_TCHAR *http_caching_; + + SOptions() : + domain_nc_ (0), + ior_file_ (0), + threads_ (1), + package_dir_ (ACE_TEXT("RepositoryManager_Packages")), + server_address_ (0), + spawn_http_ (false), + http_port_ ("5432"), + http_threads_ ("1"), + http_threading_ ("POOL"), + http_io_ ("SYNCH"), + http_caching_ ("NO_CACHE") + { + } + }; + + /// Constructor. + DAnCE_RepositoryManager_Module (void); + + /// Destructor. + ~DAnCE_RepositoryManager_Module (void); + + /// Overload the base class method to create a new instance + /// of a DAnCE_RepositoryManager_Module object. + virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, + int argc, + ACE_TCHAR *argv []); + + virtual const ACE_TCHAR * usage (void); + + virtual bool parse_args (int argc, ACE_TCHAR *argv []); + + private: + void create_poas (void); + + void spawn_http (void); + + /// Here we store the servants. + typedef ACE_Map_Manager < ACE_CString, + DAnCE::RepositoryManagerDaemon_i *, + ACE_Null_Mutex > Servant_Map; + + Servant_Map rm_map_; + + CORBA::ORB_var orb_; + CosNaming::NamingContext_var domain_nc_; + + SOptions options_; + + PortableServer::POA_var root_poa_; + PortableServer::POA_var rm_poa_; +}; + +ACE_FACTORY_DECLARE (DAnCE_RepositoryManager_Module, DAnCE_RepositoryManager_Module) + +#include /**/ "ace/post.h" + +#endif /* NODE_MANAGER_MODULE_H */ diff --git a/modules/CIAO/DAnCE/RepositoryManager/URL_Parser.cpp b/modules/CIAO/DAnCE/RepositoryManager/URL_Parser.cpp new file mode 100644 index 00000000000..37187ebff61 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/URL_Parser.cpp @@ -0,0 +1,101 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/ARGV.h" +#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_ = true; + break; + case 'u': + success = parseURL (get_opt.opt_arg ()); + break; + // Usage fallthrough. + default: + success = false; + } + + 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_ (false) +{ +} + +bool URL_Parser::parseURL (char* url) +{ + char* ptr = 0; + bool success = true; + ptr = ACE_OS::strstr (url, "http://"); + if (ptr) + url += ACE_OS::strlen ("http://"); + + if (url[0] == '/') + { + this->filename_ = ACE_OS::strdup (url); + } + else + { + ptr = ACE_OS::strstr (url, ":"); + if (ptr) + this->port_ = ACE_OS::atoi (ptr + 1); + else + ptr = ACE_OS::strstr (url, "/"); + + if(!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 (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() +{ + delete [] this->hostname_; + ACE_OS::free (this->filename_); +} diff --git a/modules/CIAO/DAnCE/RepositoryManager/URL_Parser.h b/modules/CIAO/DAnCE/RepositoryManager/URL_Parser.h new file mode 100644 index 00000000000..0dfef0262ad --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/URL_Parser.h @@ -0,0 +1,66 @@ + +/* -*- 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 + bool debug_; + + /// destructor + ~URL_Parser (void); + +protected: + /// protected constructor, singleton + URL_Parser (void); +}; + + + +#endif /* URL_PARSER_H */ diff --git a/modules/CIAO/DAnCE/RepositoryManager/ZIP_Wrapper.cpp b/modules/CIAO/DAnCE/RepositoryManager/ZIP_Wrapper.cpp new file mode 100644 index 00000000000..41a247cb717 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/ZIP_Wrapper.cpp @@ -0,0 +1,377 @@ + +//=============================================================================== +/** + * @file ZIP_Wrapper.cpp + * + * $Id$ + * + * Purpose: implementing the ZIP_Wrapper class + * + * @author Stoyan Paunov, Vipul Singh + * + */ +//=============================================================================== + +#include "ace/Containers_T.h" //for ACE_Double_Linked_List +#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_string.h" //for strncpy +#include "ace/SString.h" //for ACE_CString +#include "ace/OS_NS_sys_stat.h" //for stat +#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir +#include "ace/OS_Memory.h" //for ACE_NEW* macros + +#include <string> +#include "minizip/unzip.h" +#define MAXFILENAME (256) +#define CASESENSITIVITY (0) +#define WRITEBUFFERSIZE (8192) + +#include "ZIP_Wrapper.h" + +//ZIP_File_Info constructor +ZIP_File_Info::ZIP_File_Info (char* name, size_t size) + : name_ (name), + size_ (size), + next_ (0), + prev_ (0) +{ +} + +//ZIP_File_Info default constructor +ZIP_File_Info::ZIP_File_Info () + : name_ (""), + size_ (0), + next_ (0), + prev_ (0) +{ +} + + +/// Gets a list of the files in the archive. +int ZIP_Wrapper::file_list_info (char* zip_name, + ACE_Double_Linked_List<ZIP_File_Info> &list) +{ + unzFile uf=0; + char filename_try[MAXFILENAME+16] = ""; + if (zip_name!=0) + { + ACE_OS::strncpy(filename_try, zip_name, MAXFILENAME-1); + /* strncpy doesnt append the trailing NULL, if the string is too long. */ + filename_try[ MAXFILENAME ] = '\0'; + /* open the zip file */ + uf = unzOpen(zip_name); + /* if zipfile could not be opened, try appending .zip to name */ + if (uf==0) + { + ACE_OS::strcat(filename_try, ".zip"); + uf = unzOpen(filename_try); + } + } + /* If zipfile could not be opened still, return */ + if (uf==0) + { + ACE_DEBUG((LM_DEBUG, ACE_TEXT("There is some problem in opening" + " %s or %s.zip using unzOpen\n"), zip_name, zip_name)); + return 1; + } + unz_global_info gi; + /* get information about all the files in zip file*/ + int err = unzGetGlobalInfo(uf, &gi); + if (err!=UNZ_OK) + ACE_DEBUG((LM_DEBUG, ACE_TEXT("unzGetGlobalInfo failed while trying" + " to get global information about zipfile\n"), err)); + /* gi.number_entry corresponds to the number of directory entries + in the zip file */ + for (uLong i=0;i<gi.number_entry;i++) + { + char filename_inzip[256]; + unz_file_info file_info; + /* get information about the current file in zip file */ + err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, + sizeof(filename_inzip), 0, 0, 0, 0); + if (err!=UNZ_OK) + { + ACE_DEBUG((LM_DEBUG, ACE_TEXT("unzGetCurrentFileInfo failed" + " while trying to get information" + " about current file\n"), err)); + break; + } + ZIP_File_Info* next = 0; + ACE_NEW_RETURN (next, ZIP_File_Info (filename_inzip, + sizeof(filename_inzip)), -1); + /* add information about current file to the list */ + list.insert_tail (next); + if ((i+1)<gi.number_entry) + { + err = unzGoToNextFile(uf); + if (err!=UNZ_OK) + { + ACE_DEBUG((LM_DEBUG, + ACE_TEXT(" unzGoToNextFile failed" + " while trying to go to next file\n"), + err)); + break; + } + } + } + unzCloseCurrentFile(uf); + return gi.number_entry; +} + + +//get file and store it into ACE message block. +bool ZIP_Wrapper::get_file (char* archive_path, char* filename, + ACE_Message_Block &file) +{ + bool return_code = true; + unzFile uf=0; + uf = unzOpen(archive_path); + /* locate the desired file in the zip file and set it as current file*/ + int j=unzLocateFile(uf, filename, 0); + if (j==UNZ_END_OF_LIST_OF_FILE) + { + ACE_DEBUG((LM_DEBUG, ACE_TEXT("File not found in zip archive"))); + return false; + } + else if (j==UNZ_OK) + { + int k=unzOpenCurrentFile(uf); + if (k!=UNZ_OK) + { + ACE_DEBUG((LM_DEBUG, ACE_TEXT("Error in opening the current" + " file using unzOpenCurrentFile"))); + return false; + } + else + { + int num_read = 0; + ACE_Message_Block* head = &file; + + //read the file into the ACE_Message_Block + do + { + if (head->space () == 0) + { + ACE_Message_Block* next = 0; + ACE_NEW_RETURN (next, ACE_Message_Block (BUFSIZ), false); + head->cont (); + head = head->cont (); + } + num_read = unzReadCurrentFile(archive_path, head->wr_ptr(), + head->space()); + if (num_read > 0) + head->wr_ptr (num_read); + } while (num_read > 0); + if (num_read < 0) + return_code = false; + unzCloseCurrentFile(uf); + unzClose(uf); + return return_code; + } + } + return return_code; +} + + +/// uncompress the zip file +/// The zip file will be uncompressed into a directory +/// with the name of zip archive. +/// the path is assumed to be an existing directory + +bool ZIP_Wrapper::uncompress (char* zip_archive, char* path, bool verbose) +{ + //open the zip archive + unzFile uf=0; + uf = unzOpen(zip_archive); + if (uf==0) + { + ACE_DEBUG((LM_DEBUG,ACE_TEXT("unzOpen failed to open the" + " zipfile\n"))); + return false; + } + //get the name of the archive + ACE_CString arch_dir (path); + arch_dir += "/"; + //get only the name of the archive; remove path info + char* n = ACE_OS::strstr (zip_archive, "/"); + char* zip_name = 0; + while (n != 0) + { + zip_name = ++n; + n = ACE_OS::strstr (n, "/"); + } + arch_dir += zip_name; + //NOTE: Assumes .zip or cpk extension + arch_dir = arch_dir.substring (0, arch_dir.length () - 4); + //create directory with the name of zip archive + ACE_OS::mkdir(arch_dir.c_str()); + //if dir exists -1 is returned and ignored + unz_global_info gi; + int err = unzGetGlobalInfo(uf, &gi); + if (err!=UNZ_OK) + { + ACE_DEBUG((LM_DEBUG, ACE_TEXT("unzGetGlobalInfo failed to get global" + " information about zipfile\n"), err)); + return false; + } + err =unzGoToFirstFile(uf); + if (err!=UNZ_OK) + { + ACE_DEBUG((LM_DEBUG,ACE_TEXT("error %d with zipfile in" + " unzGoToFirstFile\n"), err)); + return false; + } + /* read each entry of zip file, create directory structure if it is + a non existing directory whereas if it is a file, write the file + at the proper path in the directory structure */ + for (uLong i=0;i<gi.number_entry;i++) + { + char filename_inzip[256]; + unz_file_info file_info; + err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, + sizeof(filename_inzip), 0, 0, 0, 0); + if (err!=UNZ_OK) + { + ACE_DEBUG((LM_DEBUG, ACE_TEXT("unzGetCurrentFileInfo failed" + " while trying to get information" + " about currentfile\n"), err)); + break; + } + int direc = checkdir(filename_inzip); + /* If it is a directory, we create directory structure */ + if (direc==1) + { + makethedir(filename_inzip, arch_dir); + } + /* If it is a file, we read its data and write the uncompressed + data to the file with proper path.*/ + else if (direc==0) + { + handlethefile(filename_inzip, uf, file_info, verbose, arch_dir); + } + if ((i+1)<gi.number_entry) + { + err = unzGoToNextFile(uf); + if (err!=UNZ_OK) + { + ACE_ERROR((LM_ERROR,ACE_TEXT("unzGoToNextFile failed" + " while trying to go to" + " nextfile\n"), err)); + break; + } + } + } + unzClose(uf); + return true; +} + + + +///try to find if it is a directory OR file +int ZIP_Wrapper::checkdir (char* filename_inzip) +{ + int direc = 0; + char* dircheck = ACE_OS::strstr (filename_inzip, "/"); + /* We assume that a directory will have its entry terminating in a / + We also assume that the directory entries in the zip file use + forward slash for both unix and windows */ + while (dircheck != 0) + { + int i = ACE_OS::strcmp(dircheck, "/"); + if (i == 0) + { + direc = 1; + break; + } + ++dircheck; + dircheck = ACE_OS::strstr (dircheck, "/"); + } + return direc; +} + +///Create directory structure if entry in zipfile is a directory +int ZIP_Wrapper::makethedir (char* filename_inzip, ACE_CString arch_dir) +{ +//let's try to create the directory structure for the package + char dir_name [2048]; + char* next = ACE_OS::strstr (filename_inzip, "/"); + while (next != 0) + { + ACE_CString location (arch_dir); + ACE_OS::strncpy (dir_name, filename_inzip, next - filename_inzip + + 1); + + dir_name[next - filename_inzip + 1] = '\0'; + location += "/"; + location += dir_name; + ACE_stat stat; + if (ACE_OS::stat (location.c_str (), &stat) == -1) + ACE_OS::mkdir (location.c_str ()); + next++; + next = ACE_OS::strstr (next, "/"); + } + return 0; +} + +///If entry in zipfile is a file, then read the file and write the +///uncompressed data at the proper filepath. +int ZIP_Wrapper::handlethefile (char* filename_inzip, unzFile uf, + unz_file_info file_info, bool verbose, + ACE_CString arch_dir) +{ + int k = unzOpenCurrentFile(uf); + if (k!=UNZ_OK) + { + ACE_ERROR((LM_ERROR,ACE_TEXT("unzOpenCurrentFile failed in" + " opening the current file"))); + return false; + } + else + { + size_t const file_size = file_info.uncompressed_size; + char* temp = 0; + ACE_NEW_RETURN (temp, char [file_size], false); + ACE_Auto_Basic_Array_Ptr<char> buffer (temp); + //read in the data + unzReadCurrentFile(uf, &(*buffer), file_size); + //close the zip handle + unzCloseCurrentFile(uf); + //create file name + path to open + std::string file_path (arch_dir.c_str ()); + //NOTE: need the c-style char to stop at '\0' + file_path += "/"; + file_path += filename_inzip; + //print out the file to be uncompressed + if (verbose) + { + ACE_OS::write(ACE_STDOUT, file_path.c_str (), + file_path.length () ); + ACE_OS::write(ACE_STDOUT, "\n", 1); + } + // Open a file handle to the local filesystem + ACE_HANDLE handle = ACE_OS::open (file_path.c_str (), + O_CREAT | O_TRUNC | O_WRONLY); + if (handle == ACE_INVALID_HANDLE) + { + unzClose(uf); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[uncompress] file creation error")), + 0); + } + //write the uncompressed data to the file + if (ACE_OS::write (handle, &(*buffer), file_size) == -1) + { + unzClose(uf); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("[uncompress] file write error")), + 0); + } + // Close the file handle + ACE_OS::close (handle); + } + return 0; +} diff --git a/modules/CIAO/DAnCE/RepositoryManager/ZIP_Wrapper.h b/modules/CIAO/DAnCE/RepositoryManager/ZIP_Wrapper.h new file mode 100644 index 00000000000..cb1be6c2843 --- /dev/null +++ b/modules/CIAO/DAnCE/RepositoryManager/ZIP_Wrapper.h @@ -0,0 +1,117 @@ + +/* -*- C++ -*- */ + +//======================================================================= +/** + * @file ZIP_Wrapper.h + * + * $Id$ + * + * Purpose: to provide a wrapper around minizip for easy handling of + * ZIP archives. This wrapper can be used as an auxiliary + * class that allows a program to become ZIP-aware + * + * @author Stoyan Paunov, Vipul Singh + * + * + */ +//======================================================================= + +#ifndef _ZIP_WRAPPER_H_ +#define _ZIP_WRAPPER_H_ + +#include "ace/Containers_T.h" //for ACE_Double_Linked_List +#include "ace/Message_Block.h" //for ACE_Message_Block +#include "ace/SString.h" //for ACE_CString +#include "ace/Log_Msg.h" +#include "ace/Synch.h" +#include "ace/OS_NS_fcntl.h" //for open +#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir + +#include "minizip/unzip.h" + + +/** + * @class ZIP_File_Info + * + * This class is used as a carrier of information + * about entities residing inside a ZIP archive + */ +class ZIP_File_Info +{ +public: + ACE_CString name_; + size_t size_; + ZIP_File_Info* next_; + ZIP_File_Info* prev_; + + ZIP_File_Info (char* name, size_t size); + ZIP_File_Info (); +}; + +/** + * @class ZIP_Wrappers + * + * This class is the actual workhorse that provides all of + * the necessary functionality + */ +class ZIP_Wrapper +{ +public: + + /// Get file and store it into an ACE_Message_Block. The function + /// averts subdirectory traversal problems. + /// NOTE: Be sure to release the message block even if the function returns + /// false becuase the return value might be due to unsuccessful allocation + + ///archive_path is the zip archive with the path + ///filename is the name of the file to be looked for in the zip archive. + ///the file is stored in ACE message block. + static bool get_file (char* archive_path, char* filename, + ACE_Message_Block &file); + + /// uncompress the zip file + /// The zip file will be uncompressed into a directory with the + ///name of zip archive. + /// The path is assumed to be an existing directory + + ///zip_archive is the arcive to be uncompressed with full path. + ///path is used for creating a directory with the name of zip archive. + static bool uncompress (char* zip_archive, char* path = 0, + bool verbose = true); + + /// Get a list of the files in the archive + + ///zip_name is the name of zipfile with fullpath. + ///list stores information about each entry in zip file. + static int file_list_info (char* zip_name, + ACE_Double_Linked_List<ZIP_File_Info> &list); + + ///Check if an entry of a zip file is a file or directory + ///We assume a directoryname terminates with a forward slash + ///Returns 1 for directory while 0 for file. + + ///filename_inzip is an entry in a zipfile + static int checkdir (char* filename_inzip); + + ///Create directory structure if entry in zipfile is a directory + + ///filename_inzip is an entry in a zipfile + ///arch_dir stores the name of the directory to be created + static int makethedir (char* filename_inzip, ACE_CString arch_dir); + + ///If entry in zipfile is a file, then read the file and write + /// the uncompressed data at the proper filepath. + + ///filename_inzip is an entry in a zipfile + ///uf refers to the zip archive + ///file_info is used to get information about current file + ///verbose decides if the details are to be printed or not + ///arch_dir is the name of file with full path where it is to be + ///uncompressed + static int handlethefile (char* filename_inzip, unzFile uf, + unz_file_info file_info, + bool verbose, ACE_CString arch_dir); +}; + +#endif diff --git a/modules/CIAO/DAnCE/Starter/Starter.cpp b/modules/CIAO/DAnCE/Starter/Starter.cpp new file mode 100644 index 00000000000..8aa2a2c5d97 --- /dev/null +++ b/modules/CIAO/DAnCE/Starter/Starter.cpp @@ -0,0 +1,924 @@ +// -*- 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 "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(ACE_TEXT("process-ns"), 'p', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option(ACE_TEXT("process-ns-options"), ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("node-mgr"), 'n', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("exec-mgr"), 'e', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option(ACE_TEXT("create-plan-ns"), 'c', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option(ACE_TEXT("rebind-plan-ns"), 'r', ACE_Get_Opt::ARG_OPTIONAL); + opts.long_option(ACE_TEXT("port-indirection"), 'i', ACE_Get_Opt::NO_ARG); + opts.long_option(ACE_TEXT("log-level"), 'l', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); + opts.long_option(ACE_TEXT("gen-object-key"), 'g', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("read-plan"), 'x', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("read-cdr-plan"), 'd', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("stop-plan"), 'q', ACE_Get_Opt::NO_ARG); + opts.long_option(ACE_TEXT("em-ior"), 'k', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("write-cdr-plan"), 'w', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("plan-uuid"), 't', ACE_Get_Opt::ARG_REQUIRED); + opts.long_option(ACE_TEXT("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 ACE_TCHAR * 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/modules/CIAO/DAnCE/Starter/Starter.h b/modules/CIAO/DAnCE/Starter/Starter.h new file mode 100644 index 00000000000..4e737b73e4e --- /dev/null +++ b/modules/CIAO/DAnCE/Starter/Starter.h @@ -0,0 +1,73 @@ +// $Id$ +#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_TString 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 ACE_TCHAR * 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/modules/CIAO/DAnCE/Starter/Starter.mpc b/modules/CIAO/DAnCE/Starter/Starter.mpc new file mode 100644 index 00000000000..312ba8659f9 --- /dev/null +++ b/modules/CIAO/DAnCE/Starter/Starter.mpc @@ -0,0 +1,9 @@ +// $Id$ +project(Starter) : taoexe, dance_exe, dance_logger, messaging, naming, iortable, avoids_minimum_corba { + exename = dance + macros += DANCE_BUILD_STARTER_EXE + Source_Files { + Starter.cpp + } +} + diff --git a/modules/CIAO/DAnCE/StaticConfigurator/README b/modules/CIAO/DAnCE/StaticConfigurator/README new file mode 100644 index 00000000000..e42c1099cfd --- /dev/null +++ b/modules/CIAO/DAnCE/StaticConfigurator/README @@ -0,0 +1,29 @@ +Please see $CIAO_ROOT/docs/static_dance.html for details. + +To run the static version of Hello example, do the following, + +1. Build ACE+TAO+CIAO statically +2. Build $CIAO_ROOT/examples/Hello +3. Generate the static function entrypoints (plan.h) + > cd $CIAO_ROOT/examples/Hello/descriptors + > $CIAO_ROOT/DAnCE/StaticConfigurator/StaticDAnCEParser -p flattened_deploymentplan_without_ns.cdp + > cp plan.h $CIAO_ROOT/DAnCE/StaticConfigurator/ +4. Build the static NodeManager for Hello example + > cd $CIAO_ROOT/DAnCE/StaticConfigurator + > cp StaticDAnCEApp.cpp.tmpl StaticDAnCEApp.cpp + > cp StaticDAnCEApp.mpc.tmpl StaticDAnCEApp.mpc + > $ACE_ROOT/bin/mwc.pl + > make +5. Run the static node managers. Note that the ORBEndpoint values should + correspond to the ones in $CIAO_ROOT/examples/Hello/descriptors/TestNodeManagerMap.dat + > cd $CIAO_ROOT/DAnCE/StaticConfigurator + > ./StaticDAnCEApp -ORBEndpoint iiop://localhost:60001 & + > ./StaticDAnCEApp -ORBEndpoint iiop://localhost:60002 & +6. Do the deployment. This is just the same as the non-static version of DAnCE + except that we have the NodeManagers already running and need not spawn node + managers. To accomplish this, change + $CIAO_ROOT/examples/Hello/descriptors/run_test_without_ns.pl + to *not* run the node manager daemons and do the following. + > cd $CIAO_ROOT/examples/Hello/descriptors + > ./run_test_without_ns.pl + diff --git a/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.cpp.tmpl b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.cpp.tmpl new file mode 100644 index 00000000000..2753ab41444 --- /dev/null +++ b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.cpp.tmpl @@ -0,0 +1,103 @@ +// $Id$ + +#include "plan.h" + +#include "NodeManager/NodeManager_Impl.h" + +#include "tao/IORTable/IORTable.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + // Initialize the ORB so that CORBA::Any will work. + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv, + ""); + + try + { + // Get reference to Root POA. + CORBA::Object_var obj = + orb->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var poa = + PortableServer::POA::_narrow (obj.in ()); + + // Activate POA manager. + PortableServer::POAManager_var mgr = poa->the_POAManager (); + + mgr->activate (); + + int homes_table_size = + sizeof (homes_table) / sizeof (HomeAttributes); + + CIAO::HOMECREATOR_FUNCPTR_MAP home_creator_fptr_map; + CIAO::HOMESERVANTCREATOR_FUNCPTR_MAP homesvnt_creator_fptr_map; + CIAO::Static_Config_EntryPoints_Maps static_config_entrypoints_maps; + + static_config_entrypoints_maps.home_creator_funcptr_map_ = + &home_creator_fptr_map; + + static_config_entrypoints_maps.home_servant_creator_funcptr_map_ = + &homesvnt_creator_fptr_map; + + for (int i = 0; i < homes_table_size; ++i) + { + home_creator_fptr_map.bind (homes_table[i].executor_entrypt_, + homes_table[i].executor_fptr_); + + homesvnt_creator_fptr_map.bind (homes_table[i].servant_entrypt_, + homes_table[i].servant_fptr_); + } + + CIAO::Static_NodeManager_Impl *static_node_manager_impl; + + // Create and install the CIAO Daemon servant. + + ACE_DEBUG ((LM_DEBUG, "creating static_node_manager\n")); + + static_node_manager_impl = + new CIAO::Static_NodeManager_Impl ("NodeManager", + orb.in (), + poa.in (), + "", //exe location + "", //exe options + 0, //spawn delay + &static_config_entrypoints_maps); + + static_node_manager_impl->init (); + + 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); + } + + CIAO::NodeManagerDaemon_var manager = + static_node_manager_impl->_this (); + + CORBA::String_var str = + orb->object_to_string (manager.in ()); + + adapter->bind ("NodeManager", str.in ()); + + // Run the main event loop for the ORB. + orb->run (); + + poa->destroy (true, true); + + orb->destroy (); + } + catch (CORBA::Exception& ex) + { + ex._tao_print_exception ("Caught CORBA Exception: "); + return -1; + } + + return 0; +} diff --git a/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.mpc.tmpl b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.mpc.tmpl new file mode 100644 index 00000000000..c528ee65695 --- /dev/null +++ b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.mpc.tmpl @@ -0,0 +1,20 @@ +// -*- MPC -*- +// $Id$ + +project(StaticDAnCEApp): ciao_static_dnc_app, iortable { + exename = StaticDAnCEApp + + libs += Hello_Base_DnC_stub + libs += Hello_Base_DnC_svnt + libs += Receiver_DnC_stub + libs += Receiver_DnC_svnt + libs += Receiver_DnC_exec + libs += Sender_DnC_stub + libs += Sender_DnC_svnt + libs += Sender_DnC_exec + + Source_Files { + StaticDAnCEApp.cpp + } +} + diff --git a/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.cpp b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.cpp new file mode 100644 index 00000000000..e0b86df1028 --- /dev/null +++ b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.cpp @@ -0,0 +1,157 @@ +//============================================================================= +/** + * @file StaticDAnCEParser.cpp + * + * $Id$ + * + * This parser is used in static deployment of CIAO components. This + * parser parses a deployment plan and generates a header file plan.h + * containing information about the home and servant creation + * function entry points. This can be used by a Static_NodeManager to + * instantiate instances of homes and servants just like the regular + * NodeManager. For more details, see + * $CIAO_ROOT/DAnCE/StaticConfigurator/docs/static_dance.html + * + * @author Venkita Subramonian <venkita@cse.wustl.edu> + */ +//============================================================================= + +#include "DAnCE/NodeApplicationManager/ImplementationInfo.h" +#include "ace/OS_NS_stdio.h" +#include "ace/streams.h" +#include "ace/Get_Opt.h" +#include "tao/IORTable/IORTable.h" +#include "tao/CDR.h" +#include "Config_Handlers/XML_File_Intf.h" + +static void +usage (const ACE_TCHAR* program) +{ + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Usage: %s -p <package URI>\n"), + program)); +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + // top level package URL + char* package_url = 0; + + // Initialize the ORB so that CORBA::Any will work + // + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:")); + int c; + + while ((c = get_opt ()) != EOF) + { + switch (c) + { + case 'p': + package_url = get_opt.opt_arg (); + break; + + default: + usage(argv[0]); + return -1; + } + } + + if (package_url == 0) { + usage(argv[0]); + return -1; + } + + CIAO::Config_Handlers::XML_File_Intf intf (package_url); + + ::Deployment::DeploymentPlan_var plan = + intf.get_plan (); + + ::Deployment::ComponentPlans dummy; + dummy.length (0); + + CIAO::NodeImplementationInfoHandler handler (plan, dummy); + + Deployment::NodeImplementationInfo_var node_impl_info (handler.node_impl_info ()); + + if (node_impl_info.ptr() == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "DAnCE (%P|%t) StaticParser -" + "Failed to create Node Implementation Infos!\n"), 1); + + } + + Deployment::ContainerImplementationInfos& impl_infos = node_impl_info->impl_infos; + + FILE* fp = ACE_OS::fopen ("plan.h", "w"); + + CORBA::ULong i,j,num_containers,num_components; + num_containers = impl_infos.length (); + for (i = 0; i < num_containers; ++i) + { + num_components = impl_infos[i].impl_infos.length (); + for (j = 0; j < num_components; ++j) + { + ACE_DEBUG ((LM_DEBUG, "The info for installation: \n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n", + impl_infos[i].impl_infos[j].component_instance_name.in (), + impl_infos[i].impl_infos[j].executor_dll.in (), + impl_infos[i].impl_infos[j].executor_entrypt.in (), + impl_infos[i].impl_infos[j].servant_dll.in (), + impl_infos[i].impl_infos[j].servant_entrypt.in () )); + ACE_OS::fprintf (fp, + "extern \"C\" ::Components::HomeExecutorBase_ptr %s (void);\n", + impl_infos[i].impl_infos[j].executor_entrypt.in ()); + ACE_OS::fprintf (fp, + "extern \"C\" ::PortableServer::Servant %s\n", + impl_infos[i].impl_infos[j].servant_entrypt.in ()); + ACE_OS::fprintf (fp, + "\t\t(::Components::HomeExecutorBase_ptr p,\n"); + ACE_OS::fprintf (fp, + "\t\t::CIAO::Session_Container *c,\n"); + ACE_OS::fprintf (fp, + "\t\tconst char*\n"); + ACE_OS::fprintf (fp, + "\t\t);\n"); + } + } + + ACE_OS::fprintf (fp, "struct HomeAttributes\n"); + ACE_OS::fprintf (fp, "{\n"); + ACE_OS::fprintf (fp, " char const * component_instance_name_;\n"); + ACE_OS::fprintf (fp, " /// Specify the entrypoint to component executor DLL.\n"); + ACE_OS::fprintf (fp, " char const * executor_entrypt_;\n"); + ACE_OS::fprintf (fp, " ::CIAO::HomeFactory executor_fptr_;\n"); + ACE_OS::fprintf (fp, " /// Specify the entrypoint to component servant DLL.\n"); + ACE_OS::fprintf (fp, " char const * servant_entrypt_;\n"); + ACE_OS::fprintf (fp, " ::CIAO::ServantFactory servant_fptr_;\n"); + ACE_OS::fprintf (fp, "};\n"); + ACE_OS::fprintf (fp, "/// Homes\n"); + ACE_OS::fprintf (fp, "HomeAttributes homes_table[]=\n"); + ACE_OS::fprintf (fp, "{\n"); + + num_containers = impl_infos.length (); + for (i = 0; i < num_containers; ++i) + { + num_components = impl_infos[i].impl_infos.length (); + for (j = 0; j < num_components; ++j) + { + ACE_OS::fprintf (fp, "\t{\"%s\", \"%s\", %s, \"%s\", %s}", + impl_infos[i].impl_infos[j].component_instance_name.in (), + impl_infos[i].impl_infos[j].executor_entrypt.in (), + impl_infos[i].impl_infos[j].executor_entrypt.in (), + impl_infos[i].impl_infos[j].servant_entrypt.in (), + impl_infos[i].impl_infos[j].servant_entrypt.in () ); + if (!(i == num_containers -1 && j == num_components-1)) + ACE_OS::fprintf (fp, ",\n"); + } + } + ACE_OS::fprintf (fp, "};\n\n"); + + ACE_OS::fclose (fp); + + return 0; +} diff --git a/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc new file mode 100644 index 00000000000..3ebe3271730 --- /dev/null +++ b/modules/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc @@ -0,0 +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 +// } +//} diff --git a/modules/CIAO/DAnCE/TargetManager/CmpClient.cpp b/modules/CIAO/DAnCE/TargetManager/CmpClient.cpp new file mode 100644 index 00000000000..b9bfd4872f2 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/CmpClient.cpp @@ -0,0 +1,305 @@ +// $Id$ +/** + * @file CmpClient.cpp + * + * @brief This file contains a client of TargetManager. + * + * It picks up the TM ior from the Targetmanager.ior file + * present in the current directory, and makes the calls on the + * TM to getAllResources and getAvailable resources + */ + +#include "DAnCE/Deployment/Deployment_DataC.h" +#include "DAnCE/Deployment/Deployment_ResourceCommitmentManagerC.h" +#include "DAnCE/TargetManager/TargetManagerImplC.h" +#include "ace/streams.h" +#include "ace/FILE_IO.h" +#include "ace/FILE_Connector.h" +#include "ace/FILE_Addr.h" +#include "ace/Get_Opt.h" +#include "tools/Config_Handlers/DnC_Dump.h" + +/** + * TM_Tester contains the code to test the TM Component + */ +namespace TM_Tester +{ + /** + * writes the extracted data to file + */ + void write_to_file (::Deployment::Domain domain); + + /// variable contains IOR of the TM + const ACE_TCHAR * stringified_TM_IOR; + + /// if add or delete from domain + bool add_to_domain = true; + + /// whether to test update domain or not + bool call_update = false; + + /// contains the host name + const ACE_TCHAR* host_name; + + /// parses the arguments and extracts the params + bool parse_args (int argc, ACE_TCHAR *argv[]) + { + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("t:u:d")); + int c; + while ((c = get_opts ()) != -1) + switch (c) + { + case 't': + stringified_TM_IOR = get_opts.opt_arg (); + break; + case 'u': + host_name = get_opts.opt_arg (); + call_update = true; + break; + case 'd': + add_to_domain = false; + break; + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-t <TM_IOR>\n" + "-u <host_name in update>\n" + "-n <delete , default add>\n" + "\n", + argv [0]), + false); + } + + return true; + } +} + + /// The main function + int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) + { + try { + // First initialize the ORB, that will remove some arguments... + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + if (!TM_Tester::parse_args (argc, argv)) + return -1; + + // Use the first argument to create the factory object reference, + // in real applications we use the naming service, but let's do + // the easy part first! + CORBA::Object_var factory_object = + orb->string_to_object (TM_Tester::stringified_TM_IOR); + + // Now downcast the object reference to the appropriate type + CIAO::TargetManagerImpl_var targetCmp = + CIAO::TargetManagerImpl::_narrow (factory_object.in ()); + + // Now get the facet reference from the target Manager Component + Deployment::TargetManager_ptr targetI = targetCmp->provide_targetMgr (); + + // Now make calls on the Target Manager facet + + try + { + Deployment::Domain_var domainV = targetI->getAllResources (); + ::Deployment::DnC_Dump::dump (domainV); + } + catch(CORBA::NO_IMPLEMENT &) + { + ACE_ERROR ((LM_ERROR ,"Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n")); + } + catch(CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR ,"Error:TargetManager:CORBA Generic Exception\n")); + ACE_ERROR ((LM_ERROR ,"Error:TargetManager:Exception in TargetManager call\n")); + } + + + // make a call to the commit resources ..... + + bool resource_available = true; + + ::Deployment::ResourceAllocations resource_seq; + + resource_seq.length (1); + + resource_seq[0].elementName = CORBA::string_dup ("TargetManagerNode_1"); + + resource_seq[0].resourceName = CORBA::string_dup ("Processor"); + + resource_seq[0].property.length (1); + resource_seq[0].property[0].name = + CORBA::string_dup ("LoadAverage"); + + CORBA::Long d = 20; + resource_seq[0].property[0].value <<= d; + + ::Deployment::ResourceCommitmentManager_ptr manager = + ::Deployment::ResourceCommitmentManager::_nil (); + + try + { + manager = targetI->commitResources (resource_seq); + } + catch(const CORBA::NO_IMPLEMENT &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n")); + } + catch (const ::Deployment::ResourceCommitmentFailure& e) + { + resource_available = 0; + ACE_ERROR ((LM_ERROR, "TargetManager commitResources ResourceCommitmentFailure Exception\n")); + + ACE_ERROR ((LM_ERROR , + "ResourceCommitmentFailure\n reason=[%C]\n elementName=[%C]\n resourceName=[%C]\n propertyName=[%C]\n", + e.reason.in (), + resource_seq[e.index].elementName.in (), + resource_seq[e.index].resourceName.in (), + e.propertyName.in ())); + } + catch(const CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:commitResources Exception\n")); + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n")); + ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in TargetManager call")); + } + + // Make a call to release resources , if resource < 0 + try + { + { + d = 10; + resource_seq[0].property[0].value <<= d; + manager->releaseResources (resource_seq); + } + } + catch(const CORBA::NO_IMPLEMENT &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n")); + } + catch (const Deployment::ResourceCommitmentFailure&) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager releaseResources ResourceNotAvailable Exception\n")); + } + catch(const CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:releaseResources Exception\n")); + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n")); + ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in TargetManager call")); + } + + // Here make a call on the TM with update domain and node deletion + + ::Deployment::Domain updated; + updated.node.length (1); + updated.node[0].name = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (TM_Tester::host_name)); + + ::CORBA::StringSeq elements; + elements.length (0); + + + if (TM_Tester::call_update) + { + if (TM_Tester::add_to_domain) + { + try + { + targetI->updateDomain (elements , updated, ::Deployment::Add); + } + catch(CORBA::NO_IMPLEMENT &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n")); + } + catch(CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n")); + ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in UpdateDomain call")); + } + } + else + { + try + { + targetI->updateDomain (elements , updated, ::Deployment::Delete); + } + catch(CORBA::NO_IMPLEMENT &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n")); + } + catch(CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n")); + ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in UpdateDomain call")); + } + } + } + + // Now make a call of getAvailableResources on the TargetManager ... + try + { + Deployment::Domain_var domainV = targetI->getAvailableResources(); + + // here write things to file ... + TM_Tester::write_to_file (domainV.in()); + + ::Deployment::DnC_Dump::dump (domainV); + } + catch(CORBA::NO_IMPLEMENT &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n")); + } + catch(CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR ,"Error:TargetManager:CORBA Generic Exception\n")); + ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in TargetManager call\n")); + } + + // Finally destroy the ORB + orb->destroy (); + } + catch (CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA exception raised!\n")); + } + return 0; + } + +namespace TM_Tester +{ + void write_to_file (::Deployment::Domain domain) + { + for (size_t i = 0;i < domain.node.length ();i++) + { + std::ofstream out (domain.node[i].name.in ()); + + // write in the node usage ... + for (CORBA::ULong j = 0;j < domain.node[i].resource.length ();j++) + { + + if (!ACE_OS::strcmp (domain.node[i].resource[j].name.in (), "Processor")) + { + CORBA::Double node_cpu; + domain.node[i].resource[j].property[0].value >>= node_cpu; + out << node_cpu << std::endl; + } + if (!ACE_OS::strcmp (domain.node[i].resource[j].name.in (), "NA_Monitor")) + { + std::string file_name = "NA_"; + file_name += domain.node[i].name.in (); + ACE_FILE_IO file_io; + ACE_FILE_Connector (file_io, ACE_FILE_Addr (file_name.c_str ())); + CORBA::Double na_node_cpu; + domain.node[i].resource[j].property[0].value >>= na_node_cpu; + char buf[BUFSIZ]; + ACE_OS::memset (buf , 0 , BUFSIZ); + ACE_OS::sprintf (buf , "%f", na_node_cpu); + file_io.send (buf, ACE_OS::strlen (buf)); + } + } + + out.close (); + } + } +} diff --git a/modules/CIAO/DAnCE/TargetManager/DomainDataManager.cpp b/modules/CIAO/DAnCE/TargetManager/DomainDataManager.cpp new file mode 100644 index 00000000000..92aa0f2337f --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/DomainDataManager.cpp @@ -0,0 +1,662 @@ +// $Id$ +#include "DomainDataManager.h" + +#include "tools/Config_Handlers/DD_Handler.h" +#include "tools/Config_Handlers/DnC_Dump.h" +#include "ciao/CIAO_common.h" + +const char * domain_file_name = "Domain.cdd"; + +CIAO::DomainDataManager* CIAO::DomainDataManager::global_data_manager_ = 0; + +CIAO::DomainDataManager * CIAO::DomainDataManager::create (CORBA::ORB_ptr orb, + ::Deployment::TargetManager_ptr target) +{ + if (global_data_manager_ == 0) + { + global_data_manager_ = new DomainDataManager (orb , target); + } + return global_data_manager_; +} + +// Returns the pointer to the static variable +CIAO::DomainDataManager* +CIAO::DomainDataManager::get_data_manager () +{ + return global_data_manager_; +} + +void +CIAO::DomainDataManager::delete_data_manger () +{ + if (global_data_manager_) + delete global_data_manager_; +} + +int CIAO::DomainDataManager::update_domain ( + const ::CORBA::StringSeq &, + const ::Deployment::Domain & domainSubset, + ::Deployment::DomainUpdateKind update_kind) +{ + // Update the subset of the domain which the above + // parameter corresponds to + + + //check the type of update .. + + switch (update_kind) + { + case ::Deployment::UpdateAll: + case ::Deployment::UpdateDynamic: + break; + case ::Deployment::Add: + add_to_domain (domainSubset); + break; + case ::Deployment::Delete: + delete_from_domain (domainSubset); + break; + default: + break; + } + + CORBA::ULong const size = current_domain_.node.length (); + + CORBA::ULong i; + for (i=0;i < size;i++) + { + if (!ACE_OS::strcmp (domainSubset.node[0].name , + current_domain_.node[i].name)) + { + // found a match + // for now overwrite the entire Node info ... + // but later , this has to be changed to overwrite + // only the specific part ... + current_domain_.node[i] = domainSubset.node[0]; + break; // finished job ...break + } + } + + if (i == size) + { + // thus the node is new .. add it to current_domain_ + // later change it ... + current_domain_.node.length (size+1); + current_domain_.node[size]=domainSubset.node[0]; + } + return 0; +} + +CIAO::DomainDataManager:: +DomainDataManager (CORBA::ORB_ptr orb, + ::Deployment::TargetManager_ptr target) + : orb_ (CORBA::ORB::_duplicate (orb)), +// deployment_config_ (orb_.in()), + target_mgr_ (::Deployment::TargetManager::_duplicate(target)) +{ + CIAO::Config_Handlers::DD_Handler dd (domain_file_name); + ::Deployment::Domain* dmn = dd.domain_idl (); + +// if (CIAO::debug_level () > 9) + //::Deployment::DnC_Dump::dump (*dmn); + + current_domain_ = *dmn; + initial_domain_ = current_domain_; + + // initialize the provisioning domain + provisioned_data_ = initial_domain_; + + update_node_status (); + + call_all_node_managers (); +} + +::Deployment::Domain* CIAO::DomainDataManager::get_current_domain () +{ + return new ::Deployment::Domain (provisioned_data_); +} + +::Deployment::Domain* CIAO::DomainDataManager::get_initial_domain () +{ + return new ::Deployment::Domain (initial_domain_); +} + +int CIAO::DomainDataManager::readin_domain_data () +{ + // here read in Domain data ... + // + return 0; +} + +int CIAO::DomainDataManager::call_all_node_managers () +{ +/* if ( this->deployment_config_.init ("NodeDetails.dat") == -1 ) + { + ACE_ERROR ((LM_ERROR, + "TargetM (%P|%t) DomainDataManager.cpp -" + "CIAO::DomainDataManager::call_all_node_managers -" + "ERROR while trying to initialize after reading " + "node details DAT file\n")); + return 0; + } + + CORBA::ULong const length = initial_domain_.node.length (); + + for (CORBA::ULong i=0;i < length;i++) + { + + ::Deployment::NodeManager_var node_manager; + + try + { + node_manager = + deployment_config_.get_node_manager + (initial_domain_.node[i].name.in ()); + } + catch (CORBA::Exception&) + { + ACE_ERROR ((LM_ERROR, "DANCE::TM (%P|%t) DomainDataManager.cpp: " + "Error trying to contact NodeManager %s\n", + initial_domain_.node[i].name.in ())); + continue; + } + + + if (!CORBA::is_nil (node_manager.in ())) + { + Deployment::Logger_ptr log = + Deployment::Logger::_nil (); + ::Deployment::Domain sub_domain; + sub_domain.UUID = CORBA::string_dup("Node-Level-domain"); + sub_domain.label = CORBA::string_dup("Node-level-domain"); + sub_domain.sharedResource.length(0); + sub_domain.interconnect.length(0); + sub_domain.bridge.length(0); + sub_domain.infoProperty.length(0); + sub_domain.node.length (1); + sub_domain.node[0] = initial_domain_.node[i]; + try + { + node_manager->joinDomain (sub_domain, + target_mgr_.in (), + log); + } + catch (CORBA::Exception& ex) + { + ACE_ERROR ((LM_ERROR , "TM::Error in calling Join Domain==\n")); + ex._tao_print_exception ( + "Exception caught in ""DomainDataManager::joinDomain"); + } + } + } +*/ + return 0; + +} + + +::Deployment::ResourceCommitmentManager_ptr CIAO::DomainDataManager +::commitResources (const ::Deployment::ResourceAllocations &) +{ +/* + // commit the resources + // parse into the plan and commit resources ... + + // set the action value + current_action_ = commit; + + // temporary created to guard against exceptions + ::Deployment::Domain temp_provisioned_data = + provisioned_data_; + + for (CORBA::ULong i = 0;i < plan.instance.length ();i++) + { + for (CORBA::ULong j = 0;j < temp_provisioned_data.node.length ();j++) + { + if (!ACE_OS::strcmp (plan.instance[i].node.in () , + temp_provisioned_data.node[j].name.in ())) + { + try { + match_requirement_resource ( + plan.instance[i].deployedResource, + temp_provisioned_data.node[j].resource); + } + catch (::Deployment::ResourceCommitmentFailure& ex) + { + // catch the exception and add parameters + throw ex; + } + } + } + } + + // here commit the commitresources + provisioned_data_ = temp_provisioned_data; + */ + return 0; +} + + +void CIAO::DomainDataManager:: +releaseResources (const ::Deployment::ResourceCommitmentManager_ptr) +{ + // release the resources +/* + + // set the action value + current_action_ = release; + + for (CORBA::ULong i = 0;i < plan.instance.length ();i++) + { + for (CORBA::ULong j = 0;j < provisioned_data_.node.length ();j++) + { + if (!ACE_OS::strcmp (plan.instance[i].node.in () , + provisioned_data_.node[j].name.in ())) + { + match_requirement_resource ( + plan.instance[i].deployedResource, + provisioned_data_.node[j].resource); + + } + } + } +*/ +} + + +void CIAO::DomainDataManager:: +match_requirement_resource ( + ::Deployment::InstanceResourceDeploymentDescriptions deployed, + ::Deployment::Resources & available + ) +{ + // here match the deployed to the available + + for (CORBA::ULong i = 0;i < deployed.length ();i++) + { + // for each deployed resource ....search the corresponding + // available resource + for (CORBA::ULong j = 0;j < available.length ();j++) + { + if (!ACE_OS::strcmp (deployed[i].requirementName, available[j].name)) + { + // search for the resourcename in the resourceType + for (CORBA::ULong k = 0;k < available[j].resourceType.length ();k++) + { + if (!ACE_OS::strcmp (deployed[i].resourceName, + available[j].resourceType[k])) + { + try { + match_properties (deployed[i].property, + available[j].property); + } + catch (::Deployment::ResourceCommitmentFailure& ex) + { + // catch the exception and add parameters + throw ex; + } + } + } + } + } + } + +} + +void CIAO::DomainDataManager:: +match_properties ( + ::Deployment::Properties deployed, + ::Deployment::SatisfierProperties & available) +{ + bool property_found; + + for (CORBA::ULong i = 0;i < deployed.length ();i++) + { + property_found = false; + + for (CORBA::ULong j = 0;j < available.length ();j++) + { + if (!ACE_OS::strcmp (deployed[i].name , available[j].name)) + { + // check kind here ....and then subtract .... + // accordingly , ..this is complex ... better to write + // some specialised algo + // for now assuming Capacity .... + // and tk_double .... + + commit_release_resource (deployed[i] , available[j]); + property_found = true; + } + } // internal for .... + + // check if property was found or not + if (property_found == false) + { + // throw an error since property was not found in the Resource + ::Deployment::ResourceCommitmentFailure failure; + + failure.reason = CORBA::string_dup ("Property Not Found\n"); + failure.propertyName = CORBA::string_dup (deployed[i].name); + failure.propertyValue.length (0); + + throw failure; + } + } // outside for ... +} + +void CIAO::DomainDataManager::commit_release_resource ( + ::Deployment::Property & deployed, + ::Deployment::SatisfierProperty & available) +{ + if (current_action_ == commit) + { + + CORBA::Long required_d; + + if ((deployed.value >>= required_d) == false) + ACE_ERROR ((LM_ERROR, "Failed to extract required amount\n")); + + CORBA::Long available_d; + + if ((available.value >>= available_d) == false) + ACE_ERROR ((LM_ERROR, "failed to extract available amount\n")); + + if (available_d >= required_d) + { + available_d = available_d - required_d; + + available.value <<= available_d; + } + else + { + ::Deployment::ResourceCommitmentFailure failure; + + failure.reason = CORBA::string_dup ("Insufficient resources!"); + failure.propertyName = CORBA::string_dup (available.name); + failure.propertyValue.length (1); + failure.propertyValue[0] = available.value; + + throw failure; + } + } + else + { + //must be release + // @todo check return value of >>= + CORBA::Long required_d; + deployed.value >>= required_d; + CORBA::Long available_d; + available.value >>= available_d; + + available_d = available_d + required_d; + + // Should we check for bin > 100 ?????? + + available.value <<= available_d; + } +} + +void CIAO::DomainDataManager::stop_monitors () +{ + + CORBA::ULong const length = initial_domain_.node.length (); + + for (CORBA::ULong i=0;i < length;i++) + { + ::Deployment::NodeManager_var node_manager; + + try + { +// node_manager = + //deployment_config_.get_node_manager +// (initial_domain_.node[i].name.in ()); + } + catch (const CORBA::Exception&) + { + ACE_ERROR ((LM_ERROR, "DANCE::TM (%P|%t) DomainDataManager.cpp: " + "Error in get Node Manager from Deployment Config %s\n", + initial_domain_.node[i].name.in ())); + continue; + } + + if (!CORBA::is_nil (node_manager.in ())) + { + try + { + node_manager->leaveDomain (); + } + catch (CORBA::Exception& ex) + { + ACE_ERROR ((LM_ERROR , "TM::Error in calling Leave Domain\n")); + ex._tao_print_exception ( + "Exception caught in ""DomainDataManager::leaveDomain"); + } + } + } + return; + +} + +int CIAO::DomainDataManager::add_to_domain ( + const ::Deployment::Domain& domain) +{ + // here add the domain to the Domain + // right now use only a node + + // got to take care of the fact , that a node can be added , + // while it is still in the domain + + //iterate through the supplied domain + //for each node + // find it in the pristine domain + // and copy it back to the provisioned_domain + + for (CORBA::ULong i = 0;i < domain.node.length ();i++) + { + //find in the pristine domain + ::Deployment::Node a_node; + + if (!this->find_in_initial_domain (domain.node[i].name.in (), + a_node)) + continue; // dont know this node + + //check if already present + if (!this->find_in_provisioned_domain (domain.node[i].name.in (), + a_node)) + { + // add the node to the domain ... + provisioned_data_.node.length (provisioned_data_.node.length () + 1); + provisioned_data_.node[provisioned_data_.node.length () - 1] = + a_node; + } + } + + return 0; +} + +bool CIAO::DomainDataManager:: +find_in_initial_domain (const char* node_name, + ::Deployment::Node& node) +{ + for (CORBA::ULong i =0; + i < this->initial_domain_.node.length (); + i++) + { + if (ACE_OS::strcmp (node_name, this->initial_domain_.node[i].name.in ()) == 0) + { + node = this->initial_domain_.node[i]; + return true; + } + } + + // not found the node , return a node with an empty name + return false; +} + + +bool CIAO::DomainDataManager:: +find_in_provisioned_domain (const char* node_name, + ::Deployment::Node& node) +{ + for (CORBA::ULong i =0; + i < this->provisioned_data_.node.length (); + i++) + { + if (ACE_OS::strcmp (node_name, this->provisioned_data_.node[i].name.in ()) == 0) + { + node = this->provisioned_data_.node[i]; + return true; + } + } + + // not found the node , return a node with an empty name + return false; +} + +int CIAO::DomainDataManager::delete_from_domain ( + const ::Deployment::Domain& domain) +{ + // validate input + if (domain.node.length () == 0) + return 1; + + if (domain.node.length () > + this->provisioned_data_.node.length ()) + return 0; + + //algo : parse through the provisioned_data + // for each node , find in the deleted domain list + // if not found add it to the updated nodes list + + ::Deployment::Nodes updated_nodes; + bool found = false; + + for (CORBA::ULong j = 0; + j < this->provisioned_data_.node.length (); + j++) + { + found = false; + + for (CORBA::ULong i = 0;i < domain.node.length ();i++) + { + if (ACE_OS::strcmp (domain.node[i].name.in (), + this->provisioned_data_.node[j].name.in ()) == 0) + { + found = true; + break; // found the node + } + } + if (found) + continue; + + // not found in the deleted list + + // update the length of the list + updated_nodes.length (updated_nodes.length () + 1); + + // copy the node info + updated_nodes[updated_nodes.length () - 1] = + this->provisioned_data_.node[j]; + + } // for provisioned_data + + // here update the provisioned data + this->provisioned_data_.node = updated_nodes; + + return 1; +} + +int CIAO::DomainDataManager::intimate_planner ( + const ::Deployment::Domain& domain) +{ + // use the connection with the planner and get a reference to the planner + // make a call top the planner + Deployment::Domain d = domain; + return 0; + +} + +bool CIAO::DomainDataManager::update_node_status () +{ + // update the node status here ... + return 0; +} + +void CIAO::DomainDataManager::commitResourceAllocation ( + const ::Deployment::ResourceAllocations & resources) +{ + // commit the resources + // parse into the plan and commit resources ... + + // set the action value + current_action_ = commit; + + this->commit_release_RA (resources); +} + +void CIAO::DomainDataManager::releaseResourceAllocation ( + const ::Deployment::ResourceAllocations & resources) +{ + // set the action value + current_action_ = release; + + this->commit_release_RA (resources); +} + + +int CIAO::DomainDataManager:: +commit_release_RA (const ::Deployment::ResourceAllocations& resources) +{ + // temporary used to guard against exceptions + temp_provisioned_data_ = provisioned_data_; + + + for (CORBA::ULong i = 0;i < resources.length ();i++) + { + try + { + ::Deployment::Resource& res = find_resource (resources[i]); + + match_properties (resources[i].property , res.property); + } + catch (::Deployment::ResourceCommitmentFailure& ex) + { + // catch the exception and add parameters + ACE_ERROR ((LM_ERROR, "Caught the Exception in releaseResourceAllocation\n")); + ex.index = i; + throw ex; + } + } + + // here commit the commitresources + provisioned_data_ = temp_provisioned_data_; + + return 0; +} + +::Deployment::Resource& +CIAO::DomainDataManager::find_resource ( + const ::Deployment::ResourceAllocation& resource) +{ + // for now search the resource in the Node sequence; Later need + // to add it to the Bridges and Interconnects too according to the + // spec + for (CORBA::ULong j = 0;j < this->temp_provisioned_data_.node.length ();j++) + { + if (!ACE_OS::strcmp (resource.elementName.in () , + this->temp_provisioned_data_.node[j].name.in ())) + { + for (CORBA::ULong k =0; + k < this->temp_provisioned_data_.node[j].resource.length (); + k++) + { + if (!ACE_OS::strcmp (this->temp_provisioned_data_.node[j].resource[k].name.in (), + resource.resourceName.in ())) + return this->temp_provisioned_data_.node[j].resource[k];//resource found here, return + } + + // resource not found + throw ::Deployment::ResourceCommitmentFailure ().reason = CORBA::string_dup ("Resource Not Found\n"); + } + } + throw ::Deployment::ResourceCommitmentFailure ().reason = CORBA::string_dup ("Resource Not Found\n"); +} diff --git a/modules/CIAO/DAnCE/TargetManager/DomainDataManager.h b/modules/CIAO/DAnCE/TargetManager/DomainDataManager.h new file mode 100644 index 00000000000..c123de6f90a --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/DomainDataManager.h @@ -0,0 +1,287 @@ +// $Id$ +//=============================================================== +/** + * @file DomainDataManager.h + * + * @brief Maintains the Domain Information + * + * It contains the entire Domain information. Both the + * initial domain as well as the current available domain. + * + * @author Nilabja Roy nilabjar@dre.vanderbilt.edu + */ +//=============================================================== +#ifndef DOMAIN_DATA_MGRH +#define DOMAIN_DATA_MGRH + +#include "TargetManagerImplC.h" +#include "DAnCE/DomainApplicationManager/Node_Locator.h" +//#include "DAnCE/Deployment/Deployment_ResourceCommitmentManagerC.h" + +/** + * @namespace CIAO + * + * @brief The main CIAO namespace + * + */ +namespace CIAO +{ + /** + * @class DomainDataManager + * + * @brief Responsible for maintaining the Domain Information + * + * It maintains both the Current Domain Information as well + * as the Initial domain at full capacity. + */ + class DomainDataManager + { + + public : + /** + * @brief This function is called by the other classes to update + * current domain data. + * @param elements The string sequence of elements + * being updated + * @param domainSubset The subset of the actual Domain to be updated + * @param updateKind Specifies the update type eg. add, delete, update + * + */ + int update_domain (const ::CORBA::StringSeq & elements, + const ::Deployment::Domain & domainSubset, + ::Deployment::DomainUpdateKind updateKind); + /** + * @brief This function is called from the Executor code + * to get the Original Domain data. + * @return Domain* The Initial Domain + * + */ + ::Deployment::Domain* get_initial_domain (); + + /** + * @brief This function is called from the Executor code + * to get the Current Domain data. + * @return Domain* The Current Domain + */ + ::Deployment::Domain* get_current_domain (); + + /** + * This function calls the constructor of the + * class Domain Data Manager + * @brief This function is called to create the Datamanager + * @param orb The orb pointer + * @param target The Target Manager Object Reference + * + */ + static DomainDataManager * create (CORBA::ORB_ptr orb, + ::Deployment::TargetManager_ptr target); + + /** + * @brief Returns the static pointer to the + * data manager. + * @return DomainDataManager* + * The staic get_data_manger function returning + * the data_manager pointer + */ + static DomainDataManager* get_data_manager (); + + /** + * @brief deletes the data manager + */ + static void delete_data_manger (); + + /** + * @brief returns the sequence of node managers + * object reference + */ + ::Deployment::ResourceCommitmentManager_ptr commitResources ( + const ::Deployment::ResourceAllocations & resources); + + /** + * @brief The function releases the resources held by a plan + * @param plan ::Deployment::DeploymentPlan the plan whose + * resources are to be released + */ + void releaseResources ( + const ::Deployment::ResourceCommitmentManager_ptr manager); + + /** + * The node manager in turn stops the monitor + * @brief The function makes a call on the leaveDomain on the + * NodeManager + */ + void stop_monitors (); + + /** + * @brief The function allocates resources specified in the + * parameter + * + * This function is for the ResourceCommitmentManager + * + */ + void commitResourceAllocation ( + const ::Deployment::ResourceAllocations & resources); + + /** + * @brief The function releases resources specified in the + * parameter + * + * This function is for the ResourceCommitmentManager + * + */ + void releaseResourceAllocation ( + const ::Deployment::ResourceAllocations & resources); + + private: + + /** + * The constructor made protected so that no one can create + * it. + * @param orb The orb pointer + * @param target The Target Manager Object Reference + */ + DomainDataManager (CORBA::ORB_ptr orb, + ::Deployment::TargetManager_ptr target); + + /** + * @brief It will read the initial Domain data from + * XML files. + */ + int readin_domain_data (); + + /** + * @brief Match the deployed resources to the + * available resource + */ + void match_requirement_resource ( + ::Deployment::InstanceResourceDeploymentDescriptions deployed, + ::Deployment::Resources& available + ); + + /** + * @brief Match the properties of a Requirement to the + * properties of available resource + * @param deployed The deployed Properties + * @param available The available Properties + */ + void match_properties ( + ::Deployment::Properties deployed, + ::Deployment::SatisfierProperties& available); + + + /// The different actiona that can take place + enum Action {commit , release}; + + /** + * @brief Either commits or releases the given resource + * based on the current Action set. + * @param deployed ::Deployment::Property is the resource + * to be commited/released + * @param available ::Deployment::SatisfierProperty is the + * available resource from which committed/released. + * @exception ::Deployment::ResourceNotAvailable thrown + * when the deployed resources exceeds + * the available resource. + */ + void commit_release_resource ( ::Deployment::Property & deployed, + ::Deployment::SatisfierProperty & available); + + /** + * @brief This function calls all NM and gives them + * the sub-domain + */ + int call_all_node_managers (); + + /** + * @brief This function add new elements to the + * already existing domain + * + * @param domain Deployment::Domain contians the new + * elements + */ + int add_to_domain (const ::Deployment::Domain& domain); + + /** + * @brief This function deletes elements from the domain + * + * @param domain ::Deployment::Domain contains the new elements + * in the domain + */ + int delete_from_domain (const ::Deployment::Domain& domain); + + /** + * @brief This function intimates the planner about a domain + * change + * + * @param domain ::Deployment::Domain contains the new elements + * in the domain + */ + int intimate_planner (const ::Deployment::Domain& domain); + + /** + * @brief This function finds a new node in the initial_domain + * + * @param node The name of the node which is to be searched + */ + + bool find_in_initial_domain (const char* node_name, + ::Deployment::Node& node); + /** + * @brief This function finds a new node in the proviosiond_domain + * + * @param node The name of the node which is to be searched + */ + bool find_in_provisioned_domain (const char* node_name, + ::Deployment::Node& node); + + /** + * @brief updates the node status by reading it from a file + */ + bool update_node_status (); + + /** + * @function find_resource + * @brief It finds the Resource structure which is respresents the + * ResourceAllocation + */ + ::Deployment::Resource& find_resource ( + const ::Deployment::ResourceAllocation& resource); + + int commit_release_RA ( + const ::Deployment::ResourceAllocations& resources); + + /// The ORB pointer + CORBA::ORB_var orb_; + + /// The Deployment Configuration +// CIAO::Deployment_Configuration deployment_config_; + + /// The Initial Domain - contains resources + /// at total capacity + ::Deployment::Domain initial_domain_; + + /// The staic data member , replacing a global variable + static DomainDataManager* global_data_manager_; + /// The Current Domain - contains resources + /// at current capacity + ::Deployment::Domain current_domain_; + + /// The Target Manager Context + ::Deployment::TargetManager_var target_mgr_; + + /** + * The static provisioned Domain data + */ + ::Deployment::Domain provisioned_data_; + + /// temporary domain used in commit/release to + /// guard against exceptions + ::Deployment::Domain temp_provisioned_data_; + + /// The current action + Action current_action_; + }; +} // CIAO + + +#endif /* DOMAIN_DATA_MGRH */ diff --git a/modules/CIAO/DAnCE/TargetManager/DomainEvents.idl b/modules/CIAO/DAnCE/TargetManager/DomainEvents.idl new file mode 100644 index 00000000000..77624dbbd23 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/DomainEvents.idl @@ -0,0 +1,25 @@ +/** + * @file DomainEvents.idl + * @brief Contains Events in the Domain + * + * @author Nilabja R <nilabjar@dre.vanderbilt.edu> + * + * $Id$ + */ + +#ifndef DOMAIN_CHANGE_IDL +#define DOMAIN_CHANGE_IDL + +#include "DAnCE/Deployment/Deployment_TargetManager.idl" +#include "ccm/CCM_Events.idl" + +module CIAO +{ + eventtype Domain_Changed_Event + { + public ::Deployment::Domain changes; + public ::Deployment::DomainUpdateKind change_kind; + }; +}; + +#endif diff --git a/modules/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.cpp b/modules/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.cpp new file mode 100644 index 00000000000..96ffcd7e439 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.cpp @@ -0,0 +1,52 @@ +// $Id$ +// +#include "DomainDataManager.h" +#include "ResourceCommitmentManager.h" + +// Implementation skeleton constructor +CIAO::ResourceCommitmentManager_i::ResourceCommitmentManager_i (void) +{ +} + +// Implementation skeleton destructor +CIAO::ResourceCommitmentManager_i::~ResourceCommitmentManager_i (void) +{ +} + +void CIAO::ResourceCommitmentManager_i::commitResources ( + const ::Deployment::ResourceAllocations& resources) +{ + CIAO::DomainDataManager::get_data_manager ()->commitResourceAllocation (resources); + + // commit succesful .. add to commited resource + this->add_to_commited_resource (resources); + return; +} + +void CIAO::ResourceCommitmentManager_i::releaseResources ( + const ::Deployment::ResourceAllocations & resources) +{ + ::Deployment::ResourceAllocations res; + + // if the resources set is null , use the already allocated resources .. + if (resources.length () == 0) + res = this->resources_; + else + res = resources; + + CIAO::DomainDataManager::get_data_manager ()->releaseResourceAllocation (res); + return; +} + +int CIAO::ResourceCommitmentManager_i::add_to_commited_resource ( + ::Deployment::ResourceAllocations res) +{ + CORBA::ULong const current_length = this->resources_.length (); + + this->resources_.length (current_length + res.length ()); + + for (CORBA::ULong i = 0;i < res.length ();i++) + this->resources_[current_length + i] = res[i]; + + return 0; +} diff --git a/modules/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.h b/modules/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.h new file mode 100644 index 00000000000..99a21a797bc --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.h @@ -0,0 +1,63 @@ +// $Id$ +// +/** + * @file ResourceCommitmentManager.h + * + * @brief This file declares the ResourceCommitmentManager class + * + * This class acts as the servant of the interface + * ResourceCommitmentManager + */ +#ifndef DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_ +#define DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_ + +#include "DAnCE/Deployment/Deployment_ResourceCommitmentManagerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO { + + class ResourceCommitmentManager_i + : public virtual POA_Deployment::ResourceCommitmentManager + { + public: + // Constructor + ResourceCommitmentManager_i (void); + + // Destructor + virtual ~ResourceCommitmentManager_i (void); + + /** + * @function commitResources + * @brief Commits the resources + * + * @description This function makes a call to the DomainDataManager in order + * to commit the resources mentioned in the ResourceAllocation + * sequence. If the resource cannot be allocated throws a + * ResourceCommitmentFailed exception + */ + virtual + void commitResources ( + const ::Deployment::ResourceAllocations& resources); + + virtual + void releaseResources ( + const ::Deployment::ResourceAllocations & resources); + + private: + /** + * @function add_to_commited_resource + * @brief This function adds the res to already commited resources. + * This is to be called from within commitResources + */ + int add_to_commited_resource (::Deployment::ResourceAllocations res); + + /// The commited resource + ::Deployment::ResourceAllocations resources_; + }; + +} + +#endif /* DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_ */ diff --git a/modules/CIAO/DAnCE/TargetManager/TM_Client.mpc b/modules/CIAO/DAnCE/TargetManager/TM_Client.mpc new file mode 100644 index 00000000000..09172b4fc12 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TM_Client.mpc @@ -0,0 +1,21 @@ +// $Id$ + +// Client.mpc,v 1.6 2005/02/18 09:07:06 jwillemsen Exp + +project(TMClient): ccm_stub, dance_deployment_stub, ciao_targetmanager_stub, ciao_config_handlers, avoids_ace_for_tao { + IDL_Files { + } + + Source_Files { + CmpClient.cpp + } + + Header_Files { + } + + Inline_Files { + } + + Template_Files { + } +} diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManager.cidl b/modules/CIAO/DAnCE/TargetManager/TargetManager.cidl new file mode 100644 index 00000000000..6e880c069e9 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManager.cidl @@ -0,0 +1,27 @@ +// $Id$ + +/* + * @file TargetManager.cidl + * @brief The file contains the TargetManager component + * defination + */ + +#ifndef TARGETMANAGER_CIDL +#define TARGETMANAGER_CIDL + +#include "TargetManagerImpl.idl" + +/* + * @composition TargetManager_i + */ + +composition session TargetManager_i +{ + home executor TargetManagerHome_Exec + { + implements CIAO::TargetManagerHome; + manages TargetManagerImpl_Exec; + }; +}; + +#endif diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManager.mpc b/modules/CIAO/DAnCE/TargetManager/TargetManager.mpc new file mode 100644 index 00000000000..73d4406bbb4 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManager.mpc @@ -0,0 +1,84 @@ +// $Id$ + +project(CIAO_TargetManager_cidl_gen) : ciaocidldefaults, avoids_ace_for_tao { + custom_only = 1 + cidlflags += --svnt-export-macro TARGETMANAGER_SVNT_Export \ + --svnt-export-include TargetManager_svnt_export.h + + CIDL_Files { + TargetManager.cidl + } +} + +project(CIAO_TargetManager_idl_gen) : ciaoidldefaults, avoids_ace_for_tao { + custom_only = 1 + after += CIAO_TargetManager_cidl_gen + idlflags += -Wb,export_macro=TARGETMANAGER_EXEC_Export \ + -Wb,export_include=TargetManager_exec_export.h -SS + + IDL_Files { + TargetManagerE.idl + } +} + +project(CIAO_TargetManager_stub) : ciao_output, ccm_stub, dance_deployment_stub, dance_nodemanager_stub, avoids_ace_for_tao { + sharedname = CIAO_TargetManager_stub + dynamicflags = TARGETMANAGER_STUB_BUILD_DLL + idlflags += -Wb,stub_export_macro=TARGETMANAGER_STUB_Export \ + -Wb,stub_export_include=TargetManager_stub_export.h \ + -Wb,skel_export_macro=TARGETMANAGER_SVNT_Export \ + -Wb,skel_export_include=TargetManager_svnt_export.h + + IDL_Files { + TargetManagerImpl.idl + TargetManagerExt.idl + DomainEvents.idl + } + + Source_Files { + TargetManagerImplC.cpp + TargetManagerExtC.cpp + DomainEventsC.cpp + } +} + +project(CIAO_TargetManager_exec) : ciao_output, ciao_executor, dance_domain_application_manager, ciao_config_handlers, avoids_ace_for_tao { + sharedname = CIAO_TargetManager_exec + libs += CIAO_TargetManager_stub + after += CIAO_TargetManager_stub CIAO_TargetManager_idl_gen + dynamicflags = TARGETMANAGER_EXEC_BUILD_DLL + + Source_Files { + TargetManagerEC.cpp + DomainDataManager.cpp + TargetManager_exec.cpp + ResourceCommitmentManager.cpp + } + + IDL_Files { + } +} + +project(CIAO_TargetManager_svnt) : ciao_output, ccm_svnt, ciao_servant, messaging, dance_deployment_svnt, ciao_config_handlers, avoids_ace_for_tao, dance_node_manager { + sharedname = CIAO_TargetManager_svnt + + libs += CIAO_TargetManager_stub CIAO_TargetManager_exec + after += CIAO_TargetManager_stub CIAO_TargetManager_exec + + dynamicflags = TARGETMANAGER_SVNT_BUILD_DLL + + CIDL_Files { + } + + IDL_Files { + } + + Source_Files { + TargetManager_svnt.cpp + TargetManagerImplS.cpp + TargetManagerExtS.cpp + DomainEventsS.cpp + } +} + + diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManagerExt.idl b/modules/CIAO/DAnCE/TargetManager/TargetManagerExt.idl new file mode 100644 index 00000000000..934314b4613 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManagerExt.idl @@ -0,0 +1,84 @@ +// $Id$ + +/** + * @file TargetManagerExt.idl + * + * @brief The Extensions to the TM interface for ARMS demo + * + * @author Nilabja R <nilabjar@dre.vanderbilt.edu> + * @author Nishanth Shankaran <nshankar@dre.vanderbilt.edu> + * + * This file declares a interface which will be implemented as + * a facet by the TargetManager component + */ + +#include "DAnCE/Interfaces/NodeManagerDaemon.idl" + +module CIAO +{ + /** + * @struct Cpu_Info + * @brief Consists of individual host-cpu info + */ + struct Host_Info + { + string hostname; + double cpu_util; + }; + + /// The sequence of CPU infos + typedef sequence<Host_Info> Host_Infos; + + /** + * @struct Component_Cpu_Util + * @brief Contains a component CPU Util + */ + struct Component_Info + { + string component_name; + double cpu_util; + }; + + /// The sequence of component cpu utilization + typedef sequence <Component_Info> Component_Infos; + + + /** + * @struct Host_NodeManager + * @brief Contains the node manager to host reference + */ + struct Host_NodeManager + { + /// host name + string host_; + + /// the node manager IOR + ::Deployment::NodeManager node_mgr_; + }; + + /// Sequence of NodeManager. + typedef sequence <Host_NodeManager> Host_NodeManager_seq; + + /** + * @interface TargetManagerExt + * @brief The Target Manager Extension + * + * Contains the interface used by the RACE + * controller. + */ + interface TargetManagerExt + { + /// Returns the pid in which a component runs + long get_pid (in string component_uuid); + + /// Returns the cpu usage for each host in the + /// last cycle + Host_Infos get_host_cpu (); + + /// Return the detail of the components + Component_Infos get_component_cpu (); + + /// Returns the OR of the Node managers + Host_NodeManager_seq get_all_node_managers (); + }; +}; diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManagerImpl.idl b/modules/CIAO/DAnCE/TargetManager/TargetManagerImpl.idl new file mode 100644 index 00000000000..7dc48e6d494 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManagerImpl.idl @@ -0,0 +1,32 @@ +// $Id$ + +/** + * @file TargetManagerImpl.idl + * @brief TargetManager interface defintion + * + * @author Nilabja R <nilabjar@dre.vanderbilt.edu> + */ + +#ifndef TARGETMGR_IDL +#define TARGETMGR_IDL + +#include "ccm/Components.idl" +#include "DAnCE/Deployment/Deployment_PlanError.idl" +#include "DAnCE/TargetManager/TargetManagerExt.idl" +#include "DAnCE/TargetManager/DomainEvents.idl" + +module CIAO +{ + component TargetManagerImpl + { + provides ::Deployment::TargetManager targetMgr; + + publishes Domain_Changed_Event changes; + }; + + home TargetManagerHome manages TargetManagerImpl + { + }; +}; + +#endif diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManager_exec.cpp b/modules/CIAO/DAnCE/TargetManager/TargetManager_exec.cpp new file mode 100644 index 00000000000..96686ef6b1a --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManager_exec.cpp @@ -0,0 +1,257 @@ +// $Id$ +#include "TargetManager_exec.h" +//#include "ciao/CIAO_common.h" +#include "tools/Config_Handlers/DD_Handler.h" +#include "tools/Config_Handlers/DnC_Dump.h" + +#include "DomainEventsC.h" + +#include "ResourceCommitmentManager.h" + +namespace CIDL_TargetManager_i +{ + //================================================================== + // Facet Executor Implementation Class: TargetManager_exec_i + //================================================================== + + TargetManager_exec_i:: + TargetManager_exec_i (TargetManagerImpl_exec_i* exec , + CORBA::ORB_ptr orb) + : exec_ (exec), + orb_ (::CORBA::ORB::_duplicate (orb)) + { + // The DomainDataManager created here ... + + // get its own obj ref , then call + ::Deployment::TargetManager_var target = this->exec_->get_targetMgr (); + + // Create Domain Data here + + CIAO::DomainDataManager::create (orb_.in (), target.in ()); + } + + TargetManager_exec_i::~TargetManager_exec_i (void) + { + } + + // Operations from ::Deployment::TargetManager + + ::Deployment::Domain * + TargetManager_exec_i::getAllResources () + { + return CIAO::DomainDataManager:: + get_data_manager ()->get_initial_domain (); + } + + ::Deployment::Domain * + TargetManager_exec_i::getAvailableResources () + { + return CIAO::DomainDataManager:: + get_data_manager ()->get_current_domain (); + } + + ::Deployment::ResourceCommitmentManager_ptr + TargetManager_exec_i::commitResources ( + const ::Deployment::ResourceAllocations & resources) + { + return CIAO::DomainDataManager:: + get_data_manager ()->commitResources (resources); + } + + void + TargetManager_exec_i::releaseResources ( + ::Deployment::ResourceCommitmentManager_ptr manager) + { + return CIAO::DomainDataManager:: + get_data_manager ()->releaseResources (manager); + } + + void + TargetManager_exec_i::updateDomain ( + const ::CORBA::StringSeq & elements , + const ::Deployment::Domain & domainSubset , + ::Deployment::DomainUpdateKind updateKind) + { + // Your code here. + CIAO::DomainDataManager:: + get_data_manager ()->update_domain ( + elements, + domainSubset, + updateKind); + + // here tell the planner about the changes + + // first get the node names which have failed ... + // assuming nodes to only fail , for now + + if (updateKind == ::Deployment::Delete || + updateKind == ::Deployment::Add) + { + CIAO::Domain_Changed_Event_var changed_event = + new OBV_CIAO::Domain_Changed_Event (); + + ::Deployment::Domain_var temp_domain = + new ::Deployment::Domain (domainSubset); + + changed_event->changes (temp_domain); + changed_event->change_kind (updateKind); + this->exec_->context_->push_changes (changed_event); + } + + } + + ::Deployment::ResourceCommitmentManager_ptr + TargetManager_exec_i::createResourceCommitment ( + const ::Deployment::ResourceAllocations& manager) + { + + CIAO::ResourceCommitmentManager_i *commit_servant = + new CIAO::ResourceCommitmentManager_i (); + + // Standard owner transfer mechanisms. + // + PortableServer::ServantBase_var safe_daemon (commit_servant); + + commit_servant->commitResources (manager); + + Deployment::ResourceCommitmentManager_var mgrv = + commit_servant->_this (); + + return mgrv._retn (); + } + + void + TargetManager_exec_i::destroyResourceCommitment ( + ::Deployment::ResourceCommitmentManager_ptr manager) + { + ::Deployment::ResourceAllocations res; + res.length (0); + manager->releaseResources (res); + return; + } + //================================================================== + // Component Executor Implementation Class: TargetManagerImpl_exec_i + //================================================================== + + TargetManagerImpl_exec_i::TargetManagerImpl_exec_i (void) + : exec_object_ (0) + { + } + + TargetManagerImpl_exec_i::~TargetManagerImpl_exec_i (void) + { + } + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + ::Deployment::CCM_TargetManager_ptr + TargetManagerImpl_exec_i::get_targetMgr () + { + // Your code here. + + if (CORBA::is_nil (this->exec_object_.in ())) + { + this->exec_object_ = new TargetManager_exec_i(this, + context_->_get_orb()); + } + + return ::Deployment::CCM_TargetManager::_duplicate (this->exec_object_.in ()); + } + + // Operations from Components::SessionComponent + + void + TargetManagerImpl_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = ::CIAO::CCM_TargetManagerImpl_Context::_narrow (ctx); + if (CORBA::is_nil (this->context_.in ())) + { + throw CORBA::INTERNAL (); + } + } + + void + TargetManagerImpl_exec_i::configuration_complete () + { + // Your code here. + } + + void + TargetManagerImpl_exec_i::ccm_activate () + { + // Your code here. + this->get_targetMgr (); + } + + void + TargetManagerImpl_exec_i::ccm_passivate () + { + // Your code here. + } + + void + TargetManagerImpl_exec_i::ccm_remove () + { + // Your code here. + + //CIAO::DomainDataManager::get_data_manager ()->stop_monitors (); + + return; + } + + + //================================================================== + // Home Executor Implementation Class: TargetManagerHome_exec_i + //================================================================== + + TargetManagerHome_exec_i::TargetManagerHome_exec_i (void) + { + } + + TargetManagerHome_exec_i::~TargetManagerHome_exec_i (void) + { + } + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + ::Components::EnterpriseComponent_ptr + TargetManagerHome_exec_i::create () + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_THROW_EX ( + retval, + TargetManagerImpl_exec_i, + CORBA::NO_MEMORY ()); + + return retval; + } + + extern "C" TARGETMANAGER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_CIAO_TargetManagerHome_Impl (void) + { + ::Components::HomeExecutorBase_ptr retval = + ::Components::HomeExecutorBase::_nil (); + + ACE_NEW_RETURN ( + retval, + TargetManagerHome_exec_i, + ::Components::HomeExecutorBase::_nil ()); + + return retval; + } +} diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManager_exec.h b/modules/CIAO/DAnCE/TargetManager/TargetManager_exec.h new file mode 100644 index 00000000000..b05b0434a2e --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManager_exec.h @@ -0,0 +1,143 @@ +// $Id$ +//=============================================================== +/** + * @file TargetManager_exec.h + * + * @brief TargetManager Executor code + * + * @author Nilabja Roy nilabjar@dre.vanderbilt.edu + */ +//=============================================================== + +#ifndef CIAO_TARGETMANAGER_EXEC_H +#define CIAO_TARGETMANAGER_EXEC_H + +#include /**/ "ace/pre.h" + +#include "TargetManager_svnt.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "TargetManager_exec_export.h" +#include "tao/LocalObject.h" +#include "DomainDataManager.h" +#include "TargetManagerEC.h" + +/** + * TargetManager Executor namespace + */ +namespace CIDL_TargetManager_i +{ + class TARGETMANAGER_EXEC_Export TargetManagerImpl_exec_i + : public virtual TargetManagerImpl_Exec, + public virtual ::CORBA::LocalObject + { + public: + TargetManagerImpl_exec_i (void); + virtual ~TargetManagerImpl_exec_i (void); + + // Supported or inherited operations. + + // Attribute operations. + + // Port operations. + + virtual ::Deployment::CCM_TargetManager_ptr + get_targetMgr (); + + // 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 (); + + virtual void configuration_complete (); + + public: + /// The service context pointer + ::CIAO::CCM_TargetManagerImpl_Context_var context_; + + /// The exec Object + ::Deployment::CCM_TargetManager_var exec_object_; + }; + + class TARGETMANAGER_EXEC_Export TargetManager_exec_i + : public virtual ::Deployment::CCM_TargetManager, + public virtual ::CORBA::LocalObject + { + public: + TargetManager_exec_i (TargetManagerImpl_exec_i* exec, + CORBA::ORB_ptr orb); + virtual ~TargetManager_exec_i (void); + + // Operations from ::Deployment::TargetManager + + virtual ::Deployment::Domain * getAllResources (); + + virtual ::Deployment::Domain * getAvailableResources (); + + virtual ::Deployment::ResourceCommitmentManager_ptr + commitResources (const ::Deployment::ResourceAllocations & resources); + + virtual void releaseResources (::Deployment::ResourceCommitmentManager_ptr manager); + + virtual void + updateDomain ( + const ::CORBA::StringSeq & elements, + const ::Deployment::Domain & domainSubset, + ::Deployment::DomainUpdateKind updateKind); + + virtual ::Deployment::ResourceCommitmentManager_ptr + createResourceCommitment (const ::Deployment::ResourceAllocations& manager); + + virtual void + destroyResourceCommitment ( + ::Deployment::ResourceCommitmentManager_ptr resources); + + private: + TargetManagerImpl_exec_i * exec_; + + /// The pointer to the Domain Manager + auto_ptr<CIAO::DomainDataManager> dataManager_; + + /// The CORBA ORB ... + CORBA::ORB_var orb_; + }; + + class TARGETMANAGER_EXEC_Export TargetManagerHome_exec_i + : public virtual TargetManagerHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + TargetManagerHome_exec_i (void); + virtual ~TargetManagerHome_exec_i (void); + + // Supported or inherited operations. + + // Home operations. + + // Factory and finder operations. + + // Attribute operations. + + // Implicit operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + + extern "C" TARGETMANAGER_EXEC_Export ::Components::HomeExecutorBase_ptr + create_CIAO_TargetManagerHome_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_TARGETMANAGER_EXEC_H */ diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManager_exec_export.h b/modules/CIAO/DAnCE/TargetManager/TargetManager_exec_export.h new file mode 100644 index 00000000000..604a07b9afa --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManager_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TARGETMANAGER_EXEC +// ------------------------------ +#ifndef TARGETMANAGER_EXEC_EXPORT_H +#define TARGETMANAGER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (TARGETMANAGER_EXEC_HAS_DLL) +# define TARGETMANAGER_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && TARGETMANAGER_EXEC_HAS_DLL */ + +#if !defined (TARGETMANAGER_EXEC_HAS_DLL) +# define TARGETMANAGER_EXEC_HAS_DLL 1 +#endif /* ! TARGETMANAGER_EXEC_HAS_DLL */ + +#if defined (TARGETMANAGER_EXEC_HAS_DLL) && (TARGETMANAGER_EXEC_HAS_DLL == 1) +# if defined (TARGETMANAGER_EXEC_BUILD_DLL) +# define TARGETMANAGER_EXEC_Export ACE_Proper_Export_Flag +# define TARGETMANAGER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TARGETMANAGER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TARGETMANAGER_EXEC_BUILD_DLL */ +# define TARGETMANAGER_EXEC_Export ACE_Proper_Import_Flag +# define TARGETMANAGER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TARGETMANAGER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TARGETMANAGER_EXEC_BUILD_DLL */ +#else /* TARGETMANAGER_EXEC_HAS_DLL == 1 */ +# define TARGETMANAGER_EXEC_Export +# define TARGETMANAGER_EXEC_SINGLETON_DECLARATION(T) +# define TARGETMANAGER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TARGETMANAGER_EXEC_HAS_DLL == 1 */ + +// Set TARGETMANAGER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TARGETMANAGER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define TARGETMANAGER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TARGETMANAGER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TARGETMANAGER_EXEC_NTRACE */ + +#if (TARGETMANAGER_EXEC_NTRACE == 1) +# define TARGETMANAGER_EXEC_TRACE(X) +#else /* (TARGETMANAGER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define TARGETMANAGER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (TARGETMANAGER_EXEC_NTRACE == 1) */ + +#endif /* TARGETMANAGER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManager_stub_export.h b/modules/CIAO/DAnCE/TargetManager/TargetManager_stub_export.h new file mode 100644 index 00000000000..9c20b4b1c98 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManager_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TARGETMANAGER_STUB +// ------------------------------ +#ifndef TARGETMANAGER_STUB_EXPORT_H +#define TARGETMANAGER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (TARGETMANAGER_STUB_HAS_DLL) +# define TARGETMANAGER_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && TARGETMANAGER_STUB_HAS_DLL */ + +#if !defined (TARGETMANAGER_STUB_HAS_DLL) +# define TARGETMANAGER_STUB_HAS_DLL 1 +#endif /* ! TARGETMANAGER_STUB_HAS_DLL */ + +#if defined (TARGETMANAGER_STUB_HAS_DLL) && (TARGETMANAGER_STUB_HAS_DLL == 1) +# if defined (TARGETMANAGER_STUB_BUILD_DLL) +# define TARGETMANAGER_STUB_Export ACE_Proper_Export_Flag +# define TARGETMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TARGETMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TARGETMANAGER_STUB_BUILD_DLL */ +# define TARGETMANAGER_STUB_Export ACE_Proper_Import_Flag +# define TARGETMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TARGETMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TARGETMANAGER_STUB_BUILD_DLL */ +#else /* TARGETMANAGER_STUB_HAS_DLL == 1 */ +# define TARGETMANAGER_STUB_Export +# define TARGETMANAGER_STUB_SINGLETON_DECLARATION(T) +# define TARGETMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TARGETMANAGER_STUB_HAS_DLL == 1 */ + +// Set TARGETMANAGER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TARGETMANAGER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define TARGETMANAGER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TARGETMANAGER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TARGETMANAGER_STUB_NTRACE */ + +#if (TARGETMANAGER_STUB_NTRACE == 1) +# define TARGETMANAGER_STUB_TRACE(X) +#else /* (TARGETMANAGER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define TARGETMANAGER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (TARGETMANAGER_STUB_NTRACE == 1) */ + +#endif /* TARGETMANAGER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/TargetManager/TargetManager_svnt_export.h b/modules/CIAO/DAnCE/TargetManager/TargetManager_svnt_export.h new file mode 100644 index 00000000000..f921ef96b5b --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/TargetManager_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TARGETMANAGER_SVNT +// ------------------------------ +#ifndef TARGETMANAGER_SVNT_EXPORT_H +#define TARGETMANAGER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (TARGETMANAGER_SVNT_HAS_DLL) +# define TARGETMANAGER_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && TARGETMANAGER_SVNT_HAS_DLL */ + +#if !defined (TARGETMANAGER_SVNT_HAS_DLL) +# define TARGETMANAGER_SVNT_HAS_DLL 1 +#endif /* ! TARGETMANAGER_SVNT_HAS_DLL */ + +#if defined (TARGETMANAGER_SVNT_HAS_DLL) && (TARGETMANAGER_SVNT_HAS_DLL == 1) +# if defined (TARGETMANAGER_SVNT_BUILD_DLL) +# define TARGETMANAGER_SVNT_Export ACE_Proper_Export_Flag +# define TARGETMANAGER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TARGETMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TARGETMANAGER_SVNT_BUILD_DLL */ +# define TARGETMANAGER_SVNT_Export ACE_Proper_Import_Flag +# define TARGETMANAGER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TARGETMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TARGETMANAGER_SVNT_BUILD_DLL */ +#else /* TARGETMANAGER_SVNT_HAS_DLL == 1 */ +# define TARGETMANAGER_SVNT_Export +# define TARGETMANAGER_SVNT_SINGLETON_DECLARATION(T) +# define TARGETMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TARGETMANAGER_SVNT_HAS_DLL == 1 */ + +// Set TARGETMANAGER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TARGETMANAGER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define TARGETMANAGER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TARGETMANAGER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TARGETMANAGER_SVNT_NTRACE */ + +#if (TARGETMANAGER_SVNT_NTRACE == 1) +# define TARGETMANAGER_SVNT_TRACE(X) +#else /* (TARGETMANAGER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define TARGETMANAGER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (TARGETMANAGER_SVNT_NTRACE == 1) */ + +#endif /* TARGETMANAGER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/TargetManager/descriptors/Domain.cdd b/modules/CIAO/DAnCE/TargetManager/descriptors/Domain.cdd new file mode 100644 index 00000000000..fe21a4b48f5 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/descriptors/Domain.cdd @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Deployment:domain + 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"> + +<UUID>effd4bd0-6db0-4c50-9bb7-db9decebae1c</UUID> +<label>Hello Domain</label> + + +<node> + <name>TargetManagerNode_1</name> + <label>Sender's Node</label> + <resource> + <name>Processor</name> + <resourceType>CPULoad</resourceType> + <property> + <name>LoadAverage</name> + <kind>Quantity</kind> + <dynamic>true</dynamic> + <value> + <type> + <kind>tk_long</kind> + </type> + <value><long>99</long></value> + </value> + </property> + </resource> +</node> +<node> + <name>TargetManagerNode_2</name> + <label>Receiver's Node</label> + <resource> + <name>Processor</name> + <resourceType>CPULoad</resourceType> + <property> + <name>LoadAverage</name> + <kind>Quantity</kind> + <dynamic>true</dynamic> + <value> + <type> + <kind>tk_long</kind> + </type> + <value><long>99</long></value> + </value> + </property> + </resource> +</node> + + +<interconnect> + <name>NoBridgeInterConnect</name> + <connect> + <name>Receiver</name> + <resource> + <name>Processor</name> + <resourceType>CPULoad</resourceType> + <property> + <name>LoadAverage</name> + <kind>Quantity</kind> + <dynamic>true</dynamic> + <value> + <type> + <kind>tk_long</kind> + </type> + <value><long>99</long></value> + </value> + </property> + </resource> + </connect> +</interconnect> + + +<bridge> + <name>NoBridge</name> + <connect> + <name>NoBridgeInterConnect</name> + <connect> + <name>Receiver</name> + <resource> + <name>Processor</name> + <resourceType>CPULoad</resourceType> + <property> + <name>LoadAverage</name> + <kind>Quantity</kind> + <dynamic>true</dynamic> + <value> + <type> + <kind>tk_long</kind> + </type> + <value><long>99</long></value> + </value> + </property> + </resource> + </connect> + </connect> +</bridge> + + +</Deployment:domain> diff --git a/modules/CIAO/DAnCE/TargetManager/descriptors/NodeDetails.dat b/modules/CIAO/DAnCE/TargetManager/descriptors/NodeDetails.dat new file mode 100644 index 00000000000..d72d68435ab --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/descriptors/NodeDetails.dat @@ -0,0 +1,2 @@ +TargetManagerNode_1 corbaloc:iiop:localhost:40000/NodeManager +TargetManagerNode_2 corbaloc:iiop:localhost:30000/NodeManager
\ No newline at end of file diff --git a/modules/CIAO/DAnCE/TargetManager/descriptors/NodeManagerMap.dat b/modules/CIAO/DAnCE/TargetManager/descriptors/NodeManagerMap.dat new file mode 100644 index 00000000000..d72d68435ab --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/descriptors/NodeManagerMap.dat @@ -0,0 +1,2 @@ +TargetManagerNode_1 corbaloc:iiop:localhost:40000/NodeManager +TargetManagerNode_2 corbaloc:iiop:localhost:30000/NodeManager
\ No newline at end of file diff --git a/modules/CIAO/DAnCE/TargetManager/descriptors/flattened_deploymentplan.cdp b/modules/CIAO/DAnCE/TargetManager/descriptors/flattened_deploymentplan.cdp new file mode 100644 index 00000000000..fae71c39fa1 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/descriptors/flattened_deploymentplan.cdp @@ -0,0 +1,92 @@ +<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 Modified_Deployment.xsd"> + + <label>Hello-DeploymentPlan</label> + <!-- Could be ZERO --> + <realizes> + <label>BasicSP-realizes-cid</label> + <UUID>c0965470-7b83-11d9-9669-0800200c9a66</UUID> + <specificType><!-- @@ What does here? --></specificType> + <supportedType>IDL:BasicSP/EC:1.0</supportedType> + <port> + <name>read_message</name> + <specificType>IDL:Hello/ReadMessage:1.0</specificType> + <supportedType>IDL:Hello/ReadMessage:1.0</supportedType> + <provider>false></provider> + <exclusiveProvider>false</exclusiveProvider> + <exclusiveUser>true</exclusiveUser> + <optional>false</optional> + <kind>SimplexReceptacle</kind> + </port> + </realizes> + + <implementation id="TargetManager-mdd"> + <name>TargetManager-mdd</name> + <source><!-- @@ Don't know what goes here --></source> + <artifact>TargetManager_exec</artifact> + <artifact>TargetManager_svnt</artifact> + <!-- + <execParameter></execParameter> + <deployRequirement></deployRequirement> + --> + </implementation> + + <instance id="TargetManager-idd"> + <name>TargetManager-idd</name> + <node>TargetManagerNode_1</node> + <source><!-- @@ What goes here --></source> + <implementation>TargetManager-mdd</implementation> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TargetManager.ior</string> + </value> + </value> + </configProperty> + </instance> + + <!-- @@ Runtime library name must match exactly in "location" tag --> + + <artifact id="TargetManager_exec"> + <name>TargetManager_exec</name> + <source><!-- @@ Not sure about this--></source> + <node><!-- blank --></node> + <location>TargetManager_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CIAO_TargetManagerHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="TargetManager_svnt"> + <name>TargetManager_svnt</name> + <source><!-- @@ Not sure --></source> + <node><!-- blank --></node> + <location>TargetManager_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CIAO_TargetManagerHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> +</Deployment:deploymentPlan> diff --git a/modules/CIAO/DAnCE/TargetManager/descriptors/run_test_TargetManager.pl b/modules/CIAO/DAnCE/TargetManager/descriptors/run_test_TargetManager.pl new file mode 100755 index 00000000000..4ea42376b98 --- /dev/null +++ b/modules/CIAO/DAnCE/TargetManager/descriptors/run_test_TargetManager.pl @@ -0,0 +1,160 @@ +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'}"; +$DAnCE = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$daemons = 2; +@ports = ( 40000, 30000 ); +@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" ); +$status = 0; +$dat_file = "NodeDetails.dat"; +$cdp_file = "flattened_DeploymentPlan.cdp"; + +$E = 0; +$EM = 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 ("TargetManager.ior"); + unlink PerlACE::LocalFile ("DAM.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); + } +} + +sub run_node_daemons { + for ($i = 0; $i < $daemons; ++$i) + { + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/NodeApplication"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -o $iorfile"; + + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR + "ERROR: The ior file of node daemon $i could not be found\n"; + for (; $i > 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + $daemons_running = 1; + return 0; +} + +delete_ior_files (); + +# 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"; + exit 1; +} + +$ns_running = 1; + +# Invoke execution manager. +print "Invoking execution manager\n"; +$EM = new PerlACE::Process ("$CIAO_ROOT/bin/Execution_Manager", + "-o EM.ior -i $dat_file"); +$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 ("$CIAO_ROOT/bin/plan_launcher", + "-p flattened_deploymentplan.cdp -k file://EM.ior -o DAM.ior"); + +$E->SpawnWaitKill (5000); + +if (PerlACE::waitforfile_timed ( + "TargetManager.ior", + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file of receiver could not be found\n"; + kill_open_processes (); + exit 1; +} + +print "Waiting for 15 secs then invoking client ===\n"; +sleep (15); + +print "Making 5 such calls \n"; + +$call_num = 5; + +for ($i = 0; $i < $call_num; ++$i) +{ + print "Invoking the client\n"; + $tmclient = new PerlACE::Process ("../CmpClient", "-t file://TargetManager.ior"); + $result = $tmclient->SpawnWaitKill (3000); + + if ($result != 0) { + print STDERR "ERROR: The client returned $result\n"; + $status = 1; + } + sleep (15); +} + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +$E = + new PerlACE::Process ("$CIAO_ROOT/bin/plan_launcher", + "-k file://EM.ior -i file://DAM.ior"); +$E->SpawnWaitKill (3000); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; diff --git a/modules/CIAO/DAnCE/Utils/DAnCE_Utils.mpc b/modules/CIAO/DAnCE/Utils/DAnCE_Utils.mpc new file mode 100644 index 00000000000..cf8d3db5c49 --- /dev/null +++ b/modules/CIAO/DAnCE/Utils/DAnCE_Utils.mpc @@ -0,0 +1,16 @@ +// -*- MPC -*- +// $Id$ + +project (DAnCE_Utils): dance_lib, dance_deployment_svnt, naming { + sharedname = DAnCE_Utils + dynamicflags = DANCE_UTILS_BUILD_DLL + + Source_Files { + Plan_Handler.cpp + } + + Header_Files { + Plan_Handler.h + } +} + diff --git a/modules/CIAO/DAnCE/Utils/DAnCE_Utils_Export.h b/modules/CIAO/DAnCE/Utils/DAnCE_Utils_Export.h new file mode 100644 index 00000000000..636453478e8 --- /dev/null +++ b/modules/CIAO/DAnCE/Utils/DAnCE_Utils_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s DAnCE_Utils +// ------------------------------ +#ifndef DANCE_UTILS_EXPORT_H +#define DANCE_UTILS_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_UTILS_HAS_DLL) +# define DANCE_UTILS_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && DANCE_UTILS_HAS_DLL */ + +#if !defined (DANCE_UTILS_HAS_DLL) +# define DANCE_UTILS_HAS_DLL 1 +#endif /* ! DANCE_UTILS_HAS_DLL */ + +#if defined (DANCE_UTILS_HAS_DLL) && (DANCE_UTILS_HAS_DLL == 1) +# if defined (DANCE_UTILS_BUILD_DLL) +# define DAnCE_Utils_Export ACE_Proper_Export_Flag +# define DANCE_UTILS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define DANCE_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* DANCE_UTILS_BUILD_DLL */ +# define DAnCE_Utils_Export ACE_Proper_Import_Flag +# define DANCE_UTILS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define DANCE_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* DANCE_UTILS_BUILD_DLL */ +#else /* DANCE_UTILS_HAS_DLL == 1 */ +# define DAnCE_Utils_Export +# define DANCE_UTILS_SINGLETON_DECLARATION(T) +# define DANCE_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* DANCE_UTILS_HAS_DLL == 1 */ + +// Set DANCE_UTILS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (DANCE_UTILS_NTRACE) +# if (ACE_NTRACE == 1) +# define DANCE_UTILS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define DANCE_UTILS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !DANCE_UTILS_NTRACE */ + +#if (DANCE_UTILS_NTRACE == 1) +# define DANCE_UTILS_TRACE(X) +#else /* (DANCE_UTILS_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define DANCE_UTILS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (DANCE_UTILS_NTRACE == 1) */ + +#endif /* DANCE_UTILS_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/DAnCE/Utils/Plan_Handler.cpp b/modules/CIAO/DAnCE/Utils/Plan_Handler.cpp new file mode 100644 index 00000000000..f464bf5058f --- /dev/null +++ b/modules/CIAO/DAnCE/Utils/Plan_Handler.cpp @@ -0,0 +1,349 @@ +// $Id$ + +#include "Plan_Handler.h" +#include "DAnCE/Logger/Log_Macros.h" + +namespace DAnCE +{ + void + DAnCE_Utils::add_instance ( + ::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_plan.instance; + + instance.length (instance.length()+1); + + instance[instance.length()-1].name = CORBA::string_dup(instance_name); // Name of the instance + instance[instance.length()-1].node = CORBA::string_dup(node_name); + instance[instance.length()-1].source.length(0); + + // Looking for implementation block with name equals to type ... + ::Deployment::MonolithicDeploymentDescriptions implementation = + deployment_plan.implementation; + + CORBA::ULong i = 0; + for (i = 0; i < implementation.length(); ++i) + if (ACE_OS::strcmp (implementation[i].name.in(), impl_name) == 0) + break; + + if (i < implementation.length()) + instance[instance.length()-1].implementationRef = i; + else + throw ImplementationNotFound(); + + if (ns_name != 0) + { + instance[instance.length()-1].configProperty.length(1); + instance[instance.length()-1].configProperty[0].name = CORBA::string_dup ("RegisterNaming"); + instance[instance.length()-1].configProperty[0].value <<= CORBA::string_dup (ns_name); + } + + // Re-assigning instances to deployment plan ... + deployment_plan.instance = instance; + } + + /* + 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) + { + // Modifying the deployment plan in order to include the new connection ... + + ::Deployment::PlanConnectionDescriptions connection = deployment_plan->connection; + connection.length(connection.length()+1); + + connection[connection.length()-1].name = CORBA::string_dup(connection_name); + connection[connection.length()-1].source.length(0); + connection[connection.length()-1].deployRequirement.length(0); + connection[connection.length()-1].externalEndpoint.length(0); + connection[connection.length()-1].internalEndpoint.length(2); + connection[connection.length()-1].internalEndpoint[0].portName = CORBA::string_dup(port_name); + connection[connection.length()-1].internalEndpoint[0].provider = 0L; + connection[connection.length()-1].internalEndpoint[0].kind = ::Deployment::Facet; + + unsigned int i; + + // Looking for instance block with name equals to facet_instance ... + + ::Deployment::InstanceDeploymentDescriptions instance = deployment_plan->instance; + + for (i = 0; i < instance.length(); i++) + if (!strcmp(instance[i].name.in(), facet_instance)) + break; + + if (i < instance.length()) + connection[connection.length()-1].internalEndpoint[0].instanceRef = i; + else + throw InstanceNotFound(); + + connection[connection.length()-1].internalEndpoint[1].portName = CORBA::string_dup(port_name); + connection[connection.length()-1].internalEndpoint[1].provider = 0L; + connection[connection.length()-1].internalEndpoint[1].kind = ::Deployment::SimplexReceptacle; + + // Looking for instance block with name equals to receptacle_instance ... + + for (i = 0; i < instance.length(); i++) + if (!strcmp(instance[i].name.in(), receptacle_instance)) + break; + + if (i < instance.length()) + connection[connection.length()-1].internalEndpoint[1].instanceRef = i; + else + throw InstanceNotFound(); + + // Re-assigning connection to deployment plan + + deployment_plan->connection = connection; + } + + void + DAnCE_Utils::remove_instance (::Deployment::DeploymentPlan_var &deployment_plan, const char *instance_name) + { + // Modifying the deployment plan in order to remove the instance ... + + ::Deployment::InstanceDeploymentDescriptions instance = deployment_plan->instance; + ::Deployment::PlanConnectionDescriptions connection = deployment_plan->connection; + + // Looking for the instance position in sequence of instances ... + + unsigned int instance_ref = 0, i; + + for (i = 0; i < instance.length(); i++) + if (!strcmp(instance[i].name.in(), instance_name)) + { + instance_ref = i; + break; + } + + if (i == instance.length()) + throw InstanceNotFound(); + + // First of all, we need to remove all connections of which this instance participates ... + + 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; + } + + // And then, removing the instance itself ... + + for (unsigned int j = instance_ref; j < instance.length() - 1; j++) + { + instance[j].name = instance[j+1].name; + instance[j].node = instance[j+1].node; + instance[j].source.length(instance[j+1].source.length()); + for (unsigned int k = 0; k < instance[j].source.length(); k++) + instance[j].source[k] = instance[j+1].source[k]; + instance[j].implementationRef = instance[j].implementationRef;; + instance[j].configProperty.length(instance[j+1].configProperty.length()); + for (unsigned int k = 0; k < instance[j].configProperty.length(); k++) + { + instance[j].configProperty[k].name = instance[j+1].configProperty[k].name; + instance[j].configProperty[k].value = instance[j+1].configProperty[k].value; + } + } + instance.length(instance.length()-1); + + // Re-assigning instances to the deployment plan ... + deployment_plan->instance = instance; + + // Updating connections for the shifted instances ... + connection = deployment_plan->connection; + 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) + connection[i].internalEndpoint[j].instanceRef--; + deployment_plan->connection = connection; + + return; + + } + + void + DAnCE_Utils::remove_connection ( + ::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 (!strcmp(connection[i].name.in(), connection_name)) + { + for (unsigned int k = i; k < connection.length() - 1; k++) + { + unsigned int l; + connection[k].name = connection[k+1].name; + connection[k].source.length(connection[k+1].source.length()); + for (l = 0; l < connection[k].source.length(); l++) + connection[k].source[l] = connection[k+1].source[l]; + connection[k].deployRequirement.length(connection[k+1].deployRequirement.length()); + for (l = 0; l < connection[k].deployRequirement.length(); l++) + { + connection[k].deployRequirement[l].resourceType = connection[k+1].deployRequirement[l].resourceType; + connection[k].deployRequirement[l].name = connection[k+1].deployRequirement[l].name; + connection[k].deployRequirement[l].property.length(connection[k+1].deployRequirement[l].property.length()); + for (unsigned int m = 0; m < connection[k].deployRequirement[l].property.length(); m++) + { + connection[k].deployRequirement[l].property[m].name = connection[k+1].deployRequirement[l].property[m].name; + connection[k].deployRequirement[l].property[m].value = connection[k+1].deployRequirement[l].property[m].value; + } + } + connection[k].externalEndpoint.length(connection[k+1].externalEndpoint.length()); + for (l = 0; l < connection[k].externalEndpoint.length(); l++) + connection[k].externalEndpoint[l].portName = connection[k+1].externalEndpoint[l].portName; + connection[k].internalEndpoint.length(connection[k+1].internalEndpoint.length()); + for (l = 0; l < connection[k].internalEndpoint.length(); l++) + { + connection[k].internalEndpoint[l].portName = connection[k+1].internalEndpoint[l].portName; + connection[k].internalEndpoint[l].provider = connection[k+1].internalEndpoint[l].provider; + connection[k].internalEndpoint[l].kind = connection[k+1].internalEndpoint[l].kind; + connection[k].internalEndpoint[l].instanceRef = connection[k+1].internalEndpoint[l].instanceRef; + } + connection[k].deployedResource.length(connection[k+1].deployedResource.length()); + for (l = 0; l < connection[k].deployedResource.length(); l++) + { + connection[k].deployedResource[l].targetName = connection[k+1].deployedResource[l].targetName; + connection[k].deployedResource[l].requirementName = connection[k+1].deployedResource[l].requirementName; + connection[k].deployedResource[l].resourceName = connection[k+1].deployedResource[l].resourceName; + connection[k].deployedResource[l].resourceValue = connection[k+1].deployedResource[l].resourceValue; + } + } + connection.length(connection.length()-1); + // Re-assigning connection to the deployment plan ... + deployment_plan->connection = connection; + return; + } + // Throw exception if connection name not found ... + throw ConnectionNotFound(); + } +*/ + void + DAnCE_Utils::print_instances (const ::Deployment::DeploymentPlan &deployment_plan) + { + const ::Deployment::InstanceDeploymentDescriptions instance = + deployment_plan.instance; + + for (CORBA::ULong i = 0; i < instance.length(); ++i) + { + 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())); + + 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++) + 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 = + deployment_plan.connection; + + for (CORBA::ULong i = 0; i < connection.length(); ++i) + { + DANCE_DEBUG((LM_DEBUG, "[%M] \nConnection no. %d\n", i)); + DANCE_DEBUG((LM_DEBUG, "[%M] \tName: %C\n", connection[i].name.in())); + + 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) + { + DANCE_DEBUG((LM_DEBUG, + "\t\tDeploy Requirement %d:\n", + j+1)); + DANCE_DEBUG((LM_DEBUG, + "\t\t\tResource Type: %C\n", + connection[i].deployRequirement[j].resourceType.in())); + DANCE_DEBUG((LM_DEBUG, + "\t\t\tName: %C\n", + connection[i].deployRequirement[j].name.in())); + 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) + { + 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())); + } + } + + DANCE_DEBUG((LM_DEBUG, + "\tNo of externalEndpoints: %d\n", + connection[i].externalEndpoint.length())); + for (CORBA::ULong j = 0; j < connection[i].externalEndpoint.length(); j++) + DANCE_DEBUG((LM_DEBUG, + "\t\tPortname %d: %C\n", j+1, + connection[i].externalEndpoint[j].portName.in())); + + DANCE_DEBUG((LM_DEBUG, + "\tNo of internalEndpoints: %d\n", + connection[i].internalEndpoint.length())); + for (CORBA::ULong j = 0; j < connection[i].internalEndpoint.length(); j++) + { + 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 || + connection[i].internalEndpoint[j].kind == ::Deployment::SimplexReceptacle) + DANCE_DEBUG((LM_DEBUG, + "\t\t\tKind: %C\n", + (connection[i].internalEndpoint[j].kind == ::Deployment::Facet) ? + "Facet" : "SimplexReceptacle")); + else + DANCE_DEBUG((LM_DEBUG, + "\t\t\tKind: %d\n", + connection[i].internalEndpoint[j].kind)); + + DANCE_DEBUG((LM_DEBUG, + "\t\t\tInstanceRef: %ld", + (long) connection[i].internalEndpoint[j].instanceRef)); + DANCE_DEBUG((LM_DEBUG, "[%M] \tInstanceName: %C\n", + deployment_plan.instance[connection[i].internalEndpoint[j].instanceRef].name.in())); + } + + DANCE_DEBUG((LM_DEBUG, + "\tNo of externalReferenceEndpoints: %d\n", + connection[i].externalReference.length())); + for (CORBA::ULong j = 0; j < connection[i].externalReference.length(); ++j) + DANCE_DEBUG((LM_DEBUG, + "\t\tLocation %d: %C\n", + j+1, + connection[i].externalReference[j].location.in())); + + DANCE_DEBUG((LM_DEBUG, + "\tNo of deployedResources: %d\n", + connection[i].deployedResource.length())); + for (CORBA::ULong j = 0; j < connection[i].deployedResource.length(); j++) + { + DANCE_DEBUG((LM_DEBUG, + "\t\tTargetName: %C\n", + connection[i].deployedResource[j].targetName.in())); + DANCE_DEBUG((LM_DEBUG, "[%M] \t\tRequirementName: %C\n", + connection[i].deployedResource[j].requirementName.in())); + DANCE_DEBUG((LM_DEBUG, "[%M] \t\tResourceName: %C\n", + connection[i].deployedResource[j].resourceName.in())); + } + } + } +} + diff --git a/modules/CIAO/DAnCE/Utils/Plan_Handler.h b/modules/CIAO/DAnCE/Utils/Plan_Handler.h new file mode 100644 index 00000000000..f65e976ed19 --- /dev/null +++ b/modules/CIAO/DAnCE/Utils/Plan_Handler.h @@ -0,0 +1,75 @@ +//$Id$ +/*======================================================== + * + * @file Plan_Handler.h + * + * @Brief This file contains the implementation of + * the Plan_Handler class. + * + * @author Gan Deng <gan.deng@vanderbilt.edu> + *========================================================*/ + +#ifndef CIAO_DANCE_UTILS_H +#define CIAO_DANCE_UTILS_H + +#include "DAnCE_Utils_Export.h" +#include "Deployment/DeploymentC.h" + +namespace DAnCE +{ + class ImplementationNotFound {}; + class InstanceNotFound {}; + class ConnectionNotFound {}; + + /** + * @class Plan_Handler + * + * This class takes an existing deployment plan as input, and + * can modify the deployment plan internals. + * + * The main methods on this class are: + * + * - Add a instance to the deployment plan; + * - Add a connection to the deployment plan; + * - Remove a connection from the deployment plan; + * - Remove a instance (and, consequently all its connection) from the + * deployment plan; + * - Show all instances in the deployment plan; + * - Show all connections in the deployment plan; + */ + + class DAnCE_Utils_Export DAnCE_Utils + { + public: + static void add_instance ( + ::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, + const char *port_name, + const char *facet_instance, + const char *receptacle_instance); + + static void remove_instance ( + ::Deployment::DeploymentPlan &deployment_plan, + const char *instance_name); + + static void remove_connection ( + ::Deployment::DeploymentPlan &deployment_plan, + const char *connection_name); + + static void print_instances ( + const ::Deployment::DeploymentPlan &deployment_plan); + + static void print_connections ( + const ::Deployment::DeploymentPlan &deployment_plan); + }; +} + +#endif /* CIAO_DANCE_UTILS_H */ + diff --git a/modules/CIAO/DAnCE/bin/.empty b/modules/CIAO/DAnCE/bin/.empty new file mode 100644 index 00000000000..eb0e403e06a --- /dev/null +++ b/modules/CIAO/DAnCE/bin/.empty @@ -0,0 +1 @@ +This file keeps the directory around even when using cvs update -dP diff --git a/modules/CIAO/DAnCE/bin/PythonDAnCE/__init__.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/__init__.py new file mode 100755 index 00000000000..0ebbdbeba93 --- /dev/null +++ b/modules/CIAO/DAnCE/bin/PythonDAnCE/__init__.py @@ -0,0 +1 @@ +import generator diff --git a/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/__init__.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/__init__.py new file mode 100755 index 00000000000..641e463cdaa --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/_path.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/_path.py new file mode 100755 index 00000000000..e69de29bb2d --- /dev/null +++ b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/_path.py diff --git a/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/artifact.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/artifact.py new file mode 100755 index 00000000000..dbebad5291d --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_impl.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_impl.py new file mode 100755 index 00000000000..e807fc6f58a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_inst.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/comp_inst.py new file mode 100755 index 00000000000..7bacf681616 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/footer.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/footer.py new file mode 100755 index 00000000000..687cfb78a02 --- /dev/null +++ b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/footer.py @@ -0,0 +1,8 @@ +from templet import stringfunction + +@stringfunction +def template (): + """ +</Deployment:DeploymentPlan> +""" + diff --git a/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/header.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/header.py new file mode 100755 index 00000000000..c16146ae028 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/home_impl.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/home_impl.py new file mode 100755 index 00000000000..87c14a68070 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/home_inst.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/home_inst.py new file mode 100755 index 00000000000..6d24a5c5986 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_impl.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_impl.py new file mode 100755 index 00000000000..ab8a7ee9517 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_inst.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/homed_comp_inst.py new file mode 100755 index 00000000000..ee1218d4539 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/templet.py b/modules/CIAO/DAnCE/bin/PythonDAnCE/generator/templet.py new file mode 100755 index 00000000000..85cfb9f0389 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/bin/generate_plan.py b/modules/CIAO/DAnCE/bin/generate_plan.py new file mode 100755 index 00000000000..15310877bec --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/lib/.empty b/modules/CIAO/DAnCE/lib/.empty new file mode 100644 index 00000000000..eb0e403e06a --- /dev/null +++ b/modules/CIAO/DAnCE/lib/.empty @@ -0,0 +1 @@ +This file keeps the directory around even when using cvs update -dP diff --git a/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.cidl new file mode 100644 index 00000000000..fe2ff8f2859 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.idl new file mode 100644 index 00000000000..7d41978b4de --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.mpc new file mode 100644 index 00000000000..53a24beb29b --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute.mpc @@ -0,0 +1,114 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl SimpleAttribute" + +project(SimpleAttribute_idl_gen) : ciaoidldefaults, 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, ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.cpp new file mode 100644 index 00000000000..675e7dcc386 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec.h new file mode 100644 index 00000000000..2913eeb8d07 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_exec_export.h new file mode 100644 index 00000000000..1b9481804a3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_stub_export.h new file mode 100644 index 00000000000..00e32efd226 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleAttribute_svnt_export.h new file mode 100644 index 00000000000..6c1f3cf5a6f --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.idl new file mode 100644 index 00000000000..6f943e9d1d5 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.mpc new file mode 100644 index 00000000000..455707896e5 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon.mpc @@ -0,0 +1,64 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl SimpleCommon" + +project(SimpleCommon_idl_gen) : ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_stub_export.h new file mode 100644 index 00000000000..79aac6677b7 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleCommon_svnt_export.h new file mode 100644 index 00000000000..0190bfeebab --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.cidl new file mode 100644 index 00000000000..ff5081f82dd --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.idl new file mode 100644 index 00000000000..3895eacda3c --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.mpc new file mode 100644 index 00000000000..60d2f8e1387 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer.mpc @@ -0,0 +1,116 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleConsumer" + +project(SimpleCommon_SimpleConsumer_idl_gen) : ciaoidldefaults, 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, ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.cpp new file mode 100644 index 00000000000..f8201a17fb9 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec.h new file mode 100644 index 00000000000..e4b9607bb45 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_exec_export.h new file mode 100644 index 00000000000..a8074c4c81f --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_stub_export.h new file mode 100644 index 00000000000..89e5e37b32e --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleConsumer_svnt_export.h new file mode 100644 index 00000000000..eab50bcfd0a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.cidl new file mode 100644 index 00000000000..9de9153b267 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.idl new file mode 100644 index 00000000000..37431ca8134 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.mpc new file mode 100644 index 00000000000..2eda3a429ce --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter.mpc @@ -0,0 +1,116 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleEmitter" + +project(SimpleCommon_SimpleEmitter_idl_gen) : ciaoidldefaults, 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, ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.cpp new file mode 100644 index 00000000000..99a3d01f161 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec.h new file mode 100644 index 00000000000..a5008a85ea5 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_exec_export.h new file mode 100644 index 00000000000..53fef48b799 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_stub_export.h new file mode 100644 index 00000000000..797140271a4 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleEmitter_svnt_export.h new file mode 100644 index 00000000000..0fdc781a895 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.cidl new file mode 100644 index 00000000000..638efe0cb30 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.idl new file mode 100644 index 00000000000..60aec58f9af --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.mpc new file mode 100644 index 00000000000..2937fcbb99e --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser.mpc @@ -0,0 +1,116 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleMultipleUser" + +project(SimpleCom_SimpleMulUser_idl_gen) : ciaoidldefaults, 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(SimpleCom_SimpleMulUser_cidl_gen) : ciaocidldefaults, ciaoidldefaults, 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_stub SimpleCom_SimpleMulUser_idl_gen + 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 += SimpleCom_SimpleMulUser_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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.cpp new file mode 100644 index 00000000000..e69a11e6e0e --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec.h new file mode 100644 index 00000000000..180cce92554 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_exec_export.h new file mode 100644 index 00000000000..79cec9f8fe7 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_stub_export.h new file mode 100644 index 00000000000..bf0be40ece3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleMultipleUser_svnt_export.h new file mode 100644 index 00000000000..97f0fdf0f00 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.cidl new file mode 100644 index 00000000000..8c10398272a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.idl new file mode 100644 index 00000000000..d8f02901be4 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.mpc new file mode 100644 index 00000000000..f71da1d73b5 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull.mpc @@ -0,0 +1,114 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl SimpleNull" + +project(SimpleNull_idl_gen) : ciaoidldefaults, 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, ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.cpp new file mode 100644 index 00000000000..15ee5ee2dbb --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec.h new file mode 100644 index 00000000000..e5887e7afdc --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_exec_export.h new file mode 100644 index 00000000000..5d0ff473419 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_stub_export.h new file mode 100644 index 00000000000..17eef930019 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleNull_svnt_export.h new file mode 100644 index 00000000000..9afa614f9a4 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.cidl new file mode 100644 index 00000000000..cff76c14b89 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.idl new file mode 100644 index 00000000000..97e2c80984b --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.mpc new file mode 100644 index 00000000000..fde3ecb9320 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider.mpc @@ -0,0 +1,116 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleProvider" + +project(SimpleCommon_SimpleProvider_idl_gen) : ciaoidldefaults, 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, ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.cpp new file mode 100644 index 00000000000..63453474a67 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec.h new file mode 100644 index 00000000000..044c9aa56e3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_exec_export.h new file mode 100644 index 00000000000..c5e9182f61f --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_stub_export.h new file mode 100644 index 00000000000..795f3fec902 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleProvider_svnt_export.h new file mode 100644 index 00000000000..5f6be2501b6 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.cidl new file mode 100644 index 00000000000..d5bae5c32ee --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.idl new file mode 100644 index 00000000000..cee261fd15a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.mpc new file mode 100644 index 00000000000..80fcb6255fa --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher.mpc @@ -0,0 +1,116 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimplePublisher" + +project(SimpleCommon_SimplePublisher_idl_gen) : ciaoidldefaults, 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, ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.cpp new file mode 100644 index 00000000000..d15ab0ce667 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec.h new file mode 100644 index 00000000000..b25191f0a4a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_exec_export.h new file mode 100644 index 00000000000..2f18677399f --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_stub_export.h new file mode 100644 index 00000000000..8ab3300c5ca --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimplePublisher_svnt_export.h new file mode 100644 index 00000000000..cbc5f4e56be --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.cidl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.cidl new file mode 100644 index 00000000000..e3afe5e12f6 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.idl b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.idl new file mode 100644 index 00000000000..90d4e67e542 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.mpc b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.mpc new file mode 100644 index 00000000000..9b819814b28 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser.mpc @@ -0,0 +1,116 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p SimpleCommon SimpleUser" + +project(SimpleCommon_SimpleUser_idl_gen) : ciaoidldefaults, 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, ciaoidldefaults, 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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.cpp b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.cpp new file mode 100644 index 00000000000..accb8f8f949 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec.h new file mode 100644 index 00000000000..9b28f1e36f2 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_exec_export.h new file mode 100644 index 00000000000..fcc935919a3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_stub_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_stub_export.h new file mode 100644 index 00000000000..a31d19d5614 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_svnt_export.h b/modules/CIAO/DAnCE/tests/CIAO/Components/SimpleUser_svnt_export.h new file mode 100644 index 00000000000..897f82c3081 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome.cdp new file mode 100644 index 00000000000..01c13b3f3d1 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome_NS.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/EmitsConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..6c01f6d36d6 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..c5bc81c852a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome_NS.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/MultiplexConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..dc865e8d0a3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome.cdp new file mode 100644 index 00000000000..32747bfc1bf --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome_NS.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/PublishConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..054e7964bea --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimpleComponentExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimpleComponentExplicitHome.cdp new file mode 100644 index 00000000000..e9af75b1ac4 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..8283e9e869a --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome_NS.cdp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome_NS.cdp new file mode 100644 index 00000000000..c60ad818d6f --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/em_launcher.mpc b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/em_launcher.mpc new file mode 100644 index 00000000000..521b45caec9 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/em_launcher.mpc @@ -0,0 +1,6 @@ +// $Id$ +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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl new file mode 100755 index 00000000000..3c6d113f39a --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl @@ -0,0 +1,174 @@ +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{'DANCE_ROOT'}"; +$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"; + +$nsior = PerlACE::LocalFile ("ns.ior"); + +PerlACE::add_lib_path ('../Components'); + +$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/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/simple_em_launcher.cpp b/modules/CIAO/DAnCE/tests/CIAO/ExecutionManager-Deployments/simple_em_launcher.cpp new file mode 100644 index 00000000000..6f14f30b4e2 --- /dev/null +++ b/modules/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> + * // $Id$ + * 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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/EmitsConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/EmitsConnectionExplicitHome.cdp new file mode 100644 index 00000000000..6ac17b1e9e9 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/MultiplexConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/MultiplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..45ff31929c3 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/PublishConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/PublishConnectionExplicitHome.cdp new file mode 100644 index 00000000000..53a0a54482d --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleAttributeExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleAttributeExplicitHome.cdp new file mode 100644 index 00000000000..d66eef2c70b --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentExplicitHome.cdp new file mode 100644 index 00000000000..5632d219c48 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp new file mode 100644 index 00000000000..e31930188d2 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleHome.cdp new file mode 100644 index 00000000000..a63da21f0f6 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimplexConnectionExplicitHome.cdp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimplexConnectionExplicitHome.cdp new file mode 100644 index 00000000000..f3f1e1ca6e9 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/nm_launcher.mpc b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/nm_launcher.mpc new file mode 100644 index 00000000000..1f0d913dd3f --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/nm_launcher.mpc @@ -0,0 +1,6 @@ +// $Id$ +project(simple_nm_launcher) : ciao_config_handlers, dance_nodemanager_stub, dance_logger { + Source_Files { + simple_nm_launcher.cpp + } +}
\ No newline at end of file diff --git a/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/run_test.pl b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/run_test.pl new file mode 100755 index 00000000000..7035cec2bcf --- /dev/null +++ b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/run_test.pl @@ -0,0 +1,117 @@ +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{'DANCE_ROOT'}"; +$daemons_running = 0; +$daemons = 1; +@ports = ( 60001 ); +@iorfiles = ( "NodeApp1.ior" ); +@nodenames = ( "Node" ); +$status = 0; + +PerlACE::add_lib_path ('../Components'); + +$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/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/simple_nm_launcher.cpp b/modules/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/simple_nm_launcher.cpp new file mode 100644 index 00000000000..33c2f1f0366 --- /dev/null +++ b/modules/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> + * $Id$ + * Launches then immediately tears down a plan. + */ + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_unistd.h" +#include "tao/ORB.h" +#include "DAnCE/Logger/Logger_Service.h" +#include "DAnCE/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[]) +{ + DANCE_DISABLE_TRACE (); + + auto_ptr<DAnCE::Logger_Service> logger; + + DAnCE::Logger_Service + * dlf = ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger_Backend_Factory"); + + if (!dlf) + dlf = new DAnCE::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/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host1.cdp b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host1.cdp new file mode 100644 index 00000000000..7aa477fae74 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host2.cdp b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2-host2.cdp new file mode 100644 index 00000000000..57a44321b09 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2.cdp b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance2.cdp new file mode 100644 index 00000000000..bc761b07268 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host1.cdp b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host1.cdp new file mode 100644 index 00000000000..8626b5275a9 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host2.cdp b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/CcmDance4-host2.cdp new file mode 100644 index 00000000000..801ebf4b60f --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/DeploymentPlanDump/DeploymentPlanDump.mpc b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/DeploymentPlanDump.mpc new file mode 100644 index 00000000000..e87a25474f9 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/DeploymentPlanDump.mpc @@ -0,0 +1,9 @@ +// $Id$ +project : dance, taoexe, xerces, aceexe, ciao_config_handlers, dance_logger { + exename = DeploymentPlanDump + + Source_Files { + test.cpp + } +} + diff --git a/modules/CIAO/DAnCE/tests/DeploymentPlanDump/NewCcmDance1.cdp b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/NewCcmDance1.cdp new file mode 100644 index 00000000000..be02b05aade --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/DeploymentPlanDump/test.cpp b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/test.cpp new file mode 100644 index 00000000000..cdf08e77cde --- /dev/null +++ b/modules/CIAO/DAnCE/tests/DeploymentPlanDump/test.cpp @@ -0,0 +1,34 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/DeploymentPlanTestReferences/DeploymentPlanTestReferences.mpc b/modules/CIAO/DAnCE/tests/DeploymentPlanTestReferences/DeploymentPlanTestReferences.mpc new file mode 100644 index 00000000000..50d8831bfbd --- /dev/null +++ b/modules/CIAO/DAnCE/tests/DeploymentPlanTestReferences/DeploymentPlanTestReferences.mpc @@ -0,0 +1,9 @@ +// $Id$ +project : dance, taolib, xerces, ciao_config_handlers, dance_logger { + exename = DeploymentPlanTestReferences + + Source_Files { + test.cpp + } +} + diff --git a/modules/CIAO/DAnCE/tests/DeploymentPlanTestReferences/test.cpp b/modules/CIAO/DAnCE/tests/DeploymentPlanTestReferences/test.cpp new file mode 100644 index 00000000000..145ae3cd3fb --- /dev/null +++ b/modules/CIAO/DAnCE/tests/DeploymentPlanTestReferences/test.cpp @@ -0,0 +1,52 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/DeploymentTest1/DeploymentTest1.mpc b/modules/CIAO/DAnCE/tests/DeploymentTest1/DeploymentTest1.mpc new file mode 100644 index 00000000000..b6b115b7130 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/DeploymentTest1/DeploymentTest1.mpc @@ -0,0 +1,9 @@ +// $Id$ +project : dance, taolib, xerces, ciao_config_handlers, dance_logger { + exename = DeploymentTest1 + + Source_Files { + test.cpp + } +} + diff --git a/modules/CIAO/DAnCE/tests/DeploymentTest1/test.cpp b/modules/CIAO/DAnCE/tests/DeploymentTest1/test.cpp new file mode 100644 index 00000000000..c6cd5ae7fbb --- /dev/null +++ b/modules/CIAO/DAnCE/tests/DeploymentTest1/test.cpp @@ -0,0 +1,67 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/MocksTest/MockObjectHome.cpp b/modules/CIAO/DAnCE/tests/MocksTest/MockObjectHome.cpp new file mode 100644 index 00000000000..4b28594ba85 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/MocksTest/MockObjectHome.cpp @@ -0,0 +1,19 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/MocksTest/MockObjectHome.h b/modules/CIAO/DAnCE/tests/MocksTest/MockObjectHome.h new file mode 100644 index 00000000000..ad037096ba7 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/MocksTest/MockObjectHome.h @@ -0,0 +1,24 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/MocksTest/MockTest.cdp b/modules/CIAO/DAnCE/tests/MocksTest/MockTest.cdp new file mode 100644 index 00000000000..f3478812063 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/MocksTest/MockTest.mpc b/modules/CIAO/DAnCE/tests/MocksTest/MockTest.mpc new file mode 100644 index 00000000000..2de6e7bf904 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/MocksTest/MocksTest.cpp b/modules/CIAO/DAnCE/tests/MocksTest/MocksTest.cpp new file mode 100644 index 00000000000..fc0779ea96c --- /dev/null +++ b/modules/CIAO/DAnCE/tests/MocksTest/MocksTest.cpp @@ -0,0 +1,37 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/MocksTest/MocksTest_Export.h b/modules/CIAO/DAnCE/tests/MocksTest/MocksTest_Export.h new file mode 100644 index 00000000000..984e865bf1f --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/MocksTest/plCommand.In b/modules/CIAO/DAnCE/tests/MocksTest/plCommand.In new file mode 100644 index 00000000000..ca7b0873bab --- /dev/null +++ b/modules/CIAO/DAnCE/tests/MocksTest/plCommand.In @@ -0,0 +1,5 @@ +I +am +the +chatter +quit diff --git a/modules/CIAO/DAnCE/tests/MocksTest/run_test.pl b/modules/CIAO/DAnCE/tests/MocksTest/run_test.pl new file mode 100755 index 00000000000..5ecaae833c6 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/NameServiceTest/Dummy.idl b/modules/CIAO/DAnCE/tests/NameServiceTest/Dummy.idl new file mode 100644 index 00000000000..1f0edee59cd --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.cpp b/modules/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.cpp new file mode 100644 index 00000000000..4fe5dea9b16 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.cpp @@ -0,0 +1,14 @@ +// $Id$ +#include "DummyImpl.h" + +namespace NameServiceTest + { + + char * DummyImpl::sayHello ( + ) + { + return CORBA::string_dup (this->helloSentence); + } + + } // namespace ObjectLocatorTest + diff --git a/modules/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.h b/modules/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.h new file mode 100644 index 00000000000..7b54d8b1386 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NameServiceTest/DummyImpl.h @@ -0,0 +1,25 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/NameServiceTest/NameServiceTest.mpc b/modules/CIAO/DAnCE/tests/NameServiceTest/NameServiceTest.mpc new file mode 100644 index 00000000000..64068565ed3 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NameServiceTest/NameServiceTest.mpc @@ -0,0 +1,30 @@ +// $Id$ + +project(*idl): ciaoidldefaults { + 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/modules/CIAO/DAnCE/tests/NameServiceTest/RegistrationPath.h b/modules/CIAO/DAnCE/tests/NameServiceTest/RegistrationPath.h new file mode 100644 index 00000000000..4a6ea64c651 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NameServiceTest/RegistrationPath.h @@ -0,0 +1,9 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/NameServiceTest/clt_main.cpp b/modules/CIAO/DAnCE/tests/NameServiceTest/clt_main.cpp new file mode 100644 index 00000000000..cc8647ca035 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NameServiceTest/clt_main.cpp @@ -0,0 +1,85 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/NameServiceTest/run_test.pl b/modules/CIAO/DAnCE/tests/NameServiceTest/run_test.pl new file mode 100755 index 00000000000..719974e5c50 --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/NameServiceTest/srv_main.cpp b/modules/CIAO/DAnCE/tests/NameServiceTest/srv_main.cpp new file mode 100644 index 00000000000..46531143c85 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NameServiceTest/srv_main.cpp @@ -0,0 +1,72 @@ +// $Id$ +#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; + ACE_TCHAR ** 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; + ACE_TCHAR 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(); + + 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/modules/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/NAM_NA.mpc b/modules/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/NAM_NA.mpc new file mode 100644 index 00000000000..7081d89caae --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/NAM_NA.mpc @@ -0,0 +1,8 @@ +// $Id$ +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/modules/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/test.cpp b/modules/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/test.cpp new file mode 100644 index 00000000000..35791ab4a1e --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NodeApplicationManager-NodeApplication/test.cpp @@ -0,0 +1,48 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/NodeManager-NodeApplicationManager.mpc b/modules/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/NodeManager-NodeApplicationManager.mpc new file mode 100644 index 00000000000..7dfbd645526 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/NodeManager-NodeApplicationManager.mpc @@ -0,0 +1,8 @@ +// $Id$ +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/modules/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/test.cpp b/modules/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/test.cpp new file mode 100644 index 00000000000..f64558ad8f2 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/NodeManager-NodeApplicationManager/test.cpp @@ -0,0 +1,42 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/ObjectLocatorTest/Dummy.idl b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/Dummy.idl new file mode 100644 index 00000000000..b91938cb4df --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.cpp b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.cpp new file mode 100644 index 00000000000..d62413d728a --- /dev/null +++ b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.cpp @@ -0,0 +1,13 @@ +// $Id$ +#include "DummyImpl.h" + +namespace ObjectLocatorTest + { + + char * DummyImpl::sayHello (void) + { + return CORBA::string_dup (this->helloSentence); + } + + } // namespace ObjectLocatorTest + diff --git a/modules/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.h b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.h new file mode 100644 index 00000000000..4ec404d93ea --- /dev/null +++ b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/DummyImpl.h @@ -0,0 +1,22 @@ +// $Id$ +#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 (void); + + private: + const char * helloSentence; + }; + } // namespace POA_ObjectLocatorTest + +#endif /*DUMMYIMPL_H_*/ diff --git a/modules/CIAO/DAnCE/tests/ObjectLocatorTest/ObjectLocatorTest.mpc b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/ObjectLocatorTest.mpc new file mode 100644 index 00000000000..f2462f74678 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/ObjectLocatorTest.mpc @@ -0,0 +1,27 @@ +// $Id$ +project (ObjectLocatorTestServer): avoids_minimum_corba, 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): avoids_minimum_corba, dance, taoclient, anytypecode, dance_logger, portableserver { + + after += ObjectLocatorTestServer + exename = ObjectLocatorTestClient + + Source_Files { + clt_main.cpp + DummyC.cpp + DummyS.cpp + } +} diff --git a/modules/CIAO/DAnCE/tests/ObjectLocatorTest/RegistrationPath.h b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/RegistrationPath.h new file mode 100644 index 00000000000..4a6ea64c651 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/RegistrationPath.h @@ -0,0 +1,9 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp new file mode 100644 index 00000000000..d2cca36e843 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp @@ -0,0 +1,56 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/ObjectLocatorTest/srv_main.cpp b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/srv_main.cpp new file mode 100644 index 00000000000..344b3013c44 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/srv_main.cpp @@ -0,0 +1,55 @@ +// $Id$ +#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; + ACE_TCHAR ** 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; + ACE_TCHAR 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/modules/CIAO/DAnCE/tests/RedirectionServiceTest/Dummy.idl b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/Dummy.idl new file mode 100644 index 00000000000..5925a4ceeba --- /dev/null +++ b/modules/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/modules/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.cpp b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.cpp new file mode 100644 index 00000000000..1ad8cec1ee8 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.cpp @@ -0,0 +1,14 @@ +// $Id$ +#include "DummyImpl.h" + +namespace Test + { + + char * DummyImpl::sayHello ( + ) + { + return CORBA::string_dup (this->helloSentence); + } + + } // namespace ObjectLocatorTest + diff --git a/modules/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.h b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.h new file mode 100644 index 00000000000..272611eedba --- /dev/null +++ b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/DummyImpl.h @@ -0,0 +1,24 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/RedirectionServiceTest/RedirectionServiceTest.mpc b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/RedirectionServiceTest.mpc new file mode 100644 index 00000000000..d9d9b3fd8fd --- /dev/null +++ b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/RedirectionServiceTest.mpc @@ -0,0 +1,25 @@ +// $Id$ +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, naming, portableserver, anytypecode { + after = *RedirectionServiceTestServer + exename = RedirectionServiceTestClient + + Source_Files { + clt_main.cpp + DummyC.cpp + } +} diff --git a/modules/CIAO/DAnCE/tests/RedirectionServiceTest/RegistrationPath.h b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/RegistrationPath.h new file mode 100644 index 00000000000..a470d19c36d --- /dev/null +++ b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/RegistrationPath.h @@ -0,0 +1,11 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/RedirectionServiceTest/clt_main.cpp b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/clt_main.cpp new file mode 100644 index 00000000000..50b4d5c2f2a --- /dev/null +++ b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/clt_main.cpp @@ -0,0 +1,110 @@ +// $Id$ +#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/modules/CIAO/DAnCE/tests/RedirectionServiceTest/srv_main.cpp b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/srv_main.cpp new file mode 100644 index 00000000000..12f9f66302e --- /dev/null +++ b/modules/CIAO/DAnCE/tests/RedirectionServiceTest/srv_main.cpp @@ -0,0 +1,68 @@ +// $Id$ +#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; + ACE_TCHAR ** argvm = new ACE_TCHAR* [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/modules/CIAO/DAnCE/tests/scripts/BasicSP/basicNodeDaemon.pl b/modules/CIAO/DAnCE/tests/scripts/BasicSP/basicNodeDaemon.pl new file mode 100755 index 00000000000..b5eea32ca38 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/scripts/BasicSP/basicNodeDaemon.pl @@ -0,0 +1,62 @@ +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; +$iorfile1 = PerlACE::LocalFile ("NodeApp1.ior"); +$iorfile2 = PerlACE::LocalFile ("NodeApp2.ior"); +$iorfile3 = PerlACE::LocalFile ("NodeApp3.ior"); +$iorfile4 = PerlACE::LocalFile ("NodeApp4.ior"); +$iorfile5 = PerlACE::LocalFile ("NodeApp5.ior"); + +#for ($iter = 0; $iter <= $#ARGV; $iter++) { +# if ($ARGV[$iter] eq "-h" || $ARGV[$iter] eq "-?") { +# print "Run_Test Perl script for NodeApplicationTest \n\n"; +# print "run_test \n"; +# print "\n"; +# print "-h -- prints this information\n"; +# exit 0; +# } +#} + + +unlink $iorfile1; +unlink $iorfile2; +unlink $iorfile3; +unlink $iorfile4; +unlink $iorfile5; + +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; + +$SV1 = new PerlACE::Process ("$DANCE_ROOT/bin/dance_node_manager", + "-ORBEndpoint iiop://localhost:10000 -s +$CIAO_ROOT/DAnCE/NodeApplication/NodeApplication"); + +$SV2 = new PerlACE::Process ("$DANCE_ROOT/bin/dance_node_manager", + "-ORBEndpoint iiop://localhost:20000 -s +$CIAO_ROOT/DAnCE/NodeApplication/NodeApplication"); + +$SV3 = new PerlACE::Process ("$DANCE_ROOT/bin/dance_node_manager", + "-ORBEndpoint iiop://localhost:30000 -s +$CIAO_ROOT/DAnCE/NodeApplication/NodeApplication"); + +$SV4 = new PerlACE::Process ("$DANCE_ROOT/bin/dance_node_manager", + "-ORBEndpoint iiop://localhost:40000 -s +$CIAO_ROOT/DAnCE/NodeApplication/NodeApplication"); + +$SV5 = new PerlACE::Process ("$DANCE_ROOT/bin/dance_node_manager", + "-ORBEndpoint iiop://localhost:50000 -s +$CIAO_ROOT/DAnCE/NodeApplication/NodeApplication"); +$SV1->Spawn (); +$SV2->Spawn (); +$SV3->Spawn (); +$SV4->Spawn (); +$SV5->Spawn (); + +sleep (99999999999); diff --git a/modules/CIAO/DAnCE/tests/scripts/BasicSP/basicsp.dat b/modules/CIAO/DAnCE/tests/scripts/BasicSP/basicsp.dat new file mode 100644 index 00000000000..8bd5e6a72f6 --- /dev/null +++ b/modules/CIAO/DAnCE/tests/scripts/BasicSP/basicsp.dat @@ -0,0 +1,3 @@ +BMClosedED corbaloc:iiop:localhost:10000/NodeManager +EC corbaloc:iiop:localhost:20000/NodeManager + |