|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopencard.core.terminal.CardTerminal
opencard.opt.terminal.AbstractLockableTerminal
public abstract class AbstractLockableTerminal
AbstractLockableTerminal is a base class for implementing lockable CardTerminals.
CardTerminal
,
Lockable
Field Summary |
---|
Fields inherited from class opencard.core.terminal.CardTerminal |
---|
address, name, slots, type |
Constructor Summary | |
---|---|
protected |
AbstractLockableTerminal(java.lang.String name,
java.lang.String type,
java.lang.String address)
Instantiates a CardTerminal object. |
Method Summary | |
---|---|
protected java.lang.Thread |
getSlotLockHandle(int slot)
|
protected java.lang.Object |
getTerminalLockHandle()
accessors for subclasses |
protected abstract void |
internalLock()
|
protected abstract void |
internalLockSlot(int slotNr)
|
protected void |
internalOpenSlotChannel(int slotID)
The internal openSlotChannel method. |
protected void |
internalOpenSlotChannel(int slotID,
java.lang.Object lockHandle)
The internal openSlotChannel method for locked terminals (default implementation). |
protected abstract void |
internalUnlock()
|
protected abstract void |
internalUnlockSlot(int slotNr)
|
java.lang.Object |
lock()
Lock the whole terminal including all slots, pinpad, display and other resources. |
protected abstract void |
lockableOpenSlotChannel(int slot)
|
java.lang.Object |
lockSlot(int slotNr)
|
void |
unlock(java.lang.Object handle)
Unlock the whole terminal including all slots, pinpad, other resources. |
void |
unlockSlot(int slotNr,
java.lang.Object handle)
|
Methods inherited from class opencard.core.terminal.CardTerminal |
---|
addSlots, cardInserted, cardRemoved, close, closeSlotChannel, enumerateSlots, features, getAddress, getCardID, getCardID, getName, getSlot, getSlots, getType, internalCloseSlotChannel, internalFeatures, internalReset, internalReset, internalSendAPDU, isCardPresent, isCardPresent, isSlotChannelAvailable, isSlotChannelAvailable, open, openSlotChannel, openSlotChannel, openSlotChannel, reset, reset, reset, sendAPDU, sendAPDU, sendVerifiedCommandAPDU, slots, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractLockableTerminal(java.lang.String name, java.lang.String type, java.lang.String address)
name
- The user friendly name.type
- The terminal type.address
- An identifier for the driver to locate the terminal.Method Detail |
---|
protected java.lang.Object getTerminalLockHandle()
protected java.lang.Thread getSlotLockHandle(int slot)
public final java.lang.Object lock() throws CardTerminalException
A thread can call CardTerminal.lock() to lock a card terminal and all of its slots and CardTerminal.unlock() to return ownership of the lock. The lock() method can only be called successfully when the card terminal has no slot channels open and no other thread has locked a slot. The lock() call also prevents other threads from using the pin pad and display of the card terminal and from sending terminal commands.
Checking these conditions and maintaining the lock owner and list of locked slots is done in this abstract class. The actual locking is delegated to specific subclasses.
Important: whether the caller may send a terminal command MUST be checked in the subclass, since this abstract class cannot know whether the subclass implements the TerminalCommand interface.
lock
in interface Lockable
TerminalLockedException
- locking failed
CardTerminalException
public void unlock(java.lang.Object handle) throws CardTerminalException
unlock
in interface Lockable
TerminalLockedException
- unlocking failed
CardTerminalException
public java.lang.Object lockSlot(int slotNr) throws CardTerminalException
lockSlot
in interface Lockable
CardTerminalException
public void unlockSlot(int slotNr, java.lang.Object handle) throws CardTerminalException
unlockSlot
in interface Lockable
CardTerminalException
protected abstract void internalLock() throws CardTerminalException
CardTerminalException
protected abstract void internalUnlock() throws CardTerminalException
CardTerminalException
protected abstract void internalLockSlot(int slotNr) throws CardTerminalException
CardTerminalException
protected abstract void internalUnlockSlot(int slotNr) throws CardTerminalException
CardTerminalException
protected final void internalOpenSlotChannel(int slotID) throws CardTerminalException
CardTerminal
internalOpenSlotChannel
in class CardTerminal
slotID
- The number of the slot for which a SlotChannel is requested.
CardTerminalException
- thrown in case of errors opening the card (e.g. error powering card).protected final void internalOpenSlotChannel(int slotID, java.lang.Object lockHandle) throws CardTerminalException
CardTerminal
internalOpenSlotChannel
in class CardTerminal
slotID
- The number of the slot for which a SlotChannel is requested.lockHandle
- the trust ticket that the lock owner obtained when locking the terminal
or slot
CardTerminalException
- thrown in case of errors opening the card (e.g. error powering card).protected abstract void lockableOpenSlotChannel(int slot) throws CardTerminalException
CardTerminalException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |