jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r735672 - in /jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc: JCRConnection.java JCRDriver.java JCRView.java
Date Mon, 19 Jan 2009 12:08:44 GMT
Author: jukka
Date: Mon Jan 19 04:08:43 2009
New Revision: 735672

URL: http://svn.apache.org/viewvc?rev=735672&view=rev
Log:
jdbc2jcr: Cleanups

Modified:
    jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRConnection.java
    jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRDriver.java
    jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRView.java

Modified: jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRConnection.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRConnection.java?rev=735672&r1=735671&r2=735672&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRConnection.java
(original)
+++ jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRConnection.java
Mon Jan 19 04:08:43 2009
@@ -121,7 +121,7 @@
                 }
             }
         } catch (NamespaceException e) {
-            System.out.println("No custom views found");
+            // System.out.println("No custom views found");
         } catch (RepositoryException e) {
             System.err.println("Failed to create custom views");
             e.printStackTrace();

Modified: jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRDriver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRDriver.java?rev=735672&r1=735671&r2=735672&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRDriver.java
(original)
+++ jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRDriver.java
Mon Jan 19 04:08:43 2009
@@ -52,34 +52,38 @@
         }
     }
 
-    private Repository getRepository(String url) throws SQLException {
-        if (url.startsWith("http://") || url.startsWith("https://")) {
+    private Repository getRepository(String url, Properties info)
+            throws SQLException {
+        if (url.startsWith("jdbc:jcr:http://")
+                || url.startsWith("jdbc:jcr:https://")) {
             try {
-                return new URLRemoteRepository(url);
+                return new URLRemoteRepository(
+                        url.substring("jdbc:jcr:".length()));
             } catch (MalformedURLException e) {
                 throw new SQLExceptionWithCause("Invalid URL: " + url, e);
             }
-        } else if (url.startsWith("rmi://")) {
-            return new RMIRemoteRepository(url.substring(4));
-        } else if (url.startsWith("jndi://")) {
+        } else if (url.startsWith("jdbc:jcr:rmi://")) {
+            return new RMIRemoteRepository(
+                    url.substring("jdbc:jcr:rmi:".length()));
+        } else if (url.startsWith("jdbc:jcr:jndi://")) {
             try {
-                return (Repository) new InitialContext().lookup(url.substring(7));
+                return (Repository) new InitialContext(info).lookup(
+                        url.substring("jdbc:jcr:jndi://".length()));
             } catch (NamingException e) {
                 throw new SQLExceptionWithCause("Name not found: " + url, e);
             }
         } else {
-            throw new SQLException("Unknown JCR connect URL: " + url);
+            return null;
         }
     }
 
     @Override
     public Connection connect(String url, Properties info) throws SQLException {
-        if (!url.startsWith("jdbc:jcr:")) {
+        Repository repository = getRepository(url, info);
+        if (repository == null) {
             return null;
         }
         try {
-            Repository repository =
-                getRepository(url.substring("jdbc:jcr:".length()));
             String workspace = info.getProperty("workspace");
             Credentials credentials = null;
             String username = info.getProperty("username");

Modified: jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRView.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRView.java?rev=735672&r1=735671&r2=735672&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRView.java
(original)
+++ jackrabbit/sandbox/jackrabbit-jdbc2jcr/src/main/java/org/apache/jackrabbit/jdbc/JCRView.java
Mon Jan 19 04:08:43 2009
@@ -209,7 +209,7 @@
         builder.append(" EXTERNAL NAME");
         builder.append(" 'org.apache.jackrabbit.jdbc.JCRResultSet.jcrQuery'");
 
-        System.out.println(builder);
+        // System.out.println(builder);
         return builder.toString();
     }
 
@@ -223,7 +223,7 @@
         builder.append("', '");
         builder.append(view); // TODO: escape
         builder.append("')) nodes");
-        System.out.println(builder);
+        // System.out.println(builder);
         return builder.toString();
     }
 



Mime
View raw message