[Mulgara-svn] r939 - trunk/src/jar/resolver/java/org/mulgara/resolver

pag at mulgara.org pag at mulgara.org
Thu May 15 02:30:20 UTC 2008


Author: pag
Date: 2008-05-14 19:30:19 -0700 (Wed, 14 May 2008)
New Revision: 939

Modified:
   trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java
Log:
Removed testing of graph URIs for all but the known protocols

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java	2008-05-14 05:06:35 UTC (rev 938)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java	2008-05-15 02:30:19 UTC (rev 939)
@@ -77,7 +77,7 @@
   CreateModelOperation(URI graphURI, URI graphTypeURI) throws QueryException {
     // Validate "graphURI" parameter
     if (graphURI == null) throw new IllegalArgumentException("Null \"graphURI\" parameter");
-    if (!graphURI.isOpaque() && graphURI.getFragment() == null) {
+    if (!graphURI.isOpaque() && fragmentScheme(graphURI) && graphURI.getFragment() == null) {
       throw new QueryException("Graph URI does not have a fragment (graphURI:\"" + graphURI + "\")");
     }
 
@@ -176,6 +176,9 @@
    * @throws QueryException
    */
   private void verifyGraphUriIsRelative(URI graphURI, DatabaseMetadata metadata) throws QueryException {
+    // only both if this is a scheme which uses fragments - for the moment only RMI
+    if (!fragmentScheme(graphURI)) return;
+
     boolean badModelURI = true;
     URI databaseURI = metadata.getURI();
     String scheme = graphURI.getScheme();
@@ -228,4 +231,20 @@
       );
     }
   }
+
+  /** Schemes with fragments are handled for backward compatibility */
+  private static final Set<String> fragmentSchemes = new HashSet<String>();
+  static {
+    fragmentSchemes.add("rmi");
+    fragmentSchemes.add("beep");
+  }
+
+  /**
+   * Test if the given URI is in a scheme which differentiates graphs based on fragments.
+   * @param graphUri The URI to test for the graph.
+   * @return <code>true</code> only of the URI is in the known graph schemes.
+   */
+  private static boolean fragmentScheme(URI graphUri) {
+    return fragmentSchemes.contains(graphUri.getScheme());
+  }
 }




More information about the Mulgara-svn mailing list