com.sun.slamd.server
Class ConfigHandler

java.lang.Object
  extended bycom.sun.slamd.server.ConfigHandler

public class ConfigHandler
extends java.lang.Object

This class handles all interaction with the LDAP directory used to store the SLAMD configuration. In addition to working with configuration, this class provides methods for storing and retrieving scheduler information and the status of jobs in progress or that have been completed.


Constructor Summary
ConfigHandler(SLAMDServer slamdServer)
          Creates a new configuration handler that will be associated with the provided SLAMD server.
 
Method Summary
 void addJobClass(JobClass jobClass)
          Adds information about the provided SLAMD job class into the configuration directory.
 void addJobFolder(java.lang.String folderName, boolean displayInReadOnlyMode)
          Attempts to create the specified folder in the configuration directory.
 void addJobsToVirtualFolder(java.lang.String folderName, java.lang.String[] jobIDs)
          Adds the specified set of job IDs to the named virtual folder.
 void addOptimizingJob(OptimizingJob optimizingJob, java.lang.String folderName)
          Adds information about the provided optimizing job into the configuration directory.
 void addScheduledJob(Job job, java.lang.String folderName)
          Writes information about the specified job into the configuration directory so that it will remain scheduled even if the SLAMD server is shut down and restarted for some reason.
 void addUploadedFile(java.lang.String folderName, UploadedFile uploadedFile)
          Adds the specified file to the specified folder in the configuration directory.
 void closeConfigHandler()
          Closes the connection to the configuration directory.
 void createVirtualFolder(java.lang.String folderName, java.lang.String folderFilter, java.lang.String[] jobIDs, boolean displayInReadOnlyMode)
          Creates a new virtual job folder with the provided information.
 void deleteScheduledJob(java.lang.String jobID)
          Removes information about the specified job from the configuration directory.
 void deleteScheduledJobNoCheck(java.lang.String jobID)
          Removes information about the specified job from the configuration directory.
 void deregisterAsSubscriber(ConfigSubscriber configSubscriber)
          Deregisters the specified subscriber so that it is no longer notified of changes to the configuration.
 Job[] doJobSearch(java.lang.String searchFilter)
          Performs a search in the configuration directory that retrieves all jobs matching the provided filter.
 Job[] doSummaryJobSearch(java.lang.String searchFilter)
          Performs a search in the configuration directory to retrieve all jobs matching the provided search filter.
 Job[] getCompletedJobs(java.lang.String folderName)
          Retrieves the set of jobs that have been completed in the requested folder.
 Job[] getCompletedNonOptimizingJobs(java.lang.String folderName)
          Retrieves the set of jobs that have been completed in the requested folder, excluding any jobs that are iterations of an optimizing job.
 ConfigSubscriber[] getConfigSubscribers()
          Retrieves the set of configuration subscribers registered with this configuration handler.
 void getFolderExportData(java.lang.String folderName, java.io.PrintWriter writer)
          Exports the contents of the specified real job folder.
 Job getJob(java.lang.String jobID)
          Retrieves the specified job from the configuration directory.
 JobFolder getJobFolder(java.lang.String folderName)
          Retrieves the requested real job folder from the configuration directory.
 java.lang.String getJobFolderDN(java.lang.String folderName)
          Retrieves the DN of the entry for the specified job folder.
 java.lang.String getJobFolderName(java.lang.String folderDN)
          Retrieves the name of the job folder defined in the entry with the provided DN.
 JobFolder[] getJobFolders()
          Retrieves the real job folders that are currently defined in the configuration directory.
 Job[] getJobsForState(int jobState)
          Retrieves the set of jobs from the configuration directory that have the specified state.
 Job getJobUnlocked(java.lang.String jobID)
          Retrieves the specified job from the configuration directory.
 OptimizingJob getOptimizingJob(java.lang.String optimizingJobID)
          Retrieves the optimizing job with the specified job ID from the configuration directory.
 OptimizingJob[] getOptimizingJobs(java.lang.String folderName)
          Retrieves the set of optimizing jobs that have been defined in the configuration directory in the specified folder.
 OptimizingJob getOptimizingJobUnlocked(java.lang.String optimizingJobID)
          Retrieves the optimizing job with the specified job ID from the configuration directory.
 java.lang.String getParameter(java.lang.String parameterName)
          Retrieves the value of the specified configuration parameter.
 java.lang.String getParentDN(java.lang.String dn)
          Retrieves the DN of the parent of the specified DN.
 java.lang.String getSafeName(ConfigSubscriber subscriber)
          Retrieves a "safe" version of the subscriber name that may be used as an HTTP parameter in the admin interface.
 Job[] getSummaryJobs(java.lang.String[] jobIDs)
          Retrieves the specified jobs from the configuration directory.
 OptimizingJob[] getUncompletedOptimizingJobs()
          Retrieves the set of optimizing jobs that have been defined in the configuration directory and have not yet completed execution.
 UploadedFile getUploadedFile(java.lang.String folderName, java.lang.String fileName)
          Retrieves the requested file from the configuration directory.
 UploadedFile[] getUploadedFiles(java.lang.String folderName)
          Retrieves the set of files that have been uploaded into the specified folder of the configuration directory.
 void getVirtualFolderExportData(java.lang.String folderName, java.io.PrintWriter writer)
          Exports the contents of the specified virtual job folder.
 JobFolder getVirtualJobFolder(java.lang.String folderName)
          Retrieves the requested virtual job folder from the configuration directory.
 JobFolder[] getVirtualJobFolders()
          Retrieves the virtual job folders that are currently defined in the configuration directory.
 Job[] getVirtualJobs(java.lang.String folderName)
          Retrieves the jobs contained in the virtual folder with the specified folder name.
 boolean jobIDInUse(java.lang.String jobID)
          Indicates whether the specified job ID is already assigned to a job in the configuration directory (regardless of the job state).
 void moveJob(java.lang.String jobID, java.lang.String folderName)
          Moves the job with the specified job ID from its current location into the specified job folder.
 void moveOptimizingJob(java.lang.String optimizingJobID, java.lang.String folderName)
          Moves the optimizing job with the specified job ID from its current location into the specified job folder.
 void notifySubscribers()
          Notifies all the configuration subscribers that they should refresh their configuration.
 void notifySubscribers(java.lang.String parameterName)
          Notifies all the configuration subscribers that they should refresh their configuration for the specified parameter.
 void processDataImport(java.lang.String importFile, java.io.PrintWriter writer)
          Handles the work of importing the data in the specified file into the SLAMD server's database.
 void readConfiguration()
          Retrieves the SLAMD server configuration from the configuration directory server.
 void readConfigurationParameter(java.lang.String parameterName)
          Reads the value of the specified configuration parameter from the config directory and stores it in the configuration.
 JobClass[] readJobClasses()
          Reads the job class definitions stored in the configuration directory.
 void reconnectIfNecessary()
          Checks to see if the connection to the configuration directory is still valid.
 void refreshConfiguration()
          Causes the configuration handler to reload all the configuration data stored in the configuration directory and notify all subscribers that they should refresh their configuration as well.
 void refreshConfiguration(java.lang.String parameterName)
          Causes the configuration handler to reload information about the specified parameter from the configuration directory and notify all subscribers that the specified parameter may have changed.
 boolean registerAsSubscriber(ConfigSubscriber configSubscriber)
          Registers the provided configuration subscriber so that it will be notified of any changes that are made to the configuration.
 void removeFromVirtualFolders(java.lang.String jobID)
          Removes the specified job from any virtual folders that may contain it.
 void removeJobClass(java.lang.String className)
          Removes the specified class from the list of available job classes in the configuration directory.
 void removeJobFolder(java.lang.String folderName, boolean removeFolderData)
          Removes a job folder from the configuration directory.
 void removeJobsFromVirtualFolder(java.lang.String folderName, java.lang.String[] jobIDs)
          Removes the specified set of job IDs from the named virtual folder.
 void removeOptimizingJob(java.lang.String optimizingJobID)
          Removes information about the specified optimizing job from the configuration directory.
 void removeUploadedFile(java.lang.String folderName, java.lang.String fileName)
          Removes the specified file from the given folder.
 void removeVirtualFolder(java.lang.String folderName)
          Removes a virtual job folder definition from the configuration directory.
 java.lang.String replaceText(java.lang.String originalString, java.lang.String textToFind, java.lang.String replaceWith)
          Replaces all occurrences of the specified text in the provided string with the given value.
 void setJobCache(JobCache jobCache)
          Specifies the job cache that is associated with this config handler and the SLAMD server.
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue, boolean notifySubscribers)
          Specifies the new value to use for the given configuration parameter.
 void setReRunIteration(OptimizingJob optimizingJob, Job reRunIteration)
          Specifies the iteration of the optimizing job that is a re-run of the best iteration found during normal job processing.
 void sortJobs(Job[] jobArray)
          Sorts the provided set of jobs based on their scheduled start times.
 void sortOptimizingJobs(OptimizingJob[] jobArray)
          Sorts the provided set of optimizing jobs based on their scheduled start times.
 ConfigSubscriber subscriberForSafeName(java.lang.String safeSubscriberName)
          Retrieves the configuration subscriber that has the specified "safe" name.
 void updateCompletedJob(Job job)
          Updates the directory entry for a job to indicate that processing on that job has been completed.
 void updateFileType(java.lang.String folderName, java.lang.String fileName, java.lang.String newType)
          Updates the MIME type for the specified uploaded file.
 void updateFolderForReadOnlyMode(java.lang.String folderName, boolean displayInReadOnlyMode, boolean updateFolderJobs)
          Updates the specified job folder to either publish or un-publish the folder and optionally all the jobs it contains for display in restricted read-only mode.
 void updateJobComments(java.lang.String jobID, java.lang.String jobDescription, java.lang.String jobComments, boolean displayInReadOnlyMode)
          Updates the description and/or set of comments associated with a job.
 void updateJobFolderDescription(java.lang.String folderName, java.lang.String description, boolean displayInReadOnlyMode)
          Updates the description of the indicated real or virtual job folder.
 void updateJobForReadOnlyMode(java.lang.String jobID, boolean displayInReadOnlyMode)
          Updates the specified job to indicate whether it should be displayed in restricted read-only mode.
 void updateJobStatus(java.lang.String jobID, int jobState, boolean setStartTime, boolean setStopTime)
          Updates the job state information for the specified job in the configuration directory.
 void updateOptimizingJob(OptimizingJob optimizingJob, java.lang.Integer jobState, java.util.Date actualStartTime, java.util.Date actualStopTime, java.lang.String stopReason, Job newJobIteration)
          Updates one or more pieces of information about the optimizing job in the the configuration directory.
 void updateOptimizingJobForReadOnlyMode(java.lang.String optimizingJobID, boolean displayInReadOnlyMode)
          Updates the specified optimizing job to indicate whether it should be displayed in restricted read-only mode.
 void updateScheduledJob(Job job, boolean jobDisabled, java.lang.String description, java.util.Date startTime, java.util.Date stopTime, int duration, int numClients, java.lang.String[] requestedClients, java.lang.String[] monitorClients, boolean monitorClientsIfAvailable, boolean waitForClients, int threadsPerClient, int threadStartupDelay, java.lang.String[] dependencies, java.lang.String[] notifyAddresses, int collectionInterval, java.lang.String comments, Parameter[] parameters, boolean displayInReadOnlyMode)
          Updates the information about the job in the config directory with the new set of information.
 boolean virtualFolderExists(java.lang.String folderName)
          Indicates whether a virtual folder exists with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigHandler

