Class TextAnalyzerServiceImpl
- java.lang.Object
-
- org.opencastproject.job.api.AbstractJobProducer
-
- org.opencastproject.textanalyzer.impl.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.ManagedServiceMedia analysis service that takes takes an image and returns text as extracted from that image.
-
-
Field Summary
Fields Modifier and Type Field Description static StringANALYSIS_JOB_LOAD_KEYThe key to look for in the service configuration file to override theDEFAULT_ANALYSIS_JOB_LOADstatic StringCOLLECTION_IDResulting collection in the working file repositorystatic floatDEFAULT_ANALYSIS_JOB_LOADThe approximate load placed on the system by creating a text analysis jobprotected org.opencastproject.dictionary.api.DictionaryServicedictionaryServiceThe dictionary serviceprotected org.opencastproject.metadata.mpeg7.Mpeg7CatalogServicempeg7CatalogServiceThe mpeg-7 serviceprotected org.opencastproject.security.api.OrganizationDirectoryServiceorganizationDirectoryServiceThe organization directory serviceprotected org.opencastproject.security.api.SecurityServicesecurityServiceThe security serviceprotected org.opencastproject.security.api.UserDirectoryServiceuserDirectoryServiceThe user directory service
-
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 voidactivate(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.Jobextract(org.opencastproject.mediapackage.Attachment image)protected org.opencastproject.security.api.OrganizationDirectoryServicegetOrganizationDirectoryService()protected org.opencastproject.security.api.SecurityServicegetSecurityService()protected org.opencastproject.serviceregistry.api.ServiceRegistrygetServiceRegistry()protected org.opencastproject.security.api.UserDirectoryServicegetUserDirectoryService()protected Stringprocess(org.opencastproject.job.api.Job job)protected voidsetDictionaryService(org.opencastproject.dictionary.api.DictionaryService dictionaryService)Sets the dictionary serviceprotected voidsetMpeg7CatalogService(org.opencastproject.metadata.mpeg7.Mpeg7CatalogService mpeg7CatalogService)Sets the mpeg7CatalogServicevoidsetOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory)Sets a reference to the organization directory service.voidsetReadinessIndicator(org.opencastproject.util.ReadinessIndicator readinessIndicator)voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService)Callback for setting the security service.protected voidsetServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)Sets the receipt serviceprotected voidsetTextExtractor(org.opencastproject.textextractor.api.TextExtractor textExtractor)Sets the text extractor.voidsetUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)Callback for setting the user directory service.protected voidsetWorkspace(org.opencastproject.workspace.api.Workspace workspace)Sets the workspacevoidupdated(Dictionary properties)
-
-
-
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
-
ANALYSIS_JOB_LOAD_KEY
public static final String ANALYSIS_JOB_LOAD_KEY
The key to look for in the service configuration file to override theDEFAULT_ANALYSIS_JOB_LOAD- 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
-
-
Method Detail
-
activate
public void activate(org.osgi.service.component.ComponentContext cc)
OSGi callback on component activation.- Overrides:
activatein classorg.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:
extractin interfaceorg.opencastproject.textanalyzer.api.TextAnalyzerService- Throws:
org.opencastproject.textanalyzer.api.TextAnalyzerExceptionorg.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:
processin classorg.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 imageid- 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:
getServiceRegistryin classorg.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:
getSecurityServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
AbstractJobProducer.getSecurityService()
-
getUserDirectoryService
protected org.opencastproject.security.api.UserDirectoryService getUserDirectoryService()
- Specified by:
getUserDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
AbstractJobProducer.getUserDirectoryService()
-
getOrganizationDirectoryService
protected org.opencastproject.security.api.OrganizationDirectoryService getOrganizationDirectoryService()
- Specified by:
getOrganizationDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
AbstractJobProducer.getOrganizationDirectoryService()
-
updated
public void updated(Dictionary properties) throws org.osgi.service.cm.ConfigurationException
- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException
-
setReadinessIndicator
public void setReadinessIndicator(org.opencastproject.util.ReadinessIndicator readinessIndicator)
-
-