jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r467945 - in /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core: persistence/db/ state/ state/db/
Date Thu, 26 Oct 2006 10:06:23 GMT
Author: tripod
Date: Thu Oct 26 03:06:22 2006
New Revision: 467945

URL: http://svn.apache.org/viewvc?view=rev&rev=467945
Log:
JCR-595 Refactoring of the Persistence Managers (fixing ddl loading)

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DerbyPersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/JNDIDatabasePersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/OraclePersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/SimpleDbPersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DatabasePersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DerbyPersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/JNDIDatabasePersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/OraclePersistenceManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -18,22 +18,21 @@
 
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.persistence.AbstractPersistenceManager;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.local.LocalFileSystem;
+import org.apache.jackrabbit.core.persistence.AbstractPersistenceManager;
+import org.apache.jackrabbit.core.persistence.PMContext;
+import org.apache.jackrabbit.core.persistence.util.BLOBStore;
+import org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore;
+import org.apache.jackrabbit.core.persistence.util.Serializer;
 import org.apache.jackrabbit.core.state.ChangeLog;
+import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.persistence.PMContext;
 import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.ItemState;
-import org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager;
-import org.apache.jackrabbit.core.persistence.util.BLOBStore;
-import org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore;
-import org.apache.jackrabbit.core.persistence.util.Serializer;
 import org.apache.jackrabbit.core.value.BLOBFileValue;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.util.Text;
@@ -43,19 +42,19 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.FilterInputStream;
-import java.io.ByteArrayInputStream;
 import java.sql.Connection;
+import java.sql.DatabaseMetaData;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.sql.DatabaseMetaData;
 
 /**
  * Abstract base class for database persistence managers. This class
@@ -951,7 +950,7 @@
 
         if (!schemaExists) {
             // read ddl from resources
-            InputStream in = getClass().getResourceAsStream(schema + ".ddl");
+            InputStream in = getSchemaDDL();
             if (in == null) {
                 String msg = "Configuration error: unknown schema '" + schema + "'";
                 log.debug(msg);
@@ -979,6 +978,14 @@
                 closeStatement(stmt);
             }
         }
+    }
+
+    /**
+     * Returns an input stream to the schema DDL resource.
+     * @return an input stream to the schema DDL resource.
+     */
+    protected InputStream getSchemaDDL() {
+        return getClass().getResourceAsStream(schema + ".ddl");
     }
 
     //--------------------------------------------------------< inner classes >

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DerbyPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DerbyPersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DerbyPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/DerbyPersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -18,7 +18,6 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager;
 
 import java.sql.Connection;
 import java.sql.DriverManager;

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/JNDIDatabasePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/JNDIDatabasePersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/JNDIDatabasePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/JNDIDatabasePersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -16,14 +16,11 @@
  */
 package org.apache.jackrabbit.core.persistence.db;
 
