/** Removes the entry from the set of secondary entries. * Called from the notifyFileDeleted */ final void removeFile (FileObject fo) { synchronized (getSecondary()) { Entry e = (Entry)getSecondary().get (fo); if (e != null) { removeSecondaryEntry (e); } } }
/** All secondary entries are recognized. Called from multi file object. * @param recognized object to mark recognized file to */ final void markSecondaryEntriesRecognized (DataLoader.RecognizedFiles recognized) { synchronized (getSecondary()) { Iterator it = getSecondary().keySet ().iterator (); while (it.hasNext ()) { FileObject fo=(FileObject)it.next (); recognized.markRecognized (fo); } } }
/** For a given file, find the associated secondary entry. * @param fo file object * @return the entry associated with the file object, or <code>null</code> if there is no * such entry */ public final Entry findSecondaryEntry (FileObject fo) { Entry e; synchronized ( synchObjectSecondary() ) { e = (Entry)getSecondary().get (fo); } return e; }
/** Performs checks by calling checkFiles * @return getSecondary() method result */ private HashMap checkSecondary () { // enumeration of all files if (! checked) { checkFiles (this); checked = true; } return getSecondary(); }
private boolean existReadOnlySecondary() { synchronized ( synchObjectSecondary() ) { Iterator it = getSecondary().keySet().iterator(); while (it.hasNext()) if ( ((FileObject)it.next()).isReadOnly() ) return true; } return false; }
/** Get secondary entries. * @return immutable set of {@link Entry}s */ public final Set secondaryEntries () { synchronized ( synchObjectSecondary() ) { removeAllInvalid (); return new HashSet (getSecondary().values ()); } }
/** Remove a secondary entry from the list. * @param fe the entry to remove */ protected final void removeSecondaryEntry (Entry fe) { synchronized (getSecondary()) { getSecondary().remove (fe.getFile ()); } firePropertyChangeLater (PROP_FILES, null, null); if (fe.isImportant ()) { checkConsistency(this); } }
protected void handleDelete() throws IOException { ArrayList toRemove = new ArrayList(); Iterator it; synchronized ( synchObjectSecondary() ) { it = new ArrayList(getSecondary().entrySet ()).iterator(); } while (it.hasNext ()) { Map.Entry e = (Map.Entry)it.next (); ((Entry)e.getValue ()).delete (); toRemove.add(e.getKey()); } synchronized ( synchObjectSecondary() ) { Object[] objects = toRemove.toArray(); for (int i = 0; i < objects.length; i++) getSecondary().remove(objects[i]); } getPrimaryEntry().delete(); }
synchronized (getSecondary()) { if (fo == null) { Entry e = (Entry)getSecondary().get (fo); if (e != null) { return e;
/** Does the work which was originaly done in MDO.files() method. */ private void doLazyWork() { synchronized (this) { if (!lazyWorkDone) { lazyWorkDone = true; synchronized ( mymdo.synchObjectSecondary() ) { mymdo.removeAllInvalid (); primaryFile = mymdo.getPrimaryFile(); secondary = mymdo.getSecondary(); } } } }
it = new ArrayList(getSecondary().entrySet ()).iterator(); Object[] objects = toRemove.toArray(); for (int i = 0; i < objects.length; i++) getSecondary().remove(objects[i]); getSecondary().putAll (add);
/** Add a new secondary entry to the list. * @param fe the entry to add */ protected final void addSecondaryEntry (Entry fe) { synchronized ( getSecondary() ) { getSecondary().put (fe.getFile (), fe); } // Fire PROP_FILES only if we have actually finished making the folder. // It is dumb to fire this if we do not yet even know what all of our // initial secondary files are going to be. FolderList l = getFolderList(); if (l == null) { firePropertyChangeLater (PROP_FILES, null, null); } else { // l != null if (l.isCreated()) { firePropertyChangeLater (PROP_FILES, null, null); } else { firePropFilesAfterFinishing(); } } }
Iterator it; synchronized ( synchObjectSecondary() ) { it = new ArrayList(getSecondary().entrySet ()).iterator(); Object[] objects = toRemove.toArray(); for (int i = 0; i < objects.length; i++) getSecondary().remove(objects[i]); getSecondary().putAll (add);