Class TextAnalysisWorkflowOperationHandler
java.lang.Object
org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
org.opencastproject.workflow.handler.textanalyzer.TextAnalysisWorkflowOperationHandler
- All Implemented Interfaces:
WorkflowOperationHandler,org.osgi.service.cm.ManagedService
public class TextAnalysisWorkflowOperationHandler
extends AbstractWorkflowOperationHandler
implements org.osgi.service.cm.ManagedService
The
TextAnalysisOperationHandler will take an MPEG-7 catalog, look for video segments and
run a text analysis on the associated still images. The resulting VideoText elements will then be added
to the segments.-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
AbstractWorkflowOperationHandler.Configuration -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ComposerServiceThe composer servicestatic final StringName of the encoding profile that extracts a still image from a moviestatic final StringName of the constant used to retreive the stability thresholdFields inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
asList, 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 WorkflowOperationResultextractVideoText(MediaPackage mediaPackage, WorkflowOperationInstance operation, ConfiguredTagsAndFlavors tagsAndFlavors) Runs the text analysis service on each of the video segments found.protected Mpeg7CatalogloadMpeg7Catalog(Catalog catalog) Loads an mpeg7 catalog from a mediapackage's catalog referenceprotected Map<Catalog, Mpeg7Catalog> loadSegmentCatalogs(MediaPackage mediaPackage, WorkflowOperationInstance operation, ConfiguredTagsAndFlavors tagsAndFlavors) Extracts the catalogs from the media package that match the requirements of flavor and tags specified in the operation handler.protected voidsetMpeg7CatalogService(Mpeg7CatalogService catalogService) Callback for the OSGi declarative services configuration.voidsetServiceRegistry(ServiceRegistry serviceRegistry) Sets the service registry.protected voidsetTextAnalyzer(TextAnalyzerService analysisService) Callback for the OSGi declarative services configuration that will set the text analysis service.voidsetWorkspace(Workspace workspace) Callback for declarative services configuration that will introduce us to the local workspace service.start(WorkflowInstance workflowInstance, JobContext context) Runs the workflow operation on thisWorkflowInstance.voidupdated(Dictionary properties) Methods inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
activate, asList, cfgKeyMissing, createResult, createResult, createResult, createResult, destroy, equals, getCfg, getConfig, getConfig, getConfig, getDescription, getFileNameFromElements, getId, getOptConfig, getOptConfig, getTagsAndFlavors, hashCode, setJobBarrierPollingInterval, skip, toString, waitForStatus, waitForStatus
-
Field Details
-
IMAGE_EXTRACTION_PROFILE
Name of the encoding profile that extracts a still image from a movie- See Also:
-
OPT_STABILITY_THRESHOLD
Name of the constant used to retreive the stability threshold- See Also:
-
composer
The composer service
-
-
Constructor Details
-
TextAnalysisWorkflowOperationHandler
public TextAnalysisWorkflowOperationHandler()
-
-
Method Details
-
setTextAnalyzer
Callback for the OSGi declarative services configuration that will set the text analysis service.- Parameters:
analysisService- the text analysis 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
-
setMpeg7CatalogService
Callback for the OSGi declarative services configuration.- Parameters:
catalogService- the catalog service
-
start
public WorkflowOperationResult start(WorkflowInstance workflowInstance, JobContext context) 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:
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:
-
extractVideoText
protected WorkflowOperationResult extractVideoText(MediaPackage mediaPackage, WorkflowOperationInstance operation, ConfiguredTagsAndFlavors tagsAndFlavors) throws EncoderException, InterruptedException, ExecutionException, IOException, NotFoundException, MediaPackageException, TextAnalyzerException, WorkflowOperationException, ServiceRegistryException Runs the text analysis service on each of the video segments found.- Parameters:
mediaPackage- the original mediapackageoperation- the workflow operation- Throws:
ExecutionExceptionInterruptedExceptionNotFoundExceptionWorkflowOperationExceptionEncoderExceptionIOExceptionMediaPackageExceptionTextAnalyzerExceptionServiceRegistryException
-
loadMpeg7Catalog
Loads an mpeg7 catalog from a mediapackage's catalog reference- Parameters:
catalog- the mediapackage's reference to this catalog- Returns:
- the mpeg7
- Throws:
IOException- if there is a problem loading or parsing the mpeg7 object
-
loadSegmentCatalogs
protected Map<Catalog,Mpeg7Catalog> loadSegmentCatalogs(MediaPackage mediaPackage, WorkflowOperationInstance operation, ConfiguredTagsAndFlavors tagsAndFlavors) throws IOException Extracts the catalogs from the media package that match the requirements of flavor and tags specified in the operation handler.- Parameters:
mediaPackage- the media packageoperation- the workflow operation- Returns:
- a map of catalog elements and their mpeg-7 representations
- Throws:
IOException- if there is a problem reading the mpeg7
-
updated
- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException- See Also:
-
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
-