summaryrefslogtreecommitdiff
path: root/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java
blob: b1213c27c5425e2c47777c2f28f46112a5858b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/**
 * @copyright
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 * @endcopyright
 */

package org.apache.subversion.javahl;

import java.util.Map;
import java.util.EventObject;
import org.apache.subversion.javahl.callback.ClientNotifyCallback;
import org.apache.subversion.javahl.types.*;

/**
 * The event passed to the {@link ClientNotifyCallback#onNotify}
 * API to notify {@link ISVNClient} of relevant events.
 */
public class ClientNotifyInformation extends EventObject
{
    // Update the serialVersionUID when there is a incompatible change
    // made to this class.  See any of the following, depending upon
    // the Java release.
    // http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc7.html
    // http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf
    // http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678
    // http://java.sun.com/javase/6/docs/platform/serialization/spec/version.html#6678
    private static final long serialVersionUID = 1L;

    /**
     * The {@link Action} which triggered this event.
     */
    private Action action;

    /**
     * The {@link NodeKind} of the item.
     */
    private NodeKind kind;

    /**
     * The MIME type of the item.
     */
    private String mimeType;

    /**
     * Any lock for the item.
     */
    private Lock lock;

    /**
     * Any error message for the item.
     */
    private String errMsg;

    /**
     * The {@link Status} of the content of the item.
     */
    private Status contentState;

    /**
     * The {@link Status} of the properties of the item.
     */
    private Status propState;

    /**
     * The {@link LockStatus} of the lock of the item.
     */
    private LockStatus lockState;

    /**
     * The revision of the item.
     */
    private long revision;

    /**
     * The name of the changelist.
     */
    private String changelistName;

    /**
     * The range of the merge just beginning to occur.
     */
    private RevisionRange mergeRange;

    /**
     * A common absolute path prefix that can be subtracted from .path.
     */
    private String pathPrefix;

    private String propName;

    private Map<String, String> revProps;

    long oldRevision;

    long hunkOriginalStart;

    long hunkOriginalLength;

    long hunkModifiedStart;

    long hunkModifiedLength;

    long hunkMatchedLine;

    int hunkFuzz;

    /**
     * This constructor is to be used by the native code.
     *
     * @param path The path of the item, which is the source of the event.
     * @param action The {@link Action} which triggered this event.
     * @param kind The {@link NodeKind} of the item.
     * @param mimeType The MIME type of the item.
     * @param lock Any lock for the item.
     * @param errMsg Any error message for the item.
     * @param contentState The {@link Status} of the content of
     * the item.
     * @param propState The {@link Status} of the properties of
     * the item.
     * @param lockState The {@link LockStatus} of the lock of the item.
     * @param revision The revision of the item.
     * @param changelistName The name of the changelist.
     * @param mergeRange The range of the merge just beginning to occur.
     * @param pathPrefix A common path prefix.
     */
    public ClientNotifyInformation(String path, Action action, NodeKind kind,
                             String mimeType, Lock lock, String errMsg,
                             Status contentState, Status propState,
                             LockStatus lockState, long revision,
                             String changelistName, RevisionRange mergeRange,
                             String pathPrefix, String propName,
                             Map<String, String> revProps, long oldRevision,
                             long hunkOriginalStart, long hunkOriginalLength,
                             long hunkModifiedStart, long hunkModifiedLength,
                             long hunkMatchedLine, int hunkFuzz)
    {
        super(path == null ? "" : path);
        this.action = action;
        this.kind = kind;
        this.mimeType = mimeType;
        this.lock = lock;
        this.errMsg = errMsg;
        this.contentState = contentState;
        this.propState = propState;
        this.lockState = lockState;
        this.revision = revision;
        this.changelistName = changelistName;
        this.mergeRange = mergeRange;
        this.pathPrefix = pathPrefix;
        this.propName = propName;
        this.revProps = revProps;
        this.oldRevision = oldRevision;
        this.hunkOriginalStart = hunkOriginalStart;
        this.hunkOriginalLength = hunkOriginalLength;
        this.hunkModifiedStart = hunkModifiedStart;
        this.hunkModifiedLength = hunkModifiedLength;
        this.hunkMatchedLine = hunkMatchedLine;
        this.hunkFuzz = hunkFuzz;
    }

    /**
     * @return The path of the item, which is the source of the event.
     */
    public String getPath()
    {
        return (String) super.source;
    }

    /**
     * @return The {@link Action} which triggered this event.
     */
    public Action getAction()
    {
        return action;
    }

    /**
     * @return The {@link NodeKind} of the item.
     */
    public NodeKind getKind()
    {
        return kind;
    }

