POA(Portable Object Adapter)を使用し、可搬性の高いサーバアプリケーションの実装を実現するための、PortableServerクラス内のインタフェースについて説明します。
//C++ class PortableServer { public : class ServantBase { public : virtual POA_ptr _default_POA(){...}
virtual CORBA::InterfaceDef_ptr _get_interface( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::SystemException ); virtual CORBA::Boolean _is_a( const char* logical_type_id, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::SystemException ); virtual CORBA::Boolean _non_existent( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::SystemException ); virtual void _add_ref(); virtual void _remove_ref(); void servant_delete(); protected : ServantBase(); ServantBase(const ServantBase&); ServantBase& operator=(const ServantBase&); }; typedef ServantBase* Servant; class DynamicImplementation : public virtual ServantBase { public : CORBA::Object_ptr _this(); virtual CORBA::Boolean invoke( CORBA::ServerRequest_ptr request, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual CORBA::RepositoryId _primary_interface( const ObjectId& oid, POA_ptr poa, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class POA : public virtual CORBA::Object { public : virtual POA_ptr create_POA( const CORBA::Char* adapter_name, POAManager_ptr a_POAManager, const CORBA::PolicyList& policies, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual POA_ptr find_POA( const CORBA::Char* adapter_name, CORBA::Boolean activate_it, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void destroy( CORBA::Boolean etherealize_objects, CORBA::Boolean wait_for_completion, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ThreadPolicy_ptr create_thread_policy( ThreadPolicyValue value, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual LifespanPolicy_ptr create_lifespan_policy( LifespanPolicyValue value, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual IdUniquenessPolicy_ptr create_id_uniqueness_policy( IdUniquenessPolicyValue value, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual IdAssignmentPolicy_ptr create_id_assignment_policy( IdAssignmentPolicyValue value, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ImplicitActivationPolicy_ptr create_implicit_activation_policy( ImplicitActivationPolicyValue value, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ServantRetentionPolicy_ptr create_servant_retention_policy( ServantRetentionPolicyValue value, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual RequestProcessingPolicy_ptr create_request_processing_policy( RequestProcessingPolicyValue value, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ServantManager_ptr get_servant_manager( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void set_servant_manager( ServantManager_ptr imgr, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual Servant get_servant( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void set_servant( Servant p_servant, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ObjectId* activate_object( Servant p_servant, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void activate_object_with_id( const ObjectId& id, Servant p_servant, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void deactivate_object( const ObjectId& oid, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual CORBA::Object_ptr create_reference( const CORBA::RepositoryId intf, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual CORBA::Object_ptr create_reference_with_id( const ObjectId& oid, const CORBA::RepositoryId intf, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ObjectId* servant_to_id( Servant p_servant, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual CORBA::Object_ptr servant_to_reference( Servant p_servant, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual Servant reference_to_servant( CORBA::Object_ptr reference, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ObjectId* reference_to_id( CORBA::Object_ptr reference, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual Servant id_to_servant( const ObjectId& oid, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual CORBA::Object_ptr id_to_reference( const ObjectId& oid, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual AdapterActivator_ptr the_activator( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void the_activator( AdapterActivator_ptr arg, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual CORBA::Char* the_name( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual POA_ptr the_parent( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual POAList* the_children( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual POAManager_ptr the_POAManager( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class POAManager { public : virtual void activate( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void hold_requests( CORBA::Boolean wait_for_completion, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void discard_requests( CORBA::Boolean wait_for_completion, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual void deactivate( CORBA::Boolean etherealize_objects, CORBA::Boolean wait_for_completion, CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual POAManager::State get_state( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class ThreadPolicy : public virtual CORBA::Object, public virtual CORBA::Policy { public : virtual ThreadPolicyValue value( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class LifespanPolicy : public virtual CORBA::Object, public virtual CORBA::Policy { public : virtual LifespanPolicyValue value( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class IdUniquenessPolicy : public virtual CORBA::Object, public virtual CORBA::Policy { public : virtual IdUniquenessPolicyValue value( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class IdAssignmentPolicy : public virtual CORBA::Object, public virtual CORBA::Policy { public : virtual IdAssignmentPolicyValue value( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class ImplicitActivationPolicy : public virtual CORBA::Object, public virtual CORBA::Policy { public : virtual ImplicitActivationPolicyValue value( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class ServantRetentionPolicy : public virtual CORBA::Object, public virtual CORBA::Policy { public : virtual ServantRetentionPolicyValue value( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class RequestProcessingPolicy : public virtual CORBA::Object, public virtual CORBA::Policy { public : virtual RequestProcessingPolicyValue value( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; };
class Current : public virtual CORBA::Object, public virtual CORBA::Current { public : virtual POA_ptr get_POA( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; virtual ObjectId* get_object_id( CORBA::Environment& = CORBA::Environment() ) throw( CORBA::Exception ) = 0; }; };