org.objectweb.david.libs.binding.iiop
Class IIOPBinder

java.lang.Object
  |
  +--org.objectweb.david.libs.binding.iiop.IIOPBinder
All Implemented Interfaces:
JAVA_SERIAL_SERVICE, NamingContext

public class IIOPBinder
extends Object
implements NamingContext, JAVA_SERIAL_SERVICE

IIOPBinder implements the IIOP protocol (GIOP/TCP/IP). This class should not be used directly by applications, but rather by personnality binders that will instantiate all the parameters: it is an IIOP "delegate" implementation.


Fields inherited from interface org.objectweb.david.apis.services.java_serial.JAVA_SERIAL_SERVICE
TAG_JAVA_SERIAL
 
Constructor Summary
IIOPBinder(Context _c, ChunkFactory chunk_factory, MarshallerFactory marshaller_factory, ServicesHandler services_handler, StubFactory stub_factory, NamingContext context, org.omg.IOP.TaggedComponent[] ior_components)
          Builds a new instance of IIOPBinder.
 
Method Summary
 Identifier decode(byte[] data, int offset, int length)
          Decodes an identifier from a buffer portion.
 Identifier decode(UnMarshaller u)
          Decodes an identifier from the provided unmarhaller.
 Identifier export(Object id, Context hints)
          Creates a new identifier for the object interface designated by the id parameter.
 Identifier newId(String host, int port, byte[] key)
          Creates an IIOP Identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IIOPBinder

public IIOPBinder(Context _c,
                  ChunkFactory chunk_factory,
                  MarshallerFactory marshaller_factory,
                  ServicesHandler services_handler,
                  StubFactory stub_factory,
                  NamingContext context,
                  org.omg.IOP.TaggedComponent[] ior_components)
           throws JonathanException
Builds a new instance of IIOPBinder.

initial_context may contain a component of name "direct_local_optimization" of type Boolean. If true, it means that the actual server implementation should be returned when a local server reference is unmarshalled. Else, a stub is returned, that will intercept calls to the server. The default value is false.

The services_handler is used to instantiate the GIOP protocol instance used.

The context parameter represents the actual IIOP naming context, i.e., the context that delegates its operations to the newly created IIOPBinder.

Parameters:
_c - an initial context to be used for initializations;
chunk_factory - a chunk factory;
marshaller_factory - a marshaller factory;
services_handler - a CORBA services handler;
stub_factory - a stub factory;
context - the actual IIOP binder (the ORB);
ior_components - the components to be included in the created IORs
Throws:
JonathanException - if something goes wrong.
Method Detail

export

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

The hints member may contain a component named port of type int. If so, its value is used as a preferred port number. id must be of type Identifier.

Specified by:
export in interface NamingContext
Parameters:
id - an identifier managed by another naming context;
hints - additional information;
Returns:
an identifier managed by the target naming context.
Throws:
JonathanException - if something else goes wrong.
See Also:
naming_context.export( org.objectweb.jonathan.model.name)

decode

public Identifier decode(byte[] data,
                         int offset,
                         int length)
                  throws JonathanException
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;
length - length of the encoding;
Returns:
a decoded identifier;
Throws:
JonathanException - if something goes wrong.

decode

public Identifier decode(UnMarshaller u)
                  throws JonathanException
Decodes an identifier from the provided unmarhaller.
Specified by:
decode in interface NamingContext
Parameters:
u - an unmarhaller;
Returns:
an identifier managed by the target naming context;
Throws:
JonathanException - if something goes wrong.

newId

public Identifier newId(String host,
                        int port,
                        byte[] key)
                 throws JonathanException
Creates an IIOP Identifier.
Parameters:
host - a machine host name;
port - a port number;
key - an object key;
Returns:
a bindable IIOP Identifier
Throws:
JonathanException - if something goes wrong.