[Mulgara-svn] r439 - in branches/mgr-58/src/jar: resolver/java/org/mulgara/resolver resolver-test/java/org/mulgara/resolver/test resolver-view/java/org/mulgara/resolver/view

andrae at mulgara.org andrae at mulgara.org
Tue Sep 18 03:59:17 UTC 2007


Author: andrae
Date: 2007-09-17 22:59:16 -0500 (Mon, 17 Sep 2007)
New Revision: 439

Modified:
   branches/mgr-58/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
   branches/mgr-58/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/SubqueryAnswerUnitTest.java
Log:
Converted all the local: URI's used in the unit-tests from opaque to
hierarcical.  Final problem is Restore - note the DatabaseURI coming from
Database is not the DatabaseURI, but the DatabaseURL.  This of course will cause
a problem with StringPoolSession mapRelative/mapAbsolute.  Depending on how we
answer the model URI question, we will either have to delete the
mapAbsolute/Relative code and store absolute URI's using UUID's in the store; or
we leave the mapAbsolute/Relative code in place, and configure the mulgara
instance with the URI and delete the UUID logic.  When we have decided how to
name models, this fix will be relatively stright forward.



Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -64,12 +64,12 @@
 */
 public class BasicDatabaseSessionUnitTest extends TestCase
 {
-  /** The URI of the {@link #database}: <code>local:database</code>.  */
+  /** The URI of the {@link #database}: <code>local:///database</code>.  */
   private static final URI databaseURI;
 
   /**
   * The URI of the {@link #database}'s system model:
-  * <code>local:database#</code>.
+  * <code>local:///database#</code>.
   */
   private static final URI systemModelURI;
 

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -224,6 +224,16 @@
           logger.debug("Model " + model + " protocol is " + modelProtocol);
         }
 
+        if ("rdfdb".equals(modelProtocol)) {
+          try {
+            logger.warn("Internal model-URI not found in system model " +
+                systemResolver.globalize(model) + ":" + model);
+          } catch (GlobalizeException eg) {
+            logger.warn("Error logging globalized model: " + model);
+          }
+          throw new QueryException("Internal model-URI not found in system model ");
+        }
+
         // find the factory for this protocol
         ResolverFactory resolverFactory =
             (ResolverFactory) externalResolverFactoryMap.get(modelProtocol);
