org.optimizationservices.oscommon.util
Class OSServiceUtil

java.lang.Object
  extended by org.optimizationservices.oscommon.util.OSServiceUtil

public class OSServiceUtil
extends java.lang.Object

The OSServiceUtil class provides a default implementation for the optimization services.

Since:
OS 1.0
Version:
1.0, 03/14/2004
Author:
Robert Fourer, Jun Ma, Kipp Martin

Field Summary
 java.lang.String m_sServiceNameInOSoL
          m_sServiceNameInOSoL holds the service name in osol.
 java.lang.String m_sServiceURIInOSoL
          m_sServiceURIInOSoL holds the service uri in osol.
static java.util.Hashtable<java.lang.String,java.util.Vector<java.lang.Process>> processsHashTable
          m_processsHashTable holds a hashtable of all the process launched by this service.
 DefaultRegistry registry
          m_regis holds the os registry
 java.lang.String serviceName
          serviceName holds the service name.
 java.lang.String serviceType
          serviceType holds the service type.
 java.lang.String serviceURI
          serviceURI holds the service uri.
 DefaultSimulation simulation
          simulation holds the simulation engine
 DefaultSolver solver
          solver holds the solver engine
 
Constructor Summary
OSServiceUtil()
          Default constructor.
 
Method Summary
 java.lang.String call(java.lang.String osslInput, java.lang.String osol)
          Call a simulation service whose input is given by a string following the Optimization Services simulation Language (OSsL) schema and returns the result in a string that follows the Optimization Services simulation Language (OSsL) schema, since OSsL specifies both simulation service input and output.
 java.lang.String find(java.lang.String osql, java.lang.String osol)
          Discover an Optimization Service whose instance is given by a string following the Optimization Services query Language (OSqL) schema and returns the location information in a string that follows the Optimization Services URI, or Universal Resource Indentifier Language, (OSuL) schema.
 java.lang.String getJobID(java.lang.String osol)
          Get a unique job id from a service, before calling the service to solve a problem.
 java.lang.String kill(java.lang.String osol)
          Kill a previously sent/solved optimization job.
 java.lang.String knock(java.lang.String osplInput, java.lang.String osol)
          Set (push) and/or get (pull) runtime dynamic process information to and/or from the service.
static void main(java.lang.String[] args)
          main for test purposes.
 boolean readOSoL(java.lang.String osol)
          read and parse the osol string.
 java.lang.String register(java.lang.String osel, java.lang.String osol)
          register an Optimization Service whose instance is given by a string following the Optimization Services entity Language (OSeL) schema and returns a string that contains an XSLT style sheet transformation so that it can be used for standard web pubblication of the Optimization Service that just joined.
 java.lang.String retrieve(java.lang.String osol)
          Retrieve results from a previously sent/solved optimization job.
 boolean send(java.lang.String osil, java.lang.String osol)
          Send (or asynchronously solve) an instance to a solver, analyzer or scheduler service whose input is given by a string following the OSiL schema and returns the result in a string that follows OSrL schema.
 java.lang.String solve(java.lang.String osil, java.lang.String osol)
          Call a solver or analyzer service whose input is given by a string following the OSiL schema and returns the result in a string that follows OSrL schema.
 java.lang.String validate(java.lang.String osxl, java.lang.String osol)
          Validate an osxl string according to the corresponding OSxL schema.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceURI

public java.lang.String serviceURI
serviceURI holds the service uri.


serviceName

public java.lang.String serviceName
serviceName holds the service name.


serviceType

public java.lang.String serviceType
serviceType holds the service type.


m_sServiceURIInOSoL

public java.lang.String m_sServiceURIInOSoL
m_sServiceURIInOSoL holds the service uri in osol.


m_sServiceNameInOSoL

public java.lang.String m_sServiceNameInOSoL
m_sServiceNameInOSoL holds the service name in osol.


solver

public DefaultSolver solver
solver holds the solver engine


simulation

public DefaultSimulation simulation
simulation holds the simulation engine


registry

public DefaultRegistry registry
m_regis holds the os registry


processsHashTable

public static java.util.Hashtable<java.lang.String,java.util.Vector<java.lang.Process>> processsHashTable
m_processsHashTable holds a hashtable of all the process launched by this service. The hashtable names are the thread names (same as the jobIDs) and the hashtable objects are the a vector of processes launched by the thread.

Constructor Detail

OSServiceUtil

public OSServiceUtil()
Default constructor.

Method Detail

getJobID

public java.lang.String getJobID(java.lang.String osol)
Get a unique job id from a service, before calling the service to solve a problem. This method call is always required before an asynchronous send call. It may be or may not be used before a synchronous solve call.

