Class WorkflowDefinitionScanner
java.lang.Object
org.opencastproject.workflow.impl.WorkflowDefinitionScanner
- All Implemented Interfaces:
org.apache.felix.fileinstall.ArtifactInstaller,org.apache.felix.fileinstall.ArtifactListener,OrganizationDirectoryListener
public class WorkflowDefinitionScanner
extends Object
implements org.apache.felix.fileinstall.ArtifactInstaller, OrganizationDirectoryListener
Loads, unloads, and reloads
WorkflowDefinitions from "*workflow.xml" files in any of fileinstall's watch
directories.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<File, WorkflowIdentifier> An internal collection of artifact id, bind the workflow definition files and their idList of artifact parsed with errorprotected Map<WorkflowIdentifier, WorkflowDefinition> An internal collection of workflows that we have installedprotected Map<String, Set<WorkflowStateMapping>> All workflow state mappings which are configured for the workflow defintions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAvailableWorkflowDefinitions(Organization organization, User user) Return available workflow definitions This method finds workflows that are either globally defined or have the correct organization/roles set.getWorkflowDefinition(User user, WorkflowIdentifier workflowIdentifier) Return the workflow definition for a given workflow identifier This method tries to get the workflow using the exact identifier and falls back to the global workflow (without the organization) if that fails.voidvoidorganizationRegistered(Organization organization) This callback notifies listeners about an organization that appeared in the organization directory.voidorganizationUnregistered(Organization organization) This callback notifies listeners about an organization that disappeared from the organization directory.voidorganizationUpdated(Organization organization) This callback notifies listeners about an organization that was updated.parseWorkflowDefinitionFile(File artifact) Parse the given workflow definition file and return the related workflow definitionvoidputWorkflowDefinition(WorkflowIdentifier identifier, WorkflowDefinition wfd) Add the given workflow definition to the installed workflow definition id.removeWorkflowDefinition(WorkflowIdentifier identifier) Remove the workflow definition with the given id from the installed definition list.voidsetOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService) voidvoid
-
Field Details
-
installedWorkflows
An internal collection of workflows that we have installed -
workflowStateMappings
All workflow state mappings which are configured for the workflow defintions -
artifactIds
An internal collection of artifact id, bind the workflow definition files and their id -
artifactsWithError
List of artifact parsed with error
-
-
Constructor Details
-
WorkflowDefinitionScanner
public WorkflowDefinitionScanner()
-
-
Method Details
-
setOrganizationDirectoryService
public void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService) -
install
- Specified by:
installin interfaceorg.apache.felix.fileinstall.ArtifactInstaller- See Also:
-
uninstall
- Specified by:
uninstallin interfaceorg.apache.felix.fileinstall.ArtifactInstaller- See Also:
-
update
- Specified by:
updatein interfaceorg.apache.felix.fileinstall.ArtifactInstaller- See Also:
-
organizationRegistered
Description copied from interface:OrganizationDirectoryListenerThis callback notifies listeners about an organization that appeared in the organization directory.- Specified by:
organizationRegisteredin interfaceOrganizationDirectoryListener- Parameters:
organization- the organization
-
organizationUnregistered
Description copied from interface:OrganizationDirectoryListenerThis callback notifies listeners about an organization that disappeared from the organization directory.- Specified by:
organizationUnregisteredin interfaceOrganizationDirectoryListener- Parameters:
organization- the organization
-
organizationUpdated
Description copied from interface:OrganizationDirectoryListenerThis callback notifies listeners about an organization that was updated.- Specified by:
organizationUpdatedin interfaceOrganizationDirectoryListener- Parameters:
organization- the organization
-
parseWorkflowDefinitionFile
Parse the given workflow definition file and return the related workflow definition- Parameters:
artifact- The workflow definition file to parse- Returns:
- the workflow definition if the given contained a valid one, or null if the file can not be parsed.
-
getAvailableWorkflowDefinitions
public Stream<WorkflowDefinition> getAvailableWorkflowDefinitions(Organization organization, User user) Return available workflow definitions This method finds workflows that are either globally defined or have the correct organization/roles set.- Parameters:
organization- The organization to check for (must not benull)user- The user to check for (must not benull)- Returns:
- A stream of available organizations
-
getWorkflowDefinition
Return the workflow definition for a given workflow identifier This method tries to get the workflow using the exact identifier and falls back to the global workflow (without the organization) if that fails.- Parameters:
user- The user to check forworkflowIdentifier- The workflow identifier- Returns:
- Either
nullif no workflow is found for this identifier, or the workflow definition.
-
putWorkflowDefinition
Add the given workflow definition to the installed workflow definition id.- Parameters:
identifier- the identifier of the workflow definition to addwfd- the workflow definition
-
removeWorkflowDefinition
Remove the workflow definition with the given id from the installed definition list.- Parameters:
identifier- the workflow definition identifier- Returns:
- the removed workflow definition
-
canHandle
- Specified by:
canHandlein interfaceorg.apache.felix.fileinstall.ArtifactListener- See Also:
-