Index: objectintegrity/VcsObjectIntegritySupport.java =================================================================== RCS file: /cvs/vcscore/src/org/netbeans/modules/vcscore/objectintegrity/VcsObjectIntegritySupport.java,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** objectintegrity/VcsObjectIntegritySupport.java 8 Apr 2003 16:23:42 -0000 1.9 --- objectintegrity/VcsObjectIntegritySupport.java 10 Apr 2003 15:26:12 -0000 1.10 *************** *** 23,28 **** --- 23,29 ---- import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; + import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.HashSet; *************** *** 49,54 **** --- 50,56 ---- import org.openide.util.RequestProcessor; import org.openide.util.WeakListener; + import org.netbeans.modules.vcscore.FileObjectExistence; import org.netbeans.modules.vcscore.FileObjectImportantness; import org.netbeans.modules.vcscore.VcsAttributes; import org.netbeans.modules.vcscore.cache.CacheDir; *************** *** 87,94 **** --- 89,100 ---- private transient FileSystem fileSystem; private transient FileSystemCache cache; private transient String fsRootPath; + private transient FileObjectExistence foExistence; private transient FileObjectImportantness foImportantness; + /** The DataObjects which need to be analyzed for objects integrity. */ private transient Set objectsToAnalyze; + /** The paths of FileObjects whose DataObjects need to be analyzed for objects integrity. */ + private transient Set pathsToAnalyze; private transient RequestProcessor.Task analyzerTask; private transient boolean activated = false; *************** *** 131,142 **** --- 137,151 ---- */ public synchronized void activate(FileSystem fileSystem, FileSystemCache cache, String fsRootPath, + FileObjectExistence foExistence, FileObjectImportantness foImportantness) { this.fileSystem = fileSystem; this.cache = cache; this.fsRootPath = fsRootPath; + this.foExistence = foExistence; this.foImportantness = foImportantness; this.objectsToAnalyze = new HashSet(); + this.pathsToAnalyze = new HashSet(); this.analyzerTask = analyzerRequestProcessor.post(this, ANALYZER_SCHEDULE_TIME, Thread.MIN_PRIORITY); //analyzerTask.setPriority(Thread.MIN_PRIORITY); DataLoaderPool pool = (DataLoaderPool) Lookup.getDefault().lookup(DataLoaderPool.class); *************** *** 216,227 **** --- 225,253 ---- * add the file names into the integrity list if necessary. */ public void run() { + Set paths; Set objects; boolean changed = false; synchronized (objectsToAnalyze) { + paths = pathsToAnalyze; objects = objectsToAnalyze; + pathsToAnalyze = new HashSet(); objectsToAnalyze = new HashSet(); } + if (!paths.isEmpty()) { + Enumeration existingEnum = foExistence.getExistingFiles(); + while(existingEnum.hasMoreElements() && !paths.isEmpty()) { + FileObject fo = (FileObject) existingEnum.nextElement(); + if (paths.remove(fo.getPath())) { + try { + DataObject dobj = DataObject.find(fo); + objects.add(dobj); + } catch (DataObjectNotFoundException donfex) { + // Ignored. If the DO does not exist, it can not be analyzed. + } + } + } + } for (Iterator objIt = objects.iterator(); objIt.hasNext(); ) { DataObject dobj = (DataObject) objIt.next(); FileObject primary = dobj.getPrimaryFile(); *************** *** 368,383 **** if (wasLocal) { // It was a local primary file; now it's not local, we need to // analyze the DataObject again. ! FileObject fo = fileSystem.findResource(path); ! if (fo != null) { ! try { ! DataObject dobj = DataObject.find(fo); ! synchronized (objectsToAnalyze) { ! objectsToAnalyze.add(dobj); ! } ! analyzerTask.schedule(ANALYZER_SCHEDULE_TIME); ! } catch (DataObjectNotFoundException donfex) {} } return ; } boolean changed = false; --- 394,403 ---- if (wasLocal) { // It was a local primary file; now it's not local, we need to // analyze the DataObject again. ! synchronized (objectsToAnalyze) { ! pathsToAnalyze.add(path); } + analyzerTask.schedule(ANALYZER_SCHEDULE_TIME); return ; } boolean changed = false; *************** *** 474,489 **** if (primaryLocalFiles.remove(path)) { // It was a local primary file; now it's not local, we need to // analyze the DataObject again. ! FileObject fo = fileSystem.findResource(path); ! if (fo != null) { ! try { ! DataObject dobj = DataObject.find(fo); ! synchronized (objectsToAnalyze) { ! objectsToAnalyze.add(dobj); ! } ! analyzerTask.schedule(ANALYZER_SCHEDULE_TIME); ! } catch (DataObjectNotFoundException donfex) {} } } } } --- 494,503 ---- if (primaryLocalFiles.remove(path)) { // It was a local primary file; now it's not local, we need to // analyze the DataObject again. ! synchronized (objectsToAnalyze) { ! pathsToAnalyze.add(path); } + analyzerTask.schedule(ANALYZER_SCHEDULE_TIME); } } } Index: VcsFileSystem.java =================================================================== RCS file: /cvs/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java,v retrieving revision 1.220 retrieving revision 1.221 diff -c -r1.220 -r1.221 *** VcsFileSystem.java 10 Apr 2003 08:28:06 -0000 1.220 --- VcsFileSystem.java 10 Apr 2003 15:26:41 -0000 1.221 *************** *** 103,109 **** AbstractFileSystem.List, AbstractFileSystem.Info, AbstractFileSystem.Change, FileSystem.Status, CacheHandlerListener, FileObjectImportantness, ! VcsOISActivator, Serializable { public static interface IgnoreListSupport { --- 103,109 ---- AbstractFileSystem.List, AbstractFileSystem.Info, AbstractFileSystem.Change, FileSystem.Status, CacheHandlerListener, FileObjectImportantness, ! FileObjectExistence, VcsOISActivator, Serializable { public static interface IgnoreListSupport { *************** *** 946,956 **** --- 946,968 ---- return r == null ? 0 : r.getRefreshTime (); } + /** + * Returns all existing files in the file system (both folders and data). + * Please note, that the name of this method is misguided. It does not return + * only existing folders, but also existing files. + */ public Enumeration getExistingFolders() { return this.existingFileObjects(getRoot()); } /** + * Returns all existing files in the file system. + */ + public Enumeration getExistingFiles() { + return this.existingFileObjects(getRoot()); + } + + /** * Do the refresh of a folder. */ public void doVirtualsRefresh(FileObject fo) { *************** *** 1539,1545 **** public void activate(VcsObjectIntegritySupport objectIntegritySupport) { FileSystemCache fsCache = CacheHandler.getInstance().getCache(getCacheIdStr()); if (fsCache != null) { ! objectIntegritySupport.activate(this, fsCache, getFile("").getAbsolutePath(), this); } } --- 1551,1557 ---- public void activate(VcsObjectIntegritySupport objectIntegritySupport) { FileSystemCache fsCache = CacheHandler.getInstance().getCache(getCacheIdStr()); if (fsCache != null) { ! objectIntegritySupport.activate(this, fsCache, getFile("").getAbsolutePath(), this, this); } }