de.dfki.lt.hog
Class MoCoManServer

java.lang.Object
  extended by de.dfki.lt.hog.MoCoManServer
All Implemented Interfaces:
XmlRpcServerInterface

public class MoCoManServer
extends java.lang.Object
implements XmlRpcServerInterface

This is a single threaded server running as an XML-RPC front-end to MoCoMan. Start the server by invoking main(String[] args). Sample usage (Python): 1. Start the server by running this class. 2. python: >>> import xmlrpclib >>> srv = xmlrpclib.Server("http://localhost:8411") >>> print srv.mocoman.getServerPort() 8411 >>>


Constructor Summary
MoCoManServer()
          Creates a new instance of MoCoManServer using the port number specified in the config.
MoCoManServer(int port)
          Creates a new instance of MoCoManServer using the port number given.
 
Method Summary
 void addHandler(java.lang.String aModuleName, java.lang.Object aHandler)
          Adds a handler object to a WebServer.
 java.lang.Object getHandler(java.lang.String aHandlerName)
          Retrieves a single handler object corresponding to a given handler name stored in the handlers hashtable.
 java.util.Hashtable getHandlers()
          Returns a Hashtable containing all registered handlers for XML-RPC calls.
 org.apache.xmlrpc.WebServer getServer()
          Returns the server for XML-RPC calls.
 int getServerPort()
          Returns the port on which the XML-RPC server is listening.
static void main(java.lang.String[] args)
           
 void shutdown()
          Shuts down MoCoMan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoCoManServer

public MoCoManServer()
              throws java.io.IOException
Creates a new instance of MoCoManServer using the port number specified in the config. file. Returns a running(!) server.

Throws:
java.io.IOException

MoCoManServer

public MoCoManServer(int port)
              throws java.io.IOException
Creates a new instance of MoCoManServer using the port number given.

Throws:
java.io.IOException
Method Detail

getServer

public org.apache.xmlrpc.WebServer getServer()
Returns the server for XML-RPC calls.

Specified by:
getServer in interface XmlRpcServerInterface
Returns:
an XML-RPC server

getServerPort

public int getServerPort()
Returns the port on which the XML-RPC server is listening.

Specified by:
getServerPort in interface XmlRpcServerInterface
Returns:
port of server

addHandler

public void addHandler(java.lang.String aModuleName,
                       java.lang.Object aHandler)
Description copied from interface: XmlRpcServerInterface
Adds a handler object to a WebServer. This object then processes incoming calls associated with the given handler name.

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

getHandlers

public java.util.Hashtable getHandlers()
Returns a Hashtable containing all registered handlers for XML-RPC calls.

Returns:
all handlers for XML-RPC calls

getHandler

public java.lang.Object getHandler(java.lang.String aHandlerName)
Retrieves a single handler object corresponding to a given handler name stored in the handlers hashtable.

Specified by:
getHandler in interface XmlRpcServerInterface
Parameters:
aHandlerName - a name of a handling class
Returns:
a single handler

shutdown

public void shutdown()
Shuts down MoCoMan. This includes closing the XML:DB annotation database, shutting down the XML-RPC server, clearing the query queue and all hashtable for session and handlers.


main

public static void main(java.lang.String[] args)