Class ClassPathImpl

java.lang.Object
org.jppf.node.protocol.ClassPathImpl
All Implemented Interfaces:
Serializable, Iterable<ClassPathElement>, ClassPath

public class ClassPathImpl extends Object implements ClassPath
A simple implementation of the ClassPath interface
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • ClassPathImpl

      public ClassPathImpl()
  • Method Details

    • iterator

      public Iterator<ClassPathElement> iterator()
      Specified by:
      iterator in interface Iterable<ClassPathElement>
    • add

      public ClassPath add(ClassPathElement element)
      Description copied from interface: ClassPath
      Add the specified element to this classpath.
      Specified by:
      add in interface ClassPath
      Parameters:
      element - the classpath element to add.
      Returns:
      this ClassPath.
    • add

      public ClassPath add(Location<?> location)
      Description copied from interface: ClassPath
      Add the specified element to this classpath. When using this method, the local and remote locations are assumed to be the same.
      Specified by:
      add in interface ClassPath
      Parameters:
      location - the location of the element to add.
      Returns:
      this ClassPath, for method call chaining.
    • add

      public ClassPath add(Location<?> sourceLocation, Location<?> targetLocation)
      Description copied from interface: ClassPath
      Add the specified element to this classpath. Upon processing by the node, the local location will be copied into the remote location.
      Specified by:
      add in interface ClassPath
      Parameters:
      sourceLocation - the location of the element to add, in the client environment.
      targetLocation - the location of the element to add, in the node environment.
      Returns:
      this ClassPath, for method call chaining.
    • add

      public ClassPath add(Location<?> sourceLocation, Location<?> targetLocation, boolean copyToExistingFileLocation)
      Description copied from interface: ClassPath
      Add the specified element to this classpath. Upon processing by the node, the local location will be copied into the remote location, unless all of the following are true:
      • copyToExistingFile is false
      • targetLocation is a FileLocation
      • the file pointed to by targetLocation already exists on the file system
      Specified by:
      add in interface ClassPath
      Parameters:
      sourceLocation - the location of the element to add, in the client environment.
      targetLocation - the location of the element to add, in the node environment.
      copyToExistingFileLocation - whether to copy the source to the target if the target is either a FileLocation or an URLLocation with a file URL protocol (e.g. file:/home/user/mylib.jar), and if it already exists on the file system.
      Returns:
      this ClassPath, for method call chaining.
    • add

      public ClassPath add(String name, Location<?> location)
      Deprecated.
      the name attribute has no clearly defined, consistent semantics. It is no longer used.
      Add the specified element to this classpath. When using this method, the local and remote locations are assumed to be the same.
      Specified by:
      add in interface ClassPath
      Parameters:
      name - the the name of the element to add.
      location - the location of the element to add.
      Returns:
      this ClassPath, for method call chaining.
    • add

      public ClassPath add(String name, Location<?> localLocation, Location<?> remoteLocation)
      Deprecated.
      the name attribute has no clearly defined, consistent semantics. It is no longer used.
      Add the specified element to this classpath. Upon processing by the node, the source location will be copied into the target location.
      Specified by:
      add in interface ClassPath
      Parameters:
      name - the the name of the element to add.
      localLocation - the location of the element to add, in the client environment.
      remoteLocation - the location of the element to add, in the node environment.
      Returns:
      this ClassPath, for method call chaining.
    • remove

      public ClassPath remove(ClassPathElement element)
      Description copied from interface: ClassPath
      Remove the specified element from this classpath.
      Specified by:
      remove in interface ClassPath
      Parameters:
      element - the classpath element to remove.
      Returns:
      this ClassPath, for method call chaining.
    • remove

      public ClassPath remove(String name)
      Deprecated.
      the name attribute has no clearly defined, consistent semantics. It is no longer used.
      Remove the specified element from this classpath.
      Specified by:
      remove in interface ClassPath
      Parameters:
      name - the name of the classpath element to remove.
      Returns:
      this ClassPath, for method call chaining.
    • clear

      public ClassPath clear()
      Description copied from interface: ClassPath
      Empty this classpath (remove all classpath elements).
      Specified by:
      clear in interface ClassPath
      Returns:
      this ClassPath, for method call chaining.
    • element

      public ClassPathElement element(String name)
      Deprecated.
      the name attribute has no clearly defined, consistent semantics. It is no longer used.
      Get the element with the specified name.
      Specified by:
      element in interface ClassPath
      Parameters:
      name - the name of the classpath element to find.
      Returns:
      a ClassPathElement instance or null if the element could no be found.
    • allElements

      public Collection<ClassPathElement> allElements()
      Description copied from interface: ClassPath
      Get a collection of all the classpath elements in this classpath.
      Specified by:
      allElements in interface ClassPath
      Returns:
      a Collection of ClassPathElements.
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: ClassPath
      Determine whether this classpath is empty.
      Specified by:
      isEmpty in interface ClassPath
      Returns:
      true if this classpath has no element, false otherwise.
    • isForceClassLoaderReset

      public boolean isForceClassLoaderReset()
      Description copied from interface: ClassPath
      Determine whether the node should force a reset of the class loader before executing the tasks.

      This only applies when this classpath is empty. If it is not empty, then the reset will occur regardless the value of this flag.

      Specified by:
      isForceClassLoaderReset in interface ClassPath
      Returns:
      true if the class loader reset should be forced, false otherwise.
    • setForceClassLoaderReset

      public ClassPath setForceClassLoaderReset(boolean forceClassLoaderReset)
      Description copied from interface: ClassPath
      Specify whether the node should force a reset of the class loader before executing the tasks.

      This only applies when this classpath is empty. If it is not empty, then the reset will occur regardless the value of the specified flag.

      Specified by:
      setForceClassLoaderReset in interface ClassPath
      Parameters:
      forceClassLoaderReset - true if the class loader reset should be forced, false otherwise.
      Returns:
      this ClassPath, for method call chaining.
    • toString

      public String toString()
      Overrides:
      toString in class Object