Class ZipWorkflowOperationHandler
- java.lang.Object
-
- org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
-
- org.opencastproject.workflow.handler.workflow.ZipWorkflowOperationHandler
-
- All Implemented Interfaces:
org.opencastproject.workflow.api.WorkflowOperationHandler
public class ZipWorkflowOperationHandler extends org.opencastproject.workflow.api.AbstractWorkflowOperationHandlerProduces a zipped archive of a mediapackage, places it in the archive collection, and removes the rest of the mediapackage elements from both the mediapackage xml and if possible, from storage altogether.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPRESS_PROPERTYThe property indicating whether to apply compression to the archivestatic org.opencastproject.mediapackage.MediaPackageElementFlavorDEFAULT_ARCHIVE_FLAVORThe default flavor to use for a mediapackage archivestatic StringDEFAULT_ZIP_ARCHIVE_TEMP_DIRThe default location to use when building an zip archive relative to the storage directorystatic StringDEFAULT_ZIP_COLLECTIONThe default collection in the working file repository to store archivesstatic StringINCLUDE_FLAVORS_PROPERTYThe element flavors to include in the zip filestatic StringTARGET_FLAVOR_PROPERTYThe zip archive's target element flavorstatic StringTARGET_TAGS_PROPERTYThe zip archive's target tagsprotected FiletempStorageDirThe temporary storage locationprotected org.opencastproject.workspace.api.WorkspaceworkspaceThe workspace to use in retrieving and storing files.static StringZIP_ARCHIVE_TEMP_DIR_CFG_KEYKey for configuring the location of the archive-temp folderstatic StringZIP_COLLECTION_PROPERTYThe workflow operation's property to consult to determine the collection to use to store an archive
-
Constructor Summary
Constructors Constructor Description ZipWorkflowOperationHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(org.osgi.service.component.ComponentContext cc)Activate the component, generating the temporary storage directory for building zip archives if necessary.voidsetWorkspace(org.opencastproject.workspace.api.Workspace workspace)Sets the workspace to use.org.opencastproject.workflow.api.WorkflowOperationResultstart(org.opencastproject.workflow.api.WorkflowInstance workflowInstance, org.opencastproject.job.api.JobContext context)protected Filezip(org.opencastproject.mediapackage.MediaPackage mediaPackage, List<org.opencastproject.mediapackage.MediaPackageElementFlavor> flavorsToZip, boolean compress)Creates a zip archive of all elements in a mediapackage.-
Methods inherited from class org.opencastproject.workflow.api.AbstractWorkflowOperationHandler
asList, cfgKeyMissing, createResult, createResult, createResult, createResult, destroy, equals, getCfg, getConfig, getConfig, getConfig, getDescription, getFileNameFromElements, getId, getOptConfig, getOptConfig, getTagsAndFlavors, hashCode, setJobBarrierPollingInterval, setServiceRegistry, skip, toString, waitForStatus, waitForStatus
-
-
-
-
Field Detail
-
ZIP_COLLECTION_PROPERTY
public static final String ZIP_COLLECTION_PROPERTY
The workflow operation's property to consult to determine the collection to use to store an archive- See Also:
- Constant Field Values
-
INCLUDE_FLAVORS_PROPERTY
public static final String INCLUDE_FLAVORS_PROPERTY
The element flavors to include in the zip file- See Also:
- Constant Field Values
-
TARGET_FLAVOR_PROPERTY
public static final String TARGET_FLAVOR_PROPERTY
The zip archive's target element flavor- See Also:
- Constant Field Values
-
TARGET_TAGS_PROPERTY
public static final String TARGET_TAGS_PROPERTY
The zip archive's target tags- See Also:
- Constant Field Values
-
COMPRESS_PROPERTY
public static final String COMPRESS_PROPERTY
The property indicating whether to apply compression to the archive- See Also:
- Constant Field Values
-
DEFAULT_ZIP_COLLECTION
public static final String DEFAULT_ZIP_COLLECTION
The default collection in the working file repository to store archives- See Also:
- Constant Field Values
-
DEFAULT_ZIP_ARCHIVE_TEMP_DIR
public static final String DEFAULT_ZIP_ARCHIVE_TEMP_DIR
The default location to use when building an zip archive relative to the storage directory- See Also:
- Constant Field Values
-
ZIP_ARCHIVE_TEMP_DIR_CFG_KEY
public static final String ZIP_ARCHIVE_TEMP_DIR_CFG_KEY
Key for configuring the location of the archive-temp folder- See Also:
- Constant Field Values
-
DEFAULT_ARCHIVE_FLAVOR
public static final org.opencastproject.mediapackage.MediaPackageElementFlavor DEFAULT_ARCHIVE_FLAVOR
The default flavor to use for a mediapackage archive
-
tempStorageDir
protected File tempStorageDir
The temporary storage location
-
workspace
protected org.opencastproject.workspace.api.Workspace workspace
The workspace to use in retrieving and storing files.
-
-
Method Detail
-
setWorkspace
public void setWorkspace(org.opencastproject.workspace.api.Workspace workspace)
Sets the workspace to use.- Parameters:
workspace- the workspace
-
activate
protected void activate(org.osgi.service.component.ComponentContext cc)
Activate the component, generating the temporary storage directory for building zip archives if necessary.- Overrides:
activatein classorg.opencastproject.workflow.api.AbstractWorkflowOperationHandler- See Also:
AbstractWorkflowOperationHandler.activate(org.osgi.service.component.ComponentContext)
-
start
public org.opencastproject.workflow.api.WorkflowOperationResult start(org.opencastproject.workflow.api.WorkflowInstance workflowInstance, org.opencastproject.job.api.JobContext context) throws org.opencastproject.workflow.api.WorkflowOperationException- Specified by:
startin interfaceorg.opencastproject.workflow.api.WorkflowOperationHandler- Specified by:
startin classorg.opencastproject.workflow.api.AbstractWorkflowOperationHandler- Throws:
org.opencastproject.workflow.api.WorkflowOperationException- See Also:
AbstractWorkflowOperationHandler.start(org.opencastproject.workflow.api.WorkflowInstance, JobContext)
-
zip
protected File zip(org.opencastproject.mediapackage.MediaPackage mediaPackage, List<org.opencastproject.mediapackage.MediaPackageElementFlavor> flavorsToZip, boolean compress) throws IOException, org.opencastproject.util.NotFoundException, org.opencastproject.mediapackage.MediaPackageException, org.opencastproject.workflow.api.WorkflowOperationException
Creates a zip archive of all elements in a mediapackage.- Parameters:
mediaPackage- the mediapackage to zip- Returns:
- the zip file
- Throws:
IOException- If an IO exception occursorg.opencastproject.util.NotFoundException- If a file referenced in the mediapackage can not be foundorg.opencastproject.mediapackage.MediaPackageException- If the mediapackage can not be serialized to xmlorg.opencastproject.workflow.api.WorkflowOperationException- If the mediapackage is invalid
-
-