OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.handler
Class Handler

java.lang.Object
  |
  +--com.ibm.opencard.handler.Handler

public class Handler
extends java.lang.Object

The base class for the handlers used for executing scripts. Each handler to be used in a HandlerChain has to be derived from this class.

Version:
$Id: Handler.java,v 1.1 1999/12/02 16:06:03 damke Exp $
See Also:
HandlerChain

Field Summary
protected  java.lang.String handler_id
          The identifier of this handler
 
Constructor Summary
protected Handler()
          Default constructor.
  Handler(java.lang.String id)
          Deprecated. use default constructor, followed by initialize(String)
 
Method Summary
 java.lang.String getID()
          Returns the identifier of this handler.
 boolean handle(Request request)
          Handles a request.
 void initialize(java.lang.String id, ServiceProvider sp)
          Initializes this handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler_id

protected java.lang.String handler_id
The identifier of this handler
Constructor Detail

Handler

public Handler(java.lang.String id)
Deprecated. use default constructor, followed by initialize(String)
This constructor creates an object with the given ID.
See Also:
initialize(java.lang.String, com.ibm.opencard.handler.ServiceProvider)

Handler

protected Handler()
Default constructor. Before this handler can actually be used, initialize has to be invoked.
Method Detail

initialize

public void initialize(java.lang.String id,
                       ServiceProvider sp)
                throws CardServiceException
Initializes this handler. This method is meant to be overridden in derived handlers that have to perform extended initialization. The implementation in this class has to be invoked anyway.
Parameters:
id - the identifier of this handler
sp - where to obtain MFC card services from, if required
Throws:
CardServiceException - if the initialization failed

getID

public final java.lang.String getID()
Returns the identifier of this handler.
Returns:
a string indentifying this handler

handle

public boolean handle(Request request)
               throws CardServiceException,
                      CardTerminalException
Handles a request. This method is meant to be overridden by derived handlers that actually handle requests. The default implementation here is to return false, indicating that the request was not recognized and therefore not handled.
Parameters:
request - the request to handle
Returns:
true if the request has been recognized, false otherwise
Throws:
CardServiceException - if the request was recognized, but the handler or a service used by the handler encountered an error when handling it
CardTerminalException - if the request was recognized, but the underlying terminal encountered an error when communicating with the smartcard