|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopencard.core.service.CardServiceScheduler
public final class CardServiceScheduler
Manager for logical channels to an inserted smartcard. For each smart card known to the system and in use by some application there is one CardServiceScheduler that manages the access to the physical smart card. This is acchieved by allocating the available communication channels to the CardServices that want to access the card. The CardServiceScheduler takes care of state management and issues such as suspending active and resuming suspended CardServices.
Note that the current version supports only one logical channel per smart card. To support multiple channels, the internal structure of this class as well as the public interface has to be changed. One way to change the public interface would be to add a method named setCustomChannels, which works similiar to setCustomChannel but expects an array of channels that have to be managed. A second method to set only the number of channels to manage should then be added, too. In any case, it is a card service factory's responsibility to switch the scheduler to multi-channel support.
CardService
,
CardChannel
,
SmartCard
,
CardServiceFactory
Constructor Summary | |
---|---|
CardServiceScheduler(SlotChannel slotchannel)
Instantiates a new scheduler that is tied to the given slot channel. |
Method Summary | |
---|---|
CardChannel |
allocateCardChannel(java.lang.Object applicant,
boolean block)
Allocates a card channel. |
void |
cardInserted(CardTerminalEvent ctEvent)
Dummy method. |
void |
cardRemoved(CardTerminalEvent ctEvent)
Signals that a smartcard has been removed. |
protected SmartCard |
createSmartCard(CardID cid)
Creates a new SmartCard object. |
SlotChannel |
getSlotChannel()
Returns the slot channel for this scheduler. |
protected boolean |
isAlive()
Checks whether this scheduler is alive. |
boolean |
isCustomized()
Deprecated. |
void |
releaseCardChannel(CardChannel channel)
Releases a card channel. |
protected void |
releaseSmartCard(SmartCard card)
Releases a SmartCard object. |
CardID |
reset(CardChannel ch,
boolean warm,
boolean block)
Reset the card associated with this CardServiceScheduler |
void |
setCustomChannel(CardChannel channel)
Deprecated. use CardChannel.setState() instead |
java.lang.String |
toString()
Returns a human-readable string representation of this scheduler. |
void |
useDefaultChannel()
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CardServiceScheduler(SlotChannel slotchannel)
slotchannel
- the physical channel to use for communicating with the cardMethod Detail |
---|
public void setCustomChannel(CardChannel channel) throws InvalidCardChannelException
InvalidCardChannelException
public void useDefaultChannel() throws InvalidCardChannelException
InvalidCardChannelException
public final boolean isCustomized()
public final SlotChannel getSlotChannel()
public CardChannel allocateCardChannel(java.lang.Object applicant, boolean block) throws CardTerminalException
applicant
- The object requesting the card channel. This parameter will
be useful when support for multi-channel cards is implemented.
It allows to implement channel affinity.block
- If true the calling thread will be suspended until a
CardChannel becomes available; if false
allocateCardChannel() will return null at once.
CardTerminalException
- if the terminal encountered an error. This can only happen
if the smartcard was removed, in which case the scheduler
will close down. When closing down, the underlying slot
channel is closed down, too. This may result in this exception.releaseCardChannel(opencard.core.service.CardChannel)
public void releaseCardChannel(CardChannel channel) throws InvalidCardChannelException
channel
- the card channel to release
InvalidCardChannelException
- The CardChannel has not been allocated here.allocateCardChannel(java.lang.Object, boolean)
public final CardID reset(CardChannel ch, boolean warm, boolean block) throws CardTerminalException
ch
- If the caller already has a channel he can provide it.
Otherwise the scheduler will allocate the channel itsself.block
- If true the calling thread will be suspended until a
CardChannel becomes available; if false
allocateCardChannel() will return null at once.
CardTerminalException
- Reset failedpublic void cardInserted(CardTerminalEvent ctEvent)
cardInserted
in interface CTListener
CTListener
public void cardRemoved(CardTerminalEvent ctEvent) throws CardTerminalException
cardRemoved
in interface CTListener
ctEvent
- an event indicating that a smartcard has been removed
CardTerminalException
CTListener
public java.lang.String toString()
toString
in class java.lang.Object
protected final boolean isAlive() throws CardTerminalException
CardTerminalException
protected SmartCard createSmartCard(CardID cid) throws CardTerminalException
cid
- The CardID representing the smart card.
CardTerminalException
- The terminal encountered an error.protected void releaseSmartCard(SmartCard card) throws CardTerminalException
card
- The SmartCard object to release.
CardTerminalException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |