com.sun.slamd.db
Class SLAMDDB

java.lang.Object
  extended by com.sun.slamd.db.SLAMDDB

public class SLAMDDB
extends java.lang.Object

This class provides the main interface to the SLAMD database used for storing user accounts, configuration information, and job data.

Author:
Neil A. Wilson

Constructor Summary
SLAMDDB(SLAMDServer slamdServer, java.lang.String dbDirectory, boolean readOnly, boolean createIfNecessary)
          Initializes the SLAMD database and opens the environment, creating a new one if necessary.
 
Method Summary
 void addJobClass(java.lang.String className)
          Adds information about the specified job class to the configuration database.
 void closeDatabases(boolean abortTransactions)
          Closes all databases in the environment.
 void closeEnvironment()
          Closes the database environment.
static void createDB(java.lang.String dbDirectory)
          Creates a new SLAMD database if one does not already exist.
static boolean dbExists(java.lang.String dbDirectory)
          Checks to see if a valid SLAMD database exists in the specified location.
 void exportFolderData(java.lang.String[] realFolderNames, java.lang.String[] virtualFolderNames, java.lang.String[] jobGroupNames, java.io.OutputStream outputStream)
          Writes data from the specified job folder(s) in a form that is suitable for importing into another SLAMD server instance.
 Job[] getCompletedJobs(java.lang.String folderName)
          Retrieves the set of completed jobs contained in the specified folder of the configuration database.
 Job[] getCompletedSummaryJobs(java.lang.String folderName)
          Retrieves summary information for the set of completed jobs contained in the specified folder of the configuration database.
 java.lang.String getConfigParameter(java.lang.String parameterName)
          Retrieves the value of the specified configuration parameter from the configuration database.
 boolean getConfigParameter(java.lang.String parameterName, boolean defaultValue)
          Retrieves the value of the specified configuration parameter from the configuration database.
 int getConfigParameter(java.lang.String parameterName, int defaultValue)
          Retrieves the value of the specified configuration parameter from the configuration database.
 java.lang.String getConfigParameter(java.lang.String parameterName, java.lang.String defaultValue)
          Retrieves the value of the specified configuration parameter from the configuration database.
 ConfigSubscriber[] getConfigSubscribers()
          Retrieves the set of config subscribers that have been registered with the configuration database.
 byte[] getDBData(java.lang.String dbName, java.lang.String dbKey)
          Retrieves the data associated with the specified key in the given database.
 java.lang.String[] getDBKeys(java.lang.String dbName)
          Retrieves a list of all the keys in the specified database.
 java.lang.String[] getDBNames()
          Retrieves the names of the databases contained in the DB environment.
 java.lang.String[] getDisabledJobIDs()
          Retrieves an array containing the job IDs of the jobs that are currently disabled.
 Job[] getDisabledJobs()
          Retrieves an array containing the set of jobs that are currently disabled.
 JobFolder getFolder(java.lang.String folderName)
          Retrieves the specified folder from the configuration database.
 JobFolder[] getFolders()
          Retrieves a list of all job folders defined in the configuration database.
 Job getJob(java.lang.String jobID)
          Retrieves the specified job from the configuration database.
 JobClass[] getJobClasses()
          Retrieves the set of job classes defined in the configuration database.
 JobGroup getJobGroup(java.lang.String jobGroupName)
          Retrieves the requested job group from the configuration database.
 JobGroup[] getJobGroups()
          Retrieves a list of all job groups defined in the configuration database.
 Job[] getJobs(java.lang.String folderName)
          Retrieves the set of jobs contained in the specified folder of the configuration database.
 OptimizingJob getOptimizingJob(java.lang.String optimizingJobID)
          Retrieves the specified optimizing job from the configuration database.
 OptimizingJob[] getOptimizingJobs(java.lang.String folderName)
          Retrieves the set of optimizing jobs contained in the specified folder of the configuration database.
 java.lang.String[] getPendingJobIDs()
          Retrieves an array containing the job IDs of the jobs that are currently pending execution.
 Job[] getPendingJobs()
          Retrieves an array containing the set of jobs that are currently pending execution.
 java.lang.String[] getRunningJobIDs()
          Retrieves an array containing the job IDs of the jobs that are currently running.
 Job[] getRunningJobs()
          Retrieves an array containing the set of jobs that are currently running.
static java.lang.String getSafeName(ConfigSubscriber subscriber)
          Retrieves a "safe" name for the provided configuration subscriber, which is suitable for submission in an HTML form.
 Job getSummaryJob(java.lang.String jobID)
          Retrieves summary information for the specified job from the configuration database.
 JobGroup[] getSummaryJobGroups()
          Retrieves a list of all job groups defined in the configuration database.
 Job[] getSummaryJobs(java.lang.String folderName)
          Retrieves summary information for the set of jobs contained in the specified folder of the configuration database.
 OptimizingJob getSummaryOptimizingJob(java.lang.String optimizingJobID)
          Retrieves summary information for the specified optimizing job from the configuration database.
 OptimizingJob[] getSummaryOptimizingJobs(java.lang.String folderName)
          Retrieves summary information for the set of optimizing jobs contained in the specified folder of the configuration database.
 Job[] getSummaryVirtualJobs(java.lang.String folderName)
          Retrieves summary information for the set of jobs contained in the specified virtual folder of the configuration database.
 UploadedFile getUploadedFile(java.lang.String folderName, java.lang.String fileName)
          Retrieves the specified uploaded file from the configuration database.
 UploadedFile[] getUploadedFiles(java.lang.String folderName)
          Retrieves the set of uploaded files associated with the specified folder.
 UploadedFile getUploadedFileWithoutData(java.lang.String folderName, java.lang.String fileName)
          Retrieves the specified uploaded file from the configuration database.
 JobFolder getVirtualFolder(java.lang.String folderName)
          Retrieves the specified virtual folder from the configuration database.
 JobFolder[] getVirtualFolders()
          Retrieves a list of all virtual job folders defined in the configuration database.
 Job[] getVirtualJobs(java.lang.String folderName)
          Retrieves the set of jobs contained in the specified virtual folder of the configuration database.
 boolean importFolderData(java.io.InputStream inputStream, java.io.PrintWriter progressWriter, boolean writeHTML)
          Reads import data from the provided input stream and imports it into the database.
 void moveJob(java.lang.String jobID, java.lang.String folderName)
          Moves the specified job from its current folder to the new folder.
 void moveOptimizingJob(java.lang.String optimizingJobID, java.lang.String folderName)
          Moves the specified optimizing job from its current folder to the new folder.
 void openDatabases(boolean createIfNecessary)
          Opens all the databases used in the SLAMD database environment.
 void putConfigParameter(java.lang.String parameterName, boolean parameterValue, boolean notifySubscribers)
          Sets the value of the specified parameter in the configuration database.
 void putConfigParameter(java.lang.String parameterName, int parameterValue, boolean notifySubscribers)
          Sets the value of the specified parameter in the configuration database.
 void putConfigParameter(java.lang.String parameterName, java.lang.String parameterValue, boolean notifySubscribers)
          Sets the value of the specified parameter in the configuration database.
 void registerAsSubscriber(ConfigSubscriber subscriber)
          Registers the provided configuration subscriber to be notified of changes to configuration parameters in the database.
 void removeConfigParameter(java.lang.String parameterName)
          Removes information about the specified parameter from the configuration database.
 void removeFolder(java.lang.String folderName, boolean deleteContents)
          Removes information about the specified job folder from the configuration database.
 void removeJob(java.lang.String jobID)
          Removes information about the specified job from the configuration database.
 void removeJobClass(java.lang.String className)
          Removes information about the specified job class from the configuration database.
 void removeJobGroup(java.lang.String jobGroupName)
          Removes information about the specified job group from the configuration database.
 void removeOptimizingJob(java.lang.String optimizingJobID)
          Removes information about the specified optimizing job from the configuration database.
 void removeUploadedFile(java.lang.String folderName, java.lang.String fileName)
          Removes information about the specified uploaded file from the configuration database.
 void removeVirtualFolder(java.lang.String folderName)
          Removes information about the specified virtual job folder from the configuration database.
 ConfigSubscriber subscriberForSafeName(java.lang.String name)
          Retrieves the configuration subscriber that corresponds to the provided "safe" name.
 void writeFolder(JobFolder jobFolder)
          Writes information about the provided job folder into the configuration database.
 void writeJob(Job job)
          Writes information about the provided job into the configuration database.
 void writeJobGroup(JobGroup jobGroup)
          Writes information about the provided job group to the configuration database.
 void writeOptimizingJob(OptimizingJob optimizingJob)
          Writes information about the provided optimizing job into the configuration database.
 void writeUploadedFile(UploadedFile uploadedFile, java.lang.String folderName)
          Writes information about the provided uploaded file into the configuration database.
 void writeVirtualFolder(JobFolder jobFolder)
          Writes information about the provided virtual job folder into the configuration database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SLAMDDB

public SLAMDDB(SLAMDServer slamdServer,
               java.lang.String dbDirectory,
               boolean readOnly,
               boolean createIfNecessary)
        throws com.sleepycat.je.DatabaseException
Initializes the SLAMD database and opens the environment, creating a new one if necessary.

Parameters:
slamdServer - The SLAMD server instance with which this database is associated.
dbDirectory - The path to the directory in which the database files should be held.
readOnly - Indicates whether the database should be opened in read-only mode.
createIfNecessary - Indicates whether a new database environment should be created if one does not already exist.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while initializing the database environment.
Method Detail

dbExists

public static boolean dbExists(java.lang.String dbDirectory)
                        throws com.sleepycat.je.DatabaseException
Checks to see if a valid SLAMD database exists in the specified location.

Parameters:
dbDirectory - The path to the directory containing the database files.
Returns:
true if the database exists, or false false if not.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while attempting to make the determination.

createDB

public static void createDB(java.lang.String dbDirectory)
                     throws com.sleepycat.je.DatabaseException
Creates a new SLAMD database if one does not already exist.

Parameters:
dbDirectory - The path to the directory in which to create the database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while trying to create the database.

openDatabases

public void openDatabases(boolean createIfNecessary)
                   throws com.sleepycat.je.DatabaseException
Opens all the databases used in the SLAMD database environment. If the databases are already open, then no action will be taken.

Parameters:
createIfNecessary - Indicates whether any database(s) that do not exist should be created.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while opening the databases. Note that if an exception is thrown, then all databases will be closed but the environment will still be open.

closeDatabases

public void closeDatabases(boolean abortTransactions)
                    throws com.sleepycat.je.DatabaseException
Closes all databases in the environment. If the databases are already closed then this method will do anything.

Parameters:
abortTransactions - Indicates whether any transactions in progress should be aborted. If not and there are active transactions, then this method will fail.
Throws:
com.sleepycat.je.DatabaseException - If there are active transactions and this method is configured to not abort them.

closeEnvironment

public void closeEnvironment()
                      throws com.sleepycat.je.DatabaseException
Closes the database environment. This will only be allowed if the databases have already been closed.

Throws:
com.sleepycat.je.DatabaseException - If the databases are still open.

exportFolderData

public void exportFolderData(java.lang.String[] realFolderNames,
                             java.lang.String[] virtualFolderNames,
                             java.lang.String[] jobGroupNames,
                             java.io.OutputStream outputStream)
                      throws com.sleepycat.je.DatabaseException,
                             java.io.IOException
Writes data from the specified job folder(s) in a form that is suitable for importing into another SLAMD server instance.

Parameters:
realFolderNames - The names of the real job folders to include in the export.
virtualFolderNames - The names of the virtual job folders to include in the export.
jobGroupNames - The names of the job groups to include in the export.
outputStream - The output stream to which the export data should be written.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the database.
java.io.IOException - If a problem occurs while writing to the provided output stream.

importFolderData

public boolean importFolderData(java.io.InputStream inputStream,
                                java.io.PrintWriter progressWriter,
                                boolean writeHTML)
Reads import data from the provided input stream and imports it into the database.

Parameters:
inputStream - The input stream from which to read the data to import.
progressWriter - The print writer that should be used to write progress about the import to the end user.
writeHTML - Indicates whether the progress information should be written in HTML format. If not, then it will be plain text.
Returns:
true if the import was completely successful, or false if one or more problems were encountered.

getDBNames

public java.lang.String[] getDBNames()
                              throws com.sleepycat.je.DatabaseException
Retrieves the names of the databases contained in the DB environment.

Returns:
The names of the databases contained in the DB environment.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while obtaining the list of database names.

getDBKeys

public java.lang.String[] getDBKeys(java.lang.String dbName)
                             throws com.sleepycat.je.DatabaseException
Retrieves a list of all the keys in the specified database.

Parameters:
dbName - The name of the database for which to retrieve the list of keys.
Returns:
A list of all the keys in the specified database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while obtaining the list of database keys.

getDBData

public byte[] getDBData(java.lang.String dbName,
                        java.lang.String dbKey)
                 throws com.sleepycat.je.DatabaseException
Retrieves the data associated with the specified key in the given database.

Parameters:
dbName - The name of the database from which the data should be retrieved.
dbKey - The key associated with the data to retrieve.
Returns:
The data associated with the specified key in the given database, or null if there is no such database key.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the database.

getConfigParameter

public java.lang.String getConfigParameter(java.lang.String parameterName)
Retrieves the value of the specified configuration parameter from the configuration database.

Parameters:
parameterName - The name of the configuration parameter to retrieve.
Returns:
The value of the specified configuration parameter, or null if there is no such parameter.

getConfigParameter

public java.lang.String getConfigParameter(java.lang.String parameterName,
                                           java.lang.String defaultValue)
Retrieves the value of the specified configuration parameter from the configuration database.

Parameters:
parameterName - The name of the configuration parameter to retrieve.
defaultValue - The value to use for the parameter if the specified key is not present in the database.
Returns:
The value of the specified configuration parameter, or the provided default value if there is no such parameter.

getConfigParameter

public boolean getConfigParameter(java.lang.String parameterName,
                                  boolean defaultValue)
Retrieves the value of the specified configuration parameter from the configuration database.

Parameters:
parameterName - The name of the configuration parameter to retrieve.
defaultValue - The value to use for the parameter if the specified key is not present in the database.
Returns:
The value of the specified configuration parameter, or the provided default value if there is no such parameter.

getConfigParameter

public int getConfigParameter(java.lang.String parameterName,
                              int defaultValue)
Retrieves the value of the specified configuration parameter from the configuration database.

Parameters:
parameterName - The name of the configuration parameter to retrieve.
defaultValue - The value to use for the parameter if the specified key is not present in the database.
Returns:
The value of the specified configuration parameter, or the provided default value if there is no such parameter.

putConfigParameter

public void putConfigParameter(java.lang.String parameterName,
                               java.lang.String parameterValue,
                               boolean notifySubscribers)
                        throws com.sleepycat.je.DatabaseException
Sets the value of the specified parameter in the configuration database.

Parameters:
parameterName - The name of the parameter to set.
parameterValue - The value to use for the parameter.
notifySubscribers - Indicates whether the configuration subscribers registered with the SLAMD server should be notified of the change.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while attempting to store the configuration parameter.

putConfigParameter

public void putConfigParameter(java.lang.String parameterName,
                               boolean parameterValue,
                               boolean notifySubscribers)
                        throws com.sleepycat.je.DatabaseException
Sets the value of the specified parameter in the configuration database.

Parameters:
parameterName - The name of the parameter to set.
parameterValue - The value to use for the parameter.
notifySubscribers - Indicates whether the configuration subscribers registered with the SLAMD server should be notified of the change.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while attempting to store the configuration parameter.

putConfigParameter

public void putConfigParameter(java.lang.String parameterName,
                               int parameterValue,
                               boolean notifySubscribers)
                        throws com.sleepycat.je.DatabaseException
Sets the value of the specified parameter in the configuration database.

Parameters:
parameterName - The name of the parameter to set.
parameterValue - The value to use for the parameter.
notifySubscribers - Indicates whether the configuration subscribers registered with the SLAMD server should be notified of the change.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while attempting to store the configuration parameter.

removeConfigParameter

public void removeConfigParameter(java.lang.String parameterName)
                           throws com.sleepycat.je.DatabaseException
Removes information about the specified parameter from the configuration database.

Parameters:
parameterName - The name of the configuration parameter to remove from the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If problem occurs while interacting with the configuration database.

getFolder

public JobFolder getFolder(java.lang.String folderName)
                    throws com.sleepycat.je.DatabaseException,
                           DecodeException
Retrieves the specified folder from the configuration database.

Parameters:
folderName - The name of the folder to retrieve.
Returns:
The requested folder, or null if no such folder exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while trying to decode the folder from the configuration database.

getFolders

public JobFolder[] getFolders()
                       throws com.sleepycat.je.DatabaseException
Retrieves a list of all job folders defined in the configuration database.

Returns:
A list of all job folders defined in the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

writeFolder

public void writeFolder(JobFolder jobFolder)
                 throws com.sleepycat.je.DatabaseException
Writes information about the provided job folder into the configuration database. If the specified folder already exists, then it will be replaced.

Parameters:
jobFolder - The folder to write to the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

removeFolder

public void removeFolder(java.lang.String folderName,
                         boolean deleteContents)
                  throws com.sleepycat.je.DatabaseException
Removes information about the specified job folder from the configuration database. If the specified folder does not exist, then no action will be taken.

Parameters:
folderName - The name of the job folder to remove from the configuration database.
deleteContents - Indicates whether to remove the jobs, optimizing jobs, and uploaded files associated with the folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getVirtualFolder

public JobFolder getVirtualFolder(java.lang.String folderName)
                           throws com.sleepycat.je.DatabaseException,
                                  DecodeException
Retrieves the specified virtual folder from the configuration database.

Parameters:
folderName - The name of the virtual folder to retrieve.
Returns:
The requested virtual folder, or null if no such folder exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while trying to decode the virtual folder from the configuration database.

getVirtualFolders

public JobFolder[] getVirtualFolders()
                              throws com.sleepycat.je.DatabaseException
Retrieves a list of all virtual job folders defined in the configuration database.

Returns:
A list of all virtual job folders defined in the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

writeVirtualFolder

public void writeVirtualFolder(JobFolder jobFolder)
                        throws com.sleepycat.je.DatabaseException
Writes information about the provided virtual job folder into the configuration database. If the specified folder already exists, then it will be replaced.

Parameters:
jobFolder - The virtual folder to write to the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

removeVirtualFolder

public void removeVirtualFolder(java.lang.String folderName)
                         throws com.sleepycat.je.DatabaseException
Removes information about the specified virtual job folder from the configuration database. If the specified folder does not exist, then no action will be taken.

Parameters:
folderName - The name of the virtual job folder to remove from the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getJob

public Job getJob(java.lang.String jobID)
           throws com.sleepycat.je.DatabaseException,
                  DecodeException
Retrieves the specified job from the configuration database.

Parameters:
jobID - The job ID of the job to retrieve from the database.
Returns:
The requested job from the configuration database, or null if no such job exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while decoding the job information.

getSummaryJob

public Job getSummaryJob(java.lang.String jobID)
                  throws com.sleepycat.je.DatabaseException,
                         DecodeException
Retrieves summary information for the specified job from the configuration database.

Parameters:
jobID - The job ID of the job to retrieve from the database.
Returns:
Summary information for the requested job from the configuration database, or null if no such job exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while decoding the job information.

getJobs

public Job[] getJobs(java.lang.String folderName)
              throws com.sleepycat.je.DatabaseException,
                     DecodeException
Retrieves the set of jobs contained in the specified folder of the configuration database.

Parameters:
folderName - The name of the folder for which to retrieve the associated jobs.
Returns:
The set of jobs contained in the specified folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified folder.

getCompletedJobs

public Job[] getCompletedJobs(java.lang.String folderName)
                       throws com.sleepycat.je.DatabaseException,
                              DecodeException
Retrieves the set of completed jobs contained in the specified folder of the configuration database.

Parameters:
folderName - The name of the folder for which to retrieve the associated jobs.
Returns:
The set of completed jobs contained in the specified folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified folder.

getVirtualJobs

public Job[] getVirtualJobs(java.lang.String folderName)
                     throws com.sleepycat.je.DatabaseException,
                            DecodeException
Retrieves the set of jobs contained in the specified virtual folder of the configuration database.

Parameters:
folderName - The name of the virtual folder for which to retrieve the associated jobs.
Returns:
The set of jobs contained in the specified virtual folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified virtual folder.

getSummaryJobs

public Job[] getSummaryJobs(java.lang.String folderName)
                     throws com.sleepycat.je.DatabaseException,
                            DecodeException
Retrieves summary information for the set of jobs contained in the specified folder of the configuration database.

Parameters:
folderName - The name of the folder for which to retrieve the associated jobs.
Returns:
Summary information about the set of jobs contained in the specified folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified folder.

getCompletedSummaryJobs

public Job[] getCompletedSummaryJobs(java.lang.String folderName)
                              throws com.sleepycat.je.DatabaseException,
                                     DecodeException
Retrieves summary information for the set of completed jobs contained in the specified folder of the configuration database.

Parameters:
folderName - The name of the folder for which to retrieve the associated jobs.
Returns:
Summary information about the set of completed jobs contained in the specified folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified folder.

getSummaryVirtualJobs

public Job[] getSummaryVirtualJobs(java.lang.String folderName)
                            throws com.sleepycat.je.DatabaseException,
                                   DecodeException
Retrieves summary information for the set of jobs contained in the specified virtual folder of the configuration database.

Parameters:
folderName - The name of the virtual folder for which to retrieve the associated jobs.
Returns:
Summary information about the set of jobs contained in the specified virtual folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified virtual folder.

writeJob

public void writeJob(Job job)
              throws com.sleepycat.je.DatabaseException
Writes information about the provided job into the configuration database. If the specified job already exists, it will be overwritten. Otherwise, it will be added.

Parameters:
job - The job to write to the database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while attempting to write the job information.

getDisabledJobIDs

public java.lang.String[] getDisabledJobIDs()
Retrieves an array containing the job IDs of the jobs that are currently disabled.

Returns:
An array containing the job IDs of the jobs that are currently disabled.

getDisabledJobs

public Job[] getDisabledJobs()
                      throws com.sleepycat.je.DatabaseException
Retrieves an array containing the set of jobs that are currently disabled.

Returns:
An array containing the set of jobs that are currently disabled.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the database.

getPendingJobIDs

public java.lang.String[] getPendingJobIDs()
Retrieves an array containing the job IDs of the jobs that are currently pending execution.

Returns:
An array containing the job IDs of the jobs that are currently pending execution.

getPendingJobs

public Job[] getPendingJobs()
                     throws com.sleepycat.je.DatabaseException
Retrieves an array containing the set of jobs that are currently pending execution.

Returns:
An array containing the set of jobs that are currently pending execution.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the database.

getRunningJobIDs

public java.lang.String[] getRunningJobIDs()
Retrieves an array containing the job IDs of the jobs that are currently running.

Returns:
An array containing the job IDs of the jobs that are currently running.

getRunningJobs

public Job[] getRunningJobs()
                     throws com.sleepycat.je.DatabaseException
Retrieves an array containing the set of jobs that are currently running.

Returns:
An array containing the set of jobs that are currently running.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the database.

removeJob

public void removeJob(java.lang.String jobID)
               throws com.sleepycat.je.DatabaseException
Removes information about the specified job from the configuration database.

Parameters:
jobID - The job ID of the job to remove from the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

moveJob

public void moveJob(java.lang.String jobID,
                    java.lang.String folderName)
             throws com.sleepycat.je.DatabaseException
Moves the specified job from its current folder to the new folder.

Parameters:
jobID - The job ID of the job to move.
folderName - The name of the new folder in which to place the job.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getOptimizingJob

public OptimizingJob getOptimizingJob(java.lang.String optimizingJobID)
                               throws com.sleepycat.je.DatabaseException,
                                      DecodeException
Retrieves the specified optimizing job from the configuration database.

