helma.framework.repository
Class FileRepository

java.lang.Object
  extended by helma.framework.repository.AbstractRepository
      extended by helma.framework.repository.FileRepository
All Implemented Interfaces:
Repository
Direct Known Subclasses:
MultiFileRepository

public class FileRepository
extends AbstractRepository

Repository implementation for directories providing file resources


Field Summary
protected  java.io.File directory
           
protected  long lastChecksum
           
protected  long lastChecksumTime
           
protected  long lastModified
           
 
Constructor Summary
FileRepository(java.io.File dir)
          Constructs a FileRepository using the given directory as top-level repository
FileRepository(java.io.File dir, Repository parent)
          Constructs a FileRepository using the given directory and top-level repository
FileRepository(java.lang.String initArgs)
          Constructs a FileRepository using the given argument
 
Method Summary
 void create()
          Creates the repository if does not exist yet
protected  Resource createResource(java.lang.String name)
          Called to create a child resource for this repository
 boolean equals(java.lang.Object obj)
           
 boolean exists()
          Checks wether the repository actually (or still) exists
 long getChecksum()
          Checksum of the repository and all its content.
 java.io.File getDirectory()
          Get the repository's directory
 int hashCode()
           
 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.
 java.lang.String toString()
          Returns the repositories full name as string representation.
 void update()
          Updates the content cache of the repository Gets called from within all methods returning sub-repositories or resources
 
Methods inherited from class helma.framework.repository.AbstractRepository
getAllResources, getName, getParentRepository, getRepositories, getResource, getResources, getRootRepository, getShortName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

directory

protected java.io.File directory

lastModified

protected long lastModified

lastChecksum

protected long lastChecksum

lastChecksumTime

protected long lastChecksumTime
Constructor Detail

FileRepository

public FileRepository(java.lang.String initArgs)
Constructs a FileRepository using the given argument

Parameters:
initArgs - absolute path to the directory

FileRepository

public FileRepository(java.io.File dir)
Constructs a FileRepository using the given directory as top-level repository

Parameters:
dir - directory

FileRepository

public FileRepository(java.io.File dir,
                      Repository parent)
Constructs a FileRepository using the given directory and top-level repository

Parameters:
dir - directory
parent - the parent repository, or null
Method Detail

exists

public boolean exists()
Description copied from interface: Repository
Checks wether the repository actually (or still) exists

Returns:
true if the repository exists

create

public void create()
Description copied from interface: Repository
Creates the repository if does not exist yet


isScriptRoot

public 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

lastModified

public long lastModified()
Description copied from interface: Repository
Returns the date the repository was last modified.

Returns:
last modified date

getChecksum

public long getChecksum()
                 throws java.io.IOException
Description copied from interface: Repository
Checksum of the repository and all its content. Implementations should make sure

Returns:
checksum
Throws:
java.io.IOException

update

public void update()
Updates the content cache of the repository Gets called from within all methods returning sub-repositories or resources

Specified by:
update in class AbstractRepository

createResource

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

Specified by:
createResource in class AbstractRepository

getDirectory

public java.io.File getDirectory()
Get the repository's directory


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Description copied from class: AbstractRepository
Returns the repositories full name as string representation.

Overrides:
toString in class AbstractRepository
See Also:
{getName()}


Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.