The overhead of processing TaggedComponents within an IOR becomes
significant when done many times, as in the case of J2EE
implementations where multiple interceptors are used.
The definition of IORs in the IOP module is intended to support
transmission and interoperability, rather than efficient access to the
local, ORB specific, internal structure.
I would like to propose that an abstract model of an IOR is introduced
which recognises that many of the constituent parts of IOR profiles are
identical for different objects, along the following lines:-
- an IOR has a type ID string, and contains TaggedProfile instances
- a TaggedProfile has an ID and data
- an IIOPProfile is a TaggedProfile; it is composed of an
IIOPProfileTemplate and an object ID.
- an IIOPProfileTemplate has IIOP addressing information, and contains
TaggedComponents.
- a TaggedComponent has an ID and data
- a TaggedComponentFactory creates a TaggedComponent
- a TaggedProfileFactory creates a TaggedProfile
with corresponding IDL definitions that allow the language bindings
to optimise conversion between transmission and internal IOR formats
to provide a performant and natural interface for IOR access.
Rationale:
In Java, for example, it should be possible to manipulate IOR
TaggedProfiles and IIOPProfileTemplate TaggedComponents using the
facilities of the Java collections framework, or at least some
equivalent facility that is a natural Java idiom.
Templates can be used to create IIOPProfiles because the basic object
adapter model for object creation is to establish many of the properties
of an IOR when the object adapter is created.
- This has been present for the POA essentially from the beginning, since
policies can only be passed to create_POA, and cannot be changed on an
existing POA.
- The Portable Interceptors work has also made this clear, since the IOR
interceptor establish_components method, which is the only time that
user code can add tagged components to an IOR, is only guaranteed to
be called once for each distinct set of server policies i.e need only
be run when an object adapter is created.
- It is also likely that more than one object within an adapter will
map to a TCP endpoint.
TaggedProfile and TaggedComponent are intended as frameworks that may be
extended to support application defined tagged profiles and components.
To support this it is necessary to be able to register TaggedProfile and
TaggedComponentFactory instances with an ORB, in which case any IOR
unmarshalled by that ORB instance will use the registered factory
to unmarshal the tagged profile or component.
Since there has already been quite a bit of discussion about this in the
Java RTF, here is a proposal for review:-
Proposal:
- add the following sections after the IOR Interceptor Overview:-
21.5.2 An Abstract Model for IORs
To support efficient access to IORs, avoiding repeated marshaling and
demarshaling of IOR components, it is helpful to have an abstract model
of the, ORB specific, local representation of an IOR.
Recognising that many of the constituent parts of IOR profiles are
identical for different objects allows the following model to be
defined:-
- an IOR has a type ID string, and contains TaggedProfile instances
- a TaggedProfile has an ID and data
- an IIOPProfile is a TaggedProfile; it is composed of an
IIOPProfileTemplate and an object ID.
- an IIOPProfileTemplate has IIOP addressing information, and contains
TaggedComponents.
- a TaggedComponent has an ID and data
- a TaggedComponentFactory creates a TaggedComponent
- a TaggedProfileFactory creates a TaggedProfile
21.5.3 Local IOR Interfaces
The following interfaces provide access to the data within a local IOR
using this model.
TaggedProfile and TaggedComponent are generic interfaces. Users of the ORB
may create implementations of them. Corresponding factories may be
registered with the IORFactory.
The IORFactory is obtained through a call to
ORB::resolve_initial_references ("IORFactory") and may also be used to
obtain an IOR for an Object.
An ORB must return all tagged profiles in an IOR through the IOR
getProfiles operations. The ProfileIterator interface allows a client
to iterate through the TaggedProfiles using the next operation.
Those profiles whose ids have a registered TaggedProfileFactory will
be made available in the form returned by the registered factory's
TaggedProfileFactory create operation, which must return a subtype of
TaggedProfile.
An ORB will provide a TaggedProfileFactory implementation for the
IIOPProfile.
Profiles with ids for which no TaggedProfileFactory has been registered
will be made available as instances of a generic ORB implementation of
TaggedProfile.
Similarly, an ORB must return all tagged components in an IIOP profile
through the IIOPProfile().getTemplate().getComponents() operations.
The ComponentIterator interface allows a client to iterate through the
TaggedComponents using the next operation.
Those components whose ids have a registered TaggedComponentFactory
will be made available in the form returned by the registered factory's
TaggedComponentFactory create operation, which must return a subtype of
TaggedComponent.
Components with ids for which no TaggedComponentFactory has been
registered will be made available as instances of a generic ORB
implementation of TaggedComponent.
module PortableInterceptor {
local interface TaggedComponent
{
readonly attribute IOP::ComponentId component_id;
readonly attribute CORBA::OctetSeq component_data;
IOP::TaggedComponent convert();
}
;
local interface ComponentIterator
{
TaggedComponent next();
boolean has_next();
}
;
local interface TaggedProfile
{
readonly attribute IOP::ProfileId profile_id;
readonly attribute CORBA::OctetSeq profile_data;
IOP::TaggedProfile convert();
}
;
local interface ProfileIterator
{
TaggedProfile next();
boolean has_next();
}
;
local interface IOR
{
readonly attribute string type_id;
ProfileIterator get_profiles ();
ProfileIterator get_profiles_by_id (in IOP::ProfileId profile_id);
}
;
local interface IIOPProfileTemplate
{
readonly attribute IIOP::Version iiop_version;
readonly attribute string host;
readonly attribute unsigned short port;
ComponentIterator get_components();
ComponentIterator get_components_by_id (in IOP::ComponentId id);
}
;
local interface IIOPProfile:TaggedProfile
{
readonly attribute CORBA::OctetSeq object_key;
readonly attribute IIOPProfileTemplate profile_template;
}
;
local interface TaggedComponentFactory
{
readonly attribute IOP::ComponentId factory_id;
TaggedComponent create_tagged_component
(in CORBA::OctetSeq component_data);
}
;
local interface TaggedProfileFactory
{
readonly attribute IOP::ProfileId factory_id;
TaggedProfile create_tagged_profile
(in CORBA::OctetSeq profile_data);
}
;
local interface IORFactory
{
IOR create_ior (in Object obj);
void register_tagged_profile_factory (in TaggedProfileFactory tpf);
void register_tagged_component_factory (in TaggedComponentFactory tcf);
}
;
};
21.5.3.1 IOR Factory Interface
create_ior
Return an IOR relating to the given Object.
If create_ior is invoked when the object reference is not bound,
standard system exception BAD_INV_ORDER with minor code n will be
raised.
register_tagged_profile_factory
Register a TaggedProfileFactory to create TaggedProfiles with the id
returned by the given factory's getId method. If a TaggedProfileFactory
already exists for the given id, standard system exception
BAD_INV_ORDER is raised with a standard minor code of n+1.
Instances of this interface may be defined by users to support custom
tagged profiles.
register_tagged_component_factory
Register a TaggedComponentFactory to read TaggedComponents with the id
returned by the given factory's getId method. If a
TaggedComponentFactory already exists for the given id, standard system
exception BAD_INV_ORDER is raised with a standard minor code of n+2.
Instances of this interface may be defined by users to support custom
tagged components.
21.5.3.2 IOR Interface
This interface gives access to a local representation of an
IOP::IOR.
type_id
The type id string from the IOR.
get_profiles
Returns an iterator over the TaggedProfiles within the IOR.
get_profiles_by_id
Returns an iterator over the TaggedProfiles with the given
Profileid.
21.5.3.3 TaggedProfile Interface
This interface gives access to a local representation of an
IOP::TaggedProfile.
profile_id
This attribute is the identifier for this TaggedProfile.
profile_data
This attribute is the data from the TaggedProfile. It is
normally a CDR encapsulation.
convert
Create an IOP representation of this TaggedProfile
21.5.3.4 TaggedComponent Interface
This interface gives access to a local representation of an
IOP::TaggedComponent.
component_id
This attribute is the identifier for this TaggedComponent.
component_data
This attribute is the data from the TaggedComponent. It is
normally a CDR encapsulation.
convert
Create an IOP representation of this TaggedComponent.
21.5.3.5 TaggedProfileFactory Interface
factory_id
This attribute is the identifier of profiles created by this
TaggedProfileFactory.
create
Create a TaggedProfile from the given profile_data.
21.5.3.6 TaggedComponentFactory Interface
factory_id
This attribute is the identifier of components created by this
TaggedComponentFactory.
create
Create a TaggedComponent from the given component_data.
21.5.3.7 ProfileIterator Interface
next
Returns the next TaggedProfile in the iteration. If next is called
after the last TaggedProfile has been returned, BAD_INV_ORDER will
be raised with a standard minor code of n+3.
If an IOR is modified in between calls to next, the behavior of
further calls to next is implementation dependent.
has_next
Returns true if the iteration has more elements. In other words,
returns true if next would return an element rather than throwing
an exception.
21.5.3.8 ComponentIterator Interface
next
Returns the next TaggedComponent in the iteration. If next is called
after the last TaggedComponent has been returned, BAD_INV_ORDER will
be raised with a standard minor code of n+3.
If a profile is modified in between calls to next, the behavior of
further calls to next is implementation dependent.
has_next
Returns true if the iteration has more elements. In other words,
returns true if next would return an element rather than throwing
an exception.
21.5.3.9 IIOPProfile Interface
object_key
This attribute is the Object key contained in this IIOPProfile.
profile_template
This attribute is the IIOPProfileTemplate associated with this
IIOPProfile.
21.5.3.10 IIOPProfileTemplate Interface
iiop_version
This attribute is the GIOP version of this profile. If the major
value is 1 and the minor value is 0, this profile cannot contain
any TaggedComponents.
host
This attribute is the host name string of this IIOPProfileTemplate.
port
This attribute is the port number of this IIOPProfileTemplate.
get_components
Return an iterator over the TaggedComponents within the
IIOPProfileTemplate.
get_components_by_id
Returns an iterator over the TaggedComponents with the given
ComponentId.
In current Section 21.5.3:
- add the following after the ORBInfo Interface
local interface IORInfo_3_n:IORInfo
{
ProfileIterator get_profiles ();
ProfileIterator get_profiles_by_id (in IOP::ProfileId profile_id);
}
;
- add the following sections:
21.5.3.4 get_profiles
Returns an iterator over the TaggedProfiles within the IOR.
21.5.3.5 get_profiles_by_id
Returns an iterator over the TaggedProfiles within the IOR with the
given Profileid.
Parameter Description
profile_id The IOP::ProfileId of the profiles in the iteration
to be returned.
- add the IORFactory to the list of reserved ObjectIds for
resolve_initial_references in section 4.5.2