com.caucho.vfs
Class Depend

java.lang.Object
  extended by com.caucho.vfs.Depend
All Implemented Interfaces:
Dependency, PersistentDependency

public class Depend
extends java.lang.Object
implements PersistentDependency

Class for keeping track of modifications.


Constructor Summary
Depend(Path source)
          Create a new dependency.
Depend(Path source, long digest)
          Create a new dependency with a given digest.
Depend(Path source, long digest, boolean requireSource)
          Create a new dependency with a given digest.
Depend(Path source, long lastModified, long length)
          Create a new dependency with an already known modified time and length.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the test Dependency has the same source path as this dependency.
 long getDigest()
          Returns the digest.
 java.lang.String getJavaCreateString()
          Returns the string to recreate the Dependency.
 long getLastModified()
          Returns the current last-modified time of the file.
 long getLength()
          Returns the current length time of the file.
 Path getPath()
          Returns the underlying source path.
 boolean getRequireSource()
          If true, deleting the source counts as a change.
 boolean isModified()
          If the source modified date changes at all, treat it as a modification.
 boolean logModified(java.util.logging.Logger log)
          Log the reason for modification
 void setRequireSource(boolean requireSource)
          If true, deleting the source counts as a change.
 java.lang.String toString()
          Returns a printable version of the dependency.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Depend

public Depend(Path source,
              long lastModified,
              long length)
Create a new dependency with an already known modified time and length.

Parameters:
source - the source file

Depend

public Depend(Path source)
Create a new dependency.

Parameters:
source - the source file

Depend

public Depend(Path source,
              long digest)
Create a new dependency with a given digest.

Parameters:
source - the source file
digest - the CRC64 digest

Depend

public Depend(Path source,
              long digest,
              boolean requireSource)
Create a new dependency with a given digest.

Parameters:
source - the source file
digest - the CRC64 digest
Method Detail

getPath

public Path getPath()
Returns the underlying source path.


getLastModified

public long getLastModified()
Returns the current last-modified time of the file.


getLength

public long getLength()
Returns the current length time of the file.


getRequireSource

public boolean getRequireSource()
If true, deleting the source counts as a change.


setRequireSource

public void setRequireSource(boolean requireSource)
If true, deleting the source counts as a change.


isModified

public boolean isModified()
If the source modified date changes at all, treat it as a modification. This protects against the case where multiple computers have misaligned dates and a '<' comparison may fail.

Specified by:
isModified in interface Dependency

logModified

public boolean logModified(java.util.logging.Logger log)
Log the reason for modification

Specified by:
logModified in interface Dependency

getDigest

public long getDigest()
Returns the digest.


equals

public boolean equals(java.lang.Object obj)
Returns true if the test Dependency has the same source path as this dependency.

Overrides:
equals in class java.lang.Object

getJavaCreateString

public java.lang.String getJavaCreateString()
Returns the string to recreate the Dependency.

Specified by:
getJavaCreateString in interface PersistentDependency

toString

public java.lang.String toString()
Returns a printable version of the dependency.

Overrides:
toString in class java.lang.Object