    /**
     * @return The MIME type of the item.
     */
    public String getMimeType()
    {
        return mimeType;
    }

    /**
     * @return Any lock for the item.
     */
    public Lock getLock()
    {
        return lock;
    }

    /**
     * @return Any error message for the item.
     */
    public String getErrMsg()
    {
        return errMsg;
    }

    /**
     * @return The {@link Status} of the content of the item.
     */
    public Status getContentState()
    {
        return contentState;
    }

    /**
     * @return The {@link Status} of the properties of the item.
     */
    public Status getPropState()
    {
        return propState;
    }

    /**
     * @return The {@link LockStatus} of the lock of the item.
     */
    public LockStatus getLockState()
    {
        return lockState;
    }

    /**
     * @return The revision of the item.
     */
    public long getRevision()
    {
        return revision;
    }

    /**
     * @return The name of the changelist.
     */
    public String getChangelistName()
    {
        return changelistName;
    }

    /**
     * @return The range of the merge just beginning to occur.
     */
    public RevisionRange getMergeRange()
    {
        return mergeRange;
    }

    /**
     * @return The common absolute path prefix.
     */
    public String getPathPrefix()
    {
        return pathPrefix;
    }

    public String getPropName()
    {
        return propName;
    }

    public Map<String, String> getRevProps()
    {
        return revProps;
    }

    public long getOldRevision()
    {
        return oldRevision;
    }

    public long getHunkOriginalStart()
    {
        return hunkOriginalStart;
    }

    public long getHunkOriginalLength()
    {
        return hunkOriginalLength;
    }

    public long getHunkModifiedStart()
    {
        return hunkModifiedStart;
    }

    public long getHunkModifiedLength()
    {
        return hunkModifiedLength;
    }

    public long getHunkMatchedLine()
    {
        return hunkMatchedLine;
    }

    public int getHunkFuzz()
    {
        return hunkFuzz;
    }

    /**
     * The type of action triggering the notification
     */
    public enum Action
    {
        /** Adding a path to revision control. */
        add             ("add"),

        /** Copying a versioned path. */
        copy            ("copy"),

        /** Deleting a versioned path. */
        delete          ("delete"),

        /** Restoring a missing path from the pristine text-base. */
        restore         ("restore"),

        /** Reverting a modified path. */
        revert          ("revert"),

        /** A revert operation has failed. */
        failed_revert   ("failed revert"),

        /** Resolving a conflict. */
        resolved        ("resolved"),

        /** Skipping a path. */
        skip            ("skip"),

        /* The update actions are also used for checkouts, switches, and
           merges. */

        /** Got a delete in an update. */
        update_delete   ("update delete"),

        /** Got an add in an update. */
        update_add      ("update add"),

        /** Got any other action in an update. */
        update_update   ("update modified"),

        /** The last notification in an update */
        update_completed ("update completed"),

        /** About to update an external module, use for checkouts and switches
         *  too, end with @c svn_wc_update_completed.
         */
        update_external ("update external"),

        /** The last notification in a status (including status on externals).
         */
        status_completed ("status completed"),

        /** Running status on an external module. */
        status_external ("status external"),

        /** Committing a modification. */
        commit_modified ("sending modified"),

        /** Committing an addition. */
        commit_added    ("sending added"),

        /** Committing a deletion. */
        commit_deleted  ("sending deleted"),

        /** Committing a replacement. */
        commit_replaced ("sending replaced"),

        /** Transmitting post-fix text-delta data for a file. */
        commit_postfix_txdelta ("transfer"),

        /** Processed a single revision's blame. */
        blame_revision  ("blame revision processed"),

        /** Locking a path */
        locked          ("locked"),

        /** Unlocking a path */
        unlocked        ("unlocked"),

        /** Failed to lock a path */
        failed_lock     ("locking failed"),

        /** Failed to unlock a path */
        failed_unlock   ("unlocking failed"),

        /** Tried adding a path that already exists.  */
        exists          ("path exists"),

        /** Set the changelist for a path.  */
        changelist_set  ("changelist set"),

        /** Clear the changelist for a path.  */
        changelist_clear ("changelist cleared"),

        /** A path has moved to another changelist.  */
        changelist_moved    ("changelist moved"),

        /** A merge operation has begun.  */
        merge_begin     ("merge begin"),

        /** A merge operation from a foreign repository has begun.  */
        foreign_merge_begin ("foreign merge begin"),

        /** Got a replaced in an update.  */
        update_replaced ("replaced"),

        /** Property added.  */
        property_added  ("property added"),

        /** Property modified.  */
        property_modified ("property modified"),

        /** Property deleted.  */
        property_deleted ("property deleted"),

        /** Property delete nonexistent.  */
        property_deleted_nonexistent ("nonexistent property deleted"),

