Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## opencard.core.terminal
Class CardTerminalRegistry

    java.lang.Object
      |
      +--opencard.core.terminal.CardTerminalRegistry

public final class CardTerminalRegistry
extends java.lang.Object

The `CardTerminalRegistry` keeps track of the installed `CardTerminal`s registered within a system. You can get an enumeration of the registered `CardTerminal`s via `CardTerminalRegistry.getCardTerminals()`.

NOTE that there may be a difference between the terminals physically attached to your computer and those registered in the registry.

Using the `add()/remove ()` methods you can dynamically add to and remove card terminals from the registry. Usually however this will be done automatically by `SmartCard.start ()` based on the information provided by the Opencard properties.

See Also:
  `CardTerminal`, `CardTerminalFactory`, `CardID`

Field Summary
`protected java.util.Hashtable` | `ctListeners` table with all registered CTListener-objects

Method Summary
`void` | `add(CardTerminal terminal)` Adds a `CardTerminal` instance to the registry.
`void` | `addCTListener(CTListener listener)` Deprecated. use EventGenerator.addCTListener
`void` | `addPollable(Pollable p)` Adds a `Pollable` card terminal to the observer's list of pollable terminals.
`protected void` | `cardInserted(CardTerminal terminal, int slotID)` Notify listeners that a card was inserted into a slot of a terminal.
`protected void` | `cardRemoved(CardTerminal terminal, int slotID)` Notify listeners that a card was removed from a slot of this terminal. (utility method).
`CardTerminal` | `cardTerminalForName(java.lang.String name)` Iterates over the registered terminals and searches for one with the given name.
`int` | `countCardTerminals()` Gets the number of registered `CardTerminals`.
`void` | `createEventsForPresentCards(CTListener ctListener)` Deprecated. use EvenGenerator.createEventsForPresentCards
`java.util.Enumeration` | `getCardTerminals()` Gets all registered `CardTerminal` instances.
`int` | `getPollInterval()` Deprecated.
`static CardTerminalRegistry` | `getRegistry()` Gets the system wide `CardTerminalRegistry`.
`boolean` | `remove(CardTerminal terminal)` Closes the card terminal and removes it from the registry.
`boolean` | `remove(java.lang.String name)` Remove the card terminal named `name`.
`void` | `removeCTListener(CTListener listener)` Deprecated. use EventGenerator.removeCTListener() instead
`boolean` | `removePollable(Pollable p)` Removes a `Pollable` card terminal from the observer's list of terminals to be polled.
`void` | `setObserver(Observer o)` The Observer is the bridge to the opencard.core.event package which creates events for card insertion/card removal
`void` | `setPollInterval(int duration)` Deprecated.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ctListeners

    protected java.util.Hashtable ctListeners

  table with all registered CTListener-objects

Method Detail

### setObserver

    public void setObserver(Observer o)

  The Observer is the bridge to the opencard.core.event package which creates events for card insertion/card removal

### getRegistry

    public static CardTerminalRegistry getRegistry()

  Gets the system wide `CardTerminalRegistry`. This conforms to the Singleton pattern.
  Returns:
    the one system-wide card terminal registry.

### add

    public void add(CardTerminal terminal)
             throws CardTerminalException

  Adds a `CardTerminal` instance to the registry. Should be called by the CardTerminalFactory when creating a card terminal.
  Parameters:
    `terminal` - The `CardTerminal` to add.
  Throws:
    thrown - in case of errors in the CardTerminal.open() method.

### addPollable

    public void addPollable(Pollable p)

  Adds a `Pollable` card terminal to the observer's list of pollable terminals. Should be called by pollable terminals in their open() method.
  Parameters:
    `p` - The `Pollable` terminal to add.

### cardTerminalForName

    public CardTerminal cardTerminalForName(java.lang.String name)

  Iterates over the registered terminals and searches for one with the given name.
  Parameters:
    `name` - The name of the card terminal to search for.
  Returns:
    A `CardTerminal` instance with `name` or `null` if none could be found.

### countCardTerminals

    public int countCardTerminals()

  Gets the number of registered `CardTerminals`.
  Returns:
    the number of terminals registered in the registry

### getCardTerminals

    public java.util.Enumeration getCardTerminals()

  Gets all registered `CardTerminal` instances.
  Returns:
    An `Enumeration` of the currently registered `CardTerminal`s.

### remove

    public boolean remove(java.lang.String name)
                   throws CardTerminalException

  Remove the card terminal named `name`.

  Parameters:
    `name` - The name of the card terminal to unregister.
  Returns:
    True if the terminal was unregistered successfully.
  Throws:
    CardTerminalException - thrown if error occurred

### remove

    public boolean remove(CardTerminal terminal)
                   throws CardTerminalException

  Closes the card terminal and removes it from the registry.
  Parameters:
    `terminal` - The reference to the `CardTerminal` object to unregister.
  Returns:
    `true` if the terminal was removed from the registry successfully, `false` otherwise
  Throws:
    CardTerminalException - thrown when error occurred in terminal.close().
  See Also:
    `CardTerminal.close()`

### removePollable

    public boolean removePollable(Pollable p)

  Removes a `Pollable` card terminal from the observer's list of terminals to be polled.
  Parameters:
    `p` - The `Pollable` to be removed.

### cardInserted

    protected void cardInserted(CardTerminal terminal,
                                int slotID)

  Notify listeners that a card was inserted into a slot of a terminal.
  Parameters:
    `terminal` - terminal where a card was inserted
    `slot` - slot where a card was inserted

### cardRemoved

    protected void cardRemoved(CardTerminal terminal,
                               int slotID)

  Notify listeners that a card was removed from a slot of this terminal. (utility method).
  Parameters:
    `slot` - slot number of the slot where a card was removed

### setPollInterval

    public void setPollInterval(int duration)

  Deprecated.

### addCTListener

    public void addCTListener(CTListener listener)

  Deprecated. use EventGenerator.addCTListener

### createEventsForPresentCards

    public void createEventsForPresentCards(CTListener ctListener)
                                     throws CardTerminalException

  Deprecated. use EvenGenerator.createEventsForPresentCards

### getPollInterval

    public int getPollInterval()

  Deprecated.

### removeCTListener

    public void removeCTListener(CTListener listener)

  Deprecated. use EventGenerator.removeCTListener() instead

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD