au.com.prunge.jgenfile
Interface GetRootsOperation

All Superinterfaces:
FileSystemOperation, Operation
All Known Implementing Classes:
LocalGetRootsOperation

public interface GetRootsOperation
extends FileSystemOperation

An operation that retrieves the roots of a file system.

Version:
1.0
Author:
Peter Runge

Method Summary
 List getRoots()
          Returns a list of items which are the roots.
 au.com.prunge.jgenfile.ItemIterator getRootsIterator()
          Returns an iterator that can iterate through the roots in the file system.
 
Methods inherited from interface au.com.prunge.jgenfile.FileSystemOperation
getFileSystem
 
Methods inherited from interface au.com.prunge.jgenfile.Operation
abort, addOperationHints, getLastRunException, getOperationHint, getOperationHints, hasRun, run, setOperationHint, setOperationHints
 

Method Detail

getRoots

public List getRoots()
              throws OperationNotFinishedException,
                     IllegalStateException,
                     JGenFileException
Returns a list of items which are the roots. Only one of the getRoots() and getRootsIterator() methods can be called for each operation. If both methods are called for a single operation, an IllegalCallException should be thrown.

Returns:
a list of items.
Throws:
OperationNotFinishedException - if this method was called and the run() method has not finished or has not been called.
IllegalStateException - if the getRootsIterator() method has already been called.
JGenFileException - if another error occurs.

getRootsIterator

public au.com.prunge.jgenfile.ItemIterator getRootsIterator()
                                                     throws OperationNotFinishedException,
                                                            IllegalStateException,
                                                            JGenFileException
Returns an iterator that can iterate through the roots in the file system. This method should return one and only one iterator, such that if an iterator that is returned is advanced, then subsequent calls to this method should return that same iterator that has advanced in position.

When finished using the iterator, it must be closed with the close() method. This is very important since iterating through a directory listing may require resources such as a socket which cannot be closed until the iterator is closed.

Only one of the getRoots() and getRootsIterator() methods can be called for each operation. If both methods are called for a single operation, an IllegalCallException should be thrown.

Returns:
an iterator to iterate through the roots.
Throws:
OperationNotFinishedException - if this method was called and the run() method has not finished or has not been called.
IllegalStateException - if the getRoots() method has already been called.
JGenFileException - if another error occurs.