org.optimizationservices.oscommon.representationparser
Class OSpLWriter

java.lang.Object
  extended by org.optimizationservices.oscommon.representationparser.OSgLWriter
      extended by org.optimizationservices.oscommon.representationparser.OSpLWriter

public class OSpLWriter
extends OSgLWriter

The OSpLWriter class is used to construct an instance that follows the OSpL format.

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.OSgLWriter
m_document
 
Constructor Summary
OSpLWriter()
          constructor.
 
Method Summary
 boolean addOtherProcess(java.lang.String name, java.lang.String value, java.lang.String description)
          Add an other process element.
static void main(java.lang.String[] argv)
          main for test purposes.
 boolean setAvailableDiskSpace(double availableDiskSpace)
          Set the available disk space (in bytes).
 boolean setAvailableMemory(double availableMemory)
          Set the available memory (in bytes).
 boolean setCurrentJobCount(int currentJobCount)
          Set the current job count.
 boolean setCurrentState(java.lang.String currentState)
          Set the current state.
 boolean setJobStatistics(JobStatistics[] jobStatistics)
          Set the statistics of all jobs.
 boolean setOptimizationProcess(JobOptimization[] optimizationProcess)
          Set the optimization process of all the jobs, which are in effect intermediate (or occasionally final) optimization results.
 boolean setOSProcess(OSProcess osProcess)
          set the OSProcess, a standard os process interface.
 boolean setOtherProcesses(java.lang.String[] names, java.lang.String[] values, java.lang.String[] descriptions)
          Set the other process related elements.
 boolean setProcessMessage(java.lang.String message)
          Set the process message.
 boolean setProcessStatistics(ProcessStatistics processStatistics)
          Set the process statistics.
 boolean setProcessTime(java.util.GregorianCalendar time)
          Set time of the last process update.
 boolean setRequestAction(java.lang.String action)
          Set the request action.
 boolean setRequestDescription(java.lang.String description)
          Set the request description.
 boolean setResponseDescription(java.lang.String description)
          Set the response description.
 boolean setResponseStatus(java.lang.String status)
          Set the response status.
 boolean setServiceName(java.lang.String serviceName)
          Set service name.
 boolean setServiceURI(java.lang.String serviceURI)
          Set service uri.
 boolean setServiceUtilization(double serviceUtilization)
          Set the service utilization ([0, 1]).
 boolean setTimeLastJobEnded(java.util.GregorianCalendar timeLastJobEnded)
          Set the time that the last job ended.
 boolean setTimeLastJobTook(double timeLastJobTook)
          Set the time that the last job took (in seconds).
 boolean setTimeServiceStarted(java.util.GregorianCalendar timeServiceStarted)
          Set the time that service last started.
 boolean setTotalJobsSoFar(int totalJobsSoFar)
          Set the total jobs received so far.
 
Methods inherited from class org.optimizationservices.oscommon.representationparser.OSgLWriter
getDocument, setDocument, writeToFile, writeToSring, writeToStandardOutput
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSpLWriter

public OSpLWriter()
constructor.

Method Detail

setOSProcess

public boolean setOSProcess(OSProcess osProcess)
                     throws java.lang.Exception
set the OSProcess, a standard os process interface.

Parameters:
osProcess - holds the standard os process interface.
Returns:
whether the OSProcess is set successfully.
Throws:
java.lang.Exception

setRequestAction

public boolean setRequestAction(java.lang.String action)
Set the request action.

Parameters:
action - holds the request action, which can be: ping, notifyJobCompletion, requestJob, getServiceStatistics, setServiceStatistics, getJobStatistics, setJobStatistics, getOptimization, setOptimization, getAll, setAll.
Returns:
whether the requestion action is set successfully.

setRequestDescription

public boolean setRequestDescription(java.lang.String description)
Set the request description.

Parameters:
description - holds the request description
Returns:
whether the requestion description is set successfully.

setResponseStatus

public boolean setResponseStatus(java.lang.String status)
Set the response status.

Parameters:
status - holds the response status, which can be: success, error, warning.
Returns:
whether the response status is set successfully.

setResponseDescription

public boolean setResponseDescription(java.lang.String description)
Set the response description.

Parameters:
description - holds the response description
Returns:
whether the response description is set successfully.

setServiceURI

public boolean setServiceURI(java.lang.String serviceURI)
Set service uri.

Parameters:
serviceURI - holds the uri of the service.
Returns:
whether the service uri is set successfully.

