idl.tmt.documentsource.filesystem
Class GenericFilesystemDocumentProvider

java.lang.Object
  |
  +--idl.tmt.documentsource.filesystem.GenericFilesystemDocumentProvider
All Implemented Interfaces:
DocumentProvider, FilesystemDocumentProvider

public class GenericFilesystemDocumentProvider
extends java.lang.Object
implements FilesystemDocumentProvider

This class implements a filesystemDocumentProvide for a generic filesystems. Created on Feb 25, 2004

Author:
jelsas

Inner Class Summary
private  class GenericFilesystemDocumentProvider.DirectoryFilter
           
private  class GenericFilesystemDocumentProvider.HTMLFileFilter
           
 
Field Summary
private  java.util.ArrayList fileList
           
private  int fileListIndex
           
private  java.io.FilenameFilter filter
           
private  java.io.File rootDir
           
 
Constructor Summary
GenericFilesystemDocumentProvider(java.io.File rootDir, java.io.FilenameFilter filter)
          Creates a new GenericFilesystemDocumentProvider.
 
Method Summary
 int documentCount()
          Returns a count of the documents left in this provier
 java.io.File getNextDocument()
          Returns the next document in our queue
 java.io.File getRoot()
          Returns the root directory of this document provider
 boolean hasMoreDocuments()
          Indicates whether or not there are more documets in the is provider
 void reset()
          Resets the index of our counter so that we can start at the beginning of our document list.
private  void traverseFilesystem()
          Traverses the file system starting at the root, populating the fileList with the documents that match our filter.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

rootDir

private java.io.File rootDir

fileList

private java.util.ArrayList fileList

fileListIndex

private int fileListIndex

filter

private java.io.FilenameFilter filter
Constructor Detail

GenericFilesystemDocumentProvider

public GenericFilesystemDocumentProvider(java.io.File rootDir,
                                         java.io.FilenameFilter filter)
                                  throws DocumentProviderException
Creates a new GenericFilesystemDocumentProvider. The File object passed in must represent an existing directory, otherwise a DocumentProviderException will be thrown. The FilenameFilter object passed in represents the type of file to be returned by this filter. If 'null' is passed in, this defaults to a HTML file filter.
Method Detail

documentCount

public int documentCount()
Returns a count of the documents left in this provier
Specified by:
documentCount in interface FilesystemDocumentProvider
See Also:
FilesystemDocumentProvider.documentCount()

traverseFilesystem

private void traverseFilesystem()
Traverses the file system starting at the root, populating the fileList with the documents that match our filter.

getRoot

public java.io.File getRoot()
Returns the root directory of this document provider
Specified by:
getRoot in interface FilesystemDocumentProvider
See Also:
FilesystemDocumentProvider.getRoot()

getNextDocument

public java.io.File getNextDocument()
Returns the next document in our queue
Specified by:
getNextDocument in interface DocumentProvider
See Also:
DocumentProvider.getNextDocument()

hasMoreDocuments

public boolean hasMoreDocuments()
Indicates whether or not there are more documets in the is provider
Specified by:
hasMoreDocuments in interface DocumentProvider
See Also:
DocumentProvider.hasMoreDocuments()

reset

public void reset()
Resets the index of our counter so that we can start at the beginning of our document list.