Class AbstractFileSubtreeWalker<T>

java.lang.Object
gov.nasa.pds.tools.validate.rule.AbstractFileSubtreeWalker<T>
Type Parameters:
T - the type used by the concrete subclass to keep track of state

public abstract class AbstractFileSubtreeWalker<T>
extends Object
Implements a class that walks a file system subtree and performs an operation on each file or directory found.
  • Constructor Details

    • AbstractFileSubtreeWalker

      public AbstractFileSubtreeWalker()
  • Method Details

    • walkSubtree

      public void walkSubtree​(URL url, T state)
      Walks a subtree starting from a specified file or directory.
      Parameters:
      f - a file or directory
      state - the state managed by the caller
    • handleDirectory

      protected abstract T handleDirectory​(URL dir, T state) throws Exception
      Handles encountering a directory. Subclasses should implement the processing for directories in this method.
      Parameters:
      dir - the directory encountered
      state - the current walking state
      Returns:
      the new state for walking children of this directory
      Throws:
      Exception - if there is an error processing the directory
    • handleFile

      protected abstract void handleFile​(URL f, T state) throws Exception
      Handles encountering a file. Subclasses should implement the processing for files in this method.
      Parameters:
      f - the file encountered
      state - the current walking state
      Throws:
      Exception - if there is an error processing the file