com.bbn.openmap.util.wanderer
Class Wanderer

java.lang.Object
  extended by com.bbn.openmap.util.wanderer.Wanderer
Direct Known Subclasses:
ChangeCase, DataPathWanderer, DTEDLocator, OneWaySync, Purge, SVGSourceFileReorganizer

public class Wanderer
extends java.lang.Object

A Wanderer is a class that traverses a directory tree and finds files and directories. It then makes a method call on the WandererCallback class to have something done on those directories or files. Subclasses can set whether the search is exhaustive (ignoring returns from handleDirectory that the search was successful) and/or runs top to bottom of the directory structure, or bottom to top.


Field Summary
protected  boolean exhaustiveSearch
           
protected  boolean topToBottom
           
 
Constructor Summary
Wanderer()
           
Wanderer(WandererCallback callback)
           
 
Method Summary
 WandererCallback getCallback()
           
protected  boolean handleDirectory(java.io.File directory, java.lang.String[] contentNames)
          Management method for the wanderer, that steps through the children of the directory and calls handleEntry for them.
 boolean handleEntry(java.io.File file)
          Given a file representing a top-level directory, start wandering the tree and call handleDirectory or handleFile on the WandererCallback.
 boolean isExhaustiveSearch()
           
 boolean isTopToBottom()
           
static void main(java.lang.String[] argv)
          Given a set of files or directories, parade through them to change their case.
 void setCallback(WandererCallback cb)
           
 void setExhaustiveSearch(boolean exhaustiveSearch)
           
 void setTopToBottom(boolean topToBottom)
          Set to true if handleDirectory is called before moving to handleFile/handleDirectory for child files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exhaustiveSearch

protected boolean exhaustiveSearch

topToBottom

protected boolean topToBottom
Constructor Detail

Wanderer

public Wanderer()

Wanderer

public Wanderer(WandererCallback callback)
Method Detail

setCallback

public void setCallback(WandererCallback cb)

getCallback

public WandererCallback getCallback()

handleEntry

public boolean handleEntry(java.io.File file)
Given a file representing a top-level directory, start wandering the tree and call handleDirectory or handleFile on the WandererCallback.

Parameters:
file - File (directory) to start at.
Returns:
true if the wandering should continue.

handleDirectory

protected boolean handleDirectory(java.io.File directory,
                                  java.lang.String[] contentNames)
                           throws java.lang.SecurityException
Management method for the wanderer, that steps through the children of the directory and calls handleEntry for them.

Parameters:
directory - the directory to handle
contentNames - an array of Strings representing children of the directory
Returns:
true if the wandering should continue.
Throws:
java.lang.SecurityException

isExhaustiveSearch

public boolean isExhaustiveSearch()

setExhaustiveSearch

public void setExhaustiveSearch(boolean exhaustiveSearch)
Parameters:
exhaustiveSearch - set to true if you want to ignore the handleDirectory and handleFile return values.

isTopToBottom

public boolean isTopToBottom()

setTopToBottom

public void setTopToBottom(boolean topToBottom)
Set to true if handleDirectory is called before moving to handleFile/handleDirectory for child files.

Parameters:
topToBottom -

main

public static void main(java.lang.String[] argv)
Given a set of files or directories, parade through them to change their case.

Parameters:
argv - paths to files or directories, use -h to get a usage statement.


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details