001 /*
002 * Licensed Materials - Property of IBM
003 * Restricted Materials of IBM
004 *
005 * com.ibm.rational.wvcm.stp.cc.CcFile
006 *
007 * (C) Copyright IBM Corporation 2004, 2012. All Rights Reserved.
008 * Note to U.S. Government Users Restricted Rights: Use, duplication or
009 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
010 */
011 package com.ibm.rational.wvcm.stp.cc;
012
013 import static com.ibm.rational.wvcm.stpex.StpExBase.PROPERTY_NAMESPACE;
014
015 import java.io.File;
016 import java.io.OutputStream;
017 import java.util.List;
018
019 import javax.wvcm.ControllableResource;
020 import javax.wvcm.Feedback;
021 import javax.wvcm.PropertyNameList.PropertyName;
022 import javax.wvcm.Resource;
023 import javax.wvcm.WvcmException;
024
025 import com.ibm.rational.wvcm.stp.cc.CcVersion.CcMergeFlag;
026 import com.ibm.rational.wvcm.stpex.StpExEnumeration;
027
028 /**
029 * A proxy for a file, directory, or symbolic link resource in a ClearCase view.
030 * This resource is either under version control or could potentially be
031 * put under version control.
032 */
033 public interface CcFile
034 extends CcResource, ControllableResource
035 {
036 /** Flags for the doApplyAttribute and doRemoveAttribute methods */
037 enum AttributeOpFlag implements StpExEnumeration {
038
039 /**
040 * Replace existing attribute instance.
041 * (Only applies to doApplyAttribute)
042 */
043 REPLACE("replace"),
044
045 /**
046 * Apply/remove attribute recursively over sub-tree.
047 */
048 RECURSE("recurse"),
049
050 /**
051 * If the attribute type was created with a default value, uses
052 * that value for the attribute instead of the value specified in
053 * the call. An error occurs if the attribute type was not created
054 * with a default value.
055 * (Only applies to doApplyAttribute)
056 */
057 DEFAULT("default");
058
059 private String m_name;
060
061 private AttributeOpFlag(String name) { m_name = name; }
062
063 /* (non-Javadoc)
064 * @see java.lang.Object#toString()
065 */
066 public String toString() { return m_name; }
067 }
068
069
070 /** Flags for the doApplyLabel method */
071 enum ApplyLabelFlag implements StpExEnumeration {
072
073 /**
074 * Replace existing label instance.
075 */
076 REPLACE("replace"),
077
078 /**
079 * Apply label recursively over sub-tree.
080 */
081 RECURSE("recurse"),
082
083 /**
084 * Follow symbolic links
085 */
086 FOLLOW_SYMLINKS("follow-symlinks");
087
088 private String m_name;
089
090 private ApplyLabelFlag(String name) { m_name = name; }
091
092 /* (non-Javadoc)
093 * @see java.lang.Object#toString()
094 */
095 public String toString() { return m_name; }
096 }
097
098 /** Flags for the doRemoveLabel method */
099 enum RemoveLabelFlag implements StpExEnumeration {
100
101 /**
102 * Remove label recursively over sub-tree.
103 */
104 RECURSE("recurse"),
105
106 /**
107 * Follow symbolic links
108 */
109 FOLLOW_SYMLINKS("follow-symlinks");
110
111 private String m_name;
112
113 private RemoveLabelFlag(String name) { m_name = name; }
114
115 /* (non-Javadoc)
116 * @see java.lang.Object#toString()
117 */
118 public String toString() { return m_name; }
119 }
120
121 /** Flags for the doUncheckout method */
122 enum UncheckoutFlag implements StpExEnumeration {
123 /**
124 * Preserve changes in checked out version in a ".keep" file.
125 */
126 KEEP("keep");
127
128 private String m_name;
129
130 private UncheckoutFlag(String name) { m_name = name; }
131
132 /* (non-Javadoc)
133 * @see java.lang.Object#toString()
134 */
135 public String toString() { return m_name; }
136 }
137
138 /** Flags for the doUnhijack method */
139 enum UnhijackFlag implements StpExEnumeration {
140
141 /**
142 * Preserve changes in hijacked version in a ".keep" file.
143 */
144 KEEP("keep");
145
146 private UnhijackFlag(String name) { m_name = name; }
147
148 /* (non-Javadoc)
149 * @see java.lang.Object#toString()
150 */
151 public String toString() { return m_name; }
152
153 private String m_name;
154 }
155
156 /**
157 * Flags for the <code>doRefresh</code> and <code>doRestore</code> methods.
158 */
159 enum RefreshFlag implements StpExEnumeration {
160
161 /**
162 * Do <i>not</i> refresh hijacked files.
163 * Leave hijacked files in the hijacked state, and do not alter
164 * their contents.
165 * <p>
166 * Note: a deleted file or directory is considered to be hijacked.
167 * In order to refresh or restore a deleted file or directory,
168 * you must specify <code>OVERWRITE_HIJACKS</code> or
169 * <code>RENAME_HIJACKS</code>.
170 * </p>
171 * This is the default hijack behavior for both <code>doRefresh</code>
172 * and <code>doRestore</code>.
173 */
174 KEEP_HIJACKS("keep-hijacks"),
175
176 /**
177 * If a file being refreshed is hijacked in this view,
178 * overwrite the hijacked contents with the new version's contents.
179 * Do not preserve the hijacked contents.
180 */
181 OVERWRITE_HIJACKS("overwrite-hijacks"),
182
183 /**
184 * If a file being refreshed is hijacked in this view,
185 * preserve the hijacked contents by moving the hijacked file to
186 * <code><file-name>.keep</code>.
187 */
188 RENAME_HIJACKS("rename-hijacks"),
189
190 /**
191 * When refreshing a file to a different version, set the file's
192 * "last modified" time to be the time when the version was created.
193 * By default, a refreshed file's "last modified" time will simply be
194 * the time when the <code>doRefresh</code> was performed.
195 */
196 PRESERVE_CREATION_TIME("preserve-creation-time"),
197
198 /**
199 * Preview the refresh operation, but don't actually perform it.
200 * Invoke the caller's feedback methods to inform them what the
201 * refresh would do if it were performed right now.
202 */
203 PREVIEW_ONLY("preview-only");
204
205 private String m_name;
206
207 private RefreshFlag(String name) { m_name = name; }
208
209 /* (non-Javadoc)
210 * @see java.lang.Object#toString()
211 */
212 public String toString() { return m_name; }
213 }
214
215 /** Flags for the <code>doCheckout</code> method. */
216 enum CcCheckoutFlag implements StpExEnumeration {
217
218 /**
219 * Indicates whether to checkout this file reserved.
220 */
221 RESERVED("reserved"),
222
223 /**
224 * Fall back to unreserved if a reservation can not be obtained.
225 */
226 FALLBACK_TO_UNRESERVED("fallback-to-unreserved"),
227
228 /**
229 * Checkout the version of the file that is currently loaded in the
230 * view, even if that version is not the version selected by the
231 * view's config spec.
232 *
233 * <p>If the loaded version is not the version selected by the view's
234 * config spec, and neither {@link #LOADED_NOT_LATEST} nor
235 * {@link #LATEST_NOT_LOADED} flags are set, the checkout operation
236 * will throw an exception with reason code <code>CHECKOUT_NOT_LATEST</code>.
237 */
238 LOADED_NOT_LATEST("checkout-loaded-not-latest"),
239
240 /**
241 * Checkout the version of the file that is selected by the view's
242 * config spec. If this version is not loaded at checkout time, then
243 * load it prior to performing the checkout.
244 *
245 * <p>If the loaded version is not the version selected by the view's
246 * config spec, and neither {@link #LOADED_NOT_LATEST} nor
247 * {@link #LATEST_NOT_LOADED} flags are set, the checkout operation
248 * will throw an exception with reason code <code>CHECKOUT_NOT_LATEST</code>.
249 */
250 LATEST_NOT_LOADED("checkout-latest-not-loaded"),
251
252 /**
253 * Indicates whether to checkout this file even if the currently
254 * selected branch is mastered by another replica. The
255 * <code>RESERVED</code> flag must NOT be set with this flag.
256 *
257 * <p>If the file is mastered by this replica, setting this
258 * flag has no effect.
259 */
260 NON_MASTERED_OK("non-mastered-ok"),
261
262 /**
263 * If the file is hijacked, keep the hijacked contents upon checkout.
264 */
265 PRESERVE_HIJACK_CONTENTS("preserve-hijack-contents"),
266
267 /**
268 * After a file is 'checkedout', set the file's "last modified"
269 * time to be the time when the version was first created.
270 * <p>This applies only to dynamic views.
271 */
272 PRESERVE_MODIFICATION_TIME("preserve-modification-time");
273
274 private String m_name;
275
276 private CcCheckoutFlag(String name) { m_name = name; }
277
278 /* (non-Javadoc)
279 * @see java.lang.Object#toString()
280 */
281 public String toString() { return m_name; }
282 }
283
284 /** Flags for the <code>doCcVersionControl</code> method. */
285 enum CcVersionControlFlag implements StpExEnumeration {
286
287 /**
288 * Indicates whether to checkin this file after it is added to version control.
289 * The default is to leave it checked out.<p>
290 * This flag is mutually exclusive with {@link CcVersionControlFlag#NO_CHECKOUT}.
291 */
292 CHECKIN("checkin"),
293
294 /**
295 * Do not checkout the file after adding to version control.<p>
296 * This flag is mutually exclusive with {@link CcVersionControlFlag#CHECKIN}.
297 */
298 NO_CHECKOUT("no-checkout"),
299
300 /**
301 * Assigns mastership of the <b>main</b> branch of the newly version controlled
302 * file to the VOB replica in which you execute operation. By default
303 * mastership of the file's <b>main</b> branch is assigned to the VOB replica
304 * that masters the <b>main</b> branch type. <p>
305 * This flag is mutually exclusive with {@link CcVersionControlFlag#MAKE_PATH}.
306 */
307 MASTER_LOCALLY("master-locally"),
308
309 /**
310 * Automatically checkout the version controlled parent directory and
311 * check back in after new file has been added to version control.
312 * Any view private parent directories below the version controlled parent
313 * and the desired file, will also be version controlled.<p>
314 * This flag is mutually exclusive with {@link CcVersionControlFlag#MASTER_LOCALLY}.
315 */
316 MAKE_PATH("mkpath");
317
318 private String m_name;
319
320 private CcVersionControlFlag(String name) { m_name = name; }
321
322 /* (non-Javadoc)
323 * @see java.lang.Object#toString()
324 */
325 public String toString() { return m_name; }
326 }
327
328 /** Values for file or directory load state */
329 enum LoadState implements StpExEnumeration {
330
331 /**
332 * This file or directory is loaded in its file area.
333 */
334 LOADED,
335
336 /**
337 * This directory is partially loaded in its file area, i.e.,
338 * some but not all of its children are loaded.
339 */
340 PARTIALLY_LOADED,
341
342 /**
343 * This file or directory is not loaded in its file area.
344 */
345 NOT_LOADED;
346 }
347
348 /**
349 * Create a new view-private file at the location specified by this resource.
350 * The request will fail if a resource already exists at that location.
351 * @param feedback
352 * @return a CcFile proxy for the new file
353 * @see javax.wvcm.ControllableResource#doCreateResource(Feedback)
354 */
355 public CcFile createCcFile(Feedback feedback) throws WvcmException;
356
357 /**
358 * Apply the specified attribute to the checked-in version of this controllable resource.
359 * @param flags array of flags which specify the behavior of the operation
360 * @param comment Comment (if any) to be used for operation. Empty string if none.
361 * @param attributeName Name of an existing attribute type to be used to create
362 * an instance will to be applied to this resource.
363 * @param attributeValue Value of attribute instance. If the vtype of the attribute type is
364 * a string, it must be enclosed in additional quotes <em>within the string</em>. For example, if
365 * specified as a constant it would appear as <code>"\"string value\""</code>. If the
366 * vtype is not a string, this should be a string representation of the given value
367 * (e.g. <code>"3.1415"</code>, <code>"0xa413"</code>, etc.).
368 * @param versionId Applies the attribute to the explicitly specified version,
369 * overriding the version selected by the view.
370 * This string must only represent the version suffix (e.g. /main/314).
371 * @param feedback
372 * @return A new proxy for this resource, whose properties are specified by feedback.
373 * @throws WvcmException
374 */
375 ControllableResource doApplyAttribute(AttributeOpFlag[] flags, String comment,
376 String attributeName, String attributeValue, String versionId, Feedback feedback)
377 throws WvcmException;
378
379 /**
380 * Remove the specified attribute from the checked-in version of this controllable resource.
381 * @param flags array of flags which specify the behavior of the operation
382 * @param comment Comment (if any) to be used for operation. Empty string if none.
383 * @param attributeName Name of the attribute to be removed from this resource
384 * @param versionId Removes the attribute from the explicitly specified version,
385 * overriding the version selected by the view.
386 * @param feedback
387 * @return A new proxy for this resource, whose properties are specified by feedback.
388 * @throws WvcmException
389 */
390 ControllableResource doRemoveAttribute(AttributeOpFlag[] flags, String comment,
391 String attributeName, String versionId, Feedback feedback)
392 throws WvcmException;
393
394 /**
395 * Apply the specified label to the checked-in version of this controllable resource.
396 * @param flags array of flags which specify the behavior of the operation
397 * @param label the label to be added to this version
398 * @param feedback
399 * @return A new proxy for this resource, whose properties are specified by feedback.
400 * @throws WvcmException
401 */
402 ControllableResource doApplyLabel(ApplyLabelFlag[] flags, String label, Feedback feedback)
403 throws WvcmException;
404
405 /**
406 * Remove the specified label from the checked-in version of this controllable resource.
407 * @param flags array of flags which specify the behavior of the operation
408 * @param label the label to be removed from this version
409 * @param feedback
410 * @return A new proxy for this resource, whose properties are specified by feedback.
411 * @throws WvcmException
412 */
413 ControllableResource doRemoveLabel(RemoveLabelFlag[] flags, String label, Feedback feedback)
414 throws WvcmException;
415
416 /**
417 * <p>Check out this version-controlled file or directory resource.
418 * The resource is checked out to the ClearCase view implied by its location.
419 * </p>
420 * <p>If the view is a UCM view, the caller must insure there is a
421 * {@link javax.wvcm.Workspace#CURRENT_ACTIVITY} for this operation.
422 * The checked out file will be added to the current activity's change set.
423 * The caller may explicitly specify an activity using this resource's
424 * {@link javax.wvcm.ControllableResource#setActivity} method. In that case,
425 * the specified activity will become the new current activity.
426 * Otherwise, the existing current activity will be used.
427 * If the view is a UCM view and there is no current activity, the operation
428 * will fail.
429 * </p>
430 * <p>The caller may optionally specify a checkout comment using this
431 * resource's {@link javax.wvcm.Resource#setComment} method.
432 * </p>
433 * @param flags array of flags which specify the behavior of the operation
434 * @param feedback
435 * @return new CcFile proxy representing the checked out file.
436 * @throws WvcmException
437 */
438 CcFile doCcCheckout(CcCheckoutFlag[] flags, Feedback feedback)
439 throws WvcmException;
440
441 /**
442 * Cancel the checkout of this version-controlled resource,
443 * and restore its content to the state of its CHECKED_IN version.
444 * @param flags array of flags which specify the behavior of the operation
445 * @param feedback
446 * @return new CcFile proxy representing the file whose checkout has been canceled
447 * @throws WvcmException
448 * @see javax.wvcm.ControllableResource#doUncheckout
449 */
450 CcFile doUncheckout(UncheckoutFlag[] flags, Feedback feedback)
451 throws WvcmException;
452
453 /**
454 * <p>Check in this checked out file or directory resource.
455 * </p>
456 * <p>If this resource is in a UCM view, it was added to an activity's
457 * change set at checkout time. The caller may specify an alternate
458 * change set using this resource's
459 * {@link javax.wvcm.ControllableResource#setActivity} method just before
460 * calling <code>doCheckin</code>.
461 * </p>
462 * <p>The caller may also specify a checkin comment using this
463 * resource's {@link javax.wvcm.Resource#setComment} method.
464 * This will override the comment specified at checkout time, if any.
465 * </p>
466 * @param flags array of flags which specify the behavior of the operation
467 * @param feedback
468 * @return new ControllableResource proxy representing the checked in file.
469 * @throws WvcmException
470 * @see javax.wvcm.ControllableResource#doCheckin
471 * @see com.ibm.rational.wvcm.stp.cc.CcFile#doCheckout
472 */
473 ControllableResource doCheckin(CheckinFlag[] flags, Feedback feedback)
474 throws WvcmException;
475
476 /**
477 * Merges the contents of two or more versions, representing files or
478 * directories, into this file. Versions must be of the same element as this
479 * file.
480 *
481 * @param baseVersion Base contributor. Can be null.
482 * @param contribList One or more contributing versions.
483 * @param flags Specify options for the merge. Can be null.
484 * @param listener Callback notifier for the merge.
485 * @param feedback
486 * @return new CcFile proxy representing the merged file.
487 * @throws WvcmException if there is an error during the merge.
488 */
489 CcFile doMerge(CcVersion baseVersion,
490 List<CcVersion> contribList,
491 CcMergeFlag[] flags,
492 CcListener listener,
493 Feedback feedback) throws WvcmException;
494
495 /**
496 * Places the view-private file specified by this proxy under version control.
497 * <p>If the view is a UCM view, the caller must insure there is a
498 * {@link javax.wvcm.Workspace#CURRENT_ACTIVITY} for this operation.
499 * The newly version controlled file will be added to the current activity's change set
500 * and left in a checked-in state.
501 * The caller may explicitly specify an activity using this resource's
502 * {@link javax.wvcm.ControllableResource#setActivity} method. In that case,
503 * the specified activity will become the new current activity.
504 * Otherwise, the existing current activity will be used.
505 * If the view is a UCM view and there is no current activity, the operation
506 * will fail.
507 * </p>
508 * <p>The caller may optionally specify a creation comment using this
509 * resource's {@link javax.wvcm.Resource#setComment} method.
510 * </p>
511 * <p>The caller may optionally specify the type of element to be created using
512 * this resource's {@link com.ibm.rational.wvcm.stp.cc.CcFile#setElementType} method.
513 * </p>
514 * @param feedback
515 * @return new ControllableResource proxy representing the version controlled file.
516 * @throws WvcmException
517 * @see javax.wvcm.ControllableResource#doVersionControl(javax.wvcm.Feedback)
518 */
519 ControllableResource
520 doVersionControl(Feedback feedback)
521 throws WvcmException;
522
523 /**
524 * Enhanced variant of the doVersionControl that provides additional flags
525 * which modify the behaviour.<p>
526 * This method has two main difference from <code>doVersionControl</code>:
527 * <ol>
528 * <li>It does <b>not</b> automatically checkout the version controlled
529 * parent directory. The caller must do this explicitly unless the
530 * {@link com.ibm.rational.wvcm.stp.cc.CcFile.CcVersionControlFlag#MAKE_PATH}
531 * flag is specified.
532 * <li>The newly version controlled file will be left in a checked-out state.
533 * To have the resulting file checked-in, specify the
534 * {@link com.ibm.rational.wvcm.stp.cc.CcFile.CcVersionControlFlag#CHECKIN} flag.
535 * </ol>
536 * @param flags array of flags which specify the behavior of the operation
537 * @param feedback
538 * @return A new proxy for this resource, whose properties are specified by feedback.
539 * @throws WvcmException
540 * @see com.ibm.rational.wvcm.stp.cc.CcFile#doVersionControl(javax.wvcm.Feedback)
541 */
542 ControllableResource
543 doCcVersionControl(CcVersionControlFlag flags[], Feedback feedback)
544 throws WvcmException;
545
546 /**
547 * <p>
548 * Refresh this file or directory. Re-evaluate the
549 * view's config spec and update resources on the client to be whatever
550 * is currently selected by the config spec. If this is a directory,
551 * recursively refresh its contents.
552 * </p>
553 * <p>
554 * Example: The config spec says "element * /main/LATEST", and you
555 * have version "/main/7" of this resource loaded. Someone else checks
556 * in a new version, thus creating a "/main/8". In that case,
557 * doRefresh() will cause version "/main/8" of this resource to
558 * be loaded into your view.
559 * </p>
560 * <p>
561 * Preconditions: This resource must be a version-controlled file
562 * or directory.
563 * </p>
564 * <p>
565 * Postconditions: This resource (and its descendants if this is a
566 * directory) are updated to be what is currently selected by the view's
567 * config spec.
568 * </p>
569 * @param flags array of flags which specify the behavior of the operation
570 * @param feedback a list of properties to fetch on the
571 * updated resources. The resources returned by the iterator returned
572 * by doRefresh will have these properties filled in.
573 * @return a new CcFile proxy representing the refreshed file
574 * @throws WvcmException if the precondition is not met or if an error
575 */
576 CcFile doRefresh(RefreshFlag[] flags, Feedback feedback)
577 throws WvcmException;
578
579 /**
580 * <p>
581 * Refresh this file or directory. Re-evaluate the
582 * view's config spec and update resources on the client to be whatever
583 * is currently selected by the config spec. If this is a directory,
584 * recursively refresh its contents.
585 * </p>
586 * <p>
587 * Example: The config spec says "element * /main/LATEST", and you
588 * have version "/main/7" of this resource loaded. Someone else checks
589 * in a new version, thus creating a "/main/8". In that case,
590 * doRefresh() will cause version "/main/8" of this resource to
591 * be loaded into your view.
592 * </p>
593 * <p>
594 * Preconditions: This resource must be a version-controlled file
595 * or directory.
596 * </p>
597 * <p>
598 * Postconditions: This resource (and its descendants if this is a
599 * directory) are updated to be what is currently selected by the view's
600 * config spec.
601 * </p>
602 * @param flags array of flags which specify the behavior of the operation
603 * @param listener Callback notifier for the merge.
604 * @param feedback a list of properties to fetch on the
605 * updated resources. The resources returned by the iterator returned
606 * by doRefresh will have these properties filled in.
607 * @return a new CcFile proxy representing the refreshed file
608 * @throws WvcmException if the precondition is not met or if an error
609 */
610 CcFile doCcRefresh(RefreshFlag[] flags, CcListener listener, Feedback feedback)
611 throws WvcmException;
612
613 /**
614 * <p>
615 * Restore this file or directory. If this is a directory, recursively
616 * restore its contents. This repairs any damage to the portion of the file
617 * area database specified by this resource.
618 * </p>
619 *
620 * @param flags array of flags which specify the behavior of the operation
621 * @param feedback
622 * @return a new CcFile proxy representing the restored file
623 * @throws WvcmException
624 */
625 CcFile doRestore(RefreshFlag[] flags, Feedback feedback)
626 throws WvcmException;
627
628 /**
629 * <p>
630 * Load this controllable resource into the web view's local file area.
631 * If this is a controllable folder, loads the tree of controllable
632 * resources under this folder.
633 * Also updates the web view's load rules if necessary
634 * to include this file or folder.
635 * </p>
636 * <p>
637 * If this resource was already loaded, doLoad is a no-op.
638 * </p>
639 * <p>
640 * Preconditions: This must be a version-controlled file or folder
641 * in a web view.
642 * </p>
643 * <p>
644 * Postconditions: This file, or the tree of files under this folder,
645 * is loaded into the web view. Thus, the file(s) appear, and the view's
646 * load rules are updated to include this file or folder.
647 * </p>
648 * @param feedback (optional) feedback's notifyIsModified() method will be
649 * called for each file or directory as it is loaded
650 * @return a new CcFile proxy for the file that has been loaded
651 * @throws WvcmException
652 */
653 CcFile doLoad(Feedback feedback) throws WvcmException;
654
655 /**
656 * Hijack this web view controllable resource.
657 * Make the resource writable and set its "last modified" time to the
658 * current time. This operation does <i>not</i> contact the server.
659 * @param feedback
660 * @return a new CcFile proxy for the hijacked file
661 * @throws WvcmException
662 */
663 CcFile hijack(Feedback feedback)
664 throws WvcmException;
665
666 /**
667 * Undo a hijack on this hijacked controllable resource. Reload the file's
668 * contents from the appropriate version on the server.
669 * @param flags Specify <code>KEEP</code> to save a copy of the hijacked
670 * file's contents in a ".keep" file before undoing the hijack.
671 * @param feedback
672 * @return a new CcFile proxy for the unhijacked file
673 * @throws WvcmException
674 */
675 CcFile doUnhijack(UnhijackFlag[] flags, Feedback feedback)
676 throws WvcmException;
677
678 /**
679 * For client resources, identifies the file system path to the local file
680 * representing this controllable resource.
681 */
682 PropertyName<File> CLIENT_PATH =
683 new PropertyName<File>(PROPERTY_NAMESPACE, "client-path");
684
685 /**
686 * Returns the value of this proxy's {@link #CLIENT_PATH} property.
687 * @return The path to this ControllableResource in the local file area.
688 * Will never be <code>null</code>.
689 * @throws WvcmException if requested of a ControllableResource without client state
690 */
691 File getClientPath() throws WvcmException;
692
693 /**
694 * For version-controlled resources, this resource's element type.
695 */
696 PropertyName<CcElementType> ELEMENT_TYPE =
697 new PropertyName<CcElementType>(PROPERTY_NAMESPACE, "element-type");
698
699 /**
700 * Returns the value of this proxy's {@link #ELEMENT_TYPE} property.
701 * @return This resource's element type. Will be <code>null</code>
702 * if resource is not version-controlled.
703 * @throws WvcmException if this proxy doesn't define a value for this property.
704 */
705 CcElementType getElementType() throws WvcmException;
706
707 /**
708 * Set the value of this file or directory's {@link #ELEMENT_TYPE} property.
709 * This property can only be set just prior to calling doVersionControl()
710 * on the resource.
711 * @param eltype resource's desired element type
712 */
713 void setElementType(CcElementType eltype);
714
715 /**
716 * Is this file a web view file area database file? File area DB files require
717 * special treatment. For instance, they cannot be source controlled.
718 * For this reason, applications may choose to hide these files from
719 * the end user.
720 */
721 PropertyName<Boolean> IS_DB_FILE =
722 new PropertyName<Boolean>(PROPERTY_NAMESPACE, "is-db-file");
723
724 /**
725 * Get the value of this files {@link #IS_DB_FILE} property.
726 * @return true if this file is a file area database file, else false
727 * @throws WvcmException
728 * if this proxy doesn't define a value for this property.
729 */
730 public boolean getIsDbFile() throws WvcmException;
731
732 /**
733 * Property which is true/false depending on whether this version-controlled
734 * resource has been hijacked.
735 */
736 PropertyName<Boolean> IS_HIJACKED =
737 new PropertyName<Boolean>(PROPERTY_NAMESPACE, "is-hijacked");
738
739 /**
740 * Get the value of this file's {@link #IS_HIJACKED} property.
741 * @return true if the file is hijacked, false otherwise
742 * @throws WvcmException
743 * if this proxy doesn't define a value for this property.
744 */
745 public boolean getIsHijacked() throws WvcmException;
746
747 /**
748 * Is this file actually a symbolic link?
749 */
750 PropertyName<Boolean> IS_SYMLINK =
751 new PropertyName<Boolean>(PROPERTY_NAMESPACE, "is-symlink");
752
753 /**
754 * Get the value of the {@link #IS_SYMLINK} property.
755 * @return true if this resource is a symbolic link, false otherwise.
756 * @throws WvcmException
757 * if this proxy doesn't define a value for this property.
758 */
759 public boolean getIsSymlink() throws WvcmException;
760
761 /**
762 * Returns the direct parent of this file. The value will
763 * be <code>null</code> if the file has no parent (e.g. VOB root).
764 * Does not find parents of hard-linked names for the file.
765 */
766 public static final PropertyName<CcFile> PARENT =
767 new PropertyName<CcFile>(PROPERTY_NAMESPACE, "cc-parent");
768
769 /**
770 * Get the value of the {@link #PARENT} property.
771 * @return A CcFile proxy for the parent, null if no parent
772 * @throws WvcmException
773 */
774 public CcFile getParent() throws WvcmException;
775
776 /**
777 * <p>If this file is actually a symbolic link, the path to its target file
778 * or directory. The path is interpreted relative to this file's parent
779 * directory.</p>
780 *
781 * <p>If this file is not a symbolic link, this value will be
782 * <code>null</code>.</p>
783 */
784 PropertyName<String> SYMLINK_TARGET_PATH =
785 new PropertyName<String>(PROPERTY_NAMESPACE, "symlink-target-path");
786
787 /**
788 * Get the value of this resource's {@link #SYMLINK_TARGET_PATH} property.
789 * @return path to symlink's target file or directory, or <code>null</code>
790 * if this file is not a symbolic link.
791 * @throws WvcmException if property was not requested
792 */
793 public String getSymlinkTargetPath() throws WvcmException;
794
795 /**
796 * The view-relative path for this resource.
797 */
798 PropertyName<String> VIEW_RELATIVE_PATH =
799 new PropertyName<String>(PROPERTY_NAMESPACE, "cr-view-relative-path");
800
801 /**
802 * Get the value of this resource's {@link #VIEW_RELATIVE_PATH} property.
803 * @return view-relative path
804 * @throws WvcmException if property was not requested
805 */
806 public String getViewRelativePath() throws WvcmException;
807
808 /**
809 * The CC version resource associated with this file.
810 * The value of this property will be null if this is not a version-
811 * controlled resource.
812 * @see javax.wvcm.ControllableResource#CHECKED_IN and
813 * javax.wvcm.ControllableResource#CHECKED_OUT
814 */
815 PropertyName<CcVersion> VERSION =
816 new PropertyName<CcVersion>(PROPERTY_NAMESPACE, "version");
817
818 /**
819 * Get the value of this resource's {@link #VERSION} property.
820 * @return this file's version, or <code>null</code> if this file is
821 * not version controlled
822 * @throws WvcmException if property was not requested
823 */
824 public CcVersion getVersion() throws WvcmException;
825
826 /**
827 * The OID of the CC version resource associated with this file.
828 * The value of this property will be null if this is not a version-
829 * controlled resource.
830 */
831 PropertyName<String> VERSION_OID =
832 new PropertyName<String>(PROPERTY_NAMESPACE, "version-oid");
833
834 /**
835 * Get the value of this resource's {@link #VERSION_OID} property.
836 * @return this file's version oid, or <code>null</code> if this file is
837 * not version controlled
838 * @throws WvcmException if property was not requested
839 */
840 public String getVersionOid() throws WvcmException;
841
842 /**
843 * The tag of the VOB in which this file resides.
844 */
845 PropertyName<CcVobTag> VOB_TAG =
846 new PropertyName<CcVobTag>(PROPERTY_NAMESPACE, "file-vob-tag");
847
848 /**
849 * Get the value of this resource's {@link #VOB_TAG} property.
850 * @return the VOB tag for this file's VOB as a CcVobTag proxy,
851 * or <code>null</code> if this file is not version controlled
852 * @throws WvcmException if property was not requested
853 */
854 public CcVobTag getVobTag() throws WvcmException;
855
856 /**
857 * The CC element resource associated with this file.
858 * The value of this property will be null if this is not a version-
859 * controlled resource.
860 * @see javax.wvcm.ControllableResource#VERSION_HISTORY
861 */
862 PropertyName<CcElement> ELEMENT =
863 new PropertyName<CcElement>(PROPERTY_NAMESPACE, "element");
864
865 /**
866 * Get the value of this resource's {@link #ELEMENT} property.
867 * @return this file's element, or <code>null</code> if this file is
868 * not version controlled
869 * @throws WvcmException if property was not requested
870 */
871 public CcElement getElement() throws WvcmException;
872
873 /**
874 * Returns a {@link java.io.File File} representing the location of this
875 * client-side resource in the local file system, else <code>null</code> if
876 * this resource is a server-side resource only, e.g., if it is a proxy
877 * to an unloaded file in a web view.
878 * @return The location of this resource in the local file system, else
879 * <code>null</code> if this is a proxy to a server-side resource only.
880 *
881 * @throws WvcmException Thrown if there was an error in determining the
882 * path for this client-side Resource.
883 */
884 File clientResourceFile() throws WvcmException;
885
886 /**
887 * Reads the file's properties, if they are available locally on the client machine.
888 * @param feedback the properties to be available in the returned proxy,
889 * and any other feedback desired, such as progress indications.
890 * @return a {@link CcFile} containing the wanted properties
891 * that are available locally on the client machine
892 * without communicating with the server.
893 * @see Resource#doReadProperties(Feedback) doReadProperties.
894 * @throws WvcmException ReasonCode:
895 * <br> {@link javax.wvcm.WvcmException.ReasonCode#NOT_FOUND}:
896 * The file MUST be available locally on the client machine.
897 */
898 CcFile readProperties(Feedback feedback) throws WvcmException;
899
900 /**
901 * Reads the file's content, if it is available locally on the client machine.
902 * @see Resource#doReadContent(OutputStream,Feedback) doReadContent
903 * @param feedback the properties to be available in the returned proxy,
904 * and any other feedback desired, such as progress indications.
905 * @param content the file's content, if available, is written to this
906 * byte stream. The stream is then closed.
907 * @return a CcFile proxy containing the wanted properties
908 * that are available on the client host without communicating with the server.
909 * @throws WvcmException ReasonCode:
910 * <br> {@link javax.wvcm.WvcmException.ReasonCode#NOT_FOUND}:
911 * The file MUST be available locally on the client machine.
912 */
913 CcFile readContent(OutputStream content, Feedback feedback) throws WvcmException;
914
915 /**
916 * Resolve this file resource, but do not consult the ClearCase server.
917 * Unlike {@link CcResource#doResolve()}, use only information currently
918 * available information on the local client machine.
919 * @see CcResource#doResolve()
920 * @return a new file proxy of the correct, most specific resource type
921 * @throws WvcmException with NOT_FOUND reason code if this file does not
922 * exist on the local machine.
923 */
924 CcFile resolve() throws WvcmException;
925
926 /**
927 * Whether this file is loaded, partially loaded, or not loaded in the
928 * web view file area in which it resides.
929 */
930 PropertyName<LoadState> LOAD_STATE =
931 new PropertyName<LoadState>(PROPERTY_NAMESPACE, "load-state");
932
933 /**
934 * Get the value of this resource's {@link #LOAD_STATE} property.
935 * @return LoadState.LOADED, LoadState.PARTIALLY_LOADED or LoadState.NOT_LOADED
936 * @throws WvcmException
937 * if this proxy doesn't define a value for this property.
938 */
939 LoadState getLoadState() throws WvcmException;
940
941 /**
942 * <p>Version controlled files and directories in a web view
943 * may have both client state -
944 * state maintained in a local file area - and server state. When the
945 * client state and server state get out of sync, we call this <i>skew</i>.
946 * </p>
947 * <p>By definition, skew cannot occur in a dynamic view.
948 * </p>
949 * <p>The caller can detect skew by including the {@link #SKEWED_PROPERTY_LIST}
950 * property in property requests to <code>doReadProperties()</code> and
951 * other <code>do</code> methods that accept property requests.
952 *
953 * The resulting value of this property is the list of property names
954 * in the request that differed between the client and the server for this
955 * particular file or directory.
956 * </p>
957 * <p>Note that only certain properties are checked for skew - properties
958 * where skew can cause significant problems. For example,
959 * {@link #IS_CHECKED_OUT}, {@link #IS_VERSION_CONTROLLED}, and
960 * {@link #VERSION_OID}.
961 *
962 * Note that skew can also be caused by elementness skew (file vs dir) and
963 * loadness skew (loaded vs unloaded).
964 * </p>
965 * <p>Note also that <i>only</i> properties in the current property request
966 * are checked for skew.
967 * </p>
968 * <p>NOTE: This should be used only as a trigger to do a real discordance
969 * scan of the directory. These values are not reliable enough to use for
970 * icon decoration or user messages. This is a quick and easy way to
971 * automatically detect skew, but it does not cover all edge cases
972 * (symlinks, aliases, and others) or discordance types.
973 * </p>
974 */
975 PropertyName<List<PropertyName>> SKEWED_PROPERTY_LIST =
976 new PropertyName<List<PropertyName>>(PROPERTY_NAMESPACE, "skewed-property-list");
977
978 /**
979 * Get the value of this file's {@link #SKEWED_PROPERTY_LIST} property.
980 *
981 * NOTE: This should be used only as a trigger to do a real discordance
982 * scan of the directory. These values are not reliable enough to use for
983 * icon decoration or user messages. This is a quick and easy way to
984 * automatically detect skew, but it does not cover all edge cases
985 * (symlinks, aliases, and others) or discordance types.
986 *
987 * @return a list of property names in the current property request whose
988 * values differed between the client and the server for this file
989 * or directory.
990 * @throws WvcmException
991 * if this proxy doesn't define a value for this property.
992 */
993 List<PropertyName> getSkewedPropertyList() throws WvcmException;
994
995 /**
996 * The config spec rule that selects this file.
997 */
998 PropertyName<String> SELECTION_RULE =
999 new PropertyName<String>(PROPERTY_NAMESPACE, "selection-rule");
1000
1001 /**
1002 * Get the value of this resource's {@link #SELECTION_RULE} property.
1003 * @return this file's config spec rule, as a string.
1004 * @throws WvcmException
1005 * if this proxy doesn't define a value for this property.
1006 */
1007 String getSelectionRule() throws WvcmException;
1008
1009 /**
1010 * The version of this file that is currently the latest on the same branch.
1011 */
1012 PropertyName<CcVersion> LATEST_VERSION_ON_BRANCH =
1013 new PropertyName<CcVersion>(PROPERTY_NAMESPACE, "latest-version-on-branch");
1014
1015 /**
1016 * Get the value of this resource's {@link #LATEST_VERSION_ON_BRANCH} property.
1017 * @return the version of this file that is the latest on the same branch as the
1018 * version in the view.
1019 * @throws WvcmException
1020 * if this proxy doesn't define a value for this property.
1021 */
1022 CcVersion getLatestVersionOnBranch() throws WvcmException;
1023 }