org.objectweb.david.libs.stub_factories.std
Class JStubFactory

java.lang.Object
  extended byorg.objectweb.david.libs.stub_factories.std.JStubFactory
All Implemented Interfaces:
Constants, StubFactory

public class JStubFactory
extends java.lang.Object
implements StubFactory, Constants

Stub factories are factories for client and server stubs. This interface is used by binders to require the construction of stubs.


Nested Class Summary
 class JStubFactory.ClientDelegate
          Type of the client-side delegates.
 
Field Summary
protected static java.util.Hashtable smart_output_table
          Hashtable containing the smart stubs.
 
Fields inherited from interface org.objectweb.david.libs.stub_factories.std.Constants
_bad_operation, _corba_object_id, _corba_prefix, _just_corba_object
 
Constructor Summary
JStubFactory(org.omg.CORBA.ORB orb, org.objectweb.jonathan.apis.kernel.ClassPathFinder class_finder)
          Constructs a new stub factory.
 
Method Summary
protected  java.lang.Class createClass(java.lang.String str)
          Loads the class of name str using the class loader of the target stub factory
protected  org.omg.CORBA.portable.ObjectImpl newSmartStub(java.lang.String s_type, org.omg.CORBA.portable.Delegate delegate)
          Returns a stub of type s_type, initialized with the provided delegate.
 java.lang.Object newStub(SessionIdentifier session_id, Identifier[] ids, org.objectweb.jonathan.apis.kernel.Context hints)
          Creates a new stub.
static org.omg.CORBA.portable.ObjectImpl newStub(java.lang.String s_type, org.omg.CORBA.portable.Delegate delegate)
          Returns a new stub of type s_type initialized with the provided delegate.
static void registerSmartStub(java.lang.String std_stub_type, java.lang.Class smart_stub_class)
          Registers a class for smart output stubs as a replacement of a standard stub type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

smart_output_table

protected static java.util.Hashtable smart_output_table
Hashtable containing the smart stubs.

Constructor Detail

JStubFactory

public JStubFactory(org.omg.CORBA.ORB orb,
                    org.objectweb.jonathan.apis.kernel.ClassPathFinder class_finder)
Constructs a new stub factory.

Parameters:
orb - the ORB asking for the construction of the stub factory;
class_finder - the class loader used to initialize orb.
Method Detail

newStub

public java.lang.Object newStub(SessionIdentifier session_id,
                                Identifier[] ids,
                                org.objectweb.jonathan.apis.kernel.Context hints)
                         throws org.objectweb.jonathan.apis.kernel.JonathanException
Creates a new stub.

Specified by:
newStub in interface StubFactory
Parameters:
session_id - a protocol session identifier, to be used to send marshalled data to the object represented by the stub;
ids - the set of identifiers of the stub;
hints - hints
Returns:
a stub
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

newStub

public static org.omg.CORBA.portable.ObjectImpl newStub(java.lang.String s_type,
                                                        org.omg.CORBA.portable.Delegate delegate)
                                                 throws org.objectweb.jonathan.apis.kernel.JonathanException
Returns a new stub of type s_type initialized with the provided delegate.

The provided delegate must be of type ClientDelegate otherwise this method returns null.

Parameters:
s_type - the expected stub type;
delegate - a CORBA delegate.
Returns:
a stub of the expected type.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

registerSmartStub

public static void registerSmartStub(java.lang.String std_stub_type,
                                     java.lang.Class smart_stub_class)
Registers a class for smart output stubs as a replacement of a standard stub type.

If smart_stub_class is null, the previous class registered for std_stub_type is un-registered. std_stub_type must not be null.


createClass

protected java.lang.Class createClass(java.lang.String str)
                               throws java.lang.ClassNotFoundException
Loads the class of name str using the class loader of the target stub factory

Parameters:
str - the name of a class to load;
Returns:
the corresponding class object.
Throws:
java.lang.ClassNotFoundException - if the class can't be found.

newSmartStub

protected org.omg.CORBA.portable.ObjectImpl newSmartStub(java.lang.String s_type,
                                                         org.omg.CORBA.portable.Delegate delegate)
                                                  throws org.objectweb.jonathan.apis.kernel.JonathanException
Returns a stub of type s_type, initialized with the provided delegate.

If a smart stub type has been registered for s_type, it is used. Otherwise, the regular stub type is used.

Parameters:
s_type - the stub type;
delegate - the delegate for the created stub (may be null).
Returns:
a (smart) stub
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.