org.optimizationservices.oscommon.representationparser
Class OSpLReader

java.lang.Object
  extended by org.optimizationservices.oscommon.representationparser.OSgLReader
      extended by org.optimizationservices.oscommon.representationparser.OSpLReader

public class OSpLReader
extends OSgLReader

The OSpLReader class parses an OSpL instance into a DOM tree and provides a set of "get" methods that can be used to retrieve different pieces of information of the instance.

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

Field Summary
 
Fields inherited from class org.optimizationservices.oscommon.representationparser.OSgLReader
m_document
 
Constructor Summary
OSpLReader()
          Default constructor.
OSpLReader(boolean validate)
          constructor.
 
Method Summary
 double getAvailableDiskSpace()
          Get the available disk space (in bytes).
 double getAvailableMemory()
          Get the available memory (in bytes).
 int getCurrentJobCount()
          Get the current job count.
 java.lang.String getCurrentState()
          Get the current state, , which can be: "busy", "busyButAccepting", "idle", "idleButNotAccepting" and "noResponse".
 JobStatistics[] getJobStatistics()
          Get the statistics of all the jobs.
 JobOptimization[] getOptimizationProcess()
          Get the optimization process of all the jobs, which are in effect intermediate (or occasionally final) optimization results.
 OSProcess getOSProcess()
          get the standard OSProcess, a local interface for storing Optimization Services process.
 java.lang.String getOtherProcessDescriptionByName(java.lang.String name)
          Get the String value from the other process hash map.
 java.lang.String[] getOtherProcessDescriptions()
          Get the descriptions of all other processes.
 java.util.HashMap<java.lang.String,java.lang.String> getOtherProcesses()
          Get the hash map of other processes.
 java.lang.String[] getOtherProcessNames()
          Get the names of all other processes.
 int getOtherProcessNumber()
          Get the number of other processes.
 java.lang.String getOtherProcessValueByName(java.lang.String name)
          Get the String value from the other process hash map.
 java.lang.String[] getOtherProcessValues()
          Get the values of all other processes.
 java.lang.String getProcessMessage()
          Get the process message.
 ProcessStatistics getProcessStatistics()
          Get the process statistics.
 java.util.GregorianCalendar getProcessTime()
          Get time of the last process update.
 java.lang.String getRequestAction()
          Get the request action, which can be: ping, notifyJobCompletion, requestJob, getServiceStatistics, setServiceStatistics, getJobStatistics, setJobStatistics, getOptimization, setOptimization, getAll, setAll.
 java.lang.String getRequestDescription()
          Get the request description.
 java.lang.String getResponseDescription()
          Get the response description.
 java.lang.String getResponseStatus()
          Get the response status, which can be: success, error, warning.
 java.lang.String getServiceName()
          Get service name.
 java.lang.String getServiceURI()
          Get service uri.
 double getServiceUtilization()
          Get the service utilization ([0, 1]).
 java.util.GregorianCalendar getTimeLastJobEnded()
          Get the time last job ended.
 double getTimeLastJobTook()
          Get the time last job took (in seconds).
 java.util.GregorianCalendar getTimeServiceStarted()
          Get the time the service started.
 int getTotalJobsSoFar()
          Get the total jobs received so far.
static void main(java.lang.String[] argv)
          main for test purposes.
 
Methods inherited from class org.optimizationservices.oscommon.representationparser.OSgLReader
getDocument, getRootElement, isValidate, readFile, readString, setDocument, setRootElement, setValidate, writeToFile, writeToSring, writeToStandardOutput
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSpLReader

public OSpLReader(boolean validate)
constructor.

Parameters:
validate - holds whether the reader should be validating against the schema or not.

OSpLReader

public OSpLReader()
Default constructor.

Method Detail

getOSProcess

public OSProcess getOSProcess()
                       throws java.lang.Exception
get the standard OSProcess, a local interface for storing Optimization Services process.

Returns:
the OSProcess.
Throws:
java.lang.Exception - if there are errors getting the OSOption.

getRequestAction

public java.lang.String getRequestAction()
Get the request action, which can be: ping, notifyJobCompletion, requestJob, getServiceStatistics, setServiceStatistics, getJobStatistics, setJobStatistics, getOptimization, setOptimization, getAll, setAll.

Returns:
the request action, null or empty string if none.

getRequestDescription

public java.lang.String getRequestDescription()
Get the request description.

