org.tmatesoft.svn.core
Class SVNDirEntry

java.lang.Object
  extended by org.tmatesoft.svn.core.SVNDirEntry
All Implemented Interfaces:
java.lang.Comparable

public class SVNDirEntry
extends java.lang.Object
implements java.lang.Comparable

The SVNDirEntry class is a representation of a versioned directory entry.

SVNDirEntry keeps an entry name, entry kind (is it a file or directory), file size (in case an entry is a file), the last changed revision, the date when the entry was last changed, the name of the author who last changed the entry, the commit log message for the last changed revision. SVNDirEntry also knows if the entry has any properties.

Since:
1.2
See Also:
ISVNDirEntryHandler

Field Summary
static int DIRENT_ALL
          Represents a combination of all the entry fields.
static int DIRENT_COMMIT_MESSAGE
          Represents commit log message for the last changed revision.
static int DIRENT_CREATED_REVISION
          Represents the last revision when the entry was changed.
static int DIRENT_HAS_PROPERTIES
          Contains the information whether the entry has any properties.
static int DIRENT_KIND
          Represents entry kind (if it is a file or a directory).
static int DIRENT_LAST_AUTHOR
          Represents the author of the last changed revision.
static int DIRENT_SIZE
          Represents file size (if the entry is a file).
static int DIRENT_TIME
          Represents the time of the last changed revision.
 
Constructor Summary
SVNDirEntry(SVNURL url, SVNURL repositoryRoot, java.lang.String name, SVNNodeKind kind, long size, boolean hasProperties, long revision, java.util.Date createdDate, java.lang.String lastAuthor)
          Constructs an instance of SVNDirEntry.
