edu.sdsc.inca.agent
Class SuiteTable

java.lang.Object
  extended by edu.sdsc.inca.agent.SuiteTable

public class SuiteTable
extends java.lang.Object

Stores the suites currently stored at the reporter agent and provides methods for accessing them. Suites are stored in a directory under their name and will be persistent.

Author:
Shava Smallen <ssmallen@sdsc.edu>

Constructor Summary
SuiteTable(java.lang.String directory, edu.sdsc.inca.util.ResourcesWrapper resources)
          Create new suite table and read in any existing suites from file.
 
Method Summary
 edu.sdsc.inca.dataModel.suite.SuiteDocument[] applyResourceChanges(edu.sdsc.inca.util.ResourcesWrapper newResources)
          Traverses thru all of its suites and applies the new resources file to each suite.
 java.lang.String getDirectory()
          Get the directory where the suite table stores the suites to disk.
 java.lang.String[] getNames()
          Return the names of the suites currently being stored.
 edu.sdsc.inca.util.SuiteStagesWrapper getSuite(java.lang.String suiteName)
          Return the contents of the named suite.
 edu.sdsc.inca.util.SuiteStagesWrapper getSuite(java.lang.String suiteName, edu.sdsc.inca.util.ResourcesWrapper resources)
          Return the contents of the named suite.
 boolean hasSuite(java.lang.String suiteName)
          Returns true if the named suite is currently stored in the object.
 void putSuite(edu.sdsc.inca.util.SuiteStagesWrapper suiteStages)
          Store the named suite contained in the suiteStages object.
 void remove(java.lang.String suiteName)
          Delete the named suite from storage.
 void setDirectory(java.lang.String directory)
          Set the directory where the suites can be stored to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuiteTable

public SuiteTable(java.lang.String directory,
                  edu.sdsc.inca.util.ResourcesWrapper resources)
Create new suite table and read in any existing suites from file.

Parameters:
directory - Path to the directory where suite files can be stored.
resources - The resource configuration information.
Method Detail

applyResourceChanges

public edu.sdsc.inca.dataModel.suite.SuiteDocument[] applyResourceChanges(edu.sdsc.inca.util.ResourcesWrapper newResources)
Traverses thru all of its suites and applies the new resources file to each suite. If there are differences in the suite expanded file produced by the new resources from the old suite expanded, they are returned as adds/deletes in a suite expanded document. This function returns an array of suite expanded documents, one for each suite.

Parameters:
newResources - The new resource configuration information.
Returns:

getDirectory

public java.lang.String getDirectory()
Get the directory where the suite table stores the suites to disk.

Returns:
A string containing the path to the directory where suites are stored.

hasSuite

public boolean hasSuite(java.lang.String suiteName)
Returns true if the named suite is currently stored in the object.

Parameters:
suiteName - The name of the suite we're looking for.
Returns:
true if the named suite is currently stored in the object; otherwise false.

getSuite

public edu.sdsc.inca.util.SuiteStagesWrapper getSuite(java.lang.String suiteName)
Return the contents of the named suite. If there is not suite by that name, null is returned.

Parameters:
suiteName - The name of the suite to be retrieved.
Returns:
A suite data access object that contains the suite.

getSuite

public edu.sdsc.inca.util.SuiteStagesWrapper getSuite(java.lang.String suiteName,
                                                      edu.sdsc.inca.util.ResourcesWrapper resources)
                                               throws org.apache.xmlbeans.XmlException,
                                                      java.io.IOException,
                                                      edu.sdsc.inca.util.CrypterException,
                                                      edu.sdsc.inca.ConfigurationException
Return the contents of the named suite. If there is not suite by that name, a blank suite is created and returned.

Parameters:
suiteName - The name of the suite to be retrieved.
resources - The resource configuration information to be applied to new suites.
Returns:
A suite data access object that contains the suite.
Throws:
org.apache.xmlbeans.XmlException
java.io.IOException
edu.sdsc.inca.util.CrypterException
edu.sdsc.inca.ConfigurationException

putSuite

public void putSuite(edu.sdsc.inca.util.SuiteStagesWrapper suiteStages)
              throws edu.sdsc.inca.util.CrypterException,
                     java.io.IOException
Store the named suite contained in the suiteStages object. If there is an existing suite in the table already, this suite will be applied to it. This change will be persistent.

Parameters:
suiteStages - The suiteStages object which contains the expanded suite.
Throws:
edu.sdsc.inca.util.CrypterException
java.io.IOException

remove

public void remove(java.lang.String suiteName)
Delete the named suite from storage.

Parameters:
suiteName - The name of the suite to be deleted.

getNames

public java.lang.String[] getNames()
Return the names of the suites currently being stored.

Returns:
An array of suite names currently stored in object.

setDirectory

public void setDirectory(java.lang.String directory)
Set the directory where the suites can be stored to disk.

Parameters:
directory - A string containing the path to a writeable directory.