Class ResumableWorkflowOperationHandlerBase
java.lang.Object
org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
org.opencastproject.workflow.handler.workflow.ResumableWorkflowOperationHandlerBase
- All Implemented Interfaces:
ResumableWorkflowOperationHandler,WorkflowOperationHandler
- Direct Known Subclasses:
ConfigureByDublinCoreTermWOH,ErrorResolutionWorkflowOperationHandler,TagByDublinCoreTermWOH,VideoEditorWorkflowOperationHandler
public class ResumableWorkflowOperationHandlerBase
extends AbstractWorkflowOperationHandler
implements ResumableWorkflowOperationHandler
Abstract base implementation for a resumable operation handler, which implements a simple operations for starting an
operation, returning a
WorkflowOperationResult with the current mediapackage and WorkflowOperationResult.Action.PAUSE and
resuming an operation, returning a WorkflowOperationResult with the current mediapackage and
WorkflowOperationResult.Action.CONTINUE.-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
AbstractWorkflowOperationHandler.Configuration -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.osgi.service.component.ComponentContextOSGi component context, obtained during component activationprotected StringTitle of this hold stateprotected StaticResourceThe static resource representing the hold state uiprotected org.osgi.framework.ServiceRegistrationReference to the static resource serviceFields inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
description, id, serviceRegistry, SOURCE_FLAVOR, SOURCE_FLAVORS, SOURCE_TAG, SOURCE_TAGS, TARGET_FLAVOR, TARGET_FLAVORS, TARGET_TAG, TARGET_TAGS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext componentContext) Activates this component with its properties once all of the collaborating services have been setvoidCallback from the OSGi environment on component shutdown.Returns the title for the link to this operations hold state UI.getHoldStateUserInterfaceURL(WorkflowInstance workflowInstance) Gets the URL for the user interface for resuming the workflow.booleanWhether this operation handler will always pause.protected StringregisterHoldStateUserInterface(String resourcePath) Registers the resource identified byresourcePathas the ui to be displayed during hold.resume(WorkflowInstance workflowInstance, JobContext context, Map<String, String> properties) Continues a suspendedWorkflowInstance.protected voidsetHoldActionTitle(String title) Sets the title that is displayed on the hold state ui.start(WorkflowInstance workflowInstance, JobContext context) Runs the workflow operation on thisWorkflowInstance.Methods inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
applyTargetTagsToElement, asList, createResult, createResult, createResult, createResult, destroy, equals, getCfg, getConfig, getConfig, getConfig, getDescription, getFileNameFromElements, getId, getOptConfig, getOptConfig, getTagsAndFlavors, getTagsAndFlavors, hashCode, setJobBarrierPollingInterval, setServiceRegistry, skip, toString, waitForStatus, waitForStatusMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opencastproject.workflow.api.WorkflowOperationHandler
destroy, getDescription, getId, skip
-
Field Details
-
componentContext
protected org.osgi.service.component.ComponentContext componentContextOSGi component context, obtained during component activation -
staticResourceRegistration
protected org.osgi.framework.ServiceRegistration staticResourceRegistrationReference to the static resource service -
staticResource
The static resource representing the hold state ui -
holdActionTitle
Title of this hold state
-
-
Constructor Details
-
ResumableWorkflowOperationHandlerBase
public ResumableWorkflowOperationHandlerBase()
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext componentContext) Activates this component with its properties once all of the collaborating services have been set- Overrides:
activatein classAbstractWorkflowOperationHandler- Parameters:
componentContext- The component's context, containing the properties used for configuration- See Also:
-
deactivate
public void deactivate()Callback from the OSGi environment on component shutdown. Make sure to call this super implementation when overwriting this class. -
getHoldStateUserInterfaceURL
public String getHoldStateUserInterfaceURL(WorkflowInstance workflowInstance) throws WorkflowOperationException Gets the URL for the user interface for resuming the workflow.- Specified by:
getHoldStateUserInterfaceURLin interfaceResumableWorkflowOperationHandler- Parameters:
workflowInstance- The workflow instance- Returns:
- The URL for the user interface
- Throws:
WorkflowOperationException- If the url to the hold state ui can't be created- See Also:
-
setHoldActionTitle
Sets the title that is displayed on the hold state ui.- Parameters:
title- the title
-
getHoldActionTitle
Returns the title for the link to this operations hold state UI.- Specified by:
getHoldActionTitlein interfaceResumableWorkflowOperationHandler- Returns:
- title to be displayed
- See Also:
-
registerHoldStateUserInterface
Registers the resource identified byresourcePathas the ui to be displayed during hold.- Parameters:
resourcePath- the path to the resource- Returns:
- the URL that was created when registering the resource
-
start
public WorkflowOperationResult start(WorkflowInstance workflowInstance, JobContext context) throws WorkflowOperationException Runs the workflow operation on thisWorkflowInstance. If the execution fails for some reason, this must throw aWorkflowOperationExceptionin order to handle the problem gracefully. Runtime exceptions will cause the entire workflow instance to fail. This default implementation will put the workflow into the hold state.- Specified by:
startin interfaceWorkflowOperationHandler- Specified by:
startin classAbstractWorkflowOperationHandler- Parameters:
workflowInstance- the workflow instancecontext- the job context- Returns:
- the
WorkflowOperationResultcontaining a potentially modified MediaPackage and whether to put the workflow instance into a wait state. - Throws:
WorkflowOperationException- If the workflow operation fails to execute properly, and the default error handling should be invoked.- See Also:
-
resume
public WorkflowOperationResult resume(WorkflowInstance workflowInstance, JobContext context, Map<String, String> properties) throws WorkflowOperationExceptionContinues a suspendedWorkflowInstance. If the execution fails for some reason, this must throw aWorkflowOperationExceptionin order to handle the problem gracefully. Runtime exceptions will cause the entire workflow instance to fail. If the workflow instance is not in a suspended state, this method should throw anIllegalStateException.- Specified by:
resumein interfaceResumableWorkflowOperationHandler- Parameters:
workflowInstance- The workflow instancecontext- the job contextproperties- The properties added while the operation was on hold- Returns:
- the result of this operation
- Throws:
WorkflowOperationException- If the workflow operation fails to execute properly.- See Also:
-
isAlwaysPause
public boolean isAlwaysPause()Description copied from interface:ResumableWorkflowOperationHandlerWhether this operation handler will always pause. The workflow service may give preferential dispatching to operations that are guaranteed to pause.- Specified by:
isAlwaysPausein interfaceResumableWorkflowOperationHandler- Returns:
- whether this handler always pauses
-