Class CaptionServiceImpl

java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.caption.impl.CaptionServiceImpl
All Implemented Interfaces:
org.opencastproject.caption.api.CaptionService, org.opencastproject.job.api.JobProducer, org.osgi.service.cm.ManagedService

public class CaptionServiceImpl extends org.opencastproject.job.api.AbstractJobProducer implements org.opencastproject.caption.api.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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The key to look for in the service configuration file to override the DEFAULT_CAPTION_JOB_LOAD
    static final String
    The collection name
    protected org.osgi.service.component.ComponentContext
    Component context needed for retrieving Converter Engines
    static final float
    The load introduced on the system by creating a caption job
    protected org.opencastproject.security.api.OrganizationDirectoryService
    The organization directory service
    protected org.opencastproject.security.api.SecurityService
    The security service
    protected org.opencastproject.serviceregistry.api.ServiceRegistry
    Reference to remote service manager
    protected org.opencastproject.security.api.UserDirectoryService
    The user directory service
    protected org.opencastproject.workspace.api.Workspace
    Reference to workspace

    Fields inherited from class org.opencastproject.job.api.AbstractJobProducer

    ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY, acceptJobLoadsExeedingMaxLoad, DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING, executor, jobType

    Fields inherited from interface org.opencastproject.caption.api.CaptionService

    JOB_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new caption service.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(org.osgi.service.component.ComponentContext componentContext)
    Activate this service implementation via the OSGI service component runtime.
    protected org.opencastproject.mediapackage.MediaPackageElement
    convert(org.opencastproject.job.api.Job job, org.opencastproject.mediapackage.MediaPackageElement input, String inputFormat, String outputFormat, String language)
    Converts the captions and returns them in a new catalog.
    org.opencastproject.job.api.Job
    convert(org.opencastproject.mediapackage.MediaPackageElement input, String inputFormat, String outputFormat)
    org.opencastproject.job.api.Job
    convert(org.opencastproject.mediapackage.MediaPackageElement input, String inputFormat, String outputFormat, String language)
    protected HashMap<String,org.opencastproject.caption.api.CaptionConverter>
    Returns all registered CaptionFormats.
    protected org.opencastproject.caption.api.CaptionConverter
    Returns specific CaptionConverter.
    getLanguageList(org.opencastproject.mediapackage.MediaPackageElement input, String format)
    protected org.opencastproject.security.api.OrganizationDirectoryService
    protected org.opencastproject.security.api.SecurityService
    protected org.opencastproject.serviceregistry.api.ServiceRegistry
    protected org.opencastproject.security.api.UserDirectoryService
    protected String
    process(org.opencastproject.job.api.Job job)
    void
    setOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory)
    Sets a reference to the organization directory service.
    void
    setSecurityService(org.opencastproject.security.api.SecurityService securityService)
    Callback for setting the security service.
    protected void
    setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)
    Setter for remote service manager via declarative activation
    void
    setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
    Callback for setting the user directory service.
    protected void
    setWorkspace(org.opencastproject.workspace.api.Workspace workspace)
    Setter for workspace via declarative activation
    void
    updated(Dictionary properties)
     

    Methods inherited from class org.opencastproject.job.api.AbstractJobProducer

    acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • COLLECTION

      public static final String COLLECTION
      The collection name
      See Also:
    • DEFAULT_CAPTION_JOB_LOAD

      public static final float DEFAULT_CAPTION_JOB_LOAD
      The load introduced on the system by creating a caption job
      See Also:
    • CAPTION_JOB_LOAD_KEY

      public static final String CAPTION_JOB_LOAD_KEY
      The key to look for in the service configuration file to override the DEFAULT_CAPTION_JOB_LOAD
      See Also:
    • workspace

      protected org.opencastproject.workspace.api.Workspace workspace
      Reference to workspace
    • serviceRegistry

      protected org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry
      Reference to remote service manager
    • securityService

      protected org.opencastproject.security.api.SecurityService securityService
      The security service
    • userDirectoryService

      protected org.opencastproject.security.api.UserDirectoryService userDirectoryService
      The user directory service
    • organizationDirectoryService

      protected org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService
      The organization directory service
    • componentContext

      protected org.osgi.service.component.ComponentContext componentContext
      Component 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:
      activate in class org.opencastproject.job.api.AbstractJobProducer
      Parameters:
      componentContext - the component context
    • convert

      public org.opencastproject.job.api.Job convert(org.opencastproject.mediapackage.MediaPackageElement input, String inputFormat, String outputFormat) throws org.opencastproject.caption.api.UnsupportedCaptionFormatException, org.opencastproject.caption.api.CaptionConverterException, org.opencastproject.mediapackage.MediaPackageException
      Specified by:
      convert in interface org.opencastproject.caption.api.CaptionService
      Throws:
      org.opencastproject.caption.api.UnsupportedCaptionFormatException
      org.opencastproject.caption.api.CaptionConverterException
      org.opencastproject.mediapackage.MediaPackageException
      See Also:
      • CaptionService.convert(org.opencastproject.mediapackage.MediaPackageElement, java.lang.String, java.lang.String)
    • convert

      public org.opencastproject.job.api.Job convert(org.opencastproject.mediapackage.MediaPackageElement input, String inputFormat, String outputFormat, String language) throws org.opencastproject.caption.api.UnsupportedCaptionFormatException, org.opencastproject.caption.api.CaptionConverterException, org.opencastproject.mediapackage.MediaPackageException
      Specified by:
      convert in interface org.opencastproject.caption.api.CaptionService
      Throws:
      org.opencastproject.caption.api.UnsupportedCaptionFormatException
      org.opencastproject.caption.api.CaptionConverterException
      org.opencastproject.mediapackage.MediaPackageException
      See Also:
      • CaptionService.convert(org.opencastproject.mediapackage.MediaPackageElement, java.lang.String, java.lang.String, java.lang.String)
    • convert

      protected org.opencastproject.mediapackage.MediaPackageElement convert(org.opencastproject.job.api.Job job, org.opencastproject.mediapackage.MediaPackageElement input, String inputFormat, String outputFormat, String language) throws org.opencastproject.caption.api.UnsupportedCaptionFormatException, org.opencastproject.caption.api.CaptionConverterException, org.opencastproject.mediapackage.MediaPackageException
      Converts the captions and returns them in a new catalog.
      Returns:
      the converted catalog
      Throws:
      org.opencastproject.caption.api.UnsupportedCaptionFormatException
      org.opencastproject.caption.api.CaptionConverterException
      org.opencastproject.mediapackage.MediaPackageException
    • getLanguageList

      public String[] getLanguageList(org.opencastproject.mediapackage.MediaPackageElement input, String format) throws org.opencastproject.caption.api.UnsupportedCaptionFormatException, org.opencastproject.caption.api.CaptionConverterException
      Specified by:
      getLanguageList in interface org.opencastproject.caption.api.CaptionService
      Throws:
      org.opencastproject.caption.api.UnsupportedCaptionFormatException
      org.opencastproject.caption.api.CaptionConverterException
    • getAvailableCaptionConverters

      protected HashMap<String,org.opencastproject.caption.api.CaptionConverter> getAvailableCaptionConverters()
      Returns all registered CaptionFormats.
    • getCaptionConverter

      protected org.opencastproject.caption.api.CaptionConverter getCaptionConverter(String formatName)
      Returns specific CaptionConverter. Registry is searched based on formatName, so in order for CaptionConverter to be found, it has to have caption.format property set with CaptionConverter format. 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:
      CaptionConverter or null if none is found
    • process

      protected String process(org.opencastproject.job.api.Job job) throws Exception
      Specified by:
      process in class org.opencastproject.job.api.AbstractJobProducer
      Throws:
      Exception
      See Also:
      • AbstractJobProducer.process(Job)
    • setWorkspace

      protected void setWorkspace(org.opencastproject.workspace.api.Workspace workspace)
      Setter for workspace via declarative activation
    • setServiceRegistry

      protected void setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)
      Setter for remote service manager via declarative activation
    • setSecurityService

      public void setSecurityService(org.opencastproject.security.api.SecurityService securityService)
      Callback for setting the security service.
      Parameters:
      securityService - the securityService to set
    • setUserDirectoryService

      public void setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
      Callback for setting the user directory service.
      Parameters:
      userDirectoryService - the userDirectoryService to set
    • setOrganizationDirectoryService

      public void setOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory)
      Sets a reference to the organization directory service.
      Parameters:
      organizationDirectory - the organization directory
    • getSecurityService

      protected org.opencastproject.security.api.SecurityService getSecurityService()
      Specified by:
      getSecurityService in class org.opencastproject.job.api.AbstractJobProducer
      See Also:
      • AbstractJobProducer.getSecurityService()
    • getOrganizationDirectoryService

      protected org.opencastproject.security.api.OrganizationDirectoryService getOrganizationDirectoryService()
      Specified by:
      getOrganizationDirectoryService in class org.opencastproject.job.api.AbstractJobProducer
      See Also:
      • AbstractJobProducer.getOrganizationDirectoryService()
    • getUserDirectoryService

      protected org.opencastproject.security.api.UserDirectoryService getUserDirectoryService()
      Specified by:
      getUserDirectoryService in class org.opencastproject.job.api.AbstractJobProducer
      See Also:
      • AbstractJobProducer.getUserDirectoryService()
    • getServiceRegistry

      protected org.opencastproject.serviceregistry.api.ServiceRegistry getServiceRegistry()
      Specified by:
      getServiceRegistry in class org.opencastproject.job.api.AbstractJobProducer
      See Also:
      • AbstractJobProducer.getServiceRegistry()
    • updated

      public void updated(Dictionary properties) throws org.osgi.service.cm.ConfigurationException
      Specified by:
      updated in interface org.osgi.service.cm.ManagedService
      Throws:
      org.osgi.service.cm.ConfigurationException