Class ImageWorkflowOperationHandler
java.lang.Object
org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler
- All Implemented Interfaces:
WorkflowOperationHandler
The workflow definition for handling "image" operations
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
AbstractWorkflowOperationHandler.Configuration -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final doubleFields 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 TypeMethodDescriptionprotected voidadjustMetadata(org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Extraction extraction, Attachment image, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Cfg cfg) Adjust flavor, tags, mime type ofimageaccording to the configuration and the extraction.protected StringcreateFileName(String suffix, URI trackUri, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.MediaPosition pos, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Cfg cfg) Create a file name for the extracted image.protected JobextractImages(ImageWorkflowOperationHandler handler, Track track, EncodingProfile profile, List<org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.MediaPosition> positions, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Cfg cfg) Start a composer job to extract images from a track at the given positions.static EncodingProfilefetchProfile(ComposerService composerService, String profileName) Fetch a profile from the composer service.protected voidmoveToWorkspace(ImageWorkflowOperationHandler handler, MediaPackage mp, Attachment image, String fileName) Move the extractedimageto its final location in the workspace and rename it tofileName.protected voidsetComposerService(ComposerService composerService) Callback for the OSGi declarative services configuration.voidsetServiceRegistry(ServiceRegistry serviceRegistry) Sets the service registry.voidsetWorkspace(Workspace workspace) Callback for declarative services configuration that will introduce us to the local workspace service.start(WorkflowInstance wi, JobContext ctx) Runs the workflow operation on thisWorkflowInstance.Methods inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
activate, applyTargetTagsToElement, asList, createResult, createResult, createResult, createResult, destroy, equals, getCfg, getConfig, getConfig, getConfig, getDescription, getFileNameFromElements, getId, getOptConfig, getOptConfig, getTagsAndFlavors, hashCode, setJobBarrierPollingInterval, skip, toString, waitForStatus, waitForStatus
-
Field Details
-
OPT_PROFILES
- See Also:
-
OPT_POSITIONS
- See Also:
-
OPT_TARGET_BASE_NAME_FORMAT_SECOND
- See Also:
-
OPT_TARGET_BASE_NAME_FORMAT_PERCENT
- See Also:
-
OPT_END_MARGIN
- See Also:
-
SINGLE_FRAME_POS
public static final double SINGLE_FRAME_POS- See Also:
-
-
Constructor Details
-
ImageWorkflowOperationHandler
public ImageWorkflowOperationHandler()
-
-
Method Details
-
setComposerService
Callback for the OSGi declarative services configuration.- Parameters:
composerService- the composer service
-
setWorkspace
Callback for declarative services configuration that will introduce us to the local workspace service. Implementation assumes that the reference is configured as being static.- Parameters:
workspace- an instance of the workspace
-
start
public WorkflowOperationResult start(WorkflowInstance wi, JobContext ctx) throws WorkflowOperationException Description copied from class:AbstractWorkflowOperationHandlerRuns 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.- Specified by:
startin interfaceWorkflowOperationHandler- Specified by:
startin classAbstractWorkflowOperationHandler- Parameters:
wi- the workflow instancectx- 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:
-
adjustMetadata
protected void adjustMetadata(org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Extraction extraction, Attachment image, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Cfg cfg) Adjust flavor, tags, mime type ofimageaccording to the configuration and the extraction. -
createFileName
protected String createFileName(String suffix, URI trackUri, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.MediaPosition pos, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Cfg cfg) throws WorkflowOperationException Create a file name for the extracted image.- Throws:
WorkflowOperationException
-
moveToWorkspace
protected void moveToWorkspace(ImageWorkflowOperationHandler handler, MediaPackage mp, Attachment image, String fileName) throws WorkflowOperationException Move the extractedimageto its final location in the workspace and rename it tofileName.- Throws:
WorkflowOperationException
-
extractImages
protected Job extractImages(ImageWorkflowOperationHandler handler, Track track, EncodingProfile profile, List<org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.MediaPosition> positions, org.opencastproject.workflow.handler.composer.ImageWorkflowOperationHandler.Cfg cfg) throws WorkflowOperationException Start a composer job to extract images from a track at the given positions.- Throws:
WorkflowOperationException
-
fetchProfile
public static EncodingProfile fetchProfile(ComposerService composerService, String profileName) throws WorkflowOperationException Fetch a profile from the composer service. Throw a WorkflowOperationException in case the profile does not exist.- Throws:
WorkflowOperationException
-
setServiceRegistry
Description copied from class:AbstractWorkflowOperationHandlerSets the service registry. This method is here as a convenience for developers that need the registry to do job waiting.- Overrides:
setServiceRegistryin classAbstractWorkflowOperationHandler- Parameters:
serviceRegistry- the service registry
-