Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

TAO_IORInfo Class Reference

This class exposes an interface that allows IORInterceptors add tagged components to IORs. More...

#include <IORInfo.h>

Inheritance diagram for TAO_IORInfo:
Inheritance graph
[legend]
Collaboration diagram for TAO_IORInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TAO_IORInfo (TAO_Root_POA *poa)
 Constructor.
void invalidate (void)
 Invalidate this IORInfo instance.
void components_established (void)
PortableInterceptor::IORInfo Methods

Methods exposed by the PortableInterceptor::IORInfo interface.

virtual CORBA::Policy_ptr get_effective_policy (CORBA::PolicyType type)
virtual void add_ior_component (const IOP::TaggedComponent &component)
 Add the given tagged component to all profiles.
virtual void add_ior_component_to_profile (const IOP::TaggedComponent &component, IOP::ProfileId profile_id)
virtual char * manager_id (void)
virtual
PortableInterceptor::AdapterState 
state (void)
virtual
PortableInterceptor::ObjectReferenceTemplate * 
adapter_template (void)
virtual
PortableInterceptor::ObjectReferenceFactory * 
current_factory (void)
virtual void current_factory (PortableInterceptor::ObjectReferenceFactory *current_factory)

Protected Member Functions

 ~TAO_IORInfo (void)
void check_validity (void)
 Check if this IORInfo instance is valid.

Private Member Functions

 TAO_IORInfo (const TAO_IORInfo &)
void operator= (const TAO_IORInfo &)

Private Attributes

TAO_Root_POApoa_
 Pointer to POA.
CORBA::Boolean components_established_

Detailed Description

This class exposes an interface that allows IORInterceptors add tagged components to IORs.

Definition at line 45 of file IORInfo.h.


Constructor & Destructor Documentation

TAO_IORInfo::TAO_IORInfo ( TAO_Root_POA poa  ) 

Constructor.

Definition at line 19 of file IORInfo.cpp.

  : poa_ (poa),
    components_established_ (false)
{
}

TAO_IORInfo::~TAO_IORInfo ( void   )  [protected]

Protected destructor to enforce proper memory managment through the reference counting mechanism.

Definition at line 25 of file IORInfo.cpp.

{
}

TAO_IORInfo::TAO_IORInfo ( const TAO_IORInfo  )  [private]

Prevent copying through the copy constructor and the assignment operator.


Member Function Documentation

PortableInterceptor::ObjectReferenceTemplate * TAO_IORInfo::adapter_template ( void   )  [virtual]

Return the policy matching the given policy type that is in effect for the object whose IOR is being created.

Definition at line 92 of file IORInfo.cpp.

{
  this->check_validity ();

  // Return the Object Reference Template whenever an IOR Interceptor
  // is invoked.  Its value is the template created for the adapter
  // policies and the IOR Interceptor calls to add_ior_component and
  // add_ior_component_to_profile.  It's a const value and its value
  // never changes.
  PortableInterceptor::ObjectReferenceTemplate *adapter_template =
    this->poa_->get_adapter_template ();

  if (adapter_template == 0)
    {
      throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
    }

  return adapter_template;
}

void TAO_IORInfo::add_ior_component ( const IOP::TaggedComponent &  component  )  [virtual]

Add the given tagged component to all profiles.

Definition at line 50 of file IORInfo.cpp.

{
  this->check_validity ();

  if (this->components_established_)
    throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);

  // Add the given tagged component to all profiles.
  this->poa_->save_ior_component (component);
}

void TAO_IORInfo::add_ior_component_to_profile ( const IOP::TaggedComponent &  component,
IOP::ProfileId  profile_id 
) [virtual]

Add the given tagged component to all profiles matching the given ProfileId.

Definition at line 62 of file IORInfo.cpp.

{
  this->check_validity ();

  if (this->components_established_)
    throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);

  this->poa_->save_ior_component_and_profile_id (component, profile_id);
}

void TAO_IORInfo::check_validity ( void   )  [protected]

Check if this IORInfo instance is valid.

