org.helma.repository
Interface Repository

All Known Implementing Classes:
AbstractRepository, FileRepository, ZipRepository

public interface Repository

Repository represents an abstract container of resources (e.g. code, skins, ...). In addition to resources, repositories may contain other repositories, building a hierarchical structure.


Method Summary
 void create()
          Creates the repository if does not exist yet
 boolean exists()
          Checks wether the repository actually (or still) exists
 java.util.List<Resource> getAllResources()
          Returns all direct and indirect resources
 long getChecksum()
          Checksum of the repository and all its content.
 Repository getChildRepository(java.lang.String name)
          Get a child repository with the given name
 java.lang.String getName()
          Returns the name of the repository; this is a full name including all parent repositories.
 Repository getParentRepository()
          Returns this repository's parent repository.
 Repository[] getRepositories()
          Returns this repository's direct child repositories
 Resource getResource(java.lang.String resourceName)
          Returns a specific direct resource of the repository
 java.util.Iterator<Resource> getResources()
          Returns all direct resources
 java.util.List<Resource> getResources(java.lang.String resourcePath)
          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()
          Returns the name of the repository.
 boolean isScriptRoot()
          Checks wether the repository is to be considered a top-level repository from a scripting point of view.
 long lastModified()
          Returns the date the repository was last modified.
 void mountRepository(Repository child, java.lang.String pathname)
          Mount a child repository under the given path name.
 

Method Detail

getChecksum

long getChecksum()
                 throws java.io.IOException
Checksum of the repository and all its content. Implementations should make sure

Returns:
checksum
Throws:
java.io.IOException - an I/O error occurred

lastModified

long lastModified()
                  throws java.io.IOException
Returns the date the repository was last modified.

Returns:
last modified date
Throws:
java.io.IOException - an I/O error occurred

getResource

Resource getResource(java.lang.String resourceName)
Returns a specific direct resource of the repository

Parameters:
resourceName - name of the child resource to return
Returns:
specified child resource

getResources

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

Parameters:
resourcePath - the repository path
Returns:
a list of all nested child resources

getResources

java.util.Iterator<Resource> getResources()
                                          throws java.io.IOException
Returns all direct resources

Returns:
direct resources
Throws:
java.io.IOException - an I/O error occurred

getAllResources

java.util.List<Resource> getAllResources()
                                         throws java.io.IOException
Returns all direct and indirect resources

Returns:
resources recursive
Throws:
java.io.IOException - an I/O error occurred

getRepositories

Repository[] getRepositories()
                             throws java.io.IOException
Returns this repository's direct child repositories

Returns:
direct repositories
Throws:
java.io.IOException - an I/O error occurred

exists

boolean exists()
Checks wether the repository actually (or still) exists

Returns:
true if the repository exists

create

void create()
            throws java.io.IOException
Creates the repository if does not exist yet

Throws:
java.io.IOException - an I/O error occurred

isScriptRoot

boolean isScriptRoot()
Checks wether the repository is to be considered a top-level repository from a scripting point of view. For example, a zip file within a file repository is not a root repository from a physical point of view, but from the scripting point of view it is.

Returns:
true if the repository is to be considered a top-level script repository

getParentRepository

Repository getParentRepository()
Returns this repository's parent repository. Returns null if this repository already is the top-level repository

Returns:
the parent repository

getChildRepository

Repository getChildRepository(java.lang.String name)
Get a child repository with the given name

Parameters:
name - the name of the repository
Returns:
the child repository

getRootRepository

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

Returns:
top-level repository
See Also:
{isScriptRoot()}

mountRepository

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

Parameters:
pathname - the path name
child - the child element

getName

java.lang.String getName()
Returns the name of the repository; this is a full name including all parent repositories.

Returns:
full name of the repository

getShortName

java.lang.String getShortName()
Returns the name of the repository.

Returns:
name of the repository