Returns:
the request description, null or empty string if none.

getResponseStatus

public java.lang.String getResponseStatus()
Get the response status, which can be: success, error, warning.

Returns:
the response status, null or empty string if none.

getResponseDescription

public java.lang.String getResponseDescription()
Get the response description.

Returns:
the response description, null or empty string if none.

getServiceURI

public java.lang.String getServiceURI()
Get service uri.

Returns:
the service uri.

getServiceName

public java.lang.String getServiceName()
Get service name.

Returns:
the service name.

getProcessTime

public java.util.GregorianCalendar getProcessTime()
Get time of the last process update.

Returns:
the time of the last process update.

getProcessMessage

public java.lang.String getProcessMessage()
Get the process message.

Returns:
the process message.

getProcessStatistics

public ProcessStatistics getProcessStatistics()
Get the process statistics.

Returns:
the process statistics.

getCurrentState

public java.lang.String getCurrentState()
Get the current state, , which can be: "busy", "busyButAccepting", "idle", "idleButNotAccepting" and "noResponse".

Returns:
the current status, "noResponse" if none.

getAvailableDiskSpace

public double getAvailableDiskSpace()
Get the available disk space (in bytes).

Returns:
the available disk space, Double.NaN if none.

getAvailableMemory

public double getAvailableMemory()
Get the available memory (in bytes).

Returns:
the available memory, Double.NaN if none.

getCurrentJobCount

public int getCurrentJobCount()
Get the current job count.

Returns:
the current job count, -1 if none.

getTotalJobsSoFar

public int getTotalJobsSoFar()
Get the total jobs received so far.

Returns:
the total jobs received so far, -1 if none.

getTimeLastJobEnded

public java.util.GregorianCalendar getTimeLastJobEnded()
Get the time last job ended.

Returns:
the time last job ended. If none, it returns unix creation time: GregorianCalendar(1970, 0, 1, 0, 0, 0).

getTimeLastJobTook

public double getTimeLastJobTook()
Get the time last job took (in seconds).

Returns:
the the time last job took, Double.NaN if none.

getTimeServiceStarted

public java.util.GregorianCalendar getTimeServiceStarted()
Get the time the service started.

Returns:
the time last job ended. If none, it returns unix creation time: GregorianCalendar(1970, 0, 1, 0, 0, 0).

getServiceUtilization

public double getServiceUtilization()
Get the service utilization ([0, 1]).

Returns:
the the time last job took, Double.NaN if none.

getJobStatistics

public JobStatistics[] getJobStatistics()
Get the statistics of all the jobs.

Returns:
the statistics of all the jobs, which is an array of jobStatistics with each member corresponding to one job; null if none.

getOptimizationProcess

public JobOptimization[] getOptimizationProcess()
Get the optimization process of all the jobs, which are in effect intermediate (or occasionally final) optimization results. The results follow the standard OSrL (Optimization Services result Language).

Returns:
the optimization process, null if none. It is an array, with each member corresponding to an optimization job. Each optimization job contains a job id string and an optimization result, which data structure follow the OSrL schema.

getOtherProcesses

public java.util.HashMap<java.lang.String,java.lang.String> getOtherProcesses()
Get the hash map of other processes.

Returns:
the hash map of other processes.

getOtherProcessNumber

public int getOtherProcessNumber()
Get the number of other processes.

Returns:
the number of other processes.

getOtherProcessValueByName

public java.lang.String getOtherProcessValueByName(java.lang.String name)
Get the String value from the other process hash map.

Parameters:
name - holds the name of process to get.
Returns:
String value from the other process hash map, null if none.

getOtherProcessDescriptionByName

public java.lang.String getOtherProcessDescriptionByName(java.lang.String name)
Get the String value from the other process hash map.

Parameters:
name - holds the name of process to get.
Returns:
String value from the other process hash map, null if none.

getOtherProcessNames

public java.lang.String[] getOtherProcessNames()
Get the names of all other processes.

Returns:
the names of all other processes.

getOtherProcessValues

public java.lang.String[] getOtherProcessValues()
Get the values of all other processes.

Returns:
the values of all other processes.

getOtherProcessDescriptions

public java.lang.String[] getOtherProcessDescriptions()
Get the descriptions of all other processes.

Returns:
the descriptions of all other processes.

main

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

Parameters:
argv - command line arguments.