Package org.ametys.core.util.path
Class PathTimeStampValidity
- java.lang.Object
-
- org.ametys.core.util.path.PathTimeStampValidity
-
- All Implemented Interfaces:
Serializable
,SourceValidity
- Direct Known Subclasses:
SkinTimeStampValidity
public class PathTimeStampValidity extends Object implements SourceValidity
A validation object for time-stamps.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private String
_absolutePath
private Path
_file
protected long
_timeStamp
The timestamp-
Fields inherited from interface org.apache.excalibur.source.SourceValidity
INVALID, UNKNOWN, UNKNWON, VALID
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PathTimeStampValidity()
Empty constructor for sub classes only.PathTimeStampValidity(String filename)
Creates from a namePathTimeStampValidity(Path file)
Creates from a filePathTimeStampValidity(Path file, long timeStamp)
Creates from a file
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static Path
_getFile(String absolutePath)
Get file from an absolute pathprotected static long
_getTimeStamp(Path file)
Get the timestamp from a filePath
getFile()
Get the filelong
getTimeStamp()
Get the timestampint
isValid()
int
isValid(SourceValidity newValidity)
String
toString()
-
-
-
Field Detail
-
_timeStamp
protected long _timeStamp
The timestamp
-
_absolutePath
private String _absolutePath
-
-
Constructor Detail
-
PathTimeStampValidity
public PathTimeStampValidity(String filename)
Creates from a name- Parameters:
filename
- File name
-
PathTimeStampValidity
public PathTimeStampValidity(Path file)
Creates from a file- Parameters:
file
- file wrapped
-
PathTimeStampValidity
public PathTimeStampValidity(Path file, long timeStamp)
Creates from a file- Parameters:
file
- file wrappedtimeStamp
- file timestamp
-
PathTimeStampValidity
protected PathTimeStampValidity()
Empty constructor for sub classes only.
-
-
Method Detail
-
_getTimeStamp
protected static long _getTimeStamp(Path file)
Get the timestamp from a file- Parameters:
file
- the file- Returns:
- the file's timestamp
-
isValid
public int isValid()
- Specified by:
isValid
in interfaceSourceValidity
-
isValid
public int isValid(SourceValidity newValidity)
- Specified by:
isValid
in interfaceSourceValidity
-
_getFile
protected static Path _getFile(String absolutePath)
Get file from an absolute path- Parameters:
absolutePath
- the absolute path- Returns:
- the file
-
getTimeStamp
public long getTimeStamp()
Get the timestamp- Returns:
- the timestamp or -1 if it cannot be computed
-
-