Package org.ringojs.repository
Interface Trackable
-
- All Superinterfaces:
java.io.Serializable
- All Known Subinterfaces:
Repository
,Resource
- All Known Implementing Classes:
AbstractRepository
,AbstractResource
,FileRepository
,FileResource
,StringResource
,WebappRepository
,WebappResource
,ZipRepository
,ZipResource
public interface Trackable extends java.io.Serializable
Parent interface for both Repository and Resource interfaces. Describes an entity defined by a file-system like path.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
exists()
Checks wether this resource actually (still) existslong
getChecksum()
Checksum of the resource content.java.lang.String
getModuleName()
Utility method to get the name for the module defined by this resource.java.lang.String
getName()
Returns the short name of the resource.Repository
getParentRepository()
Returns the parent repository containing this resourcejava.lang.String
getPath()
Returns the path of the resource.java.lang.String
getRelativePath()
Get the path of this resource relative to its root repository.Repository
getRootRepository()
Returns the root repository of this resourcejava.net.URL
getUrl()
Returns an url to the resource if the repository of this resource is able to provide urls.boolean
isAbsolute()
Return true if this Trackable is in absolute mode.long
lastModified()
Returns the date the resource was last modifiedvoid
setAbsolute(boolean absolute)
Set this Trackable to absolute mode.
-
-
-
Method Detail
-
lastModified
long lastModified()
Returns the date the resource was last modified- Returns:
- last modified date
-
getChecksum
long getChecksum() throws java.io.IOException
Checksum of the resource content. Implementations should make sure to return a different checksum if the resource's content has changed.- Returns:
- checksum
- Throws:
java.io.IOException
-
exists
boolean exists() throws java.io.IOException
Checks wether this resource actually (still) exists- Returns:
- true if the resource exists
- Throws:
java.io.IOException
-
getPath
java.lang.String getPath()
Returns the path of the resource. The returned string must be in a form so that appending a child name produces a valid resource or repository name. Usually this means that it should end with a file separator character.- Returns:
- path of the resource
-
getName
java.lang.String getName()
Returns the short name of the resource.- Returns:
- short name of the resource
-
getUrl
java.net.URL getUrl() throws java.lang.UnsupportedOperationException, java.net.MalformedURLException
Returns an url to the resource if the repository of this resource is able to provide urls.- Returns:
- url to the resource
- Throws:
java.lang.UnsupportedOperationException
java.net.MalformedURLException
-
getParentRepository
Repository getParentRepository()
Returns the parent repository containing this resource- Returns:
- parent repository
-
getRootRepository
Repository getRootRepository()
Returns the root repository of this resource- Returns:
- root repository
-
getModuleName
java.lang.String getModuleName()
Utility method to get the name for the module defined by this resource.- Returns:
- the module name according to the securable module spec
-
getRelativePath
java.lang.String getRelativePath()
Get the path of this resource relative to its root repository. The returned string must be in a form so that appending a child name produces a valid resource or repository name. Usually this means that it should end with a file separator character.- Returns:
- the relative resource path
-
setAbsolute
void setAbsolute(boolean absolute)
Set this Trackable to absolute mode. This will cause all its relative path operations to use absolute paths instead.- Parameters:
absolute
- true to operate in absolute mode
-
isAbsolute
boolean isAbsolute()
Return true if this Trackable is in absolute mode.- Returns:
- true if absolute mode is on
-
-