Package org.opencastproject.execute.impl
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionList of allowed commands that can be run with an executor.static final StringBundle property specifying which commands can be run with this executorstatic final floatThe approximate load placed on the system by running an execute operationstatic final StringThe key to look for in the service configuration file to override theDEFAULT_EXECUTE_JOB_LOADprotected org.opencastproject.security.api.OrganizationDirectoryServiceThe organization directory serviceprotected org.opencastproject.security.api.SecurityServiceThe security serviceprotected org.opencastproject.security.api.UserDirectoryServiceThe user directory serviceprotected org.opencastproject.workspace.api.WorkspaceThe workspace serviceFields 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.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 -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) Activates this component with its properties once all of the collaborating services have been setprotected StringdoProcess(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 StringdoProcess(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.Jobexecute(String exec, String params, org.opencastproject.mediapackage.MediaPackageElement inElement, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType, float load) org.opencastproject.job.api.Jobexecute(String exec, String params, org.opencastproject.mediapackage.MediaPackage mp, String outFileName, org.opencastproject.mediapackage.MediaPackageElement.Type expectedType, float load) protected org.opencastproject.security.api.OrganizationDirectoryServiceprotected org.opencastproject.security.api.SecurityServiceprotected org.opencastproject.serviceregistry.api.ServiceRegistryprotected org.opencastproject.security.api.UserDirectoryServiceprotected Stringprocess(org.opencastproject.job.api.Job job) voidsetOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory) Sets a reference to the organization directory service.voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService) Callback for setting the security service.voidsetServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) Sets the receipt servicevoidsetUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) Callback for setting the user directory service.voidsetWorkspace(org.opencastproject.workspace.api.Workspace workspace) Sets a reference to the workspace service.voidupdated(Dictionary properties) Methods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Field Details
-
securityService
protected org.opencastproject.security.api.SecurityService securityServiceThe security service -
userDirectoryService
protected org.opencastproject.security.api.UserDirectoryService userDirectoryServiceThe user directory service -
organizationDirectoryService
protected org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryServiceThe organization directory service -
workspace
protected org.opencastproject.workspace.api.Workspace workspaceThe workspace service -
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
Bundle property specifying which commands can be run with this executor- See Also:
-
DEFAULT_EXECUTE_JOB_LOAD
public static final float DEFAULT_EXECUTE_JOB_LOADThe approximate load placed on the system by running an execute operation- See Also:
-
EXECUTE_JOB_LOAD_KEY
The key to look for in the service configuration file to override theDEFAULT_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:
activatein classorg.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:
executein interfaceorg.opencastproject.execute.api.ExecuteService- Throws:
IllegalArgumentException- if the input arguments are incorrectorg.opencastproject.execute.api.ExecuteException- if an internal error occurs- See Also:
-
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:
executein interfaceorg.opencastproject.execute.api.ExecuteService- Throws:
org.opencastproject.execute.api.ExecuteException- See Also:
-
process
protected String process(org.opencastproject.job.api.Job job) throws org.opencastproject.execute.api.ExecuteException - Specified by:
processin classorg.opencastproject.job.api.AbstractJobProducer- Throws:
org.opencastproject.execute.api.ExecuteException- See Also:
-
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 argumentsmp- MediaPackage used in the operationoutFileName- The name of the resulting fileexpectedType- The expected element type- Returns:
- A
Stringcontaining 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 argumentsoutFileName- The name of the resulting fileexpectedType- The expected element type- Returns:
- A
Stringcontaining 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:
getServiceRegistryin classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
getSecurityService
protected org.opencastproject.security.api.SecurityService getSecurityService()- Specified by:
getSecurityServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
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:
getUserDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
getOrganizationDirectoryService
protected org.opencastproject.security.api.OrganizationDirectoryService getOrganizationDirectoryService()- Specified by:
getOrganizationDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
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
- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException
-