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, 2011. 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 * Restore this file or directory. If this is a directory, recursively 582 * restore its contents. This repairs any damage to the portion of the file 583 * area database specified by this resource. 584 * </p> 585 * 586 * @param flags array of flags which specify the behavior of the operation 587 * @param feedback 588 * @return a new CcFile proxy representing the restored file 589 * @throws WvcmException 590 */ 591 CcFile doRestore(RefreshFlag[] flags, Feedback feedback) 592 throws WvcmException; 593 594 /** 595 * <p> 596 * Load this controllable resource into the web view's local file area. 597 * If this is a controllable folder, loads the tree of controllable 598 * resources under this folder. 599 * Also updates the web view's load rules if necessary 600 * to include this file or folder. 601 * </p> 602 * <p> 603 * If this resource was already loaded, doLoad is a no-op. 604 * </p> 605 * <p> 606 * Preconditions: This must be a version-controlled file or folder 607 * in a web view. 608 * </p> 609 * <p> 610 * Postconditions: This file, or the tree of files under this folder, 611 * is loaded into the web view. Thus, the file(s) appear, and the view's 612 * load rules are updated to include this file or folder. 613 * </p> 614 * @param feedback (optional) feedback's notifyIsModified() method will be 615 * called for each file or directory as it is loaded 616 * @return a new CcFile proxy for the file that has been loaded 617 * @throws WvcmException 618 */ 619 CcFile doLoad(Feedback feedback) throws WvcmException; 620 621 /** 622 * Hijack this web view controllable resource. 623 * Make the resource writable and set its "last modified" time to the 624 * current time. This operation does <i>not</i> contact the server. 625 * @param feedback 626 * @return a new CcFile proxy for the hijacked file 627 * @throws WvcmException 628 */ 629 CcFile hijack(Feedback feedback) 630 throws WvcmException; 631 632 /** 633 * Undo a hijack on this hijacked controllable resource. Reload the file's 634 * contents from the appropriate version on the server. 635 * @param flags Specify <code>KEEP</code> to save a copy of the hijacked 636 * file's contents in a ".keep" file before undoing the hijack. 637 * @param feedback 638 * @return a new CcFile proxy for the unhijacked file 639 * @throws WvcmException 640 */ 641 CcFile doUnhijack(UnhijackFlag[] flags, Feedback feedback) 642 throws WvcmException; 643 644 /** 645 * For client resources, identifies the file system path to the local file 646 * representing this controllable resource. 647 */ 648 PropertyName<File> CLIENT_PATH = 649 new PropertyName<File>(PROPERTY_NAMESPACE, "client-path"); 650 651 /** 652 * Returns the value of this proxy's {@link #CLIENT_PATH} property. 653 * @return The path to this ControllableResource in the local file area. 654 * Will never be <code>null</code>. 655 * @throws WvcmException if requested of a ControllableResource without client state 656 */ 657 File getClientPath() throws WvcmException; 658 659 /** 660 * For version-controlled resources, this resource's element type. 661 */ 662 PropertyName<CcElementType> ELEMENT_TYPE = 663 new PropertyName<CcElementType>(PROPERTY_NAMESPACE, "element-type"); 664 665 /** 666 * Returns the value of this proxy's {@link #ELEMENT_TYPE} property. 667 * @return This resource's element type. Will be <code>null</code> 668 * if resource is not version-controlled. 669 * @throws WvcmException if this proxy doesn't define a value for this property. 670 */ 671 CcElementType getElementType() throws WvcmException; 672 673 /** 674 * Set the value of this file or directory's {@link #ELEMENT_TYPE} property. 675 * This property can only be set just prior to calling doVersionControl() 676 * on the resource. 677 * @param eltype resource's desired element type 678 */ 679 void setElementType(CcElementType eltype); 680 681 /** 682 * Is this file a web view file area database file? File area DB files require 683 * special treatment. For instance, they cannot be source controlled. 684 * For this reason, applications may choose to hide these files from 685 * the end user. 686 */ 687 PropertyName<Boolean> IS_DB_FILE = 688 new PropertyName<Boolean>(PROPERTY_NAMESPACE, "is-db-file"); 689 690 /** 691 * Get the value of this files {@link #IS_DB_FILE} property. 692 * @return true if this file is a file area database file, else false 693 * @throws WvcmException 694 * if this proxy doesn't define a value for this property. 695 */ 696 public boolean getIsDbFile() throws WvcmException; 697 698 /** 699 * Property which is true/false depending on whether this version-controlled 700 * resource has been hijacked. 701 */ 702 PropertyName<Boolean> IS_HIJACKED = 703 new PropertyName<Boolean>(PROPERTY_NAMESPACE, "is-hijacked"); 704 705 /** 706 * Get the value of this file's {@link #IS_HIJACKED} property. 707 * @return true if the file is hijacked, false otherwise 708 * @throws WvcmException 709 * if this proxy doesn't define a value for this property. 710 */ 711 public boolean getIsHijacked() throws WvcmException; 712 713 /** 714 * Is this file actually a symbolic link? 715 */ 716 PropertyName<Boolean> IS_SYMLINK = 717 new PropertyName<Boolean>(PROPERTY_NAMESPACE, "is-symlink"); 718 719 /** 720 * Get the value of the {@link #IS_SYMLINK} property. 721 * @return true if this resource is a symbolic link, false otherwise. 722 * @throws WvcmException 723 * if this proxy doesn't define a value for this property. 724 */ 725 public boolean getIsSymlink() throws WvcmException; 726 727 /** 728 * Returns the direct parent of this file. The value will 729 * be <code>null</code> if the file has no parent (e.g. VOB root). 730 * Does not find parents of hard-linked names for the file. 731 */ 732 public static final PropertyName<CcFile> PARENT = 733 new PropertyName<CcFile>(PROPERTY_NAMESPACE, "cc-parent"); 734 735 /** 736 * Get the value of the {@link #PARENT} property. 737 * @return A CcFile proxy for the parent, null if no parent 738 * @throws WvcmException 739 */ 740 public CcFile getParent() throws WvcmException; 741 742 /** 743 * <p>If this file is actually a symbolic link, the path to its target file 744 * or directory. The path is interpreted relative to this file's parent 745 * directory.</p> 746 * 747 * <p>If this file is not a symbolic link, this value will be 748 * <code>null</code>.</p> 749 */ 750 PropertyName<String> SYMLINK_TARGET_PATH = 751 new PropertyName<String>(PROPERTY_NAMESPACE, "symlink-target-path"); 752 753 /** 754 * Get the value of this resource's {@link #SYMLINK_TARGET_PATH} property. 755 * @return path to symlink's target file or directory, or <code>null</code> 756 * if this file is not a symbolic link. 757 * @throws WvcmException if property was not requested 758 */ 759 public String getSymlinkTargetPath() throws WvcmException; 760 761 /** 762 * The view-relative path for this resource. 763 */ 764 PropertyName<String> VIEW_RELATIVE_PATH = 765 new PropertyName<String>(PROPERTY_NAMESPACE, "cr-view-relative-path"); 766 767 /** 768 * Get the value of this resource's {@link #VIEW_RELATIVE_PATH} property. 769 * @return view-relative path 770 * @throws WvcmException if property was not requested 771 */ 772 public String getViewRelativePath() throws WvcmException; 773 774 /** 775 * The CC version resource associated with this file. 776 * The value of this property will be null if this is not a version- 777 * controlled resource. 778 * @see javax.wvcm.ControllableResource#CHECKED_IN and 779 * javax.wvcm.ControllableResource#CHECKED_OUT 780 */ 781 PropertyName<CcVersion> VERSION = 782 new PropertyName<CcVersion>(PROPERTY_NAMESPACE, "version"); 783 784 /** 785 * Get the value of this resource's {@link #VERSION} property. 786 * @return this file's version, or <code>null</code> if this file is 787 * not version controlled 788 * @throws WvcmException if property was not requested 789 */ 790 public CcVersion getVersion() throws WvcmException; 791 792 /** 793 * The OID of the CC version resource associated with this file. 794 * The value of this property will be null if this is not a version- 795 * controlled resource. 796 */ 797 PropertyName<String> VERSION_OID = 798 new PropertyName<String>(PROPERTY_NAMESPACE, "version-oid"); 799 800 /** 801 * Get the value of this resource's {@link #VERSION_OID} property. 802 * @return this file's version oid, or <code>null</code> if this file is 803 * not version controlled 804 * @throws WvcmException if property was not requested 805 */ 806 public String getVersionOid() throws WvcmException; 807 808 /** 809 * The tag of the VOB in which this file resides. 810 */ 811 PropertyName<CcVobTag> VOB_TAG = 812 new PropertyName<CcVobTag>(PROPERTY_NAMESPACE, "file-vob-tag"); 813 814 /** 815 * Get the value of this resource's {@link #VOB_TAG} property. 816 * @return the VOB tag for this file's VOB as a CcVobTag proxy, 817 * or <code>null</code> if this file is not version controlled 818 * @throws WvcmException if property was not requested 819 */ 820 public CcVobTag getVobTag() throws WvcmException; 821 822 /** 823 * The CC element resource associated with this file. 824 * The value of this property will be null if this is not a version- 825 * controlled resource. 826 * @see javax.wvcm.ControllableResource#VERSION_HISTORY 827 */ 828 PropertyName<CcElement> ELEMENT = 829 new PropertyName<CcElement>(PROPERTY_NAMESPACE, "element"); 830 831 /** 832 * Get the value of this resource's {@link #ELEMENT} property. 833 * @return this file's element, or <code>null</code> if this file is 834 * not version controlled 835 * @throws WvcmException if property was not requested 836 */ 837 public CcElement getElement() throws WvcmException; 838 839 /** 840 * Returns a {@link java.io.File File} representing the location of this 841 * client-side resource in the local file system, else <code>null</code> if 842 * this resource is a server-side resource only, e.g., if it is a proxy 843 * to an unloaded file in a web view. 844 * @return The location of this resource in the local file system, else 845 * <code>null</code> if this is a proxy to a server-side resource only. 846 * 847 * @throws WvcmException Thrown if there was an error in determining the 848 * path for this client-side Resource. 849 */ 850 File clientResourceFile() throws WvcmException; 851 852 /** 853 * Reads the file's properties, if they are available locally on the client machine. 854 * @param feedback the properties to be available in the returned proxy, 855 * and any other feedback desired, such as progress indications. 856 * @return a {@link CcFile} containing the wanted properties 857 * that are available locally on the client machine 858 * without communicating with the server. 859 * @see Resource#doReadProperties(Feedback) doReadProperties. 860 * @throws WvcmException ReasonCode: 861 * <br> {@link javax.wvcm.WvcmException.ReasonCode#NOT_FOUND}: 862 * The file MUST be available locally on the client machine. 863 */ 864 CcFile readProperties(Feedback feedback) throws WvcmException; 865 866 /** 867 * Reads the file's content, if it is available locally on the client machine. 868 * @see Resource#doReadContent(OutputStream,Feedback) doReadContent 869 * @param feedback the properties to be available in the returned proxy, 870 * and any other feedback desired, such as progress indications. 871 * @param content the file's content, if available, is written to this 872 * byte stream. The stream is then closed. 873 * @return a CcFile proxy containing the wanted properties 874 * that are available on the client host without communicating with the server. 875 * @throws WvcmException ReasonCode: 876 * <br> {@link javax.wvcm.WvcmException.ReasonCode#NOT_FOUND}: 877 * The file MUST be available locally on the client machine. 878 */ 879 CcFile readContent(OutputStream content, Feedback feedback) throws WvcmException; 880 881 /** 882 * Resolve this file resource, but do not consult the ClearCase server. 883 * Unlike {@link CcResource#doResolve()}, use only information currently 884 * available information on the local client machine. 885 * @see CcResource#doResolve() 886 * @return a new file proxy of the correct, most specific resource type 887 * @throws WvcmException with NOT_FOUND reason code if this file does not 888 * exist on the local machine. 889 */ 890 CcFile resolve() throws WvcmException; 891 892 /** 893 * Whether this file is loaded, partially loaded, or not loaded in the 894 * web view file area in which it resides. 895 */ 896 PropertyName<LoadState> LOAD_STATE = 897 new PropertyName<LoadState>(PROPERTY_NAMESPACE, "load-state"); 898 899 /** 900 * Get the value of this resource's {@link #LOAD_STATE} property. 901 * @return LoadState.LOADED, LoadState.PARTIALLY_LOADED or LoadState.NOT_LOADED 902 * @throws WvcmException 903 * if this proxy doesn't define a value for this property. 904 */ 905 LoadState getLoadState() throws WvcmException; 906 907 /** 908 * <p>Version controlled files and directories in a web view 909 * may have both client state - 910 * state maintained in a local file area - and server state. When the 911 * client state and server state get out of sync, we call this <i>skew</i>. 912 * </p> 913 * <p>By definition, skew cannot occur in a dynamic view. 914 * </p> 915 * <p>The caller can detect skew by including the {@link #SKEWED_PROPERTY_LIST} 916 * property in property requests to <code>doReadProperties()</code> and 917 * other <code>do</code> methods that accept property requests. 918 * 919 * The resulting value of this property is the list of property names 920 * in the request that differed between the client and the server for this 921 * particular file or directory. 922 * </p> 923 * <p>Note that only certain properties are checked for skew - properties 924 * where skew can cause significant problems. For example, 925 * {@link #IS_CHECKED_OUT}, {@link #IS_VERSION_CONTROLLED}, and 926 * {@link #VERSION_OID}. 927 * 928 * Note that skew can also be caused by elementness skew (file vs dir) and 929 * loadness skew (loaded vs unloaded). 930 * </p> 931 * <p>Note also that <i>only</i> properties in the current property request 932 * are checked for skew. 933 * </p> 934 * <p>NOTE: This should be used only as a trigger to do a real discordance 935 * scan of the directory. These values are not reliable enough to use for 936 * icon decoration or user messages. This is a quick and easy way to 937 * automatically detect skew, but it does not cover all edge cases 938 * (symlinks, aliases, and others) or discordance types. 939 * </p> 940 */ 941 PropertyName<List<PropertyName>> SKEWED_PROPERTY_LIST = 942 new PropertyName<List<PropertyName>>(PROPERTY_NAMESPACE, "skewed-property-list"); 943 944 /** 945 * Get the value of this file's {@link #SKEWED_PROPERTY_LIST} property. 946 * 947 * NOTE: This should be used only as a trigger to do a real discordance 948 * scan of the directory. These values are not reliable enough to use for 949 * icon decoration or user messages. This is a quick and easy way to 950 * automatically detect skew, but it does not cover all edge cases 951 * (symlinks, aliases, and others) or discordance types. 952 * 953 * @return a list of property names in the current property request whose 954 * values differed between the client and the server for this file 955 * or directory. 956 * @throws WvcmException 957 * if this proxy doesn't define a value for this property. 958 */ 959 List<PropertyName> getSkewedPropertyList() throws WvcmException; 960 961 /** 962 * The config spec rule that selects this file. 963 */ 964 PropertyName<String> SELECTION_RULE = 965 new PropertyName<String>(PROPERTY_NAMESPACE, "selection-rule"); 966 967 /** 968 * Get the value of this resource's {@link #SELECTION_RULE} property. 969 * @return this file's config spec rule, as a string. 970 * @throws WvcmException 971 * if this proxy doesn't define a value for this property. 972 */ 973 String getSelectionRule() throws WvcmException; 974 975 /** 976 * The version of this file that is currently the latest on the same branch. 977 */ 978 PropertyName<CcVersion> LATEST_VERSION_ON_BRANCH = 979 new PropertyName<CcVersion>(PROPERTY_NAMESPACE, "latest-version-on-branch"); 980 981 /** 982 * Get the value of this resource's {@link #LATEST_VERSION_ON_BRANCH} property. 983 * @return the version of this file that is the latest on the same branch as the 984 * version in the view. 985 * @throws WvcmException 986 * if this proxy doesn't define a value for this property. 987 */ 988 CcVersion getLatestVersionOnBranch() throws WvcmException; 989 }