Package org.opencastproject.caption.impl
Class CaptionServiceImpl
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.caption.impl.CaptionServiceImpl
- All Implemented Interfaces:
CaptionService,JobProducer,org.osgi.service.cm.ManagedService
public class CaptionServiceImpl
extends AbstractJobProducer
implements CaptionService, org.osgi.service.cm.ManagedService
Implementation of
CaptionService. Uses ComponentContext to get all registered
CaptionConverters. Converters are searched based on caption.format property. If there is no
match for specified input or output format UnsupportedCaptionFormatException is thrown.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key to look for in the service configuration file to override theDEFAULT_CAPTION_JOB_LOADstatic final StringThe collection nameprotected org.osgi.service.component.ComponentContextComponent context needed for retrieving Converter Enginesstatic final floatThe load introduced on the system by creating a caption jobprotected OrganizationDirectoryServiceThe organization directory serviceprotected SecurityServiceThe security serviceprotected ServiceRegistryReference to remote service managerprotected UserDirectoryServiceThe user directory serviceprotected WorkspaceReference to workspaceFields inherited from class org.opencastproject.job.api.AbstractJobProducer
ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY, acceptJobLoadsExeedingMaxLoad, DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING, executor, jobTypeFields inherited from interface org.opencastproject.caption.api.CaptionService
JOB_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext componentContext) Activate this service implementation via the OSGI service component runtime.protected MediaPackageElementconvert(Job job, MediaPackageElement input, String inputFormat, String outputFormat, String language) Converts the captions and returns them in a new catalog.convert(MediaPackageElement input, String inputFormat, String outputFormat) Converts captions from one format to another.convert(MediaPackageElement input, String inputFormat, String outputFormat, String language) Converts captions from one format to another.protected HashMap<String, CaptionConverter> Returns all registered CaptionFormats.protected CaptionConvertergetCaptionConverter(String formatName) Returns specificCaptionConverter.String[]getLanguageList(MediaPackageElement input, String format) Returns list of languages available in captions (if such information is stored).protected OrganizationDirectoryServiceReturns a reference to the organization directory service.protected SecurityServiceReturns a reference to the security serviceprotected ServiceRegistryReturns a reference to the service registry.protected UserDirectoryServiceReturns a reference to the user directory serviceprotected StringAsks the overriding class to process the arguments using the given operation.voidsetOrganizationDirectoryService(OrganizationDirectoryService organizationDirectory) Sets a reference to the organization directory service.voidsetSecurityService(SecurityService securityService) Callback for setting the security service.protected voidsetServiceRegistry(ServiceRegistry serviceRegistry) Setter for remote service manager via declarative activationvoidsetUserDirectoryService(UserDirectoryService userDirectoryService) Callback for setting the user directory service.protected voidsetWorkspace(Workspace workspace) Setter for workspace via declarative activationvoidupdated(Dictionary properties) Methods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Field Details
-
COLLECTION
The collection name- See Also:
-
DEFAULT_CAPTION_JOB_LOAD
public static final float DEFAULT_CAPTION_JOB_LOADThe load introduced on the system by creating a caption job- See Also:
-
CAPTION_JOB_LOAD_KEY
The key to look for in the service configuration file to override theDEFAULT_CAPTION_JOB_LOAD- See Also:
-
workspace
Reference to workspace -
serviceRegistry
Reference to remote service manager -
securityService
The security service -
userDirectoryService
The user directory service -
organizationDirectoryService
The organization directory service -
componentContext
protected org.osgi.service.component.ComponentContext componentContextComponent context needed for retrieving Converter Engines
-
-
Constructor Details
-
CaptionServiceImpl
public CaptionServiceImpl()Creates a new caption service.
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext componentContext) Activate this service implementation via the OSGI service component runtime.- Overrides:
activatein classAbstractJobProducer- Parameters:
componentContext- the component context
-
convert
public Job convert(MediaPackageElement input, String inputFormat, String outputFormat) throws UnsupportedCaptionFormatException, CaptionConverterException, MediaPackageException Converts captions from one format to another. Language parameter is used for those formats that store information about language.- Specified by:
convertin interfaceCaptionService- Parameters:
input- MediaPackageElement containing captionsinputFormat- format of imported captionsoutputFormat- format of exported captions- Throws:
UnsupportedCaptionFormatException- if there is no matching engine registered for given input or outputCaptionConverterException- if exception occurs while convertingMediaPackageException- if the catalog is invalid- See Also:
-
convert
public Job convert(MediaPackageElement input, String inputFormat, String outputFormat, String language) throws UnsupportedCaptionFormatException, CaptionConverterException, MediaPackageException Converts captions from one format to another. Language parameter is used for those formats that store information about language.- Specified by:
convertin interfaceCaptionService- Parameters:
input- MediaPackageElement containing captionsinputFormat- format of imported captionsoutputFormat- format of exported captionslanguage- language of captions- Throws:
UnsupportedCaptionFormatException- if there is no matching engine registered for given input or outputCaptionConverterException- if exception occurs while convertingMediaPackageException- if the catalog is invalid- See Also:
-
convert
protected MediaPackageElement convert(Job job, MediaPackageElement input, String inputFormat, String outputFormat, String language) throws UnsupportedCaptionFormatException, CaptionConverterException, MediaPackageException Converts the captions and returns them in a new catalog.- Returns:
- the converted catalog
- Throws:
UnsupportedCaptionFormatExceptionCaptionConverterExceptionMediaPackageException
-
getLanguageList
public String[] getLanguageList(MediaPackageElement input, String format) throws UnsupportedCaptionFormatException, CaptionConverterException Returns list of languages available in captions (if such information is stored).- Specified by:
getLanguageListin interfaceCaptionService- Parameters:
input- Catalog containing captionsformat- captions' format- Returns:
- Array of languages available in captions
- Throws:
UnsupportedCaptionFormatException- if there is no matching engine registered for given input or outputCaptionConverterException- if parser encounters exception
-
getAvailableCaptionConverters
Returns all registered CaptionFormats. -
getCaptionConverter
Returns specificCaptionConverter. Registry is searched based on formatName, so in order forCaptionConverterto be found, it has to havecaption.formatproperty set withCaptionConverterformat. If none is found, null is returned, if more than one is found then the first reference is returned.- Parameters:
formatName- name of the caption format- Returns:
CaptionConverteror null if none is found
-
process
Asks the overriding class to process the arguments using the given operation. The result will be added to the associated job as the payload.- Specified by:
processin classAbstractJobProducer- Parameters:
job- the job to process- Returns:
- the operation result
- Throws:
Exception- See Also:
-
setWorkspace
Setter for workspace via declarative activation -
setServiceRegistry
Setter for remote service manager via declarative activation -
setSecurityService
Callback for setting the security service.- Parameters:
securityService- the securityService to set
-
setUserDirectoryService
Callback for setting the user directory service.- Parameters:
userDirectoryService- the userDirectoryService to set
-
setOrganizationDirectoryService
Sets a reference to the organization directory service.- Parameters:
organizationDirectory- the organization directory
-
getSecurityService
Returns a reference to the security service- Specified by:
getSecurityServicein classAbstractJobProducer- Returns:
- the security service
- See Also:
-
getOrganizationDirectoryService
Returns a reference to the organization directory service.- Specified by:
getOrganizationDirectoryServicein classAbstractJobProducer- Returns:
- the organization directory service
- See Also:
-
getUserDirectoryService
Returns a reference to the user directory service- Specified by:
getUserDirectoryServicein classAbstractJobProducer- Returns:
- the user directory service
- See Also:
-
getServiceRegistry
Returns a reference to the service registry.- Specified by:
getServiceRegistryin classAbstractJobProducer- Returns:
- the service registry
- See Also:
-
updated
- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException
-