You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ma...@apache.org on 2009/09/06 20:01:00 UTC
svn commit: r811846 - in /jackrabbit/sandbox/JCR-1456/jackrabbit-core/src:
main/java/org/apache/jackrabbit/core/
main/java/org/apache/jackrabbit/core/config/
main/java/org/apache/jackrabbit/core/data/db/
main/java/org/apache/jackrabbit/core/fs/db/ main...
Author: martijnh
Date: Sun Sep 6 18:00:59 2009
New Revision: 811846
URL: http://svn.apache.org/viewvc?rev=811846&view=rev
Log:
JCR-1456 Database connection pooling
* Added configuration of data sources in the repository descriptor.
Added:
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/DataSourceConfig.java (with props)
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/DataSourceConfigTest.java (with props)
Modified:
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionFactory.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/TestAll.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/db/ConnectionFactoryTest.java
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/repository.xml
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/default/workspace.xml
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v1/workspace.xml
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v2/workspace.xml
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v3/workspace.xml
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/indexing-test/workspace.xml
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/security/workspace.xml
jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/wsp-init-test/workspace.xml
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java Sun Sep 6 18:00:59 2009
@@ -96,6 +96,7 @@
import org.apache.jackrabbit.core.state.ManagedMLRUItemStateCacheFactory;
import org.apache.jackrabbit.core.state.SharedItemStateManager;
import org.apache.jackrabbit.core.util.RepositoryLockMechanism;
+import org.apache.jackrabbit.core.util.db.ConnectionFactory;
import org.apache.jackrabbit.core.version.VersionManager;
import org.apache.jackrabbit.core.version.VersionManagerImpl;
import org.apache.jackrabbit.core.xml.ClonedInputSource;
@@ -272,6 +273,9 @@
try {
this.repConfig = repConfig;
+ // register the configured datasources
+ ConnectionFactory.registerDataSources(repConfig.getDataSourceConfig());
+
// setup file systems
repStore = repConfig.getFileSystem();
String fsRootPath = "/meta";
Added: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/DataSourceConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/DataSourceConfig.java?rev=811846&view=auto
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/DataSourceConfig.java (added)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/DataSourceConfig.java Sun Sep 6 18:00:59 2009
@@ -0,0 +1,224 @@
+/*
+ * 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.config;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import javax.naming.Context;
+
+/**
+ *
+ */
+public class DataSourceConfig {
+
+ public static final String LOGICAL_NAME = "logicalName";
+
+ public static final String DRIVER = "driver";
+
+ public static final String URL = "url";
+
+ public static final String USER = "user";
+
+ public static final String PASSWORD = "password";
+
+ public static final String DB_TYPE = "databaseType";
+
+ public static final String VALIDATION_QUERY = "validationQuery";
+
+ public static final String MAX_POOL_SIZE = "maxPoolSize";
+
+ private final List<DataSourceDefinition> defs = new ArrayList<DataSourceDefinition>();
+
+ /**
+ * Adds a DataSourceDefinition from the given properties.
+ *
+ * @param props the properties (key and values must be strings)
+ * @throws ConfigurationException on error
+ */
+ public void addDataSourceDefinition(Properties props) throws ConfigurationException {
+ DataSourceDefinition def = new DataSourceDefinition(props);
+ for (DataSourceDefinition existing : defs) {
+ if (existing.getLogicalName().equals(def.getLogicalName())) {
+ throw new ConfigurationException("Duplicate logicalName for a DataSource: "
+ + def.getLogicalName());
+ }
+ }
+ defs.add(def);
+ }
+
+ public List<DataSourceDefinition> getDefinitions() {
+ return Collections.unmodifiableList(defs);
+ }
+
+ /**
+ * The definition of a DataSource.
+ */
+ public static final class DataSourceDefinition {
+
+ private static final List<String> allPropNames =
+ Arrays
+ .asList(LOGICAL_NAME, DRIVER, URL, USER, PASSWORD, DB_TYPE, VALIDATION_QUERY, MAX_POOL_SIZE);
+
+ private static final List<String> allJndiPropNames =
+ Arrays.asList(LOGICAL_NAME, DRIVER, URL, USER, PASSWORD, DB_TYPE);
+
+ private final String logicalName;
+
+ private final String driver;
+
+ private final String url;
+
+ private final String user;
+
+ private final String password;
+
+ private final String dbType;
+
+ private final String validationQuery;
+
+ private final int maxPoolSize;
+
+ /**
+ * Creates a DataSourceDefinition from the given properties and
+ * throws a {@link ConfigurationException} when the set of properties does not
+ * satisfy some validity constraints.
+ *
+ * @param props the properties (string keys and values)
+ * @throws ConfigurationException on error
+ */
+ public DataSourceDefinition(Properties props) throws ConfigurationException {
+ this.logicalName = (String) props.getProperty(LOGICAL_NAME);
+ this.driver = (String) props.getProperty(DRIVER);
+ this.url = (String) props.getProperty(URL);
+ this.user = (String) props.getProperty(USER);
+ this.password = (String) props.getProperty(PASSWORD);
+ this.dbType = (String) props.getProperty(DB_TYPE);
+ this.validationQuery = (String) props.getProperty(VALIDATION_QUERY);
+ try {
+ this.maxPoolSize = Integer.parseInt((String) props.getProperty(MAX_POOL_SIZE, "0"));
+ } catch (NumberFormatException e) {
+ throw new ConfigurationException("failed to parse " + MAX_POOL_SIZE
+ + " property for DataSource " + logicalName);
+ }
+ verify(props);
+ }
+
+ private void verify(Properties props) throws ConfigurationException {
+ // Check required properties
+ if (logicalName == null || "".equals(logicalName)) {
+ throw new ConfigurationException("DataSource logical name must not be null or empty");
+ }
+ if (driver == null || "".equals(driver)) {
+ throw new ConfigurationException("DataSource driver must not be null or empty");
+ }
+ if (url == null || "".equals(url)) {
+ throw new ConfigurationException("DataSource URL must not be null or empty");
+ }
+ if (dbType == null || "".equals(dbType)) {
+ throw new ConfigurationException("DataSource databaseType must not be null or empty");
+ }
+ // Check unknown properties
+ for (Object propName : props.keySet()) {
+ if (!allPropNames.contains((String) propName)) {
+ throw new ConfigurationException("Unknown DataSource property: " + propName);
+ }
+ }
+ // Check JNDI config:
+ if (isJndiConfig()) {
+ for (Object propName : props.keySet()) {
+ if (!allJndiPropNames.contains((String) propName)) {
+ throw new ConfigurationException("Property " + propName
+ + " is not allowed for a DataSource obtained through JNDI"
+ + ", DataSource logicalName = " + logicalName);
+ }
+ }
+ }
+ }
+
+ private boolean isJndiConfig() throws ConfigurationException {
+ Class<?> driverClass = null;
+ try {
+ if (driver.length() > 0) {
+ driverClass = Class.forName(driver);
+ }
+ } catch (ClassNotFoundException e) {
+ throw new ConfigurationException("Could not load JDBC driver class " + driver, e);
+ }
+ return driverClass != null && Context.class.isAssignableFrom(driverClass);
+ }
+
+ /**
+ * @return the logicalName
+ */
+ public String getLogicalName() {
+ return logicalName;
+ }
+
+ /**
+ * @return the driver
+ */
+ public String getDriver() {
+ return driver;
+ }
+
+ /**
+ * @return the url
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * @return the user
+ */
+ public String getUser() {
+ return user;
+ }
+
+ /**
+ * @return the dbType
+ */
+ public String getDbType() {
+ return dbType;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * @return the validationQuery
+ */
+ public String getValidationQuery() {
+ return validationQuery;
+ }
+
+ /**
+ * @return the maxPoolSize
+ */
+ public int getMaxPoolSize() {
+ return maxPoolSize;
+ }
+ }
+}
Propchange: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/DataSourceConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java Sun Sep 6 18:00:59 2009
@@ -345,6 +345,11 @@
private final RepositoryLockMechanismFactory rlf;
/**
+ * The configuration for the used DataSources.
+ */
+ private final DataSourceConfig dsc;
+
+ /**
* Creates a repository configuration object.
*
* @param home repository home directory
@@ -359,6 +364,8 @@
* @param sc search configuration for system search manager.
* @param cc optional cluster configuration
* @param dsf data store factory
+ * @param rlf the RepositoryLockMechanismFactory
+ * @param dsc the DataSource configuration
* @param parser configuration parser
*/
public RepositoryConfig(
@@ -368,6 +375,7 @@
Element template, VersioningConfig vc, SearchConfig sc,
ClusterConfig cc, DataStoreFactory dsf,
RepositoryLockMechanismFactory rlf,
+ DataSourceConfig dsc,
RepositoryConfigurationParser parser) {
workspaces = new HashMap<String, WorkspaceConfig>();
this.home = home;
@@ -383,6 +391,7 @@
this.cc = cc;
this.dsf = dsf;
this.rlf = rlf;
+ this.dsc = dsc;
this.parser = parser;
}
@@ -896,6 +905,13 @@
}
/**
+ * Returns the datasource configuration.
+ */
+ public DataSourceConfig getDataSourceConfig() {
+ return dsc;
+ }
+
+ /**
* Creates and returns the configured data store. Returns
* <code>null</code> if a data store has not been configured.
*
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java Sun Sep 6 18:00:59 2009
@@ -98,6 +98,12 @@
/** Name of the cluster configuration element. */
public static final String CLUSTER_ELEMENT = "Cluster";
+ /** Name of the data source configuration element. */
+ public static final String DATASOURCES_ELEMENT = "DataSources";
+
+ /** Name of the data source configuration element. */
+ public static final String DATASOURCE_ELEMENT = "DataSource";
+
/** Name of the journal configuration element. */
public static final String JOURNAL_ELEMENT = "Journal";
@@ -266,9 +272,12 @@
RepositoryLockMechanismFactory rlf = getRepositoryLockMechanismFactory(root);
+ // Optional journal configuration
+ DataSourceConfig dsc = parseDataSourceConfig(root);
+
return new RepositoryConfig(home, securityConfig, fsf,
workspaceDirectory, workspaceConfigDirectory, defaultWorkspace,
- maxIdleTime, template, vc, sc, cc, dsf, rlf, this);
+ maxIdleTime, template, vc, sc, cc, dsf, rlf, dsc, this);
}
/**
@@ -707,6 +716,38 @@
}
/**
+ * TODO
+ *
+ * @param parent
+ * @return
+ * @throws ConfigurationException
+ */
+ protected DataSourceConfig parseDataSourceConfig(Element parent)
+ throws ConfigurationException {
+ DataSourceConfig dsc = new DataSourceConfig();
+ NodeList children = parent.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE
+ && DATASOURCES_ELEMENT.equals(child.getNodeName())) {
+ Element element = (Element) child;
+ NodeList children2 = element.getChildNodes();
+ // Process the DataSource entries:
+ for (int j = 0; j < children2.getLength(); j++) {
+ Node child2 = children2.item(j);
+ if (child2.getNodeType() == Node.ELEMENT_NODE
+ && DATASOURCE_ELEMENT.equals(child2.getNodeName())) {
+ Element dsdef = (Element) child2;
+ Properties props = parseParameters(dsdef);
+ dsc.addDataSourceDefinition(props);
+ }
+ }
+ }
+ }
+ return dsc;
+ }
+
+ /**
* Parses data store configuration. Data store configuration uses the following format:
* <pre>
* <DataStore class="...">
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java Sun Sep 6 18:00:59 2009
@@ -49,6 +49,7 @@
import java.util.Properties;
import java.util.WeakHashMap;
+import javax.jcr.RepositoryException;
import javax.sql.DataSource;
/**
@@ -178,6 +179,11 @@
protected String schemaObjectPrefix = "";
/**
+ * The logical name of the DataSource to use.
+ */
+ protected String dataSourceName;
+
+ /**
* This is the property 'table'
* in the [databaseType].properties file, initialized with the default value.
*/
@@ -542,8 +548,7 @@
try {
initDatabaseType();
- conHelper = createConnectionHelper(ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(),
- getPassword()));
+ conHelper = createConnectionHelper(getDataSource());
createCheckSchemaOperation().run();
@@ -553,6 +558,14 @@
}
}
+ private DataSource getDataSource() throws Exception {
+ if (getDataSourceName() == null || "".equals(getDataSourceName())) {
+ return ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(), getPassword());
+ } else {
+ return ConnectionFactory.getDataSource(dataSourceName);
+ }
+ }
+
/**
* This method is called from the {@link #init(String)} method of this class and returns a
* {@link ConnectionHelper} instance which is assigned to the {@code conHelper} field. Subclasses may
@@ -578,15 +591,22 @@
}
protected void initDatabaseType() throws DataStoreException {
- boolean failIfNotFound;
+ boolean failIfNotFound = false;
if (databaseType == null) {
- if (!url.startsWith("jdbc:")) {
- return;
+ if (dataSourceName != null) {
+ try {
+ databaseType = ConnectionFactory.getDataBaseType(dataSourceName);
+ } catch (RepositoryException e) {
+ throw new DataStoreException(e);
+ }
+ } else {
+ if (!url.startsWith("jdbc:")) {
+ return;
+ }
+ int start = "jdbc:".length();
+ int end = url.indexOf(':', start);
+ databaseType = url.substring(start, end);
}
- failIfNotFound = false;
- int start = "jdbc:".length();
- int end = url.indexOf(':', start);
- databaseType = url.substring(start, end);
} else {
failIfNotFound = true;
}
@@ -911,4 +931,11 @@
this.schemaObjectPrefix = schemaObjectPrefix;
}
+ public String getDataSourceName() {
+ return dataSourceName;
+ }
+
+ public void setDataSourceName(String dataSourceName) {
+ this.dataSourceName = dataSourceName;
+ }
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java Sun Sep 6 18:00:59 2009
@@ -127,6 +127,8 @@
*/
protected String password;
+ protected String dataSourceName;
+
//----------------------------------------------------< setters & getters >
public String getUrl() {
return url;
@@ -160,6 +162,13 @@
this.driver = driver;
}
+ public String getDataSourceName() {
+ return dataSourceName;
+ }
+
+ public void setDataSourceName(String dataSourceName) {
+ this.dataSourceName = dataSourceName;
+ }
//-------------------------------------------< java.lang.Object overrides >
/**
@@ -200,6 +209,11 @@
*/
@Override
protected final DataSource getDataSource() throws Exception {
- return ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(), getPassword());
+ if (getDataSourceName() == null || "".equals(getDataSourceName())) {
+ return ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(), getPassword());
+ } else {
+ setSchema(ConnectionFactory.getDataBaseType(dataSourceName));
+ return ConnectionFactory.getDataSource(dataSourceName);
+ }
}
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java Sun Sep 6 18:00:59 2009
@@ -35,6 +35,7 @@
import java.sql.SQLException;
import java.util.Calendar;
+import javax.jcr.RepositoryException;
import javax.sql.DataSource;
/**
@@ -117,6 +118,11 @@
private String password;
/**
+ * DataSource logical name, bean property.
+ */
+ private String dataSourceName;
+
+ /**
* The connection helper
*/
private ConnectionHelper conHelper;
@@ -227,8 +233,7 @@
init();
try {
- conHelper = createConnectionHelper(ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(),
- getPassword()));
+ conHelper = createConnectionHelper(getDataSource());
// make sure schemaObjectPrefix consists of legal name characters only
schemaObjectPrefix = conHelper.prepareDbIdentifier(schemaObjectPrefix);
@@ -248,6 +253,14 @@
log.info("DatabaseJournal initialized.");
}
+ private DataSource getDataSource() throws Exception {
+ if (getDataSourceName() == null || "".equals(getDataSourceName())) {
+ return ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(), getPassword());
+ } else {
+ return ConnectionFactory.getDataSource(dataSourceName);
+ }
+ }
+
/**
* This method is called from the {@link #init(String, NamespaceResolver)} method of this class and
* returns a {@link ConnectionHelper} instance which is assigned to the {@code conHelper} field.
@@ -285,15 +298,21 @@
* @throws JournalException if initialization fails
*/
protected void init() throws JournalException {
- if (driver == null) {
+ if (driver == null && dataSourceName == null) {
String msg = "Driver not specified.";
throw new JournalException(msg);
}
- if (url == null) {
+ if (url == null && dataSourceName == null) {
String msg = "Connection URL not specified.";
throw new JournalException(msg);
}
-
+ if (dataSourceName != null) {
+ try {
+ databaseType = ConnectionFactory.getDataBaseType(dataSourceName);
+ } catch (RepositoryException e) {
+ throw new JournalException("failed to get database type", e);
+ }
+ }
if (databaseType == null) {
try {
databaseType = getDatabaseTypeFromURL(url);
@@ -651,7 +670,15 @@
janitorNextRun.set(Calendar.SECOND, 0);
janitorNextRun.set(Calendar.MILLISECOND, 0);
}
-
+
+ public String getDataSourceName() {
+ return dataSourceName;
+ }
+
+ public void setDataSourceName(String dataSourceName) {
+ this.dataSourceName = dataSourceName;
+ }
+
/**
* This class manages the local revision of the cluster node. It
* persists the local revision in the LOCAL_REVISIONS table in the
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java Sun Sep 6 18:00:59 2009
@@ -111,7 +111,10 @@
/** the database type */
protected String databaseType;
-
+
+ /** the logical name of the data source to use */
+ protected String dataSourceName;
+
/** the {@link ConnectionHelper} set in the {@link #init(PMContext)} method */
protected ConnectionHelper conHelper;
@@ -309,6 +312,14 @@
this.databaseType = databaseType;
}
+ public String getDataSourceName() {
+ return dataSourceName;
+ }
+
+ public void setDataSourceName(String dataSourceName) {
+ this.dataSourceName = dataSourceName;
+ }
+
/**
* Returns if uses external (filesystem) blob store.
* @return if uses external (filesystem) blob store.
@@ -468,8 +479,7 @@
}
super.init(context);
- conHelper = createConnectionHelper(ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(),
- getPassword()));
+ conHelper = createConnectionHelper(getDataSource());
this.name = context.getHomeDir().getName();
@@ -497,6 +507,15 @@
}
+ private DataSource getDataSource() throws Exception {
+ if (getDataSourceName() == null || "".equals(getDataSourceName())) {
+ return ConnectionFactory.getDataSource(getDriver(), getUrl(), getUser(), getPassword());
+ } else {
+ setDatabaseType(ConnectionFactory.getDataBaseType(dataSourceName));
+ return ConnectionFactory.getDataSource(dataSourceName);
+ }
+ }
+
/**
* This method is called from the {@link #init(PMContext)} method of this class and returns a
* {@link ConnectionHelper} instance which is assigned to the {@code conHelper} field. Subclasses may
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionFactory.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionFactory.java Sun Sep 6 18:00:59 2009
@@ -29,28 +29,94 @@
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.dbcp.DelegatingConnection;
+import org.apache.jackrabbit.core.config.DataSourceConfig;
+import org.apache.jackrabbit.core.config.DataSourceConfig.DataSourceDefinition;
/**
* A factory for new database connections.
* Supported are regular JDBC drivers, as well as
* JNDI resources.
+ *
+ * FIXME: the registry currently is ClassLoader wide. I.e., if you start two repositories
+ * then you share the registered datasources...
*/
public class ConnectionFactory {
/**
- * The lock to protect the registry.
+ * The lock to protect the registries.
*/
private static final Object lock = new Object();
/**
- * The known data sources. The keys in the map are based on driver-url-user combination.
+ * The data sources without logical name. The keys in the map are based on driver-url-user combination.
*/
- private static final Map<String, DataSource> registry = new HashMap<String, DataSource>();
+ private static final Map<String, DataSource> keyToDataSource = new HashMap<String, DataSource>();
/**
- * Utility classes should not have a public or default constructor.
+ * The configured data sources with logical name. The keys in the map are the logical name.
*/
- private ConnectionFactory() {
+ private static final Map<String, DataSource> nameToDataSource = new HashMap<String, DataSource>();
+
+ /**
+ * The configured data source defs. The keys in the map are the logical name.
+ */
+ private static final Map<String, DataSourceDefinition> nameToDataSourceDef = new HashMap<String, DataSourceDefinition>();
+
+ /**
+ * Registers a number of data sources.
+ *
+ * @param dsc
+ */
+ public static void registerDataSources(DataSourceConfig dsc) throws RepositoryException {
+ for (DataSourceDefinition def : dsc.getDefinitions()) {
+ synchronized (lock) {
+ Class<?> driverClass = getDriverClass(def.getDriver());
+ if (driverClass != null
+ && Context.class.isAssignableFrom(driverClass)) {
+ DataSource ds = getJndiDataSource((Class<Context>) driverClass, def.getUrl());
+ nameToDataSource.put(def.getLogicalName(), ds);
+ nameToDataSourceDef.put(def.getLogicalName(), def);
+ } else {
+ BasicDataSource bds =
+ getDriverDataSource(driverClass, def.getUrl(), def.getUser(), def.getPassword());
+ if (def.getMaxPoolSize() > 0) {
+ bds.setMaxActive(def.getMaxPoolSize());
+ }
+ bds.setValidationQuery(def.getValidationQuery());
+ nameToDataSource.put(def.getLogicalName(), bds);
+ nameToDataSourceDef.put(def.getLogicalName(), def);
+ }
+ }
+ }
+ }
+
+ /**
+ * Retrieves a configured data source by logical name.
+ *
+ * @param logicalName
+ * @return
+ * @throws RepositoryException
+ */
+ public static DataSource getDataSource(String logicalName) throws RepositoryException {
+ synchronized (lock) {
+ DataSource ds = nameToDataSource.get(logicalName);
+ if (ds == null) {
+ throw new RepositoryException("DataSource with logicalName " + logicalName
+ + " has not been configured");
+ }
+ return ds;
+ }
+ }
+
+ public static String getDataBaseType(String logicalName) throws RepositoryException {
+ synchronized (lock) {
+ DataSourceDefinition def = nameToDataSourceDef.get(logicalName);
+ if (def == null) {
+ throw new RepositoryException("DataSource with logicalName " + logicalName
+ + " has not been configured");
+ }
+ return def.getDbType();
+ }
}
/**
@@ -68,28 +134,14 @@
* @throws RepositoryException if the driver could not be loaded
* @throws SQLException if the connection could not be established
*/
- @SuppressWarnings("unchecked")
public static DataSource getDataSource(String driver, String url, String user, String password)
throws RepositoryException, SQLException {
final String key = driver + url + user;
synchronized(lock) {
- DataSource ds = registry.get(key);
+ DataSource ds = keyToDataSource.get(key);
if (ds == null) {
- // Create a new pooling data source or lookup the JNDI data source and put it in the registry.
- Class<?> driverClass = getDriverClass(driver);
- if (driverClass != null
- && Context.class.isAssignableFrom(driverClass)) {
- DataSource database = getJndiDataSource((Class<Context>) driverClass, url);
- if (user == null && password == null) {
- ds = database;
- } else {
- ds = new DataSourceWrapper(database, user, password);
- }
- } else {
- ds = getDriverDataSource(driverClass, url, user, password);
- }
- // FIXME: is it good practice to cache JNDI things???
- registry.put(key, ds);
+ ds = createDataSource(driver, url, user, password);
+ keyToDataSource.put(key, ds);
}
return ds;
}
@@ -118,6 +170,33 @@
}
/**
+ * Create a new pooling data source or finds an existing JNDI data source (depends on driver).
+ *
+ * @param driver
+ * @param url
+ * @param user
+ * @param password
+ * @return
+ * @throws RepositoryException
+ */
+ private static DataSource createDataSource(String driver, String url, String user, String password)
+ throws RepositoryException {
+ Class<?> driverClass = getDriverClass(driver);
+ if (driverClass != null
+ && Context.class.isAssignableFrom(driverClass)) {
+ @SuppressWarnings("unchecked")
+ DataSource database = getJndiDataSource((Class<Context>) driverClass, url);
+ if (user == null && password == null) {
+ return database;
+ } else {
+ return new DataSourceWrapper(database, user, password);
+ }
+ } else {
+ return getDriverDataSource(driverClass, url, user, password);
+ }
+ }
+
+ /**
* Loads and returns the given JDBC driver (or JNDI context) class.
* Returns <code>null</code> if a class name is not given.
*
@@ -183,7 +262,7 @@
* @param url the JDBC connection URL
* @return pooling DataSource for accessing the specified database
*/
- private static DataSource getDriverDataSource(
+ private static BasicDataSource getDriverDataSource(
Class<?> driverClass, String url, String user, String password) {
BasicDataSource database = new BasicDataSource();
@@ -208,6 +287,7 @@
database.setDefaultAutoCommit(true);
database.setTestOnBorrow(true);
database.setMaxActive(10);
+ // FIXME: we could pass the databaseType and derive a validation query from that
// database.setValidationQuery("select 1");
return database;
Added: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/DataSourceConfigTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/DataSourceConfigTest.java?rev=811846&view=auto
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/DataSourceConfigTest.java (added)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/DataSourceConfigTest.java Sun Sep 6 18:00:59 2009
@@ -0,0 +1,129 @@
+/*
+ * 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.config;
+
+import java.util.Properties;
+
+import org.apache.jackrabbit.core.config.DataSourceConfig.DataSourceDefinition;
+
+import junit.framework.TestCase;
+
+public class DataSourceConfigTest extends TestCase {
+
+ private DataSourceConfig cfg;
+
+ private Properties minimalProps;
+
+ private Properties minimalProps2;
+
+ @Override
+ public void setUp() {
+ cfg = new DataSourceConfig();
+ minimalProps = new Properties();
+ minimalProps.put(DataSourceConfig.LOGICAL_NAME, "ds");
+ minimalProps.put(DataSourceConfig.DRIVER, "org.apache.derby.jdbc.EmbeddedDriver");
+ minimalProps.put(DataSourceConfig.URL, "url");
+ minimalProps.put(DataSourceConfig.DB_TYPE, "dbType");
+ minimalProps2 = new Properties();
+ minimalProps2.put(DataSourceConfig.LOGICAL_NAME, "ds2");
+ minimalProps2.put(DataSourceConfig.DRIVER, "org.apache.derby.jdbc.EmbeddedDriver");
+ minimalProps2.put(DataSourceConfig.URL, "url2");
+ minimalProps2.put(DataSourceConfig.DB_TYPE, "dbType2");
+ }
+
+ public void testEmptyConfig() {
+ assertEquals(0, cfg.getDefinitions().size());
+ }
+
+ public void testMinimalRegularConfig() throws ConfigurationException {
+ cfg.addDataSourceDefinition(minimalProps);
+ DataSourceDefinition def = cfg.getDefinitions().get(0);
+ assertEquals("ds", def.getLogicalName());
+ assertEquals("org.apache.derby.jdbc.EmbeddedDriver", def.getDriver());
+ assertEquals("url", def.getUrl());
+ assertEquals("dbType", def.getDbType());
+ // check default values:
+ assertNull(def.getUser());
+ assertNull(def.getPassword());
+ assertNull(def.getValidationQuery());
+ assertEquals(0, def.getMaxPoolSize());
+ }
+
+ public void testMultipleDefs() throws ConfigurationException {
+ cfg.addDataSourceDefinition(minimalProps);
+ cfg.addDataSourceDefinition(minimalProps2);
+ assertEquals(2, cfg.getDefinitions().size());
+ }
+
+ public void testTooMinimalConfig() {
+ try {
+ minimalProps.remove(DataSourceConfig.URL);
+ cfg.addDataSourceDefinition(minimalProps);
+ fail();
+ } catch (ConfigurationException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidProperty() {
+ try {
+ minimalProps.put("unknown property", "value");
+ cfg.addDataSourceDefinition(minimalProps);
+ fail();
+ } catch (ConfigurationException e) {
+ // expected
+ }
+ }
+
+ public void testUnparseableProperty() {
+ try {
+ minimalProps.put(DataSourceConfig.MAX_POOL_SIZE, "no int");
+ cfg.addDataSourceDefinition(minimalProps);
+ fail();
+ } catch (ConfigurationException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateLogicalName() throws ConfigurationException {
+ cfg.addDataSourceDefinition(minimalProps);
+ minimalProps2.put(DataSourceConfig.LOGICAL_NAME, "ds");
+ try {
+ cfg.addDataSourceDefinition(minimalProps2);
+ fail();
+ } catch (ConfigurationException e) {
+ // expected
+ }
+ }
+
+ /**
+ * It only makes sense to configure driver, url, username, password and dbType for
+ * a DataSource which is to be obtained from JNDI.
+ *
+ * @throws ConfigurationException
+ */
+ public void testConfiguredJNDIConfig() throws ConfigurationException {
+ minimalProps.put(DataSourceConfig.DRIVER, "javax.naming.InitialContext");
+ minimalProps.put(DataSourceConfig.MAX_POOL_SIZE, "10");
+ try {
+ cfg.addDataSourceDefinition(minimalProps);
+ fail();
+ } catch (ConfigurationException e) {
+ // expected
+ }
+ }
+}
Propchange: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/DataSourceConfigTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/TestAll.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/TestAll.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/TestAll.java Sun Sep 6 18:00:59 2009
@@ -39,6 +39,7 @@
suite.addTestSuite(RepositoryConfigTest.class);
suite.addTestSuite(WorkspaceConfigTest.class);
+ suite.addTestSuite(DataSourceConfigTest.class);
return suite;
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/db/ConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/db/ConnectionFactoryTest.java?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/db/ConnectionFactoryTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/db/ConnectionFactoryTest.java Sun Sep 6 18:00:59 2009
@@ -46,6 +46,4 @@
DataSource ds2 = ConnectionFactory.getDataSource(DERBY_DRIVER, DERBY_URL, "user2", "password");
assertNotSame(ds1, ds2);
}
-
- // TODO: test JNDI config
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/repository.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/repository.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/repository.xml Sun Sep 6 18:00:59 2009
@@ -19,16 +19,26 @@
"http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
<!-- Example Repository Configuration File -->
<Repository>
+
+ <DataSources>
+ <DataSource>
+ <param name="logicalName" value="ds1"/>
+ <param name="driver" value="@config.db.driver@"/>
+ <param name="url" value="@config.db.url@"/>
+ <param name="user" value="@config.db.user@"/>
+ <param name="password" value="@config.db.pwd@"/>
+ <param name="databaseType" value="@config.db.schema@"/>
+ <param name="validationQuery" value="select 1"/>
+ <param name="maxPoolSize" value="10"/>
+ </DataSource>
+ </DataSources>
+
<!--
virtual file system where the repository stores global state
(e.g. registered namespaces, custom node types, etc.)
-->
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_REP_" />
</FileSystem>
@@ -36,13 +46,8 @@
data store configuration
-->
<DataStore class="@config.db.dsclass@">
- <param name="url" value="@config.db.url@"/>
- <param name="user" value="@config.db.user@"/>
- <param name="password" value="@config.db.pwd@"/>
- <param name="databaseType" value="@config.db.schema@" />
- <param name="driver" value="@config.db.driver@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="minRecordLength" value="1024" />
- <param name="maxConnections" value="3" />
<param name="copyWhenReading" value="true" />
<param name="tablePrefix" value="" />
<param name="schemaObjectPrefix" value="@repo.id@_DS_" />
@@ -104,11 +109,7 @@
class: FQN of class implementing the FileSystem interface
-->
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
@@ -117,11 +118,7 @@
class: FQN of class implementing the PersistenceManager interface
-->
<PersistenceManager class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>
<!--
@@ -142,11 +139,7 @@
persistence manager
-->
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_version_" />
</FileSystem>
@@ -157,11 +150,7 @@
implementations.
-->
<PersistenceManager class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_version_" />
</PersistenceManager>
</Versioning>
@@ -179,11 +168,7 @@
-->
<Cluster id="node1">
<Journal class="@config.db.journalclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_cluster_" />
<param name="janitorEnabled" value="false" />
</Journal>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/default/workspace.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/default/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/default/workspace.xml Sun Sep 6 18:00:59 2009
@@ -16,21 +16,12 @@
<Workspace name="default">
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
- <PersistenceManager
- class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <PersistenceManager class="@config.db.pmclass@">
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v1/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v1/workspace.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v1/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v1/workspace.xml Sun Sep 6 18:00:59 2009
@@ -18,21 +18,12 @@
<Workspace name="index-format-v1">
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
- <PersistenceManager
- class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <PersistenceManager class="@config.db.pmclass@">
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v2/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v2/workspace.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v2/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v2/workspace.xml Sun Sep 6 18:00:59 2009
@@ -18,21 +18,12 @@
<Workspace name="index-format-v2">
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
- <PersistenceManager
- class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <PersistenceManager class="@config.db.pmclass@">
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v3/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v3/workspace.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v3/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/index-format-v3/workspace.xml Sun Sep 6 18:00:59 2009
@@ -18,21 +18,12 @@
<Workspace name="index-format-v3">
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
- <PersistenceManager
- class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <PersistenceManager class="@config.db.pmclass@">
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/indexing-test/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/indexing-test/workspace.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/indexing-test/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/indexing-test/workspace.xml Sun Sep 6 18:00:59 2009
@@ -18,21 +18,12 @@
<Workspace name="indexing-test">
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
- <PersistenceManager
- class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <PersistenceManager class="@config.db.pmclass@">
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/security/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/security/workspace.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/security/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/security/workspace.xml Sun Sep 6 18:00:59 2009
@@ -18,21 +18,12 @@
<Workspace name="security">
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
- <PersistenceManager
- class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <PersistenceManager class="@config.db.pmclass@">
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/wsp-init-test/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/wsp-init-test/workspace.xml?rev=811846&r1=811845&r2=811846&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/wsp-init-test/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository-descriptor-overlay/workspaces/wsp-init-test/workspace.xml Sun Sep 6 18:00:59 2009
@@ -18,21 +18,12 @@
<Workspace name="wsp-init-test">
<FileSystem class="@config.db.fsclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</FileSystem>
- <PersistenceManager
- class="@config.db.pmclass@">
- <param name="driver" value="@config.db.driver@" />
- <param name="url" value="@config.db.url@" />
- <param name="schema" value="@config.db.schema@" />
- <param name="user" value="@config.db.user@" />
- <param name="password" value="@config.db.pwd@" />
+ <PersistenceManager class="@config.db.pmclass@">
+ <param name="dataSourceName" value="ds1"/>
<param name="schemaObjectPrefix" value="@repo.id@_${wsp.name}_" />
</PersistenceManager>