org.helma.repository
Class AbstractRepository

java.lang.Object
  extended by org.helma.repository.AbstractRepository
All Implemented Interfaces:
Repository
Direct Known Subclasses:
FileRepository, ZipRepository

public abstract class AbstractRepository
extends java.lang.Object
implements Repository

Provides common methods and fields for the default implementations of the repository interface


Constructor Summary
AbstractRepository()
           
 
Method Summary
protected abstract  Resource createResource(java.lang.String name)
          Called to create a child resource for this repository
 java.util.List<Resource> getAllResources()
          Get a deep list of this repository's resources, including all resources contained in sub-reposotories.
 java.lang.String getName()
          Get the full name that identifies this repository globally
 Repository getParentRepository()
          Get this repository's parent repository.
 Repository[] getRepositories()
          Get an iterator over the sub-repositories contained in this repository.
 Resource getResource(java.lang.String path)
          Get a resource contained in this repository identified by the given local name.
 java.util.Iterator<Resource> getResources()
          Get an iterator over the resources contained in this repository.
 java.util.List<Resource> getResources(java.lang.String path)
          Get a list of resources contained in this repository identified by the given local name.
 Repository getRootRepository()
          Get this repository's logical script root repository.
 java.lang.String getShortName()
          Get the local name that identifies this repository locally within its parent repository
 void mountRepository(Repository child, java.lang.String pathname)
          Mount a child repository under the given path name.
 java.lang.String toString()
          Returns the repositories full name as string representation.
abstract  void update()
          Called to check the repository's content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.helma.repository.Repository
create, exists, getChecksum, getChildRepository, isScriptRoot, lastModified
 

Constructor Detail

AbstractRepository

public AbstractRepository()
Method Detail

update

public abstract void update()
Called to check the repository's content.


createResource

protected abstract Resource createResource(java.lang.String name)
Called to create a child resource for this repository


getName

public java.lang.String getName()
Get the full name that identifies this repository globally

Specified by:
getName in interface Repository
Returns:
full name of the repository

getShortName

public java.lang.String getShortName()
Get the local name that identifies this repository locally within its parent repository

Specified by:
getShortName in interface Repository
Returns:
name of the repository

getRootRepository

public Repository getRootRepository()
Get this repository's logical script root repository.

Specified by:
getRootRepository in interface Repository
Returns:
top-level repository
See Also:
{isScriptRoot()}

mountRepository

public void mountRepository(Repository child,
                            java.lang.String pathname)
Mount a child repository under the given path name.

Specified by:
mountRepository in interface Repository
Parameters:
pathname - the path name
child - the child element

getResource

public Resource getResource(java.lang.String path)
Get a resource contained in this repository identified by the given local name. If the name can't be resolved to a resource, a resource object is returned for which exists() returns false.

Specified by:
getResource in interface Repository
Parameters:
path - name of the child resource to return
Returns:
specified child resource

getResources

public java.util.List<Resource> getResources(java.lang.String path)
Get a list of resources contained in this repository identified by the given local name.

Specified by:
getResources in interface Repository
Parameters:
path - the repository path
Returns:
a list of all nested child resources

getResources

public java.util.Iterator<Resource> getResources()
Get an iterator over the resources contained in this repository.

Specified by:
getResources in interface Repository
Returns:
direct resources

getRepositories

public Repository[] getRepositories()
Get an iterator over the sub-repositories contained in this repository.

Specified by:
getRepositories in interface Repository
Returns:
direct repositories

getParentRepository

public Repository getParentRepository()
Get this repository's parent repository.

Specified by:
getParentRepository in interface Repository
Returns:
the parent repository

getAllResources

public java.util.List<Resource> getAllResources()
                                         throws java.io.IOException
Get a deep list of this repository's resources, including all resources contained in sub-reposotories.

Specified by:
getAllResources in interface Repository
Returns:
resources recursive
Throws:
java.io.IOException - an I/O error occurred

toString

public java.lang.String toString()
Returns the repositories full name as string representation.

Overrides:
toString in class java.lang.Object
See Also:
{getName()}