001: /*
002: * ====================================================================
003: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
004: *
005: * This software is licensed as described in the file COPYING, which
006: * you should have received as part of this distribution. The terms
007: * are also available at http://svnkit.com/license.html
008: * If newer versions of this license are posted there, you may use a
009: * newer version instead, at your option.
010: * ====================================================================
011: */
012: package org.tmatesoft.svn.core.wc;
013:
014: /**
015: * The <b>SVNEventAction</b> class is used to describe an action
016: * which generated an <b>SVNEvent</b> object.
017: * <p>
018: * Each operation invoked by
019: * a do*() method of an <b>SVN</b>*<b>Client</b> class consists of
020: * several actions that can be considered as operation steps. For example,
021: * an update operation receives changes for files, adds new ones, deletes
022: * another ones and so on. And for every such action (for every file
023: * updated, deleted, added, etc.) the
024: * {@link SVNUpdateClient#doUpdate(File, SVNRevision, boolean) doUpdate()}
025: * method generates an <b>SVNEvent</b> objects which contains information
026: * on the type of this action that can be retrieved simply calling
027: * the <b>SVNEvent</b>'s {@link SVNEvent#getAction() getAction()} method:
028: * <pre class="javacode">
029: * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.SVNEvent;
030: * <span class="javakeyword">import</span> org.tmatesoft.svn.core.wc.SVNEventAction;
031: * ...
032: *
033: * SVNEventAction action = event.getAction();
034: * <span class="javacomment">//parse the action according to the type of</span>
035: * <span class="javacomment">//operation and your needs</span>
036: * <span class="javakeyword">if</span> (action == SVNEventAction.UPDATE_UPDATE){
037: * ...
038: * }
039: * ...</pre>
040: * <p>
041: * <b>SVNEventAction</b> is just a set of predefined constant fields of
042: * the same type. Each constant is applicable only to a certain type
043: * of operation - for example those constants that names start with the
044: * <i>UPDATE_</i> prefix are relevant only for update related operations
045: * (update, checkout, switch, etc.).
046: *
047: * @version 1.1.1
048: * @author TMate Software Ltd.
049: * @see SVNEvent
050: * @see ISVNEventHandler
051: * @see <a target="_top" href="http://svnkit.com/kb/examples/">Examples</a>
052: */
053: public class SVNEventAction {
054:
055: private int myID;
056: private String myName;
057:
058: private SVNEventAction(int id, String name) {
059: myID = id;
060: myName = name;
061: }
062:
063: /**
064: * Returns this object's identifier.
065: * Each constant field of the <b>SVNEventAction</b> class is also an
066: * <b>SVNEventAction</b> object with its own id.
067: *
068: * @return id of this object
069: */
070: public int getID() {
071: return myID;
072: }
073:
074: /**
075: * Returns a string representation of this object.
076: * As a matter of fact this is a string representation of this
077: * object's id.
078: *
079: * @return a string representing this object
080: */
081: public String toString() {
082: return myName == null ? Integer.toString(myID) : myName;
083: }
084:
085: /**
086: * Reserved for future purposes.
087: */
088: public static final SVNEventAction PROGRESS = new SVNEventAction(
089: -1, "progress");
090:
091: /**
092: * Denotes that a new item is scheduled for addition. Generated
093: * by the {@link SVNWCClient#doAdd(File, boolean, boolean, boolean, boolean)
094: * doAdd()} method.
095: */
096: public static final SVNEventAction ADD = new SVNEventAction(0,
097: "add");
098:
099: /**
100: * Denotes that the item is copied with history.
101: *
102: * @see SVNCopyClient
103: */
104: public static final SVNEventAction COPY = new SVNEventAction(1,
105: "copy");
106:
107: /**
108: * Denotes that the item is scheduled for deletion. Generated
109: * by the {@link SVNWCClient#doDelete(File, boolean, boolean) doDelete()}
110: * method.
111: */
112: public static final SVNEventAction DELETE = new SVNEventAction(2,
113: "delete");
114:
115: /**
116: * Denotes that the deleted item is restored (prior to be updated).
117: */
118: public static final SVNEventAction RESTORE = new SVNEventAction(3,
119: "restore");
120:
121: /**
122: * Denotes that all local changes to the item were reverted. Generated by
123: * the {@link SVNWCClient#doRevert(File, boolean)} method.
124: */
125: public static final SVNEventAction REVERT = new SVNEventAction(4,
126: "revert");
127:
128: /**
129: * Denotes that a revert operation failed. Generated by the
130: * {@link SVNWCClient#doRevert(File, boolean)} method.
131: */
132: public static final SVNEventAction FAILED_REVERT = new SVNEventAction(
133: 5, "failed_revert");
134:
135: /**
136: * Denotes that the conflict on the item is resolved (the item is
137: * marked resolved). Such an event is generated by the
138: * {@link SVNWCClient#doResolve(File, boolean) doResolve()} method.
139: */
140: public static final SVNEventAction RESOLVED = new SVNEventAction(6,
141: "resolved");
142:
143: /**
144: * Denotes that the operation is skipped due to errors (inability to
145: * be performed, etc.).
146: */
147: public static final SVNEventAction SKIP = new SVNEventAction(7,
148: "skip");
149:
150: /**
151: * In an update operation denotes that the item is deleted from
152: * the Working Copy (as it was deleted in the repository).
153: */
154: public static final SVNEventAction UPDATE_DELETE = new SVNEventAction(
155: 8, "update_delete");
156:
157: /**
158: * In an update operation denotes that the item is added to
159: * the Working Copy (as it was added in the repository).
160: */
161: public static final SVNEventAction UPDATE_ADD = new SVNEventAction(
162: 9, "update_add");
163:
164: /**
165: * In an update operation denotes that the item is modified (there
166: * are changes received from the repository).
167: *
168: */
169: public static final SVNEventAction UPDATE_UPDATE = new SVNEventAction(
170: 10, "update_update");
171:
172: /**
173: * In an update operation denotes that the item is not modified, but its children are.
174: *
175: */
176: public static final SVNEventAction UPDATE_NONE = new SVNEventAction(
177: 10, "update_none");
178:
179: /**
180: * In an update operation denotes that the operation itself is completed
181: * (for instance, in a console client can be used to print out the
182: * revision updated to).
183: */
184: public static final SVNEventAction UPDATE_COMPLETED = new SVNEventAction(
185: 11, "update_completed");
186:
187: /**
188: * In an update operation denotes that the item being updated is
189: * external.
190: */
191: public static final SVNEventAction UPDATE_EXTERNAL = new SVNEventAction(
192: 12, "update_external");
193:
194: /**
195: * In a remote status operation denotes that the operation itself is completed -
196: * used to get the latest repository revision against which the status was
197: * invoked.
198: */
199: public static final SVNEventAction STATUS_COMPLETED = new SVNEventAction(
200: 13, "status_completed");
201:
202: /**
203: * In a status operation denotes that the status is performed on an
204: * external item. To find out the item's current status use
205: * {@link SVNEvent#getContentsStatus() getContentsStatus()},
206: * {@link SVNEvent#getPropertiesStatus() getPropertiesStatus()}.
207: * The {@link SVNStatusType#STATUS_EXTERNAL} constant says only that the
208: * item belongs to externals definitions.
209: *
210: */
211: public static final SVNEventAction STATUS_EXTERNAL = new SVNEventAction(
212: 14, "status_external");
213:
214: /**
215: * In a commit operation denotes sending the item's modifications to the
216: * repository.
217: */
218: public static final SVNEventAction COMMIT_MODIFIED = new SVNEventAction(
219: 15, "commit_modified");
220:
221: /**
222: * In a commit operation denotes adding a new item to the repository.
223: */
224: public static final SVNEventAction COMMIT_ADDED = new SVNEventAction(
225: 16, "commit_added");
226:
227: /**
228: * In a commit operation denotes deleting the item from the
229: * repository.
230: */
231: public static final SVNEventAction COMMIT_DELETED = new SVNEventAction(
232: 17, "commit_deleted");
233:
234: /**
235: * In a commit operation denotes replacing (one item was deleted while
236: * another one with the same name was added) the item in the repository.
237: */
238: public static final SVNEventAction COMMIT_REPLACED = new SVNEventAction(
239: 18, "commit_replaced");
240:
241: /**
242: * In a commit operation denotes the final stage of the operation -
243: * sending all file data and finalizing the commit.
244: */
245: public static final SVNEventAction COMMIT_DELTA_SENT = new SVNEventAction(
246: 19, "commit_delta_sent");
247:
248: /**
249: * In a commit operation denotes that the operation itself is completed
250: * (for instance, in a console client can be used to print out the
251: * commited revsion).
252: */
253: public static final SVNEventAction COMMIT_COMPLETED = new SVNEventAction(
254: 32, "commit_completed");
255:
256: /**
257: * Denotes that file blaming is started.
258: */
259: public static final SVNEventAction ANNOTATE = new SVNEventAction(
260: 20, "annotate");
261:
262: /**
263: * Denotes that the file item is locked as a result of a locking
264: * operation. Generated by a <b>doLock()</b> method of {@link SVNWCClient}.
265: */
266: public static final SVNEventAction LOCKED = new SVNEventAction(21,
267: "locked");
268:
269: /**
270: * Denotes that the file item is unlocked as a result of an unlocking
271: * operation. Generated by a <b>doUnlock()</b> method of {@link SVNWCClient}.
272: */
273: public static final SVNEventAction UNLOCKED = new SVNEventAction(
274: 22, "unlocked");
275:
276: /**
277: * Denotes that locking a file item failed. Generated by a <b>doLock()</b>
278: * method of {@link SVNWCClient}.
279: */
280: public static final SVNEventAction LOCK_FAILED = new SVNEventAction(
281: 23, "lock_failed");
282:
283: /**
284: * Denotes that unlocking a file item failed. Generated by a <b>doUnlock()</b>
285: * method of {@link SVNWCClient}.
286: */
287: public static final SVNEventAction UNLOCK_FAILED = new SVNEventAction(
288: 24, "unlock_failed");
289:
290: /**
291: * Denotes that the current format of the working copy administrative
292: * area is upgraded to a newer one.
293: */
294: public static final SVNEventAction UPGRADE = new SVNEventAction(-2,
295: "wc_upgrade");
296: }
|