diff options
author | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-07-01 20:45:24 +0000 |
---|---|---|
committer | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-07-01 20:45:24 +0000 |
commit | 6dfb465cd15847eb2c2111f7b8ba608482aee495 (patch) | |
tree | 5550931f9a68b34fbdf6d407d46816464e31c637 | |
parent | 5553c5d1f05132cd5c744a2736429e0702783d00 (diff) | |
download | ATCD-6dfb465cd15847eb2c2111f7b8ba608482aee495.tar.gz |
Thu Jul 1 15:40:06 2004 Jaiganesh B <jai@dre.vanderbilt.edu>
43 files changed, 4523 insertions, 0 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 19e20ba7cc1..fe15c9e8f8c 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,50 @@ +Thu Jul 1 15:40:06 2004 Jaiganesh B <jai@dre.vanderbilt.edu> + + * DAnCE/ciao/CCM_Base.idl: + * DAnCE/ciao/CCM_Component.idl: + * DAnCE/ciao/CCM_Container.idl: + * DAnCE/ciao/CCM_Container_Ex.idl: + * DAnCE/ciao/CCM_Core.mpc: + * DAnCE/ciao/CCM_Event.idl: + * DAnCE/ciao/CCM_Transaction.idl: + * DAnCE/ciao/CIAO_Client_Export.h: + * DAnCE/ciao/CIAO_Container_Export.h: + * DAnCE/ciao/CIAO_Server_Export.h: + * DAnCE/ciao/CIAO_Value.idl: + * DAnCE/ciao/CIAO_common.h: + * DAnCE/ciao/Client_init.cpp: + * DAnCE/ciao/Client_init.h: + * DAnCE/ciao/Components.idl: + * DAnCE/ciao/ComponentsC.h: + * DAnCE/ciao/ComponentsS.h: + * DAnCE/ciao/Container_Base.cpp: + * DAnCE/ciao/Container_Base.h: + * DAnCE/ciao/Container_Base.inl: + * DAnCE/ciao/Container_Base.pidl: + * DAnCE/ciao/Cookies.cpp: + * DAnCE/ciao/Cookies.h: + * DAnCE/ciao/Cookies.inl: + * DAnCE/ciao/CosPersistentState.idl: + * DAnCE/ciao/Deployment.idl: + * DAnCE/ciao/Deployment_Core.idl: + * DAnCE/ciao/Deployment_stub_export.h: + * DAnCE/ciao/Deployment_svnt_export.h: + * DAnCE/ciao/NodeApp_CB_Impl.cpp: + * DAnCE/ciao/NodeApp_CB_Impl.h: + * DAnCE/ciao/NodeApplication_CallBack.idl: + * DAnCE/ciao/NodeApplication_Impl.cpp: + * DAnCE/ciao/NodeApplication_Impl.h: + * DAnCE/ciao/NodeApplication_Impl.inl: + * DAnCE/ciao/Servant_Impl_Base.cpp: + * DAnCE/ciao/Servant_Impl_Base.h: + * DAnCE/ciao/Servant_Impl_T.cpp: + * DAnCE/ciao/Servant_Impl_T.h: + * DAnCE/ciao/Server_init.cpp: + * DAnCE/ciao/Server_init.h: + * DAnCE/ciao/Version.h: + + Moving DnC/ciao over here. + Thu Jul 1 15:37:33 2004 Jaiganesh B <jai@dre.vanderbilt.edu> * DAnCE/tests/Config_Handlers/CompImplDesc_Handler_Test.cpp: diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Base.idl b/TAO/CIAO/DAnCE/ciao/CCM_Base.idl new file mode 100644 index 00000000000..7e89723be4b --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CCM_Base.idl @@ -0,0 +1,144 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -I W:/ACE_wrappers/TAO Component_Base.idl + * tao_idl -I ../.. \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Base.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if defined (CIAO_HAS_IMPORT_KEYWORD) +// import ::CORBA; +#else +#include <orb.idl> +#endif /* CIAO_HAS_IMPORT_KEYWORD */ + +#if !defined (CCM_BASE_IDL) +#define CCM_BASE_IDL + +module Components +{ + /** + * @@ Commented out temporarily for lack of typePrefix support. + */ + typeprefix Components "omg.org"; + + typedef string FeatureName; + typedef sequence<FeatureName> NameList; + + valuetype Cookie + { + private CORBA::OctetSeq cookieValue; + }; + + valuetype PortDescription + { + public FeatureName name; + public CORBA::RepositoryId type_id; + }; + + valuetype FacetDescription : PortDescription + { + public Object facet_ref; + }; + + typedef sequence<FacetDescription> FacetDescriptions; + + typedef unsigned long FailureReason; + + exception InvalidName {}; + exception InvalidConnection {}; + exception ExceededConnectionLimit {}; + exception AlreadyConnected {}; + exception NoConnection {}; + exception CookieRequired {}; + exception CreateFailure { + FailureReason reason; + }; + exception FinderFailure + { + FailureReason reason; + }; + exception RemoveFailure + { + FailureReason reason; + }; + exception DuplicateKeyValue {}; + exception InvalidKey {}; + exception UnknownKeyValue {}; + exception NoKeyAvailable {}; + exception BadEventType + { + CORBA::RepositoryId expected_event_type; + }; + exception HomeNotFound {}; + exception WrongComponentType {}; + + typedef FailureReason InvalidConfigurationReason; + const InvalidConfigurationReason UnknownConfigValueName = 0; + const InvalidConfigurationReason InvalidConfigValueType = 1; + const InvalidConfigurationReason ConfigValueRequired = 2; + const InvalidConfigurationReason ConfigValueNotExpected = 3; + exception InvalidConfiguration + { + InvalidConfigurationReason reason; + FeatureName name; + }; + exception IllegalState {}; + + interface Navigation + { + Object provide_facet (in FeatureName name) + raises (InvalidName); + FacetDescriptions get_all_facets(); + FacetDescriptions get_named_facets (in NameList names) + raises (InvalidName); + boolean same_component (in Object object_ref); + }; + + valuetype ConnectionDescription + { + public Cookie ck; + public Object objref; + }; + typedef sequence<ConnectionDescription> ConnectionDescriptions; + + valuetype ReceptacleDescription : PortDescription + { + public boolean is_multiple; + public ConnectionDescriptions connections; + }; + typedef sequence<ReceptacleDescription> ReceptacleDescriptions; + + interface Receptacles + { + Cookie connect (in FeatureName name, in Object connection ) + raises (InvalidName, + InvalidConnection, + AlreadyConnected, + ExceededConnectionLimit); + + // @@ Changed to return the previously connected object reference -- basef on RTF 1.1. + Object disconnect (in FeatureName name, in Cookie ck) + raises (InvalidName, + InvalidConnection, + CookieRequired, + NoConnection); + + ConnectionDescriptions get_connections (in FeatureName name) + raises (InvalidName); + + ReceptacleDescriptions get_all_receptacles (); + + ReceptacleDescriptions get_named_receptacles (in NameList names) + raises (InvalidName); + }; +}; +#endif /* CCM_BASE_IDL */ diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Component.idl b/TAO/CIAO/DAnCE/ciao/CCM_Component.idl new file mode 100644 index 00000000000..3dcc86e4dd3 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CCM_Component.idl @@ -0,0 +1,149 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Component.idl + */ + +#if !defined (CCM_COMPONENT_IDL) +#define CCM_COMPONENT_IDL + +#include "CCM_Event.idl" +#include "tao/IFR_Client/IFR_Base.pidl" + +module Components +{ + typeprefix Components "omg.org"; + + abstract valuetype PrimaryKeyBase {}; + + interface CCMObject; //forward reference + + interface CCMHome + { + CORBA::IRObject get_component_def (); + CORBA::IRObject get_home_def (); + void remove_component ( in CCMObject comp) + raises (RemoveFailure); + }; + typedef sequence<CCMHome> CCMHomes; + + interface KeylessCCMHome + { + CCMObject create_component() + raises (CreateFailure); + }; + + interface HomeFinder + { + CCMHome find_home_by_component_type (in CORBA::RepositoryId comp_repid) + raises (HomeNotFound); + + CCMHome find_home_by_home_type (in CORBA::RepositoryId home_repid) + raises (HomeNotFound); + + CCMHome find_home_by_name (in string home_name) + raises (HomeNotFound); + }; + + interface Configurator + { + void configure (in CCMObject comp) + raises (WrongComponentType); + }; + + valuetype ConfigValue + { + public FeatureName name; + public any value; + }; + + typedef sequence<ConfigValue> ConfigValues; + + interface StandardConfigurator : Configurator + { + void set_configuration (in ConfigValues descr); + }; + + interface HomeConfiguration : CCMHome + { + void set_configurator (in Configurator cfg); + void set_configuration_values (in ConfigValues config); + void complete_component_configuration (in boolean b); + void disable_home_configuration(); + }; + + valuetype ComponentPortDescription + { + public FacetDescriptions facets; + public ReceptacleDescriptions receptacles; + public ConsumerDescriptions consumers; + public EmitterDescriptions emitters; + public PublisherDescriptions publishers; + }; + + interface CCMObject : Navigation, Receptacles, Events + { + CORBA::IRObject get_component_def ( ); + CCMHome get_ccm_home( ); + PrimaryKeyBase get_primary_key( ) + raises (NoKeyAvailable); + + /// CIAO specific operations to have some control on when and how + /// to activate components. + /** + * This is all from our work on ARMS where we needed to know whether + * every component has been configured, say for example to use + * logging in the assembly which could in turn be provided by a + * component. To get around all this we are adding some methods on + * this till we think of some standard way to do this. The problem + * is that the deployer should be able to call this as opposed to + * the home calling it as soon as the component is created. + * + * All these operations are called in the order mentioned, ie. the + * deployer calls ciao_preactivate () on all components, then + * ciao_activate and then ciao_postactivate (). The speciality is + * that these operations would be invoked on every target object + * before the next call is made. It is similar to the way + * portable interceptors work, trying to get everything onto the + * flow stack, but differ in the intention. + */ + void ciao_preactivate () + raises (InvalidConfiguration); + + void ciao_activate () + raises (InvalidConfiguration); + + void ciao_postactivate () + raises (InvalidConfiguration); + + void configuration_complete () + raises (InvalidConfiguration); + + void remove() + raises (RemoveFailure); + ComponentPortDescription get_all_ports (); + }; + + // @@ Enumeration and DefaultEnumeration are only for EJB to CCM + // mapping? At any rate, we should be able to skip them for now. + abstract valuetype Enumeration + { + boolean has_more_elements(); + CCMObject next_element(); + }; + + typedef sequence<CCMObject> CCMObjectSeq; + + valuetype DefaultEnumeration : Enumeration + { + private CCMObjectSeq objects; + }; +}; +#endif /* CCM_COMPONENT_IDL */ diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Container.idl b/TAO/CIAO/DAnCE/ciao/CCM_Container.idl new file mode 100644 index 00000000000..0b7d23562fc --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CCM_Container.idl @@ -0,0 +1,155 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Container.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_CONTAINER_IDL) +#define CCM_CONTAINER_IDL + +#include "CCM_Component.idl" +#include "orbsvcs/orbsvcs/SecurityLevel2.idl" +#include "CCM_Transaction.idl" + +// *************** Basic Container interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + typedef SecurityLevel2::Credentials Principal; + + local interface CCMContext + { + Principal get_caller_principal(); + + CCMHome get_CCM_home(); + + boolean get_rollback_only() + raises (IllegalState); + + Transaction::UserTransaction get_user_transaction() + raises (IllegalState); + + boolean is_caller_in_role (in string role); + + void set_rollback_only() + raises (IllegalState); + }; + + enum CCMExceptionReason + { + SYSTEM_ERROR, + CREATE_ERROR, + REMOVE_ERROR, + DUPLICATE_KEY, + FIND_ERROR, + OBJECT_NOT_FOUND, + NO_SUCH_ENTITY + }; + + exception CCMException + { + CCMExceptionReason reason; + }; + + local interface EnterpriseComponent {}; + + local interface SessionContext : CCMContext + { + Object get_CCM_object() + raises (IllegalState); + }; + + local interface SessionComponent : EnterpriseComponent + { + void set_session_context ( in SessionContext ctx) + raises (CCMException); + + void ccm_activate() + raises (CCMException); + + void ccm_passivate() + raises (CCMException); + + /// The following two methods are CIAO specific extension. + /** + * This method is invoked before ccm_activate () is called. All + * components in the assembly get this callback before the + * ccm_activate () is called. + */ + void ciao_preactivate () + raises (CCMException); + + /** + * This method is invoked after ccm_activate () is called. All + * components in the assembly get this callback after the + * ccm_activate () is called. + */ + void ciao_postactivate () + raises (CCMException); + + void ccm_remove () + raises (CCMException); + }; + + local interface SessionSynchronization + { + void after_begin () + raises (CCMException); + + void before_completion () + raises (CCMException); + + void after_completion (in boolean committed) + raises (CCMException); + }; + + local interface EntityContext : CCMContext + { + Object get_CCM_object () + raises (IllegalState); + + PrimaryKeyBase get_primary_key () + raises (IllegalState); + }; + + local interface EntityComponent : EnterpriseComponent + { + void set_entity_context (in EntityContext ctx) + raises (CCMException); + + void unset_entity_context () + raises (CCMException); + + void ccm_activate () + raises (CCMException); + + void ccm_load () + raises (CCMException); + + void ccm_store () + raises (CCMException); + + void ccm_passivate () + raises (CCMException); + + void ccm_remove () + raises (CCMException); + }; + + + local interface HomeExecutorBase + { + }; +}; +#endif /* CCM_CONTAINER_IDL */ diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Container_Ex.idl b/TAO/CIAO/DAnCE/ciao/CCM_Container_Ex.idl new file mode 100644 index 00000000000..0aeb481807d --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CCM_Container_Ex.idl @@ -0,0 +1,183 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Container_Ex.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_CONTAINER_EX_IDL) +#define CCM_CONTAINER_EX_IDL + +#include "CCM_Container.idl" +#include <CosPersistentState.idl> + +// *************** Extended Container Interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + enum BadComponentReferenceReason + { + NON_LOCAL_REFERENCE, + NON_COMPONENT_REFERENCE, + WRONG_CONTAINER + }; + + typedef CosPersistentState::CatalogBase CatalogBase; + typedef CosPersistentState::_TypeId _TypeId; + + typedef short SegmentId; + const SegmentId COMPONENT_SEGMENT = 0; + + typedef short FacetId; + const FacetId COMPONENT_FACET = 0; + + typedef sequence<octet> IdData; + typedef CosPersistentState::Pid PersistentId; + + typedef short StateIdType; + const StateIdType PERSISTENT_ID = 0; + + exception BadComponentReference + { + BadComponentReferenceReason reason; + }; + exception PolicyMismatch {}; + exception PersistenceNotAvailable {}; + exception UnknownActualHome {}; + exception ProxyHomeNotSupported {}; + exception InvalidStateIdData {}; + + local interface HomeRegistration + { + void register_home (in CCMHome home_ref, + in string home_name); + + void unregister_home (in CCMHome home_ref); + }; + + local interface CCM2Context : CCMContext + { + HomeRegistration get_home_registration (); + + void req_passivate () + raises (PolicyMismatch); + + CatalogBase get_persistence (in _TypeId catalog_type_id) + raises (PersistenceNotAvailable); + }; + + local interface ProxyHomeRegistration : HomeRegistration + { + void register_proxy_home (in CCMHome rhome, + in CCMHome ahome) + raises (UnknownActualHome, + ProxyHomeNotSupported); + }; + + local interface Session2Context : SessionContext, CCM2Context + { + Object create_ref (in CORBA::RepositoryId repid); + + Object create_ref_from_oid (in CORBA::OctetSeq oid, + in CORBA::RepositoryId repid); + + CORBA::OctetSeq get_oid_from_ref (in Object objref) + raises (IllegalState, + BadComponentReference); + }; + + abstract valuetype StateIdValue + { + StateIdType get_sid_type(); + IdData get_sid_data(); + }; + + local interface StateIdFactory + { + StateIdValue create (in IdData data) + raises (InvalidStateIdData); + }; + + valuetype PersistentIdValue : StateIdValue + { + private PersistentId pid; + + PersistentId get_pid(); + factory init (in PersistentId pid); + }; + + valuetype SegmentDescr + { + private StateIdValue sid; + private SegmentId seg; + + StateIdValue get_sid(); + SegmentId get_seg_id(); + factory init (in StateIdValue sid, + in SegmentId seg); + }; + + typedef sequence<SegmentDescr> SegmentDescrSeq; + + local interface ComponentId + { + FacetId get_target_facet(); + + SegmentId get_target_segment(); + + StateIdValue get_target_state_id (in StateIdFactory sid_factory) + raises (InvalidStateIdData); + + StateIdValue get_segment_state_id (in SegmentId seg, + in StateIdFactory sid_factory) + raises (InvalidStateIdData); + + ComponentId create_with_new_target (in FacetId new_target_facet, + in SegmentId new_target_segment); + + SegmentDescrSeq get_segment_descrs (in StateIdFactory sid_factory) + raises (InvalidStateIdData); + }; + + local interface Entity2Context : EntityContext, CCM2Context + { + ComponentId get_component_id () + raises (IllegalState); + + ComponentId create_component_id (in FacetId target_facet, + in SegmentId target_segment, + in SegmentDescrSeq seq_descrs); + + ComponentId create_monolithic_component_id (in FacetId target_facet, + in StateIdValue sid); + + Object create_ref_from_cid (in CORBA::RepositoryId repid, + in ComponentId cid); + + ComponentId get_cid_from_ref (in Object objref) + raises (BadComponentReference); + }; + + local interface ExecutorLocator : EnterpriseComponent + { + Object obtain_executor (in string name) + raises (CCMException); + + void release_executor (in Object exc) + raises (CCMException); + + void configuration_complete() + raises (InvalidConfiguration); + }; +}; +#endif /* CCM_CONTAINER_EX_IDL */ diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc b/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc new file mode 100644 index 00000000000..ac1774a1e36 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc @@ -0,0 +1,131 @@ +// -*- MPC -*- +// $Id$ + +project (CIAO_DnC_Client) : taolib_with_idl, valuetype, ifr_client { + sharedname = CIAO_DnC_Client + idlflags += -Wb,stub_export_include=CIAO_Client_Export.h + idlflags += -Wb,stub_export_macro=CIAO_CLIENT_Export + idlflags += -Wb,skel_export_include=CIAO_Container_Export.h + idlflags += -Wb,skel_export_macro=CIAO_CONTAINER_Export + + dynamicflags = CIAO_CLIENT_BUILD_DLL + + IDL_Files { + CCM_Base.idl + CCM_Event.idl + CCM_Component.idl + CIAO_Value.idl + } + + Source_Files { + CCM_BaseC.cpp + CCM_EventC.cpp + CCM_ComponentC.cpp + CIAO_ValueC.cpp + Client_init.cpp + } + + Header_Files { + CIAO_Client_Export.h + CIAO_common.h + } +} + +project (CIAO_DnC_Container) : orbsvcslib, portableserver, security, iorinterceptor, objreftemplate, valuetype, ifr_client { + after += CIAO_DnC_Client + sharedname = CIAO_DnC_Container + libs += CIAO_DnC_Client + idlflags += -Wb,export_include=CIAO_Container_Export.h + idlflags += -Wb,export_macro=CIAO_CONTAINER_Export + dynamicflags = CIAO_CONTAINER_BUILD_DLL + + IDL_Files { + CCM_Transaction.idl + CosPersistentState.idl + CCM_Container.idl + CCM_Container_Ex.idl + } + + Source_Files { + CCM_TransactionC.cpp + CosPersistentStateC.cpp + CCM_ContainerC.cpp + CCM_Container_ExC.cpp + CCM_BaseS.cpp + CCM_EventS.cpp + CCM_ComponentS.cpp + Cookies.cpp + } +} + +project (CIAO_DnC_Server) : orbsvcslib, portableserver, iorinterceptor, objreftemplate, valuetype, ifr_client, security { + after += CIAO_DnC_Container + sharedname = CIAO_DnC_Server + libs += CIAO_DnC_Client CIAO_DnC_Container + idlflags += -Wb,export_include=CIAO_Server_Export.h -Wb,export_macro=CIAO_SERVER_Export + dynamicflags = CIAO_SERVER_BUILD_DLL + + IDL_Files { + Deployment_Core.idl + } + + Source_Files { + Deployment_CoreC.cpp + Deployment_CoreS.cpp + Container_Base.cpp + NodeApplication_Impl.cpp + Server_init.cpp + Servant_Impl_Base.cpp + } + + Header_Files { + CIAO_Server_Export.h + CIAO_common.h + } + + Template_Files { + Servant_Impl_T.cpp + } +} + +project(Deployment_stub) : taolib_with_idl, valuetype , ciao_server_dnc { + sharedname = Deployment_stub + + 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 + idlflags += -St + + dynamicflags = DEPLOYMENT_STUB_BUILD_DLL + + IDL_Files { + Deployment.idl + NodeApplication_CallBack.idl + } + + Source_Files { + DeploymentC.cpp + NodeApplication_CallBackC.cpp + } +} + +project(Deployment_svnt) : taolib_with_idl, portableserver, ciao_server_dnc { + after += Deployment_stub + sharedname = Deployment_svnt + dynamicflags = DEPLOYMENT_SVNT_BUILD_DLL + libs += Deployment_stub + 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 { + } + + Source_Files { + DeploymentS.cpp + NodeApp_CB_Impl.cpp + NodeApplication_CallBackS.cpp + } +} diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Event.idl b/TAO/CIAO/DAnCE/ciao/CCM_Event.idl new file mode 100644 index 00000000000..7773eedd186 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CCM_Event.idl @@ -0,0 +1,100 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Event.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_EVENT_IDL) +#define CCM_EVENT_IDL + +#include "CCM_Base.idl" + +module Components +{ + typeprefix Components "omg.org"; + + abstract valuetype EventBase {}; + + interface EventConsumerBase + { + void push_event (in EventBase evt) raises (BadEventType); + }; + + valuetype ConsumerDescription : PortDescription + { + public EventConsumerBase consumer; + }; + typedef sequence<ConsumerDescription> ConsumerDescriptions; + + valuetype EmitterDescription : PortDescription + { + public EventConsumerBase consumer; + }; + typedef sequence<EmitterDescription> EmitterDescriptions; + + valuetype SubscriberDescription + { + public Cookie ck; + public EventConsumerBase consumer; + }; + typedef sequence<SubscriberDescription> SubscriberDescriptions; + + valuetype PublisherDescription : PortDescription + { + public SubscriberDescriptions consumer; + }; + typedef sequence<PublisherDescription> PublisherDescriptions; + + interface Events + { + EventConsumerBase get_consumer (in FeatureName sink_name) + raises (InvalidName); + + Cookie subscribe (in FeatureName publisher_name, + in EventConsumerBase subscriber) + raises (InvalidName, + AlreadyConnected, + InvalidConnection, + ExceededConnectionLimit); + + EventConsumerBase unsubscribe (in FeatureName publisher_name, + in Cookie ck) + raises (InvalidName, + InvalidConnection); + + void connect_consumer (in FeatureName emitter_name, + in EventConsumerBase consumer) + raises (InvalidName, + AlreadyConnected, + InvalidConnection); + + EventConsumerBase disconnect_consumer (in FeatureName source_name) + raises (InvalidName, + NoConnection); + + ConsumerDescriptions get_all_consumers (); + + ConsumerDescriptions get_named_consumers (in NameList names) + raises (InvalidName); + + EmitterDescriptions get_all_emitters (); + + EmitterDescriptions get_named_emitters (in NameList names) + raises (InvalidName); + + PublisherDescriptions get_all_publishers (); + + PublisherDescriptions get_named_publishers (in NameList names) + raises (InvalidName); + }; +}; +#endif /* CCM_EVENT_IDL */ diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Transaction.idl b/TAO/CIAO/DAnCE/ciao/CCM_Transaction.idl new file mode 100644 index 00000000000..c0c8cdc2c1d --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CCM_Transaction.idl @@ -0,0 +1,89 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Transaction.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_TRANSACTION_IDL) +#define CCM_TRANSACTION_IDL + +module Components +{ + typeprefix Components "omg.org"; + + // @@ Components::Transaction is still there. + module Transaction + { + + typedef sequence<octet> TranToken; + + exception NoTransaction {}; + exception NotSupported {}; + exception SystemError {}; + exception RollbackError {}; + exception HeuristicMixed {}; + exception HeuristicRollback {}; + exception Security {}; + exception InvalidToken {}; + + enum Status + { + ACTIVE, + MARKED_ROLLBACK, + PREPARED, + COMMITTED, + ROLLED_BACK, + NO_TRANSACTION, + PREPARING, + COMMITTING, + ROLLING_BACK + }; + + local interface UserTransaction { + void begin () + raises (NotSupported, + SystemError); + + void commit () + raises (RollbackError, + NoTransaction, + HeuristicMixed, + HeuristicRollback, + Security, + SystemError); + + void rollback () + raises (NoTransaction, + Security, + SystemError); + + void set_rollback_only () + raises (NoTransaction, + SystemError); + + Status get_status() + raises (SystemError); + + void set_timeout (in long to) + raises (SystemError); + + TranToken suspend () + raises (NoTransaction, + SystemError); + + void resume (in TranToken txtoken) + raises (InvalidToken, + SystemError); + }; + }; +}; +#endif /* CCM_TRANSACTION_IDL */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_Client_Export.h b/TAO/CIAO/DAnCE/ciao/CIAO_Client_Export.h new file mode 100644 index 00000000000..a566e94b0c2 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_Client_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_CLIENT +// ------------------------------ +#ifndef CIAO_CLIENT_EXPORT_H +#define CIAO_CLIENT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_CLIENT_HAS_DLL) +# define CIAO_CLIENT_HAS_DLL 1 +#endif /* ! CIAO_CLIENT_HAS_DLL */ + +#if defined (CIAO_CLIENT_HAS_DLL) && (CIAO_CLIENT_HAS_DLL == 1) +# if defined (CIAO_CLIENT_BUILD_DLL) +# define CIAO_CLIENT_Export ACE_Proper_Export_Flag +# define CIAO_CLIENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_CLIENT_BUILD_DLL */ +# define CIAO_CLIENT_Export ACE_Proper_Import_Flag +# define CIAO_CLIENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_CLIENT_BUILD_DLL */ +#else /* CIAO_CLIENT_HAS_DLL == 1 */ +# define CIAO_CLIENT_Export +# define CIAO_CLIENT_SINGLETON_DECLARATION(T) +# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_CLIENT_HAS_DLL == 1 */ + +// Set CIAO_CLIENT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_CLIENT_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_CLIENT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_CLIENT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_CLIENT_NTRACE */ + +#if (CIAO_CLIENT_NTRACE == 1) +# define CIAO_CLIENT_TRACE(X) +#else /* (CIAO_CLIENT_NTRACE == 1) */ +# define CIAO_CLIENT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_CLIENT_NTRACE == 1) */ + +#endif /* CIAO_CLIENT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_Container_Export.h b/TAO/CIAO/DAnCE/ciao/CIAO_Container_Export.h new file mode 100644 index 00000000000..74ba838721d --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_Container_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_CONTAINER +// ------------------------------ +#ifndef CIAO_CONTAINER_EXPORT_H +#define CIAO_CONTAINER_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_CONTAINER_HAS_DLL) +# define CIAO_CONTAINER_HAS_DLL 1 +#endif /* ! CIAO_CONTAINER_HAS_DLL */ + +#if defined (CIAO_CONTAINER_HAS_DLL) && (CIAO_CONTAINER_HAS_DLL == 1) +# if defined (CIAO_CONTAINER_BUILD_DLL) +# define CIAO_CONTAINER_Export ACE_Proper_Export_Flag +# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_CONTAINER_BUILD_DLL */ +# define CIAO_CONTAINER_Export ACE_Proper_Import_Flag +# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_CONTAINER_BUILD_DLL */ +#else /* CIAO_CONTAINER_HAS_DLL == 1 */ +# define CIAO_CONTAINER_Export +# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) +# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_CONTAINER_HAS_DLL == 1 */ + +// Set CIAO_CONTAINER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_CONTAINER_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_CONTAINER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_CONTAINER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_CONTAINER_NTRACE */ + +#if (CIAO_CONTAINER_NTRACE == 1) +# define CIAO_CONTAINER_TRACE(X) +#else /* (CIAO_CONTAINER_NTRACE == 1) */ +# define CIAO_CONTAINER_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_CONTAINER_NTRACE == 1) */ + +#endif /* CIAO_CONTAINER_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_Server_Export.h b/TAO/CIAO/DAnCE/ciao/CIAO_Server_Export.h new file mode 100644 index 00000000000..2f0145331e9 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_Server_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_SERVER +// ------------------------------ +#ifndef CIAO_SERVER_EXPORT_H +#define CIAO_SERVER_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_SERVER_HAS_DLL) +# define CIAO_SERVER_HAS_DLL 1 +#endif /* ! CIAO_SERVER_HAS_DLL */ + +#if defined (CIAO_SERVER_HAS_DLL) && (CIAO_SERVER_HAS_DLL == 1) +# if defined (CIAO_SERVER_BUILD_DLL) +# define CIAO_SERVER_Export ACE_Proper_Export_Flag +# define CIAO_SERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_SERVER_BUILD_DLL */ +# define CIAO_SERVER_Export ACE_Proper_Import_Flag +# define CIAO_SERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_SERVER_BUILD_DLL */ +#else /* CIAO_SERVER_HAS_DLL == 1 */ +# define CIAO_SERVER_Export +# define CIAO_SERVER_SINGLETON_DECLARATION(T) +# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_SERVER_HAS_DLL == 1 */ + +// Set CIAO_SERVER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_SERVER_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_SERVER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_SERVER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_SERVER_NTRACE */ + +#if (CIAO_SERVER_NTRACE == 1) +# define CIAO_SERVER_TRACE(X) +#else /* (CIAO_SERVER_NTRACE == 1) */ +# define CIAO_SERVER_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_SERVER_NTRACE == 1) */ + +#endif /* CIAO_SERVER_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_Value.idl b/TAO/CIAO/DAnCE/ciao/CIAO_Value.idl new file mode 100644 index 00000000000..52efed12f75 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_Value.idl @@ -0,0 +1,21 @@ +// $Id$ + +/** + * @file CIAO_Value.idl + * + * @brief Some CIAO valuetype extension for internal use. + */ + +#include "CCM_Base.idl" + +/** + * @ Note: This needs deprecation. + * + */ +module CIAO +{ + valuetype Cookie : Components::Cookie + { + CORBA::OctetSeq get_cookie (); + }; +}; diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_common.h b/TAO/CIAO/DAnCE/ciao/CIAO_common.h new file mode 100644 index 00000000000..e933c75fe32 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_common.h @@ -0,0 +1,53 @@ +// $Id$ + +/** + * @file CIAO_common.h + * + * This file collects common CIAO macro definitions. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_COMMON_H +#define CIAO_COMMON_H +#include /**/ "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined ACE_LACKS_PRAGMA_ONCE +#pragma once +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Client_Export.h" + +#define CIAO_REGISTER_VALUE_FACTORY(ORB,FACTORY,VALUETYPE) {\ + CORBA::ValueFactory factory = new FACTORY; \ + CORBA::ValueFactory prev_factory = \ + ORB->register_value_factory \ + (VALUETYPE::_tao_obv_static_repository_id (), \ + factory); \ + if (prev_factory) prev_factory->_remove_ref (); \ + factory->_remove_ref (); } + +namespace CIAO +{ + /** + * Return the debug level. The debug level of CIAO is control by + * an environment variable "CIAO_DEBUG_LEVEL". It should be an int + * value. If it is not defined, the default debug level is 0. The + * value of debug value is evaluated on its first use and the value + * is then cached. The actual implementation of this function is in + * Client_init.cpp. + * + * Some recommendation for using the debug_level + * + * > 0 : For component users. Component developers are encouraged + * to develop their own + * > 10 : For CIAO tools + * > 20 : For CIAO core. + */ + CIAO_CLIENT_Export int debug_level (void); +} + +#include /**/ "ace/post.h" +#endif /* CIAO_COMMON_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Client_init.cpp b/TAO/CIAO/DAnCE/ciao/Client_init.cpp new file mode 100644 index 00000000000..7dd0b874b54 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Client_init.cpp @@ -0,0 +1,58 @@ +// $Id$ + +#include "Client_init.h" +#include "CIAO_common.h" +#include "CCM_ComponentC.h" +#include "CIAO_ValueC.h" +#include "ace/Env_Value_T.h" + +int +CIAO::Client_init (CORBA::ORB_ptr o) +{ + CIAO_REGISTER_VALUE_FACTORY (o, Components::Cookie_init, + Components::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, Components::Cookie_init, + CIAO::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PortDescription_init, + Components::PortDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::FacetDescription_init, + Components::FacetDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConnectionDescription_init, + Components::ConnectionDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ReceptacleDescription_init, + Components::ReceptacleDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConsumerDescription_init, + Components::ConsumerDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::EmitterDescription_init, + Components::EmitterDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::SubscriberDescription_init, + Components::SubscriberDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PublisherDescription_init, + Components::PublisherDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConfigValue_init, + Components::ConfigValue); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ComponentPortDescription_init, + Components::ComponentPortDescription); + return 0; +} + +/// This should really be an anonymous namespace, but some compilers +/// still don't support this features. Therefore, just use a long +/// namespace name here. +namespace ciao_anonymous_namespace +{ + int debug_level = -1; +} + +int +CIAO::debug_level (void) +{ + if (ciao_anonymous_namespace::debug_level == -1) + { + // Initialize the thing. + ACE_Env_Value<int> envar ("CIAO_DEBUG_LEVEL", 1); + ciao_anonymous_namespace::debug_level = envar; + } + + return ciao_anonymous_namespace::debug_level; +} diff --git a/TAO/CIAO/DAnCE/ciao/Client_init.h b/TAO/CIAO/DAnCE/ciao/Client_init.h new file mode 100644 index 00000000000..065c1f2a280 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Client_init.h @@ -0,0 +1,40 @@ +// $Id$ + +/** + * @file Client_init.h + * + * Initializing CIAO client side ORB, if they need to. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_CLIENT_INIT_H +#define CIAO_CLIENT_INIT_H +#include /**/ "ace/pre.h" + +#include "CIAO_Client_Export.h" + +#if !defined ACE_LACKS_PRAGMA_ONCE +#pragma once +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +namespace CORBA +{ + class ORB; + typedef ORB *ORB_ptr; +} + +namespace CIAO +{ + /** + * The initialize routine for any clients that need to access + * component. This routine now simply registers various valuetype + * factories defined in CIAO_Component.pidl. Currently, this method + * should be call right after ORB initialization but we should try + * to register these stuff automatically. + */ + CIAO_CLIENT_Export int Client_init (CORBA::ORB_ptr o); +} + +#include /**/ "ace/post.h" +#endif /* CIAO_CLIENT_INIT_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Components.idl b/TAO/CIAO/DAnCE/ciao/Components.idl new file mode 100644 index 00000000000..3846f59685b --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Components.idl @@ -0,0 +1,15 @@ +// $Id$ + +/** + * @@ This file is included in the generated executor + * mapping IDL file, and for now just includes + * CCM_Container.idl. + */ + +#if !defined (CIAO_COMPONENTS_IDL) +#define CIAO_COMPONENTS_IDL + +#include "CCM_Container.idl" + +#endif /* CIAO_COMPONENTS_IDL */ + diff --git a/TAO/CIAO/DAnCE/ciao/ComponentsC.h b/TAO/CIAO/DAnCE/ciao/ComponentsC.h new file mode 100644 index 00000000000..32e5a755e83 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/ComponentsC.h @@ -0,0 +1,99 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:150 + +#ifndef _TAO_IDL_COMPONENTSC_H_ +#define _TAO_IDL_COMPONENTSC_H_ + +#include "tao/ORB.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/CDR.h" +#include "tao/Environment.h" +#include "tao/Typecode.h" + +#include "CCM_ContainerC.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO + +#if defined (TAO_EXPORT_NESTED_CLASSES) +# if defined (TAO_EXPORT_NESTED_MACRO) +# undef TAO_EXPORT_NESTED_MACRO +# endif /* defined (TAO_EXPORT_NESTED_MACRO) */ +# define TAO_EXPORT_NESTED_MACRO +#endif /* TAO_EXPORT_NESTED_CLASSES */ + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option push -w-rvl -w-rch -w-ccc -w-inl +#endif /* __BORLANDC__ */ + +// TAO_IDL - Generated from +// be/be_visitor_traits.cpp:50 + +// Traits specializations. +namespace TAO +{ +}; + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:48 + +#ifndef __ACE_INLINE__ + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:64 + +#endif /* __ACE_INLINE__ */ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:911 + + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option pop +#endif /* __BORLANDC__ */ + +#endif /* ifndef */ diff --git a/TAO/CIAO/DAnCE/ciao/ComponentsS.h b/TAO/CIAO/DAnCE/ciao/ComponentsS.h new file mode 100644 index 00000000000..5463db3326b --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/ComponentsS.h @@ -0,0 +1,65 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:390 + +#ifndef _TAO_IDL_COMPONENTSS_H_ +#define _TAO_IDL_COMPONENTSS_H_ + + +#include "CCM_ContainerS.h" +#include "ComponentsC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Collocation_Proxy_Broker.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/Servant_Base.h" + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option push -w-rvl -w-rch -w-ccc -w-inl +#endif /* __BORLANDC__ */ + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option pop +#endif /* __BORLANDC__ */ + +#endif /* ifndef */ diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.cpp b/TAO/CIAO/DAnCE/ciao/Container_Base.cpp new file mode 100644 index 00000000000..794e3927437 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.cpp @@ -0,0 +1,301 @@ +// $Id$ + +#include "Container_Base.h" +#include "ace/DLL.h" +#include "ace/OS_NS_stdio.h" + +#if !defined (__ACE_INLINE__) +# include "Container_Base.inl" +#endif /* __ACE_INLINE__ */ + +//////////////////////////////////////////////////////////////// + +CIAO::Container::Container (CORBA::ORB_ptr o) + : orb_ (CORBA::ORB::_duplicate (o)) +{ +} + +CIAO::Container::~Container () +{ +} + +PortableServer::POA_ptr +CIAO::Container::_ciao_the_POA (void) +{ + return this->poa_.in (); +} + +CORBA::ORB_ptr +CIAO::Container::_ciao_the_ORB () +{ + return this->orb_.in (); +} + +/////////////////////////////////////////////////////////////// + +ACE_Atomic_Op <ACE_SYNCH_MUTEX, long> +CIAO::Session_Container::serial_number_ (0); + +CIAO::Session_Container::Session_Container (CORBA::ORB_ptr o, + int static_config_flag, + const Static_Config_EntryPoints_Maps* maps + ) + : Container (o), + number_ (0), + static_config_flag_ (static_config_flag), + static_entrypts_maps_ (maps) +{ +} + +CIAO::Session_Container::~Session_Container () +{ +} + +int +CIAO::Session_Container::init (const char *name, + const CORBA::PolicyList *more_policies + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + char buffer[MAXPATHLEN]; + + if (name == 0) + { + this->number_ = ++CIAO::Session_Container::serial_number_; + ACE_OS::sprintf (buffer, "CIAO::Session_Container-%ld", + this->number_); + name = buffer; + } + + CORBA::Object_var poa_object = + this->orb_->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + -1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // Set up proper poa policies here. Default policies seems to be + // fine for session container. If you add some other default + // policies here, then you need to "add" more_policies below + // instead of simply assigning more_policies to the init policy + // list. + CORBA::PolicyList policies (0); + + if (more_policies != 0) + policies = *more_policies; + + this->poa_ = root_poa->create_POA (name, + PortableServer::POAManager::_nil (), + policies + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + PortableServer::POAManager_var poa_manager = + this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +CORBA::Object_ptr +CIAO::Session_Container::install_servant (PortableServer::Servant p + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid + = this->poa_->activate_object (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var objref + = this->poa_->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return objref._retn (); +} + +CORBA::Object_ptr +CIAO::Session_Container::install_component (PortableServer::Servant p, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var id + = this->poa_->activate_object (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var objref + = this->poa_->id_to_reference (id.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + oid = id._retn (); + + return objref._retn (); +} + + +//@@ Apparently we need to be cautious when handling the exception +// thrown here. We should make sure that new DnC interfaces +// NodeApplication/NodeApplicationManager etc will cache the new +// exceptions--> rethrow of new exceptions is needed. +// --Tao +Components::CCMHome_ptr +CIAO::Session_Container::ciao_install_home (const char *exe_dll_name, + const char *exe_entrypt, + const char *sv_dll_name, + const char *sv_entrypt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Deployment::InstallationFailure)) +{ + + HomeFactory hcreator = 0; + ServantFactory screator = 0; + + if (this->static_config_flag_ == 0) + { + ACE_DLL executor_dll, servant_dll; + + if (exe_dll_name == 0 || sv_dll_name == 0) + ACE_THROW_RETURN (Deployment::UnknownImplId (), + Components::CCMHome::_nil ()); + + if (executor_dll.open (exe_dll_name, + ACE_DEFAULT_SHLIB_MODE, + 0) != 0 + || servant_dll.open (sv_dll_name, + ACE_DEFAULT_SHLIB_MODE, + 0) != 0) + { + ACE_THROW_RETURN (Deployment::UnknownImplId (), + Components::CCMHome::_nil ()); + } + + if (exe_entrypt == 0 || sv_entrypt == 0) + ACE_THROW_RETURN (Deployment::ImplEntryPointNotFound (), + Components::CCMHome::_nil ()); + + // @@ (OO) Please use a static_cast<> here instead of a C-style + // cast. ANSI C++ casts are the preferred (and modern) + // way of casting in ACE/TAO/CIAO. + hcreator = (HomeFactory) executor_dll.symbol (exe_entrypt); + screator = (ServantFactory) servant_dll.symbol (sv_entrypt); + } + else + { + if (static_entrypts_maps_ == 0 || + static_entrypts_maps_->home_creator_funcptr_map_ == 0 || + static_entrypts_maps_->home_servant_creator_funcptr_map_ == 0) + ACE_THROW_RETURN (Deployment::ImplEntryPointNotFound (), + Components::CCMHome::_nil ()); + + ACE_CString exe_entrypt_str (exe_entrypt); + static_entrypts_maps_->home_creator_funcptr_map_-> + find (exe_entrypt_str, hcreator); + + ACE_CString sv_entrypt_str (sv_entrypt); + static_entrypts_maps_->home_servant_creator_funcptr_map_-> + find (sv_entrypt_str, screator); + } + + if (hcreator == 0 || screator == 0) + ACE_THROW_RETURN (Deployment::ImplEntryPointNotFound (), + Components::CCMHome::_nil ()); + + Components::HomeExecutorBase_var home_executor = hcreator (); + if (CORBA::is_nil (home_executor.in ())) + ACE_THROW_RETURN (Deployment::InstallationFailure (), + Components::CCMHome::_nil ()); + + PortableServer::Servant home_servant = screator (home_executor.in (), + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (Components::CCMHome::_nil ()); + + if (home_servant == 0) + ACE_THROW_RETURN (Deployment::InstallationFailure (), + Components::CCMHome::_nil ()); + + PortableServer::ServantBase_var safe (home_servant); + + CORBA::Object_var objref = this->install_servant (home_servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (Components::CCMHome::_nil ()); + + Components::CCMHome_var homeref = + Components::CCMHome::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return homeref._retn (); + +} + +void +CIAO::Session_Container::ciao_uninstall_home (Components::CCMHome_ptr homeref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->uninstall (homeref + ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::Session_Container::uninstall (CORBA::Object_ptr objref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid + = this->poa_->reference_to_id (objref + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (oid.in () + ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::Session_Container::uninstall (PortableServer::Servant svt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid + = this->poa_->servant_to_id (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (oid.in () + ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::Session_Container::uninstall_component (Components::CCMObject_ptr objref, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var id + = this->poa_->reference_to_id (objref + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (id.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + oid = id._retn (); +} diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.h b/TAO/CIAO/DAnCE/ciao/Container_Base.h new file mode 100644 index 00000000000..fe25c4ab113 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.h @@ -0,0 +1,234 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Container_Base.h + * + * $Id$ + * + * Header file for CIAO's container implementations + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTAINER_BASE_H +#define CIAO_CONTAINER_BASE_H +#include /**/ "ace/pre.h" + +#include "tao/ORB.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/Servant_Base.h" +#include "CCM_ContainerC.h" +#include "Deployment_CoreC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * @class Container + * + * @brief Common container interface definition. + * + * Perhaps we can use local interface to define these interfaces as + * we will also get reference counting automatically. + */ + class CIAO_SERVER_Export Container + { + public: + Container (CORBA::ORB_ptr o); + + virtual ~Container (void) = 0; + + /// Get the containing POA. This operation does *NOT* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _ciao_the_POA (void); + + /// Get a reference to the underlying ORB. + virtual CORBA::ORB_ptr _ciao_the_ORB (void); + + /// Initialize the container with a name. + virtual int init (const char *name = 0, + const CORBA::PolicyList *more_policies = 0 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + + /// Install a new home + virtual Components::CCMHome_ptr ciao_install_home + (const char *exe_dll_name, + const char *exe_entrypt, + const char *sv_dll_name, + const char *sv_entrypt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Deployment::InstallationFailure)) = 0; + + // Uninstall a servant for component or home. + virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + + // Uninstall a servant for component. + virtual void uninstall_component (::Components::CCMObject_ptr objref, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + + protected: + CORBA::ORB_var orb_; + + PortableServer::POA_var poa_; + }; + + class Session_Container; + + typedef ::Components::HomeExecutorBase_ptr (*HomeFactory) (void); + typedef ::PortableServer::Servant (*ServantFactory) + (::Components::HomeExecutorBase_ptr p, + ::CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + HomeFactory, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> HOMECREATOR_FUNCPTR_MAP; + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + ServantFactory, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> HOMESERVANTCREATOR_FUNCPTR_MAP; + + struct Static_Config_EntryPoints_Maps + { + /// Map of home creator entry point name and func ptr + HOMECREATOR_FUNCPTR_MAP* home_creator_funcptr_map_; + + /// Map of home servant creator entry point name and func ptr + HOMESERVANTCREATOR_FUNCPTR_MAP* home_servant_creator_funcptr_map_; + }; + + class CIAO_SERVER_Export Session_Container : public Container + { + public: + + // @@ (OO) Does the static_config_flag really need to be an int? + // It appears to be a boolean value. Please use bool + // instead. + Session_Container (CORBA::ORB_ptr o, + int static_config_flag =0, + const Static_Config_EntryPoints_Maps* static_entrypts_maps =0 + ); + + virtual ~Session_Container (void); + + /// Initialize the container with a name. + virtual int init (const char *name = 0, + const CORBA::PolicyList *more_policies = 0 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /** + * @brief Simply installing a home executor into the component. + * + * This operation install a home executor into the component. It + * requires the name of the DLLs to executor and the servant glue + * code, and the entry points to the respective DLLs. Currently, + * we don't try to manage the lifetime of DLL objects, but we + * should at some later point. + * + * @retval Home objref of the installed home. + */ + virtual Components::CCMHome_ptr ciao_install_home + (const char *exe_dll_name, + const char *exe_entrypt, + const char *sv_dll_name, + const char *sv_entrypt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Deployment::InstallationFailure)); + + // Uninstall a servant for component or home. + virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Uninstall a servant for component. + virtual void uninstall_component (::Components::CCMObject_ptr objref, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Install a servant for component or home. + CORBA::Object_ptr install_servant (PortableServer::Servant p + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Install a component servant. + CORBA::Object_ptr install_component (PortableServer::Servant p, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Get an object reference to a component or home from the servant. + CORBA::Object_ptr get_objref (PortableServer::Servant p + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Uninstall a servant for component or home. + void uninstall (CORBA::Object_ptr objref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Uninstall a servant for component or home. + void uninstall (PortableServer::Servant svt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + long number_; + + static ACE_Atomic_Op <ACE_SYNCH_MUTEX, long> serial_number_; + + // @@ (OO) Does this really need to be an int? It appears to be a + // boolean value. Please use bool instead. + // + // It looks like it can also be declared const, as well. + int static_config_flag_; + const Static_Config_EntryPoints_Maps* static_entrypts_maps_; + }; +} + +// Macro for registration of an OBV factory in the generated +// servant class. Similar to the macro for TAO in +// tao/ValueType/ValueFactory.h but here we take advantage of +// the fact that we have access to the current ORB indirectly +// through the context and container. +#define CIAO_REGISTER_OBV_FACTORY(FACTORY, VALUETYPE) \ + { \ + CORBA::ValueFactory factory = new FACTORY; \ + CORBA::ORB_ptr orb = \ + this->context_->_ciao_the_Container ()->_ciao_the_ORB (); \ + CORBA::ValueFactory prev_factory = \ + orb->register_value_factory ( \ + VALUETYPE::_tao_obv_static_repository_id (), \ + factory); \ + CORBA::remove_ref (prev_factory); \ + CORBA::add_ref (factory); \ + } + +#if defined (__ACE_INLINE__) +# include "Container_Base.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* CIAO_CONTAINER_BASE_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.inl b/TAO/CIAO/DAnCE/ciao/Container_Base.inl new file mode 100644 index 00000000000..5435a481075 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.inl @@ -0,0 +1,10 @@ +// $Id$ -*- C++ -*- + +ACE_INLINE CORBA::Object_ptr +CIAO::Session_Container::get_objref (PortableServer::Servant p + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->_ciao_the_POA ()->servant_to_reference (p + ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.pidl b/TAO/CIAO/DAnCE/ciao/Container_Base.pidl new file mode 100644 index 00000000000..e698ea66b45 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.pidl @@ -0,0 +1,33 @@ +// $Id$ + +/** + * CIAO's internal container interface definitions. + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CONTAINER_BASE_PIDL) +#define CONTAINER_BASE_PIDL + +#include "CIAO_Component.pidl" +#include <SecurityLevel2.idl> +#include "CIAO_Transaction.pidl" + +// *************** Basic Container interfaces *************** + +module CIAO +{ + typeprefix Components "wustl.edu"; + + local interface Container + { + // Return the POA + PortableServer::POA the_POA (); + }; + + local interface SessionContainer + { + + }; +}; +#endif /* CONTAINER_BASE_PIDL */ diff --git a/TAO/CIAO/DAnCE/ciao/Cookies.cpp b/TAO/CIAO/DAnCE/ciao/Cookies.cpp new file mode 100644 index 00000000000..4a319577be4 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Cookies.cpp @@ -0,0 +1,74 @@ +// $Id$ +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +#include "Cookies.inl" +#endif /* !defined INLINE */ + +ACE_RCSID (ciao, + Cookies, + "$Id$") + +namespace CIAO +{ + Map_Key_Cookie::Map_Key_Cookie (const ACE_Active_Map_Manager_Key &key) + { + this->cookieValue ().length (ACE_Active_Map_Manager_Key::size ()); + key.encode (this->cookieValue ().get_buffer (0)); + } + + Map_Key_Cookie::~Map_Key_Cookie (void) + { + } + + bool + Map_Key_Cookie::insert (ACE_Active_Map_Manager_Key &key) + { + this->cookieValue ().length (ACE_Active_Map_Manager_Key::size ()); + key.encode (this->cookieValue ().get_buffer (0)); + return true; + } + + bool + Map_Key_Cookie::extract (::Components::Cookie *ck, + ACE_Active_Map_Manager_Key &key) + { + Map_Key_Cookie *c = + dynamic_cast <Map_Key_Cookie *> (ck); + + if (c == 0) + return false; + + ::CORBA::OctetSeq *x = c->get_cookie (); + + if (x->length () != ACE_Active_Map_Manager_Key::size ()) + return false; + + key.decode (x->get_buffer ()); + + return true; + } + + ::CORBA::OctetSeq * + Map_Key_Cookie::get_cookie (void) + { + return &this->cookieValue (); + } + + //======================================================== + CORBA::ValueBase * + Map_Key_Cookie_init::create_for_unmarshal (ACE_ENV_SINGLE_ARG_DECL) + { + CORBA::ValueBase *ret_val = 0; + + ACE_NEW_THROW_EX (ret_val, + CIAO::Map_Key_Cookie, + CORBA::NO_MEMORY ()); + + // @@ (OO) An "ACE_CHECK_RETURN (0) is missing here. + + return ret_val; + } + + +} diff --git a/TAO/CIAO/DAnCE/ciao/Cookies.h b/TAO/CIAO/DAnCE/ciao/Cookies.h new file mode 100644 index 00000000000..dd4f11407a8 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Cookies.h @@ -0,0 +1,75 @@ +// $Id$ + +/** + * @file Cookies.h + * + * A CIAO implementation of Cookie valuetype. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_COOKIES_H +#define CIAO_COOKIES_H +#include /**/ "ace/pre.h" + +#include "CCM_BaseC.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Container_Export.h" +#include "CIAO_ValueC.h" +#include "ace/Active_Map_Manager.h" + +namespace CIAO +{ + /** + * @class Map_Key_Cookie + * + * @brief A internal cookie valuetype implementation. + */ + class CIAO_CONTAINER_Export Map_Key_Cookie + : public virtual OBV_Components::Cookie + { + public: + Map_Key_Cookie (void); + + virtual ~Map_Key_Cookie (void); + + /// Initialize a @c Cookie with an @c ACE_Active_Map_Manager_Key + Map_Key_Cookie (const ACE_Active_Map_Manager_Key &key); + + /// Insert the @c ACE_Active_Map_Manager_Key + bool insert (ACE_Active_Map_Manager_Key &key); + + /// Operation on the valuetype + CORBA::OctetSeq * get_cookie (void); + + /// Extract the @c ACE_Active_Map_Manager_Key + static bool extract (::Components::Cookie *c, + ACE_Active_Map_Manager_Key &key); + }; + + /** + * @class Map_Key_Cookie_init + * + * @brief Valuefactory implementation for Cookies. + */ + class CIAO_CONTAINER_Export Map_Key_Cookie_init : + public virtual ::Components::Cookie_init + { + public: + virtual ~Map_Key_Cookie_init (void); + + virtual CORBA::ValueBase *create_for_unmarshal (ACE_ENV_SINGLE_ARG_DECL); + }; +} + +#if defined (__ACE_INLINE__) +#include "Cookies.inl" +#endif /* !defined INLINE */ + +#include /**/ "ace/post.h" +#endif /* CIAO_COOKIES_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Cookies.inl b/TAO/CIAO/DAnCE/ciao/Cookies.inl new file mode 100644 index 00000000000..e4d89f595c7 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Cookies.inl @@ -0,0 +1,16 @@ +/* -*- C++ -*- */ +// $Id$ + +namespace CIAO +{ + ACE_INLINE + Map_Key_Cookie::Map_Key_Cookie (void) + { + } + + // ======================================== + ACE_INLINE + Map_Key_Cookie_init::~Map_Key_Cookie_init () + { + } +} diff --git a/TAO/CIAO/DAnCE/ciao/CosPersistentState.idl b/TAO/CIAO/DAnCE/ciao/CosPersistentState.idl new file mode 100644 index 00000000000..64f127539e2 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CosPersistentState.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @@ This is just a temporary file. Since TAO does not have + * CosPersistentState at all, we use this file to define + * types necessary to get ComponentBase.idl to compile. + * + * Compile with + * tao_idl -Gv CosPersistentState.idl + */ + +#if !defined (CIAO_COSPERSISTENTSTATE_PIDL) +#define CIAO_COSPERSISTENTSTATE_PIDL + +module CosPersistentState { + local interface CatalogBase + { + }; + + typedef sequence<octet> _TypeId; + typedef string Pid; +}; +#endif /* CIAO_COSPERSISTENTSTATE_PIDL */ diff --git a/TAO/CIAO/DAnCE/ciao/Deployment.idl b/TAO/CIAO/DAnCE/ciao/Deployment.idl new file mode 100644 index 00000000000..a690f64561e --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Deployment.idl @@ -0,0 +1,535 @@ +// $Id$ +#include <orb.idl> +#include "tao/ULongSeq.pidl" +#include "Deployment_Core.idl" + +module Deployment { + + enum SatisfierPropertyKind { + Quantity, + Capacity, + Minimum, + Maximum, + _Attribute, + Selection + }; + + struct SatisfierProperty { + string name; + SatisfierPropertyKind kind; + any value; + }; + + typedef sequence < SatisfierProperty > SatisfierProperties; + + struct SharedResource { + string name; + ::CORBA::StringSeq resourceType; + ::CORBA::ULongSeq nodeRef; + SatisfierProperties property; + }; + + typedef sequence < SharedResource > SharedResources; + + struct Resource { + string name; + ::CORBA::StringSeq resourceType; + SatisfierProperties property; + }; + + typedef sequence < Resource > Resources; + + 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; + }; + + 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 Requirement { + string resourceType; + string name; + Properties property; + }; + + typedef sequence < Requirement > Requirements; + + 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; + any resourceValue; + }; + + typedef sequence < InstanceResourceDeploymentDescription > InstanceResourceDeploymentDescriptions; + + struct InstanceDeploymentDescription { + string name; + string node; + ::CORBA::StringSeq source; + unsigned long implementationRef; + Properties configProperty; + InstanceResourceDeploymentDescriptions deployedResource; + InstanceResourceDeploymentDescriptions deployedSharedResource; + }; + + typedef sequence < InstanceDeploymentDescription > InstanceDeploymentDescriptions; + + struct ComponentExternalPortEndpoint { + string portName; + }; + + typedef sequence < ComponentExternalPortEndpoint > ComponentExternalPortEndpoints; + + struct PlanSubcomponentPortEndpoint { + string portName; + boolean provider; + CCMComponentPortKind kind; + unsigned long instanceRef; + }; + + typedef sequence < PlanSubcomponentPortEndpoint > PlanSubcomponentPortEndpoints; + + struct ExternalReferenceEndpoint { + string location; + }; + + typedef sequence < ExternalReferenceEndpoint > ExternalReferenceEndpoints; + + struct ConnectionResourceDeploymentDescription { + string targetName; + string requirementName; + string resourceName; + any resourceValue; + }; + + 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; + any resourceValue; + }; + + 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; + + struct DeploymentPlan { + string label; + string UUID; + ComponentInterfaceDescription realizes; + MonolithicDeploymentDescriptions implementation; + InstanceDeploymentDescriptions instance; + PlanConnectionDescriptions connection; + PlanPropertyMappings externalProperty; + ImplementationDependencies dependsOn; + ArtifactDeploymentDescriptions artifact; + Properties infoProperty; + }; + + exception ResourceNotAvailable { + string name; + string resourceType; + string propertyName; + string elementName; + string resourceName; + }; + + exception PlanError { + string name; + string reason; + }; + + enum DomainUpdateKind { + Add, + Delete, + UpdateAll, + UpdateAvailable + }; + + interface TargetManager { + Domain getAllResources (); + Domain getAvailableResources (); + void commitResources (in DeploymentPlan plan) + raises (ResourceNotAvailable, PlanError); + void releaseResources (in DeploymentPlan argname); + void updateDomain (in ::CORBA::StringSeq elements, in Domain domainSubset, in DomainUpdateKind updateKind); + }; + + exception InvalidProperty { + string name; + string reason; + }; + + exception StopError { + string name; + string reason; + }; + + interface ApplicationManager { + Application startLaunch (in Properties configProperty, out Connections providedReference, in boolean start) + raises (ResourceNotAvailable, StartError, InvalidProperty); + void destroyApplication (in Application app) + raises (StopError); + }; + + typedef sequence < Application > Applications; + + interface DomainApplicationManager + { + DeploymentPlan getPlan (); + void startLaunch (in Properties configProperty, in boolean start) + raises (ResourceNotAvailable, StartError, InvalidProperty); + void finishLaunch (in boolean start) + raises (StartError, InvalidConnection); + void start () + raises (StartError); + void destroyApplication () + raises (StopError); + }; + + typedef sequence < DomainApplicationManager > DomainApplicationManagers; + + interface ExecutionManager { + DomainApplicationManager preparePlan (in DeploymentPlan plan, in boolean commitResources) + raises (ResourceNotAvailable, PlanError, StartError); + DomainApplicationManagers getManagers (); + void destroyManager (in DomainApplicationManager manager) + raises (StopError); + }; + + interface Logger { + }; + + interface NodeApplicationManager : + ApplicationManager + { + }; + + interface NodeManager { + void joinDomain (in Domain domain, in TargetManager manager, in Logger log); + void leaveDomain (); + NodeApplicationManager preparePlan (in DeploymentPlan plan) + raises (StartError, PlanError); + void destroyManager (in NodeApplicationManager appManager) + raises (StopError); + }; + + exception NameExists { + }; + + exception PackageError { + string source; + string reason; + }; + + exception NoSuchName { + }; + + exception LastConfiguration { + }; + + exception InvalidReference { + }; + + struct PackageConfiguration; + + typedef sequence < PackageConfiguration > PackageConfigurations; + + struct ComponentPackageDescription; + + typedef sequence < ComponentPackageDescription > ComponentPackageDescriptions; + + struct ComponentPackageReference { + string requiredUUID; + string requiredName; + string requiredType; + }; + + typedef sequence < ComponentPackageReference > ComponentPackageReferences; + + struct SubcomponentInstantiationDescription { + string name; + ComponentPackageDescriptions package; + Properties configProperty; + Requirements selectRequirement; + ComponentPackageReferences reference; + }; + + 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 ComponentAssemblyDescription { + SubcomponentInstantiationDescriptions instance; + AssemblyConnectionDescriptions connection; + AssemblyPropertyMappings externalProperty; + }; + + typedef sequence < ComponentAssemblyDescription > ComponentAssemblyDescriptions; + + 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; + }; + + typedef sequence < ResourceUsageKind > ResourceUsageKinds; + + struct ImplementationRequirement { + ResourceUsageKinds resourceUsage; + string resourcePort; + string componentPort; + string resourceType; + string name; + Properties property; + }; + + typedef sequence < ImplementationRequirement > ImplementationRequirements; + + struct MonolithicImplementationDescription { + Properties execParameter; + NamedImplementationArtifacts primaryArtifact; + ImplementationRequirements deployRequirement; + }; + + typedef sequence < MonolithicImplementationDescription > MonolithicImplementationDescriptions; + + struct Capability { + string name; + ::CORBA::StringSeq resourceType; + SatisfierProperties property; + }; + + typedef sequence < Capability > Capabilities; + + 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; + PackageConfigurations specializedConfig; + ComponentPackageDescriptions basePackage; + ComponentPackageReferences reference; + Requirements selectRequirement; + Properties configProperty; + }; + + interface RepositoryManager { + void installPackage (in string installationName, in string location) + 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); + }; + + struct RequirementSatisfier { + string name; + ::CORBA::StringSeq resourceType; + SatisfierProperties property; + }; +}; diff --git a/TAO/CIAO/DAnCE/ciao/Deployment_Core.idl b/TAO/CIAO/DAnCE/ciao/Deployment_Core.idl new file mode 100644 index 00000000000..6dac65c2fda --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Deployment_Core.idl @@ -0,0 +1,183 @@ +// $Id$ + +#if !defined (DEPLOYMENT_CORE_IDL) +#define DEPLOYMENT_CORE_IDL + +#include "CCM_Component.idl" + +// *************** Packaging and Deployment *************** +module Deployment +{ + // Typeprefix Components "omg.org"; + // OMG threw these things away, didn't it. + + exception UnknownImplId {}; + exception InvalidLocation {}; + exception InstallationFailure {/*Do we still need a reason? --Tao*/}; + exception ImplEntryPointNotFound {}; + + //Below are from the OMG Deployment.idl + + exception StartError { + string name; + string reason; + }; + + exception InvalidConnection { + string name; + string reason; + }; + //==============property================== + struct Property { + string name; + any value; + }; + typedef sequence < Property > Properties; + + //============connection================== + + typedef sequence < Object > Endpoints; + //typedef Object Endpoint; + + enum CCMComponentPortKind { + Facet, + SimplexReceptacle, + MultiplexReceptacle, + EventEmitter, + EventPublisher, + EventConsumer + }; + + // To avoid the connection info in the plan being passed to the + // local node and to make the implementation not very cumbersome + // I changed the connection struct to include some extra informations. + struct Connection { + string instanceName; + string portName; + CCMComponentPortKind kind; + + // the endpoints member is change to endpoint. + // Since we will not have more than 1 objref in there. + Object endpoint; + }; + typedef sequence < Connection > Connections; + + //======================================= + struct ImplementationInfo + { + string component_instance_name; + string executor_dll; + string executor_entrypt; + string servant_dll; + string servant_entrypt; + Properties component_config; + // Properties home_config; //ignored for now. + // Properties container_config //igore for now + }; + + typedef sequence < ImplementationInfo > ImplementationInfos; + + //================================== + interface Application + { + void finishLaunch (in Connections providedReference, in boolean start) + raises (StartError, InvalidConnection); + void start () + raises (StartError); + }; + + struct Component_Info + { + string component_instance_name; + Components::CCMObject component_ref; + }; + + typedef sequence < Component_Info > ComponentInfos; + + // @@ (OO) Tao, you're altering an OMG defined interface below. In + // order to avoid confusion, it is probably better to create + // another NodeApplication interface in the CIAO namespace + // that inherits from Deployment::NodeApplication. You'd + // then use the CIAO::NodeApplication in your + // implementation. + // + // Alternatively, you should at least place a CIAO-specific + // typeprefix within your altered NodeApplication interface + // to prevent interoperability issues. + + // This NodeApplication contains the semantic from both Container and + // the new DnC NodeApplication --Tao + interface NodeApplication : Application + { + readonly attribute ::Deployment::Properties properties; + + /*@@ This operation is added for the NodeApplicationManager to + * initialize the NodeApplication after creating it. The + * properties are those for the Container and they will be + * implemented upon request from our users. --Tao + * + * Seems Kitty is opposing the idea of sending anys around. But + * what really stroke me down was that OMG is working out + * another property&configuration specification so all the + * properties we set/used might have to be thrown away in the + * future.....I am totally speachless and confused...and + * frustrated. + * + * But any way seems I can forget about the configuration + * now. --Tao + */ + + // @@ Initialize the nodeapplication, so it will know what + // components it will create and home many of them are + // there. However the real create action will take place when + // start launch is called on NodeApplicationManager. + long init (); + + // @@ This operation will be called by NodeApplicationManager + // client to really start to create homes and components. + ComponentInfos install (in ImplementationInfos impl_infos) + raises (UnknownImplId, + ImplEntryPointNotFound, + InstallationFailure, + ::Components::InvalidConfiguration); + + + //@@ We know that Dployment::NodeApplicationManager will be returned, + // however to avoid the size of the shared object of CIAO_Server. + // we return an Object. + Object get_node_application_manager (); + + //@@ The properties will contain + //1 component instance name as the key. + //2 dll/so name of the exec + //3 entry point of the exec + //4 dll/so name of the svnt + //5 entry point of the svnt + //6 Poosible other configuration for container/home/component + //Note:: We have to decide later how container/home/component could be configured. + // These properties could be passed in here or at higher level + // according to the plan(@ NodeApplicationManager/NodeApplication?) + // + //The reason that I want to expose these operation in IDL (can be called remotely) + //is 1. for easy testing. + // 2. Might comes in handy in the future. + // --Tao + ::Components::CCMHome install_home (in ImplementationInfo impl_info) + raises (UnknownImplId, + ImplEntryPointNotFound, + InstallationFailure, + ::Components::InvalidConfiguration); + + void remove_home (in string comp_ins_name) + raises (::Components::RemoveFailure); + + ::Components::CCMHomes get_homes (); + + void remove () + raises (::Components::RemoveFailure); + + + }; + +}; +#endif /* DEPLOYMENT_CORE_IDL */ diff --git a/TAO/CIAO/DAnCE/ciao/Deployment_stub_export.h b/TAO/CIAO/DAnCE/ciao/Deployment_stub_export.h new file mode 100644 index 00000000000..12985a68b5b --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/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/TAO/CIAO/DAnCE/ciao/Deployment_svnt_export.h b/TAO/CIAO/DAnCE/ciao/Deployment_svnt_export.h new file mode 100644 index 00000000000..e403dbf0c41 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/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/TAO/CIAO/DAnCE/ciao/NodeApp_CB_Impl.cpp b/TAO/CIAO/DAnCE/ciao/NodeApp_CB_Impl.cpp new file mode 100644 index 00000000000..436f4bbadcf --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/NodeApp_CB_Impl.cpp @@ -0,0 +1,70 @@ +// $Id$ +#include "NodeApp_CB_Impl.h" + +CIAO::NodeApplication_Callback_Impl:: +NodeApplication_Callback_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Deployment::NodeApplicationManager_ptr s, + const Deployment::Properties &properties + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + nam_ (Deployment::NodeApplicationManager::_duplicate (s)) +{ + ACE_TRY + { + //@@ Note: this properties is useless unless + // we have some specific properties for the callback obj. + Deployment::Properties * tmp = 0; + ACE_NEW_THROW_EX (tmp, + Deployment::Properties (properties), + CORBA::NO_MEMORY ()); + ACE_TRY_CHECK; + this->properties_ = tmp; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "NodeApp_CB_Impl::Constructor\t\n"); + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK; +} + +CIAO::NodeApplication_Callback_Impl::~NodeApplication_Callback_Impl () +{ +} + +PortableServer::POA_ptr +CIAO::NodeApplication_Callback_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +Deployment::NodeApplicationManager_ptr +CIAO::NodeApplication_Callback_Impl::register_node_application ( + Deployment::NodeApplication_ptr na, + Deployment::Properties_out properties + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + properties = this->properties_._retn (); + + this->nodeapp_ = Deployment::NodeApplication::_duplicate (na); + return Deployment::NodeApplicationManager::_duplicate (this->nam_.in ()); +} + +Deployment::NodeApplication_ptr +CIAO::NodeApplication_Callback_Impl::get_nodeapp_ref (void) +{ + // @@ (OO) How are you relinquishing ownership here? Since you're + // duplicating the reference you actually maintain + // ownership. Is the below comment wrong, or is the code + // wrong? + + // Relinquish the ownership of the nodeapplication reference. + //This method should only be called from the NodeApplicationManager. + return Deployment::NodeApplication::_duplicate (this->nodeapp_.in ()); +} diff --git a/TAO/CIAO/DAnCE/ciao/NodeApp_CB_Impl.h b/TAO/CIAO/DAnCE/ciao/NodeApp_CB_Impl.h new file mode 100644 index 00000000000..24762483cc2 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/NodeApp_CB_Impl.h @@ -0,0 +1,89 @@ +// -*- C++ -*- +// $Id$ +//============================================================================= +/** + * @file NodeApp_CB_Impl.h + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + * Tao Lu <lu@dre.vanderbilt.edu> + * + //===========================================================================*/ + + +#ifndef NODEAPPLICATION_CALLBACK_IMPL_H +#define NODEAPPLICATION_CALLBACK_IMPL_H +#include /**/ "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "NodeApplication_CallBackS.h" + +namespace CIAO +{ + // Forward declaration. + // class NodeApplicationManager; + + /** + * @class NodeApplication_Callback_Impl + * + * @brief A call back interface for NodeApplication + * @Note Here is no need to be thread safe since for every nodeapplication + * we will have an unique callback object. --Tao + */ + class Deployment_svnt_Export NodeApplication_Callback_Impl + : public virtual POA_CIAO::NodeApplication_Callback, + public virtual PortableServer::RefCountServantBase + { + public: + friend class NodeApplicationManager_Impl; + + /// Constructor. + NodeApplication_Callback_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Deployment::NodeApplicationManager_ptr s, + const Deployment::Properties &properties + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // @@ (OO) Since this class is reference counted, please make this + // destructor protected to enforce proper memory managment + // through the reference counting mechanism (i.e. to + // disallow calling operator delete() on an instance of + // this class. + /// Destructor. + ~NodeApplication_Callback_Impl (); + + /// Get the containing POA. This operation does *not* increase + /// the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// Record the NodeApplication reference returned by the newly + /// spawned NodeApplication and give it back a reference to + /// NodeApplicationManager + Deployment::NodeApplicationManager_ptr + register_node_application (Deployment::NodeApplication_ptr na, + Deployment::Properties_out properties + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + Deployment::NodeApplication_ptr get_nodeapp_ref (void); + + CORBA::ORB_var orb_; + + PortableServer::POA_var poa_; + + Deployment::NodeApplicationManager_var nam_; + + Deployment::NodeApplication_var nodeapp_; + + Deployment::Properties_var properties_; + }; +} + +#include /**/ "ace/post.h" +#endif /* NODEAPPLICATION_CALLBACK_IMPL_H */ diff --git a/TAO/CIAO/DAnCE/ciao/NodeApplication_CallBack.idl b/TAO/CIAO/DAnCE/ciao/NodeApplication_CallBack.idl new file mode 100644 index 00000000000..9c4f1d14775 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/NodeApplication_CallBack.idl @@ -0,0 +1,22 @@ +// $Id$ + +/** + * This IDL file is used to combine the NodeApplication + * interface with the NodeApplicationManager interface. + * + * NodeApplicationManager will be spwan NodeApplication. + * The call back object will be used to get the objectref of + * NodeApplication. + */ + +#include "Deployment.idl" + +module CIAO +{ + interface NodeApplication_Callback + { + Deployment::NodeApplicationManager + register_node_application (in Deployment::NodeApplication na, + out Deployment::Properties properties); + }; +}; diff --git a/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.cpp b/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.cpp new file mode 100644 index 00000000000..df60f15873d --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.cpp @@ -0,0 +1,548 @@ +//$Id$ + +#include "NodeApplication_Impl.h" + +#if !defined (__ACE_INLINE__) +# include "NodeApplication_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::NodeApplication_Impl::~NodeApplication_Impl () +{ + delete this->container_; +} + +void +CIAO::NodeApplication_Impl:: +finishLaunch (const Deployment::Connections & providedReference, + CORBA::Boolean start + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError, + Deployment::InvalidConnection)) +{ + const CORBA::ULong length = providedReference.length (); + + ACE_TRY + { + // For every connection struct we finish the connection. + for (CORBA::ULong i = 0; i < length; ++i) + { + ACE_CString name = providedReference[i].instanceName.in (); + Components::CCMObject_ptr comp; + + if (this->component_map_.find (name, comp) != 0) + { + ACE_THROW (Deployment::InvalidConnection ()); + } + + Components::EventConsumerBase_var consumer; + //Since we know CCMObject inherits from navigation/event/receptacle, no need + //to narrow here. + switch (providedReference[i].kind) + { + case Deployment::SimplexReceptacle: + comp->connect (providedReference[i].portName.in (), + providedReference[i].endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + break; + + case Deployment::MultiplexReceptacle: + comp->connect(providedReference[i].portName.in (), + providedReference[i].endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + break; + + case Deployment::EventEmitter: + consumer = Components::EventConsumerBase:: + _narrow (providedReference[i].endpoint.in () + ACE_ENV_ARG_PARAMETER); + + ACE_CHECK; + if (CORBA::is_nil (consumer.in ())) + { + ACE_THROW (Deployment::InvalidConnection ()); + } + + comp->connect_consumer(providedReference[i].portName.in (), + consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + break; + + case Deployment::EventPublisher: + consumer = Components::EventConsumerBase:: + _narrow (providedReference[i].endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + if (CORBA::is_nil (consumer.in ())) + ACE_THROW (Deployment::InvalidConnection ()); + + comp->subscribe (providedReference[i].portName.in (), + consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + break; + + default: + ACE_THROW (Deployment::InvalidConnection ()); + } + } + if (start) + { + this->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "NodeApplication_Impl::finishLaunch\t\n"); + ACE_RE_THROW; + } + + ACE_ENDTRY; +} + +void +CIAO::NodeApplication_Impl:: +start (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)) +{ + //@@ Note: set_session_context will be called when the servant is created. + Funct_Ptr functor = & Components::CCMObject::ciao_preactivate; + start_i (functor ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + functor = & Components::CCMObject::ciao_activate; + start_i (functor ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + functor = & Components::CCMObject::ciao_postactivate; + start_i (functor ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +CIAO::NodeApplication_Impl:: +start_i (Funct_Ptr functor + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)) +{ + const Component_Iterator end (this->component_map_.end ()); + for (Component_Iterator iter (this->component_map_.begin ()); + iter != end; + ++iter) + { + //@@ I don't know what if Components::InvalidConfiguration + // is thrown from here, so it's ignored for now. --Tao + (((*iter).int_id_)->*functor) (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } +} + +::Deployment::Properties * +CIAO::NodeApplication_Impl:: +properties (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + Deployment::Properties * tmp; + + ACE_NEW_THROW_EX (tmp, + Deployment::Properties (this->properties_), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + return tmp; +} + +::Deployment::ComponentInfos * +CIAO::NodeApplication_Impl:: +install (const ::Deployment::ImplementationInfos & impl_infos + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Deployment::InstallationFailure, + Components::InvalidConfiguration)) +{ + Deployment::ComponentInfos_var retv; + ACE_TRY + { + Deployment::ComponentInfos * tmp; + ACE_NEW_THROW_EX (tmp, + Deployment::ComponentInfos, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + retv = tmp; + + const CORBA::ULong len = impl_infos.length (); + + retv->length (len); + + // @@ (OO) There is no need to declare these variables outside of + // the loop. Some folks doing so is an optimization but + // doing so generally defeats some compiler optimizations. + // Please move these declaration within the loop. + Components::CCMHome_var home; + Components::CCMObject_var comp; + + for (CORBA::ULong i = 0; i < len; ++i) + { + home = this->install_home (impl_infos[i] + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Components::KeylessCCMHome_var kh = + Components::KeylessCCMHome::_narrow (home.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (kh.in ())) + ACE_THROW_RETURN (Deployment::InstallationFailure (), 0); + + // @@ Note, here we are missing the CreateFailure. + // Sometime I will come back to add exception rethrow. + comp = kh->create_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (this->component_map_.bind (impl_infos[i].component_instance_name.in (), + Components::CCMObject::_duplicate (comp.in ()))) + ACE_THROW_RETURN (Deployment::InstallationFailure (), 0); + + // Set the return value. + (*retv)[i].component_instance_name + = impl_infos[i].component_instance_name.in (); + + (*retv)[i].component_ref = Components::CCMObject::_duplicate (comp.in ()); + + // Deal with Component instance related Properties. + // Now I am only concerning about the COMPOENTIOR and here is only + // the hardcoded version of the configuration. Hopefully we will + // reach an agreement after the RTWS about how the configuration + // should be done. + + const CORBA::ULong clen = impl_infos[i].component_config.length (); + for (CORBA::ULong prop_len = 0; prop_len < clen; ++prop_len) + { + if (ACE_OS::strcmp (impl_infos[i].component_config[prop_len].name.in (), + "ComponentIOR") == 0) + { + if (CIAO::debug_level () > 1) + ACE_DEBUG ((LM_DEBUG, "Found property to write the IOR.\n")); + const char * path; + impl_infos[i].component_config[prop_len].value >>= path; + + CORBA::String_var ior = + this->orb_->object_to_string (comp.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (write_IOR (path, ior.in ()) != 0) + { + if (CIAO::debug_level () > 1) + ACE_DEBUG ((LM_DEBUG, "Failed to write the IOR.\n")); + ACE_THROW (CORBA::INTERNAL ()); + } + + } + } + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "CIAO_NodeApplication::install error\t\n"); + ACE_RE_THROW; + return 0; + } + ACE_ENDTRY; + return retv._retn (); +} + +// @@ (OO) Method definitions should never use "_WITH_DEFAULTS" +// versions of emulated exception parameters. Please remove +// the "_WITH_DEFAULTS" +::Components::CCMHome_ptr +CIAO::NodeApplication_Impl:: +install_home (const ::Deployment::ImplementationInfo & impl_info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Deployment::InstallationFailure, + Components::InvalidConfiguration)) +{ + Components::CCMHome_var newhome = + this->container_->ciao_install_home + (impl_info.executor_dll.in (), + impl_info.executor_entrypt.in (), + impl_info.servant_dll.in (), + impl_info.servant_entrypt.in () + ACE_ENV_ARG_PARAMETER); + + ACE_CHECK_RETURN (Components::CCMHome::_nil ()); + // We don't have to do _narrow since the generated code makes sure of + // the object type for us + + // Bind the home in the map. + if (this->home_map_.bind (impl_info.component_instance_name.in (), + Components::CCMHome::_duplicate (newhome.in ()))) + ACE_THROW_RETURN (Deployment::InstallationFailure (), + Components::CCMHome::_nil ()); + + //Note: If the return value will be discarded, it must be kept in a var or + // release () will have to be called explicitly. + return newhome._retn (); +} + +// @@ (OO) Method definitions should never use "_WITH_DEFAULTS" +// versions of emulated exception parameters. Please remove +// the "_WITH_DEFAULTS" +void +CIAO::NodeApplication_Impl:: +remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // Remove all components first. + remove_components (); + + ACE_CHECK; + + // Even if above op failed we should still remove homes. + const Home_Iterator end (this->home_map_.end ()); + for (Home_Iterator iter (this->home_map_.begin ()); + iter != end; + ++iter) + { + this->container_->ciao_uninstall_home ( (*iter).int_id_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::release ( (*iter).int_id_); + } + + this->home_map_.unbind_all (); + + if (CIAO::debug_level () > 1) + ACE_DEBUG ((LM_DEBUG, "Shutting down this NodeApplication!\n")); + + this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::NodeApplication_Impl:: +remove_home (const char * comp_ins_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + Components::CCMHome_ptr home; + ACE_CString str (comp_ins_name); + + if (this->home_map_.find (str, home) != 0) + ACE_THROW (CORBA::BAD_PARAM ()); + + // We should remove all components created by this home as well. + // This is not implemented yet. + + this->container_->ciao_uninstall_home (home + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // If the previous calls failed, what should we do here?? + CORBA::release (home); + + // @@ Still need to remove the home if the previous operation fails? + if (this->home_map_.unbind (str) == -1) + ACE_THROW (::Components::RemoveFailure ()); +} + +Components::CCMHomes * +CIAO::NodeApplication_Impl:: +get_homes (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + Components::CCMHomes * tmp; + ACE_NEW_THROW_EX (tmp, + Components::CCMHomes (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + Components::CCMHomes_var retval (tmp); + + // @@ (OO) Please declare len as "const". + CORBA::ULong len = this->home_map_.current_size (); + retval->length (len); + + + CORBA::ULong i = 0; + const Home_Iterator end = this->home_map_.end (); + for (Home_Iterator iter (this->home_map_.begin ()); + iter != end; + ++iter, ++i) + { + retval[i] = Components::CCMHome::_duplicate ( (*iter).int_id_); + } + + return retval._retn (); +} + +CORBA::Long +CIAO::NodeApplication_Impl:: +init (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_NEW_THROW_EX (this->container_, + CIAO::Session_Container (this->orb_.in (), + 0, + 0), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (-1); + + return this->container_->init (0, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + return 0; +} + +::CORBA::Object_ptr +CIAO::NodeApplication_Impl:: +get_node_application_manager (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::CORBA::Object::_duplicate (this->node_app_manager_.in ()); +} + + +PortableServer::POA_ptr +CIAO::NodeApplication_Impl:: +_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +void +CIAO::NodeApplication_Impl:: +remove_components (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + //Remove all the components in the NodeApplication/Container + // Release all component servant object. + const Component_Iterator end (this->component_map_.end ()); + for (Component_Iterator iter (this->component_map_.begin ()); + iter != end; + ++iter) + { + Components::CCMHome_ptr home; + if (this->home_map_.find ( (*iter).ext_id_, home) != 0) + ACE_THROW (CORBA::BAD_PARAM ()); + + // This will call ccm_passivate on the component executor. + home->remove_component ((*iter).int_id_); + ACE_CHECK; + + CORBA::release ( (*iter).int_id_); + } + + this->component_map_.unbind_all (); + // To this point the servant should have been destroyed. However, + // if someone is still making calls on the servant, terrible thing + // will happen. +} + +void +CIAO::NodeApplication_Impl:: +remove_component (const char * comp_ins_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + Components::CCMObject_ptr comp; + Components::CCMHome_ptr home; + + ACE_CString str (comp_ins_name); + + /* Before we do remove component we have to inform the homeservant so + * Component::ccm_passivate () + * constainer::ninstall_component () ->deactivate_object () will be called. + * + * ccm_remove will be called when the poa destroys the servant. + */ + + if (this->component_map_.find (str, comp) != 0) + ACE_THROW (CORBA::BAD_PARAM ()); + + if (this->home_map_.find (str, home) != 0) + ACE_THROW (CORBA::BAD_PARAM ()); + + // This will call ccm_passivate on the component executor. + home->remove_component (comp); + ACE_CHECK; + + // If the previous calls failed, what should we do here?? + CORBA::release (comp); + + // @@ Still need to remove the home if the previous operation fails? + if (this->component_map_.unbind (str) == -1) + ACE_THROW (::Components::RemoveFailure ()); +} + +// The code below is obsolete now. However I want to keep it arround as a +// start point for configurations. +/* +void +CIAO::NodeApplication_Impl:: +parse_config_values (const ::Deployment::Properties & properties, + struct home_installation_info &component_install_info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Components::InvalidConfiguration)) +{ + + for (CORBA::ULong i = 0; i < properties.length(); ++i) + { + // Place holder for string values + const char * str = 0; + const char * name = properties[i].name.in(); + + // I assume the property will be given in the following format! --Tao + if (ACE_OS::strcmp (name, "CIAO-servant-location")) + { + properties[i].value >>= str; + component_install_info.servant_dll_= str; //deep copy happens here. + } + else if (ACE_OS::strcmp (name, "CIAO-servant-entryPoint")) + { + properties[i].value >>= str; + component_install_info.servant_entrypt_= str; //deep copy happens here. + } + else if (ACE_OS::strcmp (name, "CIAO-executor-location")) + { + properties[i].value >>= str; + component_install_info.executor_dll_= str; //deep copy happens here. + } + else if (ACE_OS::strcmp (name, "CIAO-executor-entryPoint")) + { + properties[i].value >>= str; + component_install_info.executor_entrypt_= str; //deep copy happens here. + } + else + { + ACE_DEBUG ((LM_DEBUG, "Found unrecognized property: %s\n",name)); + //I should put the name of the configuration inside of the exception. --Tao + ACE_THROW (Components::InvalidConfiguration ()); + } + } + + // We don't need to worry about the case when some info is missing since + // the modeling tool will ensure the complete info to presented in the properties. +} +*/ diff --git a/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.h b/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.h new file mode 100644 index 00000000000..64e497f2fdb --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.h @@ -0,0 +1,253 @@ +//$Id$ +/**======================================================== + * + * @file NodeApplication_Impl.h + * + * @Brief This file contains the implementation of + * the NodeApplication interface. + * + * @auther Tao Lu <lu@dre.vanderbilt.edu> + *========================================================*/ + +#ifndef NODEAPPLICATION_IMPL_H +#define NODEAPPLICATION_IMPL_H +#include /**/ "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/ORB.h" +#include "ace/Synch.h" +#include "ace/Synch_Traits.h" +#include "Container_Base.h" +#include "Deployment_CoreS.h" +#include "Server_init.h" +#include "CIAO_common.h" + +using CIAO::Utility::write_IOR; + +/** + * + * @class NodeApplication_Impl + * + * @brief This class implements the NodeApplication interface. + * This interface is semantically very simillar to container + * in the old DnC spec. However this class will also be used + * as a Server for hosting home/component. This way we reduce the + * complexity of the framework by omitting the componentserver layer. + * + * @@TODO add configuration capabilities. Threading is one of them. + * + * @@Assumptions: + * 1. There is only 1 container for all components/homes associating + * with 1 NodeApplication + * 2. Now the implementation is not thread safe. + **/ + +namespace CIAO +{ + class CIAO_SERVER_Export NodeApplication_Impl + : public virtual POA_Deployment::NodeApplication + { + public: + + // Default constructor. + NodeApplication_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p); + + // Default destructor. + virtual ~NodeApplication_Impl (void); + + + /** + * @method finishLaunch + * + * @brief This operation dose 2 things. + * 1. Get the external connction (facet and Event source) + * and connect them to the local receptacle/event sink. + * 2. If the start augment is true, start the Components. + * @Note: + * The connection containes the object ref of the provided object + * reference (facet/event consumer) of components from other NodeApplications. + * However the name field stores the name of the port on the local component. + * + */ + virtual void + finishLaunch (const Deployment::Connections & providedReference, + CORBA::Boolean start + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError, + Deployment::InvalidConnection)); + + /** + * @method start + */ + virtual void + start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + /*------------- CIAO specific helper operations (idl)-------- + * + *-----------------------------------------------------------*/ + + // Initialize the NodeApplication + virtual CORBA::Long init (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Start install homes and components. + virtual ::Deployment::ComponentInfos * + install (const ::Deployment::ImplementationInfos & impl_infos + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Deployment::UnknownImplId, + ::Deployment::ImplEntryPointNotFound, + ::Deployment::InstallationFailure, + ::Components::InvalidConfiguration)); + + // Access the readonly attribute. + virtual ::Deployment::Properties * + properties (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + install_home (const ::Deployment::ImplementationInfo & impl_info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Deployment::InstallationFailure, + Components::InvalidConfiguration)); + + /** + * @@Note: I don't know how to remove a home right now. + * I assume that user will only call remove instead. + * This is true at least for DnC run time. + * + * Right now, in this implementation I assumpe that there will be + * same number of homes as the components even if the components + * are of the same type. I don't think that we have the modeling + * side support of this either. So bear me if you think I avoid + * the real thinking for easiness. + */ + virtual void remove_home (const char * comp_ins_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + // Remove everything inside including all components and homes. + // User must be sure that no connection is active before calling this!! + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + // Return all homes. + virtual ::Components::CCMHomes * + get_homes (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /*------------- CIAO specific helper functions (C++)--------- + * + *-----------------------------------------------------------*/ + + // Get the containing POA. This operation does *not* + // increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + // Get the object reference of the NodeApplicationManager. + // This might comes in handy later. + virtual ::CORBA::Object_ptr + get_node_application_manager (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + + // @@ (OO) Methods internal to the class, e.g. protected and not + // defined in IDL should not be using default arguments. + // Please drop the "_WITH_DEFAULTS" in all of the below + // protected methods. + + // This is a helper method to clean up components + // should only be called when we are sure that there is no + // active connection on this component. + virtual void remove_components (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual void remove_component (const char * comp_ins_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + // This function is a helper for start call. Bala's + // Idea of adding those pre/post activate calls doesn't work + // with the new sepc. + //@@ TODO. Come up with new ways of synchronized initialization process. + typedef void (Components::CCMObject::*Funct_Ptr) + (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + virtual void start_i (Funct_Ptr functor + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + // To store all created CCMHome object + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + Components::CCMHome_ptr, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> CCMHome_Map; + typedef CCMHome_Map::iterator Home_Iterator; + CCMHome_Map home_map_; + + // To sotre all created Component object. + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + Components::CCMObject_ptr, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> CCMComponent_Map; + typedef CCMComponent_Map::iterator Component_Iterator; + CCMComponent_Map component_map_; + + // Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + // Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + // Internal container implementation. + CIAO::Container *container_; + + // Cached properties + Deployment::Properties properties_; + + // And a reference to the NodeApplicationManager that created us. + ::CORBA::Object_var node_app_manager_; + + // Synchronize access to the object set. + // This will be needed in the case when component/home run in different thread + // TAO_SYNCH_MUTEX lock_; + + //@@ As I have stated in the idl we are not going to use properties for now. + // parse The Properties + /*void parse_config_values (const ::Deployment::Properties & properties, + struct home_installation_info &component_install_info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Components::InvalidConfiguration)); + */ + }; +} + +#if defined (__ACE_INLINE__) +# include "NodeApplication_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* NODEAPPLICATION_IMPL_H */ diff --git a/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.inl b/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.inl new file mode 100644 index 00000000000..dd541db9b70 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/NodeApplication_Impl.inl @@ -0,0 +1,21 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::NodeApplication_Impl:: +NodeApplication_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p) + + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + container_ (0) + + // @@ (OO) The default size for an ACE_Hash_Map_Mapanger is quiet + // large. The maximum size of an ACE_Hash_Map_Manager is + // also fixed, i.e. it does not grow dynamically on demand. + // Make sure the default size of home_map_ and + // component_map_ is appropriate for your needs. You may + // also want to make the size configurable at compile-time, + // at least. +{ +} diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp new file mode 100644 index 00000000000..16bfc99c407 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp @@ -0,0 +1,55 @@ +// $Id$ + +#include "Servant_Impl_Base.h" + +namespace CIAO +{ + Servant_Impl_Base::Servant_Impl_Base (Session_Container * c) + : container_ (c) + { + } + + Servant_Impl_Base::~Servant_Impl_Base (void) + { + } + + void + Servant_Impl_Base::add_facet (const char *port_name, + CORBA::Object_ptr port_ref) + { + ::Components::FacetDescription *fd = 0; + ACE_NEW (fd, + OBV_Components::FacetDescription); + ::Components::FacetDescription_var safe = fd; + + fd->name (port_name); + fd->type_id (port_ref->_interface_repository_id ()); + fd->facet_ref (port_ref); + + if (this->facet_table_.bind (port_name, fd) == 0) + { + safe._retn (); + } + } + + void + Servant_Impl_Base::add_consumer ( + const char *port_name, + ::Components::EventConsumerBase_ptr port_ref + ) + { + ::Components::ConsumerDescription *cd = 0; + ACE_NEW (cd, + OBV_Components::ConsumerDescription); + ::Components::ConsumerDescription_var safe = cd; + + cd->name (port_name); + cd->type_id (port_ref->_interface_repository_id ()); + cd->consumer (port_ref); + + if (this->consumer_table_.bind (port_name, cd) == 0) + { + safe._retn (); + } + } +} diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h new file mode 100644 index 00000000000..ea854dbde26 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h @@ -0,0 +1,80 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Servant_Impl_Base.h + * + * $Id$ + * + * This file contains the non-template declaration of a base class for + * the template mixin for the generated servant class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_SERVANT_IMPL_BASE_H +#define CIAO_SERVANT_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#include "ace/Hash_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CCM_EventC.h" +#include "CIAO_Server_Export.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Servant_Impl_Base + * + * @brief Non-template base class for Servant_Impl. + * + * Holds the non-template parts of its child class + * Servant_Impl. + */ + class CIAO_SERVER_Export Servant_Impl_Base + { + public: + Servant_Impl_Base (Session_Container * c); + + virtual ~Servant_Impl_Base (void); + + protected: + void add_facet (const char *port_name, + CORBA::Object_ptr port_ref); + + void add_consumer (const char *port_name, + ::Components::EventConsumerBase_ptr port_ref); + + protected: + typedef ACE_Hash_Map_Manager_Ex<const char *, + ::Components::FacetDescription_var, + ACE_Hash<const char *>, + ACE_Equal_To<const char *>, + ACE_Null_Mutex> + FacetTable; + + typedef ACE_Hash_Map_Manager_Ex<const char *, + ::Components::ConsumerDescription_var, + ACE_Hash<const char *>, + ACE_Equal_To<const char *>, + ACE_Null_Mutex> + ConsumerTable; + + FacetTable facet_table_; + ConsumerTable consumer_table_; + Session_Container * container_; + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SERVANT_IMPL_T_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp new file mode 100644 index 00000000000..9fe130edd33 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp @@ -0,0 +1,94 @@ +// $Id$ + +#ifndef CIAO_SERVANT_IMPL_T_C +#define CIAO_SERVANT_IMPL_T_C + +#include "Servant_Impl_T.h" + +namespace CIAO +{ + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename CONTEXT> + Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::Servant_Impl ( + EXEC * exe, + Session_Container * c + ) + : Servant_Impl_Base (c), + executor_ (EXEC::_duplicate (exe)) + { + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename CONTEXT> + Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::~Servant_Impl (void) + { + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename CONTEXT> + ::Components::FacetDescriptions * + Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::FacetDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::FacetDescriptions, + 0); + + ::Components::FacetDescriptions_var retval = tmp; + + retval->length (this->facet_table_.current_size ()); + CORBA::ULong i = 0; + + for (FacetTable::iterator iter = this->facet_table_.begin (); + iter != this->facet_table_.end (); + ++iter, ++i) + { + FacetTable::ENTRY & entry = *iter; + retval[i] = entry.int_id_; + } + + return retval._retn (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename CONTEXT> + ::Components::ConsumerDescriptions * + Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ConsumerDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::ConsumerDescriptions, + 0); + + ::Components::ConsumerDescriptions_var retval = tmp; + + retval->length (this->consumer_table_.current_size ()); + CORBA::ULong i = 0; + + for (ConsumerTable::iterator iter = this->consumer_table_.begin (); + iter != this->consumer_table_.end (); + ++iter, ++i) + { + ConsumerTable::ENTRY & entry = *iter; + retval[i] = entry.int_id_; + } + + return retval._retn (); + } +} + +#endif /* CIAO_SERVANT_IMPL_T_C */ diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h new file mode 100644 index 00000000000..af8f19a0eb2 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h @@ -0,0 +1,78 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Servant_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated servant class. + * + * @authors Boris Kolpackov <boris@dre.vanderbilt.edu> + * Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_SERVANT_IMPL_T_H +#define CIAO_SERVANT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "Servant_Impl_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class Session_Container; + + /** + * @class Servant_Impl + * + * @brief Mixin base class for generated servant. + * + * This class implements navigation and other operations + * common to all generated servants. + */ + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename CONTEXT> + class Servant_Impl : public virtual BASE_SKEL, + public Servant_Impl_Base + { + public: + Servant_Impl (EXEC * exe, + Session_Container * c); + virtual ~Servant_Impl (void); + + virtual ::Components::FacetDescriptions * + get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ConsumerDescriptions * + get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + EXEC_VAR executor_; + + CONTEXT * context_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Servant_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Servant_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_SERVANT_IMPL_T_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Server_init.cpp b/TAO/CIAO/DAnCE/ciao/Server_init.cpp new file mode 100644 index 00000000000..43eaabcd598 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Server_init.cpp @@ -0,0 +1,57 @@ +// $Id$ + +#include "Server_init.h" +#include "CIAO_common.h" +#include "CCM_ComponentC.h" +#include "Cookies.h" + +#include "ace/OS_NS_stdio.h" + +int +CIAO::Server_init (CORBA::ORB_ptr o) +{ + CIAO_REGISTER_VALUE_FACTORY (o, CIAO::Map_Key_Cookie_init, + Components::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, CIAO::Map_Key_Cookie_init, + CIAO::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PortDescription_init, + Components::PortDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::FacetDescription_init, + Components::FacetDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConnectionDescription_init, + Components::ConnectionDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ReceptacleDescription_init, + Components::ReceptacleDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConsumerDescription_init, + Components::ConsumerDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::EmitterDescription_init, + Components::EmitterDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::SubscriberDescription_init, + Components::SubscriberDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PublisherDescription_init, + Components::PublisherDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConfigValue_init, + Components::ConfigValue); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ComponentPortDescription_init, + Components::ComponentPortDescription); + return 0; +} + +int +CIAO::Utility::write_IOR (const char *pathname, + const char *ior) +{ + FILE* ior_output_file_ = + ACE_OS::fopen (pathname, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + return 0; + } + + return -1; +} diff --git a/TAO/CIAO/DAnCE/ciao/Server_init.h b/TAO/CIAO/DAnCE/ciao/Server_init.h new file mode 100644 index 00000000000..d2cbfcc04f5 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Server_init.h @@ -0,0 +1,50 @@ +// $Id$ + +/** + * @file Server_init.h + * + * Initializing CIAO Server side ORB, if they need to. + * I'm also puting some utilities functions here. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_SERVER_INIT_H +#define CIAO_SERVER_INIT_H +#include /**/ "ace/pre.h" + +#include "CIAO_Server_Export.h" + +#if !defined ACE_LACKS_PRAGMA_ONCE +#pragma once +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +namespace CORBA +{ + class ORB; + typedef ORB *ORB_ptr; +} + +namespace CIAO +{ + /** + * The initialize routine for any server that need to access + * component. This routine now simply registers various valuetype + * factories defined in CIAO_Component.pidl. Currently, this method + * should be call right after ORB initialization but we should try + * to register these stuff automatically. + */ + CIAO_SERVER_Export int Server_init (CORBA::ORB_ptr o); + + namespace Utility + { + /// Write a string (usually a stringified IOR) to a file + /// designated by the @c pathname. The file named will always get + /// overwritten. + CIAO_SERVER_Export int write_IOR (const char *pathname, + const char *IOR); + } +} + +#include /**/ "ace/post.h" +#endif /* CIAO_SERVER_INIT_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Version.h b/TAO/CIAO/DAnCE/ciao/Version.h new file mode 100644 index 00000000000..e36f84e74ec --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Version.h @@ -0,0 +1,7 @@ +// $Id$ +// This is an automatically generated file. + +#define CIAO_MAJOR_VERSION 0 +#define CIAO_MINOR_VERSION 4 +#define CIAO_BETA_VERSION 1 +#define CIAO_VERSION "0.4.1" |