public ConfigHandler(SLAMDServer slamdServer)
              throws SLAMDServerException
Creates a new configuration handler that will be associated with the provided SLAMD server. It will also establish a connection to the configuration directory server to be used for reading/writing configuration and job information.

Parameters:
slamdServer - The SLAMD server that this configuration handler will serve.
Throws:
SLAMDServerException - If there is a problem while attempting to bind to the configuration directory server.
Method Detail

setJobCache

public void setJobCache(JobCache jobCache)
Specifies the job cache that is associated with this config handler and the SLAMD server.

Parameters:
jobCache - The job cache to use for this config handler.

readConfiguration

public void readConfiguration()
                       throws SLAMDServerException
Retrieves the SLAMD server configuration from the configuration directory server.

Throws:
SLAMDServerException - If a problem is encountered while retrieving the configuration from the directory server.

readConfigurationParameter

public void readConfigurationParameter(java.lang.String parameterName)
                                throws SLAMDServerException
Reads the value of the specified configuration parameter from the config directory and stores it in the configuration. If the specified configuration parameter cannot be found in the config directory, then do nothing.

Parameters:
parameterName - The name of the configuration parameter to read from the configuration directory.
Throws:
SLAMDServerException - If a problem is encountered while attempting to interact with the config directory.

jobIDInUse