@@ -781,6 +791,10 @@
 
 
   public URI convertModelURLtoURI(URI modelURL) throws QueryException {
+    if (logger.isDebugEnabled()) {
+      logger.debug("Converting to URI: " + modelURL);
+    }
+
     if (!isInternalModelURL(modelURL)) {
       if (logger.isDebugEnabled()) {
         logger.debug(modelURL + " determined to be External");
@@ -823,11 +837,11 @@
           (modelURL.getPath() != null && ("/" + metadata.getServerName()).equals(modelURL.getPath()))) {
         return true;
       } else {
-        throw new QueryException("local: scheme URL: " + modelURL +
+        throw new QueryException("local scheme URL: " + modelURL +
             " doesn't match server-name: " + metadata.getServerName());
       }
     }
-    if (!modelURL.getPath().equals(metadata.getServerName())) {
+    if (modelURL.getPath() == null || !("/" + metadata.getServerName()).equals(modelURL.getPath())) {
       return false;
     }
     if (modelURL.getScheme().equals("rdfdb")) {

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -185,12 +185,14 @@
       URI temporaryModelTypeURI,
       String ruleLoaderClassName) throws ResolverFactoryException {
 
+    logger.info("Constructing DatabaseSession");
+/*
     if (logger.isInfoEnabled()) {
       logger.info("Constructing DatabaseSession: externalResolverFactoryMap=" +
           externalResolverFactoryMap + " internalResolverFactoryMap=" +
           internalResolverFactoryMap + " metadata=" + metadata);
     }
-
+*/
     // Validate parameters
     if (transactionManager == null) {
       throw new IllegalArgumentException("Null 'transactionManager' parameter");
@@ -375,6 +377,9 @@
    */
   public void restore(InputStream inputStream, URI serverURI,
       URI sourceURI) throws QueryException {
+    if (logger.isInfoEnabled()) {
+      logger.info("RESTORE: " + serverURI + ", " + sourceURI);
+    }
     execute(new RestoreOperation(inputStream, serverURI, sourceURI, resolverSessionFactory),
             "Unable to restore from " + sourceURI);
   }
@@ -406,7 +411,7 @@
 
   public void createModel(URI modelURI, URI modelTypeURI) throws QueryException {
     if (logger.isInfoEnabled()) {
-      logger.info("Creating Model " + modelURI + " with type " + modelTypeURI);
+      logger.info("CREATE MODEL: " + modelURI + " with type " + modelTypeURI);
     }
 
     execute(new CreateModelOperation(modelURI, modelTypeURI),
@@ -426,6 +431,9 @@
   }
 
   public boolean modelExists(URI modelURI) throws QueryException {
+    if (logger.isInfoEnabled()) {
+      logger.info("MODEL EXISTS: " + modelURI);
+    }
     ModelExistsOperation operation = new ModelExistsOperation(modelURI);
 
     execute(operation, "Failed to determine model existence");
@@ -513,6 +521,7 @@
    * {@inheritDoc}
    */
   public void applyRules(RulesRef rulesRef) throws RulesException, java.rmi.RemoteException {
+    logger.info("APPLY RULES");
     Rules rules = rulesRef.getRules();
     rules.run(this);
   }
@@ -586,6 +595,9 @@
    */
   private synchronized void backup(OutputStream outputStream, URI serverURI, URI destinationURI)
       throws QueryException {
+    if (logger.isInfoEnabled()) {
+      logger.info("BACKUP: " + serverURI + " -> " + destinationURI);
+    }
     execute(
         new BackupOperation(outputStream, serverURI, destinationURI, resolverSessionFactory),
         "Unable to backup to " + destinationURI);
@@ -597,10 +609,10 @@
   protected void modify(URI modelURI, Set statements, boolean insert) throws QueryException
   {
     if (logger.isInfoEnabled()) {
-      logger.info("Inserting statements into " + modelURI);
+      logger.info("MODIFY: " + modelURI + " insert=" + insert);
     }
     if (logger.isDebugEnabled()) {
-      logger.debug("Inserting statements: " + statements);
+      logger.debug("Modifying with statements: " + statements);
     }
 
     execute(new ModifyModelOperation(modelURI, statements, insert),

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -63,12 +63,12 @@
 * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
 */
 public class DatabaseSessionUnitTest extends TestCase {
-  /** The URI of the {@link #database}: <code>local:database</code>.  */
+  /** The URI of the {@link #database}: <code>local:///database</code>.  */
   private static final URI databaseURI;
 
   /**
    * The URI of the {@link #database}'s system model:
-   * <code>local:database#</code>.
+   * <code>local:///database#</code>.
    */
   private static final URI systemModelURI;
 
@@ -77,8 +77,8 @@
 
   static {
     try {
-      databaseURI    = new URI("local:database");
-      systemModelURI = new URI("local:database#");
+      databaseURI    = new URI("local:///database");
+      systemModelURI = new URI("local:///database#");
       memoryModelURI = new URI(Mulgara.NAMESPACE+"MemoryModel");
     } catch (URISyntaxException e) {
       throw new Error("Bad hardcoded URI", e);
@@ -103,7 +103,7 @@
   static {
     try {
       models = new ModelResource[] {
-        new ModelResource(new URI("local:database#")),
+        new ModelResource(new URI("local:///database#")),
         new ModelResource(new File("data/test-model1.rdf").toURI()),
         new ModelResource(new File("data/test-model2.rdf").toURI()),
         new ModelResource(new File("data/test-model3.rdf").toURI()),

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -128,8 +128,8 @@
     throws ClassNotFoundException, IllegalAccessException,
            InstantiationException, URISyntaxException
   {
-    URI databaseURI    = new URI("local:database");
-    URI systemModelURI = new URI("local:database#");
+    URI databaseURI    = new URI("local:///database");
+    URI systemModelURI = new URI("local:///database#");
 
     // Create the persistence directory
     File persistenceDirectory =

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -123,6 +123,10 @@
     throws ResolverFactoryException, NodePoolException, StringPoolException,
            InitializerException
   {
+    if (logger.isDebugEnabled()) {
+      logger.debug("SPSF created with databaseURI: " + databaseURI);
+    }
+
     this.databaseURI     = databaseURI;
     this.hostnameAliases = hostnameAliases;
 

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/SubqueryAnswerUnitTest.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/SubqueryAnswerUnitTest.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/SubqueryAnswerUnitTest.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -75,13 +75,13 @@
       Logger.getLogger(SubqueryAnswerUnitTest.class.getName());
 
   /**
-   * The URI of the {@link #database}: <code>local:database</code>.
+   * The URI of the {@link #database}: <code>local:///database</code>.
    */
   private static final URI databaseURI;
 
   /**
    * The URI of the {@link #database}'s system model:
-   * <code>local:database#</code>.
+   * <code>local:///database#</code>.
    */
   private static final URI systemModelURI;
 
@@ -92,8 +92,8 @@
 
   static {
     try {
-      databaseURI    = new URI("local:database");
-      systemModelURI = new URI("local:database#");
+      databaseURI    = new URI("local:///database");
+      systemModelURI = new URI("local:///database#");
       memoryModelURI = new URI(Mulgara.NAMESPACE+"MemoryModel");
     } catch (URISyntaxException e) {
       throw new Error("Bad hardcoded URI", e);

Modified: branches/mgr-58/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
===================================================================
--- branches/mgr-58/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -89,15 +89,15 @@
    */
   private static Database database = null;
 
-  /** The URI of the {@link #database}: <code>local:database</code>.  */
+  /** The URI of the {@link #database}: <code>local:///database</code>.  */
   private static final URI databaseURI;
   private static final URI systemModelURI;
   private static final URI modelTypeURI;
 
   static {
     try {
-      databaseURI  = new URI("local:database");
-      systemModelURI     = new URI("local:database#");
+      databaseURI  = new URI("local:///database");
+      systemModelURI     = new URI("local:///database#");
       modelTypeURI = new URI(Mulgara.NAMESPACE + "TestModel");
     } catch (URISyntaxException e) {
       throw new Error("Bad hardcoded URI", e);

Modified: branches/mgr-58/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
===================================================================
--- branches/mgr-58/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java	2007-09-14 20:56:30 UTC (rev 438)
+++ branches/mgr-58/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java	2007-09-18 03:59:16 UTC (rev 439)
@@ -69,12 +69,12 @@
 * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
 */
 public class ViewResolverUnitTest extends TestCase {
-  /** The URI of the {@link #database}: <code>local:database</code>.  */
+  /** The URI of the {@link #database}: <code>local:///database</code>.  */
   private static final URI databaseURI;
 
   /**
   * The URI of the {@link #database}'s system model:
-  * <code>local:database#</code>.
+  * <code>local:///database#</code>.
   */
   private static final URI systemModelURI;
 
@@ -83,8 +83,8 @@
 
   static {
     try {
-      databaseURI    = new URI("local:database");
-      systemModelURI = new URI("local:database#");
+      databaseURI    = new URI("local:///database");
+      systemModelURI = new URI("local:///database#");
       memoryModelURI = new URI(Mulgara.NAMESPACE+"MemoryModel");
     } catch (URISyntaxException e) {
       throw new Error("Bad hardcoded URI", e);
@@ -138,7 +138,7 @@
     try {
       String baseuri = "rmi://" + InetAddress.getLocalHost().getCanonicalHostName() + "/server1#";
       modelURIs = new URI[] {
-        new URI("local:database#"),
+        new URI("local:///database#"),
         new URI(baseuri + "test-model1"),
         new URI(baseuri + "test-model2"),
         new URI(baseuri + "test-model3"),




More information about the Mulgara-svn mailing list