jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r610214 - in /jackrabbit/trunk/jackrabbit-core/src/main: java/org/apache/jackrabbit/core/journal/ java/org/apache/jackrabbit/core/persistence/bundle/ resources/org/apache/jackrabbit/core/journal/ resources/org/apache/jackrabbit/core/persist...
Date Tue, 08 Jan 2008 22:56:11 GMT
Author: jukka
Date: Tue Jan  8 14:56:01 2008
New Revision: 610214

URL: http://svn.apache.org/viewvc?rev=610214&view=rev
Log:
JCR-1295: Tablespace (Filegroup) support for MS SQL Server
    - Tablespace support for MS SQL bundle pm and journal
    - Based on a patch from Vijai Kalyan

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/MSSqlPersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/journal/mssql.ddl
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/bundle/mssql.ddl

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java?rev=610214&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java
Tue Jan  8 14:56:01 2008
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.journal;
+
+import org.apache.jackrabbit.util.Text;
+
+/**
+ * It has the following property in addition to those of the DatabaseJournal:
+ * <ul>
+ * <li><code>tableSpace</code>: the MS SQL tablespace to use</li>
+ * </ul>
+ */
+public class MSSqlDatabaseJournal extends DatabaseJournal {
+
+    /** the MS SQL table space to use */
+    protected String tableSpace = "";
+
+    /**
+     * Initialize this instance with the default schema and
+     * driver values.
+     */
+    public MSSqlDatabaseJournal() {
+        setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
+        setSchema("mssql");
+    }
+
+    /**
+     * Returns the configured MS SQL table space.
+     * @return the configured MS SQL table space.
+     */
+    public String getTableSpace() {
+        return tableSpace;
+    }
+
+    /**
+     * Sets the MS SQL table space.
+     * @param tableSpace the MS SQL table space.
+     */
+    public void setTableSpace(String tableSpace) {
+        if (tableSpace != null && tableSpace.length() > 0) {
+            this.tableSpace = "on " + tableSpace.trim();
+        } else {
+            this.tableSpace = "";
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String createSchemaSQL(String sql) {
+        return Text.replace(
+                super.createSchemaSQL(sql), "${tableSpace}", tableSpace);
+    }
+
+}

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/MSSqlPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/MSSqlPersistenceManager.java?rev=610214&r1=610213&r2=610214&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/MSSqlPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/MSSqlPersistenceManager.java
Tue Jan  8 14:56:01 2008
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.persistence.bundle;
 
-import org.apache.jackrabbit.core.persistence.PMContext;
+import org.apache.jackrabbit.util.Text;
 
 /**
  * Extends the {@link BundleDbPersistenceManager} by MS-SQL specific code.
@@ -33,6 +33,7 @@
  * <li>&lt;param name="{@link #setSchema(String) schema}" value="mssql"/>
  * <li>&lt;param name="{@link #setSchemaObjectPrefix(String) schemaObjectPrefix}"
value=""/>
  * <li>&lt;param name="{@link #setErrorHandling(String) errorHandling}" value=""/>
+ * <li>&lt;param name="{@link #setTableSpace(String) tableSpace}" value=""/>
  * </ul>
  */
 public class MSSqlPersistenceManager extends BundleDbPersistenceManager {
@@ -40,18 +41,39 @@
     /** the cvs/svn id */
     static final String CVS_ID = "$URL$ $Rev$ $Date$";
 
+    /** the MS SQL table space to use */
+    protected String tableSpace = "";
+
+    public MSSqlPersistenceManager() {
+        setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
+        setSchema("mssql");
+    }
+
+    protected String createSchemaSQL(String sql) {
+        return Text.replace(
+                super.createSchemaSQL(sql), "${tableSpace}", tableSpace);
+    }
+
     /**
-     * {@inheritDoc}
+     * Returns the configured MS SQL table space.
+     * 
+     * @return the configured MS SQL table space.
      */
-    public void init(PMContext context) throws Exception {
-        // init default values
-        if (getDriver() == null) {
-            setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
-        }
-        if (getSchema() == null) {
-            setSchema("mssql");
+    public String getTableSpace() {
+        return tableSpace;
+    }
+
+    /**
+     * Sets the MS SQL table space.
+     * 
+     * @param tableSpace the MS SQL table space.
+     */
+    public void setTableSpace(String tableSpace) {
+        if (tableSpace != null && tableSpace.length() > 0) {
+            this.tableSpace = "on " + tableSpace.trim();
+        } else {
+            this.tableSpace = "";
         }
-        super.init(context);
     }
 
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/journal/mssql.ddl
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/journal/mssql.ddl?rev=610214&r1=610213&r2=610214&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/journal/mssql.ddl
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/journal/mssql.ddl
Tue Jan  8 14:56:01 2008
@@ -13,10 +13,10 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-create table ${schemaObjectPrefix}JOURNAL (REVISION_ID BIGINT NOT NULL, JOURNAL_ID varchar(255),
PRODUCER_ID varchar(255), REVISION_DATA IMAGE)
-create unique index ${schemaObjectPrefix}JOURNAL_IDX on ${schemaObjectPrefix}JOURNAL (REVISION_ID)
-create table ${schemaObjectPrefix}GLOBAL_REVISION (REVISION_ID BIGINT NOT NULL)
-create unique index ${schemaObjectPrefix}GLOBAL_REVISION_IDX on ${schemaObjectPrefix}GLOBAL_REVISION
(REVISION_ID)
+create table ${schemaObjectPrefix}JOURNAL (REVISION_ID BIGINT NOT NULL, JOURNAL_ID varchar(255),
PRODUCER_ID varchar(255), REVISION_DATA IMAGE) ${tableSpace}
+create unique index ${schemaObjectPrefix}JOURNAL_IDX on ${schemaObjectPrefix}JOURNAL (REVISION_ID)
${tableSpace}
+create table ${schemaObjectPrefix}GLOBAL_REVISION (REVISION_ID BIGINT NOT NULL) ${tableSpace}
+create unique index ${schemaObjectPrefix}GLOBAL_REVISION_IDX on ${schemaObjectPrefix}GLOBAL_REVISION
(REVISION_ID) ${tableSpace}
 
 # Inserting the one and only revision counter record now helps avoiding race conditions
 insert into ${schemaObjectPrefix}GLOBAL_REVISION VALUES(0)

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/bundle/mssql.ddl
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/bundle/mssql.ddl?rev=610214&r1=610213&r2=610214&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/bundle/mssql.ddl
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/bundle/mssql.ddl
Tue Jan  8 14:56:01 2008
@@ -1,21 +1,21 @@
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (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.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-create table ${schemaObjectPrefix}BUNDLE (NODE_ID binary(16) not null, BUNDLE_DATA image
not null)
-create unique index ${schemaObjectPrefix}BUNDLE_IDX on ${schemaObjectPrefix}BUNDLE (NODE_ID)
-create table ${schemaObjectPrefix}REFS (NODE_ID binary(16) not null, REFS_DATA image not
null)
-create unique index ${schemaObjectPrefix}REFS_IDX on ${schemaObjectPrefix}REFS (NODE_ID)
-create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(64) not null, BINVAL_DATA image
not null)
-create unique index ${schemaObjectPrefix}BINVAL_IDX on ${schemaObjectPrefix}BINVAL (BINVAL_ID)
-create table ${schemaObjectPrefix}NAMES (ID INTEGER IDENTITY(1,1) PRIMARY KEY, NAME varchar(255)
COLLATE Latin1_General_CS_AS not null)
\ No newline at end of file
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (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.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+create table ${schemaObjectPrefix}BUNDLE (NODE_ID binary(16) not null, BUNDLE_DATA image
not null) ${tableSpace}
+create unique index ${schemaObjectPrefix}BUNDLE_IDX on ${schemaObjectPrefix}BUNDLE (NODE_ID)
${tableSpace}
+create table ${schemaObjectPrefix}REFS (NODE_ID binary(16) not null, REFS_DATA image not
null) ${tableSpace}
+create unique index ${schemaObjectPrefix}REFS_IDX on ${schemaObjectPrefix}REFS (NODE_ID)
${tableSpace}
+create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(64) not null, BINVAL_DATA image
not null) ${tableSpace}
+create unique index ${schemaObjectPrefix}BINVAL_IDX on ${schemaObjectPrefix}BINVAL (BINVAL_ID)
${tableSpace}
+create table ${schemaObjectPrefix}NAMES (ID INTEGER IDENTITY(1,1) PRIMARY KEY, NAME varchar(255)
COLLATE Latin1_General_CS_AS not null) ${tableSpace}



Mime
View raw message