Class DependencyProcessor

  extended by org.embl.ebi.escience.scufl.Processor
      extended by org.embl.ebi.escience.scuflworkers.dependency.DependencyProcessor
All Implemented Interfaces:, IProcessor
Direct Known Subclasses:
APIConsumerProcessor, BeanshellProcessor

public abstract class DependencyProcessor
extends Processor

A processor that needs dependency management. Typical subclasses are org.embl.ebi.escience.scuflworkers.apiconsumer.BeanshellProcessor and org.embl.ebi.escience.scuflworkers.beanshell.APIConsumerProcessor. This abstract Processor defines dependencies on local JAR files or Raven artefacts.

Stian Soiland
See Also:
Serialized Form

Nested Class Summary
static class DependencyProcessor.ClassLoaderSharing
          Different ways to share class loader.
Field Summary
 java.util.LinkedHashSet<BasicArtifact> artifactDependencies
          Artifact dependencies.
 java.util.LinkedHashSet<java.lang.String> localDependencies
          Local dependencies, ie.
 java.util.LinkedHashSet<> repositories
          Repositories to use when searching for artifacts.
Fields inherited from interface org.embl.ebi.escience.scufl.IProcessor
Constructor Summary
DependencyProcessor(ScuflModel model, java.lang.String name)
Method Summary
 java.lang.ClassLoader findClassLoader()
          Find and possibly build the classloader.
 DependencyProcessor.ClassLoaderSharing getClassLoaderSharing()
          Return the current classloader sharing policy as used by findClassLoader().
 void setClassLoaderSharing(DependencyProcessor.ClassLoaderSharing sharing)
          Set the classloader sharing to the given policy.
Methods inherited from class org.embl.ebi.escience.scufl.Processor
addAlternate, addAnnotationTemplate, addBreakpoint, addPort, defaultAnnotationTemplates, fireModelEvent, getAlternatesArray, getAlternatesList, getAnnotationTemplates, getBackoff, getBoundInputPorts, getBoundOutputPorts, getCritical, getDefaultWorkers, getDescription, getInputPorts, getIterationStrategy, getLogLevel, getMaximumWorkers, getModel, getName, getOutputPorts, getPorts, getProperties, getRealLogLevel, getResourceHost, getRetries, getRetryDelay, getTimeout, getWorkers, hasBreakpoint, isBoring, isOffline, locatePort, locatePort, removeAlternate, removeAnnotationTemplate, removePort, rmvBreakpoint, setBackoff, setBoring, setCritical, setDescription, setIterationStrategy, setLogLevel, setName, setOffline, setOnline, setRetries, setRetryDelay, setTimeout, setWorkers, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


public final java.util.LinkedHashSet<java.lang.String> localDependencies
Local dependencies, ie. filenames of JARs. The files should be present in libDir, and the paths should be relative.


public final java.util.LinkedHashSet<BasicArtifact> artifactDependencies
Artifact dependencies. These artifacts should be available from the centrally known repositories or from one of the listed repositories in repositories.


public final java.util.LinkedHashSet<> repositories
Repositories to use when searching for artifacts. In addition, the system repositories will be searched.

Constructor Detail


public DependencyProcessor(ScuflModel model,
                           java.lang.String name)
                    throws ProcessorCreationException,
Method Detail


public java.lang.ClassLoader findClassLoader()
Find and possibly build the classloader. The classloader depends on the current classloader sharing policy as defined by setClassLoaderSharing(org.embl.ebi.escience.scuflworkers.dependency.DependencyProcessor.ClassLoaderSharing), and local dependencies as listed in localDependencies.

If the classloader sharing is DependencyProcessor.ClassLoaderSharing.fresh, a new classloader solely depending on the current localDependencies is returned. This policy would in effect reload classes for each iteration, so they would always be "fresh".

If the classloader sharing is DependencyProcessor.ClassLoaderSharing.iteration, the classloader will be built as for DependencyProcessor.ClassLoaderSharing.fresh, but only once per DependencyProcessor instance. In reality this would for Taverna mean once per processor per workflow run, as processors are built from scratch on execution. This policy would avoid reloading classes for each iteration, but each processor instance would still have different classloaders.

If the classloader sharing is DependencyProcessor.ClassLoaderSharing.workflow, a common classloader will be used for the whole workflow for all processors with the same policy. The dependencies will be constructed as the union of all localDependencies sets at the point of the first call to findClassLoader().

All of these classloaders will have as a parent the loader of this instance (ie. the loader of the deepest subclass of DependencyProcessor).

However, if the classloader sharing is DependencyProcessor.ClassLoaderSharing.system, the system classloader will be used. Note that dependencies are ignored and must be specified by -classpath when starting the Java. This is useful in combination with JNI based libraries, which would also require -Djava.library.path and possibly the operating system's PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH environment variable.

A new or existing ClassLoader according to the classloader sharing policy


public void setClassLoaderSharing(DependencyProcessor.ClassLoaderSharing sharing)
Set the classloader sharing to the given policy. This policy affects how findClassLoader() determines, builds and/or reuses classloaders.

By default, the classloader sharing is set to DependencyProcessor.ClassLoaderSharing.iteration.

sharing -
See Also:
DependencyProcessor.ClassLoaderSharing, findClassLoader()


public DependencyProcessor.ClassLoaderSharing getClassLoaderSharing()
Return the current classloader sharing policy as used by findClassLoader().

A DependencyProcessor.ClassLoaderSharing policy.