public boolean jobIDInUse(java.lang.String jobID)
                   throws SLAMDServerException
Indicates whether the specified job ID is already assigned to a job in the configuration directory (regardless of the job state).

Parameters:
jobID - The job ID for which to make the determination.
Returns:
true if a job already exists with the specified job ID, or false if there is no such job.
Throws:
SLAMDServerException - If a problem occurs while making the determination.

addScheduledJob

public void addScheduledJob(Job job,
                            java.lang.String folderName)
                     throws SLAMDServerException
Writes information about the specified job into the configuration directory so that it will remain scheduled even if the SLAMD server is shut down and restarted for some reason.

Parameters:
job - The job for which to update the scheduled job information in the configuration directory.
folderName - The name of the job folder in which the job should be placed.
Throws:
SLAMDServerException - If there is a problem while writing the job information to the configuration directory.

updateScheduledJob

public void updateScheduledJob(Job job,
                               boolean jobDisabled,
                               java.lang.String description,
                               java.util.Date startTime,
                               java.util.Date stopTime,
                               int duration,
                               int numClients,
                               java.lang.String[] requestedClients,
                               java.lang.String[] monitorClients,
                               boolean monitorClientsIfAvailable,
                               boolean waitForClients,
                               int threadsPerClient,
                               int threadStartupDelay,
                               java.lang.String[] dependencies,
                               java.lang.String[] notifyAddresses,
                               int collectionInterval,
                               java.lang.String comments,
                               Parameter[] parameters,
                               boolean displayInReadOnlyMode)
                        throws SLAMDServerException
Updates the information about the job in the config directory with the new set of information.

Parameters:
job - The job for which to make the update.
jobDisabled - Indicates whether the job should be created with a disabled state.
description - A description of the job.
startTime - The time at which the job should start running.
stopTime - The time at which the job should stop running.
duration - The length of time in seconds that the job should run.
numClients - The number of clients on which the job should run.
requestedClients - The set of clients requested for this job.
monitorClients - The set of resource monitor clients requested for this job.
waitForClients - Indicates whether to wait for clients to be available before attempting to start the job.
threadsPerClient - The number of threads that should be used on each client.
threadStartupDelay - The delay in milliseconds to use when starting each thread.
dependencies - The IDs of the jobs on which this job should be dependent.
notifyAddresses - The e-mail addresses of the users that should be notified when the job is done.
collectionInterval - The statistics collection interval for the job.
comments - The set of comments for the job.
parameters - The set of job-specific parameters for the job.
displayInReadOnlyMode - Indicates whether the job should be displayed in restricted read-only mode.
Throws:
SLAMDServerException - If a problem occurs while attempting to update the job information in the config directory.

updateJobForReadOnlyMode

public void updateJobForReadOnlyMode(java.lang.String jobID,
                                     boolean displayInReadOnlyMode)
                              throws SLAMDServerException
Updates the specified job to indicate whether it should be displayed in restricted read-only mode.

Parameters:
jobID - The job ID of the job to be updated.
displayInReadOnlyMode - Indicates whether the job should be displayed in restricted read-only mode.
Throws:
SLAMDServerException - If a problem occurs while updating the job.

updateOptimizingJobForReadOnlyMode

public void updateOptimizingJobForReadOnlyMode(java.lang.String optimizingJobID,
                                               boolean displayInReadOnlyMode)
                                        throws SLAMDServerException
Updates the specified optimizing job to indicate whether it should be displayed in restricted read-only mode.

Parameters:
optimizingJobID - The job ID of the optimizing job to be updated.
displayInReadOnlyMode - Indicates whether the job should be displayed in restricted read-only mode.
Throws:
SLAMDServerException - If a problem occurs while updating the job.

updateFolderForReadOnlyMode

public void updateFolderForReadOnlyMode(java.lang.String folderName,
                                        boolean displayInReadOnlyMode,
                                        boolean updateFolderJobs)
                                 throws SLAMDServerException
Updates the specified job folder to either publish or un-publish the folder and optionally all the jobs it contains for display in restricted read-only mode.

Parameters:
folderName - The name of the folder to be updated.
displayInReadOnlyMode - Indicates whether the folder and optionally included jobs should be displayed in restricted read-only mode.
updateFolderJobs - Indicates whether the jobs included in the folder should also be updated.
Throws:
SLAMDServerException - If a problem occurs while trying to update the folder and/or jobs.

deleteScheduledJob

public void deleteScheduledJob(java.lang.String jobID)
                        throws SLAMDServerException
Removes information about the specified job from the configuration directory. This should only be done for jobs that are not currently scheduled for execution. If a job is scheduled for execution, then it should first be cancelled and then it can be removed.

Parameters:
jobID - The ID of the job to be removed from the configuration directory.
Throws:
SLAMDServerException - If the specified job is currently scheduled for execution, or if a problem occurs while removing information about the job from the configuration directory.

deleteScheduledJobNoCheck

public void deleteScheduledJobNoCheck(java.lang.String jobID)
                               throws SLAMDServerException
Removes information about the specified job from the configuration directory. Note that this method does not verify whether a job is already running and therefore should only be called by a method that has already confirmed that.

Parameters:
jobID - The ID of the job to be removed from the configuration directory.
Throws:
SLAMDServerException - If the specified job is currently scheduled for execution, or if a problem occurs while removing information about the job from the configuration directory.

addOptimizingJob

public void addOptimizingJob(OptimizingJob optimizingJob,
                             java.lang.String folderName)
                      throws SLAMDServerException
Adds information about the provided optimizing job into the configuration directory.

Parameters:
optimizingJob - The optimizing job that is to be added into the configuration directory.
folderName - The name of the job folder in which the optimizing job should be placed.
Throws:
SLAMDServerException - If a problem occurs while adding the job information to the configuration directory.

removeOptimizingJob

public void removeOptimizingJob(java.lang.String optimizingJobID)
                         throws SLAMDServerException
Removes information about the specified optimizing job from the configuration directory.

Parameters:
optimizingJobID - The optimizing job to be removed from the configuration directory.
Throws:
SLAMDServerException - If a problem occurs while trying to remove the specified optimizing job.

getOptimizingJobs

public OptimizingJob[] getOptimizingJobs(java.lang.String folderName)
                                  throws SLAMDServerException
Retrieves the set of optimizing jobs that have been defined in the configuration directory in the specified folder. Note that the jobs returned will contain only summary information for displaying the jobs in bulk in the admin interface.

Parameters:
folderName - The name of the folder from which to retrieve the set of optimizing jobs.
Returns:
The set of optimizing jobs that have been defined in the configuration directory.
Throws:
SLAMDServerException - If a problem occurs while attempting to retrieve the set of optimizing jobs.

getUncompletedOptimizingJobs

public OptimizingJob[] getUncompletedOptimizingJobs()
                                             throws SLAMDServerException
Retrieves the set of optimizing jobs that have been defined in the configuration directory and have not yet completed execution. Note that the jobs returned will contain only summary information for displaying the jobs in bulk in the admin interface.

Returns:
The set of optimizing jobs that have been defined in the configuration directory and have not yet completed execution.
Throws:
SLAMDServerException - If a problem occurs while attempting to retrieve the set of optimizing jobs.

getOptimizingJob

public OptimizingJob getOptimizingJob(java.lang.String optimizingJobID)
                               throws SLAMDServerException
Retrieves the optimizing job with the specified job ID from the configuration directory.

Parameters:
optimizingJobID - The job ID for the optimizing job to retrieve.
Returns:
The requested optimizing job.
Throws:
SLAMDServerException - If a problem occurs while trying to retrieve the requested optimizing job.

getOptimizingJobUnlocked

public OptimizingJob getOptimizingJobUnlocked(java.lang.String optimizingJobID)
                                       throws SLAMDServerException
Retrieves the optimizing job with the specified job ID from the configuration directory.

Parameters:
optimizingJobID - The job ID for the optimizing job to retrieve.
Returns:
The requested optimizing job.
Throws:
SLAMDServerException - If a problem occurs while trying to retrieve the requested optimizing job.

updateOptimizingJob

public void updateOptimizingJob(OptimizingJob optimizingJob,
                                java.lang.Integer jobState,
                                java.util.Date actualStartTime,
                                java.util.Date actualStopTime,
                                java.lang.String stopReason,
                                Job newJobIteration)
                         throws SLAMDServerException
Updates one or more pieces of information about the optimizing job in the the configuration directory. Note that all parameters other than the optimizing job itself are optional -- if those arguments are not null, then that information will be updated in the configuration directory.

Parameters:
optimizingJob - The optimizing job to be updated.
jobState - The current state for the optimizing job.
actualStartTime - The time at which the first iteration of this optimizing job started running.
actualStopTime - The time at which the last iteration of this optimizing job completed running.
stopReason - The reason that the optimization process stopped.
newJobIteration - The next job iteration that has been scheduled for this optimizing job.
Throws:
SLAMDServerException - If a problem occurs while updating the configuration directory.

setReRunIteration

public void setReRunIteration(OptimizingJob optimizingJob,
                              Job reRunIteration)
                       throws SLAMDServerException
Specifies the iteration of the optimizing job that is a re-run of the best iteration found during normal job processing.

Parameters:
optimizingJob - The optimizing job for which the re-run iteration is to be set.
reRunIteration - The job iteration that is a re-run of the best iteration for the optimizing job.
Throws:
SLAMDServerException - If a problem occurs while attempting to update the optimizing job.

removeFromVirtualFolders

public void removeFromVirtualFolders(java.lang.String jobID)
                              throws SLAMDServerException
Removes the specified job from any virtual folders that may contain it.

Parameters:
jobID - The job ID to remove from any virtual folders.
Throws:
SLAMDServerException - If a problem occurs while removing the job

updateJobStatus

public void updateJobStatus(java.lang.String jobID,
                            int jobState,
                            boolean setStartTime,
                            boolean setStopTime)
                     throws SLAMDServerException
Updates the job state information for the specified job in the configuration directory.

Parameters:
jobID - The job ID for the job to update.
jobState - The new state for this job.
setStartTime - Indicates whether the current time should be used as the actual start time for the job.
setStopTime - Indicates whether the current time should be used as the actual stop time for the job.
Throws:
SLAMDServerException - If there is a problem while attempting to update the state information for the job.

updateJobComments

public void updateJobComments(java.lang.String jobID,
                              java.lang.String jobDescription,
                              java.lang.String jobComments,
                              boolean displayInReadOnlyMode)
                       throws SLAMDServerException
Updates the description and/or set of comments associated with a job.

Parameters:
jobID - The job ID for the job to update.
jobDescription - The new description to use for the job.
jobComments - The new set of comments to use for the job.
displayInReadOnlyMode - Indicates whether the job should be displayed in restricted read-only mode.
Throws:
SLAMDServerException - If there is a problem while attempting to update the comment information for the job.

updateCompletedJob

public void updateCompletedJob(Job job)
                        throws SLAMDServerException
Updates the directory entry for a job to indicate that processing on that job has been completed. This will update the job state, stat trackers, and actual start time, actual stop time, and actual duration.

Parameters:
job - The job that has completed processing.
Throws:
SLAMDServerException - If there is a problem while attempting to update the state information for the job.

getJobsForState

public Job[] getJobsForState(int jobState)
                      throws SLAMDServerException
Retrieves the set of jobs from the configuration directory that have the specified state.

Parameters:
jobState - The state of the jobs to be retrieved.
Returns:
The set of jobs in the specified state.
Throws:
SLAMDServerException - If there is a problem retrieving the job information from the directory.

getCompletedJobs

public Job[] getCompletedJobs(java.lang.String folderName)
                       throws SLAMDServerException
Retrieves the set of jobs that have been completed in the requested folder.

Parameters:
folderName - Specifies the name of the folder in which to look for the completed job information.
Returns:
The set of jobs that have been completed.
Throws:
SLAMDServerException - If there is a problem retrieving the job information from the directory.

getCompletedNonOptimizingJobs

public Job[] getCompletedNonOptimizingJobs(java.lang.String folderName)
                                    throws SLAMDServerException
Retrieves the set of jobs that have been completed in the requested folder, excluding any jobs that are iterations of an optimizing job.

Parameters:
folderName - Specifies the name of the folder in which to look for the completed job information.
Returns:
The set of jobs that have been completed.
Throws:
SLAMDServerException - If there is a problem retrieving the job information from the directory.

getJob

public Job getJob(java.lang.String jobID)
           throws SLAMDServerException
Retrieves the specified job from the configuration directory.

Parameters:
jobID - The job ID of the job to retrieve.
Returns:
The specified job.
Throws:
SLAMDServerException - If there is a problem retrieving the job information from the directory.

getJobUnlocked

public Job getJobUnlocked(java.lang.String jobID)
                   throws SLAMDServerException
Retrieves the specified job from the configuration directory.

Parameters:
jobID - The job ID of the job to retrieve.
Returns:
The specified job.
Throws:
SLAMDServerException - If there is a problem retrieving the job information from the directory.

getSummaryJobs

public Job[] getSummaryJobs(java.lang.String[] jobIDs)
                     throws SLAMDServerException
Retrieves the specified jobs from the configuration directory. The jobs retrieved will only contain a subset of the attributes that should be used for displaying the job summary information.

Parameters:
jobIDs - The job IDs of the jobs to retrieve.
Returns:
The specified set of jobs.
Throws:
SLAMDServerException - If there is a problem retrieving the job information from the directory.

doJobSearch

public Job[] doJobSearch(java.lang.String searchFilter)
                  throws SLAMDServerException
Performs a search in the configuration directory that retrieves all jobs matching the provided filter.

Parameters:
searchFilter - A properly-formed RFC 2254-compliant LDAP search filter to use when querying the directory.
Returns:
The jobs that match the provided search filter.
Throws:
SLAMDServerException - If a problem occurs while attempting to perform the search.

doSummaryJobSearch

public Job[] doSummaryJobSearch(java.lang.String searchFilter)
                         throws SLAMDServerException
Performs a search in the configuration directory to retrieve all jobs matching the provided search filter. The jobs returned will only contain summary information that is sufficient for providing an overview of the job details but not an in-depth look at the job data.

Parameters:
searchFilter - A properly-formed RFC 2254-compliant LDAP search filter to use when querying the directory.
Returns:
The summary jobs that match the provided search filter.
Throws:
SLAMDServerException - If a problem occurs while attempting to perform the search.

getParentDN

public java.lang.String getParentDN(java.lang.String dn)
Retrieves the DN of the parent of the specified DN.

Returns:
The DN of the parent of the specified DN, or null if no parent DN could be determined.

sortJobs

public void sortJobs(Job[] jobArray)
Sorts the provided set of jobs based on their scheduled start times.

Parameters:
jobArray - The array containing the jobs to be sorted.

sortOptimizingJobs

public void sortOptimizingJobs(OptimizingJob[] jobArray)
Sorts the provided set of optimizing jobs based on their scheduled start times.

Parameters:
jobArray - The array containing the optimizing jobs to be sorted.

getJobFolders

public JobFolder[] getJobFolders()
                          throws SLAMDServerException
Retrieves the real job folders that are currently defined in the configuration directory.

Returns:
The real job folders that are currently defined in the configuration directory.
Throws:
SLAMDServerException - If a problem occurs while trying to get the list of job folders.

getJobFolder

public JobFolder getJobFolder(java.lang.String folderName)
                       throws SLAMDServerException
Retrieves the requested real job folder from the configuration directory.

Parameters:
folderName - The name of the real job folder to retrieve.
Returns:
The requested real job folder.
Throws:
SLAMDServerException - If the requested folder cannot be retrieved from the configuration directory.

getJobFolderDN

public java.lang.String getJobFolderDN(java.lang.String folderName)
                                throws SLAMDServerException
Retrieves the DN of the entry for the specified job folder.

Parameters:
folderName - The name of the job folder for which to retrieve the DN.
Returns:
The DN of the entry for the specified job folder.
Throws:
SLAMDServerException - If a problem occurs while attempting to find the DN.

getJobFolderName

public java.lang.String getJobFolderName(java.lang.String folderDN)
                                  throws SLAMDServerException
Retrieves the name of the job folder defined in the entry with the provided DN.

Parameters:
folderDN - The DN of the entry for which to determine the folder name.
Returns:
The name of the job folder associated with the provided entry DN.
Throws:
SLAMDServerException - If a problem occurs while attempting to find the folder name.

getVirtualJobFolders

public JobFolder[] getVirtualJobFolders()
                                 throws SLAMDServerException
Retrieves the virtual job folders that are currently defined in the configuration directory.

Returns:
The virtual job folders that are currently defined in the configuration directory.
Throws:
SLAMDServerException - If a problem occurs while trying to get the list of virtual job folders.

getVirtualJobFolder

public JobFolder getVirtualJobFolder(java.lang.String folderName)
                              throws SLAMDServerException
Retrieves the requested virtual job folder from the configuration directory.

Parameters:
folderName - The name of the virtual job folder to retrieve.
Returns:
The requested virtual job folder.
Throws:
SLAMDServerException - If the requested folder cannot be retrieved from the configuration directory.

createVirtualFolder

public void createVirtualFolder(java.lang.String folderName,
                                java.lang.String folderFilter,
                                java.lang.String[] jobIDs,
                                boolean displayInReadOnlyMode)
                         throws SLAMDServerException
Creates a new virtual job folder with the provided information.

Parameters:
folderName - The name of the virtual job folder to create.
folderFilter - The LDAP search filter to use to dynamically itentify the jobs in this virtual job folder. It may be null if there is no filter.
jobIDs - The job IDs of the jobs to include in this virtual job folder. It may be null if there are no jobs.
displayInReadOnlyMode - Indicates whether this virtual folder should be displayed in restricted read-only mode.
Throws:
SLAMDServerException - If a problem occurs creating the new virtual job folder.

removeVirtualFolder

public void removeVirtualFolder(java.lang.String folderName)
                         throws SLAMDServerException
Removes a virtual job folder definition from the configuration directory.

Parameters:
folderName - The name of the virtual job folder to remove from the configuration directory.
Throws:
SLAMDServerException - If a problem occurs while attempting to remove the virtual job folder.

virtualFolderExists

public boolean virtualFolderExists(java.lang.String folderName)
                            throws SLAMDServerException
Indicates whether a virtual folder exists with the specified name.

Parameters:
folderName - The name of the virtual job folder for which to make the determination.
Returns:
true if the specified virtual folder exists, or false if not.
Throws:
SLAMDServerException - If a problem occurs while making the determination.

addJobsToVirtualFolder

public void addJobsToVirtualFolder(java.lang.String folderName,
                                   java.lang.String[] jobIDs)
                            throws SLAMDServerException
Adds the specified set of job IDs to the named virtual folder.

Parameters:
folderName - The name of the virtual job folder to which the specified jobs are to be added.
jobIDs - The job IDs to add to the virtual folder.
Throws:
SLAMDServerException - If a problem occurs while adding the specified jobs to the virtual folder.

removeJobsFromVirtualFolder

public void removeJobsFromVirtualFolder(java.lang.String folderName,
                                        java.lang.String[] jobIDs)
                                 throws SLAMDServerException
Removes the specified set of job IDs from the named virtual folder.

Parameters:
folderName - The name of the virtual job folder from which the specified jobs are to be removed.
jobIDs - The job IDs to remove from the virtual folder.
Throws:
SLAMDServerException - If a problem occurs while removing the specified jobs from the virtual folder.

getVirtualJobs

public Job[] getVirtualJobs(java.lang.String folderName)
                     throws SLAMDServerException
Retrieves the jobs contained in the virtual folder with the specified folder name.

Parameters:
folderName - The name of the virtual folder for which to retrieve the list of jobs.
Returns:
The jobs contained in the virtual folder with the specified folder name.
Throws:
SLAMDServerException - If a problem occurs while attempting to retrieve the jobs.

addJobFolder

public void addJobFolder(java.lang.String folderName,
                         boolean displayInReadOnlyMode)
                  throws SLAMDServerException
Attempts to create the specified folder in the configuration directory.

Parameters:
folderName - The name of the folder to create in the configuration directory.
displayInReadOnlyMode - Indicates whether the folder and its contents should be displayed in restricted read-only mode.
Throws:
SLAMDServerException - If a problem occurs while trying to create the job folder.

removeJobFolder

public void removeJobFolder(java.lang.String folderName,
                            boolean removeFolderData)
                     throws SLAMDServerException
Removes a job folder from the configuration directory.

Parameters:
folderName - The name of the job folder that is to be removed.
removeFolderData - Indicates whether the contents of the folder should be removed as well.
Throws:
SLAMDServerException - If a problem occurs while trying to remove the job folder.

updateJobFolderDescription

public void updateJobFolderDescription(java.lang.String folderName,
                                       java.lang.String description,
                                       boolean displayInReadOnlyMode)
                                throws SLAMDServerException
Updates the description of the indicated real or virtual job folder.

Parameters:
folderName - The name of the job folder to update.
description - The new description to use for the job folder. If it is null or blank, then the description will be removed. If a description is provided, then it will be be used as the new description for the folder.
displayInReadOnlyMode - Indicates whether this folder and its contents should be displayed in restricted read-only mode.
Throws:
SLAMDServerException - If a problem occurs while trying to update the job folder.

moveJob

public void moveJob(java.lang.String jobID,
                    java.lang.String folderName)
             throws SLAMDServerException
Moves the job with the specified job ID from its current location into the specified job folder.

Parameters:
jobID - The job ID of the job to be moved.
folderName - The name of the new folder in which to place the job.
Throws:
SLAMDServerException - If a problem occurs while trying to move the job.

moveOptimizingJob

public void moveOptimizingJob(java.lang.String optimizingJobID,
                              java.lang.String folderName)
                       throws SLAMDServerException
Moves the optimizing job with the specified job ID from its current location into the specified job folder.

Parameters:
optimizingJobID - The ID of the optimizing job to be moved.
folderName - The name of the new folder in which to place the optimizing job.
Throws:
SLAMDServerException - If a problem occurs while trying to move the optimizing job.

readJobClasses

public JobClass[] readJobClasses()
                          throws SLAMDServerException
Reads the job class definitions stored in the configuration directory.

Returns:
The job threads created from job class definitions stored in the configuration directory.
Throws:
SLAMDServerException - If a problem is encountered while reading the information from the configuration directory.

addJobClass

public void addJobClass(JobClass jobClass)
                 throws SLAMDServerException
Adds information about the provided SLAMD job class into the configuration directory.

Parameters:
jobClass - The job class for which the information is to be added.
Throws:
SLAMDServerException - If a problem is encountered while adding the job class information into the configuration directory.

getUploadedFiles

public UploadedFile[] getUploadedFiles(java.lang.String folderName)
                                throws SLAMDServerException
Retrieves the set of files that have been uploaded into the specified folder of the configuration directory.

Parameters:
folderName - The name of the folder for which to retrieve the uploaded files.
Returns:
The files that have been uploaded into the specified folder of the configuration directory.
Throws:
SLAMDServerException - If a problem occurs while retrieving the file information.

getUploadedFile

public UploadedFile getUploadedFile(java.lang.String folderName,
                                    java.lang.String fileName)
                             throws SLAMDServerException
Retrieves the requested file from the configuration directory.

Parameters:
folderName - The name of the folder from which to retrieve the file.
fileName - The name of the file to retrieve.
Returns:
The requested file, or null if it could not be found.
Throws:
SLAMDServerException - If a problem occurs while attempting to retrieve the requested file.

addUploadedFile

public void addUploadedFile(java.lang.String folderName,
                            UploadedFile uploadedFile)
                     throws SLAMDServerException
Adds the specified file to the specified folder in the configuration directory.

Parameters:
folderName - The name of the folder in which to place the file.
uploadedFile - The file information to upload into the configuration directory.
Throws:
SLAMDServerException - If a problem occurs while adding the file information to the configuration directory.

removeUploadedFile

public void removeUploadedFile(java.lang.String folderName,
                               java.lang.String fileName)
                        throws SLAMDServerException
Removes the specified file from the given folder.

Parameters:
folderName - The name of the folder in which the file is located.
fileName - The name of the file to be removed.
Throws:
SLAMDServerException - If a problem occurs while removing the specified file.

updateFileType

public void updateFileType(java.lang.String folderName,
                           java.lang.String fileName,
                           java.lang.String newType)
                    throws SLAMDServerException
Updates the MIME type for the specified uploaded file.

Parameters:
folderName - The name of the folder in which the file is located.
fileName - The name of the file to be updated.
newType - The new MIME type to use for the file.
Throws:
SLAMDServerException - If a problem occurs while updating the specified file.

replaceText

public java.lang.String replaceText(java.lang.String originalString,
                                    java.lang.String textToFind,
                                    java.lang.String replaceWith)
Replaces all occurrences of the specified text in the provided string with the given value.

