org.optimizationservices.oscommon.localinterface
Class OSRepository

java.lang.Object
  extended by org.optimizationservices.oscommon.localinterface.OSRepository

public class OSRepository
extends java.lang.Object

The OSRepository class is a local interface for storing Optimization Services repository. Its design follows the Optimization Services Repository Language (OSRepository). All the data structures in this class are standards specified in the OSRepository schema.

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

Field Summary
 java.lang.String description
          description holds the general description of the os repository.
 RepositoryInstance[] instance
          instance holds an array of os repository instances.
 News news
          news holds the news for the os repository.
 
Constructor Summary
OSRepository()
          Default constructor.
 
Method Summary
 boolean addInstance(RepositoryInstance instance)
          Add an OSRepository instance.
 boolean addNews(NewsElement newsElement)
          Add an OSRepository news element.
 boolean deleteInstance(java.lang.String instanceName)
          Delete an OSRepository instance.
 java.lang.String getDescription()
          Get the OSRepository description.
 RepositoryInstance getInstance(java.lang.String instanceName)
          Get an OSRepository instance.
 RepositoryInstance[] getInstances()
          Get the OSRepository instances.
 NewsElement[] getNews()
          Get the OSRepository news.
static void main(java.lang.String[] args)
          main for test purposes.
 OSRepository readOSRepository(java.lang.String osRepository, boolean isFile, boolean validate)
          read an OSRepository instance and return and OSRepository object.
 boolean setDescription(java.lang.String description)
          Set the OSRepository description.
 boolean setInstances(RepositoryInstance[] instances)
          Set the OSRepository instances.
 boolean setNews(NewsElement[] newsElements)
          Set the OSRepository news.
 java.lang.String writeOSRepository()
          write the OSRepository to an osRepository xml string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

public java.lang.String description
description holds the general description of the os repository.


news

public News news
news holds the news for the os repository.


instance

public RepositoryInstance[] instance
instance holds an array of os repository instances.

Constructor Detail

OSRepository

public OSRepository()
Default constructor.

Method Detail

readOSRepository

public OSRepository readOSRepository(java.lang.String osRepository,
                                     boolean isFile,
                                     boolean validate)
                              throws java.lang.Exception
read an OSRepository instance and return and OSRepository object.

Parameters:
osRepository - holds the optimization repository in a string which format follows the Optimization Services repository Language (OSRepository) schema.
isFile - holds whether the osRepository string is a file name or a string that literally holds the osRepository contents.
validate - holds whether the reader should be validating against the schema or not.
Returns:
the OSRepository object constructed from the OSRepository String.
Throws:
java.lang.Exception - if there are errors in reading the string or setting the OSRepository.

writeOSRepository

public java.lang.String writeOSRepository()
                                   throws java.lang.Exception
write the OSRepository to an osRepository xml string.

Returns:
the osRepository xml string.
Throws:
java.lang.Exception - if there are errors in writing the osRepository string.

getDescription

public java.lang.String getDescription()
Get the OSRepository description.

Returns:
the OSRepository description; null or empty string if none.

setDescription

public boolean setDescription(java.lang.String description)
Set the OSRepository description.

Parameters:
description - holds the OSRepository description.
Returns:
whether the description is set successfully or not.

getNews

public NewsElement[] getNews()
Get the OSRepository news.

Returns:
the news element array. Each element of the array corresponds to a news element; null if none.
See Also:
NewsElement

setNews

public boolean setNews(NewsElement[] newsElements)
Set the OSRepository news.

Returns:
whether the news is set successfully or not.
See Also:
NewsElement

addNews

public boolean addNews(NewsElement newsElement)
Add an OSRepository news element.

Returns:
whether the news element is added successfully or not.
See Also:
NewsElement

getInstances

public RepositoryInstance[] getInstances()
Get the OSRepository instances.

Returns:
the instance array. Each element of the array corresponds to an instance entry; null if none.
See Also:
RepositoryInstance

getInstance

public RepositoryInstance getInstance(java.lang.String instanceName)
Get an OSRepository instance.

Returns:
the found instance, which is in the RepositoryInstance data structure.
See Also:
RepositoryInstance

setInstances

public boolean setInstances(RepositoryInstance[] instances)
Set the OSRepository instances.

Returns:
whether the instances are set successfully or not.
See Also:
RepositoryInstance

addInstance

public boolean addInstance(RepositoryInstance instance)
Add an OSRepository instance.

Returns:
whether the instance is added successfully or not.
See Also:
RepositoryInstance

deleteInstance

public boolean deleteInstance(java.lang.String instanceName)
Delete an OSRepository instance.

Returns:
whether the instance is deleted successfully or not.
See Also:
RepositoryInstance

main

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

Parameters:
argv - command line arguments.