Parameters:
optimizingJobID - The ID of the optimizing job to retrieve from the database.
Returns:
The requested optimizing job from the configuration database, or null if no such job exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while decoding the optimizing job information.

getSummaryOptimizingJob

public OptimizingJob getSummaryOptimizingJob(java.lang.String optimizingJobID)
                                      throws com.sleepycat.je.DatabaseException,
                                             DecodeException
Retrieves summary information for the specified optimizing job from the configuration database.

Parameters:
optimizingJobID - The ID of the optimizing job to retrieve from the database.
Returns:
Summary information for the requested optimizing job from the configuration database, or null if no such job exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while decoding the optimizing job information.

getOptimizingJobs

public OptimizingJob[] getOptimizingJobs(java.lang.String folderName)
                                  throws com.sleepycat.je.DatabaseException,
                                         DecodeException
Retrieves the set of optimizing jobs contained in the specified folder of the configuration database.

Parameters:
folderName - The name of the folder for which to retrieve the associated optimizing jobs.
Returns:
The set of optimizing jobs contained in the specified folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified folder.

getSummaryOptimizingJobs

public OptimizingJob[] getSummaryOptimizingJobs(java.lang.String folderName)
                                         throws com.sleepycat.je.DatabaseException,
                                                DecodeException
Retrieves summary information for the set of optimizing jobs contained in the specified folder of the configuration database.

Parameters:
folderName - The name of the folder for which to retrieve the associated optimizing jobs.
Returns:
Summary information for the set of optimizing jobs contained in the specified folder of the configuration database, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while attempting to decode the specified folder.

writeOptimizingJob

public void writeOptimizingJob(OptimizingJob optimizingJob)
                        throws com.sleepycat.je.DatabaseException
Writes information about the provided optimizing job into the configuration database. If the specified optimizing job already exists, it will be overwritten. Otherwise, it will be added.

Parameters:
optimizingJob - The optimizing job to write to the database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while attempting to write the optimizing job information.

removeOptimizingJob

public void removeOptimizingJob(java.lang.String optimizingJobID)
                         throws com.sleepycat.je.DatabaseException
Removes information about the specified optimizing job from the configuration database.

Parameters:
optimizingJobID - The ID of the optimizing job to remove from the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

moveOptimizingJob

public void moveOptimizingJob(java.lang.String optimizingJobID,
                              java.lang.String folderName)
                       throws com.sleepycat.je.DatabaseException
Moves the specified optimizing job from its current folder to the new folder.

Parameters:
optimizingJobID - The job ID of the job to move.
folderName - The name of the new folder in which to place the optimizing job.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getJobGroups

public JobGroup[] getJobGroups()
                        throws com.sleepycat.je.DatabaseException
Retrieves a list of all job groups defined in the configuration database.

Returns:
A list of all job groups defined in the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getSummaryJobGroups

public JobGroup[] getSummaryJobGroups()
                               throws com.sleepycat.je.DatabaseException
Retrieves a list of all job groups defined in the configuration database. The returned list will only contain summary information for each group.

Returns:
A list of all job groups defined in the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getJobGroup

public JobGroup getJobGroup(java.lang.String jobGroupName)
                     throws com.sleepycat.je.DatabaseException,
                            DecodeException
Retrieves the requested job group from the configuration database.

Parameters:
jobGroupName - The name of the job group to retrieve.
Returns:
The requested job group, or null if no such job group exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If a problem occurs while trying to decode the requested job group information.

writeJobGroup

public void writeJobGroup(JobGroup jobGroup)
                   throws com.sleepycat.je.DatabaseException
Writes information about the provided job group to the configuration database. If the specified job group already exists, it will be overwritten. Otherwise, a new record will be created.

Parameters:
jobGroup - The job group to be written to the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

removeJobGroup

public void removeJobGroup(java.lang.String jobGroupName)
                    throws com.sleepycat.je.DatabaseException
Removes information about the specified job group from the configuration database. If it does not exist, then no action will be taken.

Parameters:
jobGroupName - The name of the job group to remove from the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getUploadedFile

