org.apache.commons.pipeline.stage
Class FileFinderStage

java.lang.Object
  extended by org.apache.commons.pipeline.stage.BaseStage
      extended by org.apache.commons.pipeline.stage.FileFinderStage
All Implemented Interfaces:
Stage

public class FileFinderStage
extends BaseStage

This Stage is used to recursively find (non-directory) files that match the specified regex.

File elements in the stage's queue will be recursively searched with the resulting File objects placed on the subsequent stage's queue.


Field Summary
 
Fields inherited from class org.apache.commons.pipeline.stage.BaseStage
context
 
Constructor Summary
FileFinderStage()
          Creates a new instance of FileFinder
 
Method Summary
 String getFilePattern()
          Getter for property filePattern.
 void preprocess()
          Precompiles the regex pattern for matching against filenames
 void process(Object obj)
          This method inspects a File object to determine if it matches this FileFinder's filePattern property.
 void setFilePattern(String pattern)
          Setter for property filePattern.
 
Methods inherited from class org.apache.commons.pipeline.stage.BaseStage
emit, emit, init, postprocess, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileFinderStage

public FileFinderStage()
Creates a new instance of FileFinder

Method Detail

preprocess

public void preprocess()
                throws StageException
Precompiles the regex pattern for matching against filenames

Specified by:
preprocess in interface Stage
Overrides:
preprocess in class BaseStage
Throws:
StageException - an Exception thrown by an overriding implementation should be wrapped in a StageException
See Also:
Stage.preprocess()

process

public void process(Object obj)
This method inspects a File object to determine if it matches this FileFinder's filePattern property. If the File represents a directory, it recursively searches that directory and all subdirectories for matching files. Matched files are placed on the next stage's queue.

Specified by:
process in interface Stage
Overrides:
process in class BaseStage
Parameters:
obj - Object to be passed to downstream pipeline.

getFilePattern

public String getFilePattern()
Getter for property filePattern.

Returns:
Value of property filePattern.

setFilePattern

public void setFilePattern(String pattern)
Setter for property filePattern.

Parameters:
pattern - Value of property filePattern.


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.