        /** Revision property set.  */
        revprop_set     ("revprop set"),

        /** Revision property deleted.  */
        revprop_deleted ("revprop deleted"),

        /** The last notification in a merge.  */
        merge_completed ("merge completed"),

        /** The path is a tree-conflict victim of the intended action */
        tree_conflict   ("tree conflict"),

        /** The path is a subdirectory referenced in an externals definition
          * which is unable to be operated on.  */
        failed_external ("failed external"),

        /** Starting an update operation */
        update_started ("update started"),

        /** Skipping an obstruction working copy */
        update_skip_obstruction ("update skip obstruction"),

        /** Skipping a working only node */
        update_skip_working_only ("update skip working only"),

        /** Skipped a file or directory to which access couldn't be obtained */
        update_skip_access_denied ("update skip access denied"),

        /** An update operation removed an external working copy.  */
        update_external_removed ("update external removed"),

        /** Applying a shadowed add */
        update_shadowed_add ("update shadowed add"),

        /** Applying a shadowed update */
        update_shadowed_update ("update shadowed update"),

        /** Applying a shadowed delete */
        update_shadowed_delete ("update shadowed delete"),

        /** The mergeinfo on path was updated.  */
        merge_record_info   ("merge record info"),

        /** An working copy directory was upgraded to the latest format.  */
        upgraded_path       ("upgraded path"),

        /** Mergeinfo describing a merge was recorded.  */
        merge_record_info_begin     ("merge record info begin"),

        /** Mergeinfo was removed due to elision.  */
        merge_elide_info    ("Merge elide info"),

        /** A file in the working copy was patched.  */
        patch       ("patch"),

        /** A hunk from a patch was applied.  */
        patch_applied_hunk  ("patch applied hunk"),

        /** A hunk from a patch was rejected.  */
        patch_rejected_hunk ("patch rejected hunk"),

        /** A hunk from a patch was found to be already applied. */
        patch_hunk_already_applied ("patch hunk already applied"),

        /** Committing a non-overwriting copy (path is the target of the
          * copy, not the source). */
        commit_copied   ("commit copied"),

        /** Committing an overwriting (replace) copy (path is the target of
          * the copy, not the source).  */
        commit_copied_replaced  ("commit copied replaced"),

        /** The server has instructed the client to follow a URL
          * redirection. */
        url_redirect    ("url redirect"),

        /** The operation was attempted on a path which doesn't exist. */
        path_nonexistent ("path nonexistent"),

        /** Removing a path by excluding it. */
        exclude ("exclude"),

        /** Operation failed because the node remains in conflict */
        failed_conflict ("failed conflict"),

        /** Operation failed because an added node is missing */
        failed_missing ("failed missing"),

        /** Operation failed because a node is out of date */
        failed_out_of_date ("failed out of date"),

        /** Operation failed because an added parent is not selected */
        failed_no_parent ("failed no parent"),

        /** Operation failed because a node is locked */
        failed_locked ("failed by lock"),

        /** Operation failed because the operation was forbidden */
        failed_forbidden_by_server ("failed forbidden by server"),

        /** Operation skipped the path because it was conflicted */
        skip_conflicted ("skipped conflicted path");

        /**
         * The description of the action.
         */
        private String description;

        Action(String description)
        {
            this.description = description;
        }

        public String toString()
        {
            return description;
        }
    }

    public enum Status
    {
        /** It not applicable*/
        inapplicable    ("inapplicable"),

        /** Notifier doesn't know or isn't saying. */
        unknown         ("unknown"),

        /** The state did not change. */
        unchanged       ("unchanged"),

        /** The item wasn't present. */
        missing         ("missing"),

        /** An unversioned item obstructed work. */
        obstructed      ("obstructed"),

        /** Pristine state was modified. */
        changed         ("changed"),

        /** Modified state had mods merged in. */
        merged          ("merged"),

        /** Modified state got conflicting mods. */
        conflicted      ("conflicted");

        /**
         * The description of the action.
         */
        private String description;

        Status(String description)
        {
            this.description = description;
        }

        public String toString()
        {
            return description;
        }
    }

    public enum LockStatus
    {
        /** does not make sense for this operation */
        inapplicable    ("inapplicable"),

        /** unknown lock state */
        unknown         ("unknown"),

        /** the lock change did not change */
        unchanged       ("unchanged"),

        /** the item was locked */
        locked          ("locked"),

        /** the item was unlocked */
        unlocked        ("unlocked");

        /**
         * The description of the action.
         */
        private String description;

        LockStatus(String description)
        {
            this.description = description;
        }

        public String toString()
        {
            return description;
        }
    }
}