com.sun.javacard.javax.smartcard.rmiclient
Class CardObjectFactory

java.lang.Object
  extended by com.sun.javacard.javax.smartcard.rmiclient.CardObjectFactory
Direct Known Subclasses:
JCCardObjectFactory, JCCardProxyFactory

public abstract class CardObjectFactory
extends java.lang.Object

This CardObjectFactory abstract class represents the base class for Java Card RMI version 2.2.1 stub generation implementations. An instance of this class is associated with one Java Card applet selection session.


Field Summary
static byte REF_FORMAT_CLASS
          This value (=1) is used to signify that the CardObjectFactory implementation suppports the Java Card RMI remote reference format using the name of the card implementation remote class.
static byte REF_FORMAT_INTERFACES
          This value (=2) is used to signify that the CardObjectFactory implementation suppports the Java Card RMI remote reference format using the names of the remote interfaces implemented by the card implementation remote class.
static byte REF_FORMAT_NONE
          This value (=0) is used to signify that the CardObjectFactory implementation does not suppport any Java Card RMI remote reference descriptor formats.
 
Constructor Summary
CardObjectFactory()
          Creates a new CardObjectFactory for this RMI session
 
Method Summary
 byte getINSByte()
          returns the configured ISO 7816-4 command INS byte to be used in the Java Card platform remote method invocation command
 java.lang.Object getObject(byte[] buffer, int tagOffset, java.lang.Class type, CardAccessor cardAccessor)
          This abstract method returns the instance of the card object corresponding to the value returned from the card.
protected abstract  java.rmi.Remote getRemoteObject(byte[] buffer, int tagOffset, CardAccessor cardAccessor)
          This abstract method instantiates a stub or proxy object corresponding to the remote reference returned from the card
abstract  byte getRemoteRefFormat()
          returns the format of Java Card RMI remote object reference descriptor supported.
 void setINSByte(byte ins)
          Sets the ISO 7816-4 header INS byte to use for Java Card RMI method invocation commands.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REF_FORMAT_NONE

public static final byte REF_FORMAT_NONE
This value (=0) is used to signify that the CardObjectFactory implementation does not suppport any Java Card RMI remote reference descriptor formats.

See Also:
Constant Field Values

REF_FORMAT_CLASS

public static final byte REF_FORMAT_CLASS
This value (=1) is used to signify that the CardObjectFactory implementation suppports the Java Card RMI remote reference format using the name of the card implementation remote class.

See Also:
Constant Field Values

REF_FORMAT_INTERFACES

public static final byte REF_FORMAT_INTERFACES
This value (=2) is used to signify that the CardObjectFactory implementation suppports the Java Card RMI remote reference format using the names of the remote interfaces implemented by the card implementation remote class.

See Also:
Constant Field Values
Constructor Detail

CardObjectFactory

public CardObjectFactory()
Creates a new CardObjectFactory for this RMI session

Method Detail

getObject

public java.lang.Object getObject(byte[] buffer,
                                  int tagOffset,
                                  java.lang.Class type,
                                  CardAccessor cardAccessor)
                           throws java.rmi.RemoteException,
                                  java.rmi.StubNotFoundException,
                                  java.lang.Exception
This abstract method returns the instance of the card object corresponding to the value returned from the card. The value returned by the card may be any of the valid return types in Java Card RMI version 2.2 protocol format. In particular the return type may be a primitive, an array type or a remote reference descriptor or null. The method delegates processing to getRemoteObject(...) when the response tag is normal and expected type is a remote reference.

Parameters:
cardAccessor - used to instantiate stubs or proxies of remote objects
buffer - the byte array containing the Java Card RMI version 2.2 response data
tagOffset - the offset within the array where the response tag is located
type - the expected return type in the response data
Returns:
the object associated with the response data. Primitive return value is encapsulated in a wrapper object.
Throws:
java.rmi.StubNotFoundException - if an appropriate object could not be instantiated
java.rmi.RemoteException - for any RMI-specific exceptions
java.lang.Exception - for exceptions thrown on the card

getRemoteObject

protected abstract java.rmi.Remote getRemoteObject(byte[] buffer,
                                                   int tagOffset,
                                                   CardAccessor cardAccessor)
                                            throws java.lang.Exception
This abstract method instantiates a stub or proxy object corresponding to the remote reference returned from the card

Parameters:
buffer - the byte array containing the JC 2.2 RMI response data
tagOffset - the offset within the array where the response tag is located
Returns:
Stub or proxy
Throws:
java.lang.Exception - In case of error during processing

setINSByte

public void setINSByte(byte ins)
Sets the ISO 7816-4 header INS byte to use for Java Card RMI method invocation commands.

Parameters:
ins - the ISO 7816-4 INS command header byte to use for Java Card RMI invocation commands

getINSByte

public byte getINSByte()
returns the configured ISO 7816-4 command INS byte to be used in the Java Card platform remote method invocation command

Returns:
the ISO-7816-4 INS byte
Since:
Java Card 2.2

getRemoteRefFormat

public abstract byte getRemoteRefFormat()
returns the format of Java Card RMI remote object reference descriptor supported. It returns one of : REF_FORMAT_NONE, REF_FORMAT_CLASS, REF_FORMAT_INTERFACES

Returns:
one of the REF_FORMAT.. values defined above


Copyright (c) Copyright © 1998, 2010, Oracle and/or its affiliates. All rights reserved.