opencard.opt.service
Class OCF11CardServiceFactory

java.lang.Object
  |
  +--opencard.core.service.CardServiceFactory
        |
        +--opencard.opt.service.OCF11CardServiceFactory
Direct Known Subclasses:
PassThruCardServiceFactory

public abstract class OCF11CardServiceFactory
extends opencard.core.service.CardServiceFactory

A CardServiceFactory can instantiate CardServices for a specific smart card. Typically, the CardServiceRegistry will instantiate a CardServiceFactory once a smart card has been inserted for which a waitForCard() method was invoked.

Note: This CardServiceFactory subclass maps the new style CardServiceFactory interface (using getCardType() and getClasses()) to the OCF 1.1 style card service factories using the deprecated knows() and cardServiceClasses() methods. Existing factories should inherit from this class to preserve compatibility.

See Also:
CardService, CardServiceFactory, CardType, CardID

Constructor Summary
OCF11CardServiceFactory()
          Instantiate a CardServiceFactory.
 
Method Summary
protected abstract  java.util.Enumeration cardServiceClasses(opencard.core.terminal.CardID cid)
          Return an enumeration of known CardService classes.
protected  opencard.core.service.CardType getCardType(opencard.core.terminal.CardID cid, opencard.core.service.CardServiceScheduler scheduler)
          Indicate whether this CardServiceFactory "knows" the smart card OS and/or installed card applications and might be able to instantiate CardServices for it.
protected  java.util.Enumeration getClasses(opencard.core.service.CardType type)
          Return an enumeration of known CardService classes.
protected abstract  boolean knows(opencard.core.terminal.CardID cid)
          Indicate whether this CardServiceFactory "knows" the smart card OS represented by cid and might be able to instantiate CardServices for it.
 
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

OCF11CardServiceFactory

public OCF11CardServiceFactory()
Instantiate a CardServiceFactory.
Method Detail

getCardType

protected opencard.core.service.CardType getCardType(opencard.core.terminal.CardID cid,
                                                     opencard.core.service.CardServiceScheduler scheduler)
Indicate whether this CardServiceFactory "knows" the smart card OS and/or installed card applications and might be able to instantiate CardServices for it.

This method replaces the former knows() method. Note: OCF 1.1 style card service factories should instead derive from opencard.opt.service.OCF11CardServiceFactory which still offers the knows() and cardServiceClasses() methods.

Should return a CardType that contains enough information to answer the getClassFor() method.

The factory can inspect the card (communicate with the card) using the provided CardServiceScheduler if the CardID information is insufficient to classify the card.

Parameters:
cid - A CardID received from a Slot.
scheduler - A CardServiceScheduler that can be used to communicate with the card to determine its type.
Returns:
A valid CardType if the factory can instantiate services for this card. CardType.UNSUPPORTED if the factory does not know the card.
Overrides:
getCardType in class opencard.core.service.CardServiceFactory
See Also:
getClasses(opencard.core.service.CardType)

getClasses

protected java.util.Enumeration getClasses(opencard.core.service.CardType type)
Return an enumeration of known CardService classes.

Replaces the former cardServiceClasses() method. Note: OCF 1.1 style card service factories should instead derive from opencard.opt.service.OCF11CardServiceFactory which still offers the knows() and cardServiceClasses() methods.

Parameters:
type - The CardType of the smart card for which the enumeration is requested.
Returns:
An Enumeration of class objects.
Overrides:
getClasses in class opencard.core.service.CardServiceFactory

knows

protected abstract boolean knows(opencard.core.terminal.CardID cid)
Indicate whether this CardServiceFactory "knows" the smart card OS represented by cid and might be able to instantiate CardServices for it.
Parameters:
cid - A CardID received from a Slot.

cardServiceClasses

protected abstract java.util.Enumeration cardServiceClasses(opencard.core.terminal.CardID cid)
Return an enumeration of known CardService classes.
Parameters:
cid - The CardID of the smart card for which the enumeration is requested.
Returns:
An Enumeration of class objects.