SVNDirEntry(SVNURL url, SVNURL repositoryRoot, java.lang.String name, SVNNodeKind kind, long size, boolean hasProperties, long revision, java.util.Date createdDate, java.lang.String lastAuthor, java.lang.String commitMessage)
          Constructs an instance of SVNDirEntry.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with another one.
 java.lang.String getAuthor()
          Retrieves the name of the author who last changed this entry.
 java.lang.String getCommitMessage()
          Returns the commit log message for the revision of this entry.
 java.util.Date getDate()
          Returns the date the entry was last changed.
 SVNNodeKind getKind()
          Returns the entry node kind.
 SVNLock getLock()
          Gets the lock object for this entry (if it's locked).
 java.lang.String getName()
          Gets the the directory entry name
 java.lang.String getPath()
          Deprecated. use getRelativePath() instead.
 java.lang.String getRelativePath()
          Returns the entry's path relative to the target directory.
 SVNURL getRepositoryRoot()
          Returns the entry's repository root URL.
 long getRevision()
          Gets the last changed revision of this entry.
 long getSize()
          Returns the file size in bytes (if this entry is a file).
 SVNURL getURL()
          Returns the entry's URL.
 boolean hasProperties()
          Tells if the entry has any properties.
 void setCommitMessage(java.lang.String message)
          This method is used by SVNKit internals and not intended for users (from an API point of view).
 void setLock(SVNLock lock)
          Sets the lock object for this entry (if it's locked).
 void setRelativePath(java.lang.String path)
          This method is used by SVNKit internals and not intended for users (from an API point of view).
 long size()
          Deprecated. use getSize() instead
 java.lang.String toString()
          Retirns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIRENT_KIND

public static final int DIRENT_KIND
Represents entry kind (if it is a file or a directory).

Since:
1.2.0
See Also:
Constant Field Values

DIRENT_SIZE

public static final int DIRENT_SIZE
Represents file size (if the entry is a file).

Since:
1.2.0
See Also:
Constant Field Values

DIRENT_HAS_PROPERTIES

public static final int DIRENT_HAS_PROPERTIES
Contains the information whether the entry has any properties.

Since:
1.2.0
See Also:
Constant Field Values

DIRENT_CREATED_REVISION

public static final int DIRENT_CREATED_REVISION
Represents the last revision when the entry was changed.

Since:
1.2.0
See Also:
Constant Field Values

DIRENT_TIME

public static final int DIRENT_TIME
Represents the time of the last changed revision.

Since:
1.2.0
See Also:
Constant Field Values

DIRENT_LAST_AUTHOR

public static final int DIRENT_LAST_AUTHOR
Represents the author of the last changed revision.

Since:
1.2.0
See Also:
Constant Field Values

DIRENT_COMMIT_MESSAGE

public static final int DIRENT_COMMIT_MESSAGE
Represents commit log message for the last changed revision.

Since:
1.2.0
See Also:
Constant Field Values

DIRENT_ALL

public static final int DIRENT_ALL
Represents a combination of all the entry fields.

Since:
1.2.0
See Also:
Constant Field Values
Constructor Detail

SVNDirEntry

public SVNDirEntry(SVNURL url,
                   SVNURL repositoryRoot,
                   java.lang.String name,
                   SVNNodeKind kind,
                   long size,
                   boolean hasProperties,
                   long revision,
                   java.util.Date createdDate,
                   java.lang.String lastAuthor)
Constructs an instance of SVNDirEntry.

Parameters:
url - a url of this entry
repositoryRoot - a url of the root of repository this entry belongs to
name - an entry name
kind - the node kind for the entry
size - the entry size in bytes
hasProperties - true if the entry has properties, otherwise false
revision - the last changed revision of the entry
createdDate - the date the entry was last changed
lastAuthor - the person who last changed the entry

SVNDirEntry

public SVNDirEntry(SVNURL url,
                   SVNURL repositoryRoot,
                   java.lang.String name,
                   SVNNodeKind kind,
                   long size,
                   boolean hasProperties,
                   long revision,
                   java.util.Date createdDate,
                   java.lang.String lastAuthor,
                   java.lang.String commitMessage)
Constructs an instance of SVNDirEntry.

Parameters:
url - a url of this entry
repositoryRoot - a url of the root of repository this entry belongs to
name - an entry name
kind - the node kind for the entry
size - the entry size in bytes
hasProperties - true if the entry has properties, otherwise false
revision - the last changed revision of the entry
createdDate - the date the entry was last changed
lastAuthor - the person who last changed the entry
commitMessage - the log message of the last change commit
Method Detail

getURL

public SVNURL getURL()
Returns the entry's URL.

Returns:
this entry's URL.

getRepositoryRoot

public SVNURL getRepositoryRoot()
Returns the entry's repository root URL.

Returns:
the URL of repository root.

getName

public java.lang.String getName()
Gets the the directory entry name

Returns:
the name of this entry

getSize

public long getSize()
Returns the file size in bytes (if this entry is a file).

Returns:
the size of this entry in bytes

size

public long size()
Deprecated. use getSize() instead

Returns the file size in bytes (if this entry is a file).

Returns:
the size of this entry in bytes

hasProperties

public boolean hasProperties()
Tells if the entry has any properties.

Returns:
true if has, false otherwise

getKind

public SVNNodeKind getKind()
Returns the entry node kind.

Returns:
the node kind of this entry
See Also:
SVNNodeKind

getDate

public java.util.Date getDate()
Returns the date the entry was last changed.

Returns:
the datestamp when the entry was last changed

getRevision

public long getRevision()
Gets the last changed revision of this entry.

Returns:
the revision of this entry when it was last changed

getAuthor

public java.lang.String getAuthor()
Retrieves the name of the author who last changed this entry.

Returns:
the last author's name.

getRelativePath

public java.lang.String getRelativePath()
Returns the entry's path relative to the target directory.

This method is guaranteed to return a non-null path only for list operations. It always returns a path relative to the target location which a list operation is launched on. When listing a directory the relative path for the target directory itself is "", for its children - just their names, for deeper directories (when listing recursively) - paths relative to the target directory path.

Returns:
path relative to the target directory

getPath

public java.lang.String getPath()
Deprecated. use getRelativePath() instead.

Returns:
repository path

getCommitMessage

public java.lang.String getCommitMessage()
Returns the commit log message for the revision of this entry.

This is guaranteed to be non-null only for the target entry returned by the SVNRepository.getDir(String, long, boolean, java.util.Collection) method.

Returns:
a commit log message

getLock

public SVNLock getLock()
Gets the lock object for this entry (if it's locked).

Returns:
a lock object or null

setRelativePath

public void setRelativePath(java.lang.String path)
This method is used by SVNKit internals and not intended for users (from an API point of view).

Parameters:
path - this entry's path

setCommitMessage

public void setCommitMessage(java.lang.String message)
This method is used by SVNKit internals and not intended for users (from an API point of view).

Parameters:
message - a commit message

setLock

public void setLock(SVNLock lock)
Sets the lock object for this entry (if it's locked).

Parameters:
lock - a lock object

toString

public java.lang.String toString()
Retirns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this directory entry

compareTo

public int compareTo(java.lang.Object o)
Compares this object with another one.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - an object to compare with
Returns:
  • -1 - if o is either null, or is not an instance of SVNDirEntry, or this entry's URL is lexicographically less than the name of o;
  • 1 - if this entry's URL is lexicographically greater than the name of o;
  • 0 - if and only if o has got the same URL as this one has