de.dfki.lt.hog
Class Adaptor

java.lang.Object
  extended by de.dfki.lt.hog.Adaptor
All Implemented Interfaces:
XmlRpcServerInterface
Direct Known Subclasses:
SampleTaggerAdaptor

public abstract class Adaptor
extends java.lang.Object
implements XmlRpcServerInterface

Adaptor is an abstract class which provides methods for a remote module that functions as an XML-RPC server. It is instantied with a Properties object which is created through a config file. In this file a server port must be specified on which a subclass of Adaptor listens. The addHandler method registers a handler which processes incoming requests. Adpator is a default implementation of XmlRpcServerInterface.


Field Summary
static java.lang.String WEBSERVER_PORT_PROP
          Key for port of XML-RPC server in Properties.
 
Constructor Summary
Adaptor(java.util.Properties adaptorProps)
          Creates an Adaptor with a given configuration as Properties object.
 
Method Summary
 void addHandler(java.lang.String aHandlerName, java.lang.Object aHandler)
          Adds a handler object to the WebServer of this Adaptor.
 java.util.Properties getConfig()
          Returns configuration of this Adaptor
 java.lang.Object getHandler(java.lang.String aHandlerName)
          Returns a handler object from handlers hashtable.
 java.util.Hashtable getHandlers()
          Returns hashtable of handlers registeres so far
 org.apache.xmlrpc.WebServer getServer()
          Returns XML-RPC server of this Adaptor
 int getServerPort()
          Returns port on which the server is listening
 void shutdown()
          Shuts down an Adaptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEBSERVER_PORT_PROP

public static final java.lang.String WEBSERVER_PORT_PROP
Key for port of XML-RPC server in Properties.

See Also:
Constant Field Values
Constructor Detail

Adaptor

public Adaptor(java.util.Properties adaptorProps)
Creates an Adaptor with a given configuration as Properties object. Instantiates a WebServer listening on a port contained in configuration.

Parameters:
adaptorProps - Properties configurating this Adaptor
Method Detail

addHandler

public void addHandler(java.lang.String aHandlerName,
                       java.lang.Object aHandler)
Adds a handler object to the WebServer of this Adaptor. A specific method is called by aHandlerName.aMethodName where aMethodName is implemented by aHandler.

Specified by:
addHandler in interface XmlRpcServerInterface
Parameters:
aHandlerName - a String to which an handling object is mapped
aHandler - remote calls handling object

getHandler

public java.lang.Object getHandler(java.lang.String aHandlerName)
Returns a handler object from handlers hashtable.

Specified by:
getHandler in interface XmlRpcServerInterface
Parameters:
aHandlerName - name of handler in hashtable
Returns:
corresponding handler object

getConfig

public java.util.Properties getConfig()
Returns configuration of this Adaptor

Returns:
configuration of Adaptor as Properties object

getHandlers

public java.util.Hashtable getHandlers()
Returns hashtable of handlers registeres so far

Returns:
hashtable of handler objects

getServer

public org.apache.xmlrpc.WebServer getServer()
Returns XML-RPC server of this Adaptor

Specified by:
getServer in interface XmlRpcServerInterface
Returns:
server of this Adaptor

getServerPort

public int getServerPort()
Returns port on which the server is listening

Specified by:
getServerPort in interface XmlRpcServerInterface
Returns:
port of XML-RPC server

shutdown

public void shutdown()
Shuts down an Adaptor. Has to be overriden for shutting down special components of derived subclass.