OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.service
Class IBMCardServiceFactory

java.lang.Object
  |
  +--opencard.core.service.CardServiceFactory
        |
        +--com.ibm.opencard.service.IBMCardServiceFactory
Direct Known Subclasses:
MFCCardServiceFactory, MFCCardServiceFactoryER

public abstract class IBMCardServiceFactory
extends CardServiceFactory

The base class for IBM's card service factories. The standard card service factory gets extended by a method that interprets the ATR of IBM smartcards. There is also a method that builds an enumeration from an array of classes.
This class is abstract since it cannot instantiate any card service for any smartcard. This functionality must be added in derived classes.

Version:
$Id: IBMCardServiceFactory.java,v 1.1 1999/12/02 16:06:06 damke Exp $
See Also:
MFCCardService

Constructor Summary
protected IBMCardServiceFactory()
          Default constructor.
 
Method Summary
static int determineCardOS(CardID atr)
          Analyzes a smartcard's ATR in order to determine the CardOS.
protected  java.util.Enumeration enumerateClasses(java.lang.Class[] classes)
          Create an enumeration from an array of classes.
protected  CardService newCardServiceInstance(java.lang.Class clazz, CardType type, CardServiceScheduler scheduler, SmartCard card, boolean blocking)
          Utility method to instantiate a CardService.
protected  int normalizedCOSValue(CardID cardID)
          Determine a normalized card operating system value.
 
Methods inherited from class opencard.core.service.CardServiceFactory
getCardServiceInstance, getCardType, getClasses, getClassFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IBMCardServiceFactory

protected IBMCardServiceFactory()
Default constructor.
Method Detail

normalizedCOSValue

protected int normalizedCOSValue(CardID cardID)
Determine a normalized card operating system value. This method gets mapped onto the static method determineCardOS. It may be removed in the future.
Parameters:
cardID - The CardID object to examine.
Returns:
The normalized COS value, or -1 if not recognized.
See Also:
determineCardOS(opencard.core.terminal.CardID)

determineCardOS

public static int determineCardOS(CardID atr)
Analyzes a smartcard's ATR in order to determine the CardOS. For OCF compliant cards, a CardOS identifier is contained in the ATR (Answer-To-Reset). For non-OCF compliant cards, the historical bytes within the ATR will be further investigated.
This method currently recognizes MFC 3.5, 4.0, and 4.1 cards.
The JavaCard detection is still missing. Thomas, could you add it?
Parameters:
atr - the ATR of the smartcard
Returns:
the identifier of the CardOS, or -1 if not recognized

enumerateClasses

protected java.util.Enumeration enumerateClasses(java.lang.Class[] classes)
Create an enumeration from an array of classes.
Parameters:
classes - the array to enumerate
Returns:
an enumeration of the argument array

newCardServiceInstance

protected CardService newCardServiceInstance(java.lang.Class clazz,
                                             CardType type,
                                             CardServiceScheduler scheduler,
                                             SmartCard card,
                                             boolean blocking)
                                      throws CardServiceException
Utility method to instantiate a CardService. In addition to the functionality provided in the parent class stores the card type in the service.
Parameters:
clazz - The class of the CardService to instantiate.
scheduler - The controlling scheduler.
card - The owning SmartCard object.
blocking - Whether to run the new CardService in blocking mode.
Returns:
The instantiated CardService object or null if the requested class could not be instantiated.
Throws:
CardServiceException - if the service could be instantiated using the default constructor, but encountered an error when initialize was invoked
Overrides:
newCardServiceInstance in class CardServiceFactory
See Also:
CardService.CardService(), CardService.initialize(opencard.core.service.CardServiceScheduler, opencard.core.service.SmartCard, boolean)