org.openorb.orb.rmi
Interface DeserializationKernel

All Known Implementing Classes:
DeserializationKernelIBM14, NullDeserializationKernel, DeserializationKernelSun, DeserializationKernelIBM, DeserializationKernelNative

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 have non-public access modifiers and non-static inner classes can be part of a class to be marshaled. During unmarshaling the members must be assigned to the corresponding class member fields. Solution: Solving the problem with non-public 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. The purpose of the DeserializationKernel is thus to hide the differences behind a common interface (DeserializationKernel) and delegate the JDK specifics to the corresponding implementation classes (DeserializationKernelSun/IBM). 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. Security: For the implementation classes to work several RuntimPermissions must be set, otherwise PermissionDenied exceptions will occur. Please add the following permissions to your application's policy file:

     permission java.lang.RuntimePermission "accessDeclaredMembers";
     permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
     permission java.io.SerializablePermission "enableSubclassImplementation";
   

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.
Throws:
java.lang.InstantiationException - When the object can be instantiated.
java.lang.IllegalAccessException - When the object can't be accessed.

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.