audiojury.action
Class ResultManager

java.lang.Object
  |
  +--audiojury.action.ResultManager
All Implemented Interfaces:
ResultProcessing

public class ResultManager
extends java.lang.Object
implements ResultProcessing

Wrapper for the ResultPlugin. It mostly forwards all requests to the plugin. The class implements the Singleton design pattern, which means there is only one instance of this class. This is necessary to make concurrent access to results impossible.


Method Summary
 int autoImport()
          Fetches results from the shared folder and imports them in the administrator program.
 void createReport(java.lang.String filename, java.util.Vector results)
          Creates a report file from the results of a Project.
static ResultManager getUniqueInstance()
          Enforces the Singleton design pattern by always returning the same instance of ResultManager.
 int manualImport(java.io.File[] resfiles)
          Fetches results from the given files and imports them in the admininstrator program.
 java.util.Vector openResults(java.lang.String projname, int state)
          Returns the result of a specific Project.
 void saveResults(ProjectResults results)
          Saves results from the client.
 void setResultPlugin(ResultPlugin plugin)
          Use this method to choose which result storage plugin (ResultPlugin) to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setResultPlugin

public void setResultPlugin(ResultPlugin plugin)
Use this method to choose which result storage plugin (ResultPlugin) to use.

Parameters:
plugin - The desired ResultPlugin.

openResults

public java.util.Vector openResults(java.lang.String projname,
                                    int state)
                             throws ResultOperationException
Returns the result of a specific Project.

Specified by:
openResults in interface ResultProcessing
Parameters:
projname - A Project name.
state - In which state to look for the Project.
Returns:
A vector of ProjectResults.
Throws:
ResultOperationException - if an unhandled error occurs.

createReport

public void createReport(java.lang.String filename,
                         java.util.Vector results)
                  throws ResultOperationException
Creates a report file from the results of a Project. The report file is comma-separated and can be opened in a spreadsheet program such as Microsoft Excel. Reports are saved in the directory called reports in the AudioJury base directory.

Specified by:
createReport in interface ResultProcessing
Parameters:
filename - The name of the report to create.
results - A vector containing ProjectResults objects.
Throws:
ResultOperationException - if an unhandled error occurs.

manualImport

public int manualImport(java.io.File[] resfiles)
                 throws ResultOperationException
Fetches results from the given files and imports them in the admininstrator program.

Specified by:
manualImport in interface ResultProcessing
Parameters:
resfiles - An array of files containing ProjectResults.
Returns:
The number of results imported.
Throws:
ResultOperationException - if an unhandled error occurs.

autoImport

public int autoImport()
               throws ResultOperationException,
                      NoSharedFolderException
Fetches results from the shared folder and imports them in the administrator program.

Specified by:
autoImport in interface ResultProcessing
Returns:
The number of results imported.
Throws:
ResultOperationException - if an unhandled error occurs.
NoSharedFolderException - if no shared folder could be found.

saveResults

public void saveResults(ProjectResults results)
                 throws ResultOperationException
Saves results from the client.

Specified by:
saveResults in interface ResultProcessing
Parameters:
results - The ProjectResults to save.
Throws:
ResultOperationException - if an unhandled error occurs.

getUniqueInstance

public static ResultManager getUniqueInstance()
Enforces the Singleton design pattern by always returning the same instance of ResultManager. This should be used instead of a constructor.

Returns:
A unique single ResultManager instance.