diff options
Diffstat (limited to 'CIAO/ciao')
120 files changed, 8808 insertions, 0 deletions
diff --git a/CIAO/ciao/CCM_Base.idl b/CIAO/ciao/CCM_Base.idl new file mode 100644 index 00000000000..40d6b308668 --- /dev/null +++ b/CIAO/ciao/CCM_Base.idl @@ -0,0 +1,26 @@ +// $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 + */ + +#if !defined (CCM_BASE_IDL) +#define CCM_BASE_IDL + +module Components +{ + typeprefix Components "omg.org"; + + exception InvalidConnection {}; + exception AlreadyConnected {}; + exception NoConnection {}; +}; +#endif /* CCM_BASE_IDL */ diff --git a/CIAO/ciao/CCM_CCM2Context.idl b/CIAO/ciao/CCM_CCM2Context.idl new file mode 100644 index 00000000000..9b29d8b7d3b --- /dev/null +++ b/CIAO/ciao/CCM_CCM2Context.idl @@ -0,0 +1,45 @@ +// $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 + */ + +#if !defined (CCM_2CONTEXT_IDL) +#define CCM_2CONTEXT_IDL + +#include "ciao/CCM_Container.idl" +#include "ciao/CCM_HomeRegistration.idl" +#include <CosPersistentState.idl> + +// *************** Extended Container Interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + typedef CosPersistentState::CatalogBase CatalogBase; + typedef CosPersistentState::_TypeId _TypeId; + + exception PolicyMismatch {}; + exception PersistenceNotAvailable {}; + + local interface CCM2Context : CCMContext + { + HomeRegistration get_home_registration (); + + void req_passivate () + raises (PolicyMismatch); + + CatalogBase get_persistence (in _TypeId catalog_type_id) + raises (PersistenceNotAvailable); + }; + +}; +#endif /* CCM_2CONTEXT_IDL */ diff --git a/CIAO/ciao/CCM_CCMException.idl b/CIAO/ciao/CCM_CCMException.idl new file mode 100644 index 00000000000..012f3dd24ff --- /dev/null +++ b/CIAO/ciao/CCM_CCMException.idl @@ -0,0 +1,40 @@ +// $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 + */ + +#if !defined (CCM_CCMEXCEPTION_IDL) +#define CCM_CCMEXCEPTION_IDL + +module Components +{ + typeprefix Components "omg.org"; + + enum CCMExceptionReason + { + SYSTEM_ERROR, + CREATE_ERROR, + REMOVE_ERROR, + DUPLICATE_KEY, + FIND_ERROR, + OBJECT_NOT_FOUND, + NO_SUCH_ENTITY, + QOS_ERROR, + REGISTRATION_ERROR, + SERVICE_INSTALLATION_ERROR + }; + + exception CCMException + { + CCMExceptionReason reason; + }; +}; +#endif /* CCM_CCMEXCEPTION_IDL */ diff --git a/CIAO/ciao/CCM_Component.idl b/CIAO/ciao/CCM_Component.idl new file mode 100644 index 00000000000..8a604edf085 --- /dev/null +++ b/CIAO/ciao/CCM_Component.idl @@ -0,0 +1,22 @@ +// $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 "ciao/CCM_Events.idl" +#include "ciao/CCM_Home.idl" +#include "ciao/CCM_Object.idl" +#include "ciao/CCM_Enumeration.idl" + +#endif /* CCM_COMPONENT_IDL */ diff --git a/CIAO/ciao/CCM_ComponentId.idl b/CIAO/ciao/CCM_ComponentId.idl new file mode 100644 index 00000000000..299515d0978 --- /dev/null +++ b/CIAO/ciao/CCM_ComponentId.idl @@ -0,0 +1,47 @@ +// $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_COMPONENTID_IDL) +#define CCM_COMPONENTID_IDL + +#include "ciao/CCM_StateIdFactory.idl" + +// *************** Extended Container Interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + 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); + }; +}; +#endif /* CCM_COMPONENTID_IDL */ diff --git a/CIAO/ciao/CCM_Configurator.idl b/CIAO/ciao/CCM_Configurator.idl new file mode 100644 index 00000000000..0d48f8e65cb --- /dev/null +++ b/CIAO/ciao/CCM_Configurator.idl @@ -0,0 +1,31 @@ +// $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_CONFIGURATOR_IDL) +#define CCM_CONFIGURATOR_IDL + +module Components +{ + typeprefix Components "omg.org"; + + exception WrongComponentType {}; + + interface CCMObject; + + interface Configurator + { + void configure (in CCMObject comp) + raises (WrongComponentType); + }; +}; +#endif /* CCM_CONFIGURATOR_IDL */ diff --git a/CIAO/ciao/CCM_Container.idl b/CIAO/ciao/CCM_Container.idl new file mode 100644 index 00000000000..d6555e16170 --- /dev/null +++ b/CIAO/ciao/CCM_Container.idl @@ -0,0 +1,25 @@ +// $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 "ciao/CCM_Component.idl" +#include "ciao/CCM_CCMException.idl" +#include "ciao/CCM_HomeExecutorBase.idl" +#include "ciao/CCM_SessionContext.idl" +#include "ciao/CCM_SessionComponent.idl" + +#endif /* CCM_CONTAINER_IDL */ diff --git a/CIAO/ciao/CCM_Container_Ex.idl b/CIAO/ciao/CCM_Container_Ex.idl new file mode 100644 index 00000000000..c2161d56c94 --- /dev/null +++ b/CIAO/ciao/CCM_Container_Ex.idl @@ -0,0 +1,23 @@ +// $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 "ciao/CCM_Container.idl" +#include "ciao/CCM_Session2Context.idl" +#include "ciao/CCM_EntityContext.idl" + +#endif /* CCM_CONTAINER_EX_IDL */ diff --git a/CIAO/ciao/CCM_Context.idl b/CIAO/ciao/CCM_Context.idl new file mode 100644 index 00000000000..e5eb75c218f --- /dev/null +++ b/CIAO/ciao/CCM_Context.idl @@ -0,0 +1,45 @@ +// $Id$ + +#if !defined (CCM_CONTEXT_IDL) +#define CCM_CONTEXT_IDL + +#include "ciao/Security.idl" +#include "ciao/CCM_Transaction.idl" +#include "ciao/CCM_Home.idl" +#include "ciao/CCM_CCMException.idl" + +// *************** Basic Container interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + typedef SecurityLevel2::Credentials Principal; + + exception IllegalState {}; + + 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); + + /** + * Added for QoS4CCM + */ + Object resolve_service_reference(in string service_id) + raises (CCMException); + }; +}; +#endif /* CCM_CONTEXT_IDL */ diff --git a/CIAO/ciao/CCM_Cookie.idl b/CIAO/ciao/CCM_Cookie.idl new file mode 100644 index 00000000000..f815d9f1ef9 --- /dev/null +++ b/CIAO/ciao/CCM_Cookie.idl @@ -0,0 +1,29 @@ +// $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 + */ + +#if !defined (CCM_COOKIE_IDL) +#define CCM_COOKIE_IDL + +#include "tao/OctetSeq.pidl" + +module Components +{ + typeprefix Components "omg.org"; + + valuetype Cookie + { + private CORBA::OctetSeq cookieValue; + }; +}; +#endif /* CCM_COOKIE_IDL */ diff --git a/CIAO/ciao/CCM_Core.mpc b/CIAO/ciao/CCM_Core.mpc new file mode 100644 index 00000000000..31e8ce1fdd9 --- /dev/null +++ b/CIAO/ciao/CCM_Core.mpc @@ -0,0 +1,214 @@ +// $Id$ + +project (CIAO_Client) : taolib_with_idl, valuetype, ifr_client { + sharedname = CIAO_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 + + // This is necessary for MPC to pull in rules.ciao.GNU + includes += $(CIAO_ROOT) + + dynamicflags = CIAO_CLIENT_BUILD_DLL + + IDL_Files { + idlflags += -SS -Sci + CCM_Base.idl + CCM_Component.idl + } + + IDL_Files { + idlflags += -SS + CCM_Cookie.idl + CCM_Enumeration.idl + } + + IDL_Files { + idlflags += -Ssi -Sci + Components.idl + } + + IDL_Files { + CCM_HomeConfiguration.idl + CCM_StandardConfigurator.idl + CCM_Home.idl + CCM_Object.idl + CCM_PrimaryKeyBase.idl + } + + IDL_Files { + idlflags += -Ssi + CCM_HomeFinder.idl + CCM_Configurator.idl + CCM_KeylessCCMHome.idl + CCM_Navigation.idl + CCM_Receptacle.idl + } + + IDL_Files { + CCM_Events.idl + CCM_EventBase.idl + CCM_EventConsumerBase.idl + } + + Source_Files { + CCM_BaseC.cpp + CCM_EventsC.cpp + CCM_EventBaseC.cpp + CCM_EventConsumerBaseC.cpp + CCM_ComponentC.cpp + CCM_EnumerationC.cpp + CCM_HomeC.cpp + CCM_ConfiguratorC.cpp + CCM_HomeConfigurationC.cpp + CCM_KeylessCCMHomeC.cpp + CCM_StandardConfiguratorC.cpp + CCM_HomeFinderC.cpp + CCM_NavigationC.cpp + CCM_ReceptacleC.cpp + CCM_CookieC.cpp + CCM_ObjectC.cpp + CCM_PrimaryKeyBaseC.cpp + Client_init.cpp + ComponentsC.cpp + } + + Header_Files { + CIAO_Client_Export.h + CIAO_common.h + } +} + +project (CIAO_Container) : orbsvcslib, portableserver, valuetype, ifr_client, codecfactory, pi, ciao_client_dnc, avoids_corba_e_compact, avoids_corba_e_micro { + sharedname = CIAO_Container + idlflags += -Wb,export_include=CIAO_Container_Export.h + idlflags += -Wb,export_macro=CIAO_CONTAINER_Export + dynamicflags = CIAO_CONTAINER_BUILD_DLL + + // This is necessary for MPC to pull in rules.ciao.GNU + includes += $(CIAO_ROOT) + + IDL_Files { + idlflags += -SS -Sci \ + -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \ + -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL + Security.idl + } + + IDL_Files { + idlflags += -SS -Sci + CCM_Context.idl + CCM_CCMException.idl + CCM_EntityComponent.idl + CCM_EntityContext.idl + CIAO_SwapExec.idl + CIAO_UpgradeableContext.idl + } + + IDL_Files { + idlflags += -SS + CCM_CCM2Context.idl + CCM_ProxyHomeRegistration.idl + CCM_Session2Context.idl + CCM_Transaction.idl + CosPersistentState.idl + CCM_Container.idl + CCM_SessionContext.idl + CCM_SessionComponent.idl + CCM_Container_Ex.idl + CCM_StateIdFactory.idl + CCM_Entity2Context.idl + CCM_ComponentId.idl + CCM_ExecutorLocator.idl + CCM_EnterpriseComponent.idl + CCM_SessionSynchronization.idl + CCM_HomeRegistration.idl + CCM_HomeExecutorBase.idl + } + + Source_Files { + CCM_TransactionC.cpp + CosPersistentStateC.cpp + CCM_ContainerC.cpp + CCM_SessionContextC.cpp + CCM_SessionComponentC.cpp + CCM_EnterpriseComponentC.cpp + CCM_SessionSynchronizationC.cpp + CCM_CCMExceptionC.cpp + CCM_ContextC.cpp + SecurityC.cpp + CCM_Container_ExC.cpp + CCM_StateIdFactoryC.cpp + CCM_ComponentIdC.cpp + CCM_Entity2ContextC.cpp + CCM_ExecutorLocatorC.cpp + CCM_ProxyHomeRegistrationC.cpp + CCM_Session2ContextC.cpp + CCM_CCM2ContextC.cpp + CCM_HomeRegistrationC.cpp + CCM_HomeExecutorBaseC.cpp + CCM_EntityContextC.cpp + CCM_EntityComponentC.cpp + CCM_EventsS.cpp + CCM_EventConsumerBaseS.cpp + CCM_EventBaseS.cpp + CCM_ConfiguratorS.cpp + CCM_HomeConfigurationS.cpp + CCM_KeylessCCMHomeS.cpp + CCM_StandardConfiguratorS.cpp + CCM_HomeS.cpp + CCM_ObjectS.cpp + CCM_PrimaryKeyBaseS.cpp + CCM_HomeFinderS.cpp + CCM_NavigationS.cpp + CCM_ReceptacleS.cpp + CIAO_SwapExecC.cpp + CIAO_UpgradeableContextC.cpp + Cookies.cpp + ComponentsS.cpp + } + +} + +project (CIAO_Server) : orbsvcslib, portableserver, valuetype, naming, ifr_client, utils, ciao_container_dnc, ciao_client_dnc, ciao_deployment_svnt, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { + includes += $(CIAO_ROOT) + sharedname = CIAO_Server + idlflags += -Wb,export_include=CIAO_Server_Export.h -Wb,export_macro=CIAO_SERVER_Export + dynamicflags = CIAO_SERVER_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Container_Base.cpp + Session_Container.cpp + Swapping_Container.cpp + Context_Impl_Base.cpp + Home_Servant_Impl_Base.cpp + Servant_Impl_Base.cpp + Swapping_Servant_Home_Impl_Base.cpp + Server_init.cpp + Servant_Activator.cpp + Dynamic_Component_Activator.cpp + Dynamic_Component_Servant_Base.cpp + Port_Activator.cpp + StandardConfigurator_Impl.cpp + } + + Header_Files { + CIAO_Server_Export.h + CIAO_common.h + } + + Template_Files { + Context_Impl_T.cpp + Upgradeable_Context_Impl_T.cpp + Home_Servant_Impl_T.cpp + Swapping_Servant_Home_Impl_T.cpp + Dynamic_Component_Servant_T.cpp + Servant_Impl_T.cpp + Servant_Impl_Utils_T.cpp + Servant_Activator_T.cpp + } +} diff --git a/CIAO/ciao/CCM_EnterpriseComponent.idl b/CIAO/ciao/CCM_EnterpriseComponent.idl new file mode 100644 index 00000000000..b3f3d1b9432 --- /dev/null +++ b/CIAO/ciao/CCM_EnterpriseComponent.idl @@ -0,0 +1,25 @@ +// $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_ENTERPRISECOMPONENT_IDL) +#define CCM_ENTERPRISECOMPONENT_IDL + +module Components +{ + typeprefix Components "omg.org"; + + local interface EnterpriseComponent {}; +}; +#endif /* CCM_CONTAINER_IDL */ diff --git a/CIAO/ciao/CCM_Entity2Context.idl b/CIAO/ciao/CCM_Entity2Context.idl new file mode 100644 index 00000000000..4ed01244408 --- /dev/null +++ b/CIAO/ciao/CCM_Entity2Context.idl @@ -0,0 +1,48 @@ +// $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_ENTITY2CONTEXT_IDL) +#define CCM_ENTITY2CONTEXT_IDL + +#include "ciao/CCM_Session2Context.idl" +#include "ciao/CCM_EntityContext.idl" +#include "ciao/CCM_ComponentId.idl" + +// *************** Extended Container Interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + 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); + }; +}; +#endif /* CCM_ENTITY2CONTEXT_IDL */ diff --git a/CIAO/ciao/CCM_EntityComponent.idl b/CIAO/ciao/CCM_EntityComponent.idl new file mode 100644 index 00000000000..0b04ad7131a --- /dev/null +++ b/CIAO/ciao/CCM_EntityComponent.idl @@ -0,0 +1,51 @@ +// $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_ENTITYCOMPONENT_IDL) +#define CCM_ENTITYCOMPONENT_IDL + +#include "ciao/CCM_CCMException.idl" +#include "ciao/CCM_EnterpriseComponent.idl" +#include "ciao/CCM_EntityContext.idl" + +module Components +{ + typeprefix Components "omg.org"; + + 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); + }; +}; +#endif /* CCM_ENTITYCOMPONENT_IDL */ diff --git a/CIAO/ciao/CCM_EntityContext.idl b/CIAO/ciao/CCM_EntityContext.idl new file mode 100644 index 00000000000..ee02b728afb --- /dev/null +++ b/CIAO/ciao/CCM_EntityContext.idl @@ -0,0 +1,35 @@ +// $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_ENTITYCONTEXT_IDL) +#define CCM_ENTITYCONTEXT_IDL + +#include "ciao/CCM_Context.idl" +#include "ciao/CCM_Object.idl" + +module Components +{ + typeprefix Components "omg.org"; + + local interface EntityContext : CCMContext + { + Object get_CCM_object () + raises (IllegalState); + + PrimaryKeyBase get_primary_key () + raises (IllegalState); + }; +}; +#endif /* CCM_ENTITYCONTEXT_IDL */ diff --git a/CIAO/ciao/CCM_Enumeration.idl b/CIAO/ciao/CCM_Enumeration.idl new file mode 100644 index 00000000000..55d64b68e07 --- /dev/null +++ b/CIAO/ciao/CCM_Enumeration.idl @@ -0,0 +1,38 @@ +// $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_ENUMERATION_IDL) +#define CCM_ENUMERATION_IDL + +#include "ciao/CCM_Object.idl" + +module Components +{ + typeprefix Components "omg.org"; + + /// @@ 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_ENUMERATION_IDL */ diff --git a/CIAO/ciao/CCM_EventBase.idl b/CIAO/ciao/CCM_EventBase.idl new file mode 100644 index 00000000000..e97a474802a --- /dev/null +++ b/CIAO/ciao/CCM_EventBase.idl @@ -0,0 +1,25 @@ +// $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_EVENTBASE_IDL) +#define CCM_EVENTBASE_IDL + +module Components +{ + typeprefix Components "omg.org"; + + abstract valuetype EventBase {}; +}; +#endif /* CCM_EVENTBASE_IDL */ diff --git a/CIAO/ciao/CCM_EventConsumerBase.idl b/CIAO/ciao/CCM_EventConsumerBase.idl new file mode 100644 index 00000000000..0e1facf5940 --- /dev/null +++ b/CIAO/ciao/CCM_EventConsumerBase.idl @@ -0,0 +1,50 @@ +// $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_EVENTCONSUMERBASE_IDL) +#define CCM_EVENTCONSUMERBASE_IDL + +#include "ciao/CCM_EventBase.idl" +#include "tao/Typecode_types.pidl" +#include "tao/orb_types.pidl" + +module Components +{ + typeprefix Components "omg.org"; + + exception BadEventType + { + CORBA::RepositoryId expected_event_type; + }; + + interface EventConsumerBase + { + void push_event (in EventBase evt) raises (BadEventType); + + // CIAO-specific operation to treat event service as regular event + // sink port. The source_id needs to be passed in to identify the + // source of the publisher port to support event filtering mechanism. + void ciao_push_event (in EventBase evt, + in string source_id, + in CORBA::TypeCode tc) + raises (BadEventType); + + // CIAO-specific operation to help support the capability + // to subscribe to eventtypes more derived than the type + // consumed. + boolean ciao_is_substitutable (in string event_repo_id); + }; +}; +#endif /* CCM_EVENTCONSUMERBASE_IDL */ diff --git a/CIAO/ciao/CCM_Events.idl b/CIAO/ciao/CCM_Events.idl new file mode 100644 index 00000000000..de0f894daf2 --- /dev/null +++ b/CIAO/ciao/CCM_Events.idl @@ -0,0 +1,97 @@ +// $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_EVENTS_IDL) +#define CCM_EVENTS_IDL + +#include "ciao/CCM_Base.idl" +#include "ciao/CCM_Navigation.idl" +#include "ciao/CCM_Receptacle.idl" +#include "ciao/CCM_Cookie.idl" +#include "ciao/CCM_EventBase.idl" +#include "ciao/CCM_EventConsumerBase.idl" + +module Components +{ + typeprefix Components "omg.org"; + + 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, + 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/CIAO/ciao/CCM_ExecutorLocator.idl b/CIAO/ciao/CCM_ExecutorLocator.idl new file mode 100644 index 00000000000..a764225af7c --- /dev/null +++ b/CIAO/ciao/CCM_ExecutorLocator.idl @@ -0,0 +1,39 @@ +// $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 + */ + +#if !defined (CCM_EXECUTORLOCATOR_IDL) +#define CCM_EXECUTORLOCATOR_IDL + +#include "ciao/CCM_EnterpriseComponent.idl" +#include "ciao/CCM_CCMException.idl" +#include "ciao/CCM_Object.idl" + +// *************** Extended Container Interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + 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_EXECUTORLOCATOR_IDL */ diff --git a/CIAO/ciao/CCM_Home.idl b/CIAO/ciao/CCM_Home.idl new file mode 100644 index 00000000000..192188dda3d --- /dev/null +++ b/CIAO/ciao/CCM_Home.idl @@ -0,0 +1,52 @@ +// $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_HOME_IDL) +#define CCM_HOME_IDL + +#include "tao/IFR_Client/IFR_Base.pidl" + +module Components +{ + typeprefix Components "omg.org"; + + typedef unsigned long FailureReason; + + exception CreateFailure { + FailureReason reason; + }; + exception FinderFailure + { + FailureReason reason; + }; + exception RemoveFailure + { + FailureReason reason; + }; + + exception DuplicateKeyValue {}; + exception InvalidKey {}; + exception UnknownKeyValue {}; + + interface CCMObject; + + interface CCMHome + { + CORBA::IRObject get_component_def (); + CORBA::IRObject get_home_def (); + void remove_component ( in CCMObject comp) + raises (RemoveFailure); + }; +}; + +#endif /* CCM_HOME_IDL */ diff --git a/CIAO/ciao/CCM_HomeConfiguration.idl b/CIAO/ciao/CCM_HomeConfiguration.idl new file mode 100644 index 00000000000..d3d488ae11b --- /dev/null +++ b/CIAO/ciao/CCM_HomeConfiguration.idl @@ -0,0 +1,33 @@ +// $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_HOMECONFIGURATION_IDL) +#define CCM_HOMECONFIGURATION_IDL + +#include "ciao/CCM_Configurator.idl" +#include "ciao/CCM_StandardConfigurator.idl" +#include "ciao/CCM_Home.idl" + +module Components +{ + typeprefix Components "omg.org"; + + 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(); + }; +}; +#endif /* CCM_HOMECONFIGURATOR_IDL */ diff --git a/CIAO/ciao/CCM_HomeExecutorBase.idl b/CIAO/ciao/CCM_HomeExecutorBase.idl new file mode 100644 index 00000000000..e1db55b9afc --- /dev/null +++ b/CIAO/ciao/CCM_HomeExecutorBase.idl @@ -0,0 +1,27 @@ +// $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_HOMEEXECUTORBASE_IDL) +#define CCM_HOMEEXECUTORBASE_IDL + +module Components +{ + typeprefix Components "omg.org"; + + local interface HomeExecutorBase + { + }; +}; +#endif /* CCM_HOMEEXECUTORBASE_IDL */ diff --git a/CIAO/ciao/CCM_HomeFinder.idl b/CIAO/ciao/CCM_HomeFinder.idl new file mode 100644 index 00000000000..f5ffca44442 --- /dev/null +++ b/CIAO/ciao/CCM_HomeFinder.idl @@ -0,0 +1,39 @@ +// $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_HomeFinder.idl + */ + +#if !defined (CCM_HOMEFINDER_IDL) +#define CCM_HOMEFINDER_IDL + +#include "tao/orb_types.pidl" + +module Components +{ + typeprefix Components "omg.org"; + + exception HomeNotFound {}; + + interface CCMHome; + + 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); + }; +}; +#endif /* CCM_HOMEFINDER_IDL */ diff --git a/CIAO/ciao/CCM_HomeRegistration.idl b/CIAO/ciao/CCM_HomeRegistration.idl new file mode 100644 index 00000000000..e7ee299e11c --- /dev/null +++ b/CIAO/ciao/CCM_HomeRegistration.idl @@ -0,0 +1,34 @@ +// $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_HOMEREGISTRATION_IDL) +#define CCM_HOMEREGISTRATION_IDL + +#include "ciao/CCM_Home.idl" + +module Components +{ + typeprefix Components "omg.org"; + + local interface HomeRegistration + { + void register_home (in CCMHome home_ref, + in string home_name); + + void unregister_home (in CCMHome home_ref); + }; + +}; +#endif /* CCM_HOMEREGISTRATION_IDL */ diff --git a/CIAO/ciao/CCM_KeylessCCMHome.idl b/CIAO/ciao/CCM_KeylessCCMHome.idl new file mode 100644 index 00000000000..747c45a5117 --- /dev/null +++ b/CIAO/ciao/CCM_KeylessCCMHome.idl @@ -0,0 +1,30 @@ +// $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_KEYLESSCCMHOME_IDL) +#define CCM_KEYLESSCCMHOME_IDL + +#include "ciao/CCM_Home.idl" + +module Components +{ + typeprefix Components "omg.org"; + + interface KeylessCCMHome + { + CCMObject create_component() + raises (CreateFailure); + }; + +}; +#endif /* CCM_KEYLESSCCMHOME_IDL */ diff --git a/CIAO/ciao/CCM_Navigation.idl b/CIAO/ciao/CCM_Navigation.idl new file mode 100644 index 00000000000..53b74e2a10c --- /dev/null +++ b/CIAO/ciao/CCM_Navigation.idl @@ -0,0 +1,54 @@ +// $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_Navigation.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_NAVIGATION_IDL) +#define CCM_NAVIGATION_IDL + +#include "tao/orb_types.pidl" +#include "tao/StringSeq.pidl" + +module Components +{ + typeprefix Components "omg.org"; + + typedef string FeatureName; + typedef sequence<FeatureName> NameList; + + valuetype PortDescription + { + public FeatureName name; + public CORBA::RepositoryId type_id; + }; + + valuetype FacetDescription : PortDescription + { + public Object facet_ref; + }; + + typedef sequence<FacetDescription> FacetDescriptions; + + exception InvalidName {}; + 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); + }; +}; +#endif /* CCM_NAVIGATION_IDL */ diff --git a/CIAO/ciao/CCM_Object.idl b/CIAO/ciao/CCM_Object.idl new file mode 100644 index 00000000000..fc869afa97c --- /dev/null +++ b/CIAO/ciao/CCM_Object.idl @@ -0,0 +1,106 @@ +// $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_OBJECT_IDL) +#define CCM_OBJECT_IDL + +#include "ciao/CCM_Events.idl" +#include "ciao/CCM_Navigation.idl" +#include "ciao/CCM_Home.idl" +#include "ciao/CCM_PrimaryKeyBase.idl" + +module Components +{ + typeprefix Components "omg.org"; + + /// This typedef and consts shouldn't be here but are here because of CIAO + /// specific additions + typedef FailureReason InvalidConfigurationReason; + const InvalidConfigurationReason UnknownConfigValueName = 0; + const InvalidConfigurationReason InvalidConfigValueType = 1; + const InvalidConfigurationReason ConfigValueRequired = 2; + const InvalidConfigurationReason ConfigValueNotExpected = 3; + + /// Shouldn't be here but is now here because of CIAO additions + exception InvalidConfiguration + { + InvalidConfigurationReason reason; + FeatureName name; + }; + + valuetype ComponentPortDescription + { + public FacetDescriptions facets; + public ReceptacleDescriptions receptacles; + public ConsumerDescriptions consumers; + public EmitterDescriptions emitters; + public PublisherDescriptions publishers; + }; + + /// CIAO specific forward declaration, shouldn't be here + interface StandardConfigurator; + + exception NoKeyAvailable {}; + + interface CCMObject : Navigation, Receptacles, Events + { + CORBA::IRObject get_component_def ( ); + CCMHome get_ccm_home( ); + PrimaryKeyBase get_primary_key( ) + raises (NoKeyAvailable); + void configuration_complete () + raises (InvalidConfiguration); + void remove() + raises (RemoveFailure); + ComponentPortDescription get_all_ports (); + + /// Factory method to return a StandardConfigurator interface. + /// CIAO specific + StandardConfigurator get_standard_configurator ( ); + + /// 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); + + /// CIAO specific + void ciao_activate () + raises (InvalidConfiguration); + + /// CIAO specific + void ciao_postactivate () + raises (InvalidConfiguration); + + /// CIAO specific + void ciao_passivate () + raises (InvalidConfiguration); + }; +}; +#endif /* CCM_OBJECT_IDL */ diff --git a/CIAO/ciao/CCM_PrimaryKeyBase.idl b/CIAO/ciao/CCM_PrimaryKeyBase.idl new file mode 100644 index 00000000000..4730208b2f9 --- /dev/null +++ b/CIAO/ciao/CCM_PrimaryKeyBase.idl @@ -0,0 +1,24 @@ +// $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_PRIMARYKEYBASE_IDL) +#define CCM_PRIMARYKEYBASE_IDL + +module Components +{ + typeprefix Components "omg.org"; + + abstract valuetype PrimaryKeyBase {}; + +}; +#endif /* CCM_PRIMARYKEYBASE_IDL */ diff --git a/CIAO/ciao/CCM_ProxyHomeRegistration.idl b/CIAO/ciao/CCM_ProxyHomeRegistration.idl new file mode 100644 index 00000000000..084b113a50d --- /dev/null +++ b/CIAO/ciao/CCM_ProxyHomeRegistration.idl @@ -0,0 +1,36 @@ +// $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_PROXYHOMEREGISTRATION_IDL) +#define CCM_PROXYHOMEREGISTRATION_IDL + +#include "ciao/CCM_HomeRegistration.idl" + +module Components +{ + typeprefix Components "omg.org"; + + exception UnknownActualHome {}; + exception ProxyHomeNotSupported {}; + + local interface ProxyHomeRegistration : HomeRegistration + { + void register_proxy_home (in CCMHome rhome, + in CCMHome ahome) + raises (UnknownActualHome, + ProxyHomeNotSupported); + }; +}; +#endif /* CCM_PROXYHOMEREGISTRATION_IDL */ diff --git a/CIAO/ciao/CCM_Receptacle.idl b/CIAO/ciao/CCM_Receptacle.idl new file mode 100644 index 00000000000..2ed7863b349 --- /dev/null +++ b/CIAO/ciao/CCM_Receptacle.idl @@ -0,0 +1,68 @@ +// $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 (CCM_RECEPTACLE_IDL) +#define CCM_RECEPTACLE_IDL + +#include "ciao/CCM_Base.idl" +#include "ciao/CCM_Navigation.idl" +#include "ciao/CCM_Cookie.idl" + +module Components +{ + typeprefix Components "omg.org"; + + 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; + + exception ExceededConnectionLimit {}; + exception CookieRequired {}; + + interface Receptacles + { + Cookie connect (in FeatureName name, in Object connection ) + raises (InvalidName, + InvalidConnection, + AlreadyConnected, + ExceededConnectionLimit); + + 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_RECEPTACLE_IDL */ diff --git a/CIAO/ciao/CCM_Session2Context.idl b/CIAO/ciao/CCM_Session2Context.idl new file mode 100644 index 00000000000..8fec0e9441c --- /dev/null +++ b/CIAO/ciao/CCM_Session2Context.idl @@ -0,0 +1,50 @@ +// $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_SESSION2CONTEXT_IDL) +#define CCM_SESSION2CONTEXT_IDL + +#include "ciao/CCM_CCM2Context.idl" + +// *************** Extended Container Interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + enum BadComponentReferenceReason + { + NON_LOCAL_REFERENCE, + NON_COMPONENT_REFERENCE, + WRONG_CONTAINER + }; + exception BadComponentReference + { + BadComponentReferenceReason reason; + }; + + 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); + }; +}; +#endif /* CCM_SESSION2CONTEXT_IDL */ diff --git a/CIAO/ciao/CCM_SessionComponent.idl b/CIAO/ciao/CCM_SessionComponent.idl new file mode 100644 index 00000000000..c4d72fffa05 --- /dev/null +++ b/CIAO/ciao/CCM_SessionComponent.idl @@ -0,0 +1,62 @@ +// $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_SESSIONCOMPONENT_IDL) +#define CCM_SESSIONCOMPONENT_IDL + +#include "ciao/CCM_SessionContext.idl" +#include "ciao/CCM_CCMException.idl" +#include "ciao/CCM_EnterpriseComponent.idl" + +// *************** Basic Container interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + local interface SessionComponent : EnterpriseComponent + { + void set_session_context ( in SessionContext ctx) + raises (CCMException); + + void ccm_activate() + raises (CCMException); + + void ccm_passivate() + raises (CCMException); + + void ccm_remove () + raises (CCMException); + + /** + * This method is invoked before ccm_activate () is called. All + * components in the assembly get this callback before the + * ccm_activate () is called. + * @note CIAO specific + */ + 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. + * @note CIAO specific + */ + void ciao_postactivate () + raises (CCMException); + }; +}; +#endif /* CCM_SESSIONCOMPONENT_IDL */ diff --git a/CIAO/ciao/CCM_SessionContext.idl b/CIAO/ciao/CCM_SessionContext.idl new file mode 100644 index 00000000000..24820fb5cce --- /dev/null +++ b/CIAO/ciao/CCM_SessionContext.idl @@ -0,0 +1,31 @@ +// $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_SESSIONCONTEXT_IDL) +#define CCM_SESSIONCONTEXT_IDL + +#include "ciao/CCM_Context.idl" + +module Components +{ + typeprefix Components "omg.org"; + + local interface SessionContext : CCMContext + { + Object get_CCM_object() + raises (IllegalState); + }; +}; +#endif /* CCM_SESSIONCONTEXT_IDL */ diff --git a/CIAO/ciao/CCM_SessionSynchronization.idl b/CIAO/ciao/CCM_SessionSynchronization.idl new file mode 100644 index 00000000000..27614d3e14e --- /dev/null +++ b/CIAO/ciao/CCM_SessionSynchronization.idl @@ -0,0 +1,39 @@ +// $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_SESSIONSYNCHRONIZATION_IDL) +#define CCM_SESSIONSYNCHRONIZATION_IDL + +#include "ciao/CCM_CCMException.idl" + +// *************** Basic Container interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + local interface SessionSynchronization + { + void after_begin () + raises (CCMException); + + void before_completion () + raises (CCMException); + + void after_completion (in boolean committed) + raises (CCMException); + }; +}; +#endif /* CCM_SESSIONSYNCHRONIZATION_IDL */ diff --git a/CIAO/ciao/CCM_StandardConfigurator.idl b/CIAO/ciao/CCM_StandardConfigurator.idl new file mode 100644 index 00000000000..e883c72ad64 --- /dev/null +++ b/CIAO/ciao/CCM_StandardConfigurator.idl @@ -0,0 +1,38 @@ +// $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_STANDARDCONFIGURATOR_IDL) +#define CCM_STANDARDCONFIGURATOR_IDL + +#include "ciao/CCM_Configurator.idl" +#include "ciao/CCM_Navigation.idl" + +module Components +{ + typeprefix Components "omg.org"; + + valuetype ConfigValue + { + public FeatureName name; + public any value; + }; + + typedef sequence<ConfigValue> ConfigValues; + + interface StandardConfigurator : Configurator + { + void set_configuration (in ConfigValues descr); + }; + +}; +#endif /* CCM_STANDARDCONFIGURATOR_IDL */ diff --git a/CIAO/ciao/CCM_StateIdFactory.idl b/CIAO/ciao/CCM_StateIdFactory.idl new file mode 100644 index 00000000000..de6b3b51b13 --- /dev/null +++ b/CIAO/ciao/CCM_StateIdFactory.idl @@ -0,0 +1,72 @@ +// $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_STATEIDFACTORY) +#define CCM_STATEIDFACTORY + +#include <CosPersistentState.idl> + +module Components +{ + typeprefix Components "omg.org"; + + typedef short SegmentId; + const SegmentId COMPONENT_SEGMENT = 0; + + typedef short FacetId; + const FacetId COMPONENT_FACET = 0; + + typedef sequence<octet> IdData; + typedef CosPersistentState::Pid PersistentId; + + exception InvalidStateIdData {}; + + typedef short StateIdType; + const StateIdType PERSISTENT_ID = 0; + + 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; + +}; +#endif /* CCM_STATEIDFACTORY */ diff --git a/CIAO/ciao/CCM_Transaction.idl b/CIAO/ciao/CCM_Transaction.idl new file mode 100644 index 00000000000..c0c8cdc2c1d --- /dev/null +++ b/CIAO/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/CIAO/ciao/CIAO_Client_Export.h b/CIAO/ciao/CIAO_Client_Export.h new file mode 100644 index 00000000000..a566e94b0c2 --- /dev/null +++ b/CIAO/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/CIAO/ciao/CIAO_Config.h b/CIAO/ciao/CIAO_Config.h new file mode 100644 index 00000000000..42b04622520 --- /dev/null +++ b/CIAO/ciao/CIAO_Config.h @@ -0,0 +1,20 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file CIAO_Config.h + * + * $Id$ + * + * CIAO compile time configuration file. + * + * @author Bala Natarajan <bala @ dre.vanderbilt.edu> + */ +//============================================================================= +#ifndef CIAO_CONFIG_H +#define CIAO_CONFIG_H + +#if !defined (CIAO_DEFAULT_MAP_SIZE) +# define CIAO_DEFAULT_MAP_SIZE 64 +#endif /* CIAO_DEFAULT_MAP_SIZE */ + +#endif /*CIAO_CONFIG_H*/ diff --git a/CIAO/ciao/CIAO_Container_Export.h b/CIAO/ciao/CIAO_Container_Export.h new file mode 100644 index 00000000000..74ba838721d --- /dev/null +++ b/CIAO/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/CIAO/ciao/CIAO_Server_Export.h b/CIAO/ciao/CIAO_Server_Export.h new file mode 100644 index 00000000000..2f0145331e9 --- /dev/null +++ b/CIAO/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/CIAO/ciao/CIAO_SwapExec.idl b/CIAO/ciao/CIAO_SwapExec.idl new file mode 100644 index 00000000000..2349988f46d --- /dev/null +++ b/CIAO/ciao/CIAO_SwapExec.idl @@ -0,0 +1,12 @@ +// $Id$ + +#include "ciao/CCM_EnterpriseComponent.idl" + +module CIAO +{ + local interface Swap_Exec : ::Components::EnterpriseComponent + { + Components::EnterpriseComponent incarnate (); + Components::EnterpriseComponent etherealize (); + }; +}; diff --git a/CIAO/ciao/CIAO_UpgradeableContext.idl b/CIAO/ciao/CIAO_UpgradeableContext.idl new file mode 100644 index 00000000000..6d4b315ae85 --- /dev/null +++ b/CIAO/ciao/CIAO_UpgradeableContext.idl @@ -0,0 +1,17 @@ +// $Id$ + +#include "ciao/CCM_Container.idl" +#include "tao/PortableServer/PortableServer_include.pidl" + +module CIAO +{ + local interface UpgradeableContext : ::Components::SessionContext + { + ::Components::ConsumerDescriptions get_registered_consumers + (in ::Components::FeatureName publisher_name) + raises (::Components::InvalidName, ::Components::InvalidConnection); + void deactivate_facet (in PortableServer::ObjectId oid); + void update_port_activator (in PortableServer::ObjectId oid); + void remove_facet (in Object reference); + }; +}; diff --git a/CIAO/ciao/CIAO_common.h b/CIAO/ciao/CIAO_common.h new file mode 100644 index 00000000000..cd6caa908ba --- /dev/null +++ b/CIAO/ciao/CIAO_common.h @@ -0,0 +1,80 @@ +// $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 (); } + +// By default tracing is turned off. +#if !defined (CIAO_NTRACE) +# if !defined (ACE_NTRACE) +# define CIAO_NTRACE 1 +# else +# define CIAO_NTRACE ACE_NTRACE +# endif +#endif /* CIAO_NTRACE */ + +#if (CIAO_NTRACE == 1) +# if !defined (ACE_NTRACE) +# define CIAO_TRACE(X) +# else +# if (ACE_NTRACE == 0) +# error CIAO_TRACE cannot be disabled if ACE_TRACE is enabled +# else +# define CIAO_TRACE(X) +# endif +# endif +#else +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CIAO_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* CIAO_NTRACE */ + +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/CIAO/ciao/Client_init.cpp b/CIAO/ciao/Client_init.cpp new file mode 100644 index 00000000000..15325cf7a4e --- /dev/null +++ b/CIAO/ciao/Client_init.cpp @@ -0,0 +1,56 @@ +// $Id$ + +#include "Client_init.h" +#include "CIAO_common.h" +#include "CCM_ComponentC.h" +#include "CCM_StandardConfiguratorC.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::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/CIAO/ciao/Client_init.h b/CIAO/ciao/Client_init.h new file mode 100644 index 00000000000..9c86e386778 --- /dev/null +++ b/CIAO/ciao/Client_init.h @@ -0,0 +1,47 @@ +// -*- C++ -*- +// +// $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 */ + +#include "tao/orbconf.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL +namespace CORBA +{ + class ORB; + typedef ORB *ORB_ptr; +} +TAO_END_VERSIONED_NAMESPACE_DECL + +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/CIAO/ciao/Components.idl b/CIAO/ciao/Components.idl new file mode 100644 index 00000000000..f58740eae6a --- /dev/null +++ b/CIAO/ciao/Components.idl @@ -0,0 +1,18 @@ +// $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 "ciao/CCM_Component.idl" +#include "ciao/CCM_KeylessCCMHome.idl" +#include "ciao/CCM_Home.idl" +#include "ciao/CCM_Object.idl" + +#endif /* CIAO_COMPONENTS_IDL */ + diff --git a/CIAO/ciao/Container_Base.cpp b/CIAO/ciao/Container_Base.cpp new file mode 100644 index 00000000000..1a991cd45a6 --- /dev/null +++ b/CIAO/ciao/Container_Base.cpp @@ -0,0 +1,66 @@ +// $Id$ + +#include "Container_Base.h" +#include "CIAO_common.h" + +namespace CIAO +{ + //////////////////////////////////////////////////////////////// + + Container::Container (CORBA::ORB_ptr o) + : orb_ (CORBA::ORB::_duplicate (o)), + container_impl_ (0) + { + } + + Container::Container (CORBA::ORB_ptr o, Container_Impl *container_impl) + : orb_ (CORBA::ORB::_duplicate (o)), + container_impl_ (container_impl) + { + } + + Container::~Container (void) + { + } + + void + Container::set_receptacle_policy_map (::CIAO::REC_POL_MAP &rec_pol_map) + { + for (::CIAO::REC_POL_MAP_ITERATOR it = rec_pol_map.begin (); + it != rec_pol_map.end (); ++it) + { + this->rec_pol_map_.bind ((*it).ext_id_, (*it).int_id_); + } + } + + CORBA::PolicyList + Container::get_receptacle_policy (const char* name) + { + CORBA::PolicyList policy_list; + if (this->rec_pol_map_.find (name, policy_list) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Unable to find policies " + "for the receptacle %s\n", name)); + policy_list.length (0); + } + return policy_list; + } + + PortableServer::POA_ptr + Container::the_POA (void) const + { + return this->component_poa_.in (); + } + + PortableServer::POA_ptr + Container::the_facet_cons_POA (void) const + { + return this->facet_cons_poa_.in (); + } + + CORBA::ORB_ptr + Container::the_ORB (void) const + { + return this->orb_.in (); + } +} diff --git a/CIAO/ciao/Container_Base.h b/CIAO/ciao/Container_Base.h new file mode 100644 index 00000000000..efc039d74e7 --- /dev/null +++ b/CIAO/ciao/Container_Base.h @@ -0,0 +1,159 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Container_Base.h + * + * $Id$ + * + * Header file for CIAO's container implementations + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + * @author Gan Deng <dengg@dre.vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTAINER_BASE_H +#define CIAO_CONTAINER_BASE_H + +#include /**/ "ace/pre.h" + +#include "ciao/CCM_ContainerC.h" + +#include "ciao/CIAO_Server_Export.h" + +#include "tao/PortableServer/PortableServer.h" + +#include "tao/ORB.h" + +#include "ace/Hash_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class Dynamic_Component_Servant_Base; + class Container_Impl; + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + CORBA::PolicyList, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> REC_POL_MAP; + typedef ACE_Hash_Map_Iterator<ACE_CString, + CORBA::PolicyList, + ACE_Null_Mutex> REC_POL_MAP_ITERATOR; + + /** + * @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: + enum OA_Type + { + Component, + Facet_Consumer + }; + + Container (CORBA::ORB_ptr o); + Container (CORBA::ORB_ptr o, Container_Impl *container_impl); + + virtual ~Container (void) = 0; + + /// Get component's POA. + /** + * This operation does *NOT* increase the reference count of the + * POA. Look at the const qualifier in the method. + */ + PortableServer::POA_ptr the_POA (void) const; + PortableServer::POA_ptr the_facet_cons_POA (void) const; + + /// Get a reference to the underlying ORB. + CORBA::ORB_ptr the_ORB (void) const; + + /// Set the policy map for all the receptacles hosted in this container. + void set_receptacle_policy_map (::CIAO::REC_POL_MAP &rec_pol_map); + + /// get the receptacle policy given the receptacle name + CORBA::PolicyList get_receptacle_policy (const char *name); + + /// Initialize the container with a name. + virtual int init (const char *name = 0, + const CORBA::PolicyList *more_policies = 0) = 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, + const char *ins_name) = 0; + + // Uninstall a servant for component or home. + virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref) = 0; + + // Uninstall a servant for component. + virtual void uninstall_component (::Components::CCMObject_ptr objref, + PortableServer::ObjectId_out oid) = 0; + + virtual void add_servant_to_map (PortableServer::ObjectId &oid, + Dynamic_Component_Servant_Base* servant) = 0; + + virtual void delete_servant_from_map (PortableServer::ObjectId &oid) = 0; + + virtual CORBA::Object_ptr get_home_objref (PortableServer::Servant p) = 0; + + protected: + /// Reference to the ORB + CORBA::ORB_var orb_; + + /// POA within which all the components in this container will be + /// activated. + PortableServer::POA_var component_poa_; + + /// POA within which all the facets and receptacles will be + /// activated. + /** + * Having two POA's allows us to associate different policies that + * are distinct from the component. + */ + PortableServer::POA_var facet_cons_poa_; + + PortableServer::POA_var home_servant_poa_; + Container_Impl *container_impl_; + ::CIAO::REC_POL_MAP rec_pol_map_; + private: + /// Not allowed to be used + Container (void); + }; +} + +// 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 ()->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); \ + } + +#include /**/ "ace/post.h" +#endif /* CIAO_CONTAINER_BASE_H */ diff --git a/CIAO/ciao/Context_Impl_Base.cpp b/CIAO/ciao/Context_Impl_Base.cpp new file mode 100644 index 00000000000..77089fb5048 --- /dev/null +++ b/CIAO/ciao/Context_Impl_Base.cpp @@ -0,0 +1,87 @@ +// $Id$ + +#include "Context_Impl_Base.h" +#include "Container_Base.h" + +namespace CIAO +{ + Context_Impl_Base::Context_Impl_Base (void) + { + ACE_ASSERT (0); + } + + Context_Impl_Base::Context_Impl_Base (Components::CCMHome_ptr home, + Session_Container * c) + : home_ (Components::CCMHome::_duplicate (home)), + container_ (c) + { + } + + Context_Impl_Base::~Context_Impl_Base (void) + { + } + + // Operations from ::Components::CCMContext. + + Components::Principal_ptr + Context_Impl_Base::get_caller_principal (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + Components::CCMHome_ptr + Context_Impl_Base::get_CCM_home (void) + { + return Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + Context_Impl_Base::get_rollback_only (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + Components::Transaction::UserTransaction_ptr + Context_Impl_Base::get_user_transaction (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + CORBA::Boolean + Context_Impl_Base::is_caller_in_role (const char * /* role */) + { + throw CORBA::NO_IMPLEMENT (); + } + + void + Context_Impl_Base::set_rollback_only (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + CORBA::Object_ptr + Context_Impl_Base::resolve_service_reference(const char *) + { + throw CORBA::NO_IMPLEMENT (); + } + + // CIAO-specific. + + CIAO::Session_Container * + Context_Impl_Base::_ciao_the_Container (void) const + { + return this->container_; + } + + const char * + Context_Impl_Base::_ciao_instance_id (void) const + { + return this->ciao_instance_id_.in (); + } + + void + Context_Impl_Base::_ciao_instance_id (const char *instance_id) + { + this->ciao_instance_id_ = instance_id; + } +} diff --git a/CIAO/ciao/Context_Impl_Base.h b/CIAO/ciao/Context_Impl_Base.h new file mode 100644 index 00000000000..1c5bcf9ea4b --- /dev/null +++ b/CIAO/ciao/Context_Impl_Base.h @@ -0,0 +1,102 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Context_Impl_Base.h + * + * $Id$ + * + * This file contains the non-template declaration of a base class for + * the template mixin for the generated context class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTEXT_IMPL_BASE_H +#define CIAO_CONTEXT_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#include "CIAO_Server_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/CCM_ContainerC.h" +#include "tao/Objref_VarOut_T.h" + +namespace Components +{ + class CCMHome; + typedef CCMHome *CCMHome_ptr; + + typedef + TAO_Objref_Var_T< + CCMHome + > + CCMHome_var; +} + +namespace CIAO +{ + class Session_Container; + + /** + * @class Context_Impl_Base + * + * @brief Non-template base class for Context_Impl. + * + * Holds the non-template parts of its child class + * Context_Impl. + */ + class CIAO_SERVER_Export Context_Impl_Base + : public virtual Components::CCMContext + { + public: + /// @todo This constructor should be declarated private but it seems + /// the compilers want it, have to sort this out in detail. + Context_Impl_Base (void); + + Context_Impl_Base (Components::CCMHome_ptr home, Session_Container * c); + + virtual ~Context_Impl_Base (void); + + // Operations from ::Components::CCMContext. + + virtual Components::Principal_ptr get_caller_principal (); + + virtual Components::CCMHome_ptr get_CCM_home (); + + virtual CORBA::Boolean get_rollback_only (); + + virtual Components::Transaction::UserTransaction_ptr get_user_transaction (); + + virtual CORBA::Boolean is_caller_in_role (const char *role); + + virtual void set_rollback_only (); + + virtual CORBA::Object_ptr resolve_service_reference(const char *service_id); + + // CIAO-specific. + + CIAO::Session_Container *_ciao_the_Container (void) const; + + // Accessors for the private member. + const char *_ciao_instance_id (void) const; + void _ciao_instance_id (const char *instance_id); + + protected: + Components::CCMHome_var home_; + Session_Container *container_; + + private: + CORBA::String_var ciao_instance_id_; + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_CONTEXT_IMPL_BASE_H */ diff --git a/CIAO/ciao/Context_Impl_T.cpp b/CIAO/ciao/Context_Impl_T.cpp new file mode 100644 index 00000000000..29558dafb0b --- /dev/null +++ b/CIAO/ciao/Context_Impl_T.cpp @@ -0,0 +1,63 @@ +// $Id$ + +#ifndef CIAO_CONTEXT_IMPL_T_C +#define CIAO_CONTEXT_IMPL_T_C + +#include "Context_Impl_T.h" + +namespace CIAO +{ + template <typename BASE_CTX, + typename SVNT, + typename COMP> + Context_Impl<BASE_CTX, SVNT, COMP>::Context_Impl ( + Components::CCMHome_ptr the_home, + Session_Container *c, + SVNT *sv) + : Context_Impl_Base (the_home, c), + servant_ (sv) + { + } + + template <typename BASE_CTX, + typename SVNT, + typename COMP> + Context_Impl<BASE_CTX, SVNT, COMP>::~Context_Impl (void) + { + } + + // Operations from ::Components::SessionContext. + + template <typename BASE_CTX, + typename SVNT, + typename COMP> + CORBA::Object_ptr + Context_Impl<BASE_CTX, SVNT, COMP>::get_CCM_object (void) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj; + + try + { + obj = this->container_->get_objref (this->servant_); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Caught Exception \n"); + return CORBA::Object::_nil (); + } + + this->component_ = COMP::_narrow (obj.in ()); + + if (CORBA::is_nil (this->component_.in ())) + { + throw CORBA::INTERNAL (); + } + } + + return COMP::_duplicate (this->component_.in ()); + } +} + +#endif /* CIAO_CONTEXT_IMPL_T_C */ diff --git a/CIAO/ciao/Context_Impl_T.h b/CIAO/ciao/Context_Impl_T.h new file mode 100644 index 00000000000..d4e0deb4cba --- /dev/null +++ b/CIAO/ciao/Context_Impl_T.h @@ -0,0 +1,101 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Context_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated context class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTEXT_IMPL_T_H +#define CIAO_CONTEXT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "Context_Impl_Base.h" +#include "tao/LocalObject.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL +namespace CORBA +{ + class SystemException; +} + +namespace SecurityLevel2 +{ + class Credentials; +} +TAO_END_VERSIONED_NAMESPACE_DECL + +namespace Components +{ + typedef SecurityLevel2::Credentials Principal; + typedef Principal *Principal_ptr; + + class IllegalState; + + namespace Transaction + { + class UserTransaction; + typedef UserTransaction *UserTransaction_ptr; + } +} + +namespace CIAO +{ + class Session_Container; + + /** + * @class Context_Impl + * + * @brief Mixin base class for generated context. + * + * This class implements operations and contains parameterized + * members common to all generated servants. + */ + template <typename BASE_CTX, + typename SVNT, + typename COMP> + class Context_Impl : public virtual BASE_CTX, + public virtual Context_Impl_Base, + public virtual TAO_Local_RefCounted_Object + { + public: + Context_Impl (Components::CCMHome_ptr the_home, + Session_Container *c, + SVNT *sv); + + virtual ~Context_Impl (void); + + // Operations from ::Components::SessionContext. + + virtual CORBA::Object_ptr get_CCM_object (); + + protected: + SVNT *servant_; + typename COMP::_var_type component_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Context_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Context_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_CONTEXT_IMPL_T_H */ diff --git a/CIAO/ciao/Cookies.cpp b/CIAO/ciao/Cookies.cpp new file mode 100644 index 00000000000..7679f31401b --- /dev/null +++ b/CIAO/ciao/Cookies.cpp @@ -0,0 +1,67 @@ +// $Id$ +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +#include "Cookies.inl" +#endif /* !defined INLINE */ + +ACE_RCSID (ciao, + Cookies, + "$Id$") + +namespace CIAO +{ + Cookie_Impl::Cookie_Impl (CORBA::ULong const &key) + { + this->cookieValue ().length (sizeof (CORBA::ULong)); + ACE_OS::memcpy (this->cookieValue ().get_buffer (false), + &key, + sizeof (CORBA::ULong)); + } + + Cookie_Impl::~Cookie_Impl (void) + { + } + + bool + Cookie_Impl::extract (Components::Cookie const * const ck, + CORBA::ULong &key) + { + Cookie_Impl const * const c = + dynamic_cast <Cookie_Impl const * const> (ck); + + if (c == 0) + { + return false; + } + + CORBA::OctetSeq const &x = c->cookieValue (); + + if (x.length () != sizeof (CORBA::ULong)) + { + return false; + } + + key = *reinterpret_cast<const CORBA::ULong *> (x.get_buffer ()); + + return true; + } + + //======================================================== + + CORBA::ValueBase * + Cookie_Impl_init::create_for_unmarshal (void) + { + CORBA::ValueBase *ret_val = 0; + + ACE_NEW_THROW_EX (ret_val, + CIAO::Cookie_Impl, + CORBA::NO_MEMORY ()); + + return ret_val; + } + + Cookie_Impl_init::~Cookie_Impl_init (void) + { + } +} diff --git a/CIAO/ciao/Cookies.h b/CIAO/ciao/Cookies.h new file mode 100644 index 00000000000..55200008d38 --- /dev/null +++ b/CIAO/ciao/Cookies.h @@ -0,0 +1,66 @@ +// $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_CookieC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Container_Export.h" +#include "ace/Active_Map_Manager.h" + +namespace CIAO +{ + /** + * @class Cookie_Impl + * + * @brief A cookie implementation using CORBA::ULong + */ + class CIAO_CONTAINER_Export Cookie_Impl + : public virtual OBV_Components::Cookie + { + public: + Cookie_Impl (void); + virtual ~Cookie_Impl (void); + + /// Initialize a @c Cookie with a @c CORBA::ULong + Cookie_Impl (CORBA::ULong const &key); + + /// Extract the @c CORBA::ULong + static bool extract (Components::Cookie const * const c, + CORBA::ULong &key); + }; + + /** + * @class Cookie_Impl_init + * + * @brief Valuefactory implementation for Cookie_Impl. + */ + class CIAO_CONTAINER_Export Cookie_Impl_init : + public virtual Components::Cookie_init + { + public: + virtual ~Cookie_Impl_init (void); + + virtual CORBA::ValueBase *create_for_unmarshal (void); + }; +} + +#if defined (__ACE_INLINE__) +#include "Cookies.inl" +#endif /* !defined INLINE */ + +#include /**/ "ace/post.h" +#endif /* CIAO_COOKIES_H */ diff --git a/CIAO/ciao/Cookies.inl b/CIAO/ciao/Cookies.inl new file mode 100644 index 00000000000..406485110c4 --- /dev/null +++ b/CIAO/ciao/Cookies.inl @@ -0,0 +1,10 @@ +/* -*- C++ -*- */ +// $Id$ + +namespace CIAO +{ + ACE_INLINE + Cookie_Impl::Cookie_Impl (void) + { + } +} diff --git a/CIAO/ciao/CosPersistentState.idl b/CIAO/ciao/CosPersistentState.idl new file mode 100644 index 00000000000..a5211d071aa --- /dev/null +++ b/CIAO/ciao/CosPersistentState.idl @@ -0,0 +1,24 @@ +// $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/CIAO/ciao/Dynamic_Component_Activator.cpp b/CIAO/ciao/Dynamic_Component_Activator.cpp new file mode 100644 index 00000000000..ba1dae03d74 --- /dev/null +++ b/CIAO/ciao/Dynamic_Component_Activator.cpp @@ -0,0 +1,63 @@ +#include "ciao/Dynamic_Component_Activator.h" +#include "ciao/Dynamic_Component_Servant_Base.h" +#include "ciao/CIAO_common.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ciao, + Dynamic_Component_Activator, + "$Id$") + +namespace CIAO +{ + Dynamic_Component_Activator::Dynamic_Component_Activator (CORBA::ORB_ptr o) + : orb_ (CORBA::ORB::_duplicate (o)) + { + } + + Dynamic_Component_Activator::~Dynamic_Component_Activator (void) + { + } + + PortableServer::Servant + Dynamic_Component_Activator::incarnate (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr) + { + Dynamic_Component_Servant_Base* servant = 0; + PortableServer::ObjectId new_oid (oid); + + if (this->servant_map_.find (oid, servant) == 0) + { + return servant->create (new_oid); + } + + return 0; + } + + void + Dynamic_Component_Activator::etherealize ( + const PortableServer::ObjectId &, + PortableServer::POA_ptr , + PortableServer::Servant , + CORBA::Boolean , + CORBA::Boolean) + { + } + + void Dynamic_Component_Activator::add_servant_to_map + (PortableServer::ObjectId &oid, + Dynamic_Component_Servant_Base* servant) + { + this->servant_map_.bind (oid, servant); + } + + void Dynamic_Component_Activator::delete_servant_from_map + (PortableServer::ObjectId &oid) + { + Dynamic_Component_Servant_Base* servant = 0; + if (this->servant_map_.unbind (oid, servant) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Invalid object reference\n")); + } + } +} diff --git a/CIAO/ciao/Dynamic_Component_Activator.h b/CIAO/ciao/Dynamic_Component_Activator.h new file mode 100644 index 00000000000..4046fda3b02 --- /dev/null +++ b/CIAO/ciao/Dynamic_Component_Activator.h @@ -0,0 +1,98 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dynamic_Component_Activator.h + * + * $Id$ + * + * @authors Jaiganesh Balasubramanian <jai@dre.vanderbilt.edu> + * Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_DYNAMIC_COMPONENT_ACTIVATOR_H +#define CIAO_DYNAMIC_COMPONENT_ACTIVATOR_H +#include /**/ "ace/pre.h" + +#include "ciao/CIAO_Server_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/CCM_ContainerC.h" + +#include "tao/PortableServer/Key_Adapters.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/ServantActivatorC.h" + +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Array_Base.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +namespace CIAO +{ + + class Dynamic_Component_Servant_Base; + /** + * @class Dynamic_Component_Activator + * + * @brief Activator that is registered with the POA for facet and + * consumer servants. + * + */ + class CIAO_SERVER_Export Dynamic_Component_Activator + : public virtual PortableServer::ServantActivator + , public virtual TAO_Local_RefCounted_Object + { + public: + Dynamic_Component_Activator (CORBA::ORB_ptr o); + + virtual ~Dynamic_Component_Activator (void); + + /// Template methods overridden to get callbacks. + /** + * If you would like to know the details of the following two + * methods, please PortableServer documentation. This is probably + * not the place to document what these mean. + */ + PortableServer::Servant incarnate ( + const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa); + + void etherealize (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr adapter, + PortableServer::Servant servant, + CORBA::Boolean cleanup_in_progress, + CORBA::Boolean remaining_activations); + + void add_servant_to_map (PortableServer::ObjectId &oid, + Dynamic_Component_Servant_Base* servant); + + void delete_servant_from_map (PortableServer::ObjectId &oid); + + private: + /// Pointer to our ORB + CORBA::ORB_var orb_; + + ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, + Dynamic_Component_Servant_Base *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + servant_map_; + }; +} + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /* CIAO_DYNAMIC_COMPONENT_ACTIVATOR_H */ diff --git a/CIAO/ciao/Dynamic_Component_Servant_Base.cpp b/CIAO/ciao/Dynamic_Component_Servant_Base.cpp new file mode 100644 index 00000000000..773004e6741 --- /dev/null +++ b/CIAO/ciao/Dynamic_Component_Servant_Base.cpp @@ -0,0 +1,27 @@ +#include "ciao/CIAO_common.h" +#include "ciao/Dynamic_Component_Servant_Base.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ciao, + Dynamic_Component_Servant_Base, + "$Id$") + +namespace CIAO +{ + Dynamic_Component_Servant_Base::Dynamic_Component_Servant_Base (void) + : container_ (0) + { + ACE_ASSERT (0); + } + + Dynamic_Component_Servant_Base::Dynamic_Component_Servant_Base + (Session_Container * c) + : container_ (c) + { + } + + Dynamic_Component_Servant_Base::~Dynamic_Component_Servant_Base (void) + { + } +} diff --git a/CIAO/ciao/Dynamic_Component_Servant_Base.h b/CIAO/ciao/Dynamic_Component_Servant_Base.h new file mode 100644 index 00000000000..6357c5d1154 --- /dev/null +++ b/CIAO/ciao/Dynamic_Component_Servant_Base.h @@ -0,0 +1,54 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dynamic_Component_Servant_Base.h + * + * $Id$ + * + */ +//============================================================================= + + +#ifndef CIAO_DYNAMIC_COMPONENT_SERVANT_BASE__H +#define CIAO_DYNAMIC_COMPONENT_SERVANT_BASE__H + +#include /**/ "ace/pre.h" + +#include "ciao/CIAO_Server_Export.h" + +#include "tao/PortableServer/PortableServer.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class Session_Container; + class CIAO_SERVER_Export Dynamic_Component_Servant_Base + { + public: + /// @todo Not to be used, no idea why this should be public, have to check this + Dynamic_Component_Servant_Base (void); + + explicit Dynamic_Component_Servant_Base (Session_Container *c); + + virtual ~Dynamic_Component_Servant_Base (void); + + virtual PortableServer::Servant + create (PortableServer::ObjectId &oid) = 0; + + virtual void destroy (PortableServer::ObjectId &oid) = 0; + + virtual void update_destroy_count () = 0; + + protected: + Session_Container *container_; + }; + +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_DYNAMIC_COMPONENT_SERVANT_BASE__H */ diff --git a/CIAO/ciao/Dynamic_Component_Servant_T.cpp b/CIAO/ciao/Dynamic_Component_Servant_T.cpp new file mode 100644 index 00000000000..a69d568264a --- /dev/null +++ b/CIAO/ciao/Dynamic_Component_Servant_T.cpp @@ -0,0 +1,90 @@ +// $Id$ + +#ifndef CIAO_DYNAMIC_COMPONENT_SERVANT_T_C +#define CIAO_DYNAMIC_COMPONENT_SERVANT_T_C + +#include "Dynamic_Component_Servant_T.h" + +namespace CIAO +{ + template <typename COMP_SVNT> + Dynamic_Component_Servant<COMP_SVNT>::Dynamic_Component_Servant ( + Components::EnterpriseComponent_ptr ec, + Components::CCMHome_ptr home, + const char* ins_name, + Home_Servant_Impl_Base *home_servant, + Session_Container *c) + : Dynamic_Component_Servant_Base (c) + , executor_ (Components::EnterpriseComponent::_duplicate (ec)) + , ins_name_ (ins_name) + , home_servant_ (home_servant) + , home_ (Components::CCMHome::_duplicate (home)) + , component_removed_ (false) + { + } + + template <typename COMP_SVNT> + void Dynamic_Component_Servant<COMP_SVNT>::update_destroy_count (void) + { + component_removed_ = true; + } + + template <typename COMP_SVNT> + Dynamic_Component_Servant<COMP_SVNT>::~Dynamic_Component_Servant (void) + { + } + + template <typename COMP_SVNT> + void Dynamic_Component_Servant<COMP_SVNT>::destroy ( + PortableServer::ObjectId &oid) + { + // @@Jai, here is a logical problem. You find a servant from a map + // having a list of servants and you turn on a bit. What is the + // granularity of the bit? Looks like its too coarse. Do you see + // what I am saying? + COMP_SVNT *servant = 0; + + if (0 == this->servant_map_.find (oid, servant)) + { + servant->remove (); + component_removed_ = true; + } + } + + template <typename COMP_SVNT> + PortableServer::Servant Dynamic_Component_Servant<COMP_SVNT>::create ( + PortableServer::ObjectId &oid) + { + CIAO::Swap_Exec_var swap_exec = + CIAO::Swap_Exec::_narrow (this->executor_.in ()); + + ::Components::EnterpriseComponent_var ciao_ec = + swap_exec->incarnate (); + + typedef typename COMP_SVNT::_exec_type exec_type; + typename COMP_SVNT::_exec_type::_var_type ciao_comp = + exec_type::_narrow (ciao_ec.in ()); + + /// @@ Jai, should you be using ACE_NEW_THROW_EX here? + COMP_SVNT *svt = new COMP_SVNT (ciao_comp.in (), + this->home_.in (), + this->ins_name_.in (), + this->home_servant_, + this->container_); + + // @@Jai, see the problem with a coarse grained stuff here. + if (component_removed_ == true) + { + // svt->ciao_preactivate (); + // svt->ciao_activate (); + // svt->ciao_postactivate (); + component_removed_ = false; + } + + PortableServer::ServantBase_var safe (svt); + this->servant_map_.bind (oid, svt); + return safe._retn (); + } +} + +#endif /* CIAO_DYNAMIC_COMPONENT_SERVANT_T_C */ diff --git a/CIAO/ciao/Dynamic_Component_Servant_T.h b/CIAO/ciao/Dynamic_Component_Servant_T.h new file mode 100644 index 00000000000..759ea1c524a --- /dev/null +++ b/CIAO/ciao/Dynamic_Component_Servant_T.h @@ -0,0 +1,85 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dynamic_Component_Servant_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated home servant class. + * + */ +//============================================================================= + + +#ifndef CIAO_DYNAMIC_COMPONENT_SERVANT_T_H +#define CIAO_DYNAMIC_COMPONENT_SERVANT_T_H + +#include /**/ "ace/pre.h" + +#include "Dynamic_Component_Servant_Base.h" +#include "CIAO_SwapExecC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Hash_Map_Manager_T.h" + +namespace CIAO +{ + template <typename COMP_SVNT> + class Dynamic_Component_Servant + : public virtual Dynamic_Component_Servant_Base + { + public: + // @@Jai, please add documentation for these methods. + Dynamic_Component_Servant (Components::EnterpriseComponent_ptr ec, + Components::CCMHome_ptr home, + const char* ins_name, + Home_Servant_Impl_Base *home_servant, + Session_Container *c); + + virtual ~Dynamic_Component_Servant (void); + + virtual PortableServer::Servant create (PortableServer::ObjectId &oid); + + virtual void destroy (PortableServer::ObjectId &oid); + + virtual void update_destroy_count (void); + + protected: + Components::EnterpriseComponent_var executor_; + + CORBA::String_var ins_name_; + + Home_Servant_Impl_Base *home_servant_; + + Components::CCMHome_var home_; + + // @@ Jai, please document why this is there. + ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, + COMP_SVNT *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + servant_map_; + + // @@ Jai, please explain what this flag means? + bool component_removed_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Dynamic_Component_Servant_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Dynamic_Component_Servant_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_DYNAMIC_COMPONENT_SERVANT_T_H */ diff --git a/CIAO/ciao/Home_Servant_Impl_Base.cpp b/CIAO/ciao/Home_Servant_Impl_Base.cpp new file mode 100644 index 00000000000..8829f170d90 --- /dev/null +++ b/CIAO/ciao/Home_Servant_Impl_Base.cpp @@ -0,0 +1,30 @@ +// $Id$ + +#include "Home_Servant_Impl_Base.h" + +namespace CIAO +{ + Home_Servant_Impl_Base::Home_Servant_Impl_Base (Session_Container * c) + : container_ (c) + { + } + + Home_Servant_Impl_Base::~Home_Servant_Impl_Base (void) + { + } + + // Operations for CCMHome interface. + + CORBA::IRObject_ptr + Home_Servant_Impl_Base::get_component_def (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + CORBA::IRObject_ptr + Home_Servant_Impl_Base::get_home_def (void) + { + throw CORBA::NO_IMPLEMENT (); + } + +} diff --git a/CIAO/ciao/Home_Servant_Impl_Base.h b/CIAO/ciao/Home_Servant_Impl_Base.h new file mode 100644 index 00000000000..12ad7105e12 --- /dev/null +++ b/CIAO/ciao/Home_Servant_Impl_Base.h @@ -0,0 +1,69 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Home_Servant_Impl_Base.h + * + * $Id$ + * + * This file contains the non-template declaration of a base class for + * the template mixin for the generated home servant class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_HOME_SERVANT_IMPL_BASE_H +#define CIAO_HOME_SERVANT_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#include "CCM_HomeS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Server_Export.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Home_Servant_Impl_Base + * + * @brief Non-template base class for Home_Servant_Impl. + * + * Holds the non-template parts of its child class + * Home_Servant_Impl. + */ + class CIAO_SERVER_Export Home_Servant_Impl_Base + : public virtual POA_Components::CCMHome + { + public: + Home_Servant_Impl_Base (Session_Container * c); + + virtual ~Home_Servant_Impl_Base (void); + + // Operations for CCMHome interface. + + virtual ::CORBA::IRObject_ptr get_component_def (void); + + virtual ::CORBA::IRObject_ptr get_home_def (void); + + virtual void + update_component_map (PortableServer::ObjectId &oid) = 0; + + protected: + Session_Container *container_; + private: + /// Not to be used + Home_Servant_Impl_Base (void); + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_HOME_SERVANT_IMPL_BASE_H */ diff --git a/CIAO/ciao/Home_Servant_Impl_T.cpp b/CIAO/ciao/Home_Servant_Impl_T.cpp new file mode 100644 index 00000000000..02e53985f11 --- /dev/null +++ b/CIAO/ciao/Home_Servant_Impl_T.cpp @@ -0,0 +1,212 @@ +// $Id$ + +#ifndef CIAO_HOME_SERVANT_IMPL_T_C +#define CIAO_HOME_SERVANT_IMPL_T_C + +#include "Home_Servant_Impl_T.h" +#include "CIAO_common.h" + +namespace CIAO +{ + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::Home_Servant_Impl ( + typename EXEC::_ptr_type exe, + Session_Container * c, + const char *ins_name + ) + : Home_Servant_Impl_Base (c), + ins_name_ (ins_name), + executor_ (EXEC::_duplicate (exe)) + { + } + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::~Home_Servant_Impl (void) + { + CIAO_TRACE ("Home_Servant_Impl<>::destructor"); + + const OBJ_ITERATOR end = this->objref_map_.end (); + + for (OBJ_ITERATOR iter = this->objref_map_.begin (); + iter != end; + ++iter) + { + this->remove_component (((*iter).int_id_).in ()); + } + } + + // Operations for CCMHome interface. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::remove_component ( + ::Components::CCMObject_ptr comp) + { + CIAO_TRACE ("Home_Servant_Impl<>::remove_component"); + + PortableServer::ObjectId_var oid = + this->container_->the_POA ()->reference_to_id (comp); + + Components::CCMObject_var ccm_obj_var = Components::CCMObject::_nil (); + if (objref_map_.find (oid.in (), ccm_obj_var) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Invalid component object reference\n")); + return; + } + + typedef typename COMP_SVNT::_stub_type stub_type; + typename COMP_SVNT::_stub_var_type _ciao_comp = + stub_type::_narrow (ccm_obj_var.in ()); + + if (CORBA::is_nil (_ciao_comp.in ())) + { + throw Components::RemoveFailure (); + } + + _ciao_comp->remove (); + + if (CIAO::debug_level () > 3) + { + ACE_DEBUG ((LM_DEBUG, "Removed the component\n")); + } + } + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::update_component_map ( + PortableServer::ObjectId &oid) + { + CIAO_TRACE ("update_component_map"); + + Components::CCMObject_var ccm_obj_ptr; + if (objref_map_.unbind (oid, ccm_obj_ptr) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Invalid component object reference\n")); + return; + } + + return; + } + + // Operations for keyless home interface. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + Components::CCMObject_ptr + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::create_component (void) + { + CIAO_TRACE ("Home_Servant_Impl<>::create_component"); + + return this->create (); + } + + // Operations for implicit home interface. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + typename COMP_SVNT::_stub_ptr_type + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::create (void) + { + CIAO_TRACE ("Home_Servant_Impl<>::create"); + + if (this->executor_.in () == 0) + { + throw CORBA::INTERNAL (); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (); + + typedef typename COMP_SVNT::_exec_type exec_type; + typename COMP_SVNT::_exec_type::_var_type _ciao_comp = + exec_type::_narrow (_ciao_ec.in ()); + + return this->_ciao_activate_component (_ciao_comp.in ()); + } + + // CIAO-specific operations. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + typename COMP_SVNT::_stub_ptr_type + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::_ciao_activate_component ( + typename COMP_SVNT::_exec_type::_ptr_type exe) + { + CIAO_TRACE ("Home_Servant_Impl<>::_ciao_activate_component"); + + CORBA::Object_var hobj = this->container_->get_objref (this); + + Components::CCMHome_var home = + Components::CCMHome::_narrow (hobj.in ()); + + typedef typename COMP_SVNT::_stub_type stub_type; + COMP_SVNT *svt = 0; + ACE_NEW_RETURN (svt, + COMP_SVNT (exe, + home.in (), + this->ins_name_, + this, + this->container_), + stub_type::_nil ()); + + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref = + this->container_->install_component (svt, oid.out ()); + + typedef typename COMP_SVNT::_stub_type stub_type; + typename COMP_SVNT::_stub_var_type ho = stub_type::_narrow (objref.in ()); + + Components::CCMObject_var ccmobjref = + Components::CCMObject::_narrow (objref.in ()); + + this->objref_map_.bind ( + oid.in (), + Components::CCMObject::_duplicate (ccmobjref.in ())); + + return ho._retn (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::_ciao_passivate_component ( + typename COMP_SVNT::_stub_ptr_type comp) + { + CIAO_TRACE ("Home_Servant_Impl<>::_ciao_passivate_component"); + + PortableServer::ObjectId_var oid; + this->container_->uninstall_component (comp, oid.out ()); + } +} + +#endif /* CIAO_HOME_SERVANT_IMPL_T_C */ diff --git a/CIAO/ciao/Home_Servant_Impl_T.h b/CIAO/ciao/Home_Servant_Impl_T.h new file mode 100644 index 00000000000..439490ab829 --- /dev/null +++ b/CIAO/ciao/Home_Servant_Impl_T.h @@ -0,0 +1,108 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Home_Servant_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated home servant class. + * + * @authors Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_HOME_SERVANT_IMPL_T_H +#define CIAO_HOME_SERVANT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "Home_Servant_Impl_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Hash_Map_Manager_T.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Home_Servant_Impl + * + * @brief Mixin base class for generated home servant. + * + * This class implements operations + * common to all generated home servants. + */ + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + class Home_Servant_Impl + : public virtual BASE_SKEL, + public virtual Home_Servant_Impl_Base + { + public: + Home_Servant_Impl (typename EXEC::_ptr_type exe, + Session_Container * c, + const char *ins_name); + + virtual ~Home_Servant_Impl (void); + + // Operations for CCMHome interface. + + virtual void remove_component (Components::CCMObject_ptr comp); + + // Operations for keyless home interface. + + virtual ::Components::CCMObject_ptr create_component (); + + // Operations for implicit home interface. + + virtual typename COMP_SVNT::_stub_ptr_type create (); + + virtual void + update_component_map (PortableServer::ObjectId &oid); + + protected: + // CIAO-specific operations. + + typename COMP_SVNT::_stub_ptr_type + _ciao_activate_component (typename COMP_SVNT::_exec_type::_ptr_type exe); + + void + _ciao_passivate_component (typename COMP_SVNT::_stub_ptr_type comp); + + protected: + const char *ins_name_; + typename EXEC::_var_type executor_; + + typedef ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, + Components::CCMObject_var, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + OBJREF_MAP; + + typedef OBJREF_MAP::iterator OBJ_ITERATOR; + + OBJREF_MAP objref_map_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Home_Servant_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Home_Servant_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_HOME_SERVANT_IMPL_T_H */ diff --git a/CIAO/ciao/Object_Set_T.cpp b/CIAO/ciao/Object_Set_T.cpp new file mode 100644 index 00000000000..5a70d6e0922 --- /dev/null +++ b/CIAO/ciao/Object_Set_T.cpp @@ -0,0 +1,133 @@ +// $Id$ + +#ifndef CIAO_OBJECT_SET_T_C +#define CIAO_OBJECT_SET_T_C + +#include "Object_Set_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "Object_Set_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ciao, Object_Set_T, "$Id$") + +template <class T, class T_var> +CIAO::Object_Set<T, T_var>::Object_Set (CORBA::ULong init_capacity, + CORBA::ULong step) + : capacity_ (init_capacity), + size_ (0), + step_ (step) +{ + this->buffer_ = new T_var [this->capacity_]; +} + +template <class T, class T_var> +CIAO::Object_Set<T, T_var>::~Object_Set () +{ + delete[] this->buffer_; +} + +template <class T, class T_var> void +CIAO::Object_Set<T, T_var>::release () +{ + CORBA::ULong i = 0; + + for (; i < this->size_; ++i) + { + this->buffer_[i] = T::_nil (); + } +} + +template <class T, class T_var> CORBA::Long +CIAO::Object_Set<T, T_var>::add (T *objref) +{ + if (this->size_ == this->capacity_) + this->grow (); + + this->buffer_[this->size_] = T::_duplicate (objref); + return this->size_++; +} + +template<class T, class T_var> CORBA::Long +CIAO::Object_Set<T, T_var>::remove (T *objref) +{ + if (CORBA::is_nil (objref)) + return -1; + + CORBA::ULong i = 0; + + for (; i < this->size_; ++i) + if (objref->_is_equivalent (this->buffer_[i].in ())) // _is_equivalent could be unreliable? + { + --this->size_; + if (i != this->size_) + this->buffer_[i] = this->buffer_[this->size_]; + + this->buffer_[this->size_] = T::_nil (); + return 0; + } + return -1; // not found. +} + +template<class T, class T_var> CORBA::Long +CIAO::Object_Set<T, T_var>::remove_all (void) +{ + for (CORBA::ULong i = 0; i < this->size_; ++i) + this->buffer_[i] = T::_nil (); + + this->size_ = 0; + return 0; +} + +template <class T, class T_var> void +CIAO::Object_Set<T, T_var>::grow (void) +{ + this->capacity_ += this->step_; + + T_var *newbuf = new T_var [this->capacity_]; + + CORBA::ULong i = 0; + for (; i < this->size_; ++i) + newbuf[i] = this->buffer_[i]; // this will hijack the object ownership + + delete[] this->buffer_; + + this->buffer_ = newbuf; +} + +template <class T, class T_var> CORBA::ULong +CIAO::Object_Set<T, T_var>::copy (CORBA::ULong len, + T **buf) +{ + if (buf == 0) + return 0; + + if (len > this->size_) + len = this->size_; + + CORBA::ULong i = 0; + for (; i < len; ++i) + buf[i] = T::_duplicate (this->buffer_[i].in ()); + + return len; +} + +template <class T, class T_var> int +CIAO::Object_Set<T, T_var>::object_in_set (T *objref) +{ + if (CORBA::is_nil (objref)) // Don't count nil objref + return 0; + + CORBA::ULong i = 0; + + for (; i < this->size_; ++i) + if (objref->_is_equivalent (this->buffer_[i].in ())) // _is_equivalent could be unreliable? + return -1; + + return 0; +} +#endif /* CIAO_OBJECT_SET_T_C */ diff --git a/CIAO/ciao/Object_Set_T.h b/CIAO/ciao/Object_Set_T.h new file mode 100644 index 00000000000..bdfdbbc49fa --- /dev/null +++ b/CIAO/ciao/Object_Set_T.h @@ -0,0 +1,129 @@ +// $Id$ + +/** + * @file Object_Set_T.h + * + * Helper template classes for maintaining and managing object + * reference sets. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_OBJECT_SET_T_H +#define CIAO_OBJECT_SET_T_H +#include /**/ "ace/pre.h" + +#include "tao/ORB_Constants.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * @class Object_Set + * + * @brief A helper template class for maintaining and managing a set + * of object reference. + * + * This class provides a naive implementation of an object reference + * set. It is naive because it simply keeps object references in an + * objref_var array without checking for duplication. More + * importantly, it takes O(n) to to look for an object reference and + * return it. What we really need is a thread-safe hash_set<> like + * class here. Since this is mostly used only during setup/assemble + * time for a CIAO application, i.e., not on critical path, this + * class serves as a place holder for later, more efficient + * implementation. + */ + template <class T, class T_var> + class Object_Set + { + public: + /** + * Default contructor that also allows initializing the initial + * capacity of the set and the increment step. + */ + Object_Set (CORBA::ULong init_capacity = 10, + CORBA::ULong step = 10); + + /// Default destructor. + ~Object_Set (void); + + /// Adding a new object reference to the set. Return -1 if error + /// occurred. + CORBA::Long add (T *objref); + + /// Removing an object from the set. Return -1 if error occurred. + CORBA::Long remove (T *objref); + + /// Removing all objects from the set. Return -1 if error occurred. + CORBA::Long remove_all (void); + + /// Access the underlying T_var array directly. This is added to + /// get around a bug in TAO's sequence of object C++ mapping. + T_var &at (CORBA::ULong index); + + /** + * Get a copy of the object reference set into the incoming array + * @c buffer with capacity of @c size. @c buffer is usually + * allocated using a sequence's @c allocbuf method. Notice that + * caller is responsible to release the object references in + * buffer. + * + * @retval actual number of objrefs copied into @c buffer. + */ + CORBA::ULong copy (CORBA::ULong size, T **buffer); + + /** + * Check if an object is in the set. Return 0 if false. + */ + int object_in_set (T *objref); + + /// Query the current size the set contains. + CORBA::ULong size (void) const; + + /// Query the current capacity the set. + CORBA::ULong capacity (void) const; + + /** + * Release all object references. + */ + void release (void); + + protected: + /// Grow the internal array holding the object references. + void grow (void); + + /// Pointer to the dynamically allocated buffer that holds the + /// object references. + T_var *buffer_; + + /// Maximun capacity of this->buffer_; + CORBA::ULong capacity_; + + /// Current size in the set. + CORBA::ULong size_; + + /// How many more slots to add each time we expand the capacity of + /// this set. + CORBA::ULong step_; + }; + +} + +#if defined (__ACE_INLINE__) +#include "Object_Set_T.inl" +#endif /* !defined INLINE */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Object_Set_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Object_Set_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* CIAO_OBJECT_SET_T_H */ diff --git a/CIAO/ciao/Object_Set_T.inl b/CIAO/ciao/Object_Set_T.inl new file mode 100644 index 00000000000..cd9b8e1ab45 --- /dev/null +++ b/CIAO/ciao/Object_Set_T.inl @@ -0,0 +1,20 @@ +/* -*- C++ -*- */ +// $Id$ + +template <class T, class T_var> ACE_INLINE CORBA::ULong +CIAO::Object_Set<T, T_var>::size (void) const +{ + return this->size_; +} + +template <class T, class T_var> ACE_INLINE CORBA::ULong +CIAO::Object_Set<T, T_var>::capacity (void) const +{ + return this->capacity_; +} + +template <class T, class T_var> ACE_INLINE T_var & +CIAO::Object_Set<T, T_var>::at (CORBA::ULong index) +{ + return this->buffer_[index]; +} diff --git a/CIAO/ciao/Port_Activator.cpp b/CIAO/ciao/Port_Activator.cpp new file mode 100644 index 00000000000..3a16c75b0d0 --- /dev/null +++ b/CIAO/ciao/Port_Activator.cpp @@ -0,0 +1,41 @@ +#include "Port_Activator.h" + +ACE_RCSID (ciao, + Servant_Activator, + "$Id$") + +namespace CIAO +{ + Port_Activator::Port_Activator (const char *oid, + const char *name, + Type t) + : oid_ (oid) + , name_ (name) + , t_ (t) + { + } + + Port_Activator::~Port_Activator (void) + { + } + + const char* + Port_Activator::oid (void) const + { + // @@ TODO, need to be inlined. + return this->oid_.in (); + } + + void + Port_Activator::oid (const char* oid) + { + this->oid_ = oid; + } + + const char* + Port_Activator::name (void) const + { + // @@ TODO, need to be inlined. + return this->name_.in (); + } +} diff --git a/CIAO/ciao/Port_Activator.h b/CIAO/ciao/Port_Activator.h new file mode 100644 index 00000000000..ddbc66954ad --- /dev/null +++ b/CIAO/ciao/Port_Activator.h @@ -0,0 +1,88 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Port_Activator.h + * + * $Id$ + * + * @authors Bala Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_PORT_ACTIVATOR_H +#define CIAO_PORT_ACTIVATOR_H +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/CIAO_Server_Export.h" + +#include "tao/PortableServer/PortableServer.h" + +namespace CIAO +{ + /** + * @class Port_Activator + * + * @brief Base class for port activations + * + * This is a ABC for the Port_Activator_T <> template class where + * the bulk of the work is done. This class is simply a place holder + * so that we could use the pointer to this class to achieve + * polymorphism for facet and consumer servant activations. + * + */ + class CIAO_SERVER_Export Port_Activator + { + public: + enum Type + { + Facet, + Sink + }; + + Port_Activator (const char *oid, const char *name, Type t); + + virtual ~Port_Activator (void); + + /// Return the oid of port that this activator encapulates. + const char* oid (void) const; + + /// Set the oid + void oid (const char* oid); + + /// Return the oid of port that this activator encapulates. + const char* name (void) const; + + /// Activate the servant reponsible for this port. + /** + * There are intentionally no throw specifications. It is the + * caller's responsibility to handle CORBA and C++ + * specifications. + */ + virtual PortableServer::Servant activate ( + const PortableServer::ObjectId &oid) = 0; + + virtual void deactivate (const PortableServer::Servant servant) = 0; + + protected: + /// The object ID that is used to activate the servant within the + /// POA. + CORBA::String_var oid_; + + /// Name of the port + CORBA::String_var name_; + + /// What type of port is it, a consumer or facet. + Type const t_; + }; +} + + + +#include /**/ "ace/post.h" +#endif /*CIAO_PORT_ACTIVATOR_H*/ diff --git a/CIAO/ciao/Port_Activator_T.cpp b/CIAO/ciao/Port_Activator_T.cpp new file mode 100644 index 00000000000..c32d80af942 --- /dev/null +++ b/CIAO/ciao/Port_Activator_T.cpp @@ -0,0 +1,80 @@ +// $Id$ + +#ifndef CIAO_PORT_ACTIVATOR_T_CPP +#define CIAO_PORT_ACTIVATOR_T_CPP + +#include "Port_Activator_T.h" +#include "tao/CORBA_String.h" + +#include "ace/OS_NS_string.h" + + +namespace CIAO +{ + template <typename SERV, + typename EXEC, + typename CONTEXT, + typename COMP_SERV> + Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::Port_Activator_T ( + const char *oid, + const char *name, + Port_Activator::Type t, + EXEC *e, + CONTEXT *c, + COMP_SERV *cc) + : Port_Activator (oid, name, t) + , executor_ (e) + , context_ (c) + , comp_serv_ (cc) + { + } + + template <typename SERV, + typename EXEC, + typename CONTEXT, + typename COMP_SERV> + void + Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::deactivate ( + const PortableServer::Servant servant) + { + SERVANT *s = dynamic_cast<SERVANT *> (servant); + s->_remove_ref (); + } + + template <typename SERV, + typename EXEC, + typename CONTEXT, + typename COMP_SERV> + PortableServer::Servant + Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::activate ( + const PortableServer::ObjectId &oid) + { + CORBA::String_var str = + PortableServer::ObjectId_to_string (oid); + + // An additional check, may not be necessary. Being on the safe + // side. + if (ACE_OS::strcmp (this->oid_.in (), str.in ()) == 0) + { + if (this->executor_ == 0 && this->t_ == Port_Activator::Facet) + { + CORBA::Object_var tmp = + this->comp_serv_->get_facet_executor (this->name_.in ()); + + this->executor_ = EXEC::_narrow (tmp.in ()); + } + + SERVANT *s = 0; + + ACE_NEW_THROW_EX (s, + SERVANT (this->executor_, + this->context_), + CORBA::NO_MEMORY ()); + return s; + } + + throw CORBA::OBJECT_NOT_EXIST (); + } +} + +#endif /*SERVANT_ACTIVATOR_T_CPP*/ diff --git a/CIAO/ciao/Port_Activator_T.h b/CIAO/ciao/Port_Activator_T.h new file mode 100644 index 00000000000..cb6635a6baa --- /dev/null +++ b/CIAO/ciao/Port_Activator_T.h @@ -0,0 +1,81 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Port_Activator_T.h + * + * $Id$ + * + * @authors Bala Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_PORT_ACTIVATOR_T_H +#define CIAO_PORT_ACTIVATOR_T_H +#include /**/ "ace/pre.h" + +#include "ciao/Port_Activator.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +namespace CIAO +{ + /** + * @class Port_Activator_T + * + * @brief Concrete class that implements the strategy for creating + * the right type of servant for the ports in question. + * + * This class is parametrized by the servant type for the port, the + * executor type for the port, the context for the component and the + * component servant which instantiated this class within the + * container. + */ + template <typename SERV, + typename EXEC, + typename CONTEXT, + typename COMP_SERV> + class Port_Activator_T : public virtual Port_Activator + { + public: + typedef SERV SERVANT; + + Port_Activator_T (const char *oid, + const char *name, + Port_Activator::Type t, + EXEC *e, + CONTEXT *c, + COMP_SERV *cs); + + /// Template method from the base class, please see the base class + /// documentation for details. + PortableServer::Servant activate ( + const PortableServer::ObjectId &oid); + + void deactivate (const PortableServer::Servant servant); + + private: + /// The executor + EXEC *executor_; + + /// Context classes + CONTEXT *context_; + + /// Component servant which created <this> + COMP_SERV *comp_serv_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Port_Activator_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Port_Activator_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /*CIAO_SERVANT_ACTIVATOR_T_H*/ diff --git a/CIAO/ciao/Security.idl b/CIAO/ciao/Security.idl new file mode 100644 index 00000000000..199ae210c31 --- /dev/null +++ b/CIAO/ciao/Security.idl @@ -0,0 +1,23 @@ +/** + * @@ This is just a temporary file. CIAO doesn't sue the security + * service in its implementation but just using this local + * interface below from the real security service pulls in + * 250Kb of footprint + * + * $Id$ + */ + +#if !defined (CIAO_SECURITY_IDL) +#define CIAO_SECURITY_IDL + +#pragma prefix "omg.org" + +module SecurityLevel2 { + +# pragma version SecurityLevel2 1.8 + + local interface Credentials + { + }; +}; +#endif /* CIAO_SECURITY_IDL */ diff --git a/CIAO/ciao/Servant_Activator.cpp b/CIAO/ciao/Servant_Activator.cpp new file mode 100644 index 00000000000..284cfadf435 --- /dev/null +++ b/CIAO/ciao/Servant_Activator.cpp @@ -0,0 +1,185 @@ +#include "Servant_Activator.h" +#include "CIAO_common.h" +#include "Port_Activator.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ciao, + Servant_Activator, + "$Id$") + +namespace CIAO +{ + Servant_Activator::Servant_Activator (CORBA::ORB_ptr o) + : orb_ (CORBA::ORB::_duplicate (o)) + // @@ TODO, avoid this magic number + , pa_ (64) + , slot_index_ (0) + { + } + + Servant_Activator::~Servant_Activator (void) + { + { + ACE_GUARD (TAO_SYNCH_MUTEX, + guard, + this->mutex_); + + size_t const sz = this->slot_index_; + + for (size_t t = 0; t != sz; ++t) + { + Port_Activator *&tmp = this->pa_[t]; + + delete tmp; + } + } + } + + bool + Servant_Activator::update_port_activator ( + const PortableServer::ObjectId &oid) + { + CORBA::String_var str = + PortableServer::ObjectId_to_string (oid); + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->mutex_, + 0); + size_t const sz = this->slot_index_; + for (size_t t = 0; t != sz; ++t) + { + Port_Activator *&tmp = this->pa_[t]; + if (ACE_OS::strcmp (tmp->oid (), str.in ()) == 0) + { + tmp->oid ("dummy"); + //delete tmp; + //--this->slot_index_; + } + } + } + return true; + } + + PortableServer::Servant + Servant_Activator::incarnate (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr) + { + CORBA::String_var str = + PortableServer::ObjectId_to_string (oid); + + if (CIAO::debug_level () > 9) + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - Servant_Activator::incarnate, " + "activating port name [%s] \n", + str.in ())); + + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->mutex_, + 0); + + size_t const sz = this->slot_index_; + + Port_Activator *tmp = 0; + + for (size_t t = 0; t != sz; ++t) + { + if (this->pa_.get (tmp, t) == -1) + throw CORBA::OBJECT_NOT_EXIST (); + + if (tmp == 0) + { + if (CIAO::debug_level () > 9) + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) - Servant_Activator::incarnate ()," + " value from the array is null \n")); + continue; + } + if (ACE_OS::strcmp (tmp->oid (), + str.in ()) == 0) + { + // We should try avoiding making outbound calls with the + // lock held. Oh well, let us get some sense of sanity in + // CIAO to do think about these. + if (CIAO::debug_level () > 5) + ACE_DEBUG ((LM_DEBUG, "Activating Port %s\n", + str.in ())); + + return this->pa_[t]->activate (oid); + } + } + } + throw CORBA::OBJECT_NOT_EXIST (); + } + + void + Servant_Activator::etherealize (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr , + PortableServer::Servant servant, + CORBA::Boolean , + CORBA::Boolean) + { + CORBA::String_var str = + PortableServer::ObjectId_to_string (oid); + + size_t const sz = this->slot_index_; + + Port_Activator *tmp = 0; + + for (size_t t = 0; t != sz; ++t) + { + if (this->pa_.get (tmp, t) == -1) + { + ACE_DEBUG ((LM_DEBUG, "Could not get Port Activator\n")); + continue; + } + + if (tmp == 0) + { + ACE_DEBUG ((LM_DEBUG, "Port Activator is NULL\n")); + continue; + } + if (ACE_OS::strcmp (tmp->oid (), + str.in ()) == 0) + { + ACE_DEBUG ((LM_DEBUG, "Deactivating Port %s\n", + str.in ())); + this->pa_[t]->deactivate (servant); + } + } + } + + bool + Servant_Activator::register_port_activator (Port_Activator *pa) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->mutex_, + false); + + // @@ TODO, need to implement a better algorithm here. + // + if (this->slot_index_ >= this->pa_.size ()) + this->pa_.size ((this->slot_index_ + 1)); + + if (this->pa_.set (pa, this->slot_index_) == 0) + { + ++this->slot_index_; + + if (CIAO::debug_level () > 9) + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - Servant_Activator::register_port_activator" + " with port name [%s]," + " the slot_index_ is [%d] \n", + pa->name (), + this->slot_index_)); + + return true; + } + + return false; + } +} diff --git a/CIAO/ciao/Servant_Activator.h b/CIAO/ciao/Servant_Activator.h new file mode 100644 index 00000000000..6cfd3d979d8 --- /dev/null +++ b/CIAO/ciao/Servant_Activator.h @@ -0,0 +1,105 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Servant_Activator.h + * + * $Id$ + * + * @authors Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_SERVANT_ACTIVATOR_H +#define CIAO_SERVANT_ACTIVATOR_H +#include /**/ "ace/pre.h" + +#include "ace/Array_Base.h" +#include "ciao/CIAO_Server_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantActivatorC.h" +#include "tao/PortableServer/ForwardRequestC.h" +#include "tao/LocalObject.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +namespace CIAO +{ + class Port_Activator; + + /** + * @class Servant_Activator + * + * @brief Activator that is registered with the POA for facet and + * consumer servants. + * + * This class acts like a factory in some sense. This factory is + * registered with the POA with RETAIN policy. When the factory gets + * a call back as part of the upcall, this factory looks at the + * list of port activators registered, uses the OID to pick the + * right one (yes a linear algorithm is used), calls activate () on + * it which returns the servant for *that* port. + */ + class CIAO_SERVER_Export Servant_Activator + : public virtual PortableServer::ServantActivator + , public virtual TAO_Local_RefCounted_Object + { + public: + Servant_Activator (CORBA::ORB_ptr o); + + virtual ~Servant_Activator (void); + + bool update_port_activator (const PortableServer::ObjectId &oid); + + /// Template methods overridden to get callbacks. + /** + * If you would like to know the details of the following two + * methods, please PortableServer documentation. This is probably + * not the place to document what these mean. + */ + PortableServer::Servant incarnate ( + const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa); + + void etherealize (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr adapter, + PortableServer::Servant servant, + CORBA::Boolean cleanup_in_progress, + CORBA::Boolean remaining_activations); + + /// Local helper methods + bool register_port_activator (Port_Activator *pa); + + private: + /// Pointer to our ORB + CORBA::ORB_var orb_; + + /// @@ This should be changed at some point of time so that we + /// don't land up with a linear algorithm + typedef ACE_Array_Base<Port_Activator *> Port_Activators; + + /// Array of port activators + Port_Activators pa_; + + /// Running index of the slot that has been just filled in. + size_t slot_index_; + + /// Mutex that synchronizes access to the array. + ACE_SYNCH_MUTEX mutex_; + }; +} + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /*CIAO_SERVANT_ACTIVATOR_H*/ diff --git a/CIAO/ciao/Servant_Impl_Base.cpp b/CIAO/ciao/Servant_Impl_Base.cpp new file mode 100644 index 00000000000..2de37eeef1f --- /dev/null +++ b/CIAO/ciao/Servant_Impl_Base.cpp @@ -0,0 +1,607 @@ +// $Id$ + +#include "Servant_Impl_Base.h" +#include "StandardConfigurator_Impl.h" +#include "Session_Container.h" + +namespace CIAO +{ + Servant_Impl_Base::Servant_Impl_Base (Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, + Session_Container * c) + : home_ (Components::CCMHome::_duplicate (home)), + home_servant_ (home_servant), + container_ (c) + { + } + + Servant_Impl_Base::~Servant_Impl_Base (void) + { + } + + // Operations for CCMObject interface. + + ::Components::PrimaryKeyBase * + Servant_Impl_Base::get_primary_key (void) + { + throw ::Components::NoKeyAvailable (); + } + + CORBA::IRObject_ptr + Servant_Impl_Base::get_component_def (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + void + Servant_Impl_Base::configuration_complete (void) + { + // CIAO to-do + } + + void + Servant_Impl_Base::remove (void) + { + try + { + // Removing Facets + Components::FacetDescriptions_var facets = this->get_all_facets (); + + CORBA::ULong const facet_len = facets->length (); + for (CORBA::ULong i = 0; i < facet_len; ++i) + { + PortableServer::ObjectId_var facet_id = + this->container_->the_facet_cons_POA ()->reference_to_id + (facets[i]->facet_ref ()); + + CIAO::Servant_Activator *sa = + this->container_->ports_servant_activator (); + + sa->update_port_activator (facet_id.in ()); + + this->container_->the_facet_cons_POA ()->deactivate_object + (facet_id); + } + + // Removed Facets + + // Removing Consumers + Components::ConsumerDescriptions_var consumers = + this->get_all_consumers (); + + CORBA::ULong const consumer_len = consumers->length (); + for (CORBA::ULong j = 0; j < consumer_len; ++j) + { + PortableServer::ObjectId_var cons_id = + this->container_->the_facet_cons_POA ()->reference_to_id + (consumers[j]->consumer ()); + + CIAO::Servant_Activator *sa = + this->container_->ports_servant_activator (); + sa->update_port_activator (cons_id.in ()); + + this->container_->the_facet_cons_POA ()->deactivate_object + (cons_id); + } + + Components::SessionComponent_var temp = this->get_executor (); + temp->ccm_remove (); + + CORBA::Object_var objref = + this->container_->get_objref (this); + + Components::CCMObject_var ccmobjref = + Components::CCMObject::_narrow (objref.in ()); + + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (ccmobjref.in (), + oid.out ()); + + this->home_servant_->update_component_map (oid); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Port not active\n"); + } + } + + ::Components::ConnectionDescriptions * + Servant_Impl_Base::get_connections (const char * /* name */) + { + throw CORBA::NO_IMPLEMENT (); + } + + ::Components::ComponentPortDescription * + Servant_Impl_Base::get_all_ports (void) + { + OBV_Components::ComponentPortDescription *cps = 0; + ACE_NEW_RETURN (cps, + OBV_Components::ComponentPortDescription, + 0); + ::Components::ComponentPortDescription_var retv = cps; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + Servant_Impl_Base::provide_facet (const char *name) + { + if (0 == name) + { + throw Components::InvalidName (); + } + + CORBA::Object_ptr retval = this->lookup_facet (name); + + if (CORBA::is_nil (retval)) + { + throw Components::InvalidName (); + } + + return retval; + } + + Components::FacetDescriptions * + Servant_Impl_Base::get_named_facets ( + const ::Components::NameList & names) + { + Components::FacetDescriptions *retval = 0; + ACE_NEW_RETURN (retval, + ::Components::FacetDescriptions, + 0); + Components::FacetDescriptions_var safe_retval = retval; + CORBA::ULong const len = names.length (); + safe_retval->length (len); + + for (CORBA::ULong i = 0; i < len; ++i) + { + ::Components::FacetDescription *tmp = + this->lookup_facet_description (names[i]); + + if (0 == tmp) + { + throw Components::InvalidName (); + } + + safe_retval[i] = tmp; + } + + return safe_retval._retn (); + } + + ::Components::FacetDescriptions * + Servant_Impl_Base::get_all_facets (void) + { + ::Components::FacetDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::FacetDescriptions, + 0); + + ::Components::FacetDescriptions_var retval = tmp; + + retval->length (this->facet_table_.size ()); + CORBA::ULong i = 0UL; + + for (FacetTable::const_iterator iter = this->facet_table_.begin (); + iter != this->facet_table_.end (); + ++iter, ++i) + { + retval[i] = iter->second; + } + + return retval._retn (); + } + + + ::Components::ConsumerDescriptions * + Servant_Impl_Base::get_all_consumers (void) + { + ::Components::ConsumerDescriptions *tmp = 0; + ACE_NEW_THROW_EX (tmp, + ::Components::ConsumerDescriptions ( + this->consumer_table_.size ()), + CORBA::NO_MEMORY ()); + + ::Components::ConsumerDescriptions_var retval = tmp; + + retval->length (this->consumer_table_.size ()); + CORBA::ULong i = 0UL; + + for (ConsumerTable::const_iterator iter = this->consumer_table_.begin (); + iter != this->consumer_table_.end (); + ++iter, ++i) + { + retval[i] = iter->second; + } + + return retval._retn (); + } + + + ::Components::EventConsumerBase_ptr + Servant_Impl_Base::get_consumer (const char *sink_name) + { + if (0 == sink_name) + { + throw Components::InvalidName (); + } + + Components::EventConsumerBase_ptr retval = + this->lookup_consumer (sink_name); + + if (CORBA::is_nil (retval)) + { + throw Components::InvalidName (); + } + + return retval; + } + + ::Components::ConsumerDescriptions * + Servant_Impl_Base::get_named_consumers ( + const ::Components::NameList & names) + { + Components::ConsumerDescriptions *retval = 0; + ACE_NEW_RETURN (retval, + ::Components::ConsumerDescriptions, + 0); + Components::ConsumerDescriptions_var safe_retval = retval; + CORBA::ULong const len = names.length (); + safe_retval->length (len); + + for (CORBA::ULong i = 0; i < len; ++i) + { + ::Components::ConsumerDescription *tmp = + this->lookup_consumer_description (names[i]); + + if (0 == tmp) + { + throw Components::InvalidName (); + } + + safe_retval[i] = tmp; + } + + return safe_retval._retn (); + } + + ::Components::EmitterDescriptions * + Servant_Impl_Base::get_named_emitters ( + const ::Components::NameList & /* names */) + { + throw CORBA::NO_IMPLEMENT (); + } + + ::Components::ReceptacleDescriptions * + + Servant_Impl_Base::get_all_receptacles ( + ) + { + ACE_DEBUG ((LM_DEBUG, "In Servant_Impl_Base::get_all_receptacles\n")); + + ::Components::ReceptacleDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::ReceptacleDescriptions, + 0); + + ::Components::ReceptacleDescriptions_var retval = tmp; + + retval->length (this->receptacle_table_.current_size ()); + CORBA::ULong i = 0; + + ACE_DEBUG ((LM_DEBUG, "Building sequence of length %d\n", retval->length())); + + for (ReceptacleTable::iterator iter = this->receptacle_table_.begin (); + iter != this->receptacle_table_.end (); + ++iter, ++i) + { + ACE_DEBUG ((LM_DEBUG, "Starting loop iteration...\n", retval->length())); + + ReceptacleTable::ENTRY & entry = *iter; + retval[i] = entry.int_id_; + } + + ACE_DEBUG ((LM_DEBUG, "Escaped loop.\n")); + return retval._retn (); + } + + ::Components::ReceptacleDescriptions * + Servant_Impl_Base::get_named_receptacles ( + const ::Components::NameList & /* names */) + { + throw ::CORBA::NO_IMPLEMENT (); + } + + ::Components::PublisherDescriptions * + Servant_Impl_Base::get_named_publishers ( + const ::Components::NameList & /* names */) + { + throw ::CORBA::NO_IMPLEMENT (); + } + + /// Protected operations. + void + Servant_Impl_Base::add_facet (const char *port_name, + ::CORBA::Object_ptr port_ref) + { + if (0 == port_name || ::CORBA::is_nil (port_ref)) + { + throw ::CORBA::BAD_PARAM (); + return; + } + + ::Components::FacetDescription *fd = 0; + ACE_NEW (fd, + ::OBV_Components::FacetDescription ( + port_name, + port_ref->_interface_repository_id (), + port_ref)); + ::Components::FacetDescription_var safe = fd; + + FacetTable::value_type entry; + entry.first = port_name; + entry.second = safe._retn (); + + { + ACE_WRITE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + + (void) this->facet_table_.insert (entry); + } + } + + CORBA::Object_ptr + Servant_Impl_Base::lookup_facet (const char *port_name) + { + if (0 == port_name) + { + return CORBA::Object::_nil (); + } + + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + CORBA::Object::_nil ()); + + FacetTable::const_iterator iter = + this->facet_table_.find (port_name); + + if (iter == this->facet_table_.end ()) + { + return CORBA::Object::_nil (); + } + + return CORBA::Object::_duplicate (iter->second->facet_ref ()); + } + + ::Components::FacetDescription * + Servant_Impl_Base::lookup_facet_description (const char *port_name) + { + if (0 == port_name) + { + /// Calling function will throw InvalidName after getting this. + return 0; + } + + ::Components::FacetDescription_var fd; + + { + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + 0); + FacetTable::const_iterator iter = + this->facet_table_.find (port_name); + + if (iter != this->facet_table_.end ()) + { + fd = iter->second; + } + } + + return fd._retn (); + } + + void + Servant_Impl_Base::add_receptacle (const char *receptacle_name, + CORBA::Object_ptr recept_ref, + ::Components::Cookie * cookie) + { + ACE_DEBUG ((LM_DEBUG, "In Servant_Impl_Base::add_receptacle (%s)\n", receptacle_name)); + + ::Components::ReceptacleDescription_var safe; + ::Components::ReceptacleDescription *rd = 0; + + if (this->receptacle_table_.find (receptacle_name, + safe) == -1) + { + ACE_DEBUG ((LM_DEBUG, "Found no receptacle named (%s)\n", receptacle_name)); + + ACE_NEW (rd, + OBV_Components::ReceptacleDescription); + safe = rd; + + rd->name (receptacle_name); + rd->type_id (); + // The receptacle is a multiplex receptacle if and only if a + // cookie was given. + rd->is_multiple (cookie != 0); + + ::Components::ConnectionDescription *cd = 0; + ACE_NEW (cd, + OBV_Components::ConnectionDescription ( + cookie, + recept_ref)); + ::Components::ConnectionDescription_var cd_safe = cd; + ::Components::ConnectionDescriptions cds (1); + + cds.length (1); + cds[0] = cd_safe; + rd->connections (cds); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "Found a receptacle named (%s)\n", + receptacle_name)); + rd = safe.inout (); + + ::Components::ConnectionDescription *cd = 0; + ACE_NEW (cd, + OBV_Components::ConnectionDescription ( + cookie, + recept_ref)); + ::Components::ConnectionDescription_var cd_safe = cd; + ::Components::ConnectionDescriptions & cds = rd->connections (); + CORBA::ULong old_length = cds.length (); + ACE_DEBUG ((LM_DEBUG, "Old length was %d\n", old_length)); + cds.length (old_length + 1); + ACE_DEBUG ((LM_DEBUG, "New length %d\n", cds.length ())); + cds [old_length] = cd_safe; + ACE_DEBUG ((LM_DEBUG, + "Added new connection to receptacle named (%s)\n", + receptacle_name)); + } + + if (this->receptacle_table_.bind (receptacle_name, safe) == 0) + { + ACE_DEBUG ((LM_DEBUG, + "Successfully added new receptacle named (%s)\n", + receptacle_name)); + } + } + + void + Servant_Impl_Base::add_consumer ( + const char *port_name, + ::Components::EventConsumerBase_ptr port_ref + ) + { + if (0 == port_name || ::CORBA::is_nil (port_ref)) + { + throw ::CORBA::BAD_PARAM (); + return; + } + + ::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); + + ConsumerTable::value_type entry; + entry.first = port_name; + entry.second = safe._retn (); + + ACE_WRITE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + + (void) this->consumer_table_.insert (entry); + } + + ::Components::EventConsumerBase_ptr + Servant_Impl_Base::lookup_consumer (const char *port_name) + { + if (0 == port_name) + { + return ::Components::EventConsumerBase::_nil (); + } + + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + ::Components::EventConsumerBase::_nil ()); + + ConsumerTable::const_iterator iter = + this->consumer_table_.find (port_name); + + if (iter == this->consumer_table_.end ()) + { + return ::Components::EventConsumerBase::_nil (); + } + + return + ::Components::EventConsumerBase::_duplicate ( + iter->second->consumer () + ); + } + + ::Components::ConsumerDescription * + Servant_Impl_Base::lookup_consumer_description ( + const char *port_name + ) + { + if (0 == port_name) + { + /// Calling function will throw InvalidName after getting this. + return 0; + } + + ::Components::ConsumerDescription_var cd; + ConsumerTable::const_iterator iter; + + { + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + 0); + + iter = this->consumer_table_.find (port_name); + + if (iter != this->consumer_table_.end ()) + { + cd = iter->second; + } + } + + return cd._retn (); + } + + ::Components::StandardConfigurator_ptr + Servant_Impl_Base::get_standard_configurator () + { + // Create the configurator servant. + StandardConfigurator_Impl *config_impl = 0; + + ACE_NEW_THROW_EX (config_impl, + StandardConfigurator_Impl (this), + CORBA::NO_MEMORY ()); + + + Components::StandardConfigurator_var configurator = + config_impl->_this (); + + return configurator._retn (); + } + + PortableServer::POA_ptr + Servant_Impl_Base::_default_POA () + { + return + PortableServer::POA::_duplicate (container_->the_POA ()); + } +} + diff --git a/CIAO/ciao/Servant_Impl_Base.h b/CIAO/ciao/Servant_Impl_Base.h new file mode 100644 index 00000000000..b6f222d7de2 --- /dev/null +++ b/CIAO/ciao/Servant_Impl_Base.h @@ -0,0 +1,235 @@ +// -*- 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" +#include "ace/Array_Map.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Thread_Mutex.h" + +#include "CCM_EventsC.h" +#include "CIAO_Server_Export.h" +#include "CCM_ContainerC.h" +#include "CCM_ObjectS.h" +#include "CCM_StandardConfiguratorC.h" +#include "Home_Servant_Impl_Base.h" +#include "Servant_Activator.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 virtual POA_Components::CCMObject + { + public: + Servant_Impl_Base (Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, + Session_Container * c); + + virtual ~Servant_Impl_Base (void); + + /// Operations for CCMObject interface. + + virtual ::Components::PrimaryKeyBase * + get_primary_key (); + + virtual CORBA::IRObject_ptr + get_component_def (); + + virtual Components::SessionComponent_ptr + get_executor () + = 0; + + virtual void + configuration_complete (); + + virtual void + remove (); + + virtual ::Components::ConnectionDescriptions * + get_connections (const char *name); + + virtual ::Components::ComponentPortDescription * + get_all_ports (); + + virtual CORBA::Object_ptr + provide_facet (const char *name); + + virtual ::Components::FacetDescriptions * + get_named_facets (const ::Components::NameList & names); + + virtual ::Components::FacetDescriptions * + get_all_facets (); + + + virtual ::Components::ConsumerDescriptions * + get_all_consumers (); + + + virtual ::Components::EventConsumerBase_ptr + get_consumer (const char *sink_name); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers (const ::Components::NameList & names); + + virtual ::Components::EmitterDescriptions * + get_named_emitters (const ::Components::NameList & names); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles (const ::Components::NameList & names); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles (); + + virtual ::Components::PublisherDescriptions * + get_named_publishers (const ::Components::NameList & names); + + /// Operation to set attributes on the component. + virtual void set_attributes (const Components::ConfigValues &descr) = 0; + + // Creates and returns the StandardConfigurator for the component. + virtual ::Components::StandardConfigurator_ptr + get_standard_configurator (); + + /// Override that returns the (passed-in) default POA of our member + /// component's container, to ensure that we get registered + /// to that POA when _this() is called. + virtual PortableServer::POA_ptr _default_POA ( + ); + + protected: + void add_facet (const char *port_name, + ::CORBA::Object_ptr port_ref); + + CORBA::Object_ptr lookup_facet (const char *port_name); + + ::Components::FacetDescription *lookup_facet_description ( + const char *port_name + ); + + void add_receptacle (const char *receptacle_name, + CORBA::Object_ptr recept_ref, + ::Components::Cookie * cookie); + + void add_consumer (const char *port_name, + ::Components::EventConsumerBase_ptr port_ref); + + ::Components::EventConsumerBase_ptr lookup_consumer ( + const char *port_name + ); + + ::Components::ConsumerDescription *lookup_consumer_description ( + const char *port_name + ); + + /// Called from generated servant class to help with + /// get_all_*() methods. + + template<typename T_var> + static void describe_simplex_receptacle ( + const char *port_name, + const char *port_type_repo_id, + T_var &connection, + ::Components::ReceptacleDescriptions_var &descriptions, + CORBA::ULong slot + ); + + template<typename T_var> + static void describe_multiplex_receptacle ( + const char *port_name, + const char *port_type_repo_id, + ACE_Array_Map<CORBA::ULong, T_var> &objrefs, + ::Components::ReceptacleDescriptions_var &descriptions, + CORBA::ULong slot + ); + + template<typename T_var> + static void describe_pub_event_source ( + const char *port_name, + const char *port_type_repo_id, + ACE_Array_Map<CORBA::ULong, T_var> &consumers, + ::Components::PublisherDescriptions_var &descriptions, + CORBA::ULong slot + ); + + template<typename T_var> + static void describe_emit_event_source ( + const char *port_name, + const char *port_type_repo_id, + T_var &consumer_ref, + ::Components::EmitterDescriptions_var &descriptions, + CORBA::ULong slot + ); + + protected: + typedef ACE_Array_Map<ACE_CString, + ::Components::FacetDescription_var> + FacetTable; + + typedef ACE_Array_Map<ACE_CString, + ::Components::ConsumerDescription_var> + ConsumerTable; + + typedef ACE_Hash_Map_Manager_Ex<const char *, + ::Components::ReceptacleDescription_var, + ACE_Hash<const char *>, + ACE_Equal_To<const char *>, + ACE_Null_Mutex> + ReceptacleTable; + + FacetTable facet_table_; + ConsumerTable consumer_table_; + ReceptacleTable receptacle_table_; + Components::CCMHome_var home_; + Home_Servant_Impl_Base *home_servant_; + Session_Container * container_; + private: + /// Not allowed to be used + Servant_Impl_Base (void); + + private: + /// For internal locking of table reads and writes. + TAO_SYNCH_MUTEX lock_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Servant_Impl_Utils_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Servant_Impl_Utils_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_SERVANT_IMPL_T_H */ diff --git a/CIAO/ciao/Servant_Impl_T.cpp b/CIAO/ciao/Servant_Impl_T.cpp new file mode 100644 index 00000000000..81eb60789d6 --- /dev/null +++ b/CIAO/ciao/Servant_Impl_T.cpp @@ -0,0 +1,251 @@ +// $Id$ + +#ifndef CIAO_SERVANT_IMPL_T_C +#define CIAO_SERVANT_IMPL_T_C + +#include "Servant_Impl_T.h" +#include "CCM_EntityContextC.h" + +namespace CIAO +{ + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::Servant_Impl ( + EXEC * exe, + Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, + Session_Container * c + ) + : Servant_Impl_Base (home, home_servant, c), + activated_ (false), + pre_activated_ (false), + post_activated_ (false), + executor_ (EXEC::_duplicate (exe)) + { + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::~Servant_Impl (void) + { + // ********************************************************************** + /* + try + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ); + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (); + } + } + catch (const CORBA::Exception& ex) + { + } + */ + // ********************************************************************* + + this->context_->_remove_ref (); + } + + // Operations for CCMObject interface. + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + CORBA::Boolean + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::same_component ( + CORBA::Object_ptr object_ref + ) + { + if (::CORBA::is_nil (object_ref)) + { + throw ::CORBA::BAD_PARAM (); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (); + + return me->_is_equivalent (the_other.in ()); + + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + ::Components::CCMHome_ptr + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::get_ccm_home ( + ) + { + return this->context_->get_CCM_home (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + Components::SessionComponent_ptr + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::get_executor ( + ) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ); + return temp._retn (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + CORBA::Object_ptr + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::_get_component ( + ) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + ); + + if (! ::CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object (); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->context_ + ); + + if (! ::CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object (); + } + + throw CORBA::INTERNAL (); + } + + // CIAO-specific operations. + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + void + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::activate_component ( + ) + { + if (this->is_activated () == 0) + { + this->ciao_preactivate (); + + this->ciao_activate (); + + this->ciao_postactivate (); + } + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + void + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::ciao_preactivate ( + ) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ); + + if (! ::CORBA::is_nil (temp.in ())) + { + if (this->pre_activated_ == 0) + { + this->pre_activated_ = 1; + temp->ciao_preactivate (); + } + } + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + void + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::ciao_activate () + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ); + + if (! ::CORBA::is_nil (temp.in ())) + { + if (this->activated_ == 0) + { + this->activated_ = 1; + temp->ccm_activate (); + } + } + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + void + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::ciao_postactivate ( + ) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ); + + if (! ::CORBA::is_nil (temp.in ())) + { + if (this->post_activated_ == 0) + { + this->post_activated_ = 1; + temp->ciao_postactivate (); + } + } + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + CORBA::Boolean + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::is_activated ( + ) + { + return this->pre_activated_; + } + + template <typename BASE_SKEL, + typename EXEC, + typename CONTEXT> + void + Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::ciao_passivate ( + ) + { + // @@ Jai, could you please see why this is required? + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ); + + if (! ::CORBA::is_nil (temp.in ())) + temp->ccm_passivate (); + + this->pre_activated_ = 0; + this->activated_ = 0; + this->post_activated_ = 0; + } +} + +#endif /* CIAO_SERVANT_IMPL_T_C */ diff --git a/CIAO/ciao/Servant_Impl_T.h b/CIAO/ciao/Servant_Impl_T.h new file mode 100644 index 00000000000..f86fcd0c046 --- /dev/null +++ b/CIAO/ciao/Servant_Impl_T.h @@ -0,0 +1,114 @@ +// -*- 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 CONTEXT> + class Servant_Impl : public virtual BASE_SKEL, + public virtual Servant_Impl_Base + { + public: + Servant_Impl (EXEC * exe, + Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, + Session_Container * c); + + virtual ~Servant_Impl (void); + + // Operations for CCMObject interface. + + virtual CORBA::Boolean + same_component (CORBA::Object_ptr object_ref); + + virtual ::Components::CCMHome_ptr + get_ccm_home (); + + virtual CORBA::Object_ptr + _get_component (); + + virtual Components::SessionComponent_ptr + get_executor (); + + // CIAO-specific operations. + + void + ciao_preactivate (); + + void + ciao_activate (); + + void + ciao_postactivate (); + + /// @@NOTE: The busted operation. + void + ciao_passivate (); + + CORBA::Boolean + is_activated (); + + void + activate_component (); + + protected: + + CORBA::Boolean activated_; + CORBA::Boolean pre_activated_; + CORBA::Boolean post_activated_; + + /// Initialized in this constructor. + typename EXEC::_var_type executor_; + + /// Initialized in the derived, generated servant constructor. + 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/CIAO/ciao/Servant_Impl_Utils_T.cpp b/CIAO/ciao/Servant_Impl_Utils_T.cpp new file mode 100644 index 00000000000..eddbdc41a2c --- /dev/null +++ b/CIAO/ciao/Servant_Impl_Utils_T.cpp @@ -0,0 +1,165 @@ +// $Id$ + +#ifndef CIAO_SERVANT_IMPL_UTILS_T_C +#define CIAO_SERVANT_IMPL_UTILS_T_C + +#include "Servant_Impl_Base.h" +#include "ciao/Cookies.h" + +namespace CIAO +{ + template<typename T_var> + void + Servant_Impl_Base::describe_simplex_receptacle ( + const char *port_name, + const char *port_type_repo_id, + T_var &connection, + ::Components::ReceptacleDescriptions_var &descriptions, + CORBA::ULong slot) + { + ::Components::ReceptacleDescription *elem = 0; + ACE_NEW (elem, + ::OBV_Components::ReceptacleDescription); + ::Components::ReceptacleDescription_var safe_elem = elem; + + elem->name (port_name); + elem->type_id (port_type_repo_id); + elem->is_multiple (false); + elem->connections ().length (1UL); + + ::Components::ConnectionDescription *conn = 0; + ACE_NEW (conn, ::OBV_Components::ConnectionDescription); + ::Components::ConnectionDescription_var safe_conn = conn; + + conn->ck (0); + conn->objref (connection.in ()); + + elem->connections ()[0UL] = safe_conn._retn (); + descriptions[slot] = safe_elem._retn (); + } + + template<typename T_var> + void + Servant_Impl_Base::describe_multiplex_receptacle ( + const char *port_name, + const char *port_type_repo_id, + ACE_Array_Map<CORBA::ULong, T_var> &objrefs, + ::Components::ReceptacleDescriptions_var &descriptions, + CORBA::ULong slot + ) + { + ::Components::ReceptacleDescription *elem = 0; + ACE_NEW (elem, + ::OBV_Components::ReceptacleDescription); + ::Components::ReceptacleDescription_var safe_elem = elem; + + elem->name (port_name); + elem->type_id (port_type_repo_id); + elem->is_multiple (true); + elem->connections ().length (objrefs.size ()); + + CORBA::ULong seq_slot = 0UL; + ::Components::ConnectionDescription *conn = 0; + + typedef typename ACE_Array_Map<CORBA::ULong, T_var>::const_iterator + CONST_ITERATOR; + + for (CONST_ITERATOR iter = objrefs.begin (); + iter != objrefs.end (); + ++iter, ++seq_slot) + { + ACE_NEW (conn, + ::OBV_Components::ConnectionDescription); + ::Components::ConnectionDescription_var safe_conn = conn; + + ::Components::Cookie *key_cookie = 0; + ACE_NEW (key_cookie, + CIAO::Cookie_Impl (iter->first)); + + // Valuetype member set operation calls add_ref. + conn->ck (key_cookie); + CORBA::remove_ref (key_cookie); + + conn->objref (iter->second.in ()); + + elem->connections ()[seq_slot] = safe_conn._retn (); + } + + descriptions[slot] = safe_elem._retn (); + } + + template<typename T_var> + void + Servant_Impl_Base::describe_pub_event_source ( + const char *port_name, + const char *port_type_repo_id, + ACE_Array_Map<CORBA::ULong, T_var> &consumers, + ::Components::PublisherDescriptions_var &descriptions, + CORBA::ULong slot + ) + { + ::Components::PublisherDescription *elem = 0; + ACE_NEW (elem, + ::OBV_Components::PublisherDescription); + ::Components::PublisherDescription_var safe_elem = elem; + + elem->name (port_name); + elem->type_id (port_type_repo_id); + elem->consumer ().length (consumers.size ()); + + CORBA::ULong map_slot = 0UL; + ::Components::SubscriberDescription *sub = 0; + + typedef typename ACE_Array_Map<CORBA::ULong, T_var>::const_iterator + CONST_ITERATOR; + + for (CONST_ITERATOR iter = consumers.begin (); + iter != consumers.end (); + ++iter, ++map_slot) + { + ACE_NEW (sub, + ::OBV_Components::SubscriberDescription); + ::Components::SubscriberDescription_var safe_sub = sub; + + ::Components::Cookie *key_cookie = 0; + ACE_NEW (key_cookie, + CIAO::Cookie_Impl (iter->first)); + + // Valuetype member set operation calls add_ref. + sub->ck (key_cookie); + CORBA::remove_ref (key_cookie); + + sub->consumer (iter->second.in ()); + + elem->consumer ()[map_slot] = safe_sub._retn (); + } + + descriptions[slot] = safe_elem._retn (); + } + + template<typename T_var> + void + Servant_Impl_Base::describe_emit_event_source ( + const char *port_name, + const char *port_type_repo_id, + T_var &consumer_ref, + ::Components::EmitterDescriptions_var &descriptions, + CORBA::ULong slot + ) + { + ::Components::EmitterDescription *elem = 0; + ACE_NEW (elem, + ::OBV_Components::EmitterDescription); + ::Components::EmitterDescription_var safe_elem = elem; + + elem->name (port_name); + elem->type_id (port_type_repo_id); + + // Valuetype 'set' call increments the reference count. + elem->consumer (consumer_ref.in ()); + + descriptions[slot] = safe_elem._retn (); + } +} + +#endif /* CIAO_SERVANT_IMPL_T_C */ diff --git a/CIAO/ciao/Server_init.cpp b/CIAO/ciao/Server_init.cpp new file mode 100644 index 00000000000..73f445c3114 --- /dev/null +++ b/CIAO/ciao/Server_init.cpp @@ -0,0 +1,234 @@ +// $Id$ + +#include "Server_init.h" +#include "CIAO_common.h" +#include "CCM_ComponentC.h" +#include "CCM_StandardConfiguratorC.h" +#include "Cookies.h" + +#include "ace/OS_NS_stdio.h" +namespace CIAO +{ + int + Server_init (CORBA::ORB_ptr o) + { + CIAO_REGISTER_VALUE_FACTORY (o, CIAO::Cookie_Impl_init, + Components::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; + } + + namespace Utility + { + int 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; + } + + // -------------------------------------------------------------- + // Implementation of NameUtility class + // -------------------------------------------------------------- + + void NameUtility::CreateContextPath (const CosNaming::NamingContextExt_ptr nc, + const CosNaming::Name& name) + { + bool isNotFound = false; + CORBA::ULong lengthMissing = 0; + CORBA::ULong OriginalLength = name.length(); + CosNaming::Name tmpName; + CosNaming::NamingContext_var tmpCtxVar; + + try + { + tmpCtxVar = nc->bind_new_context(name); + ACE_DEBUG ((LM_DEBUG, "Bound Context.\n\n")); + } + catch (const CosNaming::NamingContext::AlreadyBound&) + { + ACE_DEBUG ((LM_DEBUG, "Context Already Bound.\n\n")); + } + catch (const CosNaming::NamingContext::NotFound& nf) + { + ACE_DEBUG ((LM_DEBUG, "Context not found.\n\n")); + isNotFound = true; + lengthMissing = nf.rest_of_name.length(); + } + + if (lengthMissing == name.length()) + { + ACE_ERROR ((LM_ERROR, "Null name length.\n\n")); + } + + if (isNotFound) + { + for (CORBA::ULong l = OriginalLength-lengthMissing; + l < OriginalLength; + l++) + { + tmpName.length(l+1); + for (CORBA::ULong i=0; i <= l; i++) + { + tmpName[i] = name[i]; + + CORBA::String_var newSCName = nc->to_string(tmpName); + ACE_DEBUG ((LM_DEBUG, "What's left of the name:%s\n", + newSCName.in ())); + } + + tmpCtxVar = nc->bind_new_context(tmpName); + ACE_DEBUG ((LM_DEBUG, "Bound New Context.\n")); + } + } + } + + //--------------------------------------------------------------------------------------------- + void NameUtility::BindObjectPath (const CosNaming::NamingContextExt_ptr nc, + const CosNaming::Name& name, + const CORBA::Object_ptr obj) + { + CosNaming::Name tmpName; + CORBA::String_var newSCName = nc->to_string(name); + ACE_DEBUG ((LM_DEBUG, "The name is: %s\n", newSCName.in ())); + + try + { + nc->rebind(name, obj); + } + + catch (const CosNaming::NamingContext::NotFound&) + { + ACE_DEBUG ((LM_DEBUG, "Name not found, doing new bind.\n")); + nc->bind(name, obj); + } + } + + //--------------------------------------------------------------------------------------------- + CosNaming::BindingList * + NameUtility::listBindings (const CosNaming::NamingContext_ptr nc, + const CosNaming::Name& name, + CORBA::ULong max_list_size) + { + CosNaming::BindingList_var basicListV; + CosNaming::BindingIterator_var bIterV; + + CORBA::Object_var objV; + CosNaming::NamingContext_var tmpContextV; + + if (name.length() == 0) + { + tmpContextV = CosNaming::NamingContext::_duplicate(nc); + } + else + { + objV = nc->resolve(name); + tmpContextV = CosNaming::NamingContext::_narrow(objV.in ()); + } + if (CORBA::is_nil (tmpContextV.in ())) + { + ACE_ERROR ((LM_ERROR, "listBindings: Nil context.\n")); + return 0; + } + + tmpContextV->list(max_list_size, basicListV.out(), bIterV.out()); + + CORBA::Long max_remaining = max_list_size - basicListV->length(); + CORBA::Boolean moreBindings = !CORBA::is_nil(bIterV.in ()); + + if (moreBindings) + { + while (moreBindings && (max_remaining > 0) ) + { + CosNaming::BindingList_var tmpListV; + + moreBindings = bIterV->next_n(max_remaining, tmpListV.out()); + + //Append 'tmpListV' to 'basicListV' + CORBA::ULong basicListLen = basicListV->length(); + basicListV->length(basicListLen+tmpListV->length()); + for (CORBA::ULong i=0; i < tmpListV->length(); i++) + { + (*basicListV)[i+basicListLen] = (*tmpListV)[i]; + } + + //Re-calculate 'max_remaining' + max_remaining = max_list_size - basicListV->length(); + } + bIterV->destroy(); + } + + return basicListV._retn(); + } + + //--------------------------------------------------------------------------------------------- + void + NameUtility::recursiveUnbind (const CosNaming::NamingContext_ptr nc, + const CosNaming::Name& name) + { + CORBA::Object_var objV; + CosNaming::NamingContext_var tmpContextV; + + objV = nc->resolve(name); + tmpContextV = CosNaming::NamingContext::_narrow(objV.in ()); + if (CORBA::is_nil(tmpContextV.in ())) + { + ACE_ERROR ((LM_ERROR, "recursiveUnbind: Nil context reference.\n")); + return; + } + + CosNaming::BindingList_var blV; + CosNaming::Name tmpName; + tmpName.length(0); + + blV = NameUtility::listBindings(tmpContextV.in(), + tmpName, + 10000); // 'max_list_size' + + for (CORBA::ULong i=0; i<blV->length(); i++) + { + tmpName = (*blV)[i].binding_name; + + if ((*blV)[i].binding_type==CosNaming::nobject) + { + tmpContextV->unbind(tmpName); + } + else if ( (*blV)[i].binding_type==CosNaming::ncontext) + { + NameUtility::recursiveUnbind(tmpContextV.in(), tmpName); + } + } + nc->unbind(name); + tmpContextV->destroy(); + } + + } /* namespace Utility */ +} /* namespace CIAO */ diff --git a/CIAO/ciao/Server_init.h b/CIAO/ciao/Server_init.h new file mode 100644 index 00000000000..8e0ba15561b --- /dev/null +++ b/CIAO/ciao/Server_init.h @@ -0,0 +1,91 @@ +// $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> + * @author Gan Deng <dengg@dre.vanderbilt.edu> + */ + +#ifndef CIAO_SERVER_INIT_H +#define CIAO_SERVER_INIT_H +#include /**/ "ace/pre.h" + +#include "CIAO_Server_Export.h" +#include "tao/Versioned_Namespace.h" +#include <orbsvcs/CosNamingC.h> + +#if !defined ACE_LACKS_PRAGMA_ONCE +#pragma once +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL +namespace CORBA +{ + class ORB; + typedef ORB *ORB_ptr; +} +TAO_END_VERSIONED_NAMESPACE_DECL + +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); + + class CIAO_SERVER_Export NameUtility + { + /** + * A utility class to bind naming context. This class is contributed by + * Dipa Suri <dipa.suri@lmco.com>. + * + * The concept/code are derived from + * http://www.informit.com/articles/article.asp?p=23266&seqNum=6 + */ + + public: + /// For each 'NameComponent' in 'name', create a corresponding 'NamingContext'. + static void CreateContextPath (const CosNaming::NamingContextExt_ptr, + const CosNaming::Name &); + + /// For the first [0, length-2] NameComponents of 'name', create a + /// corresponding 'NamingContext'. + /// For the length-1 NameComponent of 'name', bind it to the object + /// reference 'obj'. + static void BindObjectPath (const CosNaming::NamingContextExt_ptr, + const CosNaming::Name&, + const CORBA::Object_ptr); + + /// Get a list of all bindings under the given context, up to + /// max_list_size. + static CosNaming::BindingList * listBindings (const CosNaming::NamingContext_ptr, + const CosNaming::Name&, + CORBA::ULong); + + /// Recursively unbind all objects and contexts below the given name + /// context, given the initial context nc. + /// Assumes a tree shape to service (not cyclic) + static void recursiveUnbind (const CosNaming::NamingContext_ptr, + const CosNaming::Name&); + }; + } +} + +#include /**/ "ace/post.h" +#endif /* CIAO_SERVER_INIT_H */ diff --git a/CIAO/ciao/Session_Container.cpp b/CIAO/ciao/Session_Container.cpp new file mode 100644 index 00000000000..a75a0913635 --- /dev/null +++ b/CIAO/ciao/Session_Container.cpp @@ -0,0 +1,548 @@ +// $Id$ + +#include "Session_Container.h" +#include "CIAO_common.h" +#include "ace/DLL.h" +#include "tao/Utils/PolicyList_Destroyer.h" +#include "ace/OS_NS_stdio.h" +#include "Servant_Activator.h" +#include "DAnCE/Deployment/Deployment_CoreC.h" + +#if !defined (__ACE_INLINE__) +# include "Session_Container.inl" +#endif /* __ACE_INLINE__ */ + +namespace CIAO +{ + /////////////////////////////////////////////////////////////// + + ACE_Atomic_Op <ACE_SYNCH_MUTEX, unsigned long> + Session_Container::serial_number_ (0); + + Session_Container::Session_Container (CORBA::ORB_ptr o, + Container_Impl *container_impl, + bool static_config_flag, + const Static_Config_EntryPoints_Maps* maps) + : Container (o, container_impl), + number_ (0), + static_config_flag_ (static_config_flag), + static_entrypts_maps_ (maps), + sa_ (0) + { + } + + Session_Container::~Session_Container (void) + { + if (! CORBA::is_nil (this->component_poa_.in ())) + { + this->component_poa_->destroy (1, 1); + } + + if (! CORBA::is_nil (this->facet_cons_poa_.in ())) + { + this->facet_cons_poa_->destroy (1, 1); + } + + if (! CORBA::is_nil (this->home_servant_poa_.in ())) + { + this->home_servant_poa_->destroy (1, 1); + } + + delete this->sa_; + } + + int + Session_Container::init (const char *name, + const CORBA::PolicyList *more_policies) + { + CIAO_TRACE ("Session_Container::init"); + + char buffer[MAXPATHLEN]; + + if (name == 0) + { + this->number_ = ++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"); + + 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 ()); + + this->create_component_POA (name, + more_policies, + root_poa.in ()); + + ACE_CString port_poa_name (name); + port_poa_name += ":Port_POA"; + this->create_facet_consumer_POA (port_poa_name.c_str (), + more_policies, + root_poa.in ()); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + poa_manager->activate (); + + return 0; + } + + void + Session_Container::create_component_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root) + { + CIAO_TRACE ("Session_Container::create_component_POA"); + + // 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 (p != 0) + { + policies = *p; + } + + PortableServer::POAManager_var poa_manager = + root->the_POAManager (); + + this->component_poa_ = + root->create_POA (name, + poa_manager.in (), + policies); + } + + void + Session_Container::create_facet_consumer_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root) + { + CIAO_TRACE ("Session_Container::create_facet_consumer_POA"); + + PortableServer::POAManager_var poa_manager = root->the_POAManager (); + + CORBA::ULong p_length = 0; + if (p != 0) + { + p_length = p->length (); + } + + TAO::Utils::PolicyList_Destroyer policies (p_length + 3); + policies.length (p_length + 3); + + policies[0] = + root->create_id_assignment_policy (PortableServer::USER_ID); + + // Servant Manager Policy + policies[1] = + root->create_request_processing_policy + (PortableServer::USE_SERVANT_MANAGER); + + // Servant Retention Policy + policies[2] = + root->create_servant_retention_policy (PortableServer::RETAIN); + + for (CORBA::ULong i = 0; i < p_length; ++i) + { + policies[i+3] = (*p)[i]; + } + + this->facet_cons_poa_ = + root->create_POA (name, + poa_manager.in (), + policies); + + ACE_NEW_THROW_EX (this->sa_, + Servant_Activator (this->orb_.in ()), + CORBA::NO_MEMORY ()); + + this->facet_cons_poa_->set_servant_manager ( + this->sa_ + ); + } + + CORBA::Object_ptr + Session_Container::install_servant (PortableServer::Servant p, + Container::OA_Type t) + { + CIAO_TRACE ("Session_Container::install_servant"); + + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + { + tmp = this->component_poa_.in (); + } + else + { + tmp = this->facet_cons_poa_.in (); + } + + PortableServer::ObjectId_var oid = + tmp->activate_object (p); + + CORBA::Object_var objref = + tmp->id_to_reference (oid.in ()); + + return objref._retn (); + } + + CORBA::Object_ptr + Session_Container::install_component (PortableServer::Servant p, + PortableServer::ObjectId_out oid) + { + CIAO_TRACE ("Session_Container::install_component"); + PortableServer::ObjectId_var id = + this->component_poa_->activate_object (p); + + CORBA::Object_var objref = + this->component_poa_->id_to_reference (id.in ()); + + 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 + Session_Container::ciao_install_home (const char *exe_dll_name, + const char *exe_entrypt, + const char *sv_dll_name, + const char *sv_entrypt, + const char *ins_name) + { + CIAO_TRACE ("Session_Container::ciao_install_home"); + + HomeFactory hcreator = 0; + ServantFactory screator = 0; + + if (this->static_config_flag_ == false) + { + ACE_DLL executor_dll, servant_dll; + + if (exe_dll_name == 0 || sv_dll_name == 0) + { + ACE_CString exception; + + if (exe_dll_name == 0) + { + exception = "Null component executor DLL name"; + } + + if (sv_dll_name == 0) + { + exception = "Null component servant DLL name"; + } + + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) Container_Base.cpp -" + "Session_Container::ciao_install_home -" + "ERROR: %s\n", + exception.c_str ())); + + throw Deployment::UnknownImplId ( + "Session_Container::ciao_install_home", + exception.c_str ()); + } + + if (executor_dll.open (exe_dll_name, + ACE_DEFAULT_SHLIB_MODE, + 0) != 0) + { + ACE_CString error ("Failed to open executor DLL: "); + error += exe_dll_name; + + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) Container_Base.cpp -" + "Session_Container::ciao_install_home -" + "ERROR in opening the executor DLL [%s] \n", + exe_dll_name)); + + throw Deployment::UnknownImplId + ("Session_Container::ciao_install_home", + error.c_str ()); + } + + if (servant_dll.open (sv_dll_name, + ACE_DEFAULT_SHLIB_MODE, + 0) != 0) + { + ACE_CString error ("Failed to open executor DLL: "); + error += sv_dll_name; + + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) Container_Base.cpp -" + "Session_Container::ciao_install_home -" + "ERROR in opening the servant DLL [%s] \n", + sv_dll_name)); + + throw Deployment::UnknownImplId + ("Session_Container::ciao_install_home", + error.c_str ()); + } + + if (exe_entrypt == 0 || sv_entrypt == 0) + { + ACE_CString error ("Entry point is null for "); + + if (exe_entrypt == 0) + { + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) Container_Base.cpp -" + "Session_Container::ciao_install_home -" + "ERROR in opening the executor entry point " + "for executor DLL [%s] \n", + exe_dll_name)); + error += exe_dll_name; + } + else + { + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) Container_Base.cpp -" + "Session_Container::ciao_install_home -" + "ERROR in opening the servant entry point " + "for servant DLL [%s] \n", + sv_dll_name)); + error += sv_dll_name; + } + + throw Deployment::ImplEntryPointNotFound + ("Session_Container::ciao_install_home", + error.c_str ()); + } + + // We have to do this casting in two steps because the C++ + // standard forbids casting a pointer-to-object (including + // void*) directly to a pointer-to-function. + void *void_ptr = executor_dll.symbol (exe_entrypt); + ptrdiff_t tmp_ptr = reinterpret_cast<ptrdiff_t> (void_ptr); + hcreator = reinterpret_cast<HomeFactory> (tmp_ptr); + + void_ptr = servant_dll.symbol (sv_entrypt); + tmp_ptr = reinterpret_cast<ptrdiff_t> (void_ptr); + screator = reinterpret_cast<ServantFactory> (tmp_ptr); + } + else + { + if (static_entrypts_maps_ == 0 + || static_entrypts_maps_->home_creator_funcptr_map_ == 0 + || static_entrypts_maps_->home_servant_creator_funcptr_map_ == 0) + { + throw Deployment::ImplEntryPointNotFound (); + } + + 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_CString error ("Entry point "); + + if (hcreator == 0) + { + error += exe_entrypt; + error += " invalid in dll "; + error += exe_dll_name; + } + else + { + error += sv_entrypt; + error += " invalid in dll "; + error += sv_dll_name; + } + + throw Deployment::ImplEntryPointNotFound + ("SessionContainer::ciao_install_home", + error.c_str ()); + } + + Components::HomeExecutorBase_var home_executor = hcreator (); + + if (CORBA::is_nil (home_executor.in ())) + { + throw Deployment::InstallationFailure + ("SessionContainer::ciao_install_home", + "Executor entrypoint failed to create a home."); + } + + PortableServer::Servant home_servant = screator (home_executor.in (), + this, + ins_name); + + if (home_servant == 0) + { + throw Deployment::InstallationFailure + ("SessionContainer::ciao_install_home", + "Servant entrypoing failed to create a home."); + } + + PortableServer::ServantBase_var safe (home_servant); + + CORBA::Object_var objref = + this->install_servant (home_servant, + Container::Component); + + Components::CCMHome_var homeref = + Components::CCMHome::_narrow (objref.in ()); + + return homeref._retn (); + } + + void + Session_Container::ciao_uninstall_home (Components::CCMHome_ptr homeref) + { + CIAO_TRACE ("Session_Container::ciao_uninstall_home"); + + this->uninstall (homeref, + Container::Component); + } + + void + Session_Container::uninstall (CORBA::Object_ptr objref, + Container::OA_Type t) + { + CIAO_TRACE ("Session_Container::uninstall"); + + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + { + tmp = this->component_poa_.in (); + } + else + { + tmp = this->facet_cons_poa_.in (); + } + + PortableServer::ObjectId_var oid = + tmp->reference_to_id (objref); + + tmp->deactivate_object (oid.in ()); + } + + void + Session_Container::uninstall (PortableServer::Servant svt, + Container::OA_Type t) + { + CIAO_TRACE ("Session_Container::uninstall"); + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + { + tmp = this->component_poa_.in (); + } + else + { + tmp = this->facet_cons_poa_.in (); + } + + PortableServer::ObjectId_var oid = tmp->servant_to_id (svt); + + tmp->deactivate_object (oid.in ()); + } + + void + Session_Container::uninstall_component (Components::CCMObject_ptr objref, + PortableServer::ObjectId_out oid) + { + CIAO_TRACE ("Session_Container::uninstall_component"); + + PortableServer::ObjectId_var id = + this->component_poa_->reference_to_id (objref); + + this->component_poa_->deactivate_object (id.in ()); + + oid = id._retn (); + } + + void + Session_Container::add_servant_to_map (PortableServer::ObjectId &, + Dynamic_Component_Servant_Base*) + { + CIAO_TRACE ("Session_Container::add_servant_to_map"); + } + + void + Session_Container::deactivate_facet (const PortableServer::ObjectId &) + { + CIAO_TRACE ("Session_Container::deactivate_facet"); + } + + void + Session_Container::delete_servant_from_map (PortableServer::ObjectId &) + { + CIAO_TRACE ("Session_Container::delete_servant_from_map"); + } + + CORBA::Object_ptr + Session_Container::get_home_objref (PortableServer::Servant) + { + CIAO_TRACE ("Session_Container::get_home_objref"); + throw CORBA::NO_IMPLEMENT (); + } + + CORBA::Object_ptr + Session_Container::generate_reference (const char *obj_id, + const char *repo_id, + Container::OA_Type t) + { + CIAO_TRACE ("Session_Container::generate_reference"); + + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + { + tmp = this->component_poa_.in (); + } + else + { + tmp = this->facet_cons_poa_.in (); + } + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (obj_id); + + CORBA::String_var str = + PortableServer::ObjectId_to_string (oid.in ()); + + if (t == Container::Facet_Consumer) + { + //if (CIAO::debug_level () > 9) + // ACE_DEBUG ((LM_DEBUG, "STRING in container is %s\n", + // str.in ())); + } + + CORBA::Object_var objref = + tmp->create_reference_with_id (oid.in (), repo_id); + + return objref._retn (); + } +} diff --git a/CIAO/ciao/Session_Container.h b/CIAO/ciao/Session_Container.h new file mode 100644 index 00000000000..797b52c8268 --- /dev/null +++ b/CIAO/ciao/Session_Container.h @@ -0,0 +1,191 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Session_Container.h + * + * $Id$ + * + * Header file for CIAO's container implementations + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + * @author Gan Deng <dengg@dre.vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_SESSION_CONTAINER_H +#define CIAO_SESSION_CONTAINER_H + +#include /**/ "ace/pre.h" + +#include "ciao/Container_Base.h" + +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/Servant_Base.h" + +#include "tao/ORB.h" + +#include "ace/Hash_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class Session_Container; + class Servant_Activator; + + typedef ::Components::HomeExecutorBase_ptr (*HomeFactory) (void); + typedef ::PortableServer::Servant (*ServantFactory) + (::Components::HomeExecutorBase_ptr p, + ::CIAO::Session_Container *c, + const char *ins_name); + + 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: + Session_Container (CORBA::ORB_ptr o, + Container_Impl *container_impl, + bool static_config_flag = false, + 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); + + /** + * @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, + const char *ins_name); + + /// Uninstall a servant for component or home. + virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref); + + /// Uninstall a servant for component. + virtual void uninstall_component (::Components::CCMObject_ptr objref, + PortableServer::ObjectId_out oid); + + /// Install a servant for component or home. + virtual CORBA::Object_ptr install_servant (PortableServer::Servant p, + Container::OA_Type t); + + /// Install a component servant. + CORBA::Object_ptr install_component (PortableServer::Servant p, + PortableServer::ObjectId_out oid); + + /// Get an object reference to a component or home from the servant. + virtual CORBA::Object_ptr get_objref (PortableServer::Servant p); + + /// Uninstall a servant for component or home. + void uninstall (CORBA::Object_ptr objref, Container::OA_Type t); + + /// Uninstall a servant for component or home. + void uninstall (PortableServer::Servant svt, Container::OA_Type t); + + virtual void add_servant_to_map (PortableServer::ObjectId &oid, + Dynamic_Component_Servant_Base* servant); + + virtual void delete_servant_from_map (PortableServer::ObjectId &oid); + + // @@Jai, could yo please add documentation? + /* + * @@Jai, you may want to consider moving these away from the + * container interface. I know what you are going to say + * :-). Consider using dynamic_cast <> to access + * add_servant_to_map, delete_servant_from_map and + * deactivate_facet from the Swapping_Conatiner's interface. It + * would make the base container interface much cleaner. + */ + virtual void deactivate_facet (const PortableServer::ObjectId &oid); + + virtual CORBA::Object_ptr get_home_objref (PortableServer::Servant p); + + /// Analog of the POA method that creates an object reference from + /// an object id string. + CORBA::Object_ptr generate_reference (const char *obj_id, + const char *repo_id, + Container::OA_Type t); + + /// Return the servant activator factory that activates the + /// servants for facets and consumers. + Servant_Activator *ports_servant_activator (void) const; + + private: + + /// Create POA for the component. + /** + * This is the POA that is returned to the component applications + * if they need one. + */ + void create_component_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root); + + /// Create POA for the facets and consumers alone. + void create_facet_consumer_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root); + + /// Not allowed to be + Session_Container (void); + + protected: + unsigned long number_; + + /// Static variable to store the highest number we have given out until + /// now + static ACE_Atomic_Op <ACE_SYNCH_MUTEX, unsigned long> serial_number_; + + const bool static_config_flag_; + const Static_Config_EntryPoints_Maps* static_entrypts_maps_; + + /// The servant activator factory used to activate facets and + /// consumer servants. + Servant_Activator *sa_; + }; +} + +#if defined (__ACE_INLINE__) +# include "Session_Container.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* CIAO_SESSION_CONTAINER_H */ diff --git a/CIAO/ciao/Session_Container.inl b/CIAO/ciao/Session_Container.inl new file mode 100644 index 00000000000..1c6bc7a075c --- /dev/null +++ b/CIAO/ciao/Session_Container.inl @@ -0,0 +1,13 @@ +// $Id$ -*- C++ -*- + +ACE_INLINE CORBA::Object_ptr +CIAO::Session_Container::get_objref (PortableServer::Servant p) +{ + return this->the_POA ()->servant_to_reference (p); +} + +ACE_INLINE CIAO::Servant_Activator * +CIAO::Session_Container::ports_servant_activator (void) const +{ + return this->sa_; +} diff --git a/CIAO/ciao/StandardConfigurator_Impl.cpp b/CIAO/ciao/StandardConfigurator_Impl.cpp new file mode 100644 index 00000000000..b737c5f5b7c --- /dev/null +++ b/CIAO/ciao/StandardConfigurator_Impl.cpp @@ -0,0 +1,34 @@ +// StandardConfigurator.cpp,v 1.0 2004/14/04 08:47:46 white Exp + +#include "StandardConfigurator_Impl.h" +#include "Servant_Impl_Base.h" + +ACE_RCSID (ciao, + StandardConfigurator_Impl, + "$Id$") + + +namespace CIAO +{ + StandardConfigurator_Impl::StandardConfigurator_Impl ( + Servant_Impl_Base* servant) + : component_ (servant) + { + } + + StandardConfigurator_Impl::~StandardConfigurator_Impl () + { + } + + void + StandardConfigurator_Impl::set_configuration ( + const Components::ConfigValues &descr) + { + this->component_->set_attributes (descr); + } + + void + StandardConfigurator_Impl::configure (Components::CCMObject_ptr) + { + } +} diff --git a/CIAO/ciao/StandardConfigurator_Impl.h b/CIAO/ciao/StandardConfigurator_Impl.h new file mode 100644 index 00000000000..dd4df6f4f98 --- /dev/null +++ b/CIAO/ciao/StandardConfigurator_Impl.h @@ -0,0 +1,68 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StandardConfigurator_Impl.h + * + * $Id$ + * + * This file contains implementation for the servant of + * Components::StandardConfigurator interface. + * + * @author Jules White <jules@dre.vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_STANDARDCONFIGURATOR_IMPL_H +#define CIAO_STANDARDCONFIGURATOR_IMPL_H +# include /**/ "ace/pre.h" + +#include "CCM_StandardConfiguratorS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Server_Export.h" +#include "Servant_Impl_Base.h" + +namespace CIAO +{ + /** + * @class StandardConfigurator_Impl + * + * @brief Servant implementation for Components::StandardConfigurator + * + * This class implements the Components::StandardConfigurator + * interface as defined by the CCM spcification. This class aids + * in setting the initial values of component attributes that are + * defined in the meta data. + */ + class CIAO_SERVER_Export StandardConfigurator_Impl + : public virtual POA_Components::StandardConfigurator + { + public: + /// Constructor + StandardConfigurator_Impl (Servant_Impl_Base* toconfigure); + + /// Destructor + virtual ~StandardConfigurator_Impl (void); + + /// This method will call set_attributes on the component that is + /// being configured, i.e, the template method from + /// StandardConfigurator interface. + virtual void set_configuration (const Components::ConfigValues & descr); + + void configure (Components::CCMObject_ptr comp); + + private: + /// The component whose attributes are going to be configured via + /// set_attributes + Servant_Impl_Base* component_; + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_STANDARDCONFIGURATOR_IMPL_H */ diff --git a/CIAO/ciao/Swapping_Container.cpp b/CIAO/ciao/Swapping_Container.cpp new file mode 100644 index 00000000000..5e8816d0c47 --- /dev/null +++ b/CIAO/ciao/Swapping_Container.cpp @@ -0,0 +1,226 @@ +// $Id$ + +#include "Container_Base.h" +#include "Swapping_Container.h" +#include "ace/DLL.h" +#include "tao/Utils/PolicyList_Destroyer.h" +#include "ace/OS_NS_stdio.h" +#include "DAnCE/Deployment//Deployment_CoreC.h" + +#if !defined (__ACE_INLINE__) +# include "Swapping_Container.inl" +#endif /* __ACE_INLINE__ */ + +namespace CIAO +{ + + ACE_Atomic_Op <ACE_SYNCH_MUTEX, unsigned long> + Swapping_Container::serial_number_ (0); + + Swapping_Container::Swapping_Container (CORBA::ORB_ptr o, + Container_Impl *container_impl) + : Session_Container (o, container_impl), + number_ (0) + { + } + + Swapping_Container::~Swapping_Container () + { + } + + PortableServer::POA_ptr + Swapping_Container::the_home_servant_POA (void) const + { + return this->home_servant_poa_.in (); + } + + CORBA::Object_ptr + Swapping_Container::get_home_objref (PortableServer::Servant p) + { + return this->the_home_servant_POA ()->servant_to_reference (p); + } + + void + Swapping_Container::deactivate_facet (const PortableServer::ObjectId &oid) + { + this->the_facet_cons_POA ()->deactivate_object (oid); + } + + int + Swapping_Container::init (const char *name, + const CORBA::PolicyList *more_policies) + { + char buffer[MAXPATHLEN]; + + if (name == 0) + { + this->number_ = ++Swapping_Container::serial_number_; + ACE_OS::sprintf (buffer, "CIAO::Swapping_Container-%ld", + this->number_); + name = buffer; + } + + CORBA::Object_var poa_object = + this->orb_->resolve_initial_references("RootPOA"); + + 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 ()); + + this->create_servant_POA (name, more_policies, root_poa.in ()); + + this->create_home_servant_POA ("home servant POA", + more_policies, + root_poa.in ()); + + this->create_connections_POA (root_poa.in ()); + + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); + + poa_manager->activate (); + + return 0; + } + + void + Swapping_Container::add_servant_to_map + (PortableServer::ObjectId &oid, + Dynamic_Component_Servant_Base* servant) + { + this->dsa_->add_servant_to_map (oid, servant); + } + + void + Swapping_Container::delete_servant_from_map + (PortableServer::ObjectId &oid) + { + this->dsa_->delete_servant_from_map (oid); + } + + void + Swapping_Container::create_home_servant_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root) + { + CORBA::PolicyList policies (0); + + if (p != 0) + policies = *p; + + PortableServer::POAManager_var poa_manager = root->the_POAManager (); + + this->home_servant_poa_ = root->create_POA (name, + poa_manager.in (), + policies); + } + + void + Swapping_Container::create_connections_POA (PortableServer::POA_ptr root) + { + PortableServer::POAManager_var poa_manager = + root->the_POAManager (); + + TAO::Utils::PolicyList_Destroyer policies (3); + policies.length (3); + + policies[0] = + root->create_id_assignment_policy (PortableServer::USER_ID); + + policies[1] = + root->create_request_processing_policy + (PortableServer::USE_SERVANT_MANAGER); + + + // Servant Retention Policy + policies[2] = + root->create_servant_retention_policy (PortableServer::RETAIN); + + this->facet_cons_poa_ = + root->create_POA ("facet_consumer_poa", + poa_manager.in (), + policies); + + ACE_NEW_THROW_EX (this->sa_, + Servant_Activator (this->orb_.in ()), + CORBA::NO_MEMORY ()); + + this->facet_cons_poa_->set_servant_manager (this->sa_); + } + + void + Swapping_Container::create_servant_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root) + { + // @@ Jai, see how this method more or less does things (like + // setting policies) like create_connections_POA (). Could you + // please refactor them into a seperate method? + CORBA::PolicyList policies (0); + + if (p != 0) + policies = *p; + + PortableServer::POAManager_var poa_manager = + root->the_POAManager (); + + CORBA::ULong policy_length = policies.length (); + policies.length (policy_length + 1); + policies[policy_length] = + root->create_id_assignment_policy (PortableServer::USER_ID); + + policy_length = policies.length (); + policies.length (policy_length + 1); + policies[policy_length] = + root->create_request_processing_policy ( + PortableServer::USE_SERVANT_MANAGER); + + policy_length = policies.length (); + policies.length (policy_length + 1); + policies[policy_length] = + root->create_servant_retention_policy (PortableServer::RETAIN); + + this->component_poa_ = root->create_POA (name, poa_manager.in (), policies); + + ACE_NEW_THROW_EX (this->dsa_, + Dynamic_Component_Activator (this->orb_.in ()), + CORBA::NO_MEMORY ()); + + this->component_poa_->set_servant_manager (this->dsa_); + } + + void + Swapping_Container::ciao_uninstall_home (Components::CCMHome_ptr homeref) + { + PortableServer::POA_ptr tmp = this->home_servant_poa_.in (); + PortableServer::ObjectId_var oid = + tmp->reference_to_id (homeref); + + tmp->deactivate_object (oid.in ()); + } + + CORBA::Object_ptr + Swapping_Container::install_servant (PortableServer::Servant p, + Container::OA_Type t) + { + PortableServer::POA_ptr tmp = 0; + + if (t == Container::Component) + { + tmp = this->home_servant_poa_.in (); + } + else + { + tmp = this->facet_cons_poa_.in (); + } + + PortableServer::ObjectId_var oid = tmp->activate_object (p); + + CORBA::Object_var objref = tmp->id_to_reference (oid.in ()); + + return objref._retn (); + } +} diff --git a/CIAO/ciao/Swapping_Container.h b/CIAO/ciao/Swapping_Container.h new file mode 100644 index 00000000000..fe149ab8c6a --- /dev/null +++ b/CIAO/ciao/Swapping_Container.h @@ -0,0 +1,117 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Swapping_Container.h + * + * $Id$ + * + * Header file for CIAO's Dynamic Swapping container implementations + * + * @author Jaiganesh Balasubramanian <jai@dre.vanderbilt.edu> + * Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_SWAPPING_CONTAINER_H +#define CIAO_SWAPPING_CONTAINER_H +#include /**/ "ace/pre.h" + +// @@ Jai, are all these inclusions necessary? Please cut down on them +// to a minimum +#include "tao/ORB.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/Servant_Base.h" +#include "ciao/Session_Container.h" +#include "ciao/Dynamic_Component_Activator.h" +#include "ciao/CIAO_Server_Export.h" +#include "ciao/Servant_Activator.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class Dynamic_Component_Servant_Base; + + class CIAO_SERVER_Export Swapping_Container : public Session_Container + { + public: + + Swapping_Container (CORBA::ORB_ptr o, Container_Impl *container_impl); + + virtual ~Swapping_Container (void); + + /// Initialize the container with a name. + virtual int init (const char *name = 0, + const CORBA::PolicyList *more_policies = 0); + + virtual CORBA::Object_ptr install_servant (PortableServer::Servant p, + Container::OA_Type t); + + virtual CORBA::Object_ptr get_objref (PortableServer::Servant p); + + virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref); + + virtual CORBA::Object_ptr get_home_objref (PortableServer::Servant p); + + virtual void add_servant_to_map (PortableServer::ObjectId &oid, + Dynamic_Component_Servant_Base* servant); + + virtual void delete_servant_from_map (PortableServer::ObjectId &oid); + + virtual void deactivate_facet (const PortableServer::ObjectId &oid); + + PortableServer::POA_ptr the_home_servant_POA (void) const; + + private: + + /// Create POA for the component. + void create_servant_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root); + + void create_home_servant_POA (const char *name, + const CORBA::PolicyList *p, + PortableServer::POA_ptr root); + + void create_connections_POA (PortableServer::POA_ptr root); + protected: + unsigned long number_; + + /// Static variable to store the highest number we have given out until + /// now + static ACE_Atomic_Op <ACE_SYNCH_MUTEX, unsigned long> serial_number_; + + Dynamic_Component_Activator *dsa_; + + }; +} + +// 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. +// @@Jai, is this macro required here? +#define CIAO_REGISTER_OBV_FACTORY(FACTORY, VALUETYPE) \ + { \ + CORBA::ValueFactory factory = new FACTORY; \ + CORBA::ORB_ptr orb = \ + this->context_->_ciao_the_Container ()->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 "Swapping_Container.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* CIAO_SWAPPING_CONTAINER_H */ diff --git a/CIAO/ciao/Swapping_Container.inl b/CIAO/ciao/Swapping_Container.inl new file mode 100644 index 00000000000..698eec0324d --- /dev/null +++ b/CIAO/ciao/Swapping_Container.inl @@ -0,0 +1,7 @@ +// $Id$ + +ACE_INLINE CORBA::Object_ptr +CIAO::Swapping_Container::get_objref (PortableServer::Servant p) +{ + return this->the_POA ()->servant_to_reference (p); +} diff --git a/CIAO/ciao/Swapping_Servant_Home_Impl_Base.cpp b/CIAO/ciao/Swapping_Servant_Home_Impl_Base.cpp new file mode 100644 index 00000000000..919c70e6df9 --- /dev/null +++ b/CIAO/ciao/Swapping_Servant_Home_Impl_Base.cpp @@ -0,0 +1,31 @@ +// $Id$ + +#include "Swapping_Servant_Home_Impl_Base.h" + +namespace CIAO +{ + Swapping_Home_Servant_Impl_Base::Swapping_Home_Servant_Impl_Base + (Swapping_Container * c) + : container_ (c) + { + } + + Swapping_Home_Servant_Impl_Base::~Swapping_Home_Servant_Impl_Base (void) + { + } + + // Operations for CCMHome interface. + + CORBA::IRObject_ptr + Swapping_Home_Servant_Impl_Base::get_component_def (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + CORBA::IRObject_ptr + Swapping_Home_Servant_Impl_Base::get_home_def (void) + { + throw CORBA::NO_IMPLEMENT (); + } + +} diff --git a/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h b/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h new file mode 100644 index 00000000000..a6ee1575aaa --- /dev/null +++ b/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h @@ -0,0 +1,63 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Swapping_Servant_Home_Impl_Base.h + * + * $Id$ + * + */ +//============================================================================= + + +#ifndef CIAO_SWAPPING_SERVANT_HOME_IMPL_BASE_H +#define CIAO_SWAPPING_SERVANT_HOME_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#include "CCM_HomeS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/CIAO_Server_Export.h" + +namespace CIAO +{ + class Swapping_Container; + + /** + * @class Swapping_Home_Servant_Impl_Base + * + */ + // @@ Jai, why are you inheriting from "home" here? What is the + // point? + // @@ JAI, probably my class naming convention was the problem. + // This is a home implementation and that is why inheriting from + // "home". + // + class CIAO_SERVER_Export Swapping_Home_Servant_Impl_Base + : public virtual POA_Components::CCMHome + { + public: + Swapping_Home_Servant_Impl_Base (Swapping_Container * c); + + virtual ~Swapping_Home_Servant_Impl_Base (void); + + // Operations for CCMHome interface. + virtual ::CORBA::IRObject_ptr get_component_def (void); + + virtual ::CORBA::IRObject_ptr get_home_def (void); + + protected: + Swapping_Container *container_; + private: + /// Not to be used + Swapping_Home_Servant_Impl_Base (void); + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_SWAPPING_SERVANT_HOME_IMPL_BASE_H */ diff --git a/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp b/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp new file mode 100644 index 00000000000..fbc804ca1aa --- /dev/null +++ b/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp @@ -0,0 +1,213 @@ +// $Id$ + +#ifndef CIAO_SWAPPING_SERVANT_IMPL_T_C +#define CIAO_SWAPPING_SERVANT_IMPL_T_C + +#include "ciao/Swapping_Servant_Home_Impl_T.h" +#include "ciao/Dynamic_Component_Servant_T.h" + +namespace CIAO +{ + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::Swapping_Home_Servant_Impl ( + typename EXEC::_ptr_type exe, + Session_Container * c, + const char* ins_name, + const char* obj_id, + const char* repo_id) + : Home_Servant_Impl_Base (c), + executor_ (EXEC::_duplicate (exe)), + ins_name_ (ins_name), + obj_id_ (obj_id), + repo_id_ (repo_id) + { + } + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::~Swapping_Home_Servant_Impl () + { + const DYNAMIC_SERVANT_MAP_ITERATOR end = + this->dynamic_servant_map_.end (); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (this->obj_id_); + + try + { + this->container_->delete_servant_from_map (oid); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("~Swapping_Home_Servant_Impl\t\n"); + } + + for (DYNAMIC_SERVANT_MAP_ITERATOR iter = + this->dynamic_servant_map_.begin (); + iter != end; ++iter) + { + (*iter).int_id_->destroy (oid); + } + } + + // Operations for CCMHome interface. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + void + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::remove_component ( + ::Components::CCMObject_ptr + ) + { + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (this->obj_id_); + + Dynamic_Component_Servant_Base *servant = 0; + + if (this->dynamic_servant_map_.find (oid.in (), servant) == 0) + { + servant->destroy (oid); + } + } + + // Operations for keyless home interface. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + Components::CCMObject_ptr + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::create_component ( + ) + { + return this->create (); + } + + // Operations for implicit home interface. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + typename COMP_SVNT::_stub_ptr_type + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::create ( + ) + { + if (this->executor_.in () == 0) + { + throw CORBA::INTERNAL (); + } + + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (); + + return this->_ciao_activate_component (_ciao_ec.in ()); + } + + // CIAO-specific operations. + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + typename COMP_SVNT::_stub_ptr_type + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::_ciao_activate_component ( + ::Components::EnterpriseComponent_ptr ec + ) + { + CORBA::Object_var hobj = + this->container_->get_home_objref (this); + + Components::CCMHome_var home = + Components::CCMHome::_narrow (hobj.in ()); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (this->obj_id_); + + CORBA::Object_var objref = + this->container_->generate_reference ( + this->obj_id_, + this->repo_id_, + Container::Component); + + Dynamic_Component_Servant_Base *svt = + new Dynamic_Component_Servant<COMP_SVNT> (ec, + home.in (), + this->ins_name_, + this, + this->container_); + + this->container_->add_servant_to_map (oid, svt); + + this->dynamic_servant_map_.bind (oid.in (), svt); + + typedef typename COMP_SVNT::_stub_type stub_type; + typename COMP_SVNT::_stub_var_type ho = + stub_type::_narrow (objref.in ()); + + return ho._retn (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + void + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::update_component_map ( + PortableServer::ObjectId &oid) + { + Dynamic_Component_Servant_Base *servant = 0; + + if (this->dynamic_servant_map_.find (oid, servant) == 0) + { + servant->update_destroy_count (); + this->dynamic_servant_map_.unbind (oid); + } + + return; + } + + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + void + Swapping_Home_Servant_Impl<BASE_SKEL, + EXEC, + COMP_SVNT>::_ciao_passivate_component ( + typename COMP_SVNT::_stub_ptr_type comp + ) + { + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (comp, + oid.out ()); + + COMP_SVNT *servant = 0; + + if (this->component_map_.find (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + + servant->ciao_passivate (); + + this->component_map_.unbind (oid.in ()); + } + } +} + +#endif /* CIAO_SWAPPING_SERVANT_IMPL_T_C */ diff --git a/CIAO/ciao/Swapping_Servant_Home_Impl_T.h b/CIAO/ciao/Swapping_Servant_Home_Impl_T.h new file mode 100644 index 00000000000..7fd6bb4a33c --- /dev/null +++ b/CIAO/ciao/Swapping_Servant_Home_Impl_T.h @@ -0,0 +1,119 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Swapping_Servant_Home_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated home servant class. + * + */ +//============================================================================= + + +#ifndef CIAO_SWAPPING_SERVANT_HOME_IMPL_T_H +#define CIAO_SWAPPING_SERVANT_HOME_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "ciao/Home_Servant_Impl_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ciao/Dynamic_Component_Servant_Base.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Swapping_Servant_Impl + * + * @brief Mixin base class for generated home servant. + * + * This class implements operations + * common to all generated home servants. + */ + template <typename BASE_SKEL, + typename EXEC, + typename COMP_SVNT> + class Swapping_Home_Servant_Impl + : public virtual BASE_SKEL, + public virtual Home_Servant_Impl_Base + { + public: + Swapping_Home_Servant_Impl (typename EXEC::_ptr_type exe, + Session_Container * c, + const char* ins_name, + const char* obj_id, + const char* repo_id); + + virtual ~Swapping_Home_Servant_Impl (void); + + // Operations for CCMHome interface. + + virtual void + remove_component (Components::CCMObject_ptr comp); + + // Operations for keyless home interface. + + virtual ::Components::CCMObject_ptr create_component (); + + // Operations for implicit home interface. + + virtual typename COMP_SVNT::_stub_ptr_type create (); + + virtual void + update_component_map (PortableServer::ObjectId &oid); + + protected: + // CIAO-specific operations. + + typename COMP_SVNT::_stub_ptr_type + _ciao_activate_component (::Components::EnterpriseComponent_ptr ec); + + void + _ciao_passivate_component (typename COMP_SVNT::_stub_ptr_type comp); + + protected: + typename EXEC::_var_type executor_; + + ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, + COMP_SVNT *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + + typedef ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, + Dynamic_Component_Servant_Base *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> DYNAMIC_SERVANT_MAP; + + typedef DYNAMIC_SERVANT_MAP::iterator DYNAMIC_SERVANT_MAP_ITERATOR; + DYNAMIC_SERVANT_MAP dynamic_servant_map_; + + const char* ins_name_; + const char* obj_id_; + const char* repo_id_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Swapping_Servant_Home_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Swapping_Servant_Home_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_SWAPPING_SERVANT_HOME_IMPL_T_H */ diff --git a/CIAO/ciao/Upgradeable_Context_Impl_T.cpp b/CIAO/ciao/Upgradeable_Context_Impl_T.cpp new file mode 100644 index 00000000000..e2afdaeab8b --- /dev/null +++ b/CIAO/ciao/Upgradeable_Context_Impl_T.cpp @@ -0,0 +1,67 @@ +// $Id$ + +#ifndef CIAO_UPGRADEABLE_CONTEXT_IMPL_T_C +#define CIAO_UPGRADEABLE_CONTEXT_IMPL_T_C + +#include "Upgradeable_Context_Impl_T.h" + +namespace CIAO +{ + template <typename BASE_CTX, + typename SVNT, + typename COMP> + Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::Upgradeable_Context_Impl ( + Components::CCMHome_ptr the_home, + Session_Container *c, + SVNT *sv) + : Context_Impl<BASE_CTX, SVNT, COMP> (the_home, c, sv) + { + } + + template <typename BASE_CTX, + typename SVNT, + typename COMP> + Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::~Upgradeable_Context_Impl (void) + { + } + + template <typename BASE_CTX, + typename SVNT, + typename COMP> + void + Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::deactivate_facet ( + const PortableServer::ObjectId &oid) + { + this->container_->deactivate_facet (oid); + } + + template <typename BASE_CTX, + typename SVNT, + typename COMP> + void + Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::remove_facet ( + CORBA::Object_ptr reference) + { + PortableServer::ObjectId_var oid = + this->container_->the_facet_cons_POA ()->reference_to_id (reference); + + this->update_port_activator (oid.in ()); + + this->deactivate_facet (oid.in ()); + } + + template <typename BASE_CTX, + typename SVNT, + typename COMP> + void + Upgradeable_Context_Impl<BASE_CTX, SVNT, COMP>::update_port_activator ( + const PortableServer::ObjectId &oid) + { + CIAO::Servant_Activator *sa = + this->container_->ports_servant_activator (); + sa->update_port_activator (oid); + } + +} + +#endif /* CIAO_UPGRADEABLE_CONTEXT_IMPL_T_C */ diff --git a/CIAO/ciao/Upgradeable_Context_Impl_T.h b/CIAO/ciao/Upgradeable_Context_Impl_T.h new file mode 100644 index 00000000000..2d1e1845f52 --- /dev/null +++ b/CIAO/ciao/Upgradeable_Context_Impl_T.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Upgradeable_Context_Impl_T.h + * + * $Id$ + * + */ +//============================================================================= + + +#ifndef CIAO_UPGRADEABLE_CONTEXT_IMPL_T_H +#define CIAO_UPGRADEABLE_CONTEXT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "ciao/CIAO_UpgradeableContextC.h" +#include "ciao/Context_Impl_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL +namespace CORBA +{ + class SystemException; +} +TAO_END_VERSIONED_NAMESPACE_DECL + +namespace CIAO +{ + template <typename BASE_CTX, + typename SVNT, + typename COMP> + class Upgradeable_Context_Impl + : public virtual Context_Impl<BASE_CTX, SVNT, COMP> + { + public: + Upgradeable_Context_Impl (Components::CCMHome_ptr the_home, + Session_Container *c, + SVNT *sv); + + virtual ~Upgradeable_Context_Impl (void); + + virtual void + deactivate_facet (const PortableServer::ObjectId &oid); + + virtual void + update_port_activator (const PortableServer::ObjectId &oid); + + virtual void + remove_facet (CORBA::Object_ptr reference); + + virtual ::Components::ConsumerDescriptions * + get_registered_consumers (const char *publisher_name) = 0; + + private: + /// Not to be used + Upgradeable_Context_Impl (void); + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Upgradeable_Context_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Upgradeable_Context_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_UPGRADEABLE_CONTEXT_IMPL_T_H */ diff --git a/CIAO/ciao/Version.h b/CIAO/ciao/Version.h new file mode 100644 index 00000000000..0e6c663ed5d --- /dev/null +++ b/CIAO/ciao/Version.h @@ -0,0 +1,9 @@ +// -*- C++ -*- +// $Id$ + +// This is file was automatically generated by $ACE_ROOT/bin/make_release. + +#define CIAO_MAJOR_VERSION 0 +#define CIAO_MINOR_VERSION 5 +#define CIAO_BETA_VERSION 6 +#define CIAO_VERSION "0.5.6" diff --git a/CIAO/ciao/extension/CCM_ClientContainerInterceptor.idl b/CIAO/ciao/extension/CCM_ClientContainerInterceptor.idl new file mode 100644 index 00000000000..27a5fdc8929 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ClientContainerInterceptor.idl @@ -0,0 +1,27 @@ +// $Id$ + +#if !defined (CCM_CLIENTCONTAINERINTERCEPTOR_IDL) +#define CCM_CLIENTCONTAINERINTERCEPTOR_IDL + +#include "ciao/CCM_ContainerInterceptor.idl" +#include "ciao/CCM_ContainerClientRequestInfo.idl" +#include "tao/PI/PIForwardRequest.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ClientContainerInterceptor : ContainerInterceptor + { + void send_request (in ContainerClientRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + void send_poll (in ContainerClientRequestInfo info); + void receive_reply (in ContainerClientRequestInfo info); + void receive_exception (in ContainerClientRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + void receive_other (in ContainerClientRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + }; + }; +}; +#endif /* CCM_CLIENTCONTAINERINTERCEPTOR_IDL */ diff --git a/CIAO/ciao/extension/CCM_ClientContainerInterceptorRegistration.idl b/CIAO/ciao/extension/CCM_ClientContainerInterceptorRegistration.idl new file mode 100644 index 00000000000..031f06f1a0f --- /dev/null +++ b/CIAO/ciao/extension/CCM_ClientContainerInterceptorRegistration.idl @@ -0,0 +1,24 @@ +// $Id$ + +#if !defined (CCM_CLIENTCONTAINERINTERCEPTORREGISTRATION_IDL) +#define CCM_CLIENTCONTAINERINTERCEPTORREGISTRATION_IDL + +#include "ciao/CCM_Cookie.idl" +#include "ciao/CCM_InvalidRegistration.idl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ClientContainerInterceptor; + + local interface ClientContainerInterceptorRegistration + { + Components::Cookie register_client_interceptor (in ClientContainerInterceptor ci); + ClientContainerInterceptor unregister_client_interceptor (in Components::Cookie cookie) + raises(InvalidRegistration); + }; + }; +}; + +#endif /* CCM_CLIENTCONTAINERINTERCEPTORREGISTRATION_IDL */ diff --git a/CIAO/ciao/extension/CCM_ContainerClientRequestInfo.idl b/CIAO/ciao/extension/CCM_ContainerClientRequestInfo.idl new file mode 100644 index 00000000000..b44dac880b8 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ContainerClientRequestInfo.idl @@ -0,0 +1,20 @@ +// $Id$ + +#if !defined (CCM_CONTAINERCLIENTREQUESTINFO_IDL) +#define CCM_CONTAINERCLIENTREQUESTINFO_IDL + +#include "ciao/CCM_ContainerRequestInfo.idl" +#include "tao/PI/ClientRequestInfo.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ContainerClientRequestInfo : ContainerRequestInfo + { + PortableInterceptor::ClientRequestInfo request_info(); + }; + }; +}; + +#endif /* CCM_CONTAINERCLIENTREQUESTINFO_IDL */ diff --git a/CIAO/ciao/extension/CCM_ContainerInterceptor.idl b/CIAO/ciao/extension/CCM_ContainerInterceptor.idl new file mode 100644 index 00000000000..b5ccdf52fae --- /dev/null +++ b/CIAO/ciao/extension/CCM_ContainerInterceptor.idl @@ -0,0 +1,21 @@ +// $Id$ + +#if !defined (CCM_CONTAINERPORTABLEINTERCEPTOR_IDL) +#define CCM_CONTAINERPORTABLEINTERCEPTOR_IDL + +#include "tao/PI_Forward.pidl" + +module Components { + + module ContainerPortableInterceptor { + + local interface ContainerInterceptor + { + readonly attribute string name; + void destroy (); + void set_slot_id(in PortableInterceptor::SlotId slot_id); + }; + }; +}; + +#endif /* CCM_CONTAINERPORTABLEINTERCEPTOR_IDL */ diff --git a/CIAO/ciao/extension/CCM_ContainerRequestInfo.idl b/CIAO/ciao/extension/CCM_ContainerRequestInfo.idl new file mode 100644 index 00000000000..3fb590acc16 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ContainerRequestInfo.idl @@ -0,0 +1,22 @@ +// $Id$ + +#if !defined (CCM_CONTAINERREQUESTINFO_IDL) +#define CCM_CONTAINERREQUESTINFO_IDL + +#include "ciao/CCM_Navigation.idl" +#include "tao/OctetSeq.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ContainerRequestInfo + { + readonly attribute CORBA::OctetSeq origin_id; + readonly attribute CORBA::OctetSeq target_id; + readonly attribute FeatureName name; + }; + }; +}; + +#endif /* CCM_CONTAINERREQUESTINFO_IDL */ diff --git a/CIAO/ciao/extension/CCM_ContainerServantRequestInfo.idl b/CIAO/ciao/extension/CCM_ContainerServantRequestInfo.idl new file mode 100644 index 00000000000..0a3348b8f7e --- /dev/null +++ b/CIAO/ciao/extension/CCM_ContainerServantRequestInfo.idl @@ -0,0 +1,25 @@ +// $Id$ + +#if !defined (CCM_CONTAINERSERVANTREQUESTINFO_IDL) +#define CCM_CONTAINERSERVANTREQUESTINFO_IDL + +#include "ciao/CCM_ContainerRequestInfo.idl" +#include "ciao/CCM_EnterpriseComponent.idl" +#include "tao/AnyTypeCode/Dynamic.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ContainerServantRequestInfo : ContainerRequestInfo + { + attribute Dynamic::ParameterList arguments; + readonly attribute string operation; + attribute any result; + attribute Components::EnterpriseComponent target; + attribute any the_exception; + }; + }; +}; + +#endif /* CCM_CONTAINERSERVANTREQUESTINFO_IDL */ diff --git a/CIAO/ciao/extension/CCM_ContainerServerRequestInfo.idl b/CIAO/ciao/extension/CCM_ContainerServerRequestInfo.idl new file mode 100644 index 00000000000..4868e6a2e8d --- /dev/null +++ b/CIAO/ciao/extension/CCM_ContainerServerRequestInfo.idl @@ -0,0 +1,20 @@ +// $Id$ + +#if !defined (CCM_CONTAINERSERVERREQUESTINFO_IDL) +#define CCM_CONTAINERSERVERREQUESTINFO_IDL + +#include "ciao/CCM_ContainerRequestInfo.idl" +#include "tao/PI_Server/ServerRequestInfo.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ContainerServerRequestInfo : ContainerRequestInfo + { + PortableInterceptor::ServerRequestInfo request_info(); + }; + }; +}; + +#endif /* CCM_CONTAINERSERVERREQUESTINFO_IDL */ diff --git a/CIAO/ciao/extension/CCM_ContainerStubRequestInfo.idl b/CIAO/ciao/extension/CCM_ContainerStubRequestInfo.idl new file mode 100644 index 00000000000..da14afa9e08 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ContainerStubRequestInfo.idl @@ -0,0 +1,24 @@ +// $Id$ + +#if !defined (CCM_CONTAINERSTUBREQUESTINFO_IDL) +#define CCM_CONTAINERSTUBREQUESTINFO_IDL + +#include "ciao/CCM_ContainerRequestInfo.idl" +#include "tao/AnyTypeCode/Dynamic.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ContainerStubRequestInfo : ContainerRequestInfo + { + attribute Dynamic::ParameterList arguments; + readonly attribute string operation; + attribute any result; + attribute Object target; + attribute any the_exception; + }; + }; +}; + +#endif /* CCM_CONTAINERSTUBREQUESTINFO_IDL */ diff --git a/CIAO/ciao/extension/CCM_ExtensionComponent.idl b/CIAO/ciao/extension/CCM_ExtensionComponent.idl new file mode 100644 index 00000000000..585e5e85f64 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ExtensionComponent.idl @@ -0,0 +1,20 @@ +// $Id$ + +#if !defined (CCM_EXTENSIONCOMPONENT_IDL) +#define CCM_EXTENSIONCOMPONENT_IDL + +#include "ciao/CCM_EnterpriseComponent.idl" +#include "ciao/CCM_ExtensionContext.idl" + +module Components +{ + local interface ExtensionComponent : EnterpriseComponent + { + void set_extension_context (in ExtensionContext ctx) + raises (CCMException); + void ccm_remove () + raises (CCMException); + }; +}; + +#endif /* CCM_EXTENSIONCOMPONENT_IDL */ diff --git a/CIAO/ciao/extension/CCM_ExtensionContext.idl b/CIAO/ciao/extension/CCM_ExtensionContext.idl new file mode 100644 index 00000000000..33fa969b436 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ExtensionContext.idl @@ -0,0 +1,37 @@ +// $Id$ + +#if !defined (CCM_EXTENSIONCONTEXT_IDL) +#define CCM_EXTENSIONCONTEXT_IDL + +#include "ciao/CCM_Context.idl" +#include "ciao/CCM_ClientContainerInterceptorRegistration.idl" +#include "ciao/CCM_ServerContainerInterceptorRegistration.idl" +#include "ciao/CCM_StubContainerInterceptorRegistration.idl" +#include "ciao/CCM_ServantContainerInterceptorRegistration.idl" +#include "ciao/CCM_CCMException.idl" + +module Components +{ + local interface ExtensionContext : CCMContext + { + Components::ContainerPortableInterceptor::ClientContainerInterceptorRegistration + get_client_interceptor_registration () + raises (CCMException); + Components::ContainerPortableInterceptor::ServerContainerInterceptorRegistration + get_server_interceptor_registration () + raises (CCMException); + Components::ContainerPortableInterceptor::StubContainerInterceptorRegistration + get_stub_interceptor_registration() + raises (CCMException); + Components::ContainerPortableInterceptor::ServantContainerInterceptorRegistration + get_servant_interceptor_registration() + raises (CCMException); + + Cookie install_service_reference(in string service_id, in Object objref) + raises (CCMException); + Object uninstall_service_reference(in Cookie ck) + raises (CCMException); + }; +}; + +#endif /* CCM_EXTENSIONCONTEXT_IDL */ diff --git a/CIAO/ciao/extension/CCM_InvalidRegistration.idl b/CIAO/ciao/extension/CCM_InvalidRegistration.idl new file mode 100644 index 00000000000..a5dc36c640e --- /dev/null +++ b/CIAO/ciao/extension/CCM_InvalidRegistration.idl @@ -0,0 +1,14 @@ +// $Id$ + +#if !defined (CCM_INVALIDREGISTRATION_IDL) +#define CCM_INVALIDREGISTRATION_IDL + +module Components +{ + module ContainerPortableInterceptor + { + exception InvalidRegistration { }; + }; +}; + +#endif /* CCM_INVALIDREGISTRATION_IDL */ diff --git a/CIAO/ciao/extension/CCM_QoS.idl b/CIAO/ciao/extension/CCM_QoS.idl new file mode 100644 index 00000000000..f78f98d3665 --- /dev/null +++ b/CIAO/ciao/extension/CCM_QoS.idl @@ -0,0 +1,31 @@ +// $Id$ + +#if !defined (CCM_QOS_IDL) +#define CCM_QOS_IDL + +#include "ciao/CCM_Cookie.idl" +#include "ciao/CCM_CCMException.idl" + +module Components +{ + module QoS { + struct QoSInstance { + string dimension; + any value; + }; + typedef sequence<QoSInstance> QoSInstances; + struct QoSConstraint { + string characteristic; + QoSInstances instances; + }; + typedef sequence<QoSConstraint> QoSConstraints; + interface Negotiation + { + Components::Cookie require_qos(in QoSConstraint requirements, in string client_id) + raises (CCMException); + void release_qos (in Components::Cookie ck); + }; + }; +}; + +#endif /* CCM_QOS_IDL */ diff --git a/CIAO/ciao/extension/CCM_ServantContainerInterceptor.idl b/CIAO/ciao/extension/CCM_ServantContainerInterceptor.idl new file mode 100644 index 00000000000..884a1af2599 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ServantContainerInterceptor.idl @@ -0,0 +1,26 @@ +// $Id$ + +#if !defined (CCM_SERVANTCONTAINERINTERCEPTOR_IDL) +#define CCM_SERVANTCONTAINERINTERCEPTOR_IDL + +#include "ciao/CCM_ContainerInterceptor.idl" +#include "ciao/CCM_ContainerServantRequestInfo.idl" +#include "tao/PI/PIForwardRequest.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ServantContainerInterceptor : ContainerInterceptor + { + void servant_receive_request (in ContainerServantRequestInfo info, out boolean proceed_call) + raises (PortableInterceptor::ForwardRequest); + void servant_send_reply (in ContainerServantRequestInfo info, out boolean proceed_call); + void servant_send_exception (in ContainerServantRequestInfo info, out boolean proceed_call) + raises (PortableInterceptor::ForwardRequest); + void servant_send_other (in ContainerServantRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + }; + }; +}; +#endif /* CCM_SERVANTCONTAINERINTERCEPTOR_IDL */ diff --git a/CIAO/ciao/extension/CCM_ServantContainerInterceptorRegistration.idl b/CIAO/ciao/extension/CCM_ServantContainerInterceptorRegistration.idl new file mode 100644 index 00000000000..39448de9a58 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ServantContainerInterceptorRegistration.idl @@ -0,0 +1,24 @@ +// $Id$ + +#if !defined (CCM_SERVANTCONTAINERINTERCEPTORREGISTRATION_IDL) +#define CCM_SERVANTCONTAINERINTERCEPTORREGISTRATION_IDL + +#include "ciao/CCM_Cookie.idl" +#include "ciao/CCM_InvalidRegistration.idl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ServantContainerInterceptor; + + local interface ServantContainerInterceptorRegistration + { + Components::Cookie register_servant_interceptor (in ServantContainerInterceptor ci); + ServantContainerInterceptor unregister_servant_interceptor (in Components::Cookie cookie) + raises(InvalidRegistration); + }; + }; +}; + +#endif /* CCM_SERVANTCONTAINERINTERCEPTORREGISTRATION_IDL */ diff --git a/CIAO/ciao/extension/CCM_ServerContainerInterceptor.idl b/CIAO/ciao/extension/CCM_ServerContainerInterceptor.idl new file mode 100644 index 00000000000..58ce5cc69a7 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ServerContainerInterceptor.idl @@ -0,0 +1,28 @@ +// $Id$ + +#if !defined (CCM_SERVERCONTAINERINTERCEPTOR_IDL) +#define CCM_SERVERCONTAINERINTERCEPTOR_IDL + +#include "ciao/CCM_ContainerInterceptor.idl" +#include "ciao/CCM_ContainerServerRequestInfo.idl" +#include "tao/PI/PIForwardRequest.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ServerContainerInterceptor : ContainerInterceptor + { + void receive_request_service_contexts (in ContainerServerRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + void receive_request (in ContainerServerRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + void send_reply (in ContainerServerRequestInfo info); + void send_exception (in ContainerServerRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + void send_other (in ContainerServerRequestInfo info) + raises (PortableInterceptor::ForwardRequest); + }; + }; +}; +#endif /* CCM_SERVERCONTAINERINTERCEPTOR_IDL */ diff --git a/CIAO/ciao/extension/CCM_ServerContainerInterceptorRegistration.idl b/CIAO/ciao/extension/CCM_ServerContainerInterceptorRegistration.idl new file mode 100644 index 00000000000..b4a3dafac26 --- /dev/null +++ b/CIAO/ciao/extension/CCM_ServerContainerInterceptorRegistration.idl @@ -0,0 +1,24 @@ +// $Id$ + +#if !defined (CCM_SERVERCONTAINERINTERCEPTORREGISTRATION_IDL) +#define CCM_SERVERCONTAINERINTERCEPTORREGISTRATION_IDL + +#include "ciao/CCM_Cookie.idl" +#include "ciao/CCM_InvalidRegistration.idl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface ServerContainerInterceptor; + + local interface ServerContainerInterceptorRegistration + { + Components::Cookie register_server_interceptor (in ServerContainerInterceptor ci); + ServerContainerInterceptor unregister_client_interceptor (in Components::Cookie cookie) + raises(InvalidRegistration); + }; + }; +}; + +#endif /* CCM_SERVERCONTAINERINTERCEPTORREGISTRATION_IDL */ diff --git a/CIAO/ciao/extension/CCM_StubContainerInterceptor.idl b/CIAO/ciao/extension/CCM_StubContainerInterceptor.idl new file mode 100644 index 00000000000..c183801af86 --- /dev/null +++ b/CIAO/ciao/extension/CCM_StubContainerInterceptor.idl @@ -0,0 +1,26 @@ +// $Id$ + +#if !defined (CCM_STUBCONTAINERINTERCEPTOR_IDL) +#define CCM_STUBCONTAINERINTERCEPTOR_IDL + +#include "ciao/CCM_ContainerInterceptor.idl" +#include "ciao/CCM_ContainerStubRequestInfo.idl" +#include "tao/PI/PIForwardRequest.pidl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface StubContainerInterceptor : ContainerInterceptor + { + void stub_send_request (in ContainerStubRequestInfo info, out boolean con) + raises (PortableInterceptor::ForwardRequest); + void stub_receive_reply (in ContainerStubRequestInfo info, out boolean con); + void stub_receive_exception (in ContainerStubRequestInfo info, out boolean con) + raises(PortableInterceptor::ForwardRequest); + void stub_receive_other (in ContainerStubRequestInfo info) + raises(PortableInterceptor::ForwardRequest); + }; + }; +}; +#endif /* CCM_STUBCONTAINERINTERCEPTOR_IDL */ diff --git a/CIAO/ciao/extension/CCM_StubContainerInterceptorRegistration.idl b/CIAO/ciao/extension/CCM_StubContainerInterceptorRegistration.idl new file mode 100644 index 00000000000..61ae62f51fa --- /dev/null +++ b/CIAO/ciao/extension/CCM_StubContainerInterceptorRegistration.idl @@ -0,0 +1,24 @@ +// $Id$ + +#if !defined (CCM_STUBCONTAINERINTERCEPTORREGISTRATION_IDL) +#define CCM_STUBCONTAINERINTERCEPTORREGISTRATION_IDL + +#include "ciao/CCM_Cookie.idl" +#include "ciao/CCM_InvalidRegistration.idl" + +module Components +{ + module ContainerPortableInterceptor + { + local interface StubContainerInterceptor; + + local interface StubContainerInterceptorRegistration + { + Components::Cookie register_stub_interceptor (in StubContainerInterceptor ci); + StubContainerInterceptor unregister_stub_interceptor (in Components::Cookie cookie) + raises(InvalidRegistration); + }; + }; +}; + +#endif /* CCM_STUBCONTAINERINTERCEPTORREGISTRATION_IDL */ diff --git a/CIAO/ciao/extension/ExtensionContext.cpp b/CIAO/ciao/extension/ExtensionContext.cpp new file mode 100644 index 00000000000..7592e2b97d2 --- /dev/null +++ b/CIAO/ciao/extension/ExtensionContext.cpp @@ -0,0 +1,98 @@ +// $Id$ + +#include "ExtensionContext.h" + +namespace CIAO +{ + ExtensionContext_Impl::ExtensionContext_Impl (Components::CCMHome_ptr home, + Session_Container * c) + : CIAO::Context_Impl_Base (home, c) + { + } + + ExtensionContext_Impl::~ExtensionContext_Impl (void) + { + } + + ::Components::ContainerPortableInterceptor::ClientContainerInterceptorRegistration_ptr + ExtensionContext_Impl::get_client_interceptor_registration (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + ::Components::ContainerPortableInterceptor::ServerContainerInterceptorRegistration_ptr + ExtensionContext_Impl::get_server_interceptor_registration (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + ::Components::ContainerPortableInterceptor::StubContainerInterceptorRegistration_ptr + ExtensionContext_Impl::get_stub_interceptor_registration (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + ::Components::ContainerPortableInterceptor::ServantContainerInterceptorRegistration_ptr + ExtensionContext_Impl::get_servant_interceptor_registration (void) + { + throw CORBA::NO_IMPLEMENT (); + } + + ::Components::Cookie * + ExtensionContext_Impl::install_service_reference ( + const char * /*service_id*/, + ::CORBA::Object_ptr /*objref*/) + { + throw CORBA::NO_IMPLEMENT (); + } + + ::CORBA::Object_ptr + ExtensionContext_Impl::uninstall_service_reference (::Components::Cookie * /*ck*/) + { + throw CORBA::NO_IMPLEMENT (); + } + + // Operations from ::Components::CCMContext. + + Components::Principal_ptr + ExtensionContext_Impl::get_caller_principal (void) + { + return CIAO::Context_Impl_Base::get_caller_principal (); + } + + Components::CCMHome_ptr + ExtensionContext_Impl::get_CCM_home (void) + { + return CIAO::Context_Impl_Base::get_CCM_home (); + } + + CORBA::Boolean + ExtensionContext_Impl::get_rollback_only (void) + { + return CIAO::Context_Impl_Base::get_rollback_only (); + } + + Components::Transaction::UserTransaction_ptr + ExtensionContext_Impl::get_user_transaction (void) + { + return CIAO::Context_Impl_Base::get_user_transaction (); + } + + CORBA::Boolean + ExtensionContext_Impl::is_caller_in_role (const char * role) + { + return CIAO::Context_Impl_Base::is_caller_in_role (role); + } + + void + ExtensionContext_Impl::set_rollback_only (void) + { + CIAO::Context_Impl_Base::set_rollback_only (); + } + + CORBA::Object_ptr + ExtensionContext_Impl::resolve_service_reference(const char *service_id) + { + return CIAO::Context_Impl_Base::resolve_service_reference (service_id); + } +} diff --git a/CIAO/ciao/extension/ExtensionContext.h b/CIAO/ciao/extension/ExtensionContext.h new file mode 100644 index 00000000000..d2ea1ee9948 --- /dev/null +++ b/CIAO/ciao/extension/ExtensionContext.h @@ -0,0 +1,90 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ExtensionContext.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + + +#ifndef CIAO_EXTENSIONCONTEXT_H +#define CIAO_EXTENSIONCONTEXT_H + +#include /**/ "ace/pre.h" + +#include "CIAO_Server_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/CCM_ExtensionContextC.h" +#include "ciao/Context_Impl_Base.h" +#include "tao/Objref_VarOut_T.h" + +namespace Components +{ + class CCMHome; + typedef CCMHome *CCMHome_ptr; + + typedef + TAO_Objref_Var_T< + CCMHome + > + CCMHome_var; +} + +namespace CIAO +{ + class CIAO_SERVER_Export ExtensionContext_Impl + : public virtual Components::ExtensionContext, + public virtual CIAO::Context_Impl_Base + { + public: + ExtensionContext_Impl(Components::CCMHome_ptr home, Session_Container * c); + + virtual ~ExtensionContext_Impl (void); + + // Operations from ::Components::CCMContext. + + virtual Components::Principal_ptr get_caller_principal (void); + + virtual Components::CCMHome_ptr get_CCM_home (void); + + virtual CORBA::Boolean get_rollback_only (void); + + virtual Components::Transaction::UserTransaction_ptr get_user_transaction (void); + + virtual CORBA::Boolean is_caller_in_role (const char *role); + + virtual void set_rollback_only (void); + + virtual CORBA::Object_ptr resolve_service_reference(const char *service_id); + + virtual ::Components::ContainerPortableInterceptor::ClientContainerInterceptorRegistration_ptr get_client_interceptor_registration (void); + + virtual ::Components::ContainerPortableInterceptor::ServerContainerInterceptorRegistration_ptr get_server_interceptor_registration (void); + + virtual ::Components::ContainerPortableInterceptor::StubContainerInterceptorRegistration_ptr get_stub_interceptor_registration (void); + + virtual ::Components::ContainerPortableInterceptor::ServantContainerInterceptorRegistration_ptr get_servant_interceptor_registration (void); + + virtual ::Components::Cookie * install_service_reference ( + const char * service_id, + ::CORBA::Object_ptr objref); + + virtual ::CORBA::Object_ptr uninstall_service_reference ( + ::Components::Cookie * ck); + + private: + ExtensionContext_Impl (void); + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_CONTEXT_IMPL_BASE_H */ |