|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopencard.core.service.CardServiceFactory
public abstract class 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: Subclasses should implement the getCardType() and getClasses() methods which can communicate with the card to classify the card. OCF 1.1 style card service factories should instead derive from opencard.opt.service.OCF11CardServiceFactory which still offers the deprecated knows() and cardServiceClasses() methods.
OCF11CardServiceFactory
,
CardService
,
PrimaryCardServiceFactory
,
CardID
Constructor Summary | |
---|---|
CardServiceFactory()
Instantiate a CardServiceFactory. |
Method Summary | |
---|---|
protected CardService |
getCardServiceInstance(java.lang.Class clazz,
CardType type,
CardServiceScheduler scheduler,
SmartCard card,
boolean block)
Instantiate a CardService implementing the class clazz. |
protected abstract CardType |
getCardType(CardID cid,
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 abstract java.util.Enumeration |
getClasses(CardType type)
Return an enumeration of known CardService classes. |
protected java.lang.Class |
getClassFor(java.lang.Class clazz,
CardType type)
Locate the CardService class that implements clazz. |
protected CardService |
newCardServiceInstance(java.lang.Class clazz,
CardType type,
CardServiceScheduler scheduler,
SmartCard card,
boolean blocking)
Utility method to instantiate a CardService. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CardServiceFactory()
Method Detail |
---|
protected CardService getCardServiceInstance(java.lang.Class clazz, CardType type, CardServiceScheduler scheduler, SmartCard card, boolean block) throws CardServiceException
clazz
- The Class object for which an implementing CardService
is requested.cid
- A CardID object representing the smart card for which
the CardService is requested.scheduler
- The controlling CardServiceSchedulercard
- The SmarCard object requesting the CardServiceblock
- Specifies the waiting behavior of the newly created CardService;
if true it will wait for CardChannel (i.e., block).
CardServiceException
protected java.lang.Class getClassFor(java.lang.Class clazz, CardType type)
clazz
- The Class object for which an implementing CardService
is requested.type
- A CardType object representing the smart card for which
the CardService is requested.
protected CardService newCardServiceInstance(java.lang.Class clazz, CardType type, CardServiceScheduler scheduler, SmartCard card, boolean blocking) throws CardServiceException
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.
CardServiceException
- if the service could be instantiated using the default constructor,
but encountered an error when initialize was invokedCardService.CardService()
,
CardService.initialize(opencard.core.service.CardServiceScheduler, opencard.core.service.SmartCard, boolean)
protected abstract CardType getCardType(CardID cid, CardServiceScheduler scheduler) throws CardTerminalException
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.
cid
- A CardID received from a Slot.scheduler
- A CardServiceScheduler that can be used to communicate with
the card to determine its type.
CardTerminalException
protected abstract java.util.Enumeration getClasses(CardType type)
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.
type
- The CardType of the smart card for which
the enumeration is requested.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |