Interface ClassPath

All Superinterfaces:
Iterable<ClassPathElement>, Serializable
All Known Implementing Classes:
ClassPathImpl

public interface ClassPath extends Serializable, Iterable<ClassPathElement>
A container for class path elements.
Author:
Laurent Cohen
  • Method Details

    • add

      Add the specified element to this classpath.
      Parameters:
      element - the classpath element to add.
      Returns:
      this ClassPath.
    • add

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

      ClassPath add(Location<?> sourceLocation, Location<?> targetLocation)
      Add the specified element to this classpath. Upon processing by the node, the local location will be copied into the remote location.
      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

      ClassPath add(Location<?> sourceLocation, Location<?> targetLocation, boolean copyToExistingFile)
      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
      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.
      copyToExistingFile - 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

      ClassPath add(String name, Location<?> location)
      Deprecated.
      the name attribute has no clearly definied, consistent semantics. It is no longer used. Use add(location) instead.
      Add the specified element to this classpath. When using this method, the local and remote locations are assumed to be the same.
      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

      ClassPath add(String name, Location<?> sourceLocation, Location<?> targetLocation)
      Deprecated.
      the name attribute has no clearly definied, consistent semantics. It is no longer used. Use add(sourceLocation, remoteLocation) instead.
      Add the specified element to this classpath. Upon processing by the node, the source location will be copied into the target location.
      Parameters:
      name - the the name of the element to add.
      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.
    • remove

      ClassPath remove(ClassPathElement element)
      Remove the specified element from this classpath.
      Parameters:
      element - the classpath element to remove.
      Returns:
      this ClassPath, for method call chaining.
    • remove

      ClassPath remove(String name)
      Deprecated.
      the name attribute has no clearly definied, consistent semantics. It is no longer used. Use remove(ClassPathElement) instead.
      Remove the specified element from this classpath.
      Parameters:
      name - the name of the classpath element to remove.
      Returns:
      this ClassPath, for method call chaining.
    • clear

      ClassPath clear()
      Empty this classpath (remove all classpath elements).
      Returns:
      this ClassPath, for method call chaining.
    • element

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

      Get a collection of all the classpath elements in this classpath.
      Returns:
      a Collection of ClassPathElements.
    • isEmpty

      boolean isEmpty()
      Determine whether this classpath is empty.
      Returns:
      true if this classpath has no element, false otherwise.
    • isForceClassLoaderReset

      boolean isForceClassLoaderReset()
      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.

      Returns:
      true if the class loader reset should be forced, false otherwise.
    • setForceClassLoaderReset

      ClassPath setForceClassLoaderReset(boolean forceReset)
      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.

      Parameters:
      forceReset - true if the class loader reset should be forced, false otherwise.
      Returns:
      this ClassPath, for method call chaining.