Once all IORInterceptor interception points have been called, this IORInfo object is no longer valid. Throw an exception in that case.

Definition at line 143 of file IORInfo.cpp.

{
  if (this->poa_ == 0)
    {
      // Although not defined by the spec, duplicate the behavior used
      // by the ORBInitInfo object once CORBA::ORB_init() has been
      // called.  Specifically, the IORInfo object is no longer valid
      // once the POA has invoked all IORInterceptor interception
      // points.  This also prevents memory access violations from
      // occuring if the POA is destroyed before this IORInfo object.
      throw ::CORBA::OBJECT_NOT_EXIST (TAO::VMCID, CORBA::COMPLETED_NO);
    }
}

void TAO_IORInfo::components_established ( void   ) 

Inform the this IORInfo object that the IORInterceptor::components_established() interception point has been called. This method is used to inform the IORInfo object when the add_ior_component() and add_ior_component_to_profile() methods are invalid. They are only valid in the IORInterceptor::establish_components() interception point.

Definition at line 15 of file IORInfo.inl.

{
  this->components_established_ = true;
}

void TAO_IORInfo::current_factory ( PortableInterceptor::ObjectReferenceFactory *  current_factory  )  [virtual]

Return the policy matching the given policy type that is in effect for the object whose IOR is being created.

Definition at line 134 of file IORInfo.cpp.

PortableInterceptor::ObjectReferenceFactory * TAO_IORInfo::current_factory ( void   )  [virtual]

Return the policy matching the given policy type that is in effect for the object whose IOR is being created.

Definition at line 113 of file IORInfo.cpp.

{
  this->check_validity ();

  // Return the current_factory that is used to create the object
  // references by the adapter.  Though initially, its value is the
  // same as the adapter_template, unlike adapter_template, its value
  // can be changed.  The value of the current_factory can be changed
  // only during the call to components_established method.
  PortableInterceptor::ObjectReferenceFactory *adapter_factory =
    this->poa_->get_obj_ref_factory ();

  if (adapter_factory == 0)
    {
      throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
    }

  return adapter_factory;
}

CORBA::Policy_ptr TAO_IORInfo::get_effective_policy ( CORBA::PolicyType  type  )  [virtual]

Return the policy matching the given policy type that is in effect for the object whose IOR is being created.

Definition at line 30 of file IORInfo.cpp.

{
  this->check_validity ();

  CORBA::Policy_var policy =
    this->poa_->get_policy (type);

  if (!CORBA::is_nil (policy.in ()))
    {
      return policy._retn ();
    }

  // TODO: Now check the global ORB policies.
  // ........

  // No policy matching the given PolicyType was found.
  throw ::CORBA::INV_POLICY (CORBA::OMGVMCID | 3, CORBA::COMPLETED_NO);
}

void TAO_IORInfo::invalidate ( void   ) 

Invalidate this IORInfo instance.

Once the IOR interception points have been invoked, this IORInfo instance is no longer valid.

Definition at line 9 of file IORInfo.inl.

{
  this->poa_ = 0;
}

char * TAO_IORInfo::manager_id ( void   )  [virtual]

Return the policy matching the given policy type that is in effect for the object whose IOR is being created.

Definition at line 75 of file IORInfo.cpp.

{
  this->check_validity ();

  PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager ();
  return poa_manager->get_id ();
}

void TAO_IORInfo::operator= ( const TAO_IORInfo  )  [private]
PortableInterceptor::AdapterState TAO_IORInfo::state ( void   )  [virtual]

Return the policy matching the given policy type that is in effect for the object whose IOR is being created.

Definition at line 84 of file IORInfo.cpp.

{
  this->check_validity ();

  return this->poa_->get_adapter_state ();
}


Member Data Documentation

True if the IORInterceptor::components_established() interception point was called. False otherwise. This flag is used to prevent the add_ior_component() and add_ior_component_to_profile() methods from being incorrectly called after the IORInterceptor::establish_components() interception point has been called.

Definition at line 139 of file IORInfo.h.

Pointer to POA.

Definition at line 129 of file IORInfo.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines