1 19 package org.openharmonise.vfs; 20 21 import java.util.*; 22 23 import org.openharmonise.vfs.event.*; 24 import org.openharmonise.vfs.metadata.*; 25 import org.openharmonise.vfs.status.*; 26 27 28 35 public class VirtualFile { 36 37 40 protected AbstractVirtualFileSystem m_vfs = null; 41 42 45 private ArrayList m_children = new ArrayList(5); 46 47 50 private HashMap m_properties = new HashMap(5); 51 52 55 private String m_sFilePath; 56 57 60 private String m_sFileName; 61 62 65 private String m_sFullPath; 66 67 70 private String m_sLockOwner = null; 71 72 75 private String m_sLockToken = null; 76 77 80 private boolean m_bContentPopulated = false; 81 82 85 private boolean m_bChildrenPopulated = false; 86 87 90 private boolean m_bMetadataPopulated = false; 91 92 95 private boolean m_bContentChanged = false; 96 97 100 private boolean m_bMetadataChanged = false; 101 102 105 private boolean m_bIsDirectory = false; 106 107 110 private byte[] m_content = null; 111 112 115 private ArrayList m_listeners = new ArrayList(); 116 117 120 public static String STATE_PENDING = "PENDING"; 121 122 125 public static String STATE_LIVE = "LIVE"; 126 127 130 public static String STATE_HISTORICAL = "HISTORICAL"; 131 132 135 private String m_sState = VirtualFile.STATE_LIVE; 136 137 140 private boolean m_bVersionable = false; 141 142 145 private boolean m_bOrderableDirectory = false; 146 147 150 private ArrayList m_allowedMethods = new ArrayList(); 151 152 155 private Date m_dtAllowedMethodsTimeStamp = null; 156 157 160 public static String METHOD_SYNC = "SYNC"; 161 162 165 public static String METHOD_DELETE = "DELETE"; 166 167 170 public static String METHOD_MOVE = "MOVE"; 171 172 175 public static String METHOD_COPY = "COPY"; 176 177 180 public static String METHOD_MKDIR = "MKDIR"; 181 182 185 public static String METHOD_LOCK = "LOCK"; 186 187 190 public static String METHOD_UNLOCK = "UNLOCK"; 191 192 195 public static String METHOD_SHORTCUT = "SHORTCUT"; 196 197 200 public static String METHOD_SET_CHILD_ORDER = "SET_CHILD_ORDER"; 201 202 205 public static String METHOD_CHECKIN = "CHECKIN"; 206 207 210 public static String METHOD_TAG = "TAG"; 211 212 215 public static String METHOD_ORDER = "ORDER"; 216 217 220 public static String METHOD_REJECT = "REJECT"; 221 222 225 public static String METHOD_CHECKOUT = "CHECKOUT"; 226 227 230 public static String METHOD_RENAME = "RENAME"; 231 232 235 public static String METHOD_ADD = "ADD"; 236 237 240 public static String METHOD_GET = "GET"; 241 242 245 public static String METHOD_SEARCH = "SEARCH"; 246 247 public static int EVENT_NOTHING = 0; 248 249 public static int EVENT_ADDITION = 1; 250 251 public static int EVENT_REMOVAL = 2; 252 253 256 private boolean m_bPopulateLocked = false; 257 258 private boolean m_bIsVirtualDirectory = false; 259 260 265 public VirtualFile(String sFullPath) { 266 super(); 267 this.setFullPath(sFullPath); 268 } 269 270 273 public VirtualFile() { 274 super(); 275 } 276 277 283 protected void discardChanges() { 284 if(this.isChanged()) { 285 this.clearFile(); 286 } 287 } 288 289 294 public void clearFile() { 295 m_bContentPopulated = false; 296 m_bChildrenPopulated = false; 297 m_bMetadataPopulated = false; 298 this.m_children.clear(); 299 this.m_content = null; 300 this.m_properties.clear(); 301 this.m_bContentChanged=false; 302 this.m_bMetadataChanged=false; 303 this.fireVirtualFileEvent(VirtualFileEvent.FILE_CHANGES_DISCARDED); 304 } 305 306 311 public boolean isPopulateLocked() { 312 return this.m_bPopulateLocked; 313 } 314 315 320 public void setPopulateLocked(boolean bPopulateLocked) { 321 this.m_bPopulateLocked = bPopulateLocked; 322 } 323 324 329 public void setFullPath(String sFullPath) { 330 String sFilePath = null; 331 String sFileName = null; 332 if( sFullPath.endsWith( "/" ) ) { 333 String sTemp = sFullPath; 334 sTemp = sTemp.substring(0, sTemp.length()-1); 335 sFilePath = sTemp.substring(0, sTemp.lastIndexOf( "/".charAt(0) )); 336 sFileName = sTemp.substring( sTemp.lastIndexOf( "/".charAt(0)) ); 337 } else { 338 String sTemp = sFullPath; 339 sFilePath = sTemp.substring(0, sTemp.lastIndexOf( "/".charAt(0) )); 340 sFileName = sTemp.substring( sTemp.lastIndexOf( "/".charAt(0)) ); 341 } 342 this.m_sFilePath = sFilePath; 343 if( sFullPath.endsWith("/")) { 344 sFullPath = sFullPath.substring(0, sFullPath.length()-1); 345 } 346 this.m_sFullPath = sFullPath; 347 if( sFileName.endsWith("/")) { 348 sFileName = sFileName.substring(0, sFileName.length()-1); 349 } 350 if( sFileName.startsWith("/") ) { 351 sFileName = sFileName.substring(1, sFileName.length()); 352 } 353 this.m_sFileName = sFileName; 354 } 355 356 361 public void addChild(String sURI) { 362 this.m_children.add(sURI); 363 } 365 366 371 public void removeChild(String sURI) { 372 this.m_children.remove(sURI); 373 } 374 375 381 public boolean hasChild(String sURI) { 382 return this.m_children.contains(sURI); 383 } 384 385 390 public List getChildren() { 391 if( this.isDirectory() && !this.m_bChildrenPopulated) { 392 this.m_vfs.fullyPopulateFileChildren(this); 393 } 394 return (List)this.m_children.clone(); 395 } 396 397 406 public StatusData setChildrenOrder(List children) { 407 VFSStatus retnStatus = new VFSStatus(); 408 retnStatus.setMethodName(METHOD_ORDER); 409 410 if(this.isDirectory() && this.isOrderableDirectory() && this.m_children.containsAll(children) && children.containsAll(this.m_children)) { 411 this.m_children = (ArrayList) children; 412 StatusData vfsStatus = this.m_vfs.orderVirtualFileChildren(children, this); 413 retnStatus.addStatusData(vfsStatus); 414 this.m_children.clear(); 415 this.m_bChildrenPopulated = false; 416 this.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 417 } 418 419 return retnStatus; 420 } 421 422 428 public void addProperty(PropertyInstance prop) { 429 this.m_properties.put( prop.getNamespaceURI() + "#" + prop.getName(), prop ); 430 prop.setVirtualFile(this); 431 } 432 433 437 protected void clearAllProperties() { 438 this.m_properties.clear(); 439 } 440 441 448 public void removeProperty(String sNamespaceURI, String sName) { 449 this.m_properties.remove(sNamespaceURI + "#" + sName); 450 } 451 452 460 public PropertyInstance getProperty(String sNamespaceURI, String sName) { 461 PropertyInstance prop = (PropertyInstance)this.m_properties.get(sNamespaceURI + "#" + sName); 462 463 if( !this.isMetadataPopulated() && prop==null && this.m_vfs!=null ) { 464 this.m_vfs.fullyPopulateFileMetadata(this); 465 prop = (PropertyInstance)this.m_properties.get(sNamespaceURI + "#" + sName); 466 } 467 468 return prop; 469 } 470 471 477 public List getProperties() { 478 if(!this.m_bMetadataPopulated) { 479 this.m_vfs.fullyPopulateFileMetadata(this); 480 } 481 return new ArrayList(this.m_properties.values()); 482 } 483 484 489 public void setVFS(AbstractVirtualFileSystem vfs) { 490 this.m_vfs = vfs; 491 } 492 493 499 public AbstractVirtualFileSystem getVFS() { 500 return this.m_vfs; 501 } 502 503 508 public boolean hasVirtualFileListeners() { 509 return this.m_listeners.size()>0; 510 } 511 512 518 public boolean isChanged() { 519 return this.m_bContentChanged || this.m_bMetadataChanged; 520 } 521 522 528 public boolean isContentChanged() { 529 return this.m_bContentChanged; 530 } 531 532 538 public boolean isMetadataChanged() { 539 return this.m_bMetadataChanged; 540 } 541 542 547 public boolean isFullyPopulated() { 548 return this.m_bChildrenPopulated && this.m_bContentPopulated && this.m_bMetadataPopulated; 549 } 550 551 557 protected boolean isChildrenPopulated() { 558 return this.m_bChildrenPopulated; 559 } 560 561 567 protected void setChildrenPopulated(boolean bChildrenPopulated) { 568 this.m_bChildrenPopulated = bChildrenPopulated; 569 } 570 571 576 protected boolean isContentPopulated() { 577 return this.m_bContentPopulated; 578 } 579 580 585 protected void setContentPopulated(boolean bContentPopulated) { 586 this.m_bContentPopulated = bContentPopulated; 587 } 588 589 594 protected boolean isMetadataPopulated() { 595 return this.m_bMetadataPopulated; 596 } 597 598 603 protected void setMetadataPopulated(boolean bMetadataPopulated) { 604 this.m_bMetadataPopulated = bMetadataPopulated; 605 } 606 607 612 public String getFullPath() { 613 return this.m_sFullPath; 614 } 615 616 623 public StatusData copy(String sNewPath, String sNewFilename) { 624 VFSStatus retnStatus = new VFSStatus(); 625 retnStatus.setMethodName(METHOD_COPY); 626 627 String sOldPath = this.getFullPath(); 628 VirtualFile vfOldParent = this.m_vfs.getVirtualFile(this.getFilePath()).getResource(); 629 VirtualFile vfNewParent = this.m_vfs.getVirtualFile(sNewPath).getResource(); 630 StatusData vfsStatus = this.m_vfs.copyVirtualFile(this.getFullPath(), sNewPath + "/" + sNewFilename); 631 retnStatus.addStatusData(vfsStatus); 632 if(retnStatus.isOK()) { 633 String sNewFilePath = sNewPath + "/" + this.getFileName(); 634 this.fireVirtualFileEvent(VirtualFileEvent.FILE_COPIED); 635 if(!sNewPath.equals(this.getFilePath())) { 636 vfOldParent.removeChild(sOldPath); 637 vfOldParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 638 } 639 vfNewParent.addChild(sNewFilePath); 640 vfNewParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 641 } 642 643 return retnStatus; 644 } 645 646 653 public StatusData copy(String sNewPath) { 654 VFSStatus retnStatus = new VFSStatus(); 655 retnStatus.setMethodName(METHOD_COPY); 656 657 String sOldPath = this.getFullPath(); 658 VirtualFile vfOldParent = this.m_vfs.getVirtualFile(this.getFilePath()).getResource(); 659 VirtualFile vfNewParent = this.m_vfs.getVirtualFile(sNewPath).getResource(); 660 StatusData vfsStatus = this.m_vfs.copyVirtualFile(this.getFullPath(), sNewPath + "/" + this.getFileName()); 661 retnStatus.addStatusData(vfsStatus); 662 if(retnStatus.isOK()) { 663 sNewPath = sNewPath + "/" + this.getFileName(); 664 vfOldParent.removeChild(sOldPath); 665 vfNewParent.addChild(sNewPath); 666 this.fireVirtualFileEvent(VirtualFileEvent.FILE_COPIED); 667 vfOldParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 668 vfNewParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 669 } 670 671 return retnStatus; 672 } 673 674 681 public StatusData move(String sNewPath, String sNewFilename) { 682 VFSStatus retnStatus = new VFSStatus(); 683 retnStatus.setMethodName(METHOD_MOVE); 684 685 String sOldPath = this.getFullPath(); 686 VirtualFile vfOldParent = this.m_vfs.getVirtualFile(this.getFilePath()).getResource(); 687 VirtualFile vfNewParent = this.m_vfs.getVirtualFile(sNewPath).getResource(); 688 StatusData vfsStatus = this.m_vfs.moveVirtualFile(this.getFullPath(), sNewPath + "/" + sNewFilename); 689 retnStatus.addStatusData(vfsStatus); 690 if(retnStatus.isOK()) { 691 sNewPath = sNewPath + "/" + sNewFilename; 692 vfOldParent.removeChild(sOldPath); 693 vfNewParent.addChild(sNewPath); 694 this.fireVirtualFileEvent(VirtualFileEvent.FILE_MOVED); 695 vfOldParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 696 vfNewParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 697 } 698 699 return retnStatus; 700 } 701 702 708 public StatusData rename(String sNewFilename) { 709 VFSStatus retnStatus = new VFSStatus(); 710 retnStatus.setMethodName(METHOD_RENAME); 711 712 String sOldPath = this.getFullPath(); 713 StatusData vfsStatus = this.m_vfs.moveVirtualFile(this.getFullPath(), this.m_sFilePath + "/" + sNewFilename); 714 retnStatus.addStatusData(vfsStatus); 715 if(retnStatus.isOK()) { 716 String sNewPath = this.getFilePath() + "/" + sNewFilename; 717 VirtualFile vfParent = this.m_vfs.getVirtualFile(this.getFilePath()).getResource(); 718 vfParent.removeChild(sOldPath); 719 vfParent.addChild(sNewPath); 720 this.fireVirtualFileEvent(VirtualFileEvent.FILE_RENAMED); 721 vfParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 722 } 723 724 return retnStatus; 725 } 726 727 733 public StatusData move(String sNewPath) { 734 VFSStatus retnStatus = new VFSStatus(); 735 retnStatus.setMethodName(METHOD_MOVE); 736 737 String sOldPath = this.getFullPath(); 738 VirtualFile vfOldParent = this.m_vfs.getVirtualFile(this.getFilePath()).getResource(); 739 VirtualFile vfNewParent = this.m_vfs.getVirtualFile(sNewPath).getResource(); 740 StatusData vfsStatus = this.m_vfs.moveVirtualFile(this.getFullPath(), sNewPath + "/" + this.getFileName()); 741 retnStatus.addStatusData(vfsStatus); 742 if(retnStatus.isOK()) { 743 sNewPath = sNewPath + "/" + this.getFileName(); 744 vfOldParent.removeChild(sOldPath); 745 vfNewParent.addChild(sNewPath); 746 this.fireVirtualFileEvent(VirtualFileEvent.FILE_MOVED); 747 vfOldParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 748 vfNewParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 749 } 750 751 return retnStatus; 752 } 753 754 758 public StatusData delete() { 759 VFSStatus retnStatus = new VFSStatus(); 760 retnStatus.setMethodName(METHOD_DELETE); 761 762 VirtualFile vfParent = this.m_vfs.getVirtualFile( this.m_sFilePath).getResource(); 763 StatusData vfsStatus = this.m_vfs.deleteVirtualFile(this.getFullPath()); 764 retnStatus.addStatusData(vfsStatus); 765 if(retnStatus.isOK()) { 766 this.fireVirtualFileEvent(VirtualFileEvent.FILE_DELETED); 767 if(vfParent!=null && !((this instanceof VersionedVirtualFile) && ((VersionedVirtualFile)this).getLiveVersionPath()!=null)) { 768 vfParent.removeChild(this.getFullPath()); 769 vfParent.refreshChildren(); 770 vfParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 771 } 772 } 773 774 return retnStatus; 775 } 776 777 781 public StatusData lock() { 782 VFSStatus retnStatus = new VFSStatus(); 783 retnStatus.setMethodName(METHOD_LOCK); 784 785 StatusData vfsStatus = this.m_vfs.lockVirtualFile(this.getFullPath()); 786 retnStatus.addStatusData(vfsStatus); 787 if(retnStatus.isOK()) { 788 this.fireVirtualFileEvent(VirtualFileEvent.FILE_LOCKED); 789 } 790 791 return retnStatus; 792 } 793 794 798 public StatusData unlock() { 799 VFSStatus retnStatus = new VFSStatus(); 800 retnStatus.setMethodName(METHOD_UNLOCK); 801 802 StatusData vfsStatus = this.m_vfs.unlockVirtualFile(this.getFullPath()); 803 retnStatus.addStatusData(vfsStatus); 804 if(retnStatus.isOK()) { 805 this.fireVirtualFileEvent(VirtualFileEvent.FILE_UNLOCKED); 806 } 807 808 return retnStatus; 809 } 810 811 818 public StatusData mkDir(String sDirname) { 819 VFSStatus retnStatus = new VFSStatus(); 820 retnStatus.setMethodName(METHOD_MKDIR); 821 822 StatusData vfsStatus = this.m_vfs.createVirtualDirectory( this.getFullPath() + "/" + sDirname); 823 retnStatus.addStatusData(vfsStatus); 824 if(retnStatus.isOK()) { 825 this.refreshChildren(); 826 this.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 827 } 828 829 return retnStatus; 830 } 831 832 840 public StatusData createShortcut(String sShortcutName, String sFromFullPath) { 841 VFSStatus retnStatus = new VFSStatus(); 842 retnStatus.setMethodName(METHOD_SHORTCUT); 843 844 StatusData vfsStatus = this.m_vfs.createShortcut(sFromFullPath, this.getFullPath() + "/" + sShortcutName); 845 retnStatus.addStatusData(vfsStatus); 846 if(retnStatus.isOK()) { 847 this.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 848 } 849 850 return retnStatus; 851 } 852 853 858 public String getLockOwner() { 859 return this.m_sLockOwner; 860 } 861 862 869 public void setLockOwner(String sLockOwner) { 870 this.m_sLockOwner = sLockOwner; 871 } 872 873 878 public String getLockToken() { 879 return this.m_sLockToken; 880 } 881 882 887 public void setLockToken(String sLockToken) { 888 this.m_sLockToken = sLockToken; 889 } 890 891 896 public boolean isLocked() { 897 return (this.m_sLockOwner!=null || this.m_sLockToken!=null); 898 } 899 900 905 public boolean isDirectory() { 906 return this.m_bIsDirectory; 907 } 908 909 914 public void setIsDirectory(boolean bIsDirectory) { 915 this.m_bIsDirectory = bIsDirectory; 916 } 917 918 923 public byte[] getContent() { 924 byte[] dataRetn = null; 925 926 if( !this.m_bContentChanged && !this.isContentPopulated() ) { 927 this.m_content = this.m_vfs.getVirtualFileContent(this.getFullPath()); 928 } 929 930 dataRetn = this.m_content; 931 932 return dataRetn; 933 } 934 935 940 public void setContent(byte[] bs) { 941 this.m_bContentChanged=true; 942 m_content = bs; 943 if(bs!=null) { 944 this.fireVirtualFileEvent(VirtualFileEvent.FILE_CONTENT_CHANGED); 945 } 946 } 947 948 953 public String getFileName() { 954 return m_sFileName; 955 } 956 957 962 public void setFileName(String string) { 963 m_sFileName = string; 964 } 965 966 971 public String getFilePath() { 972 return m_sFilePath; 973 } 974 975 980 public void setFilePath(String string) { 981 m_sFilePath = string; 982 } 983 984 990 public boolean exists() { 991 return this.m_vfs.exists(this.m_sFullPath); 992 } 993 994 999 public void addVirtualFileListener(VirtualFileListener listener) { 1000 if(!this.m_listeners.contains(listener)) { 1001 this.m_listeners.add(listener); 1002 } 1003 } 1004 1005 1010 public void removeVirtualFileListener(VirtualFileListener listener) { 1011 this.m_listeners.remove(listener); 1012 } 1013 1014 1019 public void fireVirtualFileEvent(String sEventType) { 1020 this.fireVirtualFileEvent(sEventType, EVENT_NOTHING, null); 1021 } 1022 1023 1028 public void fireVirtualFileEvent(String sEventType, int nEventAction, String sPath) { 1029 1030 if(sEventType.equals(VirtualFileEvent.FILE_METADATA_CHANGED)) { 1031 this.m_bMetadataChanged=true; 1032 } else if(sEventType.equals(VirtualFileEvent.FILE_CONTENT_CHANGED)) { 1033 this.m_bContentChanged=true; 1034 } 1035 1036 VirtualFileEvent vfe = new VirtualFileEvent(this.m_sFullPath, this.m_vfs, sEventType); 1037 if(nEventAction>0) { 1038 vfe.setSubType(nEventAction); 1039 vfe.setChildPath(sPath); 1040 } 1041 1042 Iterator itor = ((ArrayList)this.m_listeners.clone()).iterator(); 1043 while(itor.hasNext()) { 1044 VirtualFileListener listener = ((VirtualFileListener)itor.next()); 1045 listener.virtualFileChanged(vfe); 1046 } 1047 1048 if(!this.isLocked() && (sEventType.equals(VirtualFileEvent.FILE_METADATA_CHANGED) 1049 || sEventType.equals(VirtualFileEvent.FILE_CONTENT_CHANGED))) { 1050 if(this.m_vfs!=null) { 1051 this.lock(); 1052 } 1053 } 1054 } 1055 1056 1060 public void refreshChildren() { 1061 this.m_vfs.refreshChildren(this); 1062 this.m_bChildrenPopulated=false; 1063 this.m_children.clear(); 1064 this.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 1065 } 1066 1067 1071 public void refreshChildren(int nAction, String sChildPath) { 1072 this.m_vfs.refreshChildren(this); 1073 this.m_bChildrenPopulated=false; 1074 this.m_children.clear(); 1075 this.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED, nAction, sChildPath); 1076 } 1077 1078 1086 public boolean canLock() { 1087 return false; 1089 } 1090 1091 1099 public boolean canUnlock() { 1100 return false; 1102 } 1103 1104 1111 public List getAllowedMethods() { 1112 Date dt = new Date(); 1113 if(this.m_dtAllowedMethodsTimeStamp==null || dt.getTime()-this.m_dtAllowedMethodsTimeStamp.getTime()>60000*5) { 1114 this.m_allowedMethods.clear(); 1115 this.m_vfs.fullyPopulateFileAllowedMethods(this); 1116 this.m_dtAllowedMethodsTimeStamp = dt; 1117 } 1118 return (List) this.m_allowedMethods.clone(); 1119 } 1120 1121 1126 protected void addAllowedMethods(String sMethod) { 1127 if(!this.m_allowedMethods.contains(sMethod)) { 1128 this.m_allowedMethods.add(sMethod); 1129 } 1130 } 1131 1132 1136 protected void clearAllowedMethods() { 1137 this.m_allowedMethods = new ArrayList(); 1138 } 1139 1140 1145 public boolean isVersionable() { 1146 return this.m_bVersionable; 1147 } 1148 1149 1154 protected void setVersionable(boolean bVersionable) { 1155 this.m_bVersionable = bVersionable; 1156 } 1157 1158 1163 protected void setState(String sState) { 1164 this.m_sState = sState; 1165 } 1166 1167 1172 public String getState() { 1173 return this.m_sState; 1174 } 1175 1176 1182 public StatusData sync() { 1183 VFSStatus retnStatus = new VFSStatus(); 1184 retnStatus.setMethodName(METHOD_SYNC); 1185 1186 StatusData vfsStatus = this.m_vfs.synchroniseFile(this); 1187 retnStatus.addStatusData(vfsStatus); 1188 1189 VirtualFile vfParent = null; 1190 if(this.getState().equals(VirtualFile.STATE_PENDING) && ((VersionedVirtualFile)this).getLiveVersionPath()!=null) { 1191 VirtualFile vfLiveFile = this.m_vfs.getVirtualFile(((VersionedVirtualFile)this).getLiveVersionPath()).getResource(); 1192 vfParent = this.m_vfs.getVirtualFile(vfLiveFile.getFilePath()).getResource(); 1193 } else { 1194 vfParent = this.m_vfs.getVirtualFile(this.getFilePath()).getResource(); 1195 } 1196 if(retnStatus.isOK()) { 1197 this.m_bContentChanged = false; 1198 this.m_bMetadataChanged = false; 1199 this.fireVirtualFileEvent(VirtualFileEvent.FILE_SYNCHED); 1200 } 1201 vfParent.fireVirtualFileEvent(VirtualFileEvent.FILE_MEMBERS_CHANGED); 1202 return retnStatus; 1203 } 1204 1205 1211 public boolean isOrderableDirectory() { 1212 return m_bOrderableDirectory; 1213 } 1214 1215 1220 protected void setOrderableDirectory(boolean b) { 1221 m_bOrderableDirectory = b; 1222 } 1223 1224 1228 protected void clearChildren() { 1229 this.m_bChildrenPopulated=false; 1230 this.m_children.clear(); 1231 } 1232 1233 1236 public void setIsVirtualDirectory(boolean bIsVirtual) { 1237 this.m_bIsVirtualDirectory = bIsVirtual; 1238 } 1239 1240 public boolean isVirtualDirectory() { 1241 return this.m_bIsVirtualDirectory; 1242 } 1243 1244} 1245 | Popular Tags |