public UploadedFile getUploadedFile(java.lang.String folderName,
                                    java.lang.String fileName)
                             throws com.sleepycat.je.DatabaseException,
                                    DecodeException
Retrieves the specified uploaded file from the configuration database.

Parameters:
folderName - The name of the folder in which the specified file is located.
fileName - The name of the uploaded file to retrieve.
Returns:
The requested uploaded file, or null if no such file exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If the uploaded file cannot be decoded for some reason.

getUploadedFileWithoutData

public UploadedFile getUploadedFileWithoutData(java.lang.String folderName,
                                               java.lang.String fileName)
                                        throws com.sleepycat.je.DatabaseException,
                                               DecodeException
Retrieves the specified uploaded file from the configuration database. The file returned will not include the actual file data.

Parameters:
folderName - The name of the folder in which the specified file is located.
fileName - The name of the uploaded file to retrieve.
Returns:
The requested uploaded file, or null if no such file exists.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.
DecodeException - If the uploaded file cannot be decoded for some reason.

getUploadedFiles

public UploadedFile[] getUploadedFiles(java.lang.String folderName)
                                throws com.sleepycat.je.DatabaseException
Retrieves the set of uploaded files associated with the specified folder. The files returned will not include the actual file data.

Parameters:
folderName - The name of the folder for which to retrieve the uploaded files.
Returns:
The set of uploaded files associated with the specified folder, or null if there is no such folder.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

writeUploadedFile

public void writeUploadedFile(UploadedFile uploadedFile,
                              java.lang.String folderName)
                       throws com.sleepycat.je.DatabaseException
Writes information about the provided uploaded file into the configuration database. If the file already exists, then it will be overwritten. Otherwise, it will be added and the corresponding folder will be updated.

Parameters:
uploadedFile - The uploaded file to be written to the configuration database.
folderName - The name of the folder in which the specified file should be placed.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while writing information about the specified file to the configuration database.

removeUploadedFile

public void removeUploadedFile(java.lang.String folderName,
                               java.lang.String fileName)
                        throws com.sleepycat.je.DatabaseException
Removes information about the specified uploaded file from the configuration database.

Parameters:
folderName - The name of the folder from which to remove the file.
fileName - The name of the uploaded file to remove.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getJobClasses

public JobClass[] getJobClasses()
                         throws com.sleepycat.je.DatabaseException
Retrieves the set of job classes defined in the configuration database.

Returns:
The set of job classes defined in the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while obtaining the set of job classes.

addJobClass

public void addJobClass(java.lang.String className)
                 throws com.sleepycat.je.DatabaseException
Adds information about the specified job class to the configuration database.

Parameters:
className - The name of the job class to add to the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

removeJobClass

public void removeJobClass(java.lang.String className)
                    throws com.sleepycat.je.DatabaseException
Removes information about the specified job class from the configuration database.

Parameters:
className - The job class to remove from the configuration database.
Throws:
com.sleepycat.je.DatabaseException - If a problem occurs while interacting with the configuration database.

getConfigSubscribers

public ConfigSubscriber[] getConfigSubscribers()
Retrieves the set of config subscribers that have been registered with the configuration database.

Returns:
The set of config subscribers that have been registered with the configuration database.

getSafeName

public static java.lang.String getSafeName(ConfigSubscriber subscriber)
Retrieves a "safe" name for the provided configuration subscriber, which is suitable for submission in an HTML form.

Parameters:
subscriber - The configuration subscriber for which to retrieve the safe name.
Returns:
The safe name for the provided configuration subscriber.

subscriberForSafeName

public ConfigSubscriber subscriberForSafeName(java.lang.String name)
Retrieves the configuration subscriber that corresponds to the provided "safe" name. The safe name will be generated by converting the subscriber name to all lowercase characters and replacing any spaces with underscores.

Parameters:
name - The safe name for which to retrieve the corresponding config subscriber.
Returns:
The config subscriber for the provided safe name, or null if there is no such subscriber.

registerAsSubscriber

public void registerAsSubscriber(ConfigSubscriber subscriber)
Registers the provided configuration subscriber to be notified of changes to configuration parameters in the database.

Parameters:
subscriber - The configuration subscriber with which to register.