com.penguinwerks.jodene.managers
Class ExampleSetManager

java.lang.Object
  extended bycom.penguinwerks.jodene.managers.ExampleSetManager

public class ExampleSetManager
extends java.lang.Object

This manager handles the storing and retrieval of example sets.

Author:
Paul Hoehne

Method Summary
 void addDataFile(ExampleSet set, DataStorageTag tag, java.lang.String name)
          Adds a new example set to the vault with the given name and the given storage tag.
 void addDataFile(ExampleSet set, java.lang.String name)
          Adds a new example set to the vault.
 void cleanVault()
          Cleans out the example sets from the vault.
 ExampleSet getData(java.lang.String name)
          Returns the example set for the given name.
static ExampleSetManager getManager()
          Used to obtain a reference to the example set manager, a singleton in this system.
 DataStorageTag getStorageTag(java.lang.String name)
          Returns the data storage tage associates with a given example set.
 java.lang.String getVaulDirectory()
          Returns the current directory for the example set vault.
 java.util.List listDataFiles()
          Lists the example sets in this vault.
 void removeDataFile(java.lang.String name)
          Remove the data file from the vault.
 void setVaultDirectory(java.lang.String directory)
          Sets the directory for the example set vault.
 void updateDataFile(ExampleSet set, DataStorageTag tag, java.lang.String name)
          Updates the given data file and data storage tag.
 void updateDataFile(ExampleSet set, java.lang.String name)
          Calls update data file but does not update the data storage tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getManager

public static ExampleSetManager getManager()
Used to obtain a reference to the example set manager, a singleton in this system.

Returns:
The manager.

setVaultDirectory

public void setVaultDirectory(java.lang.String directory)
Sets the directory for the example set vault.

Parameters:
directory - The new vault directory.

getVaulDirectory

public java.lang.String getVaulDirectory()
Returns the current directory for the example set vault.

Returns:
The vault directory.

listDataFiles

public java.util.List listDataFiles()
Lists the example sets in this vault.

Returns:
The list of example sets stored in this vault.

addDataFile

public void addDataFile(ExampleSet set,
                        DataStorageTag tag,
                        java.lang.String name)
                 throws java.io.IOException,
                        java.io.FileNotFoundException
Adds a new example set to the vault with the given name and the given storage tag.

Parameters:
set - The example set to store.
tag - The Data Storage Tag for the example set.
name - The name of the example set.
Throws:
IOException - Thrown if there is an IO exception.
FileNotFoundException - Thrown if there is a problem writing to the data file.

addDataFile

public void addDataFile(ExampleSet set,
                        java.lang.String name)
                 throws java.io.IOException,
                        java.io.FileNotFoundException
Adds a new example set to the vault. Calls the addDataFile method with a new empty Data Storage Tag.

Parameters:
set - The example set to store.
name - The name of the example set.
Throws:
IOException - Thrown if there is an IO exception.
FileNotFoundException - Thrown if there is a problem writing to the file.

updateDataFile

public void updateDataFile(ExampleSet set,
                           DataStorageTag tag,
                           java.lang.String name)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException
Updates the given data file and data storage tag.

Parameters:
set - The data to update.
tag - The data storage tag for the data.
name - The name of the data set.
Throws:
IOException - Thrown if there is an IO exception.
java.lang.ClassNotFoundException - Thrown if there is a class not found excption.

updateDataFile

public void updateDataFile(ExampleSet set,
                           java.lang.String name)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException
Calls update data file but does not update the data storage tag.

Parameters:
set - The example set to update.
name - The name of the example set.
Throws:
IOException - Thrown if there is an IO problem.
java.lang.ClassNotFoundException - Thrown if the ExampleSet class is not found.

getStorageTag

public DataStorageTag getStorageTag(java.lang.String name)
                             throws java.lang.ClassNotFoundException,
                                    java.io.FileNotFoundException,
                                    java.io.IOException
Returns the data storage tage associates with a given example set.

Parameters:
name - The name of the example set.
Returns:
The associated data storage tag.
Throws:
java.lang.ClassNotFoundException - Class of storage tag not found.
FileNotFoundException - The data file is not found.
IOException - An IO exception occured.

getData

public ExampleSet getData(java.lang.String name)
                   throws java.io.FileNotFoundException,
                          java.io.IOException,
                          java.lang.ClassNotFoundException
Returns the example set for the given name.

Parameters:
name - The name of the example set.
Returns:
The example set.
Throws:
FileNotFoundException - Thrown if the file is not found.
IOException - Thrown if there is an io exception.
java.lang.ClassNotFoundException - Thrown if the example set class not found.

removeDataFile

public void removeDataFile(java.lang.String name)
Remove the data file from the vault.

Parameters:
name - The name of the data file.

cleanVault

public void cleanVault()
Cleans out the example sets from the vault.