Class TextAnalyzerServiceImpl

  • All Implemented Interfaces:
    org.opencastproject.job.api.JobProducer, org.opencastproject.textanalyzer.api.TextAnalyzerService, org.osgi.service.cm.ManagedService

    public class TextAnalyzerServiceImpl
    extends org.opencastproject.job.api.AbstractJobProducer
    implements org.opencastproject.textanalyzer.api.TextAnalyzerService, org.osgi.service.cm.ManagedService
    Media analysis service that takes takes an image and returns text as extracted from that image.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String ANALYSIS_JOB_LOAD_KEY
      The key to look for in the service configuration file to override the DEFAULT_ANALYSIS_JOB_LOAD
      static String COLLECTION_ID
      Resulting collection in the working file repository
      static float DEFAULT_ANALYSIS_JOB_LOAD
      The approximate load placed on the system by creating a text analysis job
      protected org.opencastproject.dictionary.api.DictionaryService dictionaryService
      The dictionary service
      protected org.opencastproject.metadata.mpeg7.Mpeg7CatalogService mpeg7CatalogService
      The mpeg-7 service
      protected org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService
      The organization directory service
      protected org.opencastproject.security.api.SecurityService securityService
      The security service
      protected org.opencastproject.security.api.UserDirectoryService userDirectoryService
      The user directory service
      • 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.textanalyzer.api.TextAnalyzerService

        JOB_TYPE, OPERATION
    • Constructor Summary

      Constructors 
      Constructor Description
      TextAnalyzerServiceImpl()
      Creates a new instance of the text analyzer service.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activate​(org.osgi.service.component.ComponentContext cc)
      OSGi callback on component activation.
      protected org.opencastproject.metadata.mpeg7.VideoText[] analyze​(File imageFile, String id)
      Returns the video text element for the given image.
      org.opencastproject.job.api.Job extract​(org.opencastproject.mediapackage.Attachment image)
      protected org.opencastproject.security.api.OrganizationDirectoryService getOrganizationDirectoryService()
      protected org.opencastproject.security.api.SecurityService getSecurityService()
      protected org.opencastproject.serviceregistry.api.ServiceRegistry getServiceRegistry()
      protected org.opencastproject.security.api.UserDirectoryService getUserDirectoryService()
      protected String process​(org.opencastproject.job.api.Job job)
      protected void setDictionaryService​(org.opencastproject.dictionary.api.DictionaryService dictionaryService)
      Sets the dictionary service
      protected void setMpeg7CatalogService​(org.opencastproject.metadata.mpeg7.Mpeg7CatalogService mpeg7CatalogService)
      Sets the mpeg7CatalogService
      void setOrganizationDirectoryService​(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory)
      Sets a reference to the organization directory service.
      void setReadinessIndicator​(org.opencastproject.util.ReadinessIndicator readinessIndicator)  
      void setSecurityService​(org.opencastproject.security.api.SecurityService securityService)
      Callback for setting the security service.
      protected void setServiceRegistry​(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)
      Sets the receipt service
      protected void setTextExtractor​(org.opencastproject.textextractor.api.TextExtractor textExtractor)
      Sets the text extractor.
      void setUserDirectoryService​(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
      Callback for setting the user directory service.
      protected void setWorkspace​(org.opencastproject.workspace.api.Workspace workspace)
      Sets the workspace
      void updated​(Dictionary properties)  
      • Methods inherited from class org.opencastproject.job.api.AbstractJobProducer

        acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
    • Field Detail

      • COLLECTION_ID

        public static final String COLLECTION_ID
        Resulting collection in the working file repository
        See Also:
        Constant Field Values
      • DEFAULT_ANALYSIS_JOB_LOAD

        public static final float DEFAULT_ANALYSIS_JOB_LOAD
        The approximate load placed on the system by creating a text analysis job
        See Also:
        Constant Field Values
      • mpeg7CatalogService

        protected org.opencastproject.metadata.mpeg7.Mpeg7CatalogService mpeg7CatalogService
        The mpeg-7 service
      • dictionaryService

        protected org.opencastproject.dictionary.api.DictionaryService dictionaryService
        The dictionary service
      • 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
    • Constructor Detail

      • TextAnalyzerServiceImpl

        public TextAnalyzerServiceImpl()
        Creates a new instance of the text analyzer service.
    • Method Detail

      • activate

        public void activate​(org.osgi.service.component.ComponentContext cc)
        OSGi callback on component activation.
        Overrides:
        activate in class org.opencastproject.job.api.AbstractJobProducer
        Parameters:
        cc - the component context
      • extract

        public org.opencastproject.job.api.Job extract​(org.opencastproject.mediapackage.Attachment image)
                                                throws org.opencastproject.textanalyzer.api.TextAnalyzerException,
                                                       org.opencastproject.mediapackage.MediaPackageException
        Specified by:
        extract in interface org.opencastproject.textanalyzer.api.TextAnalyzerService
        Throws:
        org.opencastproject.textanalyzer.api.TextAnalyzerException
        org.opencastproject.mediapackage.MediaPackageException
        See Also:
        TextAnalyzerService.extract(org.opencastproject.mediapackage.Attachment)
      • 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(org.opencastproject.job.api.Job)
      • analyze

        protected org.opencastproject.metadata.mpeg7.VideoText[] analyze​(File imageFile,
                                                                         String id)
                                                                  throws org.opencastproject.textanalyzer.api.TextAnalyzerException
        Returns the video text element for the given image.
        Parameters:
        imageFile - the image
        id - the video text id
        Returns:
        the video text found on the image
        Throws:
        org.opencastproject.textanalyzer.api.TextAnalyzerException - if accessing the image fails
      • setServiceRegistry

        protected void setServiceRegistry​(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)
        Sets the receipt service
        Parameters:
        serviceRegistry - the service registry
      • getServiceRegistry

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

        protected void setTextExtractor​(org.opencastproject.textextractor.api.TextExtractor textExtractor)
        Sets the text extractor.
        Parameters:
        textExtractor - a text extractor implementation
      • setWorkspace

        protected void setWorkspace​(org.opencastproject.workspace.api.Workspace workspace)
        Sets the workspace
        Parameters:
        workspace - an instance of the workspace
      • setMpeg7CatalogService

        protected void setMpeg7CatalogService​(org.opencastproject.metadata.mpeg7.Mpeg7CatalogService mpeg7CatalogService)
        Sets the mpeg7CatalogService
        Parameters:
        mpeg7CatalogService - an instance of the mpeg7 catalog service
      • setDictionaryService

        protected void setDictionaryService​(org.opencastproject.dictionary.api.DictionaryService dictionaryService)
        Sets the dictionary service
        Parameters:
        dictionaryService - an instance of the dicitonary service
      • 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()
      • getUserDirectoryService

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

        protected org.opencastproject.security.api.OrganizationDirectoryService getOrganizationDirectoryService()
        Specified by:
        getOrganizationDirectoryService in class org.opencastproject.job.api.AbstractJobProducer
        See Also:
        AbstractJobProducer.getOrganizationDirectoryService()
      • 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
      • setReadinessIndicator

        public void setReadinessIndicator​(org.opencastproject.util.ReadinessIndicator readinessIndicator)