de.dfki.lt.hog
Class XmlRpcModule

java.lang.Object
  extended by de.dfki.lt.hog.Module
      extended by de.dfki.lt.hog.XmlRpcModule
All Implemented Interfaces:
XmlRpcClientInterface
Direct Known Subclasses:
SampleRemoteTagger

public abstract class XmlRpcModule
extends Module
implements XmlRpcClientInterface

Encapsulates all methods needed to communicate via XML-RPC with a remote module. This module is called a Handler in the XML-RPC API used, so, this convention is applied here. A handler must have a method which actually processes a request and a server for communication.


Field Summary
static java.lang.String XMLRPC_HANDLER_METHOD
          Key for a method name of a handler.
static java.lang.String XMLRPC_HANDLER_NAME
          Key for an object which handles an XmlRpc request
static java.lang.String XMLRPC_SERVER_URL
          Key for XML-RPC server URL in configuration file.
protected static org.apache.log4j.Logger xmlRpcModuleLog
          A logger for XmlRpcModules
 
Fields inherited from class de.dfki.lt.hog.Module
CONFIG_SEARCH_PATH_PROP, LINE_SEPARATOR, MODULE_DEPTH_PROP, MODULE_LANGUAGE_PROP, MODULE_NAME_PROP, MODULE_ROOTELEMENT_PROP, moduleLog, NO, NONE, ROOT, YES
 
Constructor Summary
XmlRpcModule()
           
 
Method Summary
protected  org.apache.xmlrpc.XmlRpcClient getXmlRpcClient()
          Returns the XmlRpcClient of this XmlRpcModule.
 java.lang.String getXmlRpcHandlerMethod()
          Returns method name to which an XmlRpc request is past by a handler.
 java.lang.String getXmlRpcHandlerName()
          Returns name of a class which can handle an XmlRpc request.
 java.lang.String getXmlRpcServerUrl()
          Returns the URL of an XmlRpc server this XmlRpcModule communicates with.
protected  void init(java.util.Properties xmlRpcModuleConfig)
          Initializes basic field values like name, server URL and XMLRPC client, by a Properties object.
abstract  java.lang.String process(java.lang.String processString)
           
 java.lang.String process(java.lang.String aHandlerCall, java.util.Vector params)
          Sends parameters to a remote module by an XmlRpcClient.
abstract  org.w3c.dom.Node processDOMTree(org.w3c.dom.Node domTree)
           
protected  void setXmlRpcClient(org.apache.xmlrpc.XmlRpcClient aClient)
          Sets the client for this XmlRpcModule
protected  void setXmlRpcHandlerMethod(java.lang.String aHandlerMethod)
          Sets a method name to which an XmlRpc request is past by a handler
protected  void setXmlRpcHandlerName(java.lang.String aHandlerName)
          Sets name name of a class which can handle an XmlRpc request.
protected  void setXmlRpcServerUrl(java.lang.String aServerUrl)
          Sets the URL of an XmlRpc server this XmlRpcModule communicates with.
 void shutdown(java.lang.String aModuleName)
          Shutsdown a remote module.
 void start(java.lang.String aModuleName)
          Starts a remote adaptor to communicate with.
 
Methods inherited from class de.dfki.lt.hog.Module
getAbsolutOrRelativePath, getConfig, getFileProperty, getMoCoMan, getModuleDepth, getModuleLanguage, getModuleName, getModuleRootElement, getProperty, getProperty, searchConfigFile, searchConfigFile, setConfig, setMoCoMan, setModuleDepth, setModuleLanguage, setModuleName, setModuleRootElement, setProperty, shutdown, suitable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLRPC_SERVER_URL

public static final java.lang.String XMLRPC_SERVER_URL
Key for XML-RPC server URL in configuration file.

See Also:
Constant Field Values

XMLRPC_HANDLER_NAME

public static final java.lang.String XMLRPC_HANDLER_NAME
Key for an object which handles an XmlRpc request

See Also:
Constant Field Values

XMLRPC_HANDLER_METHOD

public static final java.lang.String XMLRPC_HANDLER_METHOD
Key for a method name of a handler.

See Also:
Constant Field Values

xmlRpcModuleLog

protected static org.apache.log4j.Logger xmlRpcModuleLog
A logger for XmlRpcModules

Constructor Detail

XmlRpcModule

public XmlRpcModule()
Method Detail

getXmlRpcClient

protected org.apache.xmlrpc.XmlRpcClient getXmlRpcClient()
Returns the XmlRpcClient of this XmlRpcModule.

Returns:
an XmlRpc client

setXmlRpcClient

protected void setXmlRpcClient(org.apache.xmlrpc.XmlRpcClient aClient)
Sets the client for this XmlRpcModule

Parameters:
aClient - XmlRpcClient for this module

getXmlRpcServerUrl

public java.lang.String getXmlRpcServerUrl()
Returns the URL of an XmlRpc server this XmlRpcModule communicates with.

Returns:
an URL as String

setXmlRpcServerUrl

protected void setXmlRpcServerUrl(java.lang.String aServerUrl)
Sets the URL of an XmlRpc server this XmlRpcModule communicates with.

Parameters:
aServerUrl - an URL as String

getXmlRpcHandlerName

public java.lang.String getXmlRpcHandlerName()
Returns name of a class which can handle an XmlRpc request.

Returns:
class name of handler

setXmlRpcHandlerName

protected void setXmlRpcHandlerName(java.lang.String aHandlerName)
Sets name name of a class which can handle an XmlRpc request.

Parameters:
aHandlerName - class name

getXmlRpcHandlerMethod

public java.lang.String getXmlRpcHandlerMethod()
Returns method name to which an XmlRpc request is past by a handler.

Returns:
method name for XmlRpc request

setXmlRpcHandlerMethod

protected void setXmlRpcHandlerMethod(java.lang.String aHandlerMethod)
Sets a method name to which an XmlRpc request is past by a handler

Parameters:
aHandlerMethod - method name for a handler

init

protected void init(java.util.Properties xmlRpcModuleConfig)
             throws InitializationException
Initializes basic field values like name, server URL and XMLRPC client, by a Properties object. First, init() of Module is called; then all other field values are set by their corresponding set methods.

Overrides:
init in class Module
Parameters:
xmlRpcModuleConfig -
Throws:
InitializationException
See Also:
Module.init(java.util.Properties)

start

public void start(java.lang.String aModuleName)
Description copied from interface: XmlRpcClientInterface
Starts a remote adaptor to communicate with. This method must be implemented by each class derived from XmlRpcModule and could start an adaptor via a shell or Python script, for example.

Specified by:
start in interface XmlRpcClientInterface
Parameters:
aModuleName - name of the module to start

process

public java.lang.String process(java.lang.String aHandlerCall,
                                java.util.Vector params)
Description copied from interface: XmlRpcClientInterface
Sends parameters to a remote module by an XmlRpcClient. Calls therefore the execute method of XmlRpcClient.

Specified by:
process in interface XmlRpcClientInterface
Parameters:
aHandlerCall - name of a method which process params remotely
params - paramters for remote method

shutdown

public void shutdown(java.lang.String aModuleName)
Description copied from interface: XmlRpcClientInterface
Shutsdown a remote module.

Specified by:
shutdown in interface XmlRpcClientInterface
Parameters:
aModuleName - name of the module to shut down

process

public abstract java.lang.String process(java.lang.String processString)
Specified by:
process in class Module

processDOMTree

public abstract org.w3c.dom.Node processDOMTree(org.w3c.dom.Node domTree)
Specified by:
processDOMTree in class Module