com.sun.grid.proxy
Class ProxyInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.ObjectInputStream
              |
              +--sun.rmi.server.MarshalInputStream
                    |
                    +--com.sun.grid.proxy.ProxyInputStream
All Implemented Interfaces:
java.io.DataInput, java.io.ObjectInput, java.io.ObjectStreamConstants

public class ProxyInputStream
extends sun.rmi.server.MarshalInputStream

This class provides the ability to retrieve the annotation for any object that it reads.


Nested Class Summary
 
Nested classes inherited from class java.io.ObjectInputStream
java.io.ObjectInputStream.GetField
 
Field Summary
private  java.util.HashMap annotations
          A map of the annotations read indexed by class name.
private  java.lang.String classToAnnotate
          Since the annotation is read in a method that doesn't know the name of the class being read, we have to store the class name in a method that does know it (resolveClass) so it can be used in readLocation to enter the annotation into the annotations Map.
 
Fields inherited from class sun.rmi.server.MarshalInputStream
permittedSunClasses
 
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
ProxyInputStream(java.io.InputStream in)
          Creates a new instance of ProxyInputStream
 
Method Summary
 java.util.Map getAnnotations()
          This method returns the Map containing the annotations read so far, indexed by class name.
protected  java.lang.Object readLocation()
          This method reads the object annotation from the stream.
protected  java.lang.Class resolveClass(java.io.ObjectStreamClass classDesc)
          This method overrides its parent's method to store the class name in classToAnnotation
 
Methods inherited from class sun.rmi.server.MarshalInputStream
close, done, getDoneCallback, resolveProxyClass, setDoneCallback
 
Methods inherited from class java.io.ObjectInputStream
available, 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, 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

annotations

private java.util.HashMap annotations
A map of the annotations read indexed by class name.


classToAnnotate

private java.lang.String classToAnnotate
Since the annotation is read in a method that doesn't know the name of the class being read, we have to store the class name in a method that does know it (resolveClass) so it can be used in readLocation to enter the annotation into the annotations Map.

Constructor Detail

ProxyInputStream

public ProxyInputStream(java.io.InputStream in)
                 throws java.io.IOException,
                        java.io.StreamCorruptedException
Creates a new instance of ProxyInputStream

Parameters:
in - the InputStream to wrap
Throws:
java.io.IOException - if an error occurs while reading from the stream
java.io.StreamCorruptedException - if the object stream is invalid
Method Detail

resolveClass

protected java.lang.Class resolveClass(java.io.ObjectStreamClass classDesc)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
This method overrides its parent's method to store the class name in classToAnnotation

Overrides:
resolveClass in class sun.rmi.server.MarshalInputStream
Parameters:
classDesc - the ClassDesc object
Returns:
the resolved class object
Throws:
java.io.IOException - if an error occurs while reading from the stream
java.lang.ClassNotFoundException - if no class file can be found for the class being read

readLocation

protected java.lang.Object readLocation()
                                 throws java.io.IOException,
                                        java.lang.ClassNotFoundException
This method reads the object annotation from the stream. It overrides its parent's method to store the annotation in the annotations map index by the classToAnnotate.

Overrides:
readLocation in class sun.rmi.server.MarshalInputStream
Returns:
an object representing the annotation
Throws:
java.io.IOException - if an error occurs while reading from the stream
java.lang.ClassNotFoundException - If the class file for the annotation can not be found

getAnnotations

public java.util.Map getAnnotations()
This method returns the Map containing the annotations read so far, indexed by class name.

Returns:
map of annotations