setServiceName

public boolean setServiceName(java.lang.String serviceName)
Set service name.

Parameters:
serviceName - holds the name of the service.
Returns:
whether the service name is set successfully.

setProcessTime

public boolean setProcessTime(java.util.GregorianCalendar time)
Set time of the last process update.

Parameters:
time - holds the time of the last process update.
Returns:
whether process time is set successfully.

setProcessMessage

public boolean setProcessMessage(java.lang.String message)
Set the process message.

Parameters:
message - holds the process message.
Returns:
whether process message is set successfully.

setProcessStatistics

public boolean setProcessStatistics(ProcessStatistics processStatistics)
Set the process statistics.

Parameters:
processStatistics - holds the process statistics.
Returns:
whether the process statistics is set successfully.

setCurrentState

public boolean setCurrentState(java.lang.String currentState)
Set the current state.

Parameters:
currentState - holds the current state, which can be: "busy", "busyButAccepting", "idle", "idleButNotAccepting" or "noResponse".
Returns:
whether the current state is set successfully.

setAvailableDiskSpace

public boolean setAvailableDiskSpace(double availableDiskSpace)
Set the available disk space (in bytes).

Parameters:
availableDiskSpace - holds the available disk space.
Returns:
whether the available disk space is set successfully.

setAvailableMemory

public boolean setAvailableMemory(double availableMemory)
Set the available memory (in bytes).

Parameters:
availableMemory - holds the available memory.
Returns:
whether the available memory is set successfully.

setCurrentJobCount

public boolean setCurrentJobCount(int currentJobCount)
Set the current job count.

Parameters:
currentJobCount - holds the current job count.
Returns:
whether the current job count is set successfully.

setTotalJobsSoFar

public boolean setTotalJobsSoFar(int totalJobsSoFar)
Set the total jobs received so far.

Parameters:
totalJobsSoFar - holds the total jobs received so far.
Returns:
whether the total jobs received so far is set successfully.

setTimeLastJobEnded

public boolean setTimeLastJobEnded(java.util.GregorianCalendar timeLastJobEnded)
Set the time that the last job ended.

Parameters:
timeLastJobEnded - holds the time (xs:dateTime) that the last job ended.
Returns:
whether the time last job ended is set successfully.

setTimeLastJobTook

public boolean setTimeLastJobTook(double timeLastJobTook)
Set the time that the last job took (in seconds).

Parameters:
timeLastJobTook - holds the number of seconds that the last job took.
Returns:
whether the time last job took is set successfully.

setTimeServiceStarted

public boolean setTimeServiceStarted(java.util.GregorianCalendar timeServiceStarted)
Set the time that service last started.

Parameters:
timeServiceStarted - holds the time (xs:dateTime) that the service last started.
Returns:
whether the time the service started is set successfully.

setServiceUtilization

public boolean setServiceUtilization(double serviceUtilization)
Set the service utilization ([0, 1]).

Parameters:
serviceUtilization - holds the service utilization (busy time/total time).
Returns:
whether service utilization is set successfully.

setJobStatistics

public boolean setJobStatistics(JobStatistics[] jobStatistics)
Set the statistics of all jobs.

Parameters:
jobStatistics - holds an array of jobStatistics with each member corresponding to one job.
Returns:
whether the job statistics are set successfully.

setOptimizationProcess

public boolean setOptimizationProcess(JobOptimization[] optimizationProcess)
Set 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).

Parameters:
optimizationProcess - holds 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.
Returns:
whether the optimization process is set successfully.

setOtherProcesses

public boolean setOtherProcesses(java.lang.String[] names,
                                 java.lang.String[] values,
                                 java.lang.String[] descriptions)
Set the other process related elements.

Parameters:
names - holds the names of the other processes. It is required.
values - holds the values of the other processs, empty String "" if no value for an process.
descriptions - holds the descriptions of the other processs, empty String "" if no value for an process, null for the entire array if none of the processs have descriptions.
Returns:
whether the other processs element construction is successful.

addOtherProcess

public boolean addOtherProcess(java.lang.String name,
                               java.lang.String value,
                               java.lang.String description)
Add an other process element.

Parameters:
name - holds the name of the other process element. It is required.
value - holds the value of the other process element, empty String "" if none.
description - holds the description of the other process element, empty String "" if none.
Returns:
whether the other process element is added successfully.

main

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

Parameters:
argv - command line arguments.