Index: IntegritySupportMaintainer.java =================================================================== RCS file: /cvs/vcscore/src/org/netbeans/modules/vcscore/objectintegrity/IntegritySupportMaintainer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** IntegritySupportMaintainer.java 14 Apr 2003 11:13:45 -0000 1.3 --- IntegritySupportMaintainer.java 7 May 2003 18:28:12 -0000 1.4 *************** *** 17,31 **** import java.beans.PropertyChangeListener; import java.beans.PropertyVetoException; import java.beans.VetoableChangeListener; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; - import org.openide.filesystems.FileObject; import org.openide.filesystems.FileSystem; import org.openide.util.RequestProcessor; import org.openide.util.WeakListener; --- 17,39 ---- import java.beans.PropertyChangeListener; import java.beans.PropertyVetoException; import java.beans.VetoableChangeListener; + import java.io.File; + import java.io.FileInputStream; + import java.io.FileOutputStream; + import java.io.IOException; + import java.io.ObjectInputStream; + import java.io.ObjectOutputStream; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; + import org.openide.ErrorManager; + import org.openide.filesystems.FileObject; import org.openide.filesystems.FileSystem; + import org.openide.filesystems.FileUtil; import org.openide.util.RequestProcessor; import org.openide.util.WeakListener; *************** *** 42,47 **** --- 50,56 ---- Runnable { private static Map VOISMap = new WeakHashMap(); private static final int SAVER_SCHEDULE_TIME = 500; + private static final String DB_FILE_NAME = ".nbintdb"; // NOI18N private FileSystem fileSystem; private VcsOISActivator objectIntegrityActivator; *************** *** 146,155 **** for (Iterator it = toSave.keySet().iterator(); it.hasNext(); ) { FileObject fo = (FileObject) it.next(); VcsObjectIntegritySupport vois = (VcsObjectIntegritySupport) toSave.get(fo); ! try { ! fo.setAttribute(VcsObjectIntegritySupport.ATTRIBUTE_NAME, vois); ! } catch (java.io.IOException ioex) { ! org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ioex); } } } --- 155,186 ---- for (Iterator it = toSave.keySet().iterator(); it.hasNext(); ) { FileObject fo = (FileObject) it.next(); VcsObjectIntegritySupport vois = (VcsObjectIntegritySupport) toSave.get(fo); ! //fo.setAttribute(VcsObjectIntegritySupport.ATTRIBUTE_NAME, vois); ! File folder = FileUtil.toFile(fo); ! if (folder != null) { ! File dbFile = new File(folder, DB_FILE_NAME); ! /* ! if (!dbFile.exists()) { ! dbFile.createNewFile(); ! } ! if (dbFile.canWrite()) { ! */ ! ObjectOutputStream oout = null; ! try { ! oout = new ObjectOutputStream(new FileOutputStream(dbFile)); ! oout.writeObject(vois); ! } catch (java.io.IOException ioex) { ! ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioex); ! } finally { ! if (oout != null) { ! try { ! oout.close(); ! } catch (IOException ioex) { ! ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioex); ! } ! } ! } ! //} } } } *************** *** 163,169 **** } public Object run() { ! return rootFO.getAttribute(VcsObjectIntegritySupport.ATTRIBUTE_NAME); } } --- 194,226 ---- } public Object run() { ! File folder = FileUtil.toFile(rootFO); ! if (folder != null) { ! File dbFile = new File(folder, DB_FILE_NAME); ! if (dbFile.exists() && dbFile.canRead()) { ! ObjectInputStream oin = null; ! Object vois = null; ! try { ! oin = new ObjectInputStream(new FileInputStream(dbFile)); ! vois = oin.readObject(); ! } catch (IOException ioex) { ! ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioex); ! // The vois will remain null ! } catch (ClassNotFoundException cnfex) { ! ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, cnfex); ! // The vois will remain null ! } finally { ! if (oin != null) { ! try { ! oin.close(); ! } catch (IOException ioex) {} ! } ! } ! return vois; ! } ! } ! return null; ! //return rootFO.getAttribute(VcsObjectIntegritySupport.ATTRIBUTE_NAME); } }