[Nodal-cvs] nodal/j-src/storage/framework SBNStreamServices.java,1.4,1.5 StreamBasedNode.java,1.10,1
Status: Pre-Alpha
Brought to you by:
leei
From: Lee I. <le...@us...> - 2004-06-28 19:14:39
|
Update of /cvsroot/nodal/nodal/j-src/storage/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14896/storage/framework Modified Files: SBNStreamServices.java StreamBasedNode.java Log Message: Use JDBM framework for saving/restoring node IDs on file:-based repositories. Index: StreamBasedNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/StreamBasedNode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** StreamBasedNode.java 2 Jun 2004 19:02:05 -0000 1.10 --- StreamBasedNode.java 28 Jun 2004 19:14:28 -0000 1.11 *************** *** 15,18 **** --- 15,19 ---- import java.util.HashMap; import java.util.Iterator; + import java.util.LinkedList; import java.util.List; import java.util.Map; *************** *** 94,97 **** --- 95,103 ---- */ boolean renameNode(Node node, Name nid); + + /** + * @param nidList + */ + void saveNidList(List nidList); } *************** *** 203,206 **** --- 209,214 ---- if (nidList != null) { restoreNIDs(nidList, root); + } else { + saveNIDs (root); } return root.content(); *************** *** 212,215 **** --- 220,236 ---- } + /** + * @param root + */ + private void saveNIDs(Node root) { + List nidList = new LinkedList(); + DFSIterator iter = new DFSIterator(root); + while (iter.hasNext()) { + Node node = iter.nextNode(); + nidList.add(node.id()); + } + services.saveNidList (nidList); + } + private void restoreNIDs(List nidList, Node root) throws IOException { DFSIterator iter = new DFSIterator(root); Index: SBNStreamServices.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/SBNStreamServices.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SBNStreamServices.java 2 Jun 2004 19:02:05 -0000 1.4 --- SBNStreamServices.java 28 Jun 2004 19:14:28 -0000 1.5 *************** *** 84,87 **** --- 84,93 ---- /* (non-Javadoc) + * @see storage.framework.StreamBasedNode.Services#nidList() + */ + public void saveNidList(List list) { + } + + /* (non-Javadoc) * @see storage.framework.StreamBasedNode.Services#renameNode(org.nodal.model.Node, org.nodal.util.Name) */ |