Package helma.framework.repository
Class SingleFileRepository
- java.lang.Object
-
- helma.framework.repository.SingleFileRepository
-
- All Implemented Interfaces:
Repository
public class SingleFileRepository extends java.lang.Object implements Repository
-
-
Constructor Summary
Constructors Constructor Description SingleFileRepository(java.io.File file)
Constructs a SingleFileRepository using the given argumentSingleFileRepository(java.io.File file, Repository parent)
Constructs a SingleFileRepository using the given argumentSingleFileRepository(java.lang.String initArgs)
Constructs a SingleFileRepository using the given argument
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create()
Creates the repository if does not exist yetboolean
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.boolean
exists()
Checks wether the repository actually (or still) existsjava.util.List
getAllResources()
Returns all direct and indirect resourceslong
getChecksum()
Checksum of the repository and all its content.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 repositoriesprotected Resource
getResource()
Return our single resource.Resource
getResource(java.lang.String resourceName)
Returns a specific direct resource of the repositoryjava.util.Iterator
getResources()
Returns all direct resourcesRepository
getRootRepository()
Get this repository's logical script root repository.java.lang.String
getShortName()
Returns the name of the repository.int
hashCode()
Returns a hash code value for the object.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 a string representation of the object.
-
-
-
Constructor Detail
-
SingleFileRepository
public SingleFileRepository(java.lang.String initArgs)
Constructs a SingleFileRepository using the given argument- Parameters:
initArgs
- absolute path to the script file
-
SingleFileRepository
public SingleFileRepository(java.io.File file)
Constructs a SingleFileRepository using the given argument- Parameters:
file
- the script file
-
SingleFileRepository
public SingleFileRepository(java.io.File file, Repository parent)
Constructs a SingleFileRepository using the given argument- Parameters:
file
- the script fileparent
- the parent repository, or null
-
-
Method Detail
-
getChecksum
public long getChecksum() throws java.io.IOException
Checksum of the repository and all its content. Implementations should make sure- Specified by:
getChecksum
in interfaceRepository
- Returns:
- checksum
- Throws:
java.io.IOException
-
getShortName
public java.lang.String getShortName()
Returns the name of the repository.- Specified by:
getShortName
in interfaceRepository
- Returns:
- name of the repository
-
getName
public java.lang.String getName()
Returns the name of the repository; this is a full name including all parent repositories.- Specified by:
getName
in interfaceRepository
- Returns:
- full name of the repository
-
getRootRepository
public Repository getRootRepository()
Get this repository's logical script root repository.- Specified by:
getRootRepository
in interfaceRepository
- Returns:
- top-level repository
-
getParentRepository
public Repository getParentRepository()
Returns this repository's parent repository. Returns null if this repository already is the top-level repository- Specified by:
getParentRepository
in interfaceRepository
- Returns:
- the parent repository
-
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.- Specified by:
isScriptRoot
in interfaceRepository
- Returns:
- true if the repository is to be considered a top-level script repository
-
create
public void create() throws java.io.IOException
Creates the repository if does not exist yet- Specified by:
create
in interfaceRepository
- Throws:
java.io.IOException
-
exists
public boolean exists() throws java.io.IOException
Checks wether the repository actually (or still) exists- Specified by:
exists
in interfaceRepository
- Returns:
- true if the repository exists
- Throws:
java.io.IOException
-
getRepositories
public Repository[] getRepositories() throws java.io.IOException
Returns this repository's direct child repositories- Specified by:
getRepositories
in interfaceRepository
- Returns:
- direct repositories
- Throws:
java.io.IOException
-
getAllResources
public java.util.List getAllResources() throws java.io.IOException
Returns all direct and indirect resources- Specified by:
getAllResources
in interfaceRepository
- Returns:
- resources recursive
- Throws:
java.io.IOException
-
getResources
public java.util.Iterator getResources() throws java.io.IOException
Returns all direct resources- Specified by:
getResources
in interfaceRepository
- Returns:
- direct resources
- Throws:
java.io.IOException
-
getResource
public Resource getResource(java.lang.String resourceName)
Returns a specific direct resource of the repository- Specified by:
getResource
in interfaceRepository
- Parameters:
resourceName
- name of the child resource to return- Returns:
- specified child resource
-
lastModified
public long lastModified() throws java.io.IOException
Returns the date the repository was last modified.- Specified by:
lastModified
in interfaceRepository
- Returns:
- last modified date
- Throws:
java.io.IOException
-
getResource
protected Resource getResource()
Return our single resource.- Returns:
- the wrapped resource
-
equals
public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the object.- Overrides:
toString
in classjava.lang.Object
-
-