nodal-cvs Mailing List for NODAL (Page 3)
Status: Pre-Alpha
Brought to you by:
leei
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(69) |
Jun
(153) |
Jul
(129) |
Aug
(70) |
Sep
(94) |
Oct
(105) |
Nov
(31) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(7) |
Feb
(40) |
Mar
(68) |
Apr
(27) |
May
(107) |
Jun
(202) |
Jul
(74) |
Aug
(5) |
Sep
(25) |
Oct
(40) |
Nov
(43) |
Dec
(73) |
2004 |
Jan
(63) |
Feb
(40) |
Mar
(104) |
Apr
(34) |
May
(33) |
Jun
(18) |
Jul
(12) |
Aug
(2) |
Sep
(24) |
Oct
(52) |
Nov
(44) |
Dec
(4) |
2005 |
Jan
(42) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(5) |
Jun
|
Jul
|
Aug
(6) |
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(6) |
Oct
(5) |
Nov
(8) |
Dec
(3) |
2015 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Lee I. <le...@us...> - 2004-11-18 23:43:28
|
Update of /cvsroot/nodal/j-test/src/test/storage/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18350/src/test/storage/memory Modified Files: TestmemOperator.java Log Message: Adjust for change or name from MemOperator -> AbstractOperator Index: TestmemOperator.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/storage/memory/TestmemOperator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestmemOperator.java 3 Oct 2004 19:42:10 -0000 1.1 --- TestmemOperator.java 18 Nov 2004 23:43:17 -0000 1.2 *************** *** 29,33 **** import org.nodal.util.Names; ! import storage.memory.MemOperator; import storage.trans.TransientRepository; --- 29,33 ---- import org.nodal.util.Names; ! import storage.memory.AbstractOperator; import storage.trans.TransientRepository; *************** *** 68,72 **** public void testCreateOpCreate() { ! MemOperator op = MemOperator.createOpCreate (node, nodeType); assertTrue (op instanceof OpCreate); OpCreate opCreate = (OpCreate) op; --- 68,72 ---- public void testCreateOpCreate() { ! AbstractOperator op = AbstractOperator.createOpCreate (node, nodeType); assertTrue (op instanceof OpCreate); OpCreate opCreate = (OpCreate) op; *************** *** 76,80 **** public void testCreateOpClone() { ! MemOperator op = MemOperator.createOpClone (node, node); assertTrue (op instanceof OpClone); OpClone opClone = (OpClone) op; --- 76,80 ---- public void testCreateOpClone() { ! AbstractOperator op = AbstractOperator.createOpClone (node, node); assertTrue (op instanceof OpClone); OpClone opClone = (OpClone) op; *************** *** 84,88 **** public void testCreateOpSetValue() { ! MemOperator op = MemOperator.createOpSetValue (node, nodeType); assertTrue (op instanceof OpSetValue); OpSetValue opSetValue = (OpSetValue) op; --- 84,88 ---- public void testCreateOpSetValue() { ! AbstractOperator op = AbstractOperator.createOpSetValue (node, nodeType); assertTrue (op instanceof OpSetValue); OpSetValue opSetValue = (OpSetValue) op; *************** *** 92,96 **** public void testCreateOpRemove() { ! MemOperator op = MemOperator.createOpRemove (node); assertTrue (op instanceof OpRemove); OpRemove opRemoveKey = (OpRemove) op; --- 92,96 ---- public void testCreateOpRemove() { ! AbstractOperator op = AbstractOperator.createOpRemove (node); assertTrue (op instanceof OpRemove); OpRemove opRemoveKey = (OpRemove) op; *************** *** 100,104 **** public void testCreateOpSetField() { Name test = Names.getName ("test"); ! MemOperator op = MemOperator.createOpSetField (test, node); assertTrue (op instanceof OpSetField); OpSetField opSetField = (OpSetField) op; --- 100,104 ---- public void testCreateOpSetField() { Name test = Names.getName ("test"); ! AbstractOperator op = AbstractOperator.createOpSetField (test, node); assertTrue (op instanceof OpSetField); OpSetField opSetField = (OpSetField) op; *************** *** 108,112 **** public void testCreateOpReplaceRange() { ! MemOperator op = MemOperator.createOpReplaceRange (0, -1, node); assertTrue (op instanceof OpReplaceRange); OpReplaceRange opReplaceRange = (OpReplaceRange) op; --- 108,112 ---- public void testCreateOpReplaceRange() { ! AbstractOperator op = AbstractOperator.createOpReplaceRange (0, -1, node); assertTrue (op instanceof OpReplaceRange); OpReplaceRange opReplaceRange = (OpReplaceRange) op; *************** *** 117,121 **** public void testCreateOpRemoveRange() { ! MemOperator op = MemOperator.createOpRemoveRange (0, -1); assertTrue (op instanceof OpRemoveRange); OpRemoveRange opRemoveRange = (OpRemoveRange) op; --- 117,121 ---- public void testCreateOpRemoveRange() { ! AbstractOperator op = AbstractOperator.createOpRemoveRange (0, -1); assertTrue (op instanceof OpRemoveRange); OpRemoveRange opRemoveRange = (OpRemoveRange) op; *************** *** 125,129 **** public void testCreateOpInsertBefore() { ! MemOperator op = MemOperator.createOpInsertBefore (0, node); assertTrue (op instanceof OpInsertBefore); OpInsertBefore opInsertBefore = (OpInsertBefore) op; --- 125,129 ---- public void testCreateOpInsertBefore() { ! AbstractOperator op = AbstractOperator.createOpInsertBefore (0, node); assertTrue (op instanceof OpInsertBefore); OpInsertBefore opInsertBefore = (OpInsertBefore) op; *************** *** 133,137 **** public void testCreateOpInsertAfter() { ! MemOperator op = MemOperator.createOpInsertAfter (-1, node); assertTrue (op instanceof OpInsertAfter); OpInsertAfter opInsertAfter = (OpInsertAfter) op; --- 133,137 ---- public void testCreateOpInsertAfter() { ! AbstractOperator op = AbstractOperator.createOpInsertAfter (-1, node); assertTrue (op instanceof OpInsertAfter); OpInsertAfter opInsertAfter = (OpInsertAfter) op; |
From: Lee I. <le...@us...> - 2004-11-18 23:30:49
|
Update of /cvsroot/nodal/nodal/j-src/org/nodal/format/application/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15230/org/nodal/format/application/xml Added Files: Format.java XMLFactory.java Log Message: Make application/xml the default MIME type for XML --- NEW FILE: XMLFactory.java --- /* * Distributed under the Apache Software License, Version 1.1 (see below, or * the file LICENSE for terms and conditions) * * Copyright (c) 2004 University of British Columbia. All rights reserved. * * Created on Mar 10, 2004 by leei */ package org.nodal.format.application.xml; import org.nodal.Types; import org.nodal.model.NodeFactory; import org.nodal.model.MapNode; import org.nodal.model.RecordNode; import org.nodal.model.SequenceNode; import org.nodal.type.MapType; import org.nodal.type.NodeType; import org.nodal.type.RecordType; import org.nodal.type.Schema; import org.nodal.type.SequenceType; import org.nodal.util.ConstraintFailure; import org.nodal.util.IndexBoundsException; import org.nodal.util.Name; import org.nodal.util.Names; /** * @author leei */ public class XMLFactory { /** * The xml.nls schema, a collection of all of the basic XML types. */ public static final Schema schema = Types .openBaseSchema("xml.nls"); public static final RecordType notationType = (RecordType) schema .typeNamed("Notation"); public static final RecordType documentType = (RecordType) schema .typeNamed("Document"); public static final RecordType docTypeType = (RecordType) schema .typeNamed("DocumentType"); public static final RecordType elementType = (RecordType) schema .typeNamed("Element"); public static final RecordType commentType = (RecordType) schema .typeNamed("Comment"); public static final RecordType textType = (RecordType) schema .typeNamed("Text"); public static final RecordType piType = (RecordType) schema .typeNamed("ProcessingInstruction"); public static final SequenceType nodeListType = (SequenceType) schema .typeNamed("NodeList"); public static final MapType attrMapType = (MapType) elementType .fieldType("attributes"); public static final RecordType chardataType = (RecordType) schema .typeNamed("CharacterData"); public static final RecordType cdataType = (RecordType) schema .typeNamed("CDATASection"); private NodeFactory factory; /** * */ public XMLFactory(NodeFactory factory) { this.factory = factory; } public RecordNode.Editor createDocument() { return factory.createNode(documentType).editRecord(); } public RecordNode.Editor createDocumentType() { return factory.createNode(docTypeType).editRecord(); } public RecordNode.Editor createElement() { return factory.createNode(elementType).editRecord(); } public RecordNode.Editor createElement(Name tagName) throws ConstraintFailure { RecordNode.Editor element = createElement(); element.setField("tagName").set(tagName); return element; } public MapNode.Editor createNamespaceMap(RecordNode.Editor element) throws ConstraintFailure { NodeType nsType = (NodeType) elementType.fieldType("namespaces"); MapNode.Editor map = factory.createNode(nsType).editMap(); element.setField("namespaces").setNode(map); return map; } public RecordNode.Editor createText() { return factory.createNode(textType).editRecord(); } public RecordNode.Editor setCData(RecordNode.Editor editor, String data) throws ConstraintFailure { editor.setField("data").setNode(createString(data)); return editor; } public RecordNode.Editor createText(String data) throws ConstraintFailure { RecordNode.Editor text = createText(); return setCData(text, data); } public RecordNode.Editor createComment() { return factory.createNode(commentType).editRecord(); } public RecordNode.Editor createComment(String data) throws ConstraintFailure { RecordNode.Editor comment = createComment(); return setCData(comment, data); } public RecordNode.Editor createProcessingInstruction() { return factory.createNode(piType).editRecord(); } public RecordNode.Editor createProcessingInstruction(String target, String data) throws ConstraintFailure { RecordNode.Editor pi = createProcessingInstruction(); pi.setField("target").set(Names.getName(target)); return setCData(pi, data); } public RecordNode.Editor createCData() { return factory.createNode(cdataType).editRecord(); } public RecordNode.Editor createCData(String data) throws ConstraintFailure { RecordNode.Editor comment = createCData(); return setCData(comment, data); } public MapNode.Editor createAttributeMap() { return factory.createNode(attrMapType).editMap(); } public SequenceNode.Editor createNodeList() { return factory.createNode(nodeListType).editSequence(); } public SequenceNode.Editor createNodeList(NodeType t) { return factory.createNode(t).editSequence(); } public SequenceNode.Editor createString(String s) { SequenceNode.Editor editor = factory.createNode(Types.STRING) .editSequence(); try { editor.replaceRange(0, -1).setString(s); } catch (IndexBoundsException e) { return null; } catch (ConstraintFailure e) { return null; } return editor; } } --- NEW FILE: Format.java --- /* * Created on Nov 6, 2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package org.nodal.format.application.xml; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.jdom.Attribute; import org.jdom.CDATA; import org.jdom.Comment; import org.jdom.DocType; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.ProcessingInstruction; import org.jdom.Text; import org.jdom.input.SAXBuilder; import org.nodal.filesystem.DocumentFormat; import org.nodal.model.MapNode; import org.nodal.model.Node; import org.nodal.model.NodeFactory; import org.nodal.model.RecordNode; import org.nodal.model.SequenceNode; import org.nodal.model.Setter; import org.nodal.type.NodeType; import org.nodal.util.ConstraintFailure; import org.nodal.util.IndexBoundsException; import org.nodal.util.Name; import org.nodal.util.Names; import org.nodal.util.Namespace; import org.xml.sax.InputSource; /** * Implementation of the text/xml DocumentFormat handler. Decodes and encodes * XML data using the base schema xml.nls. * * Built using the org.jdom parser interface. * * @author leei */ public class Format extends DocumentFormat.AutoRegister { /** * Singleton instance of Format class. */ private static final Format format = new Format(); public DocumentFormat create () { return format; } /** * Ensure that above singleton instance is only one created. * */ private Format () { } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat#mimeType() */ public String mimeType() { return "application/xml"; } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat#rootType() */ public NodeType rootType() { return XMLFactory.documentType; } private static class NSChain { MapNode nsMap; NSChain chain; NSChain(MapNode nsMap, NSChain chain) { this.nsMap = nsMap; this.chain = chain; } String qName(Name nm) { Namespace ns = nm.namespace(); // Check for global Namespace if (ns.uri() == null) { return nm.string(); } Name uri = Names.getName(ns.uri()); NSChain cv = this; Name prefix; do { prefix = (Name) cv.nsMap.getValue(uri); cv = cv.chain; } while (cv != null && prefix == null); if (prefix == null) { return nm.string(); } else { return prefix.string() + ":" + nm.string(); } } } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat#encoder() */ public DocumentFormat.Encoder encoder() { return new Encoder(); } private class Encoder implements DocumentFormat.Encoder { /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat.Encoder#isLossless() */ public boolean isLossless() { return false; } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat.Encoder#encode(java.io.OutputStream, * org.nodal.model.Node) */ public OutputStream encode(OutputStream stream, Node root) throws IOException { PrintWriter pr = new PrintWriter(stream); encodeDocument(pr, root.asRecordNode()); pr.println(); pr.flush(); return stream; } private void encodeDocument(PrintWriter out, RecordNode docNode) throws IOException { out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); Node typeNode = docNode.field("docType").getNode(); if (typeNode != null) { RecordNode docType = typeNode.asRecordNode(); Name name = (Name) docType.getField("name"); Name pubID = (Name) docType.getField("publicID"); Name sysID = (Name) docType.getField("systemID"); Name internalSubset = (Name) docType.getField("internalSubset"); out.print("<!DOCTYPE " + name.string()); if (pubID != null) { out.print(" PUBLIC \"" + pubID.string() + "\""); if (sysID != null) { out.print(" \"" + sysID.string() + "\""); } } else if (sysID != null) { out.print(" SYSTEM \"" + sysID.string() + "\""); } if (internalSubset != null && internalSubset.string().length() != 0) { out.print("\n["); out.print(internalSubset.string()); out.print("]"); } out.println(">"); } Node chNode = docNode.field("children").getNode(); if (chNode != null) { SequenceNode children = chNode.asSequenceNode(); int n = children.size(); for (int i = 0; i < n; ++i) { Node child = children.item(i).getNode(); encodeNode(out, child, 0, null); } } } private void encodeNode(PrintWriter out, Node node, int indent, NSChain nsChain) { NodeType nodeType = node.nodeType(); if (XMLFactory.chardataType.acceptsType(nodeType)) { RecordNode text = node.asRecordNode(); if (text != null) { encodeText(out, text); } } else if (XMLFactory.elementType.acceptsType(nodeType)) { RecordNode element = node.asRecordNode(); if (element != null) { encodeElement(out, element, indent, nsChain); } } else { out.println("<!-- Ignore XML: " + nodeType + " -->"); } } /** * Returns an XML-qualified name derived from the URI->prefix mappings in * the NSChain. * * @param name * a Nodal Name for the given tag * @param nsChain * a namespace chain (NSChain) holding URI->prefix mappings * @return an XML QName for the name argument */ private String qName(Name name, NSChain nsChain) { if (nsChain == null) { return name.string(); } else { return nsChain.qName(name); } } /** * Encode an XML Element. Handles Namespace declarations properly... * * @param out * @param element * @param indent * @param nsChain */ private void encodeElement(PrintWriter out, RecordNode element, int indent, NSChain nsChain) { // Extend Namespace mapping if necessary Node nsNode = element.field("namespaces").getNode(); MapNode nsMap = null; if (nsNode != null) { nsMap = nsNode.asMapNode(); nsChain = new NSChain(nsMap, nsChain); } // Write tagName opening Name elementName = (Name) element.getField("tagName"); out.print("<" + qName(elementName, nsChain)); // Write Namespace decls if (nsMap != null) { Iterator e = nsMap.properties(); while (e.hasNext()) { Name uri = (Name) e.next(); Name prefix = (Name) nsMap.getValue(uri); out.print(" xmlns"); if (prefix.string().length() != 0) { out.print(":" + prefix.string()); } out.print("=\"" + uri.string() + "\""); } } // Write attributes Node attrNode = element.field("attributes").getNode(); if (attrNode != null) { MapNode attrs = attrNode.asMapNode(); Iterator e = attrs.properties(); while (e.hasNext()) { Name attrName = (Name) e.next(); Name value = (Name) attrs.getValue(attrName); out.print(" " + qName(attrName, nsChain) + "=\"" + value.string() + "\""); } } // Write children Node childNode = element.field("children").getNode(); if (childNode == null) { out.print("/>"); } else { SequenceNode children = childNode.asSequenceNode(); int n = children.size(); out.print(">"); for (int i = 0; i < n; ++i) { Node child = children.item(i).getNode(); encodeNode(out, child, indent + 2, nsChain); } out.print("</" + elementName.string() + ">"); } } /** * Handle any CharacterData type. * * @param out * @param text */ private void encodeText(PrintWriter out, RecordNode text) { boolean isComment = XMLFactory.commentType.accepts(text); boolean isPI = XMLFactory.piType.accepts(text); boolean isCDATA = XMLFactory.cdataType.accepts(text); String end = null; Node dataNode = text.field("data").getNode(); if (dataNode != null) { String str = dataNode.asSequenceNode().range(0, -1).getString(); if (isComment) { out.print("<!--"); end = "-->"; } else if (isPI) { Name target = (Name) text.getField("target"); out.print("<?" + target.string() + " "); end = "?>"; } else if (isCDATA) { out.print("<![CDATA["); end = "]]>"; } out.print(str); if (end != null) { out.print(end); } } } } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat#decoder() */ public DocumentFormat.Decoder decoder() { return new Decoder(); } private class Decoder implements DocumentFormat.Decoder { private List exceptions; private InputSource source; private Decoder() { source = new InputSource(); } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat.Decoder#isLossless() */ public boolean isLossless() { return false; } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat.Decoder#decode(java.io.InputStream, * org.nodal.model.NodeFactory) */ public Node decode(InputStream stream, NodeFactory factory) throws IOException { SAXBuilder builder = new SAXBuilder(); XMLFactory xmlFactory = new XMLFactory(factory); try { source.setByteStream(stream); org.jdom.Document jdomDoc = builder.build(source); return nodalizeDocument(jdomDoc, xmlFactory); } catch (JDOMException e) { exceptions = new LinkedList(); exceptions.add(e); return null; } } /** * Convert a Document from JDOM to an instantiation wrt. NODAL's xml.nls * schema. * * @param jdomDoc * a Document from JDOM * @param factory * a NodeFactory used to create the Nodes in this Document * @return */ private Node nodalizeDocument(Document jdomDoc, XMLFactory factory) { try { //System.out.println("Create xml Document " + documentType); RecordNode.Editor doc = factory.createDocument(); DocType docType = jdomDoc.getDocType(); doc.setField("docType").setNode(nodalizeDocType(docType, factory)); List docContent = jdomDoc.getContent(); if (!docContent.isEmpty()) { SequenceNode.Editor docChildren = doc.createNode( (NodeType) XMLFactory.documentType.fieldType("children")) .editSequence(); doc.setField("children").setNode(docChildren); Setter appender = docChildren.insertAfter(-1); for (Iterator i = docContent.iterator(); i.hasNext();) { appender.setNode(nodalize(i.next(), factory)); } } doc.commit(); return doc; } catch (ConstraintFailure e) { throw new RuntimeException(e); } } /** * Convert a jdom Object into NODAL. * * @param object * a JDOM object * @param factory * a NodeFactory used to create the Nodes * @return a Node */ private Node nodalize(Object object, XMLFactory factory) { // NEXT Nodalize Entities and Notations from XML try { if (object instanceof Comment) { return nodalizeComment((Comment) object, factory); } else if (object instanceof Element) { return nodalizeElement((Element) object, factory); } else if (object instanceof Text) { return nodalizeText((Text) object, factory); } else if (object instanceof CDATA) { return nodalizeCDATA ((CDATA) object, factory); } else if (object instanceof ProcessingInstruction) { return nodalizePI((ProcessingInstruction) object, factory); } else if (object instanceof DocType) { return nodalizeDocType((DocType) object, factory); } else { System.out.println("nodalize: Didn't handle " + object); } } catch (IndexBoundsException e) { throw new RuntimeException(e); } catch (ConstraintFailure e) { throw new RuntimeException(e); } return null; } /** * @param cdata * @param factory * @return */ private Node nodalizeCDATA(CDATA cdata, XMLFactory factory) throws ConstraintFailure { return factory.createCData(cdata.getText()); } /** * @param type * @param factory * @return */ private Node nodalizeDocType(DocType type, XMLFactory factory) throws ConstraintFailure { RecordNode.Editor dtNode = factory.createDocumentType(); String pubID = type.getPublicID(); String sysID = type.getSystemID(); String subset = type.getInternalSubset(); String elementName = type.getElementName(); dtNode.setField("name").setString(elementName); if (pubID != null) { dtNode.setField("publicID").setString(pubID); } if (sysID != null) { dtNode.setField("systemID").setString(sysID); } if (subset != null) { dtNode.setField("internalSubset").setString(subset); } return dtNode; } /** * @param pi * @param factory * @return */ private Node nodalizePI(ProcessingInstruction pi, XMLFactory factory) throws IndexBoundsException, ConstraintFailure { RecordNode.Editor piNode = factory.createProcessingInstruction(pi.getTarget(), pi.getData()); return piNode; } /** * Create a Node of type textType from a JDOM Text object. * * @param text * @param factory * @return @throws * IndexBoundsException * @throws ConstraintFailure */ private Node nodalizeText(Text text, XMLFactory factory) throws IndexBoundsException, ConstraintFailure { RecordNode.Editor textNode = factory.createText(text.getText()); return textNode; } /** * Create a Node of type commentType from a JDOM Comment object. * * @param comment * @param factory * @return @throws * IndexBoundsException * @throws ConstraintFailure */ private Node nodalizeComment(Comment comment, XMLFactory factory) throws IndexBoundsException, ConstraintFailure { RecordNode.Editor commentNode = factory.createComment(comment.getText()); return commentNode; } /** * Create a Node of type elementType from a JDOM Element object. * * @param elem * @param factory * @return @throws * ConstraintFailure */ private Node nodalizeElement(Element elem, XMLFactory factory) throws ConstraintFailure { Namespace ns = Names.getNamespace(elem.getNamespaceURI()); Name tagName = ns.name(elem.getName()); RecordNode.Editor elementNode = factory.createElement(tagName); // Process namespace declarations List namespaces = elem.getAdditionalNamespaces(); if (namespaces != null && !namespaces.isEmpty()) { MapNode.Editor nsMap = factory.createNamespaceMap (elementNode); Iterator i = namespaces.iterator(); while (i.hasNext()) { org.jdom.Namespace nsDecl = (org.jdom.Namespace) i.next(); nsMap.setValue(nsDecl.getURI()).setString(nsDecl.getPrefix()); } } // Process attributes List attrs = elem.getAttributes(); if (!attrs.isEmpty()) { MapNode.Editor attrMap = factory.createAttributeMap(); Iterator i = attrs.iterator(); while (i.hasNext()) { Attribute attr = (Attribute) i.next(); Namespace attrNS = Names.getNamespace(attr.getNamespaceURI()); Name name = attrNS.name(attr.getName()); attrMap.setValue(name).set(attr.getValue()); } elementNode.setField("attributes").setNode(attrMap); } // Process children List ch = elem.getContent(); if (!ch.isEmpty()) { NodeType t = (NodeType) elementNode.nodeType().valueType("children"); SequenceNode.Editor childrenList = factory.createNodeList(t); elementNode.setField("children").setNode(childrenList); Setter appender = childrenList.insertAfter(-1); for (Iterator i = ch.iterator(); i.hasNext();) { Node node = nodalize(i.next(), factory); appender.setNode(node); } } return elementNode; } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat.Decoder#setURI(java.lang.String) */ public String setURI(String uri) { source.setSystemId(uri); return uri; } /* * (non-Javadoc) * * @see org.nodal.filesystem.DocumentFormat.Decoder#exceptions() */ public List exceptions() { return exceptions; } } } |
From: Lee I. <le...@us...> - 2004-11-18 23:30:49
|
Update of /cvsroot/nodal/nodal/j-src/org/nodal/format/text/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15230/org/nodal/format/text/html Modified Files: Format.java Log Message: Make application/xml the default MIME type for XML Index: Format.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/org/nodal/format/text/html/Format.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Format.java 5 May 2004 03:24:34 -0000 1.6 --- Format.java 18 Nov 2004 23:30:38 -0000 1.7 *************** *** 17,21 **** import org.nodal.Types; import org.nodal.filesystem.DocumentFormat; ! import org.nodal.format.text.xml.XMLFactory; import org.nodal.model.MapNode; import org.nodal.model.Node; --- 17,21 ---- import org.nodal.Types; import org.nodal.filesystem.DocumentFormat; ! import org.nodal.format.application.xml.XMLFactory; import org.nodal.model.MapNode; import org.nodal.model.Node; |
From: Lee I. <le...@us...> - 2004-11-18 23:30:48
|
Update of /cvsroot/nodal/nodal/j-src/org/nodal/format/text/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15230/org/nodal/format/text/xml Removed Files: Format.java XMLFactory.java Log Message: Make application/xml the default MIME type for XML --- XMLFactory.java DELETED --- --- Format.java DELETED --- |
From: Lee I. <le...@us...> - 2004-11-18 23:30:48
|
Update of /cvsroot/nodal/nodal/j-src/.externalToolBuilders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15230/.externalToolBuilders Modified Files: Create JAR.launch Log Message: Make application/xml the default MIME type for XML Index: Create JAR.launch =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/.externalToolBuilders/Create JAR.launch,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Create JAR.launch 6 Oct 2004 22:21:37 -0000 1.1 --- Create JAR.launch 18 Nov 2004 23:30:37 -0000 1.2 *************** *** 3,7 **** <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> ! <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/j-src}"/> <intAttribute key="org.eclipse.ui.externaltoolsATTR_SORT_TARGETS" value="1"/> --- 3,7 ---- <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> ! <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/j-src}"/> <intAttribute key="org.eclipse.ui.externaltoolsATTR_SORT_TARGETS" value="1"/> |
From: Lee I. <le...@us...> - 2004-11-18 23:30:40
|
Update of /cvsroot/nodal/nodal/j-src/org/nodal/format/application/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15208/org/nodal/format/application/xml Log Message: Directory /cvsroot/nodal/nodal/j-src/org/nodal/format/application/xml added to the repository |
From: Lee I. <le...@us...> - 2004-11-18 23:29:31
|
Update of /cvsroot/nodal/nodal/j-src/storage/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/storage/framework Modified Files: AnchorNodeImpl.java AbstractRepository.java Log Message: Add createAnchor() handling to AbstractRepository.AbstractBackend Properly handle creation of files via FileRepository Index: AnchorNodeImpl.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/AnchorNodeImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AnchorNodeImpl.java 12 Nov 2004 19:23:24 -0000 1.5 --- AnchorNodeImpl.java 18 Nov 2004 23:29:18 -0000 1.6 *************** *** 98,102 **** } } ! // TODO Should this follow through? i.e. target() of the target? return (getter != null ? getter.getNode() : null); --- 98,102 ---- } } ! // TODO Should this follow through? i.e. target() of the target? return (getter != null ? getter.getNode() : null); *************** *** 130,132 **** --- 130,137 ---- return true; } + + public String toString() { + return "Anchor[" + path.toURLString() + + (context != null ? "@" + context.toURLString() : "") + "]"; + } } \ No newline at end of file Index: AbstractRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/AbstractRepository.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AbstractRepository.java 16 Nov 2004 20:46:19 -0000 1.17 --- AbstractRepository.java 18 Nov 2004 23:29:18 -0000 1.18 *************** *** 42,45 **** --- 42,47 ---- static private CacheMap tempIDMap = new CacheMap(); + private static final EdgeIndex backlinks = EdgeIndex.create(); + /** * Use the cache of created Repositories to check for the existence of one. *************** *** 273,276 **** --- 275,286 ---- */ Node seatNode (Node node); + + /** + * Add an edge (src,property,dest) to the global graph of link/backlink edges. + * @param src the source Node of this edge + * @param property the property connecting these nodes + * @param dest the destination Node of this edge + */ + void addEdge (NodeContent src, Object property, Node dest); } *************** *** 364,367 **** --- 374,384 ---- /** + * Add an edge (src,property,dest) to the global link/backlink index. + */ + public void addEdge (NodeContent src, Object property, Node dest) { + backlinks.add(src, property, dest); + } + + /** * Create a brand new Node with the given NodeType. The <tt>context</tt> * Node determines the base metadata for the new Node, including permissions *************** *** 377,383 **** public abstract NodeContent.Editor cloneNode(Node node, Node context); ! public abstract AnchorNode createAnchor(Path context, Path rel); ! public abstract AnchorNode createAnchor(Path abs); /** --- 394,404 ---- public abstract NodeContent.Editor cloneNode(Node node, Node context); ! public final AnchorNode createAnchor(Path context, Path relative) { ! return AnchorNodeImpl.createWithContext(relative, context); ! } ! public final AnchorNode createAnchor(Path absolute) { ! return AnchorNodeImpl.create(absolute); ! } /** *************** *** 386,389 **** --- 407,411 ---- public abstract TxnManager txnManager(); } + /** * Remember the association between a Node and its id(). If the id() is a |
From: Lee I. <le...@us...> - 2004-11-18 23:29:29
|
Update of /cvsroot/nodal/nodal/j-src/storage/jar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/storage/jar Modified Files: JarRepository.java Log Message: Add createAnchor() handling to AbstractRepository.AbstractBackend Properly handle creation of files via FileRepository Index: JarRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/jar/JarRepository.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** JarRepository.java 16 Nov 2004 19:25:38 -0000 1.12 --- JarRepository.java 18 Nov 2004 23:29:18 -0000 1.13 *************** *** 17,21 **** import org.nodal.Repository; import org.nodal.filesystem.Document; - import org.nodal.model.AnchorNode; import org.nodal.model.Node; import org.nodal.model.NodeContent; --- 17,20 ---- *************** *** 29,33 **** import storage.framework.AbstractRepository; - import storage.framework.AnchorNodeImpl; import storage.framework.DocFromURL; import storage.framework.TxnManager; --- 28,31 ---- *************** *** 85,96 **** return JarNode.clone(JarRepository.this, node, context); } - - public AnchorNode createAnchor (Path context, Path relative) { - return AnchorNodeImpl.createWithContext (relative, context); - } - - public AnchorNode createAnchor (Path absolute) { - return AnchorNodeImpl.create (absolute); - } /* --- 83,86 ---- |
From: Lee I. <le...@us...> - 2004-11-18 23:29:29
|
Update of /cvsroot/nodal/nodal/j-src/storage/trans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/storage/trans Modified Files: TransientRepository.java Log Message: Add createAnchor() handling to AbstractRepository.AbstractBackend Properly handle creation of files via FileRepository Index: TransientRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/trans/TransientRepository.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** TransientRepository.java 16 Nov 2004 19:25:37 -0000 1.35 --- TransientRepository.java 18 Nov 2004 23:29:18 -0000 1.36 *************** *** 15,19 **** import org.nodal.filesystem.Directory; import org.nodal.filesystem.Document; - import org.nodal.model.AnchorNode; import org.nodal.model.Node; import org.nodal.model.NodeContent; --- 15,18 ---- *************** *** 28,32 **** import storage.framework.AbstractDocument; import storage.framework.AbstractRepository; - import storage.framework.AnchorNodeImpl; import storage.framework.DocFromNode; import storage.framework.SimpleTxnManager; --- 27,30 ---- *************** *** 94,105 **** } ! public AnchorNode createAnchor(Path context, Path relative) { ! return AnchorNodeImpl.createWithContext(relative, context); ! } ! ! public AnchorNode createAnchor(Path absolute) { ! return AnchorNodeImpl.create(absolute); } ! /** * The TxnManager for a transient repository is null. --- 92,105 ---- } ! /** ! * To seat a Node in a transient repository, we simply refer to it. There is no ! * need to create AnchorNodes. ! * @param node a Node ! * @return the Node node ! */ ! public Node seatNode (Node node) { ! return node; } ! /** * The TxnManager for a transient repository is null. *************** *** 138,142 **** return null; } ! public Directory filesystem() { if (fs == null) { --- 138,142 ---- return null; } ! public Directory filesystem() { if (fs == null) { |
From: Lee I. <le...@us...> - 2004-11-18 23:29:29
|
Update of /cvsroot/nodal/nodal/j-src/storage/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/storage/file Modified Files: FileRepository.java FileNode.java FileDirMap.java Added Files: FileNodeContext.java Log Message: Add createAnchor() handling to AbstractRepository.AbstractBackend Properly handle creation of files via FileRepository Index: FileDirMap.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileDirMap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileDirMap.java 15 Sep 2004 20:57:15 -0000 1.4 --- FileDirMap.java 18 Nov 2004 23:29:17 -0000 1.5 *************** *** 33,37 **** * @author leei */ ! public class FileDirMap extends GeneratedNode { private Capability cap; private HashSet files; --- 33,37 ---- * @author leei */ ! public class FileDirMap extends GeneratedNode implements FileNodeContext { private Capability cap; private HashSet files; *************** *** 104,106 **** --- 104,127 ---- return null; } + + /* (non-Javadoc) + * @see storage.file.FileNodeContext#docPath() + */ + public final Path docPath() { + return docPath; + } + + /* (non-Javadoc) + * @see storage.file.FileNodeContext#fileRepository() + */ + public FileRepository fileRepository() { + return (FileRepository) repo; + } + + /* (non-Javadoc) + * @see storage.file.FileNodeContext#fileContext() + */ + public File fileContext() { + return file; + } } Index: FileNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileNode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FileNode.java 16 Nov 2004 19:25:36 -0000 1.10 --- FileNode.java 18 Nov 2004 23:29:17 -0000 1.11 *************** *** 29,33 **** * @author leei */ ! class FileNode extends AbstractNode { protected final Path docPath; protected final File fileContext; --- 29,33 ---- * @author leei */ ! class FileNode extends AbstractNode implements FileNodeContext { protected final Path docPath; protected final File fileContext; *************** *** 149,151 **** --- 149,172 ---- return Paths.directPath(this, docPath, id()); } + + /* (non-Javadoc) + * @see storage.file.FileNodeContext#docPath() + */ + public final Path docPath() { + return docPath; + } + + /* (non-Javadoc) + * @see storage.file.FileNodeContext#fileRepository() + */ + public final FileRepository fileRepository() { + return fileRepo; + } + + /* (non-Javadoc) + * @see storage.file.FileNodeContext#fileContext() + */ + public final File fileContext() { + return fileContext; + } } \ No newline at end of file Index: FileRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileRepository.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** FileRepository.java 16 Nov 2004 19:25:36 -0000 1.29 --- FileRepository.java 18 Nov 2004 23:29:16 -0000 1.30 *************** *** 13,20 **** import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import org.nodal.filesystem.Document; - import org.nodal.model.AnchorNode; import org.nodal.model.Node; import org.nodal.model.NodeFactory; --- 13,21 ---- import java.net.MalformedURLException; import java.net.URL; + import java.util.HashSet; import java.util.Iterator; + import java.util.Set; import org.nodal.filesystem.Document; import org.nodal.model.Node; import org.nodal.model.NodeFactory; *************** *** 26,30 **** import org.nodal.util.CacheMap; import storage.framework.AbstractRepository; - import storage.framework.AnchorNodeImpl; import storage.framework.BasicNodeFactory; import storage.framework.SimpleTxnManager; --- 27,30 ---- *************** *** 90,95 **** */ public NodeContent.Editor createNode(NodeType type, Node context) { ! FileNode fcontext = (FileNode) context; ! File contextFile = (fcontext == null ? file : fcontext.fileContext); return FileNode.createNode(this, path(), nextID(), type, contextFile); } --- 90,95 ---- */ public NodeContent.Editor createNode(NodeType type, Node context) { ! FileNodeContext fcontext = (FileNodeContext) context; ! File contextFile = (fcontext == null ? file : fcontext.fileContext()); return FileNode.createNode(this, path(), nextID(), type, contextFile); } *************** *** 116,127 **** } - public AnchorNode createAnchor(Path context, Path rel) { - return AnchorNodeImpl.createWithContext(rel, context); - } - - public AnchorNode createAnchor(Path abs) { - return AnchorNodeImpl.create(abs); - } - /* * (non-Javadoc) --- 116,119 ---- *************** *** 139,143 **** * (non-Javadoc) * ! * @see storage.framework.RepoBackend#commitTxn(storage.memory.TxnResolver) */ public void commitTxn(TxnManager.Resolver resolver) { --- 131,135 ---- * (non-Javadoc) * ! * @see storage.framework.AbstractRepository.Backend#commitTxn(storage.memory.TxnResolver) */ public void commitTxn(TxnManager.Resolver resolver) { *************** *** 146,158 **** 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; ! } } } } --- 138,169 ---- Txn txn = resolver.txn(); Iterator subjIter = txn.subjects().iterator(); + Set fileSet = new HashSet(); 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; ! if (fileSet.add (fnode.fileContext)) { ! Document doc = FileDocument.create(frepo, fnode.fileContext); ! System.out.println("Save document "+doc); ! } } } } + + /* + * (non-Javadoc) + * @see storage.framework.AbstractRepository.Backend#addEdge(org.nodal.model.NodeContent, java.lang.Object, org.nodal.model.Node) + */ + public void addEdge (NodeContent src, Object property, Node dest) { + super.addEdge (src, property, dest); + // Gather Document->FileNode associations + Node bareSrc = src.bareNode(); + if (dest != null && dest instanceof FileNode && src instanceof FileNode) { + FileNode destFileNode = (FileNode) dest; + FileNode srcFileNode = (FileNode) bareSrc; + System.out.println("Link from "+srcFileNode+"->"+destFileNode); + } + } } --- NEW FILE: FileNodeContext.java --- /* * Distributed under the Apache Software License, Version 1.1 * (see below, or the file LICENSE for terms and conditions) * * Copyright (c) 2004 University of British Columbia. All rights reserved. * * Created on Nov 18, 2004 by leei */ package storage.file; import java.io.File; import org.nodal.nav.Path; /** * @author leei */ public interface FileNodeContext { /** * The Path to the Document that contains this Node. * @return */ Path docPath (); /** * The FileRepository that contains this Node. * @return */ FileRepository fileRepository(); /** * The File that provided the creation context for this Node. * @return */ File fileContext(); } |
From: Lee I. <le...@us...> - 2004-11-18 23:29:29
|
Update of /cvsroot/nodal/nodal/j-src/storage/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/storage/memory Modified Files: BareContent.java Log Message: Add createAnchor() handling to AbstractRepository.AbstractBackend Properly handle creation of files via FileRepository Index: BareContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareContent.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** BareContent.java 16 Nov 2004 20:46:18 -0000 1.32 --- BareContent.java 18 Nov 2004 23:29:17 -0000 1.33 *************** *** 40,44 **** import storage.framework.AbstractRepository; - import storage.framework.EdgeIndex; public abstract class BareContent extends NodeFilter implements NodeContent { --- 40,43 ---- *************** *** 48,54 **** protected List txnHandlers; - // NEXT Should this be Repo-based? - private static final EdgeIndex globalIndex = EdgeIndex.create(); - protected BareContent(Node n, memContent c, Capability cap, AbstractRepository.Backend backend) { --- 47,50 ---- *************** *** 80,87 **** } ! Node seatNode (Node node) { return backend.seatNode(node); } ! // Methods from org.nodal.model.TxnMonitorable public void addTxnHandler(TxnHandler handler) { --- 76,87 ---- } ! Node seatNode(Node node) { return backend.seatNode(node); } ! ! void addEdge(NodeContent src, Object property, Node dest) { ! backend.addEdge(src, property, dest); ! } ! // Methods from org.nodal.model.TxnMonitorable public void addTxnHandler(TxnHandler handler) { *************** *** 229,241 **** // Methods inherited from BareContent ! Node seatNode (Node node) { return content.seatNode(node); } ! /** ! * Called whenever a Node value is assigned anywhere in a BareContent object. This takes ! * care of accessing the {@link org.nodal.model.Node#bareNode()}, ensuring ! * that the reference stored is in the same repository, and then that all ! * indices are properly updated. * * @param property --- 229,242 ---- // Methods inherited from BareContent ! Node seatNode(Node node) { return content.seatNode(node); } ! /** ! * Called whenever a Node value is assigned anywhere in a BareContent ! * object. This takes care of accessing the ! * {@link org.nodal.model.Node#bareNode()}, ensuring that the reference ! * stored is in the same repository, and then that all indices are properly ! * updated. * * @param property *************** *** 247,254 **** protected Node assignNode(Object property, Node node) { node = seatNode(node); ! globalIndex.add(this, property, node); return node; } ! // Methods inherited from Node public NodeContent content() { --- 248,255 ---- protected Node assignNode(Object property, Node node) { node = seatNode(node); ! content.addEdge(this, property, node); return node; } ! // Methods inherited from Node public NodeContent content() { |
From: Lee I. <le...@us...> - 2004-11-18 23:29:29
|
Update of /cvsroot/nodal/nodal/j-src/storage/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14856/storage/http Modified Files: HttpRepository.java Log Message: Add createAnchor() handling to AbstractRepository.AbstractBackend Properly handle creation of files via FileRepository Index: HttpRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/http/HttpRepository.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** HttpRepository.java 16 Nov 2004 19:25:37 -0000 1.16 --- HttpRepository.java 18 Nov 2004 23:29:18 -0000 1.17 *************** *** 16,20 **** import org.nodal.filesystem.Document; - import org.nodal.model.AnchorNode; import org.nodal.model.Node; import org.nodal.model.NodeContent; --- 16,19 ---- *************** *** 26,30 **** import storage.framework.AbstractRepository; - import storage.framework.AnchorNodeImpl; import storage.framework.SBNStreamServices; import storage.framework.StreamBasedNode; --- 25,28 ---- *************** *** 66,77 **** return HttpNode.clone (HttpRepository.this, node, context); } - - public AnchorNode createAnchor (Path context, Path relative) { - return AnchorNodeImpl.createWithContext (relative, context); - } - - public AnchorNode createAnchor (Path absolute) { - return AnchorNodeImpl.create (absolute); - } /* (non-Javadoc) --- 64,67 ---- |
From: Lee I. <le...@us...> - 2004-11-18 23:20:10
|
Update of /cvsroot/nodal/nodal/j-src/org/nodal/nav In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12787/org/nodal/nav Modified Files: PathTokenizer.java Log Message: Ensure that we can handle ~ characters in URL paths. Index: PathTokenizer.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/org/nodal/nav/PathTokenizer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PathTokenizer.java 23 Mar 2004 18:19:42 -0000 1.7 --- PathTokenizer.java 18 Nov 2004 23:20:01 -0000 1.8 *************** *** 15,33 **** */ final class PathTokenizer { ! static final Object COLON = new Character(':'); ! static final Object SLASH = new Character('/'); ! static final Object SEMI = new Character(';'); ! static final Object COMMA = new Character(','); static final Object QUESTION = new Character('?'); ! static final Object HASH = new Character('#'); ! static final Object OPAREN = new Character('('); ! static final Object CPAREN = new Character(')'); ! static final Object DOT = new Character('.'); ! static final Object DOTDOT = ".."; ! static final Object EOS = new Character('\0'); // Which of the tokenizer modes are we in? ! static final int FRAGMENT = 0; ! static final int PATH = 1; ! static final int QUERY = 2; static boolean markChar(char ch) { --- 15,33 ---- */ final class PathTokenizer { ! static final Object COLON = new Character(':'); ! static final Object SLASH = new Character('/'); ! static final Object SEMI = new Character(';'); ! static final Object COMMA = new Character(','); static final Object QUESTION = new Character('?'); ! static final Object HASH = new Character('#'); ! static final Object OPAREN = new Character('('); ! static final Object CPAREN = new Character(')'); ! static final Object DOT = new Character('.'); ! static final Object DOTDOT = ".."; ! static final Object EOS = new Character('\0'); // Which of the tokenizer modes are we in? ! static final int FRAGMENT = 0; ! static final int PATH = 1; ! static final int QUERY = 2; static boolean markChar(char ch) { *************** *** 57,68 **** } ! private String str; private boolean encode; ! private int i; ! private int n; ! private int state; ! private char[] accum; ! private int accumLength; ! private int mode; private PathTokenizer(String str, int mode, boolean encode) { --- 57,68 ---- } ! private String str; private boolean encode; ! private int i; ! private int n; ! private int state; ! private char[] accum; ! private int accumLength; ! private int mode; private PathTokenizer(String str, int mode, boolean encode) { *************** *** 136,140 **** return (Character.isLetterOrDigit(c) || Character.isWhitespace(c) || c == '_' || c == '.' || c == '-' || c == '%' || (mode == PATH && (c == '(' ! || c == ')' || c == '[' || c == ']'))); } --- 136,140 ---- return (Character.isLetterOrDigit(c) || Character.isWhitespace(c) || c == '_' || c == '.' || c == '-' || c == '%' || (mode == PATH && (c == '(' ! || c == ')' || c == '[' || c == ']' || c == '~'))); } *************** *** 155,159 **** private static String stateName[] = {"start", "integer part", "sign", "decimal part", "id", "dot", "dotdot", "exponent", "exponent sign", ! "exponent digits" }; final Object nextToken() throws Path.Failure { --- 155,159 ---- private static String stateName[] = {"start", "integer part", "sign", "decimal part", "id", "dot", "dotdot", "exponent", "exponent sign", ! "exponent digits"}; final Object nextToken() throws Path.Failure { |
Update of /cvsroot/nodal/nodal/j-src/storage/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29271/storage/memory Modified Files: memBoolSequenceContent.java OpReplaceRange.java OpInsertAfter.java BareContent.java OpAnchor.java memNodeMapContent.java memLiteralSetContent.java OpRemoveRange.java memContent.java memRecordContent.java MemContentI.java memLiteralMapContent.java memMapContent.java memStringContent.java OpClone.java OpAdd.java memNodeSetContent.java memByteSequenceContent.java memFloatSequenceContent.java memSetContent.java memSequenceContent.java memLongSequenceContent.java OpInsertBefore.java memIntSequenceContent.java OpSetValue.java memDoubleSequenceContent.java OpCreate.java OpRemove.java OpSetField.java memShortSequenceContent.java memGenericSequenceContent.java Added Files: AbstractOperator.java Removed Files: MemOperator.java Log Message: Move seatNode into AbstractRepository.Backend interface and AbstractBackend implementation. Rename MemOperator to AbstractOperator in storage.memory. Index: memLiteralMapContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memLiteralMapContent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** memLiteralMapContent.java 28 Jun 2004 19:13:10 -0000 1.1 --- memLiteralMapContent.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 69,73 **** } ! void opSetValue(Object key, Object val, NodeContent.Editor c) throws ConstraintFailure { // Check types and convert if necessary --- 69,73 ---- } ! void opSetValue(Object key, Object val, BareContent.Editor c) throws ConstraintFailure { // Check types and convert if necessary *************** *** 78,82 **** } else { if (isNodeValue) { ! val = assignNode(c, key, (Node) val); } // Notify any interested values --- 78,82 ---- } else { if (isNodeValue) { ! val = c.assignNode(key, (Node) val); } // Notify any interested values Index: MemContentI.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/MemContentI.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MemContentI.java 13 May 2004 19:39:17 -0000 1.3 --- MemContentI.java 16 Nov 2004 20:46:18 -0000 1.4 *************** *** 95,99 **** * applyTo method of the memOperator. */ ! void modify(MemOperator op, NodeContent c) throws InvalidOperator, ConstraintFailure; } \ No newline at end of file --- 95,99 ---- * applyTo method of the memOperator. */ ! void modify(AbstractOperator op, BareContent.Editor c) throws InvalidOperator, ConstraintFailure; } \ No newline at end of file Index: memDoubleSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memDoubleSequenceContent.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** memDoubleSequenceContent.java 15 Jul 2004 04:47:57 -0000 1.19 --- memDoubleSequenceContent.java 16 Nov 2004 20:46:19 -0000 1.20 *************** *** 146,150 **** // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, NodeContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new DoubleSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); --- 146,150 ---- // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, BareContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new DoubleSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); *************** *** 153,160 **** private class IndexSetter implements DoubleSetterUtil.DoubleSetter { private int idx; ! private NodeContent.Editor content; private NodeManager mgr; ! IndexSetter(int i, NodeContent.Editor c, NodeManager mgr) { idx = i; this.content = c; --- 153,160 ---- private class IndexSetter implements DoubleSetterUtil.DoubleSetter { private int idx; ! private BareContent.Editor content; private NodeManager mgr; ! IndexSetter(int i, BareContent.Editor c, NodeManager mgr) { idx = i; this.content = c; *************** *** 186,190 **** * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, NodeContent.Editor c) throws ConstraintFailure { // Convert to something close to Double --- 186,190 ---- * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, BareContent.Editor c) throws ConstraintFailure { // Convert to something close to Double *************** *** 200,204 **** * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, double v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); --- 200,204 ---- * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, double v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); *************** *** 214,218 **** * must have already been done. */ ! private synchronized void opSetItemUnchecked(int i, double v, NodeContent c) throws ConstraintFailure { if (i < 0) { --- 214,218 ---- * must have already been done. */ ! private synchronized void opSetItemUnchecked(int i, double v, BareContent.Editor c) throws ConstraintFailure { if (i < 0) { *************** *** 224,228 **** synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! NodeContent.Editor c) throws ConstraintFailure { DoubleSeq seq = (val == null ? null : DoubleSeqUtil.create(val)); if (seq != null) { --- 224,228 ---- synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! BareContent.Editor c) throws ConstraintFailure { DoubleSeq seq = (val == null ? null : DoubleSeqUtil.create(val)); if (seq != null) { *************** *** 256,260 **** } ! synchronized void opInsertBefore(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 256,260 ---- } ! synchronized void opInsertBefore(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { *************** *** 266,270 **** } ! synchronized void opInsertAfter(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 266,270 ---- } ! synchronized void opInsertAfter(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { Index: memSetContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memSetContent.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** memSetContent.java 16 Nov 2004 19:25:35 -0000 1.7 --- memSetContent.java 16 Nov 2004 20:46:18 -0000 1.8 *************** *** 211,228 **** } ! MemOperator invertAdd(Object key, NodeContent c) { Object value = getValue(key, c); if (value != null) { return null; } ! return MemOperator.createOpRemove(value); } ! MemOperator invertRemoveKey(Object key, NodeContent c) { Object value = getValue(key, c); if (value == null) { return null; } ! return MemOperator.createOpAdd(value); } --- 211,228 ---- } ! AbstractOperator invertAdd(Object key, NodeContent c) { Object value = getValue(key, c); if (value != null) { return null; } ! return AbstractOperator.createOpRemove(value); } ! AbstractOperator invertRemoveKey(Object key, NodeContent c) { Object value = getValue(key, c); if (value == null) { return null; } ! return AbstractOperator.createOpAdd(value); } *************** *** 324,331 **** public abstract Set asSet(); ! abstract boolean opAdd(Object v, NodeContent.Editor c) throws ConstraintFailure; ! abstract boolean opRemove(Object k, NodeContent.Editor c); ! final void opSetValue(Object key, Object val, NodeContent.Editor c) throws ConstraintFailure { // Check types and convert if necessary key = checkItemType(key); --- 324,331 ---- public abstract Set asSet(); ! abstract boolean opAdd(Object v, BareContent.Editor c) throws ConstraintFailure; ! abstract boolean opRemove(Object k, BareContent.Editor c); ! final void opSetValue(Object key, Object val, BareContent.Editor c) throws ConstraintFailure { // Check types and convert if necessary key = checkItemType(key); --- MemOperator.java DELETED --- Index: memFloatSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memFloatSequenceContent.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** memFloatSequenceContent.java 15 Jul 2004 04:47:57 -0000 1.19 --- memFloatSequenceContent.java 16 Nov 2004 20:46:18 -0000 1.20 *************** *** 146,150 **** // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, NodeContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new FloatSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); --- 146,150 ---- // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, BareContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new FloatSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); *************** *** 153,160 **** private final class IndexSetter implements FloatSetterUtil.FloatSetter { private final int idx; ! private final NodeContent.Editor content; private final NodeManager mgr; ! IndexSetter(int i, NodeContent.Editor c, NodeManager mgr) { this.idx = i; this.content = c; --- 153,160 ---- private final class IndexSetter implements FloatSetterUtil.FloatSetter { private final int idx; ! private final BareContent.Editor content; private final NodeManager mgr; ! IndexSetter(int i, BareContent.Editor c, NodeManager mgr) { this.idx = i; this.content = c; *************** *** 186,190 **** * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, NodeContent.Editor c) throws ConstraintFailure { // Convert to something close to Double --- 186,190 ---- * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, BareContent.Editor c) throws ConstraintFailure { // Convert to something close to Double *************** *** 200,204 **** * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, float v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); --- 200,204 ---- * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, float v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); *************** *** 213,217 **** * must have already been done. */ ! private synchronized void opSetItemUnchecked(int i, float v, NodeContent c) throws ConstraintFailure { if (i < 0) { --- 213,217 ---- * must have already been done. */ ! private synchronized void opSetItemUnchecked(int i, float v, BareContent.Editor c) throws ConstraintFailure { if (i < 0) { *************** *** 223,227 **** synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! NodeContent.Editor c) throws ConstraintFailure { FloatSeq seq = (val == null ? null : FloatSeqUtil.create(val)); if (seq != null) { --- 223,227 ---- synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! BareContent.Editor c) throws ConstraintFailure { FloatSeq seq = (val == null ? null : FloatSeqUtil.create(val)); if (seq != null) { *************** *** 255,259 **** } ! synchronized void opInsertBefore(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 255,259 ---- } ! synchronized void opInsertBefore(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { *************** *** 265,269 **** } ! synchronized void opInsertAfter(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 265,269 ---- } ! synchronized void opInsertAfter(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { Index: OpAnchor.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpAnchor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpAnchor.java 13 May 2004 19:39:16 -0000 1.1 --- OpAnchor.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 20,24 **** * @author leei */ ! class OpAnchor extends MemOperator implements org.nodal.model.OpAnchor { private static CacheMap map = new CacheMap(); --- 20,24 ---- * @author leei */ ! class OpAnchor extends AbstractOperator implements org.nodal.model.OpAnchor { private static CacheMap map = new CacheMap(); *************** *** 105,114 **** } ! void applyTo(memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpAnchor on " + content); } ! MemOperator invertOn(memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return this; --- 105,114 ---- } ! void applyTo(memContent content, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpAnchor on " + content); } ! AbstractOperator invertOn(memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return this; Index: OpAdd.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpAdd.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpAdd.java 13 May 2004 19:39:16 -0000 1.1 --- OpAdd.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 14,18 **** import org.nodal.util.ConstraintFailure; ! final class OpAdd extends MemOperator implements org.nodal.model.OpAdd { private Object val; --- 14,18 ---- import org.nodal.util.ConstraintFailure; ! final class OpAdd extends AbstractOperator implements org.nodal.model.OpAdd { private Object val; *************** *** 23,31 **** public Object value () { return val; } ! void applyTo (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { content.opAdd (val, c); } ! MemOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertAdd (val, c); --- 23,31 ---- public Object value () { return val; } ! void applyTo (memContent content, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { content.opAdd (val, c); } ! AbstractOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertAdd (val, c); Index: OpSetField.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpSetField.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpSetField.java 13 May 2004 19:39:16 -0000 1.1 --- OpSetField.java 16 Nov 2004 20:46:19 -0000 1.2 *************** *** 16,20 **** import org.nodal.util.PropertyConstraintFailure; ! final class OpSetField extends MemOperator implements org.nodal.model.OpSetField { private Name field; private Object newValue; --- 16,20 ---- import org.nodal.util.PropertyConstraintFailure; ! final class OpSetField extends AbstractOperator implements org.nodal.model.OpSetField { private Name field; private Object newValue; *************** *** 40,48 **** } ! void applyTo(memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { content.opSetField(field, newValue, c); } ! MemOperator invertOn(memContent content, NodeContent node) throws InvalidOperator, PropertyConstraintFailure { return content.invertSetField(field, node); --- 40,48 ---- } ! void applyTo(memContent content, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { content.opSetField(field, newValue, c); } ! AbstractOperator invertOn(memContent content, NodeContent node) throws InvalidOperator, PropertyConstraintFailure { return content.invertSetField(field, node); Index: OpInsertAfter.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpInsertAfter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpInsertAfter.java 13 May 2004 19:39:16 -0000 1.1 --- OpInsertAfter.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 14,18 **** import org.nodal.util.ConstraintFailure; ! final class OpInsertAfter extends MemOperator implements org.nodal.model.OpInsertAfter { private int index; private Object newValue; --- 14,18 ---- import org.nodal.util.ConstraintFailure; ! final class OpInsertAfter extends AbstractOperator implements org.nodal.model.OpInsertAfter { private int index; private Object newValue; *************** *** 26,34 **** public Object value () { return newValue; } ! void applyTo (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { content.opInsertAfter (index, newValue, c); } ! MemOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertInsertAfter (index, newValue, c); --- 26,34 ---- public Object value () { return newValue; } ! void applyTo (memContent content, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { content.opInsertAfter (index, newValue, c); } ! AbstractOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertInsertAfter (index, newValue, c); Index: OpRemove.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpRemove.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OpRemove.java 14 May 2004 17:31:28 -0000 1.2 --- OpRemove.java 16 Nov 2004 20:46:19 -0000 1.3 *************** *** 15,19 **** import org.nodal.util.PropertyConstraintFailure; ! final class OpRemove extends MemOperator implements org.nodal.model.OpRemove { private Object key; --- 15,19 ---- import org.nodal.util.PropertyConstraintFailure; ! final class OpRemove extends AbstractOperator implements org.nodal.model.OpRemove { private Object key; *************** *** 24,32 **** public Object key () { return key; } ! void applyTo (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { content.opRemove (key, c); } ! MemOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { return content.invertRemoveKey (key, c); --- 24,32 ---- public Object key () { return key; } ! void applyTo (memContent content, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { content.opRemove (key, c); } ! AbstractOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { return content.invertRemoveKey (key, c); Index: memLiteralSetContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memLiteralSetContent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** memLiteralSetContent.java 28 Jun 2004 19:13:10 -0000 1.1 --- memLiteralSetContent.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 14,18 **** import java.util.TreeSet; - import org.nodal.model.NodeContent; import org.nodal.model.SetContent; import org.nodal.type.SetType; --- 14,17 ---- *************** *** 74,78 **** } ! boolean opRemove (Object key, NodeContent.Editor c) { key = checkItemType(key); // Notify interested parties --- 73,77 ---- } ! boolean opRemove (Object key, BareContent.Editor c) { key = checkItemType(key); // Notify interested parties *************** *** 82,86 **** } ! boolean opAdd(Object val, NodeContent.Editor c) throws ConstraintFailure { val = checkValue(val); // Notify any interested values --- 81,85 ---- } ! boolean opAdd(Object val, BareContent.Editor c) throws ConstraintFailure { val = checkValue(val); // Notify any interested values Index: memShortSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memShortSequenceContent.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** memShortSequenceContent.java 15 Jul 2004 04:47:57 -0000 1.20 --- memShortSequenceContent.java 16 Nov 2004 20:46:19 -0000 1.21 *************** *** 145,149 **** // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, NodeContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new ShortSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); --- 145,149 ---- // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, BareContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new ShortSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); *************** *** 152,159 **** private final class IndexSetter implements ShortSetterUtil.ShortSetter { private final int idx; ! private final NodeContent.Editor content; private final NodeManager mgr; ! IndexSetter(int i, NodeContent.Editor c, NodeManager mgr) { this.idx = i; this.content = c; --- 152,159 ---- private final class IndexSetter implements ShortSetterUtil.ShortSetter { private final int idx; ! private final BareContent.Editor content; private final NodeManager mgr; ! IndexSetter(int i, BareContent.Editor c, NodeManager mgr) { this.idx = i; this.content = c; *************** *** 182,186 **** * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); --- 182,186 ---- * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); *************** *** 197,201 **** * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, short v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); --- 197,201 ---- * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, short v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); *************** *** 220,224 **** synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! NodeContent.Editor c) throws ConstraintFailure { ShortSeq seq = (val == null ? null : ShortSeqUtil.create(val)); if (seq != null) { --- 220,224 ---- synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! BareContent.Editor c) throws ConstraintFailure { ShortSeq seq = (val == null ? null : ShortSeqUtil.create(val)); if (seq != null) { *************** *** 250,254 **** } ! synchronized void opInsertBefore(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 250,254 ---- } ! synchronized void opInsertBefore(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { *************** *** 260,264 **** } ! synchronized void opInsertAfter(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 260,264 ---- } ! synchronized void opInsertAfter(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { Index: OpInsertBefore.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpInsertBefore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpInsertBefore.java 13 May 2004 19:39:16 -0000 1.1 --- OpInsertBefore.java 16 Nov 2004 20:46:19 -0000 1.2 *************** *** 14,18 **** import org.nodal.util.ConstraintFailure; ! class OpInsertBefore extends MemOperator implements org.nodal.model.OpInsertBefore { private int index; private Object newValue; --- 14,18 ---- import org.nodal.util.ConstraintFailure; ! class OpInsertBefore extends AbstractOperator implements org.nodal.model.OpInsertBefore { private int index; private Object newValue; *************** *** 26,34 **** public Object value () { return newValue; } ! void applyTo (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { content.opInsertBefore (index, newValue, c); } ! MemOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertInsertBefore (index, content, c); --- 26,34 ---- public Object value () { return newValue; } ! void applyTo (memContent content, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { content.opInsertBefore (index, newValue, c); } ! AbstractOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertInsertBefore (index, content, c); Index: OpRemoveRange.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpRemoveRange.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpRemoveRange.java 13 May 2004 19:39:16 -0000 1.1 --- OpRemoveRange.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 14,18 **** import org.nodal.util.ConstraintFailure; ! class OpRemoveRange extends MemOperator implements org.nodal.model.OpRemoveRange { private int startIndex; private int endIndex; --- 14,18 ---- import org.nodal.util.ConstraintFailure; ! class OpRemoveRange extends AbstractOperator implements org.nodal.model.OpRemoveRange { private int startIndex; private int endIndex; *************** *** 26,34 **** public int endIndex () { return endIndex; } ! void applyTo (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { content.opRemoveRange (startIndex, endIndex, c); } ! MemOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertRemoveRange (startIndex, endIndex, c); --- 26,34 ---- public int endIndex () { return endIndex; } ! void applyTo (memContent content, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { content.opRemoveRange (startIndex, endIndex, c); } ! AbstractOperator invertOn (memContent content, NodeContent c) throws InvalidOperator, ConstraintFailure { return content.invertRemoveRange (startIndex, endIndex, c); Index: OpClone.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/OpClone.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpClone.java 13 May 2004 19:39:17 -0000 1.1 --- OpClone.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 14,18 **** import org.nodal.model.NodeContent; ! final class OpClone extends MemOperator implements org.nodal.model.OpClone { private final Node context; private final Node source; --- 14,18 ---- import org.nodal.model.NodeContent; ! final class OpClone extends AbstractOperator implements org.nodal.model.OpClone { private final Node context; private final Node source; *************** *** 29,38 **** public Node source () { return source; } ! void applyTo (memContent content, NodeContent c) throws InvalidOperator { throw new InvalidOperator ("invalid OpClone on "+content); } // The inverse of a creation Operator is itself. ! MemOperator invertOn (memContent content, NodeContent c) { return this; } --- 29,38 ---- public Node source () { return source; } ! void applyTo (memContent content, BareContent.Editor c) throws InvalidOperator { throw new InvalidOperator ("invalid OpClone on "+content); } // The inverse of a creation Operator is itself. ! AbstractOperator invertOn (memContent content, NodeContent c) { return this; } Index: memNodeSetContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memNodeSetContent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** memNodeSetContent.java 28 Jun 2004 19:13:10 -0000 1.1 --- memNodeSetContent.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 16,20 **** import org.nodal.model.Node; - import org.nodal.model.NodeContent; import org.nodal.model.SetContent; import org.nodal.type.SetType; --- 16,19 ---- *************** *** 78,82 **** } ! boolean opRemove (Object key, NodeContent.Editor c) { key = checkItemType(key); // Notify interested parties --- 77,81 ---- } ! boolean opRemove (Object key, BareContent.Editor c) { key = checkItemType(key); // Notify interested parties *************** *** 90,96 **** } ! boolean opAdd(Object val, NodeContent.Editor c) throws ConstraintFailure { val = checkValue(val); ! val = assignNode(c, val, (Node) val); // Notify any interested values --- 89,95 ---- } ! boolean opAdd(Object val, BareContent.Editor c) throws ConstraintFailure { val = checkValue(val); ! val = c.assignNode(val, (Node) val); // Notify any interested values Index: memIntSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memIntSequenceContent.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** memIntSequenceContent.java 15 Jul 2004 04:47:57 -0000 1.46 --- memIntSequenceContent.java 16 Nov 2004 20:46:19 -0000 1.47 *************** *** 144,148 **** // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, NodeContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new IntSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); --- 144,148 ---- // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, BareContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new IntSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); *************** *** 151,158 **** private class IndexSetter implements IntSetterUtil.IntSetter { private int idx; ! private final NodeContent.Editor content; private final NodeManager mgr; ! IndexSetter(int i, NodeContent.Editor c, NodeManager mgr) { idx = i; this.content = c; --- 151,158 ---- private class IndexSetter implements IntSetterUtil.IntSetter { private int idx; ! private final BareContent.Editor content; private final NodeManager mgr; ! IndexSetter(int i, BareContent.Editor c, NodeManager mgr) { idx = i; this.content = c; *************** *** 181,185 **** * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); --- 181,185 ---- * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); *************** *** 196,200 **** * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, int v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); --- 196,200 ---- * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, int v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); *************** *** 219,223 **** synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! NodeContent.Editor c) throws ConstraintFailure { IntSeq seq = (val == null ? null : IntSeqUtil.create(val)); if (seq != null) { --- 219,223 ---- synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! BareContent.Editor c) throws ConstraintFailure { IntSeq seq = (val == null ? null : IntSeqUtil.create(val)); if (seq != null) { *************** *** 249,253 **** } ! synchronized void opInsertBefore(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 249,253 ---- } ! synchronized void opInsertBefore(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { *************** *** 259,263 **** } ! synchronized void opInsertAfter(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 259,263 ---- } ! synchronized void opInsertAfter(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { Index: memNodeMapContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memNodeMapContent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** memNodeMapContent.java 28 Jun 2004 19:13:10 -0000 1.1 --- memNodeMapContent.java 16 Nov 2004 20:46:18 -0000 1.2 *************** *** 17,21 **** import org.nodal.model.MapContent; import org.nodal.model.Node; - import org.nodal.model.NodeContent; import org.nodal.type.MapType; --- 17,20 ---- *************** *** 63,70 **** } ! void opRemoveKey(Object key, NodeContent.Editor c) throws PropertyConstraintFailure { key = checkKeyType(key); ! key = seatNode (c, (Node) key); // Notify interested parties --- 62,69 ---- } ! void opRemoveKey(Object key, BareContent.Editor c) throws PropertyConstraintFailure { key = checkKeyType(key); ! key = c.seatNode ((Node) key); // Notify interested parties *************** *** 75,79 **** } ! void opSetValue(Object key, Object val, NodeContent.Editor c) throws ConstraintFailure { // Check types and convert if necessary --- 74,78 ---- } ! void opSetValue(Object key, Object val, BareContent.Editor c) throws ConstraintFailure { // Check types and convert if necessary *************** *** 84,91 **** opRemoveKey(key, c); } else { ! key = seatNode(c, (Node) key); if (isNodeValue) { ! val = assignNode(c, key, (Node) val); } // Notify any interested values --- 83,90 ---- opRemoveKey(key, c); } else { ! key = c.seatNode((Node) key); if (isNodeValue) { ! val = c.assignNode(key, (Node) val); } // Notify any interested values Index: BareContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareContent.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** BareContent.java 16 Nov 2004 19:25:35 -0000 1.31 --- BareContent.java 16 Nov 2004 20:46:18 -0000 1.32 *************** *** 40,43 **** --- 40,44 ---- import storage.framework.AbstractRepository; + import storage.framework.EdgeIndex; public abstract class BareContent extends NodeFilter implements NodeContent { *************** *** 47,50 **** --- 48,54 ---- protected List txnHandlers; + // NEXT Should this be Repo-based? + private static final EdgeIndex globalIndex = EdgeIndex.create(); + protected BareContent(Node n, memContent c, Capability cap, AbstractRepository.Backend backend) { *************** *** 76,79 **** --- 80,87 ---- } + Node seatNode (Node node) { + return backend.seatNode(node); + } + // Methods from org.nodal.model.TxnMonitorable public void addTxnHandler(TxnHandler handler) { *************** *** 181,185 **** public Operator invert(Operator op) throws InvalidOperator, ConstraintFailure { ! return c.invert((MemOperator) op, this); } --- 189,193 ---- public Operator invert(Operator op) throws InvalidOperator, ConstraintFailure { ! return c.invert((AbstractOperator) op, this); } *************** *** 220,223 **** --- 228,254 ---- } + // Methods inherited from BareContent + Node seatNode (Node node) { + return content.seatNode(node); + } + + /** + * Called whenever a Node value is assigned anywhere in a BareContent object. This takes + * care of accessing the {@link org.nodal.model.Node#bareNode()}, ensuring + * that the reference stored is in the same repository, and then that all + * indices are properly updated. + * + * @param property + * the property being assigned + * @param node + * the Node being assigned as the value for property + * @return the Node pointer ultimately assigned + */ + protected Node assignNode(Object property, Node node) { + node = seatNode(node); + globalIndex.add(this, property, node); + return node; + } + // Methods inherited from Node public NodeContent content() { *************** *** 264,268 **** public final Operator invert(Operator op) throws InvalidOperator, ConstraintFailure { ! return content.invert((MemOperator) op); } --- 295,299 ---- public final Operator invert(Operator op) throws InvalidOperator, ConstraintFailure { ! return content.invert((AbstractOperator) op); } *************** *** 351,360 **** return applyCreateOp((CreateOp) op); } ! content.c.modify((MemOperator) op, this); return this; } public void modify(Operator op) throws InvalidOperator, ConstraintFailure { ! content.c.modify((MemOperator) op, this); } --- 382,391 ---- return applyCreateOp((CreateOp) op); } ! content.c.modify((AbstractOperator) op, this); return this; } public void modify(Operator op) throws InvalidOperator, ConstraintFailure { ! content.c.modify((AbstractOperator) op, this); } Index: memContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memContent.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** memContent.java 16 Nov 2004 19:25:35 -0000 1.35 --- memContent.java 16 Nov 2004 20:46:18 -0000 1.36 *************** *** 33,37 **** import org.nodal.util.PropertyConstraintFailure; - import storage.framework.EdgeIndex; import storage.framework.AbstractRepository; --- 33,36 ---- *************** *** 47,52 **** protected final CacheMap nodeContents; protected final Set allContents; - // NEXT Should this be Repo-based? - private static final EdgeIndex globalIndex = EdgeIndex.create(); protected memContent() { --- 46,49 ---- *************** *** 104,108 **** * the memOperator to apply this content to */ ! public void modify(MemOperator op, NodeContent c) throws InvalidOperator, ConstraintFailure { op.applyTo(this, c); --- 101,105 ---- * the memOperator to apply this content to */ ! public void modify(AbstractOperator op, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { op.applyTo(this, c); *************** *** 112,120 **** // pattern of memOperator.applyTo. They should be overridden for // any memContent class that recognizes the Operator. ! abstract void opSetValue(Object k, Object v, NodeContent.Editor c) throws ConstraintFailure; // Methods valid only for MapContent ! boolean opRemove(Object k, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpRemoveKey on " + this); --- 109,117 ---- // pattern of memOperator.applyTo. They should be overridden for // any memContent class that recognizes the Operator. ! abstract void opSetValue(Object k, Object v, BareContent.Editor c) throws ConstraintFailure; // Methods valid only for MapContent ! boolean opRemove(Object k, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpRemoveKey on " + this); *************** *** 122,126 **** // Methods valid only for RecordContent ! void opSetField(Name n, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpSetField on " + this); --- 119,123 ---- // Methods valid only for RecordContent ! void opSetField(Name n, Object v, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpSetField on " + this); *************** *** 128,157 **** // Methods valid only for SequenceContent ! void opSetItem(int i, Object v, NodeContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpSetItem on " + this); } ! void opRemoveRange(int startIndex, int endIndex, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpRemoveRange on " + this); } ! void opReplaceRange(int startIndex, int endIndex, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpReplaceRange on " + this); } ! void opInsertBefore(int index, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertBefore on " + this); } ! void opInsertAfter(int index, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertAfter on " + this); } ! boolean opAdd(Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpAdd on " + this); --- 125,154 ---- // Methods valid only for SequenceContent ! void opSetItem(int i, Object v, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpSetItem on " + this); } ! void opRemoveRange(int startIndex, int endIndex, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpRemoveRange on " + this); } ! void opReplaceRange(int startIndex, int endIndex, Object v, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpReplaceRange on " + this); } ! void opInsertBefore(int index, Object v, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertBefore on " + this); } ! void opInsertAfter(int index, Object v, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertAfter on " + this); } ! boolean opAdd(Object v, BareContent.Editor c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpAdd on " + this); *************** *** 160,164 **** public Operator invert(Operator op, NodeContent c) throws InvalidOperator, ConstraintFailure { ! return invert((MemOperator) op, c); } --- 157,161 ---- public Operator invert(Operator op, NodeContent c) throws InvalidOperator, ConstraintFailure { ! return invert((AbstractOperator) op, c); } *************** *** 168,172 **** * @return a memOperator that represents the inverse operation. */ ! public MemOperator invert(MemOperator op, NodeContent c) throws InvalidOperator, ConstraintFailure { // Use the double dispatch pattern with memOperator to compute this --- 165,169 ---- * @return a memOperator that represents the inverse operation. */ ! public AbstractOperator invert(AbstractOperator op, NodeContent c) throws InvalidOperator, ConstraintFailure { // Use the double dispatch pattern with memOperator to compute this *************** *** 177,211 **** // pattern of memOperator.applyTo. They should be overridden for // any memContent class that recognizes the Operator. ! MemOperator invertRemoveKey(Object key, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { throw new InvalidOperator("invalid OpRemoveKey on " + this); } ! MemOperator invertSetField(Name name, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { throw new InvalidOperator("invalid OpSetField on " + this); } ! MemOperator invertRemoveRange(int startIndex, int endIndex, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { throw new InvalidOperator("invalid OpRemoveRange on " + this); } ! MemOperator invertReplaceRange(int startIndex, int endIndex, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpReplaceRange on " + this); } ! MemOperator invertInsertBefore(int index, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertBefore on " + this); } ! MemOperator invertInsertAfter(int index, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertAfter on " + this); } ! MemOperator invertAdd(Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpAdd on " + this); --- 174,208 ---- // pattern of memOperator.applyTo. They should be overridden for // any memContent class that recognizes the Operator. ! AbstractOperator invertRemoveKey(Object key, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { throw new InvalidOperator("invalid OpRemoveKey on " + this); } ! AbstractOperator invertSetField(Name name, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { throw new InvalidOperator("invalid OpSetField on " + this); } ! AbstractOperator invertRemoveRange(int startIndex, int endIndex, NodeContent c) throws InvalidOperator, PropertyConstraintFailure { throw new InvalidOperator("invalid OpRemoveRange on " + this); } ! AbstractOperator invertReplaceRange(int startIndex, int endIndex, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpReplaceRange on " + this); } ! AbstractOperator invertInsertBefore(int index, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertBefore on " + this); } ! AbstractOperator invertInsertAfter(int index, Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpInsertAfter on " + this); } ! AbstractOperator invertAdd(Object v, NodeContent c) throws InvalidOperator, ConstraintFailure { throw new InvalidOperator("invalid OpAdd on " + this); *************** *** 294,340 **** return null; } - - /** - * Ensure that any Node references are within the current Repository. - * - * @param node - * the Node being referenced - * @param c - * the NodeContent context for this reference - * @return a "seated" reference to the given Node - */ - protected Node seatNode(NodeContent.Editor c, Node node) { - // Make sure that we only use bareNode references. - if (node != null) { - // Only use direct Node references. - node = node.bareNode(); - // If we are not in the same Repository, then create an AnchorNode - // reference to the other Repository. - if (node.repository() != c.repository()) { - node = c.createAnchor(node.path()); - System.out.println("Storing " + node + " in " + c.repository()); - } - } - return node; - } - - /** - * Called whenever a Node value is assigned anywhere in memContent. This takes - * care of accessing the {@link org.nodal.model.Node#bareNode()}, ensuring - * that the reference stored is in the same repository, and then that all - * indices are properly updated. - * - * @param c - * the NodeContent context for this assignment - * @param property - * the property being assigned - * @param node - * the Node being assigned as the value for property - * @return the Node pointer ultimately assigned - */ - protected Node assignNode(NodeContent.Editor c, Object property, Node node) { - node = seatNode(c, node); - globalIndex.add(c.content(), property, node); - return node; - } }; --- 291,293 ---- Index: memBoolSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memBoolSequenceContent.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** memBoolSequenceContent.java 15 Jul 2004 04:47:57 -0000 1.21 --- memBoolSequenceContent.java 16 Nov 2004 20:46:18 -0000 1.22 *************** *** 145,149 **** // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, NodeContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new BooleanSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); --- 145,149 ---- // Implementation of StSequenceEditor methods ! protected Setter itemSetter(int i, BareContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new BooleanSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); *************** *** 153,159 **** private int idx; private NodeManager mgr; ! private NodeContent.Editor content; ! IndexSetter(int i, NodeContent.Editor c, NodeManager mgr) { this.idx = i; this.mgr = mgr; --- 153,159 ---- private int idx; private NodeManager mgr; ! private BareContent.Editor content; ! IndexSetter(int i, BareContent.Editor c, NodeManager mgr) { this.idx = i; this.mgr = mgr; *************** *** 181,185 **** } ! void opSetItem(int i, Object v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); --- 181,185 ---- } ! void opSetItem(int i, Object v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); *************** *** 196,200 **** * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, boolean v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); --- 196,200 ---- * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, boolean v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); *************** *** 210,214 **** * must have already been done. */ ! private synchronized void opSetItemUnchecked(int i, boolean v, NodeContent c) { if (i < 0) { i = normalizeIndex(i); --- 210,214 ---- * must have already been done. */ ! private synchronized void opSetItemUnchecked(int i, boolean v, BareContent.Editor c) { if (i < 0) { i = normalizeIndex(i); *************** *** 219,223 **** synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! NodeContent.Editor c) throws ConstraintFailure { BooleanSeq seq = (val == null ? null : BooleanSeqUtil.create(val)); if (seq != null) { --- 219,223 ---- synchronized void opReplaceRange(int startIndex, int endIndex, Object val, ! BareContent.Editor c) throws ConstraintFailure { BooleanSeq seq = (val == null ? null : BooleanSeqUtil.create(val)); if (seq != null) { *************** *** 251,255 **** } ! synchronized void opInsertBefore(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 251,255 ---- } ! synchronized void opInsertBefore(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { *************** *** 261,265 **** } ! synchronized void opInsertAfter(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { if (val == null) { --- 261,265 ---- } ! synchronized void opInsertAfter(int index, Object val, BareContent.Editor c) throws ConstraintFailure { if (val == null) { Index: memStringContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memStringContent.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** memStringContent.java 15 Jul 2004 04:47:57 -0000 1.39 --- memStringContent.java 16 Nov 2004 20:46:18 -0000 1.40 *************** *** 161,165 **** } ! protected Setter itemSetter(int i, NodeContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new CharSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); --- 161,165 ---- } ! protected Setter itemSetter(int i, BareContent.Editor c, NodeManager mgr) throws IndexBoundsException { return new CharSetterUtil(itemGetter(i, c), new IndexSetter(i, c, mgr)); *************** *** 169,175 **** private final int idx; private final NodeManager mgr; ! private final NodeContent.Editor content; ! IndexSetter(int i, NodeContent.Editor c, NodeManager mgr) { this.idx = i; this.content = c; --- 169,175 ---- private final int idx; private final NodeManager mgr; ! private final BareContent.Editor content; ! IndexSetter(int i, BareContent.Editor c, NodeManager mgr) { this.idx = i; this.content = c; *************** *** 199,203 **** * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); --- 199,203 ---- * Automatically converts to a valid value if necessary. */ ! void opSetItem(int i, Object v, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); *************** *** 214,218 **** * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, char ch, NodeContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); --- 214,218 ---- * Set an item value with full checking of validity of value or index. */ ! void opSetItem(int i, char ch, BareContent.Editor c) throws ConstraintFailure { checkIndex(i); Type itemType = type.itemType(); *************** *** 249,253 **** */ synchronized void opReplaceRange(int start, int end, Object val, ! NodeContent.Editor c) throws ConstraintFailure { CharSeq seq = CharSeqUtil.create(val); checkSeq(seq); --- 249,253 ---- */ synchronized void opReplaceRange(int start, int end, Object val, ! BareContent.Editor c) throws ConstraintFailure { CharSeq seq = CharSeqUtil.create(val); checkSeq(seq); *************** *** 284,288 **** } ! synchronized void opInsertBefore(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { CharSeq seq = CharSeqUtil.create(val); --- 284,288 ---- } ! synchronized void opInsertBefore(int index, Object val, BareContent.Editor c) throws ConstraintFailure { CharSeq seq = CharSeqUtil.create(val); *************** *** 295,299 **** } ! synchronized void opInsertAfter(int index, Object val, NodeContent.Editor c) throws ConstraintFailure { CharSeq seq = CharSeqUtil.create(val); --- 295,299 ---- } ! synchronized void opInsertAfter(int index, Object val, BareContent.Editor c) throws ConstraintFailure { CharSeq seq = CharSeqUtil.create(val); Index: memSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memSequenceContent.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** memSequenceContent.java 16 Nov 2004 19:25:35 -0000 1.70 --- memSequenceContent.java 16 Nov 2004 20:46:18 -0000 1.71 *************** *** 254,258 **** // Implementation of opSetValue from memContent ! void opSetValue(Object k, Object value, NodeContent.Editor c) throws ConstraintFailure { if (k instanceof Byte || k instanceof Short || k instanceof Integer) { --- 254,258 ---- // Implementation of opSetValue from memContent ! void opSetValue(Object k, Object value, BareContent.Editor c) throws ConstraintFailure { if (k instanceof Byte || k instanceof Short || k instanceof Integer) { *************** *** 266,285 **** throws IndexBoundsException; ! protected abstract Setter itemSetter(int i, NodeContent.Editor c, NodeManager mgr) throws IndexBoundsException; ! abstract void opSetItem(int i, Object val, NodeContent.Editor c) throws ConstraintFailure; abstract void opReplaceRange(int startIndex, int endIndex, Object val, ! NodeContent.Editor c) throws ConstraintFailure; ! abstract void opInsertBefore(int index, Object val, NodeContent.Editor c) throws ConstraintFailure; ! abstract void opInsertAfter(int index, Object val, NodeContent.Editor c) throws ConstraintFailure; ! final void opRemoveRange(int startIndex, int endIndex, NodeContent.Editor c) throws ConstraintFailure { checkRange(startIndex, endIndex); --- 266,285 ---- throws IndexBoundsException; ! protected abstract Setter itemSetter(int i, BareContent.Editor c, NodeManager mgr) throws IndexBoundsException; ! abstract void opSetItem(int i, Object val, BareContent.Editor c) throws Co... [truncated message content] |
From: Lee I. <le...@us...> - 2004-11-16 20:46:29
|
Update of /cvsroot/nodal/nodal/j-src/storage/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29271/storage/framework Modified Files: SimpleTxnBuilder.java AbstractRepository.java Log Message: Move seatNode into AbstractRepository.Backend interface and AbstractBackend implementation. Rename MemOperator to AbstractOperator in storage.memory. Index: SimpleTxnBuilder.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/SimpleTxnBuilder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SimpleTxnBuilder.java 12 Nov 2004 19:23:24 -0000 1.3 --- SimpleTxnBuilder.java 16 Nov 2004 20:46:19 -0000 1.4 *************** *** 30,34 **** import org.nodal.util.Name; ! import storage.memory.MemOperator; /** --- 30,34 ---- import org.nodal.util.Name; ! import storage.memory.AbstractOperator; /** *************** *** 143,147 **** */ public TxnOp addOpCreate(NodeContent newNode, Node ctx, NodeType t) { ! return addOp (newNode, MemOperator.createOpCreate(ctx, t)); } --- 143,147 ---- */ public TxnOp addOpCreate(NodeContent newNode, Node ctx, NodeType t) { ! return addOp (newNode, AbstractOperator.createOpCreate(ctx, t)); } *************** *** 150,154 **** */ public TxnOp addOpClone(NodeContent newNode, Node ctx, Node n) { ! return addOp (newNode, MemOperator.createOpClone(ctx, n)); } --- 150,154 ---- */ public TxnOp addOpClone(NodeContent newNode, Node ctx, Node n) { ! return addOp (newNode, AbstractOperator.createOpClone(ctx, n)); } *************** *** 157,161 **** */ public TxnOp addOpAnchor(AnchorNode newNode, Path path, Path context) { ! return addOp (newNode, MemOperator.createOpAnchor(path, context)); } --- 157,161 ---- */ public TxnOp addOpAnchor(AnchorNode newNode, Path path, Path context) { ! return addOp (newNode, AbstractOperator.createOpAnchor(path, context)); } *************** *** 164,168 **** */ public TxnOp addOpAnchor(AnchorNode newNode, Path absolute) { ! return addOp (newNode, MemOperator.createOpAnchor(absolute)); } --- 164,168 ---- */ public TxnOp addOpAnchor(AnchorNode newNode, Path absolute) { ! return addOp (newNode, AbstractOperator.createOpAnchor(absolute)); } *************** *** 171,175 **** */ public TxnOp addOpSetValue(NodeContent subj, Object k, Object v) { ! return addOp (subj, MemOperator.createOpSetValue(k, v)); } --- 171,175 ---- */ public TxnOp addOpSetValue(NodeContent subj, Object k, Object v) { ! return addOp (subj, AbstractOperator.createOpSetValue(k, v)); } *************** *** 178,182 **** */ public TxnOp addOpRemove(NodeContent subj, Object k) { ! return addOp (subj, MemOperator.createOpRemove(k)); } --- 178,182 ---- */ public TxnOp addOpRemove(NodeContent subj, Object k) { ! return addOp (subj, AbstractOperator.createOpRemove(k)); } *************** *** 185,189 **** */ public TxnOp addOpSetField(NodeContent subj, Name n, Object v) { ! return addOp (subj, MemOperator.createOpSetField(n, v)); } --- 185,189 ---- */ public TxnOp addOpSetField(NodeContent subj, Name n, Object v) { ! return addOp (subj, AbstractOperator.createOpSetField(n, v)); } *************** *** 192,196 **** */ public TxnOp addOpReplaceRange(NodeContent subj, int startIndex, int endIndex, Object v) { ! return addOp (subj, MemOperator.createOpReplaceRange(startIndex, endIndex, v)); } --- 192,196 ---- */ public TxnOp addOpReplaceRange(NodeContent subj, int startIndex, int endIndex, Object v) { ! return addOp (subj, AbstractOperator.createOpReplaceRange(startIndex, endIndex, v)); } *************** *** 199,203 **** */ public TxnOp addOpRemoveRange(NodeContent subj, int startIndex, int endIndex) { ! return addOp (subj, MemOperator.createOpRemoveRange(startIndex, endIndex)); } --- 199,203 ---- */ public TxnOp addOpRemoveRange(NodeContent subj, int startIndex, int endIndex) { ! return addOp (subj, AbstractOperator.createOpRemoveRange(startIndex, endIndex)); } *************** *** 206,210 **** */ public TxnOp addOpInsertBefore(NodeContent subj, int index, Object v) { ! return addOp (subj, MemOperator.createOpInsertBefore(index, v)); } --- 206,210 ---- */ public TxnOp addOpInsertBefore(NodeContent subj, int index, Object v) { ! return addOp (subj, AbstractOperator.createOpInsertBefore(index, v)); } *************** *** 213,217 **** */ public TxnOp addOpInsertAfter(NodeContent subj, int index, Object v) { ! return addOp (subj, MemOperator.createOpInsertAfter(index, v)); } --- 213,217 ---- */ public TxnOp addOpInsertAfter(NodeContent subj, int index, Object v) { ! return addOp (subj, AbstractOperator.createOpInsertAfter(index, v)); } *************** *** 220,224 **** */ public TxnOp addOpAdd(NodeContent subj, Object v) { ! return addOp (subj, MemOperator.createOpAdd(v)); } --- 220,224 ---- */ public TxnOp addOpAdd(NodeContent subj, Object v) { ! return addOp (subj, AbstractOperator.createOpAdd(v)); } Index: AbstractRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/AbstractRepository.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AbstractRepository.java 16 Nov 2004 19:25:34 -0000 1.16 --- AbstractRepository.java 16 Nov 2004 20:46:19 -0000 1.17 *************** *** 263,266 **** --- 263,276 ---- */ void commitTxn (TxnManager.Resolver resolver); + + /** + * Ensure that a reference to Node node can be stored within the associated + * AbstractRepository. + * + * @param node + * the Node being referenced + * @return a "seated" reference to the given Node + */ + Node seatNode (Node node); } *************** *** 338,341 **** --- 348,366 ---- } + public Node seatNode (Node node) { + // Make sure that we only use bareNode references. + if (node != null) { + // Only use direct Node references. + node = node.bareNode(); + // If we are not in the same Repository, then create an AnchorNode + // reference to the other Repository. + if (node.repository() != repo) { + node = createAnchor(node.path()); + System.out.println("Storing " + node + " in " + repo); + } + } + return node; + } + /** * Create a brand new Node with the given NodeType. The <tt>context</tt> |
From: Lee I. <le...@us...> - 2004-11-16 19:26:15
|
Update of /cvsroot/nodal/nodal/j-src/storage/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7750/storage/framework Modified Files: NodeFactoryFramework.java AbstractRepository.java SimpleTxnManager.java SBNStreamServices.java StreamBasedNode.java Removed Files: AbstractRepoBackend.java RepoBackend.java Log Message: Move RepoBackend and AbstractRepoBackend into AbstractRepository as Backend and AbstractBackend. Index: NodeFactoryFramework.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/NodeFactoryFramework.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NodeFactoryFramework.java 15 Nov 2004 19:21:57 -0000 1.2 --- NodeFactoryFramework.java 16 Nov 2004 19:25:34 -0000 1.3 *************** *** 18,24 **** * An interface that represents the basic framework for creating Node instances. * {@link BasicNodeFactory} is built on top of this interface, and at its most basic ! * it is provided by {@link RepoBackend} * @see BasicNodeFactory ! * @see RepoBackend * @author leei */ --- 18,24 ---- * An interface that represents the basic framework for creating Node instances. * {@link BasicNodeFactory} is built on top of this interface, and at its most basic ! * it is provided by {@link AbstractRepository.Backend} * @see BasicNodeFactory ! * @see AbstractRepository.Backend * @author leei */ --- RepoBackend.java DELETED --- Index: SimpleTxnManager.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/SimpleTxnManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SimpleTxnManager.java 15 Nov 2004 19:21:57 -0000 1.3 --- SimpleTxnManager.java 16 Nov 2004 19:25:35 -0000 1.4 *************** *** 32,49 **** */ public final class SimpleTxnManager implements TxnManager { ! public static TxnManager create(RepoBackend services, TxnBuilderFactory factory) { return new SimpleTxnManager(services, factory); } ! public static TxnManager create(RepoBackend services) { return create (services, SimpleTxnBuilder.factory()); } ! private final RepoBackend services; private final TxnBuilderFactory factory; private TxnBuilder current; ! private SimpleTxnManager(RepoBackend services, TxnBuilderFactory factory) { this.services = services; this.factory = factory; --- 32,49 ---- */ public final class SimpleTxnManager implements TxnManager { ! public static TxnManager create(AbstractRepository.Backend services, TxnBuilderFactory factory) { return new SimpleTxnManager(services, factory); } ! public static TxnManager create(AbstractRepository.Backend services) { return create (services, SimpleTxnBuilder.factory()); } ! private final AbstractRepository.Backend services; private final TxnBuilderFactory factory; private TxnBuilder current; ! private SimpleTxnManager(AbstractRepository.Backend services, TxnBuilderFactory factory) { this.services = services; this.factory = factory; --- AbstractRepoBackend.java DELETED --- Index: StreamBasedNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/StreamBasedNode.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** StreamBasedNode.java 15 Nov 2004 19:21:57 -0000 1.14 --- StreamBasedNode.java 16 Nov 2004 19:25:35 -0000 1.15 *************** *** 65,69 **** * @return the RepoBackend associated with this Document loading context */ ! RepoBackend repoServices(); /** --- 65,69 ---- * @return the RepoBackend associated with this Document loading context */ ! AbstractRepository.Backend repoBackend(); /** *************** *** 154,158 **** */ public Repository repository() { ! return services.repoServices().repository(); } --- 154,158 ---- */ public Repository repository() { ! return services.repoBackend().repository(); } Index: SBNStreamServices.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/SBNStreamServices.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SBNStreamServices.java 15 Nov 2004 19:21:57 -0000 1.8 --- SBNStreamServices.java 16 Nov 2004 19:25:35 -0000 1.9 *************** *** 24,31 **** protected final InputStream stream; protected final Path path; ! protected final RepoBackend svc; protected boolean reloading; ! public SBNStreamServices(RepoBackend svc, Path path, InputStream stream, String mimeType) throws IOException { super(svc, svc.txnManager()); --- 24,31 ---- protected final InputStream stream; protected final Path path; ! protected final AbstractRepository.Backend svc; protected boolean reloading; ! public SBNStreamServices(AbstractRepository.Backend svc, Path path, InputStream stream, String mimeType) throws IOException { super(svc, svc.txnManager()); *************** *** 50,54 **** * @see storage.framework.StreamBasedNode.LoadServices#repoServices() */ ! public RepoBackend repoServices() { return svc; } --- 50,54 ---- * @see storage.framework.StreamBasedNode.LoadServices#repoServices() */ ! public AbstractRepository.Backend repoBackend() { return svc; } Index: AbstractRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/AbstractRepository.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractRepository.java 15 Nov 2004 19:21:57 -0000 1.15 --- AbstractRepository.java 16 Nov 2004 19:25:34 -0000 1.16 *************** *** 14,23 **** --- 14,27 ---- import org.nodal.filesystem.Document; import org.nodal.filesystem.DocumentFormat; + import org.nodal.model.AnchorNode; import org.nodal.model.Node; + 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 org.nodal.util.Name; import org.nodal.util.Names; + import org.nodal.util.Namespace; import org.nodal.util.User; *************** *** 54,60 **** protected final Path path; ! protected AbstractRepoBackend backend; ! protected AbstractRepository(Path path, AbstractRepoBackend services) { this.path = path; this.backend = services; --- 58,64 ---- protected final Path path; ! protected AbstractBackend backend; ! protected AbstractRepository(Path path, AbstractBackend services) { this.path = path; this.backend = services; *************** *** 68,72 **** } ! protected final void setBackend(AbstractRepoBackend services) { // Ensure that it is only set once. if (this.backend != null && this.backend != services) { --- 72,76 ---- } ! protected final void setBackend(AbstractBackend services) { // Ensure that it is only set once. if (this.backend != null && this.backend != services) { *************** *** 76,80 **** } ! public final AbstractRepoBackend getBackend() { return backend; } --- 80,84 ---- } ! public final AbstractBackend getBackend() { return backend; } *************** *** 230,234 **** --- 234,364 ---- } } + + /** + * Basic facility for providing backend from a Repository to the + * storage.memory package facilities. This includes creating new Nodes and + * providing transaction management. + * + * @author Lee Iverson <le...@ec...> + */ + public interface Backend extends NodeFactoryFramework { + /** + * Return the Repository associated with these backend. + * @return the Repository providing these backend + */ + Repository repository(); + + /** + * A TxnManager if this Repository type creates an audit trail via the + * NodeHistory interface. + * @return a TxnManager or null + */ + TxnManager txnManager(); + + /** + * Notify the Repository that a Txn has been committed. + * + * Created on Oct 8, 2003 + * @author leei + */ + void commitTxn (TxnManager.Resolver resolver); + } + + /** + * This base class should be overriden to provide a facility for creating new + * Nodes. + * + * @author Lee Iverson <le...@ec...> + */ + public abstract static class AbstractBackend implements Backend { + protected final AbstractRepository repo; + protected final Store store; + protected final Path path; + protected final Namespace ns; + private int nextIdx; + + protected AbstractBackend(AbstractRepository repo, Path path, Store store) { + this.repo = repo; + this.store = store; + this.path = path; + this.ns = Names.getNamespace(path); + nextIdx = 0; + } + + protected AbstractBackend(AbstractRepository repo, Path path) { + this.repo = repo; + this.store = null; + this.path = path; + this.ns = Names.getNamespace(path); + nextIdx = 0; + } + + protected AbstractBackend(AbstractRepository repo) { + this.repo = repo; + this.store = null; + this.path = repo.path(); + this.ns = Names.getNamespace(path); + nextIdx = 0; + } + /** + * Create a new, unused node ID. + */ + public final synchronized Name createNodeID(Node node) { + // NEXT Get rid of this and the two-argument associateID method + Name nid = nextID(); + repo.associateID(nid, node); + return nid; + } + + public synchronized Name nextID() { + return ns.name("n" + (nextIdx++)); + } + + /** + * Recover a Node from a backing store. + */ + public final synchronized Node recoverNodeNamed(Name nid) { + // Recover from store + if (store != null) { + Node node = store.recoverNode(nid); + if (node != null) { + repo.associateID(node); + } + return node; + } + return null; + } + + /** + * Return the Repository associated with these backend. + */ + public final Repository repository() { + return repo; + } + + /** + * Create a brand new Node with the given NodeType. The <tt>context</tt> + * Node determines the base metadata for the new Node, including permissions + * and versioning. + */ + public abstract NodeContent.Editor createNode(NodeType type, Node context); + + /** + * Clone a brand new Node copying the content from an existing Node. The + * <tt>context</tt> Node determines the base metadata for the new Node, + * including permissions and versioning. + */ + public abstract NodeContent.Editor cloneNode(Node node, Node context); + + public abstract AnchorNode createAnchor(Path context, Path rel); + + public abstract AnchorNode createAnchor(Path abs); + + /** + * Return the TxnManager used by this Repository. + */ + public abstract TxnManager txnManager(); + } /** * Remember the association between a Node and its id(). If the id() is a |
From: Lee I. <le...@us...> - 2004-11-16 19:26:04
|
Update of /cvsroot/nodal/nodal/j-src/storage/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7750/storage/memory Modified Files: BareSet.java BareMap.java memSetContent.java BareContent.java memSequenceContent.java memContent.java memRecordContent.java BareRecord.java memMapContent.java BareSequence.java Log Message: Move RepoBackend and AbstractRepoBackend into AbstractRepository as Backend and AbstractBackend. Index: memSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memSequenceContent.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** memSequenceContent.java 15 Nov 2004 19:21:58 -0000 1.69 --- memSequenceContent.java 16 Nov 2004 19:25:35 -0000 1.70 *************** *** 82,106 **** } } ! public boolean contains(Object obj) { ! int index = indexOf (obj); return index >= 0; } ! public boolean contains (Object v, int st, int en) { ! int idx = indexOf (v, st, en); return idx != -1; } ! ! public final int indexOf (Object v) { ! return indexOf (v, 0, -1); } ! ! protected abstract int indexOf (Object v, int st, int en); ! /** * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend f) { return new MyNodeContent(n, cap, f); } --- 82,107 ---- } } ! public boolean contains(Object obj) { ! int index = indexOf(obj); return index >= 0; } ! public boolean contains(Object v, int st, int en) { ! int idx = indexOf(v, st, en); return idx != -1; } ! ! public final int indexOf(Object v) { ! return indexOf(v, 0, -1); } ! ! protected abstract int indexOf(Object v, int st, int en); ! /** * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, ! AbstractRepository.Backend f) { return new MyNodeContent(n, cap, f); } *************** *** 109,113 **** private SequenceNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memSequenceContent.this, cap, f); editor = null; --- 110,114 ---- private SequenceNode.Editor editor; ! MyNodeContent(Node n, Capability cap, AbstractRepository.Backend f) { super(n, memSequenceContent.this, cap, f); editor = null; *************** *** 229,233 **** throw new IndexBoundsException(i, -sz, sz - 1, "index out of range"); } ! return normalizeIndex (i); } --- 230,234 ---- throw new IndexBoundsException(i, -sz, sz - 1, "index out of range"); } ! return normalizeIndex(i); } *************** *** 658,662 **** public boolean indexIsValid(int i) { ! return seq.indexIsValid (relIndex(i)); } --- 659,663 ---- public boolean indexIsValid(int i) { ! return seq.indexIsValid(relIndex(i)); } *************** *** 673,677 **** int st2 = relIndex(start2); int en2 = relIndex(end2); ! return seq.range (st2, en2, c); } --- 674,678 ---- int st2 = relIndex(start2); int en2 = relIndex(end2); ! return seq.range(st2, en2, c); } *************** *** 683,687 **** int idx = seq.indexOf(obj, start, end); if (idx >= 0) { ! return idx-seq.normalizeIndex(start); } return idx; --- 684,688 ---- int idx = seq.indexOf(obj, start, end); if (idx >= 0) { ! return idx - seq.normalizeIndex(start); } return idx; Index: BareSet.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareSet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BareSet.java 15 Nov 2004 19:21:57 -0000 1.2 --- BareSet.java 16 Nov 2004 19:25:35 -0000 1.3 *************** *** 15,19 **** import org.nodal.model.SetNode; import org.nodal.security.Capability; ! import storage.framework.RepoBackend; public abstract class BareSet extends BareContent implements SetNode { --- 15,19 ---- import org.nodal.model.SetNode; import org.nodal.security.Capability; ! import storage.framework.AbstractRepository; public abstract class BareSet extends BareContent implements SetNode { *************** *** 21,25 **** protected SetNode.Editor editSet; ! BareSet(Node n, memSetContent s, Capability cap, RepoBackend f) { super(n, s, cap, f); set = s; --- 21,25 ---- protected SetNode.Editor editSet; ! BareSet(Node n, memSetContent s, Capability cap, AbstractRepository.Backend f) { super(n, s, cap, f); set = s; Index: BareContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareContent.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** BareContent.java 15 Nov 2004 19:21:57 -0000 1.30 --- BareContent.java 16 Nov 2004 19:25:35 -0000 1.31 *************** *** 39,52 **** import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.RepoBackend; public abstract class BareContent extends NodeFilter implements NodeContent { protected final Capability cap; protected final MemContentI c; ! protected final RepoBackend backend; protected List txnHandlers; protected BareContent(Node n, memContent c, Capability cap, ! RepoBackend backend) { super(n); this.c = c; --- 39,52 ---- import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.AbstractRepository; public abstract class BareContent extends NodeFilter implements NodeContent { protected final Capability cap; protected final MemContentI c; ! protected final AbstractRepository.Backend backend; protected List txnHandlers; protected BareContent(Node n, memContent c, Capability cap, ! AbstractRepository.Backend backend) { super(n); this.c = c; Index: BareMap.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareMap.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** BareMap.java 15 Nov 2004 19:21:58 -0000 1.15 --- BareMap.java 16 Nov 2004 19:25:35 -0000 1.16 *************** *** 17,21 **** import org.nodal.security.Capability; ! import storage.framework.*; public abstract class BareMap extends BareContent implements MapNode { --- 17,21 ---- import org.nodal.security.Capability; ! import storage.framework.AbstractRepository; public abstract class BareMap extends BareContent implements MapNode { *************** *** 23,27 **** protected MapNode.Editor editMap; ! BareMap(Node n, memMapContent m, Capability cap, RepoBackend f) { super(n, m, cap, f); map = m; --- 23,27 ---- protected MapNode.Editor editMap; ! BareMap(Node n, memMapContent m, Capability cap, AbstractRepository.Backend f) { super(n, m, cap, f); map = m; Index: memRecordContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memRecordContent.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** memRecordContent.java 15 Nov 2004 19:21:57 -0000 1.64 --- memRecordContent.java 16 Nov 2004 19:25:35 -0000 1.65 *************** *** 35,39 **** import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoBackend; /** --- 35,39 ---- import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.AbstractRepository; /** *************** *** 119,123 **** * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend f) { return new MyNodeContent(n, cap, f); } --- 119,123 ---- * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, AbstractRepository.Backend f) { return new MyNodeContent(n, cap, f); } *************** *** 126,130 **** private RecordNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memRecordContent.this, cap, f); editor = null; --- 126,130 ---- private RecordNode.Editor editor; ! MyNodeContent(Node n, Capability cap, AbstractRepository.Backend f) { super(n, memRecordContent.this, cap, f); editor = null; Index: memContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memContent.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** memContent.java 15 Nov 2004 19:21:57 -0000 1.34 --- memContent.java 16 Nov 2004 19:25:35 -0000 1.35 *************** *** 34,38 **** import storage.framework.EdgeIndex; ! import storage.framework.RepoBackend; /** --- 34,38 ---- import storage.framework.EdgeIndex; ! import storage.framework.AbstractRepository; /** *************** *** 255,261 **** */ protected abstract NodeContent createNodeContent(Node n, Capability cap, ! RepoBackend s); ! public NodeContent.Editor initEdit(Node n, RepoBackend f) { // TODO Find some way to disable this after commit() return createNodeContent(n, CapabilityImpl.createInit(), f).edit(); --- 255,261 ---- */ protected abstract NodeContent createNodeContent(Node n, Capability cap, ! AbstractRepository.Backend s); ! public NodeContent.Editor initEdit(Node n, AbstractRepository.Backend f) { // TODO Find some way to disable this after commit() return createNodeContent(n, CapabilityImpl.createInit(), f).edit(); *************** *** 275,279 **** * @return a NodeContent object or null if not allowed */ ! public NodeContent nodeContent(Node n, RepoBackend f, Capability cap) { // Use the bareNode for all indexing etc. n = n.bareNode(); --- 275,279 ---- * @return a NodeContent object or null if not allowed */ ! public NodeContent nodeContent(Node n, AbstractRepository.Backend backend, Capability cap) { // Use the bareNode for all indexing etc. n = n.bareNode(); *************** *** 287,291 **** NodeContent c = (canonical ? findNodeContent(n) : null); if (c == null) { ! c = createNodeContent(n, cap, f); rememberNodeContent(c, canonical); } --- 287,291 ---- NodeContent c = (canonical ? findNodeContent(n) : null); if (c == null) { ! c = createNodeContent(n, cap, backend); rememberNodeContent(c, canonical); } Index: BareRecord.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareRecord.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** BareRecord.java 15 Nov 2004 19:21:58 -0000 1.21 --- BareRecord.java 16 Nov 2004 19:25:36 -0000 1.22 *************** *** 19,23 **** import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.RepoBackend; //import java.util.Enumeration; --- 19,23 ---- import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.AbstractRepository; //import java.util.Enumeration; *************** *** 26,30 **** protected final MemRecordContentI record; ! BareRecord(Node n, memRecordContent r, Capability cap, RepoBackend f) { super(n, r, cap, f); record = r; --- 26,30 ---- protected final MemRecordContentI record; ! BareRecord(Node n, memRecordContent r, Capability cap, AbstractRepository.Backend f) { super(n, r, cap, f); record = r; Index: BareSequence.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareSequence.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** BareSequence.java 15 Nov 2004 19:21:58 -0000 1.23 --- BareSequence.java 16 Nov 2004 19:25:36 -0000 1.24 *************** *** 17,21 **** import org.nodal.util.IndexBoundsException; import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.*; //import java.util.Enumeration; --- 17,21 ---- import org.nodal.util.IndexBoundsException; import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.AbstractRepository; //import java.util.Enumeration; *************** *** 23,27 **** protected final MemSequenceContentI seq; ! BareSequence(Node n, memSequenceContent s, Capability cap, RepoBackend f) { super(n, s, cap, f); seq = s; --- 23,27 ---- protected final MemSequenceContentI seq; ! BareSequence(Node n, memSequenceContent s, Capability cap, AbstractRepository.Backend f) { super(n, s, cap, f); seq = s; Index: memSetContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memSetContent.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** memSetContent.java 15 Nov 2004 19:21:58 -0000 1.6 --- memSetContent.java 16 Nov 2004 19:25:35 -0000 1.7 *************** *** 34,38 **** import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoBackend; /** --- 34,38 ---- import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.AbstractRepository; /** *************** *** 70,74 **** private SetNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memSetContent.this, cap, f); editor = null; --- 70,74 ---- private SetNode.Editor editor; ! MyNodeContent(Node n, Capability cap, AbstractRepository.Backend f) { super(n, memSetContent.this, cap, f); editor = null; *************** *** 232,236 **** protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, RepoBackend f) { super(content); this.content = content; --- 232,236 ---- protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, AbstractRepository.Backend f) { super(content); this.content = content; *************** *** 317,321 **** } ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend s) { return new MyNodeContent(n, cap, s); } --- 317,321 ---- } ! protected NodeContent createNodeContent(Node n, Capability cap, AbstractRepository.Backend s) { return new MyNodeContent(n, cap, s); } Index: memMapContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memMapContent.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** memMapContent.java 15 Nov 2004 19:21:57 -0000 1.60 --- memMapContent.java 16 Nov 2004 19:25:36 -0000 1.61 *************** *** 33,37 **** import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoBackend; /** --- 33,37 ---- import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.AbstractRepository; /** *************** *** 68,72 **** } ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend s) { return new MyNodeContent(n, cap, s); } --- 68,72 ---- } ! protected NodeContent createNodeContent(Node n, Capability cap, AbstractRepository.Backend s) { return new MyNodeContent(n, cap, s); } *************** *** 75,79 **** private MapNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memMapContent.this, cap, f); editor = null; --- 75,79 ---- private MapNode.Editor editor; ! MyNodeContent(Node n, Capability cap, AbstractRepository.Backend f) { super(n, memMapContent.this, cap, f); editor = null; *************** *** 233,237 **** protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, RepoBackend f) { super(content); this.content = content; --- 233,237 ---- protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, AbstractRepository.Backend f) { super(content); this.content = content; |
From: Lee I. <le...@us...> - 2004-11-16 19:26:01
|
Update of /cvsroot/nodal/nodal/j-src/storage/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7750/storage/file Modified Files: FileRepository.java FileNode.java FileDocument.java Log Message: Move RepoBackend and AbstractRepoBackend into AbstractRepository as Backend and AbstractBackend. Index: FileNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileNode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FileNode.java 15 Nov 2004 19:22:00 -0000 1.9 --- FileNode.java 16 Nov 2004 19:25:36 -0000 1.10 *************** *** 20,24 **** import org.nodal.util.Name; import storage.framework.AbstractNode; ! import storage.framework.RepoBackend; import storage.memory.memContent; --- 20,24 ---- import org.nodal.util.Name; import storage.framework.AbstractNode; ! import storage.framework.AbstractRepository; import storage.memory.memContent; *************** *** 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); --- 48,52 ---- * @return a new FileNode */ ! static NodeContent.Editor createNode(AbstractRepository.Backend 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(RepoBackend 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(AbstractRepository.Backend 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(RepoBackend 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(AbstractRepository.Backend services, Path docPath, Name id, Node node, FileNode fcontext) { memContent c = memContent.ingest(node.content()); Index: FileRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileRepository.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** FileRepository.java 15 Nov 2004 19:21:59 -0000 1.28 --- FileRepository.java 16 Nov 2004 19:25:36 -0000 1.29 *************** *** 25,29 **** import org.nodal.type.NodeType; import org.nodal.util.CacheMap; - import storage.framework.AbstractRepoBackend; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; --- 25,28 ---- *************** *** 45,49 **** * @author leei */ ! static class Backend extends AbstractRepoBackend { private FileRepository frepo; private TxnManager txnManager; --- 44,48 ---- * @author leei */ ! static class Backend extends AbstractBackend { private FileRepository frepo; private TxnManager txnManager; Index: FileDocument.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/file/FileDocument.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** FileDocument.java 15 Nov 2004 19:22:00 -0000 1.20 --- FileDocument.java 16 Nov 2004 19:25:36 -0000 1.21 *************** *** 30,34 **** import storage.framework.AbstractRepository; import storage.framework.DocFromNode; - import storage.framework.RepoBackend; import storage.framework.StreamBasedNode; import storage.framework.TxnManager; --- 30,33 ---- *************** *** 162,166 **** } ! public RepoBackend repoServices() { return svc; } --- 161,165 ---- } ! public AbstractRepository.Backend repoBackend() { return svc; } |
From: Lee I. <le...@us...> - 2004-11-16 19:26:00
|
Update of /cvsroot/nodal/nodal/j-src/storage/trans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7750/storage/trans Modified Files: TransientRepository.java Log Message: Move RepoBackend and AbstractRepoBackend into AbstractRepository as Backend and AbstractBackend. Index: TransientRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/trans/TransientRepository.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** TransientRepository.java 15 Nov 2004 19:21:58 -0000 1.34 --- TransientRepository.java 16 Nov 2004 19:25:37 -0000 1.35 *************** *** 27,31 **** import storage.framework.AbstractDocument; - import storage.framework.AbstractRepoBackend; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; --- 27,30 ---- *************** *** 57,61 **** // Have to delay this since can't refer to this in super constructor boolean isAudited = audited.isAncestorOf(path); ! this.setBackend(new Services(this, isAudited)); //System.err.println("Create " + this); --- 56,60 ---- // Have to delay this since can't refer to this in super constructor boolean isAudited = audited.isAncestorOf(path); ! this.setBackend(new Backend(this, isAudited)); //System.err.println("Create " + this); *************** *** 78,85 **** * TransientRepository. */ ! private static final class Services extends AbstractRepoBackend { private TxnManager txnManager; ! Services(TransientRepository repo, boolean audited) { // No Store! super(repo, null); --- 77,84 ---- * TransientRepository. */ ! private static final class Backend extends AbstractBackend { private TxnManager txnManager; ! Backend(TransientRepository repo, boolean audited) { // No Store! super(repo, null); |
From: Lee I. <le...@us...> - 2004-11-16 19:25:50
|
Update of /cvsroot/nodal/nodal/j-src/storage/jar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7750/storage/jar Modified Files: JarRepository.java Log Message: Move RepoBackend and AbstractRepoBackend into AbstractRepository as Backend and AbstractBackend. Index: JarRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/jar/JarRepository.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** JarRepository.java 15 Nov 2004 19:21:59 -0000 1.11 --- JarRepository.java 16 Nov 2004 19:25:38 -0000 1.12 *************** *** 27,31 **** import org.nodal.util.Names; import org.nodal.util.Namespace; ! import storage.framework.AbstractRepoBackend; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; --- 27,31 ---- import org.nodal.util.Names; import org.nodal.util.Namespace; ! import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; *************** *** 53,57 **** // TODO Treat a whole JAR file as a Repository super(path, null); ! setBackend(new Services()); this.url = new URL(path.toURLString()); this.connection = (JarURLConnection) url.openConnection(); --- 53,57 ---- // TODO Treat a whole JAR file as a Repository super(path, null); ! setBackend(new Backend()); this.url = new URL(path.toURLString()); this.connection = (JarURLConnection) url.openConnection(); *************** *** 60,65 **** } ! class Services extends AbstractRepoBackend { ! private Services() { super(JarRepository.this, null); } --- 60,65 ---- } ! class Backend extends AbstractBackend { ! private Backend() { super(JarRepository.this, null); } |
From: Lee I. <le...@us...> - 2004-11-16 19:25:50
|
Update of /cvsroot/nodal/nodal/j-src/storage/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7750/storage/http Modified Files: HttpRepository.java Log Message: Move RepoBackend and AbstractRepoBackend into AbstractRepository as Backend and AbstractBackend. Index: HttpRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/http/HttpRepository.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** HttpRepository.java 15 Nov 2004 19:21:58 -0000 1.15 --- HttpRepository.java 16 Nov 2004 19:25:37 -0000 1.16 *************** *** 25,29 **** import org.nodal.util.Namespace; - import storage.framework.AbstractRepoBackend; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; --- 25,28 ---- *************** *** 44,48 **** * @author leei */ ! private final class Services extends AbstractRepoBackend { /** --- 43,47 ---- * @author leei */ ! private final class Backend extends AbstractBackend { /** *************** *** 50,54 **** * @param store */ ! protected Services() { super(HttpRepository.this, null, null); } --- 49,53 ---- * @param store */ ! protected Backend() { super(HttpRepository.this, null, null); } *************** *** 101,105 **** HttpRepository(Path path) throws IOException { super(path, null); ! setBackend(new Services()); this.url = new URL(path.toURLString()); HttpURLConnection.setFollowRedirects(true); --- 100,104 ---- HttpRepository(Path path) throws IOException { super(path, null); ! setBackend(new Backend()); this.url = new URL(path.toURLString()); HttpURLConnection.setFollowRedirects(true); |
From: Lee I. <le...@us...> - 2004-11-15 19:22:20
|
Update of /cvsroot/nodal/nodal/j-src/storage/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4642/storage/memory Modified Files: BareSet.java BareContent.java memContent.java memRecordContent.java memMapContent.java BareMap.java memSetContent.java memSequenceContent.java BareRecord.java BareSequence.java Log Message: Change name of RepoServices to RepoBackend throughout. o update references and field and method names Index: memSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memSequenceContent.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** memSequenceContent.java 15 Jul 2004 04:47:57 -0000 1.68 --- memSequenceContent.java 15 Nov 2004 19:21:58 -0000 1.69 *************** *** 102,106 **** * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, RepoServices f) { return new MyNodeContent(n, cap, f); } --- 102,106 ---- * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend f) { return new MyNodeContent(n, cap, f); } *************** *** 109,113 **** private SequenceNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoServices f) { super(n, memSequenceContent.this, cap, f); editor = null; --- 109,113 ---- private SequenceNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memSequenceContent.this, cap, f); editor = null; Index: BareSet.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareSet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BareSet.java 19 Apr 2004 23:59:18 -0000 1.1 --- BareSet.java 15 Nov 2004 19:21:57 -0000 1.2 *************** *** 15,19 **** import org.nodal.model.SetNode; import org.nodal.security.Capability; ! import storage.framework.RepoServices; public abstract class BareSet extends BareContent implements SetNode { --- 15,19 ---- import org.nodal.model.SetNode; import org.nodal.security.Capability; ! import storage.framework.RepoBackend; public abstract class BareSet extends BareContent implements SetNode { *************** *** 21,25 **** protected SetNode.Editor editSet; ! BareSet(Node n, memSetContent s, Capability cap, RepoServices f) { super(n, s, cap, f); set = s; --- 21,25 ---- protected SetNode.Editor editSet; ! BareSet(Node n, memSetContent s, Capability cap, RepoBackend f) { super(n, s, cap, f); set = s; Index: BareContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareContent.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** BareContent.java 12 Nov 2004 19:23:25 -0000 1.29 --- BareContent.java 15 Nov 2004 19:21:57 -0000 1.30 *************** *** 1,9 **** /* ! * ! * Distributed under the Apache Software License, Version 1.1 ! * (see below, or the file LICENSE for terms and conditions) ! * ! * Copyright (c) 2002 University of British Columbia. All rights reserved. ! * */ --- 1,9 ---- /* ! * ! * Distributed under the Apache Software License, Version 1.1 (see below, or the ! * file LICENSE for terms and conditions) ! * ! * Copyright (c) 2002 University of British Columbia. All rights reserved. ! * */ *************** *** 39,59 **** import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.RepoServices; public abstract class BareContent extends NodeFilter implements NodeContent { protected final Capability cap; protected final MemContentI c; ! protected final RepoServices services; protected List txnHandlers; ! protected BareContent( ! Node n, ! memContent c, ! Capability cap, ! RepoServices repoServices) { super(n); this.c = c; this.cap = cap; ! this.services = repoServices; } --- 39,56 ---- import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.RepoBackend; public abstract class BareContent extends NodeFilter implements NodeContent { protected final Capability cap; protected final MemContentI c; ! protected final RepoBackend backend; protected List txnHandlers; ! protected BareContent(Node n, memContent c, Capability cap, ! RepoBackend backend) { super(n); this.c = c; this.cap = cap; ! this.backend = backend; } *************** *** 62,79 **** return cap; } ! public NodeContent content() { return this; } ! public Type type () { return node.nodeType(); } ! ! public Type propertyType () { return node.nodeType().propertyType(); } ! ! public Type valueType (Object property) { return node.nodeType().valueType(property); } --- 59,76 ---- return cap; } ! public NodeContent content() { return this; } ! public Type type() { return node.nodeType(); } ! ! public Type propertyType() { return node.nodeType().propertyType(); } ! ! public Type valueType(Object property) { return node.nodeType().valueType(property); } *************** *** 105,108 **** --- 102,106 ---- } } + protected void notifyInsertBefore(int index, Object value) { if (txnHandlers != null) { *************** *** 114,117 **** --- 112,116 ---- } } + protected void notifyAdd(Object val) { if (txnHandlers != null) { *************** *** 123,126 **** --- 122,126 ---- } } + protected void notifyRemove(Object key) { if (txnHandlers != null) { *************** *** 132,135 **** --- 132,136 ---- } } + protected void notifyRemoveRange(int start, int end) { if (txnHandlers != null) { *************** *** 141,144 **** --- 142,146 ---- } } + protected void notifyReplaceRange(int start, int end, Object seq) { if (txnHandlers != null) { *************** *** 150,153 **** --- 152,156 ---- } } + protected void notifySetValue(Object property, Object value) { if (txnHandlers != null) { *************** *** 164,167 **** --- 167,171 ---- return c.size(); } + public Iterator properties() { return c.properties(); *************** *** 176,181 **** } ! public Operator invert(Operator op) ! throws InvalidOperator, ConstraintFailure { return c.invert((MemOperator) op, this); } --- 180,184 ---- } ! public Operator invert(Operator op) throws InvalidOperator, ConstraintFailure { return c.invert((MemOperator) op, this); } *************** *** 185,194 **** --- 188,200 ---- return null; } + public RecordNode asRecordNode() { return null; } + public SequenceNode asSequenceNode() { return null; } + public SetNode asSetNode() { return null; *************** *** 198,204 **** public abstract NodeContent.Editor edit(); ! public abstract static class Editor ! extends NodeFilter ! implements NodeContent.Editor { protected final BareContent content; protected final NodeManager nodeMgr; --- 204,210 ---- public abstract NodeContent.Editor edit(); ! public abstract static class Editor extends NodeFilter ! implements ! NodeContent.Editor { protected final BareContent content; protected final NodeManager nodeMgr; *************** *** 207,212 **** super(content.node); this.content = content; ! if (content.services.txnManager() != null) { ! this.nodeMgr = new NodeManager(content, content.services.txnManager()); } else { nodeMgr = null; --- 213,218 ---- super(content.node); this.content = content; ! if (content.backend.txnManager() != null) { ! this.nodeMgr = new NodeManager(content, content.backend.txnManager()); } else { nodeMgr = null; *************** *** 218,244 **** return content; } public final NodeType nodeType() { return content.nodeType(); } public final Type propertyType() { return nodeType().propertyType(); } ! public final Type valueType (Object property) { return nodeType().valueType(property); } ! // Methods from Content public final Type type() { return content.type(); } public final int size() { return content.size(); } public final Iterator properties() { return content.properties(); } public boolean isValidProperty(Object property) { return content.isValidProperty(property); } public Getter value(Object obj) throws PropertyConstraintFailure { return content.value(obj); --- 224,257 ---- return content; } + public final NodeType nodeType() { return content.nodeType(); } + public final Type propertyType() { return nodeType().propertyType(); } ! ! public final Type valueType(Object property) { return nodeType().valueType(property); } ! // Methods from Content public final Type type() { return content.type(); } + public final int size() { return content.size(); } + public final Iterator properties() { return content.properties(); } + public boolean isValidProperty(Object property) { return content.isValidProperty(property); } + public Getter value(Object obj) throws PropertyConstraintFailure { return content.value(obj); *************** *** 249,254 **** } ! public final Operator invert(Operator op) ! throws InvalidOperator, ConstraintFailure { return content.invert((MemOperator) op); } --- 262,267 ---- } ! public final Operator invert(Operator op) throws InvalidOperator, ! ConstraintFailure { return content.invert((MemOperator) op); } *************** *** 267,273 **** --- 280,288 ---- return null; } + public RecordNode asRecordNode() { return null; } + public SequenceNode asSequenceNode() { return null; *************** *** 276,280 **** // Methods from NodeFactory public final NodeContent.Editor createNode(NodeType type) { ! NodeContent.Editor newNode = content.services.createNode(type, this.node); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); --- 291,295 ---- // Methods from NodeFactory public final NodeContent.Editor createNode(NodeType type) { ! NodeContent.Editor newNode = content.backend.createNode(type, this.node); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); *************** *** 285,289 **** public final NodeContent.Editor createNode(NodeType type, Node context) { ! NodeContent.Editor newNode = content.services.createNode(type, context); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); --- 300,304 ---- public final NodeContent.Editor createNode(NodeType type, Node context) { ! NodeContent.Editor newNode = content.backend.createNode(type, context); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); *************** *** 294,301 **** public final NodeContent.Editor cloneNode(Node node) { ! NodeContent.Editor newNode = content.services.cloneNode(node, this.node); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpClone (newNode, node, this.node); } return newNode; --- 309,316 ---- public final NodeContent.Editor cloneNode(Node node) { ! NodeContent.Editor newNode = content.backend.cloneNode(node, this.node); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpClone(newNode, node, this.node); } return newNode; *************** *** 303,310 **** public final NodeContent.Editor cloneNode(Node node, Node context) { ! NodeContent.Editor newNode = content.services.cloneNode(node, context); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpClone (newNode, node, context); } return newNode; --- 318,325 ---- public final NodeContent.Editor cloneNode(Node node, Node context) { ! NodeContent.Editor newNode = content.backend.cloneNode(node, context); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpClone(newNode, node, context); } return newNode; *************** *** 312,319 **** public final AnchorNode createAnchor(Path context, Path rel) { ! AnchorNode newNode = content.services.createAnchor(context, rel); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpAnchor (newNode, context, rel); } return newNode; --- 327,334 ---- public final AnchorNode createAnchor(Path context, Path rel) { ! AnchorNode newNode = content.backend.createAnchor(context, rel); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpAnchor(newNode, context, rel); } return newNode; *************** *** 321,328 **** public final AnchorNode createAnchor(Path abs) { ! AnchorNode newNode = content.services.createAnchor(abs); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpAnchor (newNode, abs); } return newNode; --- 336,343 ---- public final AnchorNode createAnchor(Path abs) { ! AnchorNode newNode = content.backend.createAnchor(abs); if (nodeMgr != null) { TxnBuilder txnBuilder = nodeMgr.builder(); ! txnBuilder.addOpAnchor(newNode, abs); } return newNode; *************** *** 331,336 **** // Methods from NodeEditor ! public NodeContent.Editor apply(Operator op) ! throws InvalidOperator, ConstraintFailure { if (op instanceof CreateOp) { return applyCreateOp((CreateOp) op); --- 346,351 ---- // Methods from NodeEditor ! public NodeContent.Editor apply(Operator op) throws InvalidOperator, ! ConstraintFailure { if (op instanceof CreateOp) { return applyCreateOp((CreateOp) op); *************** *** 372,389 **** // Abstract methods public abstract Setter setValue(Object key) ! throws PropertyConstraintFailure; public NodeContent.Editor edit() { return this; } public MapNode.Editor editMap() { return null; } public RecordNode.Editor editRecord() { return null; } public SetNode.Editor editSet() { return null; } public SequenceNode.Editor editSequence() { return null; --- 387,408 ---- // Abstract methods public abstract Setter setValue(Object key) ! throws PropertyConstraintFailure; public NodeContent.Editor edit() { return this; } + public MapNode.Editor editMap() { return null; } + public RecordNode.Editor editRecord() { return null; } + public SetNode.Editor editSet() { return null; } + public SequenceNode.Editor editSequence() { return null; Index: BareMap.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareMap.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** BareMap.java 19 Mar 2004 00:24:44 -0000 1.14 --- BareMap.java 15 Nov 2004 19:21:58 -0000 1.15 *************** *** 23,27 **** protected MapNode.Editor editMap; ! BareMap(Node n, memMapContent m, Capability cap, RepoServices f) { super(n, m, cap, f); map = m; --- 23,27 ---- protected MapNode.Editor editMap; ! BareMap(Node n, memMapContent m, Capability cap, RepoBackend f) { super(n, m, cap, f); map = m; Index: memRecordContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memRecordContent.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** memRecordContent.java 13 May 2004 19:39:16 -0000 1.63 --- memRecordContent.java 15 Nov 2004 19:21:57 -0000 1.64 *************** *** 35,39 **** import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoServices; /** --- 35,39 ---- import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoBackend; /** *************** *** 119,123 **** * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, RepoServices f) { return new MyNodeContent(n, cap, f); } --- 119,123 ---- * Called by BareNode to create a NodeContent object. */ ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend f) { return new MyNodeContent(n, cap, f); } *************** *** 126,130 **** private RecordNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoServices f) { super(n, memRecordContent.this, cap, f); editor = null; --- 126,130 ---- private RecordNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memRecordContent.this, cap, f); editor = null; Index: memContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memContent.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** memContent.java 15 Nov 2004 18:51:03 -0000 1.33 --- memContent.java 15 Nov 2004 19:21:57 -0000 1.34 *************** *** 34,38 **** import storage.framework.EdgeIndex; ! import storage.framework.RepoServices; /** --- 34,38 ---- import storage.framework.EdgeIndex; ! import storage.framework.RepoBackend; /** *************** *** 48,52 **** protected final Set allContents; // NEXT Should this be Repo-based? ! private static final EdgeIndex globalIndex = EdgeIndex.create (); protected memContent() { --- 48,52 ---- protected final Set allContents; // NEXT Should this be Repo-based? ! private static final EdgeIndex globalIndex = EdgeIndex.create(); protected memContent() { *************** *** 244,248 **** /** * Create a NodeContent object with the memContent, and the given Node, ! * Capability, and RepoServices. * * @param n --- 244,248 ---- /** * Create a NodeContent object with the memContent, and the given Node, ! * Capability, and RepoBackend. * * @param n *************** *** 251,261 **** * a Capability restricting access to operations * @param s ! * the RepoServices needed to manage Txns and create Nodes * @return a new NodeContent object */ protected abstract NodeContent createNodeContent(Node n, Capability cap, ! RepoServices s); ! public NodeContent.Editor initEdit(Node n, RepoServices f) { // TODO Find some way to disable this after commit() return createNodeContent(n, CapabilityImpl.createInit(), f).edit(); --- 251,261 ---- * a Capability restricting access to operations * @param s ! * the RepoBackend needed to manage Txns and create Nodes * @return a new NodeContent object */ protected abstract NodeContent createNodeContent(Node n, Capability cap, ! RepoBackend s); ! public NodeContent.Editor initEdit(Node n, RepoBackend f) { // TODO Find some way to disable this after commit() return createNodeContent(n, CapabilityImpl.createInit(), f).edit(); *************** *** 264,280 **** /** * Maybe create a NodeContent object that matches this memContent with the ! * given Node. We require the Node, a set of RepoServices and an optional * Capability. * * @param n * the Node that this content is associated with ! * @param services ! * a set of RepoServices for handling Node creation and Txn ! * management * @param cap * a Capability restricting access (or null for default). * @return a NodeContent object or null if not allowed */ ! public NodeContent nodeContent(Node n, RepoServices f, Capability cap) { // Use the bareNode for all indexing etc. n = n.bareNode(); --- 264,279 ---- /** * Maybe create a NodeContent object that matches this memContent with the ! * given Node. We require the Node, a set of RepoBackend and an optional * Capability. * * @param n * the Node that this content is associated with ! * @param backend ! * a set of RepoBackend for handling Node creation and Txn management * @param cap * a Capability restricting access (or null for default). * @return a NodeContent object or null if not allowed */ ! public NodeContent nodeContent(Node n, RepoBackend f, Capability cap) { // Use the bareNode for all indexing etc. n = n.bareNode(); *************** *** 336,340 **** protected Node assignNode(NodeContent.Editor c, Object property, Node node) { node = seatNode(c, node); ! globalIndex.add (c.content(), property, node.bareNode()); return node; } --- 335,339 ---- protected Node assignNode(NodeContent.Editor c, Object property, Node node) { node = seatNode(c, node); ! globalIndex.add(c.content(), property, node); return node; } Index: BareRecord.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareRecord.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** BareRecord.java 19 Mar 2004 00:24:44 -0000 1.20 --- BareRecord.java 15 Nov 2004 19:21:58 -0000 1.21 *************** *** 19,23 **** import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.RepoServices; //import java.util.Enumeration; --- 19,23 ---- import org.nodal.util.PropertyConstraintFailure; ! import storage.framework.RepoBackend; //import java.util.Enumeration; *************** *** 26,30 **** protected final MemRecordContentI record; ! BareRecord(Node n, memRecordContent r, Capability cap, RepoServices f) { super(n, r, cap, f); record = r; --- 26,30 ---- protected final MemRecordContentI record; ! BareRecord(Node n, memRecordContent r, Capability cap, RepoBackend f) { super(n, r, cap, f); record = r; Index: BareSequence.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/BareSequence.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** BareSequence.java 15 Jul 2004 04:47:57 -0000 1.22 --- BareSequence.java 15 Nov 2004 19:21:58 -0000 1.23 *************** *** 23,27 **** protected final MemSequenceContentI seq; ! BareSequence(Node n, memSequenceContent s, Capability cap, RepoServices f) { super(n, s, cap, f); seq = s; --- 23,27 ---- protected final MemSequenceContentI seq; ! BareSequence(Node n, memSequenceContent s, Capability cap, RepoBackend f) { super(n, s, cap, f); seq = s; Index: memSetContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memSetContent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** memSetContent.java 28 Jun 2004 19:13:10 -0000 1.5 --- memSetContent.java 15 Nov 2004 19:21:58 -0000 1.6 *************** *** 34,38 **** import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoServices; /** --- 34,38 ---- import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoBackend; /** *************** *** 70,74 **** private SetNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoServices f) { super(n, memSetContent.this, cap, f); editor = null; --- 70,74 ---- private SetNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memSetContent.this, cap, f); editor = null; *************** *** 77,81 **** public SetNode.Editor editSet() { if (editor == null && cap.allowEdit()) { ! editor = new MyNodeEditor(this, services); } return editor; --- 77,81 ---- public SetNode.Editor editSet() { if (editor == null && cap.allowEdit()) { ! editor = new MyNodeEditor(this, backend); } return editor; *************** *** 232,236 **** protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, RepoServices f) { super(content); this.content = content; --- 232,236 ---- protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, RepoBackend f) { super(content); this.content = content; *************** *** 317,321 **** } ! protected NodeContent createNodeContent(Node n, Capability cap, RepoServices s) { return new MyNodeContent(n, cap, s); } --- 317,321 ---- } ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend s) { return new MyNodeContent(n, cap, s); } Index: memMapContent.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/memory/memMapContent.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** memMapContent.java 15 Sep 2004 20:53:45 -0000 1.59 --- memMapContent.java 15 Nov 2004 19:21:57 -0000 1.60 *************** *** 33,37 **** import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoServices; /** --- 33,37 ---- import org.nodal.util.SetterUtil; import org.nodal.util.TypeConstraintFailure; ! import storage.framework.RepoBackend; /** *************** *** 68,72 **** } ! protected NodeContent createNodeContent(Node n, Capability cap, RepoServices s) { return new MyNodeContent(n, cap, s); } --- 68,72 ---- } ! protected NodeContent createNodeContent(Node n, Capability cap, RepoBackend s) { return new MyNodeContent(n, cap, s); } *************** *** 75,79 **** private MapNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoServices f) { super(n, memMapContent.this, cap, f); editor = null; --- 75,79 ---- private MapNode.Editor editor; ! MyNodeContent(Node n, Capability cap, RepoBackend f) { super(n, memMapContent.this, cap, f); editor = null; *************** *** 82,86 **** public MapNode.Editor editMap() { if (editor == null && cap.allowEdit()) { ! editor = new MyNodeEditor(this, services); } return editor; --- 82,86 ---- public MapNode.Editor editMap() { if (editor == null && cap.allowEdit()) { ! editor = new MyNodeEditor(this, backend); } return editor; *************** *** 233,237 **** protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, RepoServices f) { super(content); this.content = content; --- 233,237 ---- protected MyNodeContent content; ! protected MyNodeEditor(MyNodeContent content, RepoBackend f) { super(content); this.content = content; |
From: Lee I. <le...@us...> - 2004-11-15 19:22:20
|
Update of /cvsroot/nodal/nodal/j-src/storage/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4642/storage/http Modified Files: HttpNode.java HttpRepository.java Log Message: Change name of RepoServices to RepoBackend throughout. o update references and field and method names Index: HttpRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/http/HttpRepository.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** HttpRepository.java 15 Sep 2004 20:57:15 -0000 1.14 --- HttpRepository.java 15 Nov 2004 19:21:58 -0000 1.15 *************** *** 25,29 **** import org.nodal.util.Namespace; ! import storage.framework.AbstractRepoServices; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; --- 25,29 ---- import org.nodal.util.Namespace; ! import storage.framework.AbstractRepoBackend; import storage.framework.AbstractRepository; import storage.framework.AnchorNodeImpl; *************** *** 44,48 **** * @author leei */ ! private final class Services extends AbstractRepoServices { /** --- 44,48 ---- * @author leei */ ! private final class Services extends AbstractRepoBackend { /** *************** *** 55,59 **** /* (non-Javadoc) ! * @see storage.framework.RepoServices#createNode(org.nodal.type.NodeType, org.nodal.model.Node) */ public NodeContent.Editor createNode(NodeType type, Node context) { --- 55,59 ---- /* (non-Javadoc) ! * @see storage.framework.RepoBackend#createNode(org.nodal.type.NodeType, org.nodal.model.Node) */ public NodeContent.Editor createNode(NodeType type, Node context) { *************** *** 62,66 **** /* (non-Javadoc) ! * @see storage.framework.RepoServices#cloneNode(org.nodal.model.Node, org.nodal.model.Node) */ public NodeContent.Editor cloneNode(Node node, Node context) { --- 62,66 ---- /* (non-Javadoc) ! * @see storage.framework.RepoBackend#cloneNode(org.nodal.model.Node, org.nodal.model.Node) */ public NodeContent.Editor cloneNode(Node node, Node context) { *************** *** 77,81 **** /* (non-Javadoc) ! * @see storage.framework.RepoServices#txnManager() */ public TxnManager txnManager() { --- 77,81 ---- /* (non-Javadoc) ! * @see storage.framework.RepoBackend#txnManager() */ public TxnManager txnManager() { *************** *** 84,88 **** /* (non-Javadoc) ! * @see storage.framework.RepoServices#commitTxn(storage.memory.TxnResolver) */ public void commitTxn(TxnManager.Resolver txn) { --- 84,88 ---- /* (non-Javadoc) ! * @see storage.framework.RepoBackend#commitTxn(storage.memory.TxnResolver) */ public void commitTxn(TxnManager.Resolver txn) { *************** *** 101,105 **** HttpRepository(Path path) throws IOException { super(path, null); ! setServices(new Services()); this.url = new URL(path.toURLString()); HttpURLConnection.setFollowRedirects(true); --- 101,105 ---- HttpRepository(Path path) throws IOException { super(path, null); ! setBackend(new Services()); this.url = new URL(path.toURLString()); HttpURLConnection.setFollowRedirects(true); *************** *** 136,140 **** SBNStreamServices sbnServices = ! new SBNStreamServices (services, abs, conn.getInputStream(), conn.getContentType()); return StreamBasedNode.createStreamDoc(sbnServices); } catch (IOException e) { --- 136,140 ---- SBNStreamServices sbnServices = ! new SBNStreamServices (backend, abs, conn.getInputStream(), conn.getContentType()); return StreamBasedNode.createStreamDoc(sbnServices); } catch (IOException e) { Index: HttpNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/http/HttpNode.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HttpNode.java 15 Sep 2004 20:57:15 -0000 1.2 --- HttpNode.java 15 Nov 2004 19:21:58 -0000 1.3 *************** *** 37,41 **** private NodeContent.Editor initialize() { //System.out.println("Initialize " + this); ! return content.initEdit(this, repo.services()); } --- 37,41 ---- private NodeContent.Editor initialize() { //System.out.println("Initialize " + this); ! return content.initEdit(this, repo.getBackend()); } *************** *** 76,80 **** */ public NodeContent content() { ! return content.nodeContent(this, repo.services(), capability()); } --- 76,80 ---- */ public NodeContent content() { ! return content.nodeContent(this, repo.getBackend(), capability()); } |
From: Lee I. <le...@us...> - 2004-11-15 19:22:20
|
Update of /cvsroot/nodal/nodal/j-src/storage/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4642/storage/framework Modified Files: BasicNodeFactory.java SimpleTxnManager.java SBNStreamServices.java SBNURLServices.java StreamBasedNode.java NodeFactoryFramework.java AbstractRepository.java GeneratedNode.java EdgeIndex.java Added Files: AbstractRepoBackend.java RepoBackend.java Removed Files: AbstractRepoServices.java RepoServices.java Log Message: Change name of RepoServices to RepoBackend throughout. o update references and field and method names --- AbstractRepoServices.java DELETED --- Index: GeneratedNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/GeneratedNode.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GeneratedNode.java 15 Sep 2004 20:57:14 -0000 1.4 --- GeneratedNode.java 15 Nov 2004 19:21:57 -0000 1.5 *************** *** 49,57 **** // Create returnable content memContent content = memContent.create(type); ! nodeContent = content.nodeContent(this, repo.services, null); // Create and update content from generator Capability cap = CapabilityImpl.createOwner(repo.user()); ! updateEditor = content.nodeContent(this, repo.services, cap).edit(); updateContent(updateEditor); } else if (outofdate()) { --- 49,57 ---- // Create returnable content memContent content = memContent.create(type); ! nodeContent = content.nodeContent(this, repo.backend, null); // Create and update content from generator Capability cap = CapabilityImpl.createOwner(repo.user()); ! updateEditor = content.nodeContent(this, repo.backend, cap).edit(); updateContent(updateEditor); } else if (outofdate()) { Index: StreamBasedNode.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/StreamBasedNode.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** StreamBasedNode.java 15 Sep 2004 20:57:14 -0000 1.13 --- StreamBasedNode.java 15 Nov 2004 19:21:57 -0000 1.14 *************** *** 43,47 **** /** ! * StreamBasedDocument services, to be provided by implementing class. * * Created on Dec 3, 2003 --- 43,47 ---- /** ! * StreamBasedDocument backend, to be provided by implementing class. * * Created on Dec 3, 2003 *************** *** 61,69 **** /** ! * The RepoServices * ! * @return the RepoServices associated with this Document loading context */ ! RepoServices repoServices(); /** --- 61,69 ---- /** ! * The RepoBackend * ! * @return the RepoBackend associated with this Document loading context */ ! RepoBackend repoServices(); /** *************** *** 121,125 **** * Create a Document from a given set of StreamBasedNode.LoadServices. * ! * @param services * a set of StreamBasedNode.LoadServices that can define a Document * creation environment. --- 121,125 ---- * Create a Document from a given set of StreamBasedNode.LoadServices. * ! * @param backend * a set of StreamBasedNode.LoadServices that can define a Document * creation environment. Index: SBNStreamServices.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/SBNStreamServices.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SBNStreamServices.java 15 Sep 2004 20:57:14 -0000 1.7 --- SBNStreamServices.java 15 Nov 2004 19:21:57 -0000 1.8 *************** *** 24,31 **** protected final InputStream stream; protected final Path path; ! protected final RepoServices svc; protected boolean reloading; ! public SBNStreamServices(RepoServices svc, Path path, InputStream stream, String mimeType) throws IOException { super(svc, svc.txnManager()); --- 24,31 ---- protected final InputStream stream; protected final Path path; ! protected final RepoBackend svc; protected boolean reloading; ! public SBNStreamServices(RepoBackend svc, Path path, InputStream stream, String mimeType) throws IOException { super(svc, svc.txnManager()); *************** *** 50,54 **** * @see storage.framework.StreamBasedNode.LoadServices#repoServices() */ ! public RepoServices repoServices() { return svc; } --- 50,54 ---- * @see storage.framework.StreamBasedNode.LoadServices#repoServices() */ ! public RepoBackend repoServices() { return svc; } Index: AbstractRepository.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/AbstractRepository.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AbstractRepository.java 15 Sep 2004 20:57:14 -0000 1.14 --- AbstractRepository.java 15 Nov 2004 19:21:57 -0000 1.15 *************** *** 54,62 **** protected final Path path; ! protected AbstractRepoServices services; ! protected AbstractRepository(Path path, AbstractRepoServices services) { this.path = path; ! this.services = services; this.repoIDMap = new CacheMap(); --- 54,62 ---- protected final Path path; ! protected AbstractRepoBackend backend; ! protected AbstractRepository(Path path, AbstractRepoBackend services) { this.path = path; ! this.backend = services; this.repoIDMap = new CacheMap(); *************** *** 68,81 **** } ! protected final void setServices(AbstractRepoServices services) { // Ensure that it is only set once. ! if (this.services != null && this.services != services) { ! throw new RuntimeException(this + ".services initialized twice"); } ! this.services = services; } ! public final AbstractRepoServices services() { ! return services; } --- 68,81 ---- } ! protected final void setBackend(AbstractRepoBackend services) { // Ensure that it is only set once. ! if (this.backend != null && this.backend != services) { ! throw new RuntimeException(this + ".backend initialized twice"); } ! this.backend = services; } ! public final AbstractRepoBackend getBackend() { ! return backend; } *************** *** 144,148 **** if (node == null) { //Namespace ns = nid.namespace(); ! return services.recoverNodeNamed(id); } return node; --- 144,148 ---- if (node == null) { //Namespace ns = nid.namespace(); ! return backend.recoverNodeNamed(id); } return node; Index: NodeFactoryFramework.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/NodeFactoryFramework.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NodeFactoryFramework.java 15 Sep 2004 20:57:14 -0000 1.1 --- NodeFactoryFramework.java 15 Nov 2004 19:21:57 -0000 1.2 *************** *** 18,24 **** * An interface that represents the basic framework for creating Node instances. * {@link BasicNodeFactory} is built on top of this interface, and at its most basic ! * it is provided by {@link RepoServices} * @see BasicNodeFactory ! * @see RepoServices * @author leei */ --- 18,24 ---- * An interface that represents the basic framework for creating Node instances. * {@link BasicNodeFactory} is built on top of this interface, and at its most basic ! * it is provided by {@link RepoBackend} * @see BasicNodeFactory ! * @see RepoBackend * @author leei */ --- NEW FILE: RepoBackend.java --- /* * * Distributed under the Apache Software License, Version 1.1 * (see below, or the file LICENSE for terms and conditions) * * Copyright (c) 2003 University of British Columbia. All rights reserved. * */ package storage.framework; import org.nodal.Repository; /** * Basic facility for providing backend from a Repository to the * storage.memory package facilities. This includes creating new Nodes and * providing transaction management. * * @author Lee Iverson <le...@ec...> */ public interface RepoBackend extends NodeFactoryFramework { /** * Return the Repository associated with these backend. * @return the Repository providing these backend */ Repository repository(); /** * A TxnManager if this Repository type creates an audit trail via the * NodeHistory interface. * @return a TxnManager or null */ TxnManager txnManager(); /** * Notify the Repository that a Txn has been committed. * * Created on Oct 8, 2003 * @author leei */ void commitTxn (TxnManager.Resolver resolver); } --- RepoServices.java DELETED --- Index: SimpleTxnManager.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/SimpleTxnManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimpleTxnManager.java 14 May 2004 17:31:24 -0000 1.2 --- SimpleTxnManager.java 15 Nov 2004 19:21:57 -0000 1.3 *************** *** 32,49 **** */ public final class SimpleTxnManager implements TxnManager { ! public static TxnManager create(RepoServices services, TxnBuilderFactory factory) { return new SimpleTxnManager(services, factory); } ! public static TxnManager create(RepoServices services) { return create (services, SimpleTxnBuilder.factory()); } ! private final RepoServices services; private final TxnBuilderFactory factory; private TxnBuilder current; ! private SimpleTxnManager(RepoServices services, TxnBuilderFactory factory) { this.services = services; this.factory = factory; --- 32,49 ---- */ public final class SimpleTxnManager implements TxnManager { ! public static TxnManager create(RepoBackend services, TxnBuilderFactory factory) { return new SimpleTxnManager(services, factory); } ! public static TxnManager create(RepoBackend services) { return create (services, SimpleTxnBuilder.factory()); } ! private final RepoBackend services; private final TxnBuilderFactory factory; private TxnBuilder current; ! private SimpleTxnManager(RepoBackend services, TxnBuilderFactory factory) { this.services = services; this.factory = factory; Index: BasicNodeFactory.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/BasicNodeFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BasicNodeFactory.java 15 Sep 2004 20:57:14 -0000 1.5 --- BasicNodeFactory.java 15 Nov 2004 19:21:57 -0000 1.6 *************** *** 26,30 **** /** ! * All we need to construct one of these is a set of RepoServices. */ public BasicNodeFactory(NodeFactoryFramework fmwk, TxnManager txnMgr) { --- 26,30 ---- /** ! * All we need to construct one of these is a set of RepoBackend. */ public BasicNodeFactory(NodeFactoryFramework fmwk, TxnManager txnMgr) { --- NEW FILE: AbstractRepoBackend.java --- /* * * Distributed under the Apache Software License, Version 1.1 * (see below, or the file LICENSE for terms and conditions) * * Copyright (c) 2003 University of British Columbia. All rights reserved. * */ package storage.framework; import org.nodal.Repository; import org.nodal.model.AnchorNode; import org.nodal.model.Node; import org.nodal.model.NodeContent; import org.nodal.nav.Path; import org.nodal.type.NodeType; import org.nodal.util.Name; import org.nodal.util.Names; import org.nodal.util.Namespace; /** * This base class should be overriden to provide a facility for creating new * Nodes. * * @author Lee Iverson <le...@ec...> */ public abstract class AbstractRepoBackend implements RepoBackend { protected final AbstractRepository repo; protected final Store store; protected final Path path; protected final Namespace ns; private int nextIdx; protected AbstractRepoBackend(AbstractRepository repo, Path path, Store store) { this.repo = repo; this.store = store; this.path = path; this.ns = Names.getNamespace(path); nextIdx = 0; } protected AbstractRepoBackend(AbstractRepository repo, Path path) { this.repo = repo; this.store = null; this.path = path; this.ns = Names.getNamespace(path); nextIdx = 0; } protected AbstractRepoBackend(AbstractRepository repo) { this.repo = repo; this.store = null; this.path = repo.path(); this.ns = Names.getNamespace(path); nextIdx = 0; } /** * Create a new, unused node ID. */ public final synchronized Name createNodeID(Node node) { // NEXT Get rid of this and the two-argument associateID method Name nid = nextID(); repo.associateID(nid, node); return nid; } public synchronized Name nextID() { return ns.name("n" + (nextIdx++)); } /** * Recover a Node from a backing store. */ public final synchronized Node recoverNodeNamed(Name nid) { // Recover from store if (store != null) { Node node = store.recoverNode(nid); if (node != null) { repo.associateID(node); } return node; } return null; } /** * Return the Repository associated with these backend. */ public final Repository repository() { return repo; } /** * Create a brand new Node with the given NodeType. The <tt>context</tt> * Node determines the base metadata for the new Node, including permissions * and versioning. */ public abstract NodeContent.Editor createNode(NodeType type, Node context); /** * Clone a brand new Node copying the content from an existing Node. The * <tt>context</tt> Node determines the base metadata for the new Node, * including permissions and versioning. */ public abstract NodeContent.Editor cloneNode(Node node, Node context); public abstract AnchorNode createAnchor(Path context, Path rel); public abstract AnchorNode createAnchor(Path abs); /** * Return the TxnManager used by this Repository. */ public abstract TxnManager txnManager(); } Index: EdgeIndex.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/EdgeIndex.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EdgeIndex.java 15 Nov 2004 18:48:06 -0000 1.1 --- EdgeIndex.java 15 Nov 2004 19:21:57 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- /** * An index of (node,property,node) edges. + * * @author leei */ *************** *** 26,42 **** final Node node; final Object property; ! Label (Node node, Object property) { this.node = node; this.property = property; } ! public boolean equals (Object other) { Label otherLabel = (Label) other; ! return (node.equals(otherLabel.node) ! && property.equals (otherLabel.property)); } } ! /** * Create a new instance of the EdgeIndex class. * @return an EdgeIndex */ --- 27,46 ---- final Node node; final Object property; ! ! Label(Node node, Object property) { this.node = node; this.property = property; } ! ! public boolean equals(Object other) { Label otherLabel = (Label) other; ! return (node.equals(otherLabel.node) && property ! .equals(otherLabel.property)); } } ! /** * Create a new instance of the EdgeIndex class. + * * @return an EdgeIndex */ *************** *** 44,97 **** return new EdgeIndex(); } ! private Map backlinks; ! /** ! * */ private EdgeIndex() { ! backlinks = new HashMap (); } /** * Add a backlink to the Node dst on the edge (src,property). ! * @param src the source Node of the edge ! * @param property the property label for the edge ! * @param dst the destination Node of the edge */ ! public void add (NodeContent src, Object property, Node dst) { ! Label label = new Label (src.bareNode(), property); // Remove a (src,property,dst2) backlink Node prevDst = src.value(property).getNode(); ! this.remove (label, prevDst); ! ! // Access/create and augment the link set. ! Set links = (Set) backlinks.get (dst); ! if (links == null) { ! links = new HashSet(); ! backlinks.put(dst, links); } - links.add (label); } /** * Remove a backlink to prevDst from EdgeLabel label. ! * @param label the label with the link ! * @param dst the destination Node for this link */ private void remove(Label label, Node dst) { ! Set links = (Set) backlinks.get (dst); if (links != null) { links.remove(label); } } ! /** * The Set of EdgeLabel values that link to the dst Node. ! * @param dst the destination Node of these links * @return a Set of EdgeLabel instances or null if none. */ ! public Set backlinks (Node dst) { ! return Collections.unmodifiableSet ((Set) backlinks.get (dst)); } ! } --- 48,118 ---- return new EdgeIndex(); } ! private Map backlinks; ! /** ! * */ private EdgeIndex() { ! backlinks = new HashMap(); } /** * Add a backlink to the Node dst on the edge (src,property). ! * ! * @param src ! * the source Node of the edge ! * @param property ! * the property label for the edge ! * @param dst ! * the destination Node of the edge */ ! public void add(NodeContent src, Object property, Node dst) { ! Label label = new Label(src.bareNode(), property); // Remove a (src,property,dst2) backlink Node prevDst = src.value(property).getNode(); ! if (prevDst != null) { ! this.remove(label, prevDst); ! } ! ! // Ensure that we are only referring to non-null Nodes in backlink set ! if (dst != null) { ! // Backlinks are wrt. the bareNode. ! dst = dst.bareNode(); ! ! // Access/create and augment the link set. ! Set links = (Set) backlinks.get(dst); ! if (links == null) { ! links = new HashSet(); ! backlinks.put(dst, links); ! } ! links.add(label); } } /** * Remove a backlink to prevDst from EdgeLabel label. ! * ! * @param label ! * the label with the link ! * @param dst ! * the destination Node for this link */ private void remove(Label label, Node dst) { ! Set links = (Set) backlinks.get(dst); if (links != null) { links.remove(label); } } ! /** * The Set of EdgeLabel values that link to the dst Node. ! * ! * @param dst ! * the destination Node of these links * @return a Set of EdgeLabel instances or null if none. */ ! public Set backlinks(Node dst) { ! return Collections.unmodifiableSet((Set) backlinks.get(dst)); } ! } \ No newline at end of file Index: SBNURLServices.java =================================================================== RCS file: /cvsroot/nodal/nodal/j-src/storage/framework/SBNURLServices.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SBNURLServices.java 15 Sep 2004 20:57:14 -0000 1.2 --- SBNURLServices.java 15 Nov 2004 19:21:57 -0000 1.3 *************** *** 20,24 **** public SBNURLServices(AbstractRepository repo, Path path, URL url) throws IOException { ! super (repo.services, path, url.openConnection().getInputStream(), null); this.url = url; --- 20,24 ---- public SBNURLServices(AbstractRepository repo, Path path, URL url) throws IOException { ! super (repo.backend, path, url.openConnection().getInputStream(), null); this.url = url; |
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; } |