001: package org.tigris.subversion.javahl;
002:
003: /**
004: * @copyright
005: * ====================================================================
006: * Copyright (c) 2003-2004 CollabNet. All rights reserved.
007: *
008: * This software is licensed as described in the file COPYING, which
009: * you should have received as part of this distribution. The terms
010: * are also available at http://subversion.tigris.org/license-1.html.
011: * If newer versions of this license are posted there, you may use a
012: * newer version instead, at your option.
013: *
014: * This software consists of voluntary contributions made by many
015: * individuals. For exact contribution history, see the revision
016: * history and logs, available at http://subversion.tigris.org/.
017: * ====================================================================
018: * @endcopyright
019: */
020:
021: /**
022: * this class describes one property managed by subversion
023: */
024: public class PropertyData {
025: /**
026: * the name of the property
027: */
028: private String name;
029: /**
030: * the string value of the property
031: */
032: private String value;
033: /**
034: * the byte array value of the property
035: */
036: private byte[] data;
037: /**
038: * path of the subversion to change or delete this property
039: */
040: private String path;
041: /**
042: * reference to the creating SVNClient object to change or delete this
043: * property
044: */
045: private SVNClient client;
046: /**
047: * Standard subversion known properties
048: */
049: /**
050: * mime type of the entry, used to flag binary files
051: */
052: public static final String MIME_TYPE = "svn:mime-type";
053: /**
054: * list of filenames with wildcards which should be ignored by add and
055: * status
056: */
057: public static final String IGNORE = "svn:ignore";
058: /**
059: * how the end of line code should be treated during retrieval
060: */
061: public static final String EOL_STYLE = "svn:eol-style";
062: /**
063: * list of keywords to be expanded during retrieval
064: */
065: public static final String KEYWORDS = "svn:keywords";
066: /**
067: * flag if the file should be made excutable during retrieval
068: */
069: public static final String EXECUTABLE = "svn:executable";
070: /**
071: * value for svn:executable
072: */
073: public static final String EXECUTABLE_VALUE = "*";
074: /**
075: * list of directory managed outside of this working copy
076: */
077: public static final String EXTERNALS = "svn:externals";
078: /**
079: * the author of the revision
080: */
081: public static final String REV_AUTHOR = "svn:author";
082: /**
083: * the log message of the revision
084: */
085: public static final String REV_LOG = "svn:log";
086: /**
087: * the date of the revision
088: */
089: public static final String REV_DATE = "svn:date";
090: /**
091: * the original date of the revision
092: */
093: public static final String REV_ORIGINAL_DATE = "svn:original-date";
094:
095: /**
096: * @since 1.2
097: * flag property if a lock is needed to modify this node
098: */
099: public static final String NEEDS_LOCK = "svn:needs-lock";
100:
101: /**
102: * this constructor is only used by the JNI code
103: * @param cl the client object, which created this object
104: * @param p the path of the item owning this property
105: * @param n the name of the property
106: * @param v the string value of the property
107: * @param d the byte array value of the property
108: */
109: PropertyData(SVNClient cl, String p, String n, String v, byte[] d) {
110: path = p;
111: name = n;
112: value = v;
113: client = cl;
114: data = d;
115: }
116:
117: /**
118: * Returns the name of the property
119: * @return the name
120: */
121: public String getName() {
122: return name;
123: }
124:
125: /**
126: * Returns the string value of the property.
127: * There is no protocol if a property is a string or a binary value
128: * @return the string value
129: */
130: public String getValue() {
131: return value;
132: }
133:
134: /**
135: * Return the path of the item which owns this property
136: * @return the path
137: */
138: public String getPath() {
139: return path;
140: }
141:
142: /**
143: * Returns the byte array value of the property
144: * There is no protocol if a property is a string or a binary value
145: * @return the byte array value
146: */
147: public byte[] getData() {
148: return data;
149: }
150:
151: /**
152: * modify the string value of a property
153: * The byte array value is cleared
154: * @param newValue the new string value
155: * @param recurse if operation should recurse directories
156: * @throws ClientException
157: */
158: public void setValue(String newValue, boolean recurse)
159: throws ClientException {
160: client.propertySet(path, name, newValue, recurse);
161: value = newValue;
162: data = null;
163: }
164:
165: /**
166: * modify the byte array value of a property
167: * The string array value is cleared
168: * @param newValue the new byte array value
169: * @param recurse if operation should recurse directories
170: * @throws ClientException
171: */
172: public void setValue(byte[] newValue, boolean recurse)
173: throws ClientException {
174: client.propertySet(path, name, newValue, recurse);
175: data = newValue;
176: value = null;
177: }
178:
179: /**
180: * remove this property from subversion
181: * @param recurse if operation should recurse directories
182: * @throws ClientException
183: */
184: public void remove(boolean recurse) throws ClientException {
185: client.propertyRemove(path, name, recurse);
186: }
187: }
|