Parameters:
osol - holds the option in a string which format follows OSoL schema.
Returns:
jobID, a unique job ID generated by the service.

readOSoL

public boolean readOSoL(java.lang.String osol)
read and parse the osol string.

Parameters:
osol - holds the option string to read.
Returns:
whether the osol string is read successfully.

solve

public java.lang.String solve(java.lang.String osil,
                              java.lang.String osol)
Call a solver or analyzer service whose input is given by a string following the OSiL schema and returns the result in a string that follows OSrL schema.

Parameters:
osil - holds the instance in a string which format follows OSiL schema.
osol - holds the option in a string which format follows OSoL schema.
Returns:
osrl, the result in a string which format follows the OSrL schema.

send

public boolean send(java.lang.String osil,
                    java.lang.String osol)
Send (or asynchronously solve) an instance to a solver, analyzer or scheduler service whose input is given by a string following the OSiL schema and returns the result in a string that follows OSrL schema.

Parameters:
osil - holds the instance in a string which format follows OSiL schema.
osol - holds the option in a string which format follows OSoL schema. It should contain the jobID information that is previous obtained from the service.
Returns:
success, whether the asynchronous communication is successful or not

retrieve

public java.lang.String retrieve(java.lang.String osol)
Retrieve results from a previously sent/solved optimization job.

Parameters:
osol - holds the option in a string which format follows OSoL schema It should contain the jobID information that is previous obtained from the service.
Returns:
osrl, the result in a string which format follows the OSrL schema. If the result cannot be retrieved, it should be indicated in the message/status section of OSrL.

kill

public java.lang.String kill(java.lang.String osol)
Kill a previously sent/solved optimization job.

Parameters:
osol - holds the option in a string which format follows OSoL schema It should contain the jobID information that is previous obtained from the service.
Returns:
ospl, the kill process status of the kill operation.

knock

public java.lang.String knock(java.lang.String osplInput,
                              java.lang.String osol)
Set (push) and/or get (pull) runtime dynamic process information to and/or from the service.

Parameters:
osplInput - holds the input process information in a string which format follows OSpL schema.
osol - holds the option in a string which format follows OSoL schema
Returns:
osplOutput, the output process information in a string which format follows the OSpL schema.

find

public java.lang.String find(java.lang.String osql,
                             java.lang.String osol)
Discover an Optimization Service whose instance is given by a string following the Optimization Services query Language (OSqL) schema and returns the location information in a string that follows the Optimization Services URI, or Universal Resource Indentifier Language, (OSuL) schema.

Parameters:
OSqL - holds the Optimization Service query in a string which format follows the Optimization Services query Language (OSqL) schema.
osol - holds the optimization option in a string which format follows the Optimization Services option Language (OSoL) schema.
Returns:
the location information in a string that follows the Optimization Services URI, or Universal Resource Indentifier Language, (OSuL) schema.

register

public java.lang.String register(java.lang.String osel,
                                 java.lang.String osol)
register an Optimization Service whose instance is given by a string following the Optimization Services entity Language (OSeL) schema and returns a string that contains an XSLT style sheet transformation so that it can be used for standard web pubblication of the Optimization Service that just joined. The XSLT is espcially used to publish the OSeL.

Parameters:
osel - holds the Optimization Service entity description in a string which format follows the Optimization Services entity Language (OSeL) schema.
osol - holds the optimization option in a string which format follows the Optimization Services option Language (OSoL) schema.
Returns:
the register process output information in a string which format follows the OSpL schema.

validate

public java.lang.String validate(java.lang.String osxl,
                                 java.lang.String osol)
Validate an osxl string according to the corresponding OSxL schema.

Parameters:
osxl - holds the xml string to be validated.
osol - holds the optimization option in a string which format follows the Optimization Services option Language (OSoL) schema.
Returns:
the validate process output information in a string which format follows the OSpL schema.

call

public java.lang.String call(java.lang.String osslInput,
                             java.lang.String osol)
Call a simulation service whose input is given by a string following the Optimization Services simulation Language (OSsL) schema and returns the result in a string that follows the Optimization Services simulation Language (OSsL) schema, since OSsL specifies both simulation service input and output.

Parameters:
osslInput - holds the simulation input in a string which format follows the Optimization Services simulation Language (OSsL) schema.
osol - holds the optimization option in a string which format follows the Optimization Services option Language (OSoL) schema.
Returns:
osslOutput, the simulation output in a string which format follows the Optimization Services simulation Language (OSsL) schema.

main

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

Parameters:
argv - command line arguments.