com.sun.grid.jgrid.server
Class JCEPInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.ObjectInputStream
          extended bycom.sun.grid.jgrid.server.JCEPInputStream
All Implemented Interfaces:
java.io.DataInput, java.io.ObjectInput, java.io.ObjectStreamConstants

public class JCEPInputStream
extends java.io.ObjectInputStream

This class is used to read a serialized Job object that was written to disk with annotation for where to find its class data.


Nested Class Summary
 
Nested classes inherited from class java.io.ObjectInputStream
java.io.ObjectInputStream.GetField
 
Field Summary
private  java.lang.String lastAnnotation
          The last class data URL read from an object annotation by resolveClass().
 
Fields inherited from class java.io.ObjectInputStream
 
Fields inherited from class java.io.InputStream
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
JCEPInputStream()
          Creates a new instance of JCEPInputStream
JCEPInputStream(java.io.InputStream in)
          Creates an instance of JCEPInputStream that wraps the given InputStream.
 
Method Summary
 java.lang.String getLastAnnotation()
          Used to retreive the last annotation read in resolveClass().
protected  java.lang.Class resolveClass(java.io.ObjectStreamClass desc)
          Used to retreive the class file appropriate for a serialized object.
 
Methods inherited from class java.io.ObjectInputStream
available, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readClassDescriptor, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readStreamHeader, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, resolveProxyClass, skipBytes
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.ObjectInput
read, skip
 

Field Detail

lastAnnotation

private java.lang.String lastAnnotation
The last class data URL read from an object annotation by resolveClass().

Constructor Detail

JCEPInputStream

public JCEPInputStream()
                throws java.io.IOException
Creates a new instance of JCEPInputStream

Throws:
java.io.IOException - Thrown when an error occurs while creating the stream

JCEPInputStream

public JCEPInputStream(java.io.InputStream in)
                throws java.io.IOException
Creates an instance of JCEPInputStream that wraps the given InputStream.

Parameters:
in - The InputStream to wrap
Throws:
java.io.IOException - Thrown when an error occurs while creating the stream
Method Detail

resolveClass

protected java.lang.Class resolveClass(java.io.ObjectStreamClass desc)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException,
                                       java.net.MalformedURLException
Used to retreive the class file appropriate for a serialized object. To find the class file, JCEPInputStream reads an annotation from the serialized object which contains the URL where the class data can be found. If the annotation is null or if the class file can be found in the classpath, the classfile is loaded from the default ClassLoader.

Parameters:
desc - The object describing the class to be found and loaded
Returns:
A Class object for the class described by desc
Throws:
java.io.IOException - Thrown if there's an error reading the annotation
java.lang.ClassNotFoundException - Thrown if the class described by desc cannot be found in the classpath or, if present, in the URL given by the annotation
java.net.MalformedURLException - Thrown if the URL given in the annotation is not a valid URL

getLastAnnotation

public java.lang.String getLastAnnotation()
Used to retreive the last annotation read in resolveClass(). This is needed to set the codebase property of the Job object that is being deserialized.

Returns:
The last read annotation
See Also:
Job.setAnnotation(String)