Package net.sf.basedb.plugins.executor
Class ExternalProgramExecutor.ResponseWrapper
java.lang.Object
net.sf.basedb.plugins.executor.ExternalProgramExecutor.ResponseWrapper
- All Implemented Interfaces:
Response
- Enclosing class:
- ExternalProgramExecutor
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Response
Response.Status
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) String
(package private) String
getMessage
(String defaultMessage) (package private) boolean
hasError()
void
This can be used in the configuration phase of a plug-in to clear the stored state and nextCommand information.void
setContinue
(String nextCommand) This method will continue the configuration or execution of the job with a new command to the plugin.void
setContinue
(String nextCommand, Serializable state) Can be used by an executing job to also store state information that will be restored when the job is starting up again.void
This will end the job execution and report it as a success.void
setDone
(String message, Job.ExecutionTime estimatedExecutionTime) This will end the configuration of a job and set the estimated execution time for it.void
setDownloadImmediately
(String message, Job.ExecutionTime estimatedExecutionTime, boolean failIfDenied) This will end the configuration of a export job, and start to execute it for immediate download.void
setDryRun
(boolean dryRun) A plug-in may call this method in it's configuration phase or after it has been executed to indicate that the job should be or was executed as a dry-run job.void
This will end the job execution or configuration and report it as a failure.void
setExecuteImmediately
(String message, Job.ExecutionTime estimatedExecutionTime, boolean failIfDenied) This will end the configuration of a job, and start to execute it immediately if the plugin is permitted to do so.void
setPause
(String message, String nextCommand, Serializable state) A plug-in can call this method to notify the core that it has been paused.void
setSuggestedJobName
(String jobName) A plug-in may call this method on it's job configuration phase to suggest a name for the job.
-
Field Details
-
message
-
errors
-
hasError
private boolean hasError
-
-
Constructor Details
-
ResponseWrapper
ResponseWrapper()
-
-
Method Details
-
hasError
boolean hasError() -
getErrors
-
getMessage
String getMessage() -
getMessage
-
setContinue
Description copied from interface:Response
This method will continue the configuration or execution of the job with a new command to the plugin. If the plug-in is currently being configured the configuration will continue with the next command. If the plug-in is currently executing the job will be returned to job queue. The intention is that plug-ins can use this to survive a temporary shutdown of the system after catching theSignal.SHUTDOWN
signal.- Specified by:
setContinue
in interfaceResponse
- Parameters:
nextCommand
- The next command to the plugin- Throws:
PermissionDeniedException
- If another command isn't allowed
-
setContinue
Description copied from interface:Response
Can be used by an executing job to also store state information that will be restored when the job is starting up again. If used in the configuration phase, the state information is ignored.- Specified by:
setContinue
in interfaceResponse
- Parameters:
nextCommand
- The next command to the pluginstate
- State information that will be restored when resuming- Throws:
PermissionDeniedException
- See Also:
-
setPause
Description copied from interface:Response
A plug-in can call this method to notify the core that it has been paused. The job should remain in the job queue. A user may manually decide to either re-configure the job or resume it from where it was paused. Note to plug-in developers: The job will be resumed in a different instance. Any state information that is needed when resuming can be stored in the 'state' parameter. This information will be provided to the plug-in when re-starting. -
setDone
Description copied from interface:Response
This will end the configuration of a job and set the estimated execution time for it. -
setDone
Description copied from interface:Response
This will end the job execution and report it as a success. -
setDownloadImmediately
public void setDownloadImmediately(String message, Job.ExecutionTime estimatedExecutionTime, boolean failIfDenied) throws PermissionDeniedException Description copied from interface:Response
This will end the configuration of a export job, and start to execute it for immediate download. This method is similar to theResponse.setExecuteImmediately(String, Job.ExecutionTime, boolean)
but:- The plugin must implement the
ImmediateDownloadExporter
interface. - The core will call
ImmediateDownloadExporter.doExport(ExportOutputStream, ProgressReporter)
instead of thePlugin.run(Request, Response, ProgressReporter)
method.
- Specified by:
setDownloadImmediately
in interfaceResponse
- Parameters:
message
- An optional messageestimatedExecutionTime
- An estimated execution time for the job, null is the same asExecutionTime.LONG
. This value is only used if immediate execution isn't possible and the job has to be added to the job queue.failIfDenied
- TRUE if a PermissionDeniedException should be thrown if immediate exection isn't possible, FALSE to add the job to the job queue for later exection- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission to the job.
- The plugin must implement the
-
setDryRun
public void setDryRun(boolean dryRun) Description copied from interface:Response
A plug-in may call this method in it's configuration phase or after it has been executed to indicate that the job should be or was executed as a dry-run job. A dry-run job is a job that does all the things a normal job would do except committing the changes to the database. The dry-run job may output a log file with detailed information about what should have happened if it hadn't been a dry-run.NOTE! Setting this value to true doesn't change the behaviour of the core. It is the responsibility of the plug-in to check this value(eg.
Job.isDryRun()
and take appropriate action. -
setSuggestedJobName
Description copied from interface:Response
A plug-in may call this method on it's job configuration phase to suggest a name for the job. Otherwise a default name will be generated by the core.- Specified by:
setSuggestedJobName
in interfaceResponse
-
setError
Description copied from interface:Response
This will end the job execution or configuration and report it as a failure. If in a configuration sequence the client application may try the same command again with different parameters. -
setExecuteImmediately
public void setExecuteImmediately(String message, Job.ExecutionTime estimatedExecutionTime, boolean failIfDenied) throws PermissionDeniedException Description copied from interface:Response
This will end the configuration of a job, and start to execute it immediately if the plugin is permitted to do so. If it is not possible to execute the job immediately it will be added to the job queue for later execution unless thefailIfDenied
flag is set to true, in which case an exception will be thrown.If immediate execution is possible the client application must continue to use the same instance of the plugin object. This means that immediate execution always happens in the same virtual machine. Plugins should be aware of this and avoid excessive use of resources such as memory and CPU time.
The client application may execute the job in another thread.
- Specified by:
setExecuteImmediately
in interfaceResponse
- Parameters:
message
- An optional messageestimatedExecutionTime
- An estimated execution time for the job, null is the same asExecutionTime.LONG
. This value is only used if immediate execution isn't possible and the job has to be added to the job queue.failIfDenied
- TRUE if a PermissionDeniedException should be thrown if immediate exection isn't possible, FALSE to add the job to the job queue for later exection- Throws:
PermissionDeniedException
- If logged in user doesn't have write permission on the job.
-
setClearState
public void setClearState()Description copied from interface:Response
This can be used in the configuration phase of a plug-in to clear the stored state and nextCommand information. The intention is that a PAUSED plug-in that is being re-configured should be able to force a re-start from the beginning if the configuration has changed in a way that restarting from the stored state doesn't make any sense.- Specified by:
setClearState
in interfaceResponse
-