[Mulgara-svn] r1277 - in trunk/src/jar: content-mbox/java/org/mulgara/content/mbox content-mp3/java/org/mulgara/content/mp3 content-n3/java/org/mulgara/content/n3 content-rdfxml/java/org/mulgara/content/rdfxml content-rdfxml/java/org/mulgara/content/rdfxml/writer resolver/java/org/mulgara/resolver resolver-filesystem/java/org/mulgara/resolver/filesystem resolver-spi/java/org/mulgara/resolver/spi resolver-xsd/java/org/mulgara/resolver/xsd
pag at mulgara.org
pag at mulgara.org
Tue Sep 30 05:51:15 UTC 2008
Author: pag
Date: 2008-09-29 22:51:14 -0700 (Mon, 29 Sep 2008)
New Revision: 1277
Removed:
trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/TestResolverSession.java
trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/TestResolverSession.java
trunk/src/jar/content-n3/java/org/mulgara/content/n3/TestResolverSession.java
trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/TestResolverSession.java
trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/TestResolverSession.java
trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/TestResolverSession.java
trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/TestResolverSession.java
trunk/src/jar/resolver/java/org/mulgara/resolver/TestResolverSession.java
Modified:
trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxStatementsUnitTest.java
trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3StatementsUnitTest.java
trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3StatementsUnitTest.java
trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLStatementsUnitTest.java
trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriterUnitTest.java
trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemStatementsUnitTest.java
trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/BackupRestoreSession.java
trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSession.java
trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSessionFactoryException.java
trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/TestResolverSession.java
trunk/src/jar/resolver/java/org/mulgara/resolver/PersistentResolverSession.java
Log:
Added a node mapper factory to the backup/restore session. Rather than duplicate an implementation of this method in every copy/pasted TestResolverSession, these were all converged into a single implementation (like they should have been in the first place)
Modified: trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxStatementsUnitTest.java
===================================================================
--- trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxStatementsUnitTest.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxStatementsUnitTest.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -29,22 +29,14 @@
// Java 2 standard packages
import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.net.URL;
import java.net.MalformedURLException;
-import java.net.InetAddress;
-import java.util.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
// Third party packages
import junit.framework.*; // JUnit
import org.apache.log4j.*; // Log4J
-import org.jrdf.vocabulary.RDF; // JRDF
import org.jrdf.graph.*;
import org.jrdf.graph.mem.*;
import org.apache.log4j.xml.*; // Log4J
@@ -54,17 +46,9 @@
// Locally written packages
import org.mulgara.content.*;
import org.mulgara.query.*;
-import org.mulgara.query.rdf.LiteralImpl;
-import org.mulgara.query.rdf.Mulgara;
-import org.mulgara.query.rdf.URIReferenceImpl;
-import org.mulgara.resolver.*;
import org.mulgara.resolver.spi.GlobalizeException;
import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.server.Session;
-import org.mulgara.store.StoreException;
-import org.mulgara.store.nodepool.NodePool;
-import org.mulgara.store.stringpool.StringPool;
-import org.mulgara.util.FileUtil;
+import org.mulgara.resolver.spi.TestResolverSession;
/**
* Unit testing for the Mulgara MBox Resolver.
Deleted: trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/TestResolverSession.java
===================================================================
--- trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,173 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.content.mbox;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2004-10-11
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- * @author Mark Ludlow
- * @version $Revision: 1.8 $
- * @modified $Date: 2005/01/05 04:57:40 $
- * @maintenanceAuthor $Author: newmana $
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana Technology,
- * Inc</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-class TestResolverSession implements ResolverSession
-{
- /**
- * Our pretend node pool, a counter used to generate new local node values.
- */
- private long top = 0;
-
- /**
- * Our pretend string pool, a map from global JRDF nodes to local
- * {@link Long}s.
- */
- private final Map map = new HashMap();
-
- /** A map to map longs to nodes. Inverse of the String pool */
- private final Map globalMap = new HashMap();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException
- {
-
- Object object = globalMap.get(new Long(node));
-
- if (object == null) {
-
- throw new GlobalizeException(node, "No such node");
- }
- else {
-
- return ((Node) object);
- }
- }
-
- public long lookup(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- top++;
- map.put(node, new Long(top));
- globalMap.put(new Long(top), node);
-
- return top;
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- *
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
Modified: trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3StatementsUnitTest.java
===================================================================
--- trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3StatementsUnitTest.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3StatementsUnitTest.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -29,40 +29,21 @@
// Java 2 standard packages
import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.net.InetAddress;
-import java.util.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
// Third party packages
import junit.framework.*; // JUnit
import org.apache.log4j.*; // Log4J
-import org.jrdf.vocabulary.RDF; // JRDF
import org.jrdf.graph.Node;
import org.jrdf.graph.BlankNode;
-import org.apache.log4j.xml.*; // Log4J
-// import org.jibble.simplewebserver.*;
// Locally written packages
import org.mulgara.content.*;
import org.mulgara.query.*;
-import org.mulgara.query.rdf.LiteralImpl;
-import org.mulgara.query.rdf.Mulgara;
-import org.mulgara.query.rdf.URIReferenceImpl;
import org.mulgara.resolver.spi.GlobalizeException;
import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.server.Session;
-import org.mulgara.store.StoreException;
-import org.mulgara.store.nodepool.NodePool;
-import org.mulgara.store.stringpool.StringPool;
-import org.mulgara.util.TempDir;
+import org.mulgara.resolver.spi.TestResolverSession;
/**
* Unit testing for the MP3 Statements object.
Deleted: trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/TestResolverSession.java
===================================================================
--- trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,173 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.content.mp3;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2004-09-17
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- * @author Mark Ludlow
- * @version $Revision: 1.8 $
- * @modified $Date: 2005/01/05 04:57:43 $
- * @maintenanceAuthor $Author: newmana $
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana Technology,
- * Inc</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-class TestResolverSession implements ResolverSession
-{
- /**
- * Our pretend node pool, a counter used to generate new local node values.
- */
- private long top = 0;
-
- /**
- * Our pretend string pool, a map from global JRDF nodes to local
- * {@link Long}s.
- */
- private final Map map = new HashMap();
-
- /** A map to map longs to nodes. Inverse of the String pool */
- private final Map globalMap = new HashMap();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException
- {
-
- Object object = globalMap.get(new Long(node));
-
- if (object == null) {
-
- throw new GlobalizeException(node, "No such node");
- }
- else {
-
- return ((Node) object);
- }
- }
-
- public long lookup(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- top++;
- map.put(node, new Long(top));
- globalMap.put(new Long(top), node);
-
- return top;
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- *
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
Modified: trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3StatementsUnitTest.java
===================================================================
--- trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3StatementsUnitTest.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3StatementsUnitTest.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -46,6 +46,7 @@
import org.mulgara.query.rdf.LiteralImpl;
import org.mulgara.query.rdf.URIReferenceImpl;
import org.mulgara.resolver.spi.ResolverSession;
+import org.mulgara.resolver.spi.TestResolverSession;
/**
* Test suite for {@link N3Statements}.
@@ -59,13 +60,10 @@
* Technology Inc</a>
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
-public class N3StatementsUnitTest extends TestCase
-{
- /**
- * Logger.
- */
- private static final Logger logger =
- Logger.getLogger(N3StatementsUnitTest.class.getName());
+public class N3StatementsUnitTest extends TestCase {
+ /** Logger. */
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger.getLogger(N3StatementsUnitTest.class.getName());
//
// Constructors
Deleted: trunk/src/jar/content-n3/java/org/mulgara/content/n3/TestResolverSession.java
===================================================================
--- trunk/src/jar/content-n3/java/org/mulgara/content/n3/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-n3/java/org/mulgara/content/n3/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,157 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.content.n3;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2004-09-17
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- * @version $Revision: 1.8 $
- * @modified $Date: 2005/01/05 04:58:02 $
- * @maintenanceAuthor $Author: newmana $
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana Technology,
- * Inc</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-class TestResolverSession implements ResolverSession
-{
- /**
- * Our pretend node pool, a counter used to generate new local node values.
- */
- private long top = 0;
-
- /**
- * Our pretend string pool, a map from global JRDF nodes to local
- * {@link Long}s.
- */
- private final Map map = new HashMap();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException
- {
- throw new GlobalizeException(node, "Not implemented");
- }
-
- public long lookup(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- top++;
- map.put(node, new Long(top));
- return top;
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- *
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
Modified: trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLStatementsUnitTest.java
===================================================================
--- trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLStatementsUnitTest.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLStatementsUnitTest.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -43,6 +43,7 @@
import org.mulgara.query.rdf.LiteralImpl;
import org.mulgara.query.rdf.URIReferenceImpl;
import org.mulgara.resolver.spi.ResolverSession;
+import org.mulgara.resolver.spi.TestResolverSession;
/**
* Test suite for {@link RDFXMLStatements}.
Deleted: trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/TestResolverSession.java
===================================================================
--- trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,152 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.content.rdfxml;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2004-09-17
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- * @version $Revision: 1.8 $
- * @modified $Date: 2005/01/05 04:58:03 $
- * @maintenanceAuthor $Author: newmana $
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana Technology,
- * Inc</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-class TestResolverSession implements ResolverSession
-{
- /**
- * Our pretend node pool, a counter used to generate new local node values.
- */
- private long top = 0;
-
- /**
- * Our pretend string pool, a map from global JRDF nodes to local
- * {@link Long}s.
- */
- private final Map<Node,Long> map = new HashMap<Node,Long>();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException {
- throw new GlobalizeException(node, "Not implemented");
- }
-
- public long lookup(Node node) throws LocalizeException {
- Long object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- } else {
- return object.longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- top++;
- map.put(node, new Long(top));
- return top;
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- *
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
Modified: trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriterUnitTest.java
===================================================================
--- trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriterUnitTest.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriterUnitTest.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -33,7 +33,6 @@
import junit.framework.*;
import org.mulgara.content.Content;
import org.mulgara.content.rdfxml.RDFXMLContentHandler;
-import org.mulgara.content.rdfxml.writer.TestResolverSession;
import org.mulgara.resolver.file.FileContent;
import org.mulgara.resolver.spi.*;
import org.mulgara.util.TempDir;
Deleted: trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/TestResolverSession.java
===================================================================
--- trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,164 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.content.rdfxml.writer;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.query.rdf.BlankNodeImpl;
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2004-09-17
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- * @version $Revision: 1.8 $
- * @modified $Date: 2005/01/05 04:58:03 $
- * @maintenanceAuthor $Author: newmana $
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana Technology,
- * Inc</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-public class TestResolverSession implements ResolverSession {
- /** Our pretend node pool, a counter used to generate new local node values. */
- private long top = 0;
-
- /**
- * ID's used to reference BlankNodes (top counter for blank nodes)
- * Will cause problems if more nodes (non-blank) than the initial value
- * are inserted.
- */
- private long bNode = 1000000;
-
- /** Our pretend string pool, a map from global JRDF nodes to local {@link Long}s. */
- private final Map<Node,Long> map = new HashMap<Node,Long>();
-
- /** Mirror to the string pool map that allows globalization. */
- private final Map<Long,Node> mirrorMap = new HashMap<Long,Node>();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException {
- return mirrorMap.get(node);
- }
-
- public long lookup(Node node) throws LocalizeException {
- Long object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- } else {
- return object.longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException {
- Long object = map.get(node);
- if (object == null) {
- top++;
- Long id = new Long(top);
-
- if (node instanceof BlankNodeImpl) {
- bNode++;
- id = new Long(bNode);
- ((BlankNodeImpl)node).setNodeId(bNode);
- }
-
- map.put(node, id);
- mirrorMap.put(id, node);
-
- return id.longValue();
- } else {
- return object.longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/PersistentResolverSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/PersistentResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/PersistentResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -41,6 +41,7 @@
import org.mulgara.store.stringpool.SPObjectFactory;
import org.mulgara.store.stringpool.StringPoolException;
import org.mulgara.store.tuples.Tuples;
+import org.mulgara.util.LongMapper;
/**
* A wrapper that redirects the localizing of temporary query nodes
@@ -56,11 +57,10 @@
* Technology, Inc</a>
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
-public class PersistentResolverSession implements ResolverSession
-{
+public class PersistentResolverSession implements ResolverSession {
/** Logger. */
- private static final Logger logger =
- Logger.getLogger(PersistentResolverSession.class.getName());
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger.getLogger(PersistentResolverSession.class.getName());
/** The ResolverSession to be wraped **/
private ResolverSession resolverSession = null;
@@ -154,4 +154,8 @@
public long findGNode(SPObject spObject) throws StringPoolException {
return resolverSession.findGNode(spObject);
}
+
+ public LongMapper getRestoreMapper() throws Exception {
+ return resolverSession.getRestoreMapper();
+ }
}
Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/TestResolverSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,180 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2004-10-11
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @author Mark Ludlow
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:24 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana Technology,
- * Inc</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-class TestResolverSession implements ResolverSession
-{
- /**
- * Our pretend node pool, a counter used to generate new local node values.
- */
- private long top = 0;
-
- /**
- * Our pretend string pool, a map from global JRDF nodes to local
- * {@link Long}s.
- */
- private final Map map = new HashMap();
-
- /** A map to map longs to nodes. Inverse of the String pool */
- private final Map globalMap = new HashMap();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException
- {
-
- Object object = globalMap.get(new Long(node));
-
- if (object == null) {
-
- throw new GlobalizeException(node, "No such node");
- }
- else {
-
- return ((Node) object);
- }
- }
-
- public long lookup(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- top++;
- map.put(node, new Long(top));
- globalMap.put(new Long(top), node);
-
- return top;
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- *
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
Modified: trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemStatementsUnitTest.java
===================================================================
--- trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemStatementsUnitTest.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemStatementsUnitTest.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -29,22 +29,14 @@
// Java 2 standard packages
import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.MalformedURLException;
-import java.net.InetAddress;
-import java.util.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
// Third party packages
import junit.framework.*; // JUnit
import org.apache.log4j.*; // Log4J
-import org.jrdf.vocabulary.RDF; // JRDF
import org.jrdf.graph.Node;
import org.apache.log4j.xml.*; // Log4J
@@ -52,16 +44,11 @@
import org.mulgara.query.*;
import org.mulgara.query.rdf.BlankNodeImpl;
import org.mulgara.query.rdf.LiteralImpl;
-import org.mulgara.query.rdf.Mulgara;
import org.mulgara.query.rdf.URIReferenceImpl;
-import org.mulgara.resolver.*;
import org.mulgara.resolver.spi.GlobalizeException;
import org.mulgara.resolver.spi.LocalizeException;
import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.server.Session;
-import org.mulgara.store.StoreException;
-import org.mulgara.store.nodepool.NodePool;
-import org.mulgara.store.stringpool.StringPool;
+import org.mulgara.resolver.spi.TestResolverSession;
import org.mulgara.store.tuples.*;
/**
Deleted: trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/TestResolverSession.java
===================================================================
--- trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,178 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver.filesystem;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2004-11-22
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- * @author Mark Ludlow
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:27 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana Technology,
- * Inc</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-class TestResolverSession implements ResolverSession
-{
- /**
- * Our pretend node pool, a counter used to generate new local node values.
- */
- private long top = 0;
-
- /**
- * Our pretend string pool, a map from global JRDF nodes to local
- * {@link Long}s.
- */
- private final Map map = new HashMap();
-
- /** A map to map longs to nodes. Inverse of the String pool */
- private final Map globalMap = new HashMap();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException
- {
-
- Object object = globalMap.get(new Long(node));
-
- if (object == null) {
-
- throw new GlobalizeException(node, "No such node");
- }
- else {
-
- return ((Node) object);
- }
- }
-
- public long lookup(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- top++;
- map.put(node, new Long(top));
- globalMap.put(new Long(top), node);
-
- return top;
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- *
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/BackupRestoreSession.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/BackupRestoreSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/BackupRestoreSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -22,6 +22,7 @@
import org.mulgara.store.nodepool.NodePool;
import org.mulgara.store.stringpool.SPObject;
import org.mulgara.store.stringpool.StringPoolException;
+import org.mulgara.util.LongMapper;
/**
* An interface to the string-pool required by the Backup and Restore
@@ -36,16 +37,24 @@
* @licence Open Software Licence v3.0
*/
-public interface BackupRestoreSession
-{
+public interface BackupRestoreSession {
+
public static final long NONE = NodePool.NONE;
+
/**
* Find a single object in the persistent string pool.
- *
* @param gNode The graph node to find.
* @return the SPObject corresponding to <var>gNode</var>, or
* <code>null</code> if the node is not in the pool.
* @throws StringPoolException if an internal error occurs.
*/
public SPObject findSPObject(long gNode) throws StringPoolException;
+
+ /**
+ * Gets an object that can map nodes from a resolver to other nodes specific to the resolver.
+ * This provides a mechanism for resolvers to use optimizations specific to their node space.
+ * @return A node-to-node mapper specific to the resolver.
+ * @throws Exception An implementation specific exception.
+ */
+ public LongMapper getRestoreMapper() throws Exception;
}
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSession.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -34,17 +34,12 @@
import org.jrdf.graph.Node;
// Local packages
-import org.mulgara.store.StoreException;
import org.mulgara.store.nodepool.NodePool;
import org.mulgara.store.nodepool.NodePoolException;
-import org.mulgara.store.statement.StatementStore;
import org.mulgara.store.stringpool.SPObject;
import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPool;
import org.mulgara.store.stringpool.StringPoolException;
import org.mulgara.store.tuples.Tuples;
-import org.mulgara.store.xa.SimpleXAResource;
-import org.mulgara.store.xa.SimpleXAResourceException;
/**
* A {@link Resolver}'s view of a particular session.
@@ -61,8 +56,7 @@
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
-public interface ResolverSession extends BackupRestoreSession
-{
+public interface ResolverSession extends BackupRestoreSession {
/**
* Convert session-local node numbers to globally valid RDF nodes.
*
@@ -203,4 +197,5 @@
* refactored to no longer require it.
*/
public long findGNode(SPObject spObject) throws StringPoolException;
+
}
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSessionFactoryException.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSessionFactoryException.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ResolverSessionFactoryException.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -40,13 +40,15 @@
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
-public class ResolverSessionFactoryException extends Exception
-{
+public class ResolverSessionFactoryException extends Exception {
+
+ /** Generated UID */
+ private static final long serialVersionUID = -3006762480999889949L;
+
/**
- * @param message diagnostic text
+ * @param message diagnostic text
*/
- public ResolverSessionFactoryException(String message)
- {
+ public ResolverSessionFactoryException(String message) {
super(message);
}
@@ -54,8 +56,7 @@
* @param message diagnostic text
* @param cause an exception to be chained as the reason for this one
*/
- public ResolverSessionFactoryException(String message, Throwable cause)
- {
+ public ResolverSessionFactoryException(String message, Throwable cause) {
super(message, cause);
}
}
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/TestResolverSession.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -44,6 +44,7 @@
import org.jrdf.graph.Node;
// Local packages
+import org.mulgara.query.rdf.BlankNodeImpl;
import org.mulgara.store.stringpool.SPObject;
import org.mulgara.store.stringpool.SPObjectFactory;
import org.mulgara.store.stringpool.StringPoolException;
@@ -70,9 +71,16 @@
/**
* Our pretend node pool, a counter used to generate new local node values.
*/
- private long top = 0;
+ private long top = 1;
/**
+ * ID's used to reference BlankNodes (top counter for blank nodes)
+ * Will cause problems if more nodes (non-blank) than the initial value
+ * are inserted.
+ */
+ private long bNode = 1000000;
+
+ /**
* Our pretend string pool, a map from global JRDF nodes to local
* {@link Long}s.
*/
@@ -115,11 +123,17 @@
public long localize(Node node) throws LocalizeException {
Long object = map.get(node);
if (object == null) {
- top++;
- map.put(node, top);
- globalMap.put(top, node);
+ Long id = top++; // repeating the errors of the rdf/xml writer test class
- return top;
+ if (node instanceof BlankNodeImpl) {
+ id = bNode++;
+ ((BlankNodeImpl)node).setNodeId(bNode);
+ }
+
+ map.put(node, id);
+ globalMap.put(id, node);
+
+ return id;
} else {
return object;
}
Deleted: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/TestResolverSession.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/TestResolverSession.java 2008-09-30 05:47:42 UTC (rev 1276)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/TestResolverSession.java 2008-09-30 05:51:14 UTC (rev 1277)
@@ -1,196 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s):
- * The copyright to this file is held by:
- * The Australian Commonwealth Government
- * Department of Defense
- * Developed by Netymon Pty Ltd
- * under contract 4500430665
- * contributed to the Mulgara Project under the
- * Mozilla Public License version 1.1
- * per clause 4.1.3 of the above contract.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver.xsd;
-
-// Java 2 standard packages
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URI;
-
-// Third party packages
-import org.jrdf.graph.Node;
-
-// Local packages
-import org.mulgara.resolver.spi.GlobalizeException;
-import org.mulgara.resolver.spi.LocalizeException;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.stringpool.SPObject;
-import org.mulgara.store.stringpool.SPObjectFactory;
-import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.stringpool.xa.SPObjectFactoryImpl;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * A minimal implementation of {@link ResolverSession}.
- *
- * This isn't capable of persistence, and is only appropriate for use in
- * unit tests.
- *
- * @created 2005-05-28
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @author <a href="mailto:raboczi at itee.uq.edu.au">Simon Raboczi</a>
- *
- * @version $Revision: 1.1 $
- *
- * @modified $Date: 2005/05/29 08:34:21 $
- *
- * @maintenanceAuthor $Author: raboczi $
- *
- * @copyright ©2005 <a href="http://www.defence.gov.au/">
- * Australian Commonwealth Government, Department of Defence</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-class TestResolverSession implements ResolverSession
-{
- /**
- * Our pretend node pool, a counter used to generate new local node values.
- */
- private long top = 0;
-
- /**
- * Our pretend string pool, a map from global JRDF nodes to local
- * {@link Long}s.
- */
- private final Map map = new HashMap();
-
- /** A map to map longs to nodes. Inverse of the String pool */
- private final Map globalMap = new HashMap();
-
- /**
- * Source of {@link SPObject}s.
- */
- private final SPObjectFactory spObjectFactory = new SPObjectFactoryImpl();
-
- //
- // Methods implementing ResolverSession
- //
-
- public Node globalize(long node) throws GlobalizeException
- {
-
- Object object = globalMap.get(new Long(node));
-
- if (object == null) {
-
- throw new GlobalizeException(node, "No such node");
- }
- else {
-
- return ((Node) object);
- }
- }
-
- public long lookup(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- throw new LocalizeException(node, "No such node");
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long lookupPersistent(Node node) throws LocalizeException
- {
- throw new LocalizeException(node, "Not implemented");
- }
-
- public long localize(Node node) throws LocalizeException
- {
- Object object = map.get(node);
- if (object == null) {
- top++;
- map.put(node, new Long(top));
- globalMap.put(new Long(top), node);
-
- return top;
- }
- else {
- return ((Long) object).longValue();
- }
- }
-
- public long localizePersistent(Node node) throws LocalizeException
- {
- return localize(node);
- }
-
- public long newBlankNode() {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Tuples findStringPoolRange(
- SPObject lowValue, boolean inclLowValue,
- SPObject highValue, boolean inclHighValue
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public Tuples findStringPoolType(
- SPObject.TypeCategory typeCategory, URI typeURI
- ) throws StringPoolException {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public SPObject findStringPoolObject(long gNode) throws StringPoolException {
-
- Node node = (Node) globalMap.get(new Long(gNode));
- return (node == null) ? null : spObjectFactory.newSPObject(node);
- }
-
- /**
- * Retrieve the SPObject factory from the stringpool to allow for the creation
- * of new SPObjects.
- *
- * @return The factory to allow for creation of SPObjects
- */
- public SPObjectFactory getSPObjectFactory() {
- return spObjectFactory;
- }
-
- public SPObject findSPObject(long gNode) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-
- public long findGNode(SPObject spObject) {
- throw new UnsupportedOperationException("Not Implemented on test class");
- }
-}
More information about the Mulgara-svn
mailing list