-import org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
 
 /**
  * Database persistence manager that uses JNDI to acquire the database

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/OraclePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/OraclePersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/OraclePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/OraclePersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -112,6 +112,7 @@
      * <code>MODE_READWRITE</code> constants defined there.
      * @see oracle.sql.BLOB#DURATION_SESSION
      * @see oracle.sql.BLOB#MODE_READWRITE
+     * @noinspection JavadocReference
      */
     public void init(PMContext context) throws Exception {
         super.init(context);
@@ -294,7 +295,7 @@
 
         if (!schemaExists) {
             // read ddl from resources
-            InputStream in = getClass().getResourceAsStream(schema + ".ddl");
+            InputStream in = getSchemaDDL();
             if (in == null) {
                 String msg = "Configuration error: unknown schema '" + schema + "'";
                 log.debug(msg);

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/SimpleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/SimpleDbPersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/SimpleDbPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/persistence/db/SimpleDbPersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -16,12 +16,11 @@
  */
 package org.apache.jackrabbit.core.persistence.db;
 
+import org.apache.jackrabbit.core.persistence.util.Serializer;
+
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
-
-import org.apache.jackrabbit.core.persistence.util.Serializer;
-import org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager;
 
 /**
  * <code>SimpleDbPersistenceManager</code> is a generic JDBC-based

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -21,6 +21,7 @@
  * @deprecated use {@link org.apache.jackrabbit.core.persistence.AbstractPersistenceManager}
  *             instead.
  */
-public abstract class AbstractPersistenceManager extends org.apache.jackrabbit.core.persistence.AbstractPersistenceManager
{
+public abstract class AbstractPersistenceManager
+        extends org.apache.jackrabbit.core.persistence.AbstractPersistenceManager {
 
 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DatabasePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DatabasePersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DatabasePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DatabasePersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.state.db;
 
+import java.io.InputStream;
+
 /**
  * Legacy class kept for backward compatibility reasons.
  * @deprecated use {@link org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager}
@@ -23,4 +25,13 @@
  */
 public abstract class DatabasePersistenceManager
         extends org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager {
+
+    /**
+     * {@inheritDoc}
+     *
+     * Needed to override in order to load the ddl from the new location
+     */
+    protected InputStream getSchemaDDL() {
+        return super.getClass().getResourceAsStream(schema + ".ddl");
+    }
 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DerbyPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DerbyPersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DerbyPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/DerbyPersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.state.db;
 
+import java.io.InputStream;
+
 /**
  * Legacy class kept for backward compatibility reasons.
   * @deprecated use {@link org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager}
@@ -23,4 +25,13 @@
   */
 public class DerbyPersistenceManager
         extends org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager {
+
+    /**
+     * {@inheritDoc}
+     *
+     * Needed to override in order to load the ddl from the new location
+     */
+    protected InputStream getSchemaDDL() {
+        return super.getClass().getResourceAsStream(schema + ".ddl");
+    }
 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/JNDIDatabasePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/JNDIDatabasePersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/JNDIDatabasePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/JNDIDatabasePersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.state.db;
 
+import java.io.InputStream;
+
 /**
  * Legacy class kept for backward compatibility reasons.
   * @deprecated use {@link org.apache.jackrabbit.core.persistence.db.JNDIDatabasePersistenceManager}
@@ -23,4 +25,14 @@
   */
 public class JNDIDatabasePersistenceManager
         extends org.apache.jackrabbit.core.persistence.db.JNDIDatabasePersistenceManager
{
+
+    /**
+     * {@inheritDoc}
+     *
+     * Needed to override in order to load the ddl from the new location
+     */
+    protected InputStream getSchemaDDL() {
+        return super.getClass().getResourceAsStream(schema + ".ddl");
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/OraclePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/OraclePersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/OraclePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/OraclePersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.state.db;
 
+import java.io.InputStream;
+
 /**
  * Legacy class kept for backward compatibility reasons.
   * @deprecated use {@link org.apache.jackrabbit.core.persistence.db.OraclePersistenceManager}
@@ -23,4 +25,14 @@
   */
 public class OraclePersistenceManager
         extends org.apache.jackrabbit.core.persistence.db.OraclePersistenceManager {
+
+    /**
+     * {@inheritDoc}
+     *
+     * Needed to override in order to load the ddl from the new location
+     */
+    protected InputStream getSchemaDDL() {
+        return super.getClass().getResourceAsStream(schema + ".ddl");
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java?view=diff&rev=467945&r1=467944&r2=467945
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
Thu Oct 26 03:06:22 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.state.db;
 
+import java.io.InputStream;
+
 /**
  * Legacy class kept for backward compatibility reasons.
   * @deprecated use {@link org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager}
@@ -23,4 +25,14 @@
   */
 public class SimpleDbPersistenceManager
         extends org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager {
+
+    /**
+     * {@inheritDoc}
+     *
+     * Needed to override in order to load the ddl from the new location
+     */
+    protected InputStream getSchemaDDL() {
+        return super.getClass().getResourceAsStream(schema + ".ddl");
+    }
+
 }



Mime
View raw message