Package de.espirit.firstspirit.access
Interface ServerActionHandle<T extends ActionProgress,R extends Serializable>
- Type Parameters:
T
- Type ofActionProgress
.R
- Type of result.
public interface ServerActionHandle<T extends ActionProgress,R extends Serializable>
This interface provides methods to handle server actions like e.g.
ProjectStorage.startExport(de.espirit.firstspirit.access.export.ExportParameters)
and gives access to the progress
of the related
action.- Since:
- 4.0.13
-
Method Summary
Modifier and TypeMethodDescriptionCancel the related server action.void
Checks, whether an exception has yet occurred during the execution of the related server action and throws it, if any.int
Returns the unique id of the belonging server action.Returns the name of the belonging server action.getProgress
(boolean removeActionIfFinished) Returns the current action progress of the related server action since the last progress poll.
The recommended delay between polls is 1 to 2 seconds.CallsgetResult(false)
getResult
(boolean removeAction) Blocks until the execution of the related server action has been finished.boolean
Indicates wether the related server action is still running, or not.
-
Method Details
-
getActionName
String getActionName()Returns the name of the belonging server action.- Returns:
- the name
String
- Since:
- 4.0.9
-
getActionId
int getActionId()Returns the unique id of the belonging server action.- Returns:
- the action id
- Since:
- 4.0.9
-
getProgress
Returns the current action progress of the related server action since the last progress poll.
The recommended delay between polls is 1 to 2 seconds.- Parameters:
removeActionIfFinished
- Iftrue
, the action will be removed, if finished.- Returns:
- the current action progress
- Throws:
ServerActionNotFoundException
- if the related server action not longer exists on the server.- Since:
- 4.0.9
-
checkAndThrow
Checks, whether an exception has yet occurred during the execution of the related server action and throws it, if any. This call does not block. UsegetResult()
if you want to know if the action completed successfully.- Throws:
Exception
- if an exception has yet occurred during execution of the related server action.- Since:
- 4.0.13
-
getResult
CallsgetResult(false)
- Returns:
- the result of the action
- Throws:
Exception
- if the server action throws an exception.- Since:
- 4.0.13
-
getResult
Blocks until the execution of the related server action has been finished. Call this method withtrue
if you don't want to callgetProgress(boolean)
afterwards to ensure action will be removed on server.- Parameters:
removeAction
- usetrue
to remove the belonging server action after this call- Returns:
- the result of the action
- Throws:
Exception
- if the server action throws an exception.- Since:
- 4.1.27
-
cancelAction
Cancel the related server action.- Returns:
- Type of
ActionProgress
- Throws:
ServerActionNotFoundException
- if the related server action not longer exists on the server.- Since:
- 4.0.9
-
isRunning
Indicates wether the related server action is still running, or not.- Returns:
true
, if the server action is still running,false
, otherwise- Throws:
ServerActionNotFoundException
- if the related server action not longer exists on the server.- Since:
- 4.0.9
-