org.objectweb.jonathan.binding.domain

Class JDomain

Implemented Interfaces:
NamingContext

public class JDomain
extends Object
implements NamingContext

Default domain implementation.

JDomain implements a domain functionality . It uses a context to associate integers and specific naming context types. For instance, to implement the OMG naming scheme where 0 is associated with IIOP, if the IIOP implementation is org.objectweb.david.libs.binders.orbs.iiop.IIOPORB, the bootstrap configuration file should contain the following lines, in the "/jonathan/JDomain" definition: The first declaration is used when an identifier is marshalled: JDomain gets the class name of the identifier's context (in this case org.objectweb.david.libs.binders.orbs.iiop.IIOPORB), and attempts to get the corresponding value. The value should be an integer, used to designate the naming context.

The second line is used when an identifier is unmarshalled. JDomain knows the integer id, but may have to dynamically instantiate the corresponding naming context. To do so, the integer must be associated to a factory that may be used to retrieve an instance of the context.

Constructor Summary

JDomain(Context _initial_context)
Builds a new JDomain instance.

Method Summary

NamingContext
bind(int jid)
Returns the context registered under jid in the target context.
Identifier
decode(byte[] data, int offset, int len)
Decodes an identifier from a buffer portion.
Identifier
decode(UnMarshaller unmarshaller)
Decodes an identifier from the provided unmarshaller.
Identifier
export(Object id, Context hints)
Creates a new identifier for the object interface designated by the id parameter.
void
export(NamingContext context, int jid)
Registers the provided context under jid in the target context.
void
unexport(int jid)
Unexports the context identified by jid.

Constructor Details

JDomain

public JDomain(Context _initial_context)
Builds a new JDomain instance. _initial_context corresponds to the Context describing the naming contexts to register implicitly in the new JDomain.

Parameters:
_initial_context - describing the naming contexts to register implicitly in the new JDomain.

Method Details

bind

public final NamingContext bind(int jid)
Returns the context registered under jid in the target context. This method only searched the already instantiated contexts.

Parameters:
jid - an integer id.

Returns:
the context registered under jid in the target context.


decode

public final Identifier decode(byte[] data,
                               int offset,
                               int len)
Decodes an identifier from a buffer portion.
Specified by:
decode in interface NamingContext

Parameters:
data - the byte array to read the encoded identifier from;
offset - offset of the first byte of the encoding;

Returns:
a decoded identifier;


decode

public final Identifier decode(UnMarshaller unmarshaller)
            throws JonathanException
Decodes an identifier from the provided unmarshaller.
Specified by:
decode in interface NamingContext

Parameters:

Returns:
an identifier managed by the target context;


export

public final Identifier export(Object id,
                               Context hints)
            throws JonathanException
Creates a new identifier for the object interface designated by the id parameter.

id must be of type Identifier

Specified by:
export in interface NamingContext

Parameters:
id - an identifier managed by another naming context;
hints - additional information (unused);

Returns:
an identifier managed by the target naming context.

See Also:
org.objectweb.jonathan.model.naming_context.export(org.objectweb.jonathan.model.name)


export

public final void export(NamingContext context,
                         int jid)
            throws ExportException
Registers the provided context under jid in the target context. This may override the settings specified when the JDomain instance was created.

Parameters:
context - a naming context;
jid - an integer id;

Throws:
ExportException - if the id is already in use.


unexport

public final void unexport(int jid)
Unexports the context identified by jid.

Parameters:
jid - an integer id.