de.folt.rpc.client
Class OpenTMSClient

java.lang.Object
  extended by de.folt.rpc.client.OpenTMSClient

public class OpenTMSClient
extends java.lang.Object

Author:
klemens.waldhoer
A java client which allows to access the OpenTMS XML RPC Server

Constructor Summary
OpenTMSClient()
           
 
Method Summary
static java.util.Vector execute(java.util.Vector vector)
          Execute executes a defined method and returns a vector containing the execution results.
static org.apache.xmlrpc.XmlRpcClient init()
          init Method initialises the XmlRpcClient.
static void main(java.lang.String[] args)
          main executes an OpenTMS message.
static java.util.Vector testMessage()
          testMessage just sends a test message to the server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenTMSClient

public OpenTMSClient()
Method Detail

execute

public static java.util.Vector execute(java.util.Vector vector)
Execute executes a defined method and returns a vector containing the execution results. The method is called "TranslationTools.run" and currently hard coded.
The argument vector contains the parameters to be executed:

Example:
Vector vector = new Vector();
Hashtable message = new Hashtable();
message.put("testString", "OpenTMS Test Message");
message.put("message", "TestMessage");
vector.add(message);
Vector result = execute(vector);

Parameters:
vector - (argument) of type Vector contains the values for the execute method of the XmlRpcClient. For an example see testmessage.
Returns:
The result is of type Vector and contains the results from calling the messages defined in the vector argument.

init

public static org.apache.xmlrpc.XmlRpcClient init()
init Method initialises the XmlRpcClient. It reads the connection string from the OpenTMSProperties property file rpc.server.connectstring. The port is defined in the property rpc.server.port. Default connection string is "http://localhost:4050". The final connection string is built from "rpc.server.connectstring" and "rpc.server.port"

Returns:
an XmlRpcClient

main

public static void main(java.lang.String[] args)
main executes an OpenTMS message.
Here is an example call:
call java -Xmx1024m -cp .;lib/OpenTMS.jar;lib/arayaserver.jar;lib/external.jar -Djava.library.path=lib\Win32 de.folt.rpc.client.OpenTMSClient "message=TestMessage" "testString=My personal OpenTMS Test Message"

TestMessage represents a OpenTMS rpc message (de.folt.rpc.messages.TestMessage is executed)

Parameters:
args - a list of strings; structured as above.

testMessage

public static java.util.Vector testMessage()
testMessage just sends a test message to the server.

Returns:
is a vector with element 0: success de.folt.constants.OpenTMSConstants.OpenTMS_ID_SUCCESS or de.folt.constants.OpenTMSConstants.OpenTMS_ID_FAILURE i case of a failure.