opencard.opt.util
Class PassThruCardServiceFactory

java.lang.Object
  |
  +--opencard.core.service.CardServiceFactory
        |
        +--opencard.opt.service.OCF11CardServiceFactory
              |
              +--opencard.opt.util.PassThruCardServiceFactory

public final class PassThruCardServiceFactory
extends OCF11CardServiceFactory

A factory for creating low level card services for any smartcard. The only service this factory can create is PassThruCardService, which is available for all smartcards. This class serves as an example for implementing a simple card service factories, and provides a "quick start" for people who want to become familiar with smartcards and the OpenCard Framework.
To use the service instantiated by this factory, add opencard.opt.util.PassThruCardServiceFactory to the attribute OpenCard.services in your opencard.properties file, preferrably as the last entry.

See Also:
PassThruCardService

Constructor Summary
PassThruCardServiceFactory()
          Instantiates a new factory for low level card services.
 
Method Summary
 java.util.Enumeration cardServiceClasses(opencard.core.terminal.CardID cardID)
          Returns an enumeration of known card service classes.
 boolean knows(opencard.core.terminal.CardID cardID)
          Tests whether this factory supports a given smartcard.
 
Methods inherited from class opencard.opt.service.OCF11CardServiceFactory
getCardType, getClasses
 
Methods inherited from class opencard.core.service.CardServiceFactory
getCardServiceInstance, getClassFor, newCardServiceInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PassThruCardServiceFactory

public PassThruCardServiceFactory()
Instantiates a new factory for low level card services.
Method Detail

knows

public final boolean knows(opencard.core.terminal.CardID cardID)
Tests whether this factory supports a given smartcard. The smartcard is identified by it's ATR (Answer To Reset), which is encapsulated in a CardID object. Since all smartcards can receive APDUs and send responses to them, this factory supports all cards. If a smartcard is supported, the card services this factory is able to instantiate can be obtained using cardServiceClasses.
Parameters:
cardID - the ATR of the smartcard to test for
Returns:
true, since this factory supports all smartcards
Overrides:
knows in class OCF11CardServiceFactory
See Also:
cardServiceClasses(opencard.core.terminal.CardID)

cardServiceClasses

public final java.util.Enumeration cardServiceClasses(opencard.core.terminal.CardID cardID)
Returns an enumeration of known card service classes. Known classes are those that can be instantiated by this factory for the given smartcard. To check whether a factory is able to instantiate any service at all for that smartcard, knows can be invoked. Since this factory supports all smartcards, and can only instantiate one service, this method returns a constant value.
Parameters:
cardID - the ATR of the smartcard to test for
Returns:
an enumeration holding PassThruCardService.class as it's only element
Overrides:
cardServiceClasses in class OCF11CardServiceFactory
See Also:
knows(opencard.core.terminal.CardID)