moj.lang.statserv
Class StatServConnection

java.lang.Object
  extended by moj.lang.statserv.StatServConnection

public class StatServConnection
extends java.lang.Object

StatServConnection handles all communication with a StatServ server.

Version:
2006-Dec-13
Author:
Martin Hassel

Field Summary
 java.net.URL statservURL
          URL to current StatServ servlet
 
Constructor Summary
StatServConnection()
          Create a new StatServConnection to the StatServ server given in the file StatServ.properties.
 
Method Summary
 boolean addModule(StatServRequest module)
          Adds a StatServRequest module to the connection.
static void main(java.lang.String[] args)
           
 boolean removeModule(StatServRequest module)
          Removes a StatServRequest module from the connection.
 void removeModules()
          Removes all StatServRequest modules from the connection.
 java.lang.String requestXML(java.lang.String title, java.lang.String text)
          Returns the XML that constitutes a StatServConnection request.
 boolean StatServConnect(java.lang.String title, java.lang.String text)
          Sends the text and title to a StatServ servlet and lets each previously addedStatServRequest module request and parse its own statistics, which is then made available through each StatServRequest module respectively.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statservURL

public final java.net.URL statservURL
URL to current StatServ servlet

Constructor Detail

StatServConnection

public StatServConnection()
                   throws java.net.MalformedURLException
Create a new StatServConnection to the StatServ server given in the file StatServ.properties.

Throws:
java.net.MalformedURLException
Method Detail

addModule

public boolean addModule(StatServRequest module)
Adds a StatServRequest module to the connection.

Parameters:
module - StatServRequest module to add
Returns:
true on success, else false

removeModule

public boolean removeModule(StatServRequest module)
Removes a StatServRequest module from the connection.

Parameters:
module - StatServRequest module to remove
Returns:
true on success, else false

removeModules

public void removeModules()
Removes all StatServRequest modules from the connection.


requestXML

public java.lang.String requestXML(java.lang.String title,
                                   java.lang.String text)
Returns the XML that constitutes a StatServConnection request.

Parameters:
title - the title of the document statistics is requested for
text - the text statistics is requested for
Returns:
XML representing a StatServConnection request

StatServConnect

public boolean StatServConnect(java.lang.String title,
                               java.lang.String text)
Sends the text and title to a StatServ servlet and lets each previously addedStatServRequest module request and parse its own statistics, which is then made available through each StatServRequest module respectively.

Parameters:
title - the title of the document statistics is requested for
text - the text statistics is requested for
Returns:
true on success, else false

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception