com.cosylab.jcosyne.server
Interface ResultRepositoryMBean

All Superinterfaces:
RemoteTaskMBean, java.lang.Runnable
All Known Implementing Classes:
ResultRepository

public interface ResultRepositoryMBean
extends RemoteTaskMBean

MBean compliant interface to the result repository. See ResultRepository for more concise descriptions.

See Also:
ResultRepository

Method Summary
 void deleteRecord(RemoteTaskInvocation rti, boolean outputs)
          Deletes the record from the index directory and optionally deletes the result files as well.
 byte[] getInputFile(java.lang.String name)
          File transfer of the input file as a byte array.
 java.lang.String getInputRepositoryPath()
          Returns a concatenation of the repository root and the input directory name.
 byte[] getOutputFile(java.lang.String name)
          File transfer of the output file as a byte array.
 java.lang.String getOutputRepositoryPath()
          Returns a concatenation of the repository root and the output directory name.
 RemoteTaskInvocation[] getRecords(java.util.Map criteria)
          Returns a list of existing records that match supplied criteria.
 java.lang.String getRepositoryRoot()
          Returns the value of the repository root attribute.
 boolean isRecording()
          Returns true iff this repository is writing indices in response to task executions.
 java.lang.String requestInputFilename(javax.management.ObjectName task, java.lang.String name)
          Returns a fully qualified filename of the input resource.
 java.lang.String requestOutputFilename(javax.management.ObjectName task, java.lang.String sub)
          Creates a fully qualified output file name, constructed by concatenation of user home directory, output repository path, the directory that is computed from today's date and the filename.
 void setRecording(boolean recording)
          Usually set by the JMX server on the basis of the server properties.
 void setRepositoryRoot(java.lang.String pathRelativeToHome)
          Called by JMX server to set the path relative to user's home where repository will place its index, out and in directories.
 int storeRecord(RemoteTaskInvocation rti, boolean assignNewID)
          Stores the record to the permanent storage.
 
Methods inherited from interface com.cosylab.jcosyne.server.RemoteTaskMBean
copyStateFrom, copyStateFrom, equals, executeScript, getLastScriptResult, getName, getPostExecutionScript, getPostInitializactionScript, getProgress, getState, hashCode, initialize, isFinished, isInitialized, isReadyToRun, isRunning, isSuspended, setPostExecutionScript, setPostInitializationScript, setRunning, setSuspended
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

setRepositoryRoot

public void setRepositoryRoot(java.lang.String pathRelativeToHome)
Called by JMX server to set the path relative to user's home where repository will place its index, out and in directories.

Parameters:
pathRelativeToHome - the path to set without trailing and prefixing path separator characters

getRepositoryRoot

public java.lang.String getRepositoryRoot()
Returns the value of the repository root attribute.

Returns:
the path relative to user's home where repository root starts

getOutputRepositoryPath

public java.lang.String getOutputRepositoryPath()
Returns a concatenation of the repository root and the output directory name. This is still not the absolute pathname, because it must be prefixed with user's home.

Returns:
the directory where output files are stored

getInputRepositoryPath

public java.lang.String getInputRepositoryPath()
Returns a concatenation of the repository root and the input directory name. This is still not the absolute pathname, because it must be prefixed with user's home.

Returns:
the directory where input files are stored

requestOutputFilename

public java.lang.String requestOutputFilename(javax.management.ObjectName task,
                                              java.lang.String sub)
Creates a fully qualified output file name, constructed by concatenation of user home directory, output repository path, the directory that is computed from today's date and the filename.

Parameters:
task - the task which is requiring a new output filename
sub - additional info to put in filename if the same task requests multiple output files; can be null for default filename
Returns:
absolute filename; note that all paths do not necessarily exist

requestInputFilename

public java.lang.String requestInputFilename(javax.management.ObjectName task,
                                             java.lang.String name)
Returns a fully qualified filename of the input resource. The name is obtained by concatenation of user's home directory, input repository path and the supplied name.

Parameters:
task - requesting access to the input resource
name - the name of the input resource.
Returns:
fully qualified input file name

isRecording

public boolean isRecording()
Returns true iff this repository is writing indices in response to task executions.

Returns:
true iff this repository is keeping results on permanent storage of current activities

setRecording

public void setRecording(boolean recording)
Usually set by the JMX server on the basis of the server properties. See accessor.

Parameters:
recording - true iff the repository should record to permanent storage the results of remote task processing; if false the repository does nothing

getRecords

public RemoteTaskInvocation[] getRecords(java.util.Map criteria)
Returns a list of existing records that match supplied criteria.

Parameters:
criteria - a map of (string name, string value) pairs. Names of criteria are defined in Constants and the range of the values as well.
Returns:
an array of all matching records, will not be null
See Also:
Constants

getInputFile

public byte[] getInputFile(java.lang.String name)
File transfer of the input file as a byte array. Can be to remote target because byte arrays are serializable by default. To reconstruct the file at the receiving end, read the byte array into java.io.ByteArrayInputStream.

Parameters:
name - the name of the input resource relative to the repository input path.
Returns:
the byte array representing the file

getOutputFile

public byte[] getOutputFile(java.lang.String name)
File transfer of the output file as a byte array. Can be to remote target because byte arrays are serializable by default. To reconstruct the file at the receiving end, read the byte array into java.io.ByteArrayInputStream.

Parameters:
name - the name of the output resource relative to the repository output path.
Returns:
the byte array representing the file

storeRecord

public int storeRecord(RemoteTaskInvocation rti,
                       boolean assignNewID)
Stores the record to the permanent storage. Used to store records that have been modified by the user in a client.

Parameters:
rti - invocation to store
assignNewID - if true, then a new, free, unique ID will be found in the repository and rti will be updated to carry that ID; if false the ID in rti will be used, possibly overwriting exising record if it has the same ID.
Returns:
the ID actually used to store the record

deleteRecord

public void deleteRecord(RemoteTaskInvocation rti,
                         boolean outputs)
Deletes the record from the index directory and optionally deletes the result files as well.

Parameters:
rti - the rti used to get ID from which the index file is calculated
outputs - if true all output files specified by the rti will be deleted as well