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 Details

    • installedWorkflows

      protected Map<WorkflowIdentifier,WorkflowDefinition> installedWorkflows
      An internal collection of workflows that we have installed
    • workflowStateMappings

      protected Map<String,Set<WorkflowStateMapping>> workflowStateMappings
      All workflow state mappings which are configured for the workflow defintions
    • artifactIds

      protected Map<File,WorkflowIdentifier> artifactIds
      An internal collection of artifact id, bind the workflow definition files and their id
    • artifactsWithError

      protected final List<File> artifactsWithError
      List of artifact parsed with error
  • Constructor Details

    • WorkflowDefinitionScanner

      public WorkflowDefinitionScanner()
  • Method Details

    • setOrganizationDirectoryService

      public void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService)
    • install

      public void install(File artifact)
      Specified by:
      install in interface org.apache.felix.fileinstall.ArtifactInstaller
      See Also:
      • ArtifactInstaller.install(java.io.File)
    • uninstall

      public void uninstall(File artifact)
      Specified by:
      uninstall in interface org.apache.felix.fileinstall.ArtifactInstaller
      See Also:
      • ArtifactInstaller.uninstall(java.io.File)
    • update

      public void update(File artifact)
      Specified by:
      update in interface org.apache.felix.fileinstall.ArtifactInstaller
      See Also:
      • ArtifactInstaller.update(java.io.File)
    • organizationRegistered

      public void organizationRegistered(Organization organization)
      Description copied from interface: OrganizationDirectoryListener
      This callback notifies listeners about an organization that appeared in the organization directory.
      Specified by:
      organizationRegistered in interface OrganizationDirectoryListener
      Parameters:
      organization - the organization
    • organizationUnregistered

      public void organizationUnregistered(Organization organization)
      Description copied from interface: OrganizationDirectoryListener
      This callback notifies listeners about an organization that disappeared from the organization directory.
      Specified by:
      organizationUnregistered in interface OrganizationDirectoryListener
      Parameters:
      organization - the organization
    • organizationUpdated

      public void organizationUpdated(Organization organization)
      Description copied from interface: OrganizationDirectoryListener
      This callback notifies listeners about an organization that was updated.
      Specified by:
      organizationUpdated in interface OrganizationDirectoryListener
      Parameters:
      organization - the organization
    • parseWorkflowDefinitionFile

      public WorkflowDefinition parseWorkflowDefinitionFile(File artifact)
      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 be null)
      user - The user to check for (must not be null)
      Returns:
      A stream of available organizations
    • getWorkflowDefinition

      public WorkflowDefinition 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.
      Parameters:
      user - The user to check for
      workflowIdentifier - The workflow identifier
      Returns:
      Either null if no workflow is found for this identifier, or the workflow definition.
    • putWorkflowDefinition

      public void putWorkflowDefinition(WorkflowIdentifier identifier, WorkflowDefinition wfd)
      Add the given workflow definition to the installed workflow definition id.
      Parameters:
      identifier - the identifier of the workflow definition to add
      wfd - the workflow definition
    • removeWorkflowDefinition

      public WorkflowDefinition removeWorkflowDefinition(WorkflowIdentifier identifier)
      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

      public boolean canHandle(File artifact)
      Specified by:
      canHandle in interface org.apache.felix.fileinstall.ArtifactListener
      See Also:
      • ArtifactListener.canHandle(java.io.File)