001: /**
002: * @copyright
003: * ====================================================================
004: * Copyright (c) 2003-2004 CollabNet. All rights reserved.
005: *
006: * This software is licensed as described in the file COPYING, which
007: * you should have received as part of this distribution. The terms
008: * are also available at http://subversion.tigris.org/license-1.html.
009: * If newer versions of this license are posted there, you may use a
010: * newer version instead, at your option.
011: *
012: * This software consists of voluntary contributions made by many
013: * individuals. For exact contribution history, see the revision
014: * history and logs, available at http://subversion.tigris.org/.
015: * ====================================================================
016: * @endcopyright
017: */package org.tigris.subversion.javahl;
018:
019: import java.util.Date;
020:
021: /**
022: * A general subversion directory entry. Used for SVNClientInterface.list
023: * @author Cédric Chabanois
024: * <a href="mailto:cchabanois@ifrance.com">cchabanois@ifrance.com</a>
025: *
026: */
027: public class DirEntry {
028: /**
029: * the date of the last change in nanoseconds since 01/01/1970
030: */
031: private long lastChanged;
032: /**
033: * the revision number of the last change
034: */
035: private long lastChangedRevision;
036: /**
037: * flag if the item has properties managed by subversion
038: */
039: private boolean hasProps;
040: /**
041: * the name of the author of the last change
042: */
043: private String lastAuthor;
044: /**
045: * the kind of the node (directory or file)
046: */
047: private int nodeKind;
048: /**
049: * the size of the file
050: */
051: private long size;
052: /**
053: * the pathname of the entry
054: */
055: private String path;
056:
057: /**
058: * this constructor is only called from the JNI code
059: * @param path the pathname of the entry
060: * @param nodeKind the kind of entry (file or directory)
061: * @param size the size of the file
062: * @param hasProps if the entry has properties managed by
063: * subversion
064: * @param lastChangedRevision the revision number of the last change
065: * @param lastChanged the date of the last change
066: * @param lastAuthor the author of the last change
067: */
068: DirEntry(String path, int nodeKind, long size, boolean hasProps,
069: long lastChangedRevision, long lastChanged,
070: String lastAuthor) {
071: this .path = path;
072: this .nodeKind = nodeKind;
073: this .size = size;
074: this .hasProps = hasProps;
075: this .lastChangedRevision = lastChangedRevision;
076: this .lastChanged = lastChanged;
077: this .lastAuthor = lastAuthor;
078: }
079:
080: /**
081: * Returns the path of the entry.
082: * @return the path of the entry.
083: */
084: public String getPath() {
085: return path;
086: }
087:
088: /**
089: * Returns the last time the file was changed.
090: * @return the last time the file was changed.
091: */
092: public Date getLastChanged() {
093: return new Date(lastChanged / 1000);
094: }
095:
096: /**
097: * Returns the revision of the last change.
098: * @return revision of the last change as a Revision object.
099: */
100: public Revision.Number getLastChangedRevision() {
101: return Revision.createNumber(lastChangedRevision);
102: }
103:
104: /**
105: * Returns the revision number of the last change.
106: * @return revision number of the last change.
107: */
108: public long getLastChangedRevisionNumber() {
109: return lastChangedRevision;
110: }
111:
112: /**
113: * Returns if the entry has properties managed by Subversion.
114: * @return if the entry has properties managed by subversion.
115: */
116: public boolean getHasProps() {
117: return hasProps;
118: }
119:
120: /**
121: * Returns the author of the last change.
122: * @return the author of the last change.
123: */
124: public String getLastAuthor() {
125: return lastAuthor;
126: }
127:
128: /**
129: * Return the kind of entry (file or directory)
130: * @return the kind of the entry (file or directory) see NodeKind class
131: */
132: public int getNodeKind() {
133: return nodeKind;
134: }
135:
136: /**
137: * Return the length of file test or 0 for directories
138: * @return length of file text, or 0 for directories
139: */
140: public long getSize() {
141: return size;
142: }
143:
144: }
|