Class ExecuteServiceImpl

java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.execute.impl.ExecuteServiceImpl
All Implemented Interfaces:
org.opencastproject.execute.api.ExecuteService, org.opencastproject.job.api.JobProducer, org.osgi.service.cm.ManagedService

public class ExecuteServiceImpl extends org.opencastproject.job.api.AbstractJobProducer implements org.opencastproject.execute.api.ExecuteService, org.osgi.service.cm.ManagedService
Implements a service that runs CLI commands with MediaPackage elements as arguments
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Set<String>
    List of allowed commands that can be run with an executor.
    static final String
    Bundle property specifying which commands can be run with this executor
    static final float
    The approximate load placed on the system by running an execute operation
    static final String
    The key to look for in the service configuration file to override the DEFAULT_EXECUTE_JOB_LOAD
    protected org.opencastproject.security.api.OrganizationDirectoryService
    The organization directory service
    protected org.opencastproject.security.api.SecurityService
    The security service
    protected org.opencastproject.security.api.UserDirectoryService
    The user directory service
    protected org.opencastproject.workspace.api.Workspace
    The workspace 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.execute.api.ExecuteService

    COLLECTION, ENDPOINT_NAME, EXEC_FORM_PARAM, INPUT_ELEM_FORM_PARAM, INPUT_FILE_PATTERN, INPUT_MP_FORM_PARAM, JOB_TYPE, LOAD_FORM_PARAM, MP_ID_PATTERN, ORG_ID_PATTERN, OUTPUT_FILE_PATTERN, OUTPUT_NAME_FORM_PARAMETER, PARAMS_FORM_PARAM, TYPE_FORM_PARAMETER
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of the execute service.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(org.osgi.service.component.ComponentContext cc)
    Activates this component with its properties once all of the collaborating services have been set
    protected String
    doProcess(List<String> arguments, org.opencastproject.mediapackage.MediaPackageElement element, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType)
    Does the actual processing, given a mediapackage element (Execute Many WOH)
    protected String
    doProcess(List<String> arguments, org.opencastproject.mediapackage.MediaPackage mp, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType)
    Does the actual processing, given a mediapackage (Execute Once WOH)
    org.opencastproject.job.api.Job
    execute(String exec, String params, org.opencastproject.mediapackage.MediaPackageElement inElement, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType, float load)
    org.opencastproject.job.api.Job
    execute(String exec, String params, org.opencastproject.mediapackage.MediaPackage mp, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType, float load)
    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.
    void
    setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)
    Sets the receipt service
    void
    setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
    Callback for setting the user directory service.
    void
    setWorkspace(org.opencastproject.workspace.api.Workspace workspace)
    Sets a reference to the workspace service.
    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

    • 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
    • workspace

      protected org.opencastproject.workspace.api.Workspace workspace
      The workspace service
    • allowedCommands

      protected final Set<String> allowedCommands
      List of allowed commands that can be run with an executor. By convention, an empty set doesn't mean any command can be run. An '*' in the service configuration means any command can be executed
    • COMMANDS_ALLOWED_PROPERTY

      public static final String COMMANDS_ALLOWED_PROPERTY
      Bundle property specifying which commands can be run with this executor
      See Also:
    • DEFAULT_EXECUTE_JOB_LOAD

      public static final float DEFAULT_EXECUTE_JOB_LOAD
      The approximate load placed on the system by running an execute operation
      See Also:
    • EXECUTE_JOB_LOAD_KEY

      public static final String EXECUTE_JOB_LOAD_KEY
      The key to look for in the service configuration file to override the DEFAULT_EXECUTE_JOB_LOAD
      See Also:
  • Constructor Details

    • ExecuteServiceImpl

      public ExecuteServiceImpl()
      Creates a new instance of the execute service.
  • Method Details

    • activate

      public void activate(org.osgi.service.component.ComponentContext cc)
      Activates this component with its properties once all of the collaborating services have been set
      Overrides:
      activate in class org.opencastproject.job.api.AbstractJobProducer
      Parameters:
      cc - The component's context, containing the properties used for configuration
    • execute

      public org.opencastproject.job.api.Job execute(String exec, String params, org.opencastproject.mediapackage.MediaPackageElement inElement, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType, float load) throws org.opencastproject.execute.api.ExecuteException, IllegalArgumentException
      Specified by:
      execute in interface org.opencastproject.execute.api.ExecuteService
      Throws:
      IllegalArgumentException - if the input arguments are incorrect
      org.opencastproject.execute.api.ExecuteException - if an internal error occurs
      See Also:
      • ExecuteService.execute(java.lang.String, java.lang.String, org.opencastproject.mediapackage.MediaPackageElement, java.lang.String, org.opencastproject.mediapackage.MediaPackageElement.Type, float)
    • execute

      public org.opencastproject.job.api.Job execute(String exec, String params, org.opencastproject.mediapackage.MediaPackage mp, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType, float load) throws org.opencastproject.execute.api.ExecuteException
      Specified by:
      execute in interface org.opencastproject.execute.api.ExecuteService
      Throws:
      org.opencastproject.execute.api.ExecuteException
      See Also:
      • ExecuteService.execute(java.lang.String, java.lang.String, org.opencastproject.mediapackage.MediaPackage, java.lang.String, org.opencastproject.mediapackage.MediaPackageElement.Type, float)
    • process

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

      protected String doProcess(List<String> arguments, org.opencastproject.mediapackage.MediaPackage mp, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType) throws org.opencastproject.execute.api.ExecuteException
      Does the actual processing, given a mediapackage (Execute Once WOH)
      Parameters:
      arguments - The list containing the program and its arguments
      mp - MediaPackage used in the operation
      outFileName - The name of the resulting file
      expectedType - The expected element type
      Returns:
      A String containing the command output
      Throws:
      org.opencastproject.execute.api.ExecuteException - if some internal error occurred
    • doProcess

      protected String doProcess(List<String> arguments, org.opencastproject.mediapackage.MediaPackageElement element, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType) throws org.opencastproject.execute.api.ExecuteException
      Does the actual processing, given a mediapackage element (Execute Many WOH)
      Parameters:
      arguments - The list containing the program and its arguments
      outFileName - The name of the resulting file
      expectedType - The expected element type
      Returns:
      A String containing the command output
      Throws:
      org.opencastproject.execute.api.ExecuteException - if some internal error occurred
    • setServiceRegistry

      public 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()
    • getSecurityService

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

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

      public void setWorkspace(org.opencastproject.workspace.api.Workspace workspace)
      Sets a reference to the workspace service.
      Parameters:
      workspace -
    • 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