org.openorb.rmi.system
Interface DeserializationKernel

All Known Implementing Classes:
DeserializationKernelIBM, DeserializationKernelSun

public interface DeserializationKernel

This interface provides the methods to perform proper deserialization from IIOP streams. Problem description: The data format in IIOP streams (described in the CORBA/IIOP 2.6 spec. chapter 15.7) is completely different to the Java standard object serialization format as described by the Java object serialization specification. From the IIOP stream the data is read on a per field basis. No restrictions apply to the Java classes that are marshaled to the IIOP stream, besides the fact that the class must be Serializable. The problem is that even fields that jave final access modifiers and non-static inner classes can be part of a class to be marshaled. Upon unmarshaling an object from the stream the members are unmarshaled and thus must be assigned to the corresponding class member fields. Final members are problematic as no value can be assigned to, after the instance has been created. Solution: Solving the problem with final members in pure Java is impossible without restrictions to the classes that can be marshaled. Therefore a non-Java, i.e. native, solutions must be found. Inspecting the way how the major JDK ORBs (Sun, IBM) solve this problem revealed that they use similar native methods to assign members no matter what access modifiers they have. This class provides The methods in this interface allow assignments to class member fields no matter what access modifiers they have. This is achieved by providing access to private native method hooks from the classes com.sun.corba.se.internal.io.IIOPInputStream (Sun) and com.ibm.rmi.io (IBM) (more to come). The actual implementation of how access to the native method hooks is achieved can be found in the actual implementations of this interface. For more JDKs (MacOS, HP-UX) this interface must be implemented by providing access to the appropriate methods.

Author:
Michael Rumpf

Method Summary
 java.lang.Object allocateNewObject(java.lang.Class c, java.lang.Class base)
          This class allocates an instance of a class.
 void setBooleanField(java.lang.Class c, java.lang.String n, java.lang.Object o, boolean v)
          Set the member field of a class instance.
 void setByteField(java.lang.Class c, java.lang.String n, java.lang.Object o, byte v)
          Set the member field of a class instance.
 void setCharField(java.lang.Class c, java.lang.String n, java.lang.Object o, char v)
          Set the member field of a class instance.
 void setDoubleField(java.lang.Class c, java.lang.String n, java.lang.Object o, double v)
          Set the member field of a class instance.
 void setFloatField(java.lang.Class c, java.lang.String n, java.lang.Object o, float v)
          Set the member field of a class instance.
 void setIntField(java.lang.Class c, java.lang.String n, java.lang.Object o, int v)
          Set the member field of a class instance.
 void setLongField(java.lang.Class c, java.lang.String n, java.lang.Object o, long v)
          Set the member field of a class instance.
 void setObjectField(java.lang.Class c, java.lang.String n, java.lang.Object o, java.lang.Object v)
          Set the member field of a class instance.
 void setShortField(java.lang.Class c, java.lang.String n, java.lang.Object o, short v)
          Set the member field of a class instance.
 

Method Detail

allocateNewObject

public java.lang.Object allocateNewObject(java.lang.Class c,
                                          java.lang.Class base)
                                   throws java.lang.InstantiationException,
                                          java.lang.IllegalAccessException
This class allocates an instance of a class. The method allows allocations that are not possible when using pure Java's newInstance() method.
Parameters:
c - The class to allocate memory for.
base - The enclosing class when c is a non-static inner class.
Returns:
An instance of class c.

setObjectField

public void setObjectField(java.lang.Class c,
                           java.lang.String n,
                           java.lang.Object o,
                           java.lang.Object v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setBooleanField

public void setBooleanField(java.lang.Class c,
                            java.lang.String n,
                            java.lang.Object o,
                            boolean v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setByteField

public void setByteField(java.lang.Class c,
                         java.lang.String n,
                         java.lang.Object o,
                         byte v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setCharField

public void setCharField(java.lang.Class c,
                         java.lang.String n,
                         java.lang.Object o,
                         char v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setShortField

public void setShortField(java.lang.Class c,
                          java.lang.String n,
                          java.lang.Object o,
                          short v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setIntField

public void setIntField(java.lang.Class c,
                        java.lang.String n,
                        java.lang.Object o,
                        int v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setLongField

public void setLongField(java.lang.Class c,
                         java.lang.String n,
                         java.lang.Object o,
                         long v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setFloatField

public void setFloatField(java.lang.Class c,
                          java.lang.String n,
                          java.lang.Object o,
                          float v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.

setDoubleField

public void setDoubleField(java.lang.Class c,
                           java.lang.String n,
                           java.lang.Object o,
                           double v)
Set the member field of a class instance.
Parameters:
c - The type of the class.
n - The name of the member field.
o - The instance of the class c.
v - The value to assign to the field n on instance o.