org.objectweb.jonathan.binding.domain
Class JDomain

java.lang.Object
  extended byorg.objectweb.jonathan.binding.domain.JDomain
All 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(org.objectweb.jonathan.apis.kernel.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.
 void export(NamingContext context, int jid)
          Registers the provided context under jid in the target context.
 Identifier export(Object id, org.objectweb.jonathan.apis.kernel.Context hints)
          Creates a new identifier for the object interface designated by the id parameter.
 void unexport(int jid)
          Unexports the context identified by jid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDomain

public JDomain(org.objectweb.jonathan.apis.kernel.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 Detail

export

public final Identifier export(Object id,
                               org.objectweb.jonathan.apis.kernel.Context hints)
                        throws org.objectweb.jonathan.apis.kernel.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.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something else goes wrong.
See Also:
org.objectweb.jonathan.model.naming_context#export(org.objectweb.jonathan.model.name)

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;
len - length of the encoding;
Returns:
a decoded identifier;

decode

public final Identifier decode(UnMarshaller unmarshaller)
                        throws org.objectweb.jonathan.apis.kernel.JonathanException
Decodes an identifier from the provided unmarshaller.

Specified by:
decode in interface NamingContext
Parameters:
unmarshaller - an unmarhaller;
Returns:
an identifier managed by the target context;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

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.

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.