org.apache.excalibur.source
Interface TraversableSource

All Superinterfaces:
Source
All Known Subinterfaces:
ModifiableTraversableSource
All Known Implementing Classes:
FileSource

public interface TraversableSource
extends Source

A traversable source is a source that can have children and a parent, like a file system.

Version:
CVS $Revision: 1.5 $ $Date: 2004/02/28 11:47:26 $
Author:
Avalon Development Team

Method Summary
 Source getChild(java.lang.String name)
          Get a child of this source, given its name.
 java.util.Collection getChildren()
          Get the children of this source if this source is traversable.
 java.lang.String getName()
          Return the name of this source relative to its parent.
 Source getParent()
          Get the parent of this source as a Source object.
 boolean isCollection()
          Is this source a collection, i.e.
 
Methods inherited from interface org.apache.excalibur.source.Source
exists, getContentLength, getInputStream, getLastModified, getMimeType, getScheme, getURI, getValidity, refresh
 

Method Detail

isCollection

public boolean isCollection()
Is this source a collection, i.e. it possibly has children ? For a filesystem-based implementation, this would typically mean that this source represents a directory and not a file.

Returns:
true if the source exists and is traversable.

getChildren

public java.util.Collection getChildren()
                                 throws SourceException
Get the children of this source if this source is traversable.

Note: only those sources actually fetched from the collection need to be released using the SourceResolver.

Returns:
a collection of Sources (actually most probably TraversableSources).
Throws:
SourceException - this source is not traversable, or if some problem occurs.
See Also:
isCollection()

getChild

public Source getChild(java.lang.String name)
                throws SourceException
Get a child of this source, given its name. Note that the returned source may not actually physically exist, and that this must be checked using Source.exists().

Parameters:
name - the child name.
Returns:
the child source.
Throws:
SourceException - if this source is not traversable or if some other error occurs.

getName

public java.lang.String getName()
Return the name of this source relative to its parent.

Returns:
the name

getParent

public Source getParent()
                 throws SourceException
Get the parent of this source as a Source object.

Returns:
the parent source, or null if this source has no parent.
Throws:
SourceException - if some problem occurs.


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.