Parameters:
originalString - The original string in which the replacements should be made.
textToFind - The text to find in the original string that should be replaced.
replaceWith - The text to use to replace the text to find in the original string.
Returns:
The provided string with all the appropriate replacements made.

removeJobClass

public void removeJobClass(java.lang.String className)
                    throws SLAMDServerException
Removes the specified class from the list of available job classes in the configuration directory.

Parameters:
className - The name of the job class to remove from the configuration directory.
Throws:
SLAMDServerException - If there is a problem removing the specified class.

getFolderExportData

public void getFolderExportData(java.lang.String folderName,
                                java.io.PrintWriter writer)
                         throws SLAMDServerException
Exports the contents of the specified real job folder.

Parameters:
folderName - The name of the real job folder to be exported. If this is null, then the default (unclassified) folder will be exported.
writer - The print writer to which the output data should be written.
Throws:
SLAMDServerException - If a problem occurs while generating the export.

getVirtualFolderExportData

public void getVirtualFolderExportData(java.lang.String folderName,
                                       java.io.PrintWriter writer)
                                throws SLAMDServerException
Exports the contents of the specified virtual job folder.

Parameters:
folderName - The name of the virtual job folder to be exported.
writer - The print writer to which the data is to be written.
Throws:
SLAMDServerException - If a problem occurs while generating the export.

processDataImport

public void processDataImport(java.lang.String importFile,
                              java.io.PrintWriter writer)
Handles the work of importing the data in the specified file into the SLAMD server's database.

Parameters:
importFile - The absolute path to the import file. It must be located on the filesystem of the machine running the SLAMD server.
writer - The print writer that can be used to report progress back to the end user.

getParameter

public java.lang.String getParameter(java.lang.String parameterName)
Retrieves the value of the specified configuration parameter.

Parameters:
parameterName - The name of the configuration parameter for which to retrieve the value.
Returns:
The value of the specified configuration parameter as a String, or null if the specified parameter has not been defined in the configuration.

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue,
                         boolean notifySubscribers)
                  throws SLAMDServerException
Specifies the new value to use for the given configuration parameter. If the parameter already exists, then the value will be replaced. If the parameter does not yet exist, then it will be added.

Parameters:
parameterName - The name of the configuration parameter to be updated.
parameterValue - The value to use for the configuration parameter.
notifySubscribers - Indicates whether the config handler will notify all of the configuration subscribers about this change.
Throws:
SLAMDServerException - If there is a problem making the change in the configuration, or if any of the configuration subscribers complain about it.

closeConfigHandler

public void closeConfigHandler()
Closes the connection to the configuration directory. Once this is done, any attempt to use it will result in an exception. Therefore, this should only be done when the SLAMD server is shutting down.


registerAsSubscriber

public boolean registerAsSubscriber(ConfigSubscriber configSubscriber)
Registers the provided configuration subscriber so that it will be notified of any changes that are made to the configuration.

Parameters:
configSubscriber - The component that is to be subscribed with this configuration handler.
Returns:
true if the subscriber was successfully registered, or false if it could not be for some reason (e.g., there was already a subscriber with the specified name).

deregisterAsSubscriber

public void deregisterAsSubscriber(ConfigSubscriber configSubscriber)
Deregisters the specified subscriber so that it is no longer notified of changes to the configuration.

Parameters:
configSubscriber - The configuration subscriber to be deregistered from the configuration handler.

getConfigSubscribers

public ConfigSubscriber[] getConfigSubscribers()
Retrieves the set of configuration subscribers registered with this configuration handler.

Returns:
The set of configuration subscribers registered with this configuration handler.

getSafeName

public java.lang.String getSafeName(ConfigSubscriber subscriber)
Retrieves a "safe" version of the subscriber name that may be used as an HTTP parameter in the admin interface.

Parameters:
subscriber - The configuration subscriber for which to generate the safe name.
Returns:
The safe name for the specified subscriber.

subscriberForSafeName

public ConfigSubscriber subscriberForSafeName(java.lang.String safeSubscriberName)
Retrieves the configuration subscriber that has the specified "safe" name.

Parameters:
safeSubscriberName - The safe name of the subscriber to retrieve.
Returns:
The requested configuration subscriber, or null if it could not be found.

refreshConfiguration

public void refreshConfiguration()
                          throws SLAMDServerException
Causes the configuration handler to reload all the configuration data stored in the configuration directory and notify all subscribers that they should refresh their configuration as well.

Throws:
SLAMDServerException - If there is a problem while reading the configuration information from the config directory.

refreshConfiguration

public void refreshConfiguration(java.lang.String parameterName)
                          throws SLAMDServerException
Causes the configuration handler to reload information about the specified parameter from the configuration directory and notify all subscribers that the specified parameter may have changed.

Parameters:
parameterName - The name of the configuration parameter
Throws:
SLAMDServerException - If there is a problem while reading the configuration information from the config directory.

notifySubscribers

public void notifySubscribers()
                       throws SLAMDServerException
Notifies all the configuration subscribers that they should refresh their configuration.

Throws:
SLAMDServerException - If any of the configuration subscribers threw an exception while updating their configuration.

notifySubscribers

public void notifySubscribers(java.lang.String parameterName)
                       throws SLAMDServerException
Notifies all the configuration subscribers that they should refresh their configuration for the specified parameter.

Parameters:
parameterName - The name of the configuration parameter that should be refreshed.
Throws:
SLAMDServerException - If any of the configuration subscribers threw an exception while updating their configuration.

reconnectIfNecessary

public void reconnectIfNecessary()
                          throws netscape.ldap.LDAPException
Checks to see if th