org.extex.resource
Class ResourceFinderList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<ResourceFinder>
              extended by org.extex.resource.ResourceFinderList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<ResourceFinder>, java.util.Collection<ResourceFinder>, java.util.List<ResourceFinder>, java.util.RandomAccess, RecursiveFinder, ResourceFinder

public class ResourceFinderList
extends java.util.ArrayList<ResourceFinder>
implements ResourceFinder, RecursiveFinder

This class provides a means to combine several resource finders to be queried as one.

Version:
$Revision: 6871 $
Author:
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ResourceFinderList()
          Creates a new object.
 
Method Summary
 boolean add(ResourceFinder finder)
          
 void enableTracing(boolean flag)
          Enable or disable the tracing.
 NamedInputStream findResource(java.lang.String name, java.lang.String type)
          Find a resource which can be used for reading.
 void setParent(ResourceFinder theParent)
          Setter for the parent resource finder.
 java.lang.String toString()
           
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

ResourceFinderList

public ResourceFinderList()
Creates a new object. Initially the list is empty.

Method Detail

add

public boolean add(ResourceFinder finder)

Specified by:
add in interface java.util.Collection<ResourceFinder>
Specified by:
add in interface java.util.List<ResourceFinder>
Overrides:
add in class java.util.ArrayList<ResourceFinder>
See Also:
ArrayList.add(java.lang.Object)

enableTracing

public void enableTracing(boolean flag)
Enable or disable the tracing. The argument indicates whether tracing should be enabled or disabled. The resource finder can decide on its own how to perform tracing. The preferred way is to write tracing records to a logger.

Specified by:
enableTracing in interface ResourceFinder
Parameters:
flag - indicator whether tracing should be turned on or off.
See Also:
ResourceFinder.enableTracing(boolean)

findResource

public NamedInputStream findResource(java.lang.String name,
                                     java.lang.String type)
                              throws ConfigurationException
Find a resource which can be used for reading. If the search fails then null is returned.

Specified by:
findResource in interface ResourceFinder
Parameters:
name - the base name of the resource
type - the type, i.e. the extension
Returns:
the file or null if none could be found
Throws:
ConfigurationException - in case of an exception
See Also:
ResourceFinder.findResource(java.lang.String, java.lang.String)

setParent

public void setParent(ResourceFinder theParent)
Setter for the parent resource finder.

Specified by:
setParent in interface RecursiveFinder
Parameters:
theParent - the parent finder for recursive invocation
See Also:
RecursiveFinder.setParent( org.extex.resource.ResourceFinder)

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection<ResourceFinder>
See Also:
Object.toString()