[Nodal-cvs] nodal/j-src/storage/file FileRepository.java,1.27,1.28 FileNode.java,1.8,1.9 FileDocumen
Status: Pre-Alpha
Brought to you by:
leei
From: Lee I. <le...@us...> - 2004-11-15 19:22:20
|
Update of /cvsroot/nodal/nodal/j-src/storage/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4642/storage/file Modified Files: FileRepository.java FileNode.java FileDocument.java Log Message: Change name of RepoServices to RepoBackend throughout. o update references and field and method names Index: FileNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileNode.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FileNode.java 15 Sep 2004 20:57:15 -0000 1.8 --- FileNode.java 15 Nov 2004 19:22:00 -0000 1.9 *************** *** 20,24 **** import org.nodal.util.Name; import storage.framework.AbstractNode; ! import storage.framework.RepoServices; import storage.memory.memContent; --- 20,24 ---- import org.nodal.util.Name; import storage.framework.AbstractNode; ! import storage.framework.RepoBackend; import storage.memory.memContent; *************** *** 48,52 **** * @return a new FileNode */ ! static NodeContent.Editor createNode(RepoServices svc, Path docPath, Name id, NodeType type, FileNode fcontext) { return createNode(svc, docPath, id, type, fcontext.fileContext); --- 48,52 ---- * @return a new FileNode */ ! static NodeContent.Editor createNode(RepoBackend svc, Path docPath, Name id, NodeType type, FileNode fcontext) { return createNode(svc, docPath, id, type, fcontext.fileContext); *************** *** 64,68 **** * @return a new FileNode of the given type */ ! static NodeContent.Editor createNode(RepoServices svc, Path docPath, Name id, NodeType t, File fileContext) { memContent c = memContent.create(t); --- 64,68 ---- * @return a new FileNode of the given type */ ! static NodeContent.Editor createNode(RepoBackend svc, Path docPath, Name id, NodeType t, File fileContext) { memContent c = memContent.create(t); *************** *** 81,85 **** * @return a new FileNode with the cloned context */ ! static NodeContent.Editor cloneNode(RepoServices services, Path docPath, Name id, Node node, FileNode fcontext) { memContent c = memContent.ingest(node.content()); --- 81,85 ---- * @return a new FileNode with the cloned context */ ! static NodeContent.Editor cloneNode(RepoBackend services, Path docPath, Name id, Node node, FileNode fcontext) { memContent c = memContent.ingest(node.content()); *************** *** 126,130 **** public NodeContent content() { if (content == null && bareContent != null) { ! content = bareContent.nodeContent(this, fileRepo.services(), null); } return content; --- 126,130 ---- public NodeContent content() { if (content == null && bareContent != null) { ! content = bareContent.nodeContent(this, fileRepo.getBackend(), null); } return content; Index: FileRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileRepository.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** FileRepository.java 15 Sep 2004 20:57:15 -0000 1.27 --- FileRepository.java 15 Nov 2004 19:21:59 -0000 1.28 *************** *** 13,16 **** --- 13,18 ---- import java.net.MalformedURLException; import java.net.URL; + import java.util.Iterator; + import org.nodal.filesystem.Document; import org.nodal.model.AnchorNode; *************** *** 18,26 **** import org.nodal.model.NodeFactory; import org.nodal.model.NodeContent; import org.nodal.nav.Path; import org.nodal.nav.Paths; import org.nodal.type.NodeType; import org.nodal.util.CacheMap; ! import storage.framework.AbstractRepoServices; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; --- 20,29 ---- import org.nodal.model.NodeFactory; import org.nodal.model.NodeContent; + import org.nodal.model.Txn; import org.nodal.nav.Path; import org.nodal.nav.Paths; import org.nodal.type.NodeType; import org.nodal.util.CacheMap; ! import storage.framework.AbstractRepoBackend; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; *************** *** 42,46 **** * @author leei */ ! static class Services extends AbstractRepoServices { private FileRepository frepo; private TxnManager txnManager; --- 45,49 ---- * @author leei */ ! static class Backend extends AbstractRepoBackend { private FileRepository frepo; private TxnManager txnManager; *************** *** 49,58 **** /** ! * A set of basic services for the AbstractRepository. * * @param repo * @param store */ ! protected Services(FileRepository repo, File file /* , Store store */ ) { super(repo, pathFromFile(file), null); --- 52,61 ---- /** ! * A set of basic backend for the AbstractRepository. * * @param repo * @param store */ ! protected Backend(FileRepository repo, File file /* , Store store */ ) { super(repo, pathFromFile(file), null); *************** *** 125,129 **** * (non-Javadoc) * ! * @see storage.framework.RepoServices#txnManager() */ public TxnManager txnManager() { --- 128,132 ---- * (non-Javadoc) * ! * @see storage.framework.RepoBackend#txnManager() */ public TxnManager txnManager() { *************** *** 137,150 **** * (non-Javadoc) * ! * @see storage.framework.RepoServices#commitTxn(storage.memory.TxnResolver) */ ! public void commitTxn(TxnManager.Resolver txn) { //NEXT We need to go through this Txn and write out all affected Docs ! System.err.println("Commit " + txn); } } private File rootFile; ! private CacheMap allServices; private CacheMap idMap; --- 140,163 ---- * (non-Javadoc) * ! * @see storage.framework.RepoBackend#commitTxn(storage.memory.TxnResolver) */ ! public void commitTxn(TxnManager.Resolver resolver) { //NEXT We need to go through this Txn and write out all affected Docs ! System.err.println("Commit " + resolver); ! Txn txn = resolver.txn(); ! Iterator subjIter = txn.subjects().iterator(); ! while (!subjIter.hasNext()) { ! Node subj = (Node) subjIter.next(); ! if (!subj.isAnchor()) { ! // For each Node, find all associated Documents and save them. ! //FileNode fnode = (FileNode) subj; ! ! } ! } } } private File rootFile; ! private CacheMap backends; private CacheMap idMap; *************** *** 160,164 **** String rootName = path.toURLString().substring(5); this.rootFile = new File(rootName); ! // Check that file exists and is a directory. if (!rootFile.exists()) { --- 173,177 ---- String rootName = path.toURLString().substring(5); this.rootFile = new File(rootName); ! // Check that file exists and is a directory. if (!rootFile.exists()) { *************** *** 168,189 **** throw new IOException("Non-directory file: " + rootName); } ! // Canonicalize the file. rootFile = rootFile.getCanonicalFile(); ! // Cannot initialize this until rootFile established. ! allServices = new CacheMap(); ! setServices(services(rootFile)); //System.out.println ("Create "+this); ! // Create the ID->Node map for permanent IDs idMap = new CacheMap(); } ! Services services(File file) { ! Services svc = (Services) allServices.get(file); if (svc == null) { ! svc = new Services(this, file); ! allServices.put(file, svc); } return svc; --- 181,202 ---- throw new IOException("Non-directory file: " + rootName); } ! // Canonicalize the file. rootFile = rootFile.getCanonicalFile(); ! // Cannot initialize this until rootFile established. ! backends = new CacheMap(); ! setBackend(backend(rootFile)); //System.out.println ("Create "+this); ! // Create the ID->Node map for permanent IDs idMap = new CacheMap(); } ! Backend backend(File file) { ! Backend svc = (Backend) backends.get(file); if (svc == null) { ! svc = new Backend(this, file); ! backends.put(file, svc); } return svc; *************** *** 220,224 **** NodeFactory nodeFactory(File f) { ! return services(f).nodeFactory(); } --- 233,237 ---- NodeFactory nodeFactory(File f) { ! return backend(f).nodeFactory(); } *************** *** 241,248 **** * Remember the association between the ID and the Node so that it can be * recovered later. ! * @param node a FileNode with a permanent ID */ void associateID(FileNode node) { ! idMap.put (node.id(), node); } } \ No newline at end of file --- 254,263 ---- * Remember the association between the ID and the Node so that it can be * recovered later. ! * ! * @param node ! * a FileNode with a permanent ID */ void associateID(FileNode node) { ! idMap.put(node.id(), node); } } \ No newline at end of file Index: FileDocument.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileDocument.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** FileDocument.java 15 Sep 2004 20:57:15 -0000 1.19 --- FileDocument.java 15 Nov 2004 19:22:00 -0000 1.20 *************** *** 30,34 **** import storage.framework.AbstractRepository; import storage.framework.DocFromNode; ! import storage.framework.RepoServices; import storage.framework.StreamBasedNode; import storage.framework.TxnManager; --- 30,34 ---- import storage.framework.AbstractRepository; import storage.framework.DocFromNode; ! import storage.framework.RepoBackend; import storage.framework.StreamBasedNode; import storage.framework.TxnManager; *************** *** 74,78 **** } else if (file.isDirectory()) { Path path = FileRepository.pathFromFile(file); ! FileRepository.Services svc = repo.services(file); NodeFactory factory = svc.nodeFactory(); RecordNode.Editor docEditor = factory.createNode(Types.DIRTYPE) --- 74,78 ---- } else if (file.isDirectory()) { Path path = FileRepository.pathFromFile(file); ! FileRepository.Backend svc = repo.backend(file); NodeFactory factory = svc.nodeFactory(); RecordNode.Editor docEditor = factory.createNode(Types.DIRTYPE) *************** *** 115,119 **** private JDBMRecordManager ndldb; private JDBMHashtable props; ! private FileRepository.Services svc; private boolean reloading; --- 115,119 ---- private JDBMRecordManager ndldb; private JDBMHashtable props; ! private FileRepository.Backend svc; private boolean reloading; *************** *** 124,128 **** * @author leei */ ! private class LoadRepoServices extends FileRepository.Services { LoadRepoServices(FileRepository repo, File file) { super(repo, file); --- 124,128 ---- * @author leei */ ! private class LoadRepoServices extends FileRepository.Backend { LoadRepoServices(FileRepository repo, File file) { super(repo, file); *************** *** 140,144 **** public void commitTxn(Resolver resolver) { ! commitTxn(resolver); } } --- 140,144 ---- public void commitTxn(Resolver resolver) { ! super.commitTxn(resolver); } } *************** *** 147,151 **** this.repo = repo; this.file = file; ! this.svc = repo.services(file); this.reloading = false; } --- 147,151 ---- this.repo = repo; this.file = file; ! this.svc = repo.backend(file); this.reloading = false; } *************** *** 157,166 **** svc = new LoadRepoServices(repo, file); } else { ! svc = repo.services(file); } } } ! public RepoServices repoServices() { return svc; } --- 157,166 ---- svc = new LoadRepoServices(repo, file); } else { ! svc = repo.backend(file); } } } ! public RepoBackend repoServices() { return svc; } |