Author: shawkins
Date: 2009-05-28 07:04:30 -0400 (Thu, 28 May 2009)
New Revision: 1003
Added:
trunk/client/src/main/java/com/metamatrix/dqp/embedded/
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
trunk/engine/src/main/java/com/metamatrix/common/application/ServiceLoader.java
Removed:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDataSource.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
trunk/common-core/src/main/java/com/metamatrix/common/classloader/PostDelegatingClassLoader.java
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/CacheProvider.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedDataService.java
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java
trunk/embedded/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java
trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java
trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/server/src/main/java/com/metamatrix/server/CacheProvider.java
trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java
Log:
TEIID-590 TEIID-632 fixes to embedded to make integration easier
Copied: trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
(from rev 1000,
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java)
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
(rev 0)
+++
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.dqp.embedded;
+
+/**
+ */
+public interface DQPEmbeddedProperties {
+
+ public static final String DQP_LOGFILE = "dqp.logFile"; //$NON-NLS-1$
+ public static final String DQP_LOGLEVEL = "dqp.logLevel"; //$NON-NLS-1$
+ public static final String DQP_EXTENSIONS = "dqp.extensions";
//$NON-NLS-1$
+ public static final String DQP_CONFIGFILE = "dqp.configFile";
//$NON-NLS-1$
+ public static final String DQP_METADATA_SYSTEMURL =
"dqp.metadata.systemURL"; //$NON-NLS-1$
+ public static final String VDB_DEFINITION = "vdb.definition";
//$NON-NLS-1$
+ public static final String USER_DEFINED_FUNCTIONS =
"dqp.userDefinedFunctionsFile"; //$NON-NLS-1$
+ public static final String COMMON_EXTENSION_CLASPATH =
"dqp.extension.CommonClasspath"; //$NON-NLS-1$
+ public static final String DQP_KEYSTORE = "dqp.keystore"; //$NON-NLS-1$
+ public static final String DQP_IDENTITY = "dqp.identity"; //$NON-NLS-1$
+ public static final String DQP_TMPDIR = "mm.io.tmpdir"; //$NON-NLS-1$
+
+ public interface BufferService {
+ /**
+ * Property prefix for DQP Buffer Service properties.
+ */
+ public static final String BUFFER_PREFIX = "dqp.buffer"; //$NON-NLS-1$
+
+ /**
+ * Determines whether buffer management should be all-memory (if false)
+ * or mixed memory and disk access (if true). Default value is false.
+ */
+ public static final String DQP_BUFFER_USEDISK = BUFFER_PREFIX +
".usedisk"; //$NON-NLS-1$
+
+ /**
+ * Determines the directory to use if buffer management is using disk.
+ * This property is not used if DQP_BUFFER_USEDISK = true. Default value
+ * is ".".
+ */
+ public static final String DQP_BUFFER_DIR = BUFFER_PREFIX + ".dir";
//$NON-NLS-1$
+
+ /**
+ * Determines amount of memory to use in-memory before buffering to
+ * disk. This property is not used if DQP_BUFFER_USEDISK = true. The
+ * value is in megabytes. Default value is 32.
+ */
+ public static final String DQP_BUFFER_MEMORY = BUFFER_PREFIX +
".memory"; //$NON-NLS-1$
+
+ /**
+ * The maximum number of rows a processor batch should contain. Default is 2000.
+ */
+ public static final String DQP_PROCESSOR_BATCH_SIZE = BUFFER_PREFIX +
".processorBatchSize"; //$NON-NLS-1$
+
+ /**
+ * The maximum number of rows a connector batch should contain. Default is 2000.
+ */
+ public static final String DQP_CONNECTOR_BATCH_SIZE = BUFFER_PREFIX +
".connectorBatchSize"; //$NON-NLS-1$
+ }
+
+ public interface DataService {
+ /**
+ * Property prefix for DQP Data Service properties.
+ */
+ public static final String DATA_PREFIX = "dqp.data"; //$NON-NLS-1$
+ }
+
+ public interface MetadataService {
+ /**
+ * Property prefix for DQP Metadata Service properties.
+ */
+ public static final String METADATA_PREFIX = "dqp.metadata";
//$NON-NLS-1$
+ }
+}
Property changes on:
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,6 +22,7 @@
package com.metamatrix.jdbc;
+import java.net.URL;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
@@ -31,14 +32,17 @@
* defined so that it can be used with DQP class loading.
*/
public interface EmbeddedConnectionFactory {
+
+ public void initialize(URL bootstrapURL, Properties props) throws SQLException;
/**
* Create a Connection to the DQP. This will load a DQP instance if one is not
present
+ * @param bootstrapURL
* @param properties
* @return Connection to DQP
* @throws SQLException
*/
- public Connection createConnection(Properties properties) throws SQLException;
+ public Connection createConnection(URL bootstrapURL, Properties properties) throws
SQLException;
/**
* Shutdown the connection factory, including the DQP and all its existing
connections
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDataSource.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDataSource.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDataSource.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,7 +22,6 @@
package com.metamatrix.jdbc;
-import java.net.MalformedURLException;
import java.net.URL;
import java.sql.Connection;
import java.sql.SQLException;
@@ -45,44 +44,6 @@
*/
private String bootstrapFile;
- //*************************** ConnectionPoolDataSource Specific Properties
- /**
- * maxstatements -
- * The total number of statements that the pool should keep open.
- * 0 (zero) indicates that caching of statements is disabled.
- */
- private int maxStatements;
- /**
- * initialPoolSize -
- * The number of physical connections the pool should contain when it is created
- */
- private int initialPoolSize;
- /**
- * minPoolSize -
- * The number of physical connections the pool should keep available at all times.
- * 0 (zero) indicates that connections should be created as needed.
- */
- private int minPoolSize;
- /**
- * maxPoolSize -
- * The maximum number of physical connections that the pool should contain.
- * 0 (zero) indicates no maximum size.
- */
- private int maxPoolSize;
- /**
- * maxIdleTime -
- * The number of seconds that a physical connection should remain unused in the pool
- * before the connection is closed. 0 (zero) indicates no limit.
- */
- private int maxIdleTime;
- /**
- * propertyCycle -
- * The interval, in seconds, that the pool should wait before enforcing the current
- * policy defined by the values of the above connection pool properties
- */
- private int propertyCycle;
-
-
// string constant for the embedded configuration file property
public static final String DQP_BOOTSTRAP_FILE = "bootstrapFile";
//$NON-NLS-1$
@@ -100,16 +61,10 @@
final String password) {
Properties props = super.buildProperties(userName, password);
- if (this.getBootstrapFile() != null &&
this.getBootstrapFile().trim().length() != 0) {
- try {
- if
(this.getBootstrapFile().equals(EmbeddedDriver.getDefaultConnectionURL())) {
- props.put("vdb.definition", getDatabaseName() +".vdb");
//$NON-NLS-1$ //$NON-NLS-2$
- }
- props.put(EmbeddedDataSource.DQP_BOOTSTRAP_FILE,
URLHelper.buildURL(this.getBootstrapFile().trim()));
- } catch (MalformedURLException e) {
- // we can safely ignore as this will would have caught in validate..
- }
- }
+ if (this.getBootstrapFile().equals(EmbeddedDriver.getDefaultConnectionURL())) {
+ props.put("vdb.definition", getDatabaseName() +".vdb");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ props.put(DQP_BOOTSTRAP_FILE, this.bootstrapFile);
return props;
}
@@ -179,111 +134,4 @@
this.bootstrapFile = configFile;
}
- /**
- * @return Returns the initialPoolSize.
- * @since 4.3
- */
- public int getInitialPoolSize() {
- return this.initialPoolSize;
- }
-
-
- /**
- * @param initialPoolSize The initialPoolSize to set.
- * @since 4.3
- */
- public void setInitialPoolSize(int initialPoolSize) {
- this.initialPoolSize = initialPoolSize;
- }
-
-
- /**
- * @return Returns the maxIdleTime.
- * @since 4.3
- */
- public int getMaxIdleTime() {
- return this.maxIdleTime;
- }
-
-
- /**
- * @param maxIdleTime The maxIdleTime to set.
- * @since 4.3
- */
- public void setMaxIdleTime(int maxIdleTime) {
- this.maxIdleTime = maxIdleTime;
- }
-
-
- /**
- * @return Returns the maxPoolSize.
- * @since 4.3
- */
- public int getMaxPoolSize() {
- return this.maxPoolSize;
- }
-
-
- /**
- * @param maxPoolSize The maxPoolSize to set.
- * @since 4.3
- */
- public void setMaxPoolSize(int maxPoolSize) {
- this.maxPoolSize = maxPoolSize;
- }
-
-
- /**
- * @return Returns the maxStatements.
- * @since 4.3
- */
- public int getMaxStatements() {
- return this.maxStatements;
- }
-
-
- /**
- * @param maxStatements The maxStatements to set.
- * @since 4.3
- */
- public void setMaxStatements(int maxStatements) {
- this.maxStatements = maxStatements;
- }
-
-
- /**
- * @return Returns the minPoolSize.
- * @since 4.3
- */
- public int getMinPoolSize() {
- return this.minPoolSize;
- }
-
-
- /**
- * @param minPoolSize The minPoolSize to set.
- * @since 4.3
- */
- public void setMinPoolSize(int minPoolSize) {
- this.minPoolSize = minPoolSize;
- }
-
-
- /**
- * @return Returns the propertyCycle.
- * @since 4.3
- */
- public int getPropertyCycle() {
- return this.propertyCycle;
- }
-
-
- /**
- * @param propertyCycle The propertyCycle to set.
- * @since 4.3
- */
- public void setPropertyCycle(int propertyCycle) {
- this.propertyCycle = propertyCycle;
- }
-
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -28,18 +28,16 @@
import java.io.ObjectInputStream;
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
-import java.util.StringTokenizer;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -49,6 +47,8 @@
import com.metamatrix.common.protocol.MetaMatrixURLStreamHandlerFactory;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.common.util.ApplicationInfo;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.jdbc.util.MMJDBCURL;
/**
@@ -74,10 +74,7 @@
static final String URL_PATTERN =
"jdbc:metamatrix:(\\w+)@(([^;]*)[;]?)((.*)*)"; //$NON-NLS-1$
static final String BASE_PATTERN =
"jdbc:metamatrix:((\\w+)[;]?)(;([^@])+)*"; //$NON-NLS-1$
public static final String DRIVER_NAME = "Teiid Embedded JDBC Driver";
//$NON-NLS-1$
- public static final String POST_DELEGATION_LIBRARIES =
"PostDelegationLibraries"; //$NON-NLS-1$
- static final String DQP_IDENTITY = "dqp.identity"; //$NON-NLS-1$
- static final String MM_IO_TMPDIR = "mm.io.tmpdir"; //$NON-NLS-1$
private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
private static EmbeddedTransport currentTransport = null;
@@ -108,6 +105,8 @@
// create a properties obj if it is null
if (info == null) {
info = new Properties();
+ } else {
+ info = PropertiesUtils.clone(info);
}
if (!acceptsURL(url)) {
return null;
@@ -123,22 +122,24 @@
return conn;
}
-
+
Connection createConnection(Properties info) throws SQLException{
// first validate the properties as this may called from the EmbeddedDataSource
// and make sure we have all the properties we need.
validateProperties(info);
+ URL dqpURL;
+ try {
+ dqpURL = URLHelper.buildURL(info.getProperty(EmbeddedDataSource.DQP_BOOTSTRAP_FILE));
+ } catch (MalformedURLException e) {
+ throw MMSQLException.create(e);
+ }
+
// now create the connection
- URL dqpURL = (URL)info.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE);
EmbeddedTransport transport = getDQPTransport(dqpURL, info);
Connection conn = transport.createConnection(info);
-
- // only upon successful creation of the connection, keep the transport
- // available for future connections
- currentTransport = transport;
return conn;
}
@@ -151,7 +152,7 @@
* @throws SQLException
* @since 4.4
*/
- private static EmbeddedTransport getDQPTransport(URL dqpURL, Properties info) throws
SQLException {
+ private synchronized static EmbeddedTransport getDQPTransport(URL dqpURL, Properties
info) throws SQLException {
EmbeddedTransport transport = currentTransport;
if (transport != null && currentTransport.getURL().equals(dqpURL)) {
String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDriver.use_existing_transport");
//$NON-NLS-1$
@@ -164,6 +165,7 @@
String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDriver.use_new_transport");
//$NON-NLS-1$
DriverManager.println(logMsg);
}
+ currentTransport = transport;
return transport;
}
@@ -198,9 +200,7 @@
connectionURL = getDefaultConnectionURL();
info.setProperty("vdb.definition",
jdbcURL.getVDBName()+".vdb"); //$NON-NLS-1$ //$NON-NLS-2$
}
-
- // Set the dqp.properties file properties
- URL dqpURL = URLHelper.buildURL(connectionURL);
+ info.setProperty(EmbeddedDataSource.DQP_BOOTSTRAP_FILE, connectionURL);
Properties optionalParams = jdbcURL.getProperties();
MMJDBCURL.normalizeProperties(info);
@@ -221,10 +221,6 @@
if(!info.containsKey(BaseDataSource.APP_NAME)) {
info.setProperty(BaseDataSource.APP_NAME,
BaseDataSource.DEFAULT_APP_NAME);
}
-
- // Add the DQP URL as the configuration URL
- info.put(EmbeddedDataSource.DQP_BOOTSTRAP_FILE, dqpURL);
-
} catch (Exception e) {
String logMsg = e.getClass() +": "+e.getMessage(); //$NON-NLS-1$
DriverManager.println(logMsg);
@@ -259,13 +255,6 @@
throw new SQLException(logMsg);
}
- // DQP config file must be supplied
- URL url = (URL)info.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE);
- if (url == null) {
- String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDataSource.Configuration_file_must_be_specified");
//$NON-NLS-1$
- DriverManager.println(logMsg);
- throw new SQLException(logMsg);
- }
}
@@ -297,9 +286,7 @@
@Override
List<DriverPropertyInfo> getAdditionalPropertyInfo(String url,
Properties info) {
- DriverPropertyInfo dpi = new
DriverPropertyInfo(EmbeddedDataSource.DQP_BOOTSTRAP_FILE,
info.getProperty(EmbeddedDataSource.DQP_BOOTSTRAP_FILE));
- dpi.required = true;
- return Arrays.asList(dpi);
+ return Collections.emptyList();
}
/**
@@ -355,19 +342,22 @@
this.url = dqpURL;
- // Create a temporary workspace directory
- this.workspaceDirectory = createWorkspace(getDQPIdentity());
-
//Load the properties from dqp.properties file
Properties props = loadDQPProperties(dqpURL);
props.putAll(info);
-
+
+ props = PropertiesUtils.resolveNestedProperties(props);
+
+ String dqpId = getDQPIdentity();
+ props.setProperty(DQPEmbeddedProperties.DQP_IDENTITY, dqpId);
+ // Create a temporary workspace directory
+ this.workspaceDirectory =
createWorkspace(props.getProperty(DQPEmbeddedProperties.DQP_TMPDIR), dqpId);
+
this.classLoader = this.getClass().getClassLoader();
// a non-delegating class loader will be created from where all third party
dependent jars can be loaded
ArrayList<URL> runtimeClasspathList = new ArrayList<URL>();
- ArrayList<URL> postDelegationClasspathList = null;
- String libLocation = info.getProperty("dqp.lib",
"./lib/"); //$NON-NLS-1$ //$NON-NLS-2$
+ String libLocation = props.getProperty("dqp.lib",
"./lib/"); //$NON-NLS-1$ //$NON-NLS-2$
if (!libLocation.endsWith("/")) { //$NON-NLS-1$
libLocation = libLocation + "/"; //$NON-NLS-1$
}
@@ -375,32 +365,12 @@
// find jars in the "lib" directory; patches is reverse alpaha and
not case sensitive so small letters then capitals
if (!EmbeddedDriver.getDefaultConnectionURL().equals(dqpURL.toString())) {
runtimeClasspathList.addAll(libClassPath(dqpURL,
libLocation+"patches/", MMURLConnection.REVERSEALPHA)); //$NON-NLS-1$
-
- // check if a specific post delegation rules specified for loading
- String postDelgationLibraries =
info.getProperty(POST_DELEGATION_LIBRARIES);
- if (postDelgationLibraries != null) {
- postDelegationClasspathList = resolvePath(dqpURL, libLocation,
postDelgationLibraries);
- List<URL> postDelegationPatches = new
ArrayList<URL>(runtimeClasspathList);
- postDelegationPatches.retainAll(postDelegationClasspathList);
- postDelegationClasspathList.removeAll(postDelegationPatches);
- postDelegationClasspathList.addAll(0, postDelegationPatches);
- }
-
runtimeClasspathList.addAll(libClassPath(dqpURL, libLocation,
MMURLConnection.DATE));
-
- if (postDelegationClasspathList != null) {
- runtimeClasspathList.removeAll(postDelegationClasspathList);
- }
}
URL[] dqpClassPath = runtimeClasspathList.toArray(new
URL[runtimeClasspathList.size()]);
- this.classLoader = new URLClassLoader(dqpClassPath,
Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
+ this.classLoader = new PostDelegatingClassLoader(dqpClassPath,
Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
- if (postDelegationClasspathList != null &&
!postDelegationClasspathList.isEmpty()) {
- URL[] path = postDelegationClasspathList.toArray(new
URL[postDelegationClasspathList.size()]);
- this.classLoader = new PostDelegatingClassLoader(path, this.classLoader, new
MetaMatrixURLStreamHandlerFactory());
- }
-
String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDriver.use_classpath");
//$NON-NLS-1$
DriverManager.println(logMsg);
for (int i = 0; i < dqpClassPath.length; i++) {
@@ -408,13 +378,13 @@
}
// Now using this class loader create the connection factory to the dqp.
- ClassLoader current = null;
+ ClassLoader current = Thread.currentThread().getContextClassLoader();
try {
- current = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.classLoader);
String className =
"com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl"; //$NON-NLS-1$
- Class clazz = this.classLoader.loadClass(className);
+ Class<?> clazz = this.classLoader.loadClass(className);
this.connectionFactory = (EmbeddedConnectionFactory)clazz.newInstance();
+ this.connectionFactory.initialize(dqpURL, props);
} catch (Exception e) {
DriverManager.println(e.getClass() +": "+e.getMessage());
//$NON-NLS-1$
throw new EmbeddedSQLException(e);
@@ -455,19 +425,6 @@
return urlList;
}
- private ArrayList<URL> resolvePath(URL dqpURL, String directory, String
path) throws SQLException {
- StringTokenizer st = new StringTokenizer(path, ","); //$NON-NLS-1$
- ArrayList<URL> urlList = new ArrayList<URL>();
- while (st.hasMoreTokens()) {
- try {
- urlList.add(URLHelper.buildURL(dqpURL, directory+st.nextToken()));
- } catch (MalformedURLException e) {
- throw new EmbeddedSQLException(e);
- }
- }
- return urlList;
- }
-
/**
* Load DQP Properties from the URL supplied.
* @param dqpURL - URL to the "dqp.properties" object
@@ -526,7 +483,7 @@
try {
current = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
- return connectionFactory.createConnection(info);
+ return connectionFactory.createConnection(url, info);
} finally {
Thread.currentThread().setContextClassLoader(current);
}
@@ -537,21 +494,29 @@
* @return a JVM level unique identifier
*/
String getDQPIdentity() {
- String id = System.getProperty(DQP_IDENTITY, "0"); //$NON-NLS-1$
+ String id = System.getProperty(DQPEmbeddedProperties.DQP_IDENTITY,
"0"); //$NON-NLS-1$
int identity = Integer.parseInt(id)+1;
id = String.valueOf(identity);
- System.setProperty(DQP_IDENTITY, id);
-
return id;
}
/**
* Create the temporary workspace directory for the dqp
* @param identity - identity of the dqp
+ * @throws MMSQLException
*/
- String createWorkspace(String identity) {
- String dir =
System.getProperty("java.io.tmpdir")+"/metamatrix/"+identity;
//$NON-NLS-1$ //$NON-NLS-2$
- System.setProperty(MM_IO_TMPDIR, dir);
+ String createWorkspace(String baseDir, String identity) throws MMSQLException {
+ if (baseDir == null) {
+ baseDir = System.getProperty("java.io.tmpdir")+"/teiid/";
//$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ try {
+ baseDir = URLHelper.buildURL(this.url, baseDir).getPath();
+ } catch (MalformedURLException e) {
+ throw MMSQLException.create(e);
+ }
+ }
+ String dir = baseDir + identity;
+ System.setProperty(DQPEmbeddedProperties.DQP_TMPDIR, dir);
File f = new File(dir);
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/classloader/PostDelegatingClassLoader.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/classloader/PostDelegatingClassLoader.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/common-core/src/main/java/com/metamatrix/common/classloader/PostDelegatingClassLoader.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -23,7 +23,6 @@
package com.metamatrix.common.classloader;
import java.net.URL;
-import java.net.URLClassLoader;
import java.net.URLStreamHandlerFactory;
/**
@@ -62,12 +61,15 @@
*/
public synchronized Class loadClass(String name) throws ClassNotFoundException {
+ if (name.startsWith("javax.") || name.startsWith("java.")) {
//$NON-NLS-1$ //$NON-NLS-2$
+ return super.loadClass(name);
+ }
+
Class loadedClass = this.findLoadedClass(name);
if (loadedClass != null) {
return loadedClass;
}
-
// class not in cache
try {
loadedClass = super.findClass(name);
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -753,7 +753,7 @@
* @return resolved properties object.
* @since 4.4
*/
- public static Properties resolveNestedProperties(Properties original) throws
IOException{
+ public static Properties resolveNestedProperties(Properties original) {
Properties modified = new Properties();
for(Enumeration e = original.keys(); e.hasMoreElements();) {
Modified: trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-05-28
11:04:30 UTC (rev 1003)
@@ -1,4 +1,5 @@
<ComponentType Name="JDBC Connector" ComponentTypeCode="2"
Deployable="true" Deprecated="false" Monitorable="false"
SuperComponentType="Connector" ParentComponentType="Connectors"
LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.952-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.952-06:00">
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription="" DefaultValue="jdbc:" IsRequired="true"
PropertyType="String"/>
<PropertyDefinition Name="User" DisplayName="User
Name" ShortDescription="" />
<PropertyDefinition Name="Password"
DisplayName="Password" ShortDescription="" IsMasked="true"
/>
<PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}-${project.version}.jar;${classpath}"
IsModifiable="false" />
Deleted:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.embedded;
-
-/**
- */
-public interface DQPEmbeddedProperties {
-
- public static final String DQP_LOGFILE = "dqp.logFile"; //$NON-NLS-1$
- public static final String DQP_LOGLEVEL = "dqp.logLevel"; //$NON-NLS-1$
- public static final String DQP_SERVICE_METADATA = "dqp.service.metadata";
//$NON-NLS-1$
- public static final String DQP_SERVICE_DATA = "dqp.service.data";
//$NON-NLS-1$
- public static final String DQP_EXTENSIONS = "dqp.extensions";
//$NON-NLS-1$
- public static final String DQP_CONFIGFILE = "dqp.configFile";
//$NON-NLS-1$
- public static final String DQP_METADATA_SYSTEMURL =
"dqp.metadata.systemURL"; //$NON-NLS-1$
- public static final String VDB_DEFINITION = "vdb.definition";
//$NON-NLS-1$
- public static final String USER_DEFINED_FUNCTIONS =
"dqp.userDefinedFunctionsFile"; //$NON-NLS-1$
- public static final String COMMON_EXTENSION_CLASPATH =
"dqp.extension.CommonClasspath"; //$NON-NLS-1$
- public static final String DQP_KEYSTORE = "dqp.keystore"; //$NON-NLS-1$
- public static final String DQP_IDENTITY = "dqp.identity"; //$NON-NLS-1$
- public static final String DQP_TMPDIR = "mm.io.tmpdir"; //$NON-NLS-1$
-
- // Holds the value of the DQP Embedded configuration properties file.
- public static final String DQP_BOOTSTRAP_PROPERTIES_FILE =
"dqp.propertiesFile"; //$NON-NLS-1$
-
-
- public interface BufferService {
- /**
- * Property prefix for DQP Buffer Service properties.
- */
- public static final String BUFFER_PREFIX = "dqp.buffer"; //$NON-NLS-1$
-
- /**
- * Determines whether buffer management should be all-memory (if false)
- * or mixed memory and disk access (if true). Default value is false.
- */
- public static final String DQP_BUFFER_USEDISK = BUFFER_PREFIX +
".usedisk"; //$NON-NLS-1$
-
- /**
- * Determines the directory to use if buffer management is using disk.
- * This property is not used if DQP_BUFFER_USEDISK = true. Default value
- * is ".".
- */
- public static final String DQP_BUFFER_DIR = BUFFER_PREFIX + ".dir";
//$NON-NLS-1$
-
- /**
- * Determines amount of memory to use in-memory before buffering to
- * disk. This property is not used if DQP_BUFFER_USEDISK = true. The
- * value is in megabytes. Default value is 32.
- */
- public static final String DQP_BUFFER_MEMORY = BUFFER_PREFIX +
".memory"; //$NON-NLS-1$
-
- /**
- * The maximum number of rows a processor batch should contain. Default is 2000.
- */
- public static final String DQP_PROCESSOR_BATCH_SIZE = BUFFER_PREFIX +
".processorBatchSize"; //$NON-NLS-1$
-
- /**
- * The maximum number of rows a connector batch should contain. Default is 2000.
- */
- public static final String DQP_CONNECTOR_BATCH_SIZE = BUFFER_PREFIX +
".connectorBatchSize"; //$NON-NLS-1$
- }
-
- public interface DataService {
- /**
- * Property prefix for DQP Data Service properties.
- */
- public static final String DATA_PREFIX = "dqp.data"; //$NON-NLS-1$
- }
-
- public interface MetadataService {
- /**
- * Property prefix for DQP Metadata Service properties.
- */
- public static final String METADATA_PREFIX = "dqp.metadata";
//$NON-NLS-1$
- }
-}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,8 +22,6 @@
package com.metamatrix.dqp.embedded;
-import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -33,12 +31,13 @@
import com.google.inject.Binder;
import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.name.Named;
+import com.google.inject.name.Names;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.dqp.embedded.services.EmbeddedBufferService;
import com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService;
import com.metamatrix.dqp.embedded.services.EmbeddedDataService;
@@ -47,8 +46,6 @@
import com.metamatrix.dqp.embedded.services.EmbeddedTransactionService;
import com.metamatrix.dqp.embedded.services.EmbeddedVDBService;
import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.jdbc.EmbeddedDataSource;
-import com.metamatrix.jdbc.JDBCPlugin;
/**
* This class is main hook point for the Embedded DQP configuration. This classe's
@@ -56,11 +53,12 @@
* services used the DQP.
*
*/
+@Singleton
public class EmbeddedConfigSource implements DQPConfigSource {
- private static final String SERVER_CONFIG_FILE_EXTENSION = ".properties";
//$NON-NLS-1$
private Properties props;
private boolean useTxn;
+ private URL dqpURL;
@Inject
DQPContextCache contextCache;
@@ -70,67 +68,12 @@
* @param configFile
* @throws ApplicationInitializationException
*/
- public EmbeddedConfigSource(Properties connectionProperties) {
-
- URL dqpURL = (URL)connectionProperties.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE);
- if(dqpURL == null) {
- throw new
MetaMatrixRuntimeException(JDBCPlugin.Util.getString("LocalTransportHandler.No_configuration_file_set_in_property",
DQPEmbeddedProperties.DQP_BOOTSTRAP_PROPERTIES_FILE)); //$NON-NLS-1$
- }
-
- String dqpFileName = dqpURL.toString().toLowerCase();
- if (!dqpFileName.endsWith(SERVER_CONFIG_FILE_EXTENSION)) {
- throw new
MetaMatrixRuntimeException(JDBCPlugin.Util.getString("LocalTransportHandler.Invalid_config_file_extension",
dqpFileName) ); //$NON-NLS-1$
- }
-
- String dqpURLString = dqpURL.toString();
- try {
- dqpURL = URLHelper.buildURL(dqpURLString);
- InputStream in = dqpURL.openStream();
- if (in == null) {
- throw new
MetaMatrixRuntimeException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigSource.Can_not_load_config_file_2",
dqpURL)); //$NON-NLS-1$
- }
-
- // Load the "dqp.properties" file.
- props = new Properties();
- props.load(in);
- in.close();
-
- // Merge any user properties with the mm.properties
- props.putAll(connectionProperties);
-
- // this will resolve any nested properties in the properties
- // file; this created for testing purpose
- props = PropertiesUtils.resolveNestedProperties(props);
-
- // create a unique identity number for this DQP
- props.setProperty(DQPEmbeddedProperties.DQP_IDENTITY, getDQPIdentity());
-
- // create a workspace directory for the DQP
- props.setProperty(DQPEmbeddedProperties.DQP_TMPDIR,
getWorkspaceDirectory());
-
- // This is context of where the dqp.properties loaded, VDB are defined
relative to
- // this path.
- props.put(DQPEmbeddedProperties.DQP_BOOTSTRAP_PROPERTIES_FILE, dqpURL);
-
- useTxn = PropertiesUtils.getBooleanProperty(props,
EmbeddedTransactionService.TRANSACTIONS_ENABLED, true);
- } catch (IOException e) {
- throw new MetaMatrixRuntimeException(e);
- }
+ @Inject public EmbeddedConfigSource(@Named("BootstrapURL") URL dqpURL,
@Named("DQPProperties") Properties connectionProperties) {
+ this.dqpURL = dqpURL;
+ this.props = connectionProperties;
+ useTxn = PropertiesUtils.getBooleanProperty(props,
EmbeddedTransactionService.TRANSACTIONS_ENABLED, true);
}
- /**
- * create an identity for the DQP instance in this JVM
- * @return int a unique number for this JVM
- */
- String getDQPIdentity() {
- String id = System.getProperty(DQPEmbeddedProperties.DQP_IDENTITY,
"0"); //$NON-NLS-1$
- return id;
- }
-
- String getWorkspaceDirectory() {
- return System.getProperty(DQPEmbeddedProperties.DQP_TMPDIR,
System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
- }
-
/**
* @see com.metamatrix.common.application.DQPConfigSource#getProperties()
*/
@@ -143,6 +86,7 @@
if (contextCache != null) {
binder.bind(DQPContextCache.class).toInstance(contextCache);
}
+ binder.bind(URL.class).annotatedWith(Names.named("BootstrapURL")).toInstance(this.dqpURL);
//$NON-NLS-1$
}
@Override
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -38,6 +38,8 @@
import java.util.Set;
import java.util.StringTokenizer;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.AbstractClassLoaderManager;
import com.metamatrix.common.application.ApplicationEnvironment;
@@ -96,7 +98,10 @@
private static final String VDB = ".vdb"; //$NON-NLS-1$
private static final String DEF = ".def"; //$NON-NLS-1$
- Properties userPreferences;
+ public final static String PROPERTIES_URL = "dqp.bootstrap"; //$NON-NLS-1$
+
+ private Properties userPreferences;
+ private URL bootStrapURL;
private Map<String, VDBArchive> loadedVDBs = new HashMap<String,
VDBArchive>();
Map<String, ConnectorBinding> loadedConnectorBindings = new HashMap<String,
ConnectorBinding>();
Map<String, ComponentType> loadedConnectorTypes = new HashMap<String,
ComponentType>();
@@ -114,7 +119,7 @@
@Override
public String getCommonExtensionClassPath() {
- return userPreferences.getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH,
""); //$NON-NLS-1$
+ return
getUserPreferences().getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH,
""); //$NON-NLS-1$
}
@Override
@@ -122,7 +127,15 @@
return ExtensionModuleReader.resolveExtensionModule(url, getExtensionPath());
}
};
-
+
+ public URL getBootStrapURL() {
+ return bootStrapURL;
+ }
+
+ @Inject public void setBootStrapURL(@Named("BootstrapURL") URL
bootStrapURL) {
+ this.bootStrapURL = bootStrapURL;
+ }
+
boolean valid(String str) {
if (str != null) {
str = str.trim();
@@ -136,7 +149,7 @@
* @since 4.3
*/
public URL getSystemVdb() {
- String systemVDB =
userPreferences.getProperty(DQPEmbeddedProperties.DQP_METADATA_SYSTEMURL);
+ String systemVDB =
getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_METADATA_SYSTEMURL);
if (valid(systemVDB)) {
return getFullyQualifiedPath(systemVDB);
}
@@ -148,7 +161,7 @@
* @since 4.3
*/
public Properties getSystemProperties() {
- return userPreferences;
+ return getUserPreferences();
}
/**
@@ -156,7 +169,7 @@
* @since 4.3
*/
public void setSystemProperty(String key, String value) throws
MetaMatrixComponentException {
- userPreferences.setProperty(key, value);
+ getUserPreferences().setProperty(key, value);
DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.add_system_property",
new Object[] {key, value}); //$NON-NLS-1$
this.configurationModel =
ServerConfigFileWriter.addProperty(getSystemConfiguration(), key, value);
saveSystemConfiguration(configurationModel);
@@ -167,7 +180,7 @@
* @since 4.3
*/
public void updateSystemProperties(Properties properties) throws
MetaMatrixComponentException {
- userPreferences.putAll(properties);
+ getUserPreferences().putAll(properties);
DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.update_system_properties",
new Object[] {properties}); //$NON-NLS-1$
this.configurationModel =
ServerConfigFileWriter.addProperties(getSystemConfiguration(), properties);
saveSystemConfiguration(configurationModel);
@@ -208,7 +221,7 @@
* @see com.metamatrix.dqp.service.ConfigurationService#getConfigFile()
*/
public URL getConfigFile() {
- String configFile =
userPreferences.getProperty(DQPEmbeddedProperties.DQP_CONFIGFILE,
"configuration.xml"); //$NON-NLS-1$
+ String configFile =
getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_CONFIGFILE,
"configuration.xml"); //$NON-NLS-1$
if (valid(configFile)) {
return getFullyQualifiedPath(configFile);
}
@@ -221,7 +234,7 @@
*/
public URL getUDFFile() {
try {
- String udfFile =
userPreferences.getProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
+ String udfFile =
getUserPreferences().getProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
if (valid(udfFile)) {
return ExtensionModuleReader.resolveExtensionModule(udfFile, getExtensionPath());
}
@@ -250,7 +263,7 @@
* @since 4.3
*/
public URL getLogFile() {
- String logFile = userPreferences.getProperty(DQPEmbeddedProperties.DQP_LOGFILE);
+ String logFile =
getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_LOGFILE);
if (valid(logFile)) {
return getFullyQualifiedPath(logFile);
}
@@ -262,7 +275,7 @@
* @since 4.3
*/
public String getLogLevel(){
- String level = userPreferences.getProperty(DQPEmbeddedProperties.DQP_LOGLEVEL);
+ String level =
getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_LOGLEVEL);
if (level == null) {
level = "3"; //$NON-NLS-1$
}
@@ -795,7 +808,7 @@
* @since 4.3
*/
public URL[] getExtensionPath() {
- String path = userPreferences.getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS,
"./extensions/"); //$NON-NLS-1$
+ String path =
getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS,
"./extensions/"); //$NON-NLS-1$
if (valid(path)) {
ArrayList<URL> urlPaths = new ArrayList<URL>();
StringTokenizer st = new StringTokenizer(path, ";"); //$NON-NLS-1$
@@ -811,7 +824,7 @@
* @see com.metamatrix.dqp.service.ConfigurationService#useExtensionClasspath()
*/
public boolean useExtensionClasspath() {
- String path = userPreferences.getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS);
+ String path =
getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS);
return valid(path);
}
@@ -963,7 +976,7 @@
throws ApplicationInitializationException {
try {
- userPreferences = PropertiesUtils.clone(properties);
+ this.setUserPreferences(PropertiesUtils.clone(properties));
DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.dqp_loading", new
Object[] {getInstanceIdenifier()}); //$NON-NLS-1$
@@ -975,7 +988,7 @@
ServerConfigFileReader configReader = loadServerConfigFile();
// Add properties to all the user preferences.
- userPreferences.putAll(configReader.getSystemProperties());
+ getUserPreferences().putAll(configReader.getSystemProperties());
// Get the alternate connector bindings from the server configuration
Map connectorBindings = configReader.getConnectorBindings();
@@ -1031,7 +1044,7 @@
*/
public URL[] getVDBLocations() {
ArrayList vdbs = new ArrayList();
- String vdbProperty =
userPreferences.getProperty(DQPEmbeddedProperties.VDB_DEFINITION);
+ String vdbProperty =
getUserPreferences().getProperty(DQPEmbeddedProperties.VDB_DEFINITION);
if (vdbProperty != null && vdbProperty.length() != 0) {
StringTokenizer st = new StringTokenizer(vdbProperty, VDB_LIST_SEPARATOR);
while( st.hasMoreTokens() ) {
@@ -1193,9 +1206,6 @@
URL getFullyQualifiedPath(String file){
if (file != null) {
try {
- // get the original URL to kick start the DQP as context URL
- URL bootStrapURL =
(URL)userPreferences.get(DQPEmbeddedProperties.DQP_BOOTSTRAP_PROPERTIES_FILE);
-
// since DQP can use metamatrix specific URLs to load the DQP, and we can
not
// register the URLStreamHandler, we need to create the URL with correct
handler
// URLHelper will let us do that.
@@ -1237,7 +1247,7 @@
* @see com.metamatrix.dqp.service.ConfigurationService#getEncryptionKeyStore()
*/
public URL getEncryptionKeyStore() {
- String keyStoreFile =
userPreferences.getProperty(DQPEmbeddedProperties.DQP_KEYSTORE);
+ String keyStoreFile =
getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_KEYSTORE);
if (valid(keyStoreFile)) {
return getFullyQualifiedPath(keyStoreFile);
}
@@ -1433,7 +1443,7 @@
* @return true if yes to use buffering; false otherwise
*/
public boolean useDiskBuffering() {
- return
Boolean.valueOf(userPreferences.getProperty(DQPEmbeddedProperties.BufferService.DQP_BUFFER_USEDISK,
"true")).booleanValue(); //$NON-NLS-1$
+ return
Boolean.valueOf(getUserPreferences().getProperty(DQPEmbeddedProperties.BufferService.DQP_BUFFER_USEDISK,
"true")).booleanValue(); //$NON-NLS-1$
}
@@ -1443,7 +1453,7 @@
*/
public File getDiskBufferDirectory() {
File bufferDir = null;
- String bufferDirectory =
userPreferences.getProperty(DQPEmbeddedProperties.BufferService.DQP_BUFFER_DIR);
+ String bufferDirectory =
getUserPreferences().getProperty(DQPEmbeddedProperties.BufferService.DQP_BUFFER_DIR);
if (valid(bufferDirectory)) {
if (!bufferDirectory.endsWith("/")) { //$NON-NLS-1$
bufferDirectory += "/"; //$NON-NLS-1$
@@ -1453,7 +1463,7 @@
bufferDir = new File(bufferURL.getPath());
}
else {
- bufferDir = new
File(userPreferences.getProperty(DQPEmbeddedProperties.DQP_TMPDIR));
+ bufferDir = new
File(getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_TMPDIR));
}
// create the buffer directory if not alread exists.
@@ -1469,22 +1479,22 @@
* @return must a return a location
*/
public String getBufferMemorySize() {
- return
userPreferences.getProperty(DQPEmbeddedProperties.BufferService.DQP_BUFFER_MEMORY,
"64"); //$NON-NLS-1$
+ return
getUserPreferences().getProperty(DQPEmbeddedProperties.BufferService.DQP_BUFFER_MEMORY,
"64"); //$NON-NLS-1$
}
/**
* @see com.metamatrix.dqp.service.ConfigurationService#getInstanceIdenifier()
*/
public String getInstanceIdenifier() {
- return userPreferences.getProperty(DQPEmbeddedProperties.DQP_IDENTITY);
+ return getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_IDENTITY);
}
public String getProcessorBatchSize() {
- return
userPreferences.getProperty(DQPEmbeddedProperties.BufferService.DQP_PROCESSOR_BATCH_SIZE,
"2000"); //$NON-NLS-1$
+ return
getUserPreferences().getProperty(DQPEmbeddedProperties.BufferService.DQP_PROCESSOR_BATCH_SIZE,
"2000"); //$NON-NLS-1$
}
public String getConnectorBatchSize() {
- return
userPreferences.getProperty(DQPEmbeddedProperties.BufferService.DQP_CONNECTOR_BATCH_SIZE,
"2000"); //$NON-NLS-1$
+ return
getUserPreferences().getProperty(DQPEmbeddedProperties.BufferService.DQP_CONNECTOR_BATCH_SIZE,
"2000"); //$NON-NLS-1$
}
@Override
@@ -1501,5 +1511,18 @@
public void clearClassLoaderCache() throws MetaMatrixComponentException {
this.classLoaderManager.clearCache();
}
+
+ void setUserPreferences(Properties userPreferences) {
+ this.userPreferences = userPreferences;
+ //test hack
+ URL url = (URL)userPreferences.get(PROPERTIES_URL);
+ if (url != null) {
+ this.bootStrapURL = url;
+ }
+ }
+
+ Properties getUserPreferences() {
+ return userPreferences;
+ }
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,11 +22,16 @@
package com.metamatrix.dqp.embedded.services;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Properties;
import org.teiid.dqp.internal.transaction.TransactionServerImpl;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
+import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.dqp.service.TransactionService;
@@ -36,6 +41,8 @@
public static final String TRANSACTIONS_ENABLED =
"metamatrix.xatxnmgr.enabled"; //$NON-NLS-1$
+ @Inject @Named("BootstrapURL") URL bootstrapURL;
+
@Override
public void initialize(Properties props)
throws ApplicationInitializationException {
@@ -44,10 +51,18 @@
props.put(TransactionService.HOSTNAME, "dqp"); //$NON-NLS-1$
props.put(TransactionService.VMNAME,
props.getProperty(DQPEmbeddedProperties.DQP_IDENTITY));
+ String dir = props.getProperty(TransactionService.TXN_STORE_DIR);
+ if (dir != null) {
+ props.setProperty(TXN_STORE_DIR, URLHelper.buildURL(bootstrapURL,
dir).getPath());
+ } else {
+ props.setProperty(TXN_STORE_DIR,
props.getProperty(DQPEmbeddedProperties.DQP_TMPDIR));
+ }
this.setTransactionProvider(ArjunaTransactionProvider.getInstance(props));
} catch (XATransactionException e) {
throw new ApplicationInitializationException(e);
- }
+ } catch (MalformedURLException e) {
+ throw new ApplicationInitializationException(e);
+ }
}
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/CacheProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/CacheProvider.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/CacheProvider.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,17 +22,29 @@
package com.metamatrix.jdbc;
+import java.util.List;
+import java.util.Properties;
+
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
+import com.google.inject.name.Named;
@Singleton
class CacheProvider implements Provider<org.jboss.cache.Cache> {
+
+ @Inject @Named("WorkspaceDir") String workspaceDir;
public Cache get() {
Cache cache = new
DefaultCacheFactory().createCache("jboss-cache-configuration.xml", false);
//$NON-NLS-1$
+ List<IndividualCacheLoaderConfig> configs =
cache.getConfiguration().getCacheLoaderConfig().getIndividualCacheLoaderConfigs();
+ Properties p = configs.get(0).getProperties();
+ p.setProperty("location", workspaceDir + "/cache"); //$NON-NLS-1$
//$NON-NLS-2$
+ configs.get(0).setProperties(p);
return cache;
}
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,6 +22,7 @@
package com.metamatrix.jdbc;
+import java.net.URL;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;
@@ -60,7 +61,6 @@
*/
public class EmbeddedConnectionFactoryImpl implements EmbeddedConnectionFactory {
private static final int ACTIVE = 3;
- private boolean initialized = false;
private LocalTransportHandler handler = null;
private volatile boolean shutdownInProgress = false;
private DQPCore dqp;
@@ -72,12 +72,9 @@
/**
* @see com.metamatrix.jdbc.EmbeddedConnectionFactory#createConnection()
*/
- public Connection createConnection(Properties props) throws SQLException {
+ public Connection createConnection(URL bootstrapURL, Properties props) throws
SQLException {
try {
- // Initialize the transport
- initialize(props);
-
// check for the valid connection properties
checkConnectionProperties (props);
@@ -87,8 +84,6 @@
return new EmbeddedConnection(this, serverConn, props, listener);
} catch (ConnectionException e) {
throw new EmbeddedSQLException(e);
- } catch (ApplicationInitializationException e) {
- throw new EmbeddedSQLException(e);
}
}
@@ -98,34 +93,34 @@
* holding on to a previous transport handler, so we need to check if the DQP is
* still alive and create a new one if necessary.
* @param props
- * @throws SQLException
+ * @throws ApplicationInitializationException
* @since 4.3
*/
- private synchronized void initialize(Properties props) throws
ApplicationInitializationException {
- if (!initialized) {
-
- Injector injector = Guice.createInjector(new EmbeddedGuiceModule(props));
- ResourceFinder.setInjector(injector);
- DQPConfigSource configSource = injector.getInstance(DQPConfigSource.class);
+ public void initialize(URL bootstrapURL, Properties props) throws SQLException {
+ Injector injector = Guice.createInjector(new EmbeddedGuiceModule(bootstrapURL,
props));
+ ResourceFinder.setInjector(injector);
+ DQPConfigSource configSource = injector.getInstance(DQPConfigSource.class);
- // start the DQP
- this.dqp = new DQPCore();
- this.dqp.start(configSource);
-
- // make the configuration service listen for the connection life-cycle events
- // used during VDB delete
- ConfigurationService configService =
(ConfigurationService)findService(DQPServiceNames.CONFIGURATION_SERVICE);
-
- //in new class loader - all of these should be created lazily and held
locally
- this.handler = new LocalTransportHandler(this.dqp);
- this.handler.registerListener(configService.getConnectionListener());
- this.shutdownThread = new ShutdownWork();
- Runtime.getRuntime().addShutdownHook(this.shutdownThread);
-
- this.initialized = true;
- this.starttime = System.currentTimeMillis();
- DQPEmbeddedPlugin.logInfo("DQPEmbeddedManager.start_dqp", new
Object[] {new Date(System.currentTimeMillis()).toString()}); //$NON-NLS-1$
- }
+ // start the DQP
+ this.dqp = new DQPCore();
+ try {
+ this.dqp.start(configSource);
+ } catch (ApplicationInitializationException e) {
+ throw new EmbeddedSQLException(e);
+ }
+
+ // make the configuration service listen for the connection life-cycle events
+ // used during VDB delete
+ ConfigurationService configService =
(ConfigurationService)findService(DQPServiceNames.CONFIGURATION_SERVICE);
+
+ //in new class loader - all of these should be created lazily and held locally
+ this.handler = new LocalTransportHandler(this.dqp);
+ this.handler.registerListener(configService.getConnectionListener());
+ this.shutdownThread = new ShutdownWork();
+ Runtime.getRuntime().addShutdownHook(this.shutdownThread);
+
+ this.starttime = System.currentTimeMillis();
+ DQPEmbeddedPlugin.logInfo("DQPEmbeddedManager.start_dqp", new Object[]
{new Date(System.currentTimeMillis()).toString()}); //$NON-NLS-1$
}
class ShutdownWork extends Thread {
@@ -166,7 +161,7 @@
}
public ApplicationService findService(String type) {
- return this.dqp.getEnvironment().findService(type);
+ return getDQP().getEnvironment().findService(type);
}
/**
@@ -180,7 +175,7 @@
shutdown(true);
}
- private void shutdown(boolean undoShutdownHook) throws SQLException {
+ private synchronized void shutdown(boolean undoShutdownHook) throws SQLException {
if (undoShutdownHook) {
Runtime.getRuntime().removeShutdownHook(this.shutdownThread);
@@ -189,7 +184,7 @@
// Make sure shutdown is not already in progress; as call to shutdown will close
// connections; and after the last connection closes, the listener also calls
shutdown
// for normal route.
- if (!this.shutdownInProgress && this.initialized) {
+ if (!this.shutdownInProgress) {
// this will by pass, and only let shutdown called once.
shutdownInProgress = true;
@@ -207,9 +202,7 @@
this.dqp = null;
this.handler = null;
-
- this.initialized = false;
-
+
// shutdown the cache.
ResourceFinder.getCacheFactory().destroy();
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,6 +22,7 @@
package com.metamatrix.jdbc;
+import java.net.URL;
import java.util.Properties;
import org.jboss.cache.Cache;
@@ -36,30 +37,36 @@
import com.metamatrix.common.log.LogConfiguration;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.log.LogListener;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.dqp.embedded.EmbeddedConfigSource;
public class EmbeddedGuiceModule extends AbstractModule {
private Properties props;
+ private URL bootstrapURL;
- public EmbeddedGuiceModule(Properties props) {
+ public EmbeddedGuiceModule(URL bootstrapURL, Properties props) {
+ this.bootstrapURL = bootstrapURL;
this.props = props;
}
@Override
protected void configure() {
-
bind(Cache.class).toProvider(CacheProvider.class).in(Scopes.SINGLETON);
bind(CacheFactory.class).to(JBossCacheFactory.class).in(Scopes.SINGLETON);
bindConstant().annotatedWith(Names.named("HostName")).to("embedded");
//$NON-NLS-1$ //$NON-NLS-2$
bindConstant().annotatedWith(Names.named("ProcessName")).to("embedded");
//$NON-NLS-1$ //$NON-NLS-2$
+ String workspaceDir = System.getProperty(DQPEmbeddedProperties.DQP_TMPDIR,
System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
+ bindConstant().annotatedWith(Names.named("WorkspaceDir")).to(workspaceDir);
//$NON-NLS-1$
+ this.props.setProperty(DQPEmbeddedProperties.DQP_TMPDIR, workspaceDir);
+ bind(Properties.class).annotatedWith(Names.named("DQPProperties")).toInstance(this.props);
//$NON-NLS-1$
bind(DQPContextCache.class).in(Scopes.SINGLETON);
- bind(DQPConfigSource.class).toInstance(new EmbeddedConfigSource(this.props));
+ bind(DQPConfigSource.class).to(EmbeddedConfigSource.class);
+ bind(URL.class).annotatedWith(Names.named("BootstrapURL")).toInstance(bootstrapURL);
//$NON-NLS-1$
bind(LogConfiguration.class).toProvider(LogConfigurationProvider.class).in(Scopes.SINGLETON);
bind(LogListener.class).toProvider(LogListernerProvider.class).in(Scopes.SINGLETON);
-
// this needs to be removed.
binder().requestStaticInjection(LogManager.class);
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -29,6 +29,7 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
+import com.google.inject.name.Named;
import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.core.MetaMatrixRuntimeException;
@@ -43,9 +44,11 @@
@Inject
DQPConfigSource configSource;
+ @Inject @Named("BootstrapURL")
+ URL dqpURL;
+
@Override
public LogListener get() {
- URL dqpURL =
(URL)configSource.getProperties().get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE);
String logFile =
configSource.getProperties().getProperty(DQPEmbeddedProperties.DQP_LOGFILE);
String instanceId =
configSource.getProperties().getProperty(DQPEmbeddedProperties.DQP_IDENTITY,
"0"); //$NON-NLS-1$
Modified: trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -30,6 +30,7 @@
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.util.FileUtils;
import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService;
public class EmbeddedTestUtil {
@@ -39,7 +40,7 @@
public static Properties getProperties(String file) throws IOException {
Properties props = PropertiesUtils.load(file);
- props.put(DQPEmbeddedProperties.DQP_BOOTSTRAP_PROPERTIES_FILE,
URLHelper.buildURL(file));
+ props.put(EmbeddedConfigurationService.PROPERTIES_URL,
URLHelper.buildURL(file));
return props;
}
Modified:
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -34,7 +34,6 @@
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.FakeAbstractService;
import com.metamatrix.dqp.service.FakeVDBService;
-import com.metamatrix.jdbc.EmbeddedDataSource;
public class TestEmbeddedConfigSource extends TestCase {
@@ -48,9 +47,9 @@
public void testServiceLoading() throws Exception {
Properties p = new Properties();
- p.put(EmbeddedDataSource.DQP_BOOTSTRAP_FILE,
buildDQPUrl(UnitTestUtil.getTestDataPath() + "/bqt/fakebqt.properties"));
//$NON-NLS-1$
-
- EmbeddedConfigSource source = new EmbeddedConfigSource(p);
+ URL url = buildDQPUrl(UnitTestUtil.getTestDataPath() +
"/bqt/fakebqt.properties"); //$NON-NLS-1$
+ p.load(url.openStream());
+ EmbeddedConfigSource source = new EmbeddedConfigSource(url, p);
Application application = new Application();
application.start(source);
assertTrue(application.getEnvironment().findService(DQPServiceNames.VDB_SERVICE)
instanceof FakeVDBService);
Modified:
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -34,8 +34,6 @@
import junit.framework.TestCase;
-import org.teiid.connector.api.ConnectorPropertyNames;
-
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.config.api.ComponentType;
@@ -79,19 +77,19 @@
}
public void testUseExtensionPath() throws Exception {
- service.userPreferences = EmbeddedTestUtil.getProperties();
+ service.setUserPreferences(EmbeddedTestUtil.getProperties());
assertTrue(service.useExtensionClasspath());
}
public void testUseExtensionPathFalse() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
p.remove("dqp.extensions"); //$NON-NLS-1$
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertFalse(service.useExtensionClasspath());
}
public void testGetAvailableVDBFiles() throws Exception {
- service.userPreferences = EmbeddedTestUtil.getProperties();
+ service.setUserPreferences(EmbeddedTestUtil.getProperties());
HashMap vdbFiles = VDBConfigurationReader.loadVDBS(service.getVDBLocations());
int count = vdbFiles.keySet().size();
assertEquals(2, count);
@@ -106,7 +104,7 @@
}
public void testGetConfigFileURL() throws Exception {
- service.userPreferences = EmbeddedTestUtil.getProperties();
+ service.setUserPreferences(EmbeddedTestUtil.getProperties());
assertTrue(service.getConfigFile().toString().endsWith("dqp/config/ServerConfig.xml"));
//$NON-NLS-1$
}
@@ -115,7 +113,7 @@
BasicConnectorBinding alternatebinding = new BasicConnectorBinding(new
ConfigurationID("foo"), new ConnectorBindingID(new
ConfigurationID("foo"), "foo"), new ComponentTypeID("foo
type")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.loadedConnectorBindings.put("foo", alternatebinding);
//$NON-NLS-1$
// we did not set use alternate.
@@ -125,7 +123,7 @@
public void defer_testInitializeEncryption() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
p.setProperty(DQPEmbeddedProperties.DQP_KEYSTORE, "Cluster.key");
//$NON-NLS-1$
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeEncryption();
assertFalse(CryptoUtil.getDecryptor() instanceof NullCryptor);
}
@@ -133,20 +131,20 @@
public void testGetDefaultExtensionPath() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
p.remove(DQPEmbeddedProperties.DQP_EXTENSIONS);
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertTrue(service.getExtensionPath()[0].toString().endsWith("dqp/extensions/"));
//$NON-NLS-1$
}
public void testGetDirectoryToStoreVDBS() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertTrue(service.getVDBSaveLocation().toString().endsWith("dqp/config/"));
//$NON-NLS-1$
}
public void testGetDirectoryToStoreVDBSByVDBName() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
p.setProperty(DQPEmbeddedProperties.VDB_DEFINITION,
"./config/QT_Ora9DS.vdb"); //$NON-NLS-1$
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
VDBArchive vdb = service.getVDB("QT_Ora9DS", "1");
//$NON-NLS-1$ //$NON-NLS-2$
@@ -157,7 +155,7 @@
public void testGetFileToSaveNewFile() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
p.setProperty(DQPEmbeddedProperties.VDB_DEFINITION,
"./config/QT_Ora9DS.vdb"); //$NON-NLS-1$
service.initializeService(p);
@@ -170,7 +168,7 @@
public void testGetFileAlreadyExisting() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
VDBArchive vdb = service.getVDB("QT_Ora9DS", "1");
//$NON-NLS-1$ //$NON-NLS-2$
@@ -181,7 +179,7 @@
public void testGetFullyQualifiedPath() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertTrue(service.getFullyQualifiedPath("http://lib/foo.txt").toString().endsWith("http://lib/foo.txt"));
//$NON-NLS-1$ //$NON-NLS-2$
assertTrue(service.getFullyQualifiedPath("file:/c:/lib/foo.txt").toString().endsWith("file:/c:/lib/foo.txt"));//$NON-NLS-1$
//$NON-NLS-2$
assertTrue(service.getFullyQualifiedPath("/lib/foo.txt").toString().endsWith("mmfile:/lib/foo.txt"));//$NON-NLS-1$
//$NON-NLS-2$
@@ -194,14 +192,14 @@
public void testGetNextVdbVersion() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertEquals(2, service.getNextVdbVersion("QT_Ora9DS")); //$NON-NLS-1$
}
public void testDeleteInUseConnectorBinding() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
try {
service.deleteConnectorBinding("BQT2 Oracle 9i Simple Cap");
//$NON-NLS-1$
@@ -213,7 +211,7 @@
public void testDeleteNonExistingConnectorBinding() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
try {
service.deleteConnectorBinding("UNKNOWN"); //$NON-NLS-1$
@@ -225,7 +223,7 @@
public void testDeleteConnectorBinding() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
service.deleteVDB(service.getVDB("QT_Ora9DS", "1"));
//$NON-NLS-1$ //$NON-NLS-2$
@@ -241,7 +239,7 @@
public void testDeleteConnectorType() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
try {
@@ -262,7 +260,7 @@
public void testDeleteConnectorTypeInUse() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertNotNull(service.getConnectorType("Oracle ANSI JDBC
Connector"));//$NON-NLS-1$
@@ -277,7 +275,7 @@
public void testDeleteVDB() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
VDBArchive vdb = service.getVDB("QT_Ora9DS", "1");
//$NON-NLS-1$ //$NON-NLS-2$
@@ -292,7 +290,7 @@
Properties p = EmbeddedTestUtil.getProperties();
p.setProperty(DQPEmbeddedProperties.DQP_LOGFILE, "./log/dqp.log");
//$NON-NLS-1$
p.setProperty(DQPEmbeddedProperties.DQP_LOGLEVEL, "1"); //$NON-NLS-1$
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertTrue(service.getLogFile().toString().endsWith("/log/dqp.log"));
//$NON-NLS-1$
assertEquals(service.getLogLevel(), "1");
//$NON-NLS-1$
@@ -300,7 +298,7 @@
public void testGetSystemProperties() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
Properties sp = service.getSystemProperties();
@@ -312,7 +310,7 @@
public void testGetSystemConfiguration() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertNull(service.configurationModel);
service.getSystemConfiguration();
@@ -321,7 +319,7 @@
public void testGetSystemVDB() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertNotNull(service.getSystemVdb());
}
@@ -330,7 +328,7 @@
Properties p = EmbeddedTestUtil.getProperties();
p.setProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS,
"extensionjar:foo.xmi"); //$NON-NLS-1$
p.setProperty("dqp.extensions", "./foo/;./bar/");
//$NON-NLS-1$ //$NON-NLS-2$
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertNull(service.getUDFFile());
@@ -363,14 +361,14 @@
public void testGetVDBs() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertTrue(service.getVDBs().size() == 2);
}
public void testSaveConnectorBinding() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
String msg = "Test update of the connector binding"; //$NON-NLS-1$
@@ -401,7 +399,7 @@
public void testSaveConnectorType() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
String msg = "Test update of the connector type"; //$NON-NLS-1$
@@ -426,7 +424,7 @@
public void testSaveVDB() throws Exception{
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
VDBArchive vdb = service.getVDB("QT_Ora9DS", "1");
//$NON-NLS-1$ //$NON-NLS-2$
@@ -439,7 +437,7 @@
public void testGetProcessorBatchSize() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertEquals("3867", service.getProcessorBatchSize()); //$NON-NLS-1$
@@ -447,7 +445,7 @@
public void testGetConnectorBatchSize() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertEquals("3868", service.getConnectorBatchSize()); //$NON-NLS-1$
@@ -455,7 +453,7 @@
public void testLoadedConnectorBindings() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertEquals("There shlould be only three connectors", 3,
service.getConnectorBindings().size()); //$NON-NLS-1$
@@ -477,7 +475,7 @@
public void testAddConnectorBinding() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
ConnectorBinding binding = service.getConnectorBinding("QT_ORA9DS_1.BQT1
Oracle 9i Simple Cap"); //$NON-NLS-1$
@@ -489,7 +487,7 @@
public void testGetConnectorTypes() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- service.userPreferences = p;
+ service.setUserPreferences(p);
service.initializeService(p);
assertEquals(23, service.loadedConnectorTypes.size());
@@ -498,7 +496,7 @@
public void testUseMultipleExtensionPath() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
p.setProperty("dqp.extensions", "/foo/;../x/bar/");
//$NON-NLS-1$ //$NON-NLS-2$
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertEquals("mmfile:/foo/",
service.getExtensionPath()[0].toExternalForm()); //$NON-NLS-1$
assertEquals("mmfile:target/scratch/x/bar/",
service.getExtensionPath()[1].toExternalForm()); //$NON-NLS-1$
}
@@ -514,7 +512,7 @@
fw.close();
p.setProperty("dqp.extensions", "./foo/;./bar/");
//$NON-NLS-1$ //$NON-NLS-2$
- service.userPreferences = p;
+ service.setUserPreferences(p);
// get all the modules in the system.
List<ExtensionModule> modules = service.getExtensionModules();
@@ -537,7 +535,7 @@
assertEquals(2, modules.size());
// test common class path; also makes sure that the connect in position (1) has
the newly added module
- service.userPreferences.setProperty("dqp.extension.CommonClasspath",
"extensionjar:added-ext.jar;extensionjar:extfile.jar"); //$NON-NLS-1$
//$NON-NLS-2$
+
service.getUserPreferences().setProperty("dqp.extension.CommonClasspath",
"extensionjar:added-ext.jar;extensionjar:extfile.jar"); //$NON-NLS-1$
//$NON-NLS-2$
URL[] urls =
service.getClassLoaderManager().parseURLs(service.getClassLoaderManager().getCommonExtensionClassPath());
assertEquals("mmfile:target/scratch/dqp/foo/added-ext.jar",
urls[0].toString()); //$NON-NLS-1$
assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar",
urls[1].toString()); //$NON-NLS-1$
@@ -572,7 +570,7 @@
fw.close();
p.setProperty("dqp.extensions", "./foo/;./bar/");
//$NON-NLS-1$ //$NON-NLS-2$
- service.userPreferences = p;
+ service.setUserPreferences(p);
assertEquals("",
service.getClassLoaderManager().getCommonExtensionClassPath()); //$NON-NLS-1$
Modified:
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedDataService.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedDataService.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedDataService.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -54,7 +54,7 @@
public void testSelectConnector() throws Exception {
Properties p =
EmbeddedTestUtil.getProperties(UnitTestUtil.getTestDataPath()+"/dqp/dqp.properties");
//$NON-NLS-1$
- configService.userPreferences = p;
+ configService.setUserPreferences(p);
configService.initializeService(p);
}
Modified:
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -64,8 +64,8 @@
}
public void testGetTestVDB() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
VDBArchive vdb = vdbService.getVDB("QT_Ora9DS", "1");
//$NON-NLS-1$ //$NON-NLS-2$
@@ -81,8 +81,8 @@
}
public void testSystemModelConnectorBinding() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
// asking "vdb.name" and stored "vdb.name"
@@ -102,8 +102,8 @@
// name | trim stored | name |
//---------------------------------------
public void testGetConnectorBindingNames() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
// asking "vdb.name" and stored "vdb.name"
@@ -113,8 +113,8 @@
}
public void testMapConnectorBinding() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
Properties props = new Properties();
@@ -156,7 +156,7 @@
Application registry = new Application();
configService = new EmbeddedConfigurationService();
- configService.userPreferences = p;
+ configService.setUserPreferences(p);
configService.initializeService(p);
registry.installService(DQPServiceNames.CONFIGURATION_SERVICE, configService);
vdbService = new EmbeddedVDBService();
@@ -170,14 +170,14 @@
public void testVDBResource() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- configService.userPreferences = p;
+ configService.setUserPreferences(p);
configService.initializeService(p);
assertNotNull(vdbService.getVDBResource("Admin", "1"));
//$NON-NLS-1$ //$NON-NLS-2$
}
public void testAvailableVDBs() throws Exception {
Properties p = EmbeddedTestUtil.getProperties();
- configService.userPreferences = p;
+ configService.setUserPreferences(p);
configService.initializeService(p);
assertEquals(2, vdbService.getAvailableVDBs().size());
@@ -188,8 +188,8 @@
}
public void testDeployNewVDB() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
assertEquals(2, vdbService.getAvailableVDBs().size());
assertEquals(3, configService.getConnectorBindings().size());
@@ -211,8 +211,8 @@
// when we deploy the already deployed VDB it should take on the next version
// number.
public void testDeploySameVDB() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
assertEquals(2, vdbService.getAvailableVDBs().size());
assertEquals(3, configService.getConnectorBindings().size());
@@ -232,8 +232,8 @@
public void changeVDBStatus_delete() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
assertEquals(2, vdbService.getAvailableVDBs().size());
@@ -243,8 +243,8 @@
}
public void changeVDBStatus_inactive() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$
- configService.userPreferences = p;
+ Properties p = EmbeddedTestUtil.getProperties();
+ configService.setUserPreferences(p);
configService.initializeService(p);
assertEquals(2, vdbService.getAvailableVDBs().size());
Modified:
trunk/embedded/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -31,6 +31,7 @@
import com.metamatrix.common.buffer.impl.BufferConfig;
import com.metamatrix.common.buffer.impl.BufferManagerImpl;
import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.dqp.embedded.EmbeddedTestUtil;
import com.metamatrix.dqp.embedded.services.EmbeddedBufferService;
import com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService;
@@ -45,12 +46,12 @@
public void testMissingRequiredProperties() throws Exception {
try {
- System.setProperty("mm.io.tmpdir",
System.getProperty("java.io.tmpdir")+"/metamatrix/1"); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ System.setProperty(DQPEmbeddedProperties.DQP_TMPDIR,
System.getProperty("java.io.tmpdir")+"/metamatrix/1"); //$NON-NLS-1$
//$NON-NLS-2$
Application r = new Application();
ConfigurationService cs = new EmbeddedConfigurationService();
Properties p = EmbeddedTestUtil.getProperties(UnitTestUtil.getTestDataPath()
+ "/admin/buffertest1.properties"); //$NON-NLS-1$
- p.setProperty("mm.io.tmpdir",
System.getProperty("mm.io.tmpdir")); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty(DQPEmbeddedProperties.DQP_TMPDIR,
System.getProperty(DQPEmbeddedProperties.DQP_TMPDIR));
cs.initialize(p);
r.installService(DQPServiceNames.CONFIGURATION_SERVICE, cs);
EmbeddedBufferService svc = new EmbeddedBufferService();
@@ -94,12 +95,12 @@
}
public void testCheckMemPropertyGotSet2() throws Exception {
- System.setProperty("mm.io.tmpdir",
System.getProperty("java.io.tmpdir")+"/metamatrix/1");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ System.setProperty(DQPEmbeddedProperties.DQP_TMPDIR,
System.getProperty("java.io.tmpdir")+"/metamatrix/1");
//$NON-NLS-1$ //$NON-NLS-2$
EmbeddedBufferService svc = null;
Application r = new Application();
ConfigurationService cs = new EmbeddedConfigurationService();
Properties p = EmbeddedTestUtil.getProperties(UnitTestUtil.getTestDataPath() +
"/admin/buffertest3.properties"); //$NON-NLS-1$
- p.setProperty("mm.io.tmpdir",
System.getProperty("mm.io.tmpdir")); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty(DQPEmbeddedProperties.DQP_TMPDIR,
System.getProperty(DQPEmbeddedProperties.DQP_TMPDIR));
cs.initialize(p);
r.installService(DQPServiceNames.CONFIGURATION_SERVICE, cs);
svc = new EmbeddedBufferService();
Modified: trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -85,7 +85,7 @@
Properties p = new Properties();
driver.parseURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties", p);
//$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("mmfile:/c:/metamatrix/dqp/dqp.properties"));
//$NON-NLS-1$
+ assertEquals("c:\\metamatrix\\dqp\\dqp.properties",
p.getProperty(EmbeddedDataSource.DQP_BOOTSTRAP_FILE)); //$NON-NLS-1$
assertEquals(3, p.size());
}
@@ -93,7 +93,7 @@
Properties p = new Properties();
driver.parseURL("jdbc:metamatrix:BQT@\\metamatrix\\dqp\\dqp.properties;version=3",
p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("mmfile:/metamatrix/dqp/dqp.properties"));
//$NON-NLS-1$
+ assertEquals("\\metamatrix\\dqp\\dqp.properties",
p.getProperty(EmbeddedDataSource.DQP_BOOTSTRAP_FILE)); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3"));
//$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3"));
//$NON-NLS-1$
assertEquals(5, p.size());
@@ -114,7 +114,7 @@
Properties p = new Properties();
driver.parseURL("jdbc:metamatrix:BQT@testdata/dqp/dqp.properties;partialResultsMode=true",
p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("mmfile:testdata/dqp/dqp.properties"));
//$NON-NLS-1$
+ assertEquals("testdata/dqp/dqp.properties",
p.getProperty(EmbeddedDataSource.DQP_BOOTSTRAP_FILE)); //$NON-NLS-1$
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("true"));
//$NON-NLS-1$
assertEquals(4, p.size());
}
@@ -123,21 +123,21 @@
Properties p = new Properties();
driver.parseURL("jdbc:metamatrix:BQT", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("classpath:/deploy.properties"));
//$NON-NLS-1$
+
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).equals("classpath:/deploy.properties"));
//$NON-NLS-1$
}
public void testParseURL55() throws SQLException{
Properties p = new Properties();
driver.parseURL("jdbc:metamatrix:BQT;", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("classpath:/deploy.properties"));
//$NON-NLS-1$
+
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).equals("classpath:/deploy.properties"));
//$NON-NLS-1$
}
public void testParseURL6() throws SQLException{
Properties p = new Properties();
driver.parseURL("jdbc:metamatrix:BQT;partialResultsMode=true;version=1", p);
//$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("classpath:/deploy.properties"));
//$NON-NLS-1$
+
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).equals("classpath:/deploy.properties"));
//$NON-NLS-1$
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("true"));
//$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("1"));
//$NON-NLS-1$
assertTrue(p.getProperty("vdb.definition").equals("BQT.vdb"));
//$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/common/application/Application.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/engine/src/main/java/com/metamatrix/common/application/Application.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -43,6 +43,7 @@
protected ApplicationEnvironment environment = new ApplicationEnvironment();
private ArrayList<String> installedServices = new ArrayList<String>();
+ private ServiceLoader loader = new ServiceLoader();
/*
* @see
com.metamatrix.common.application.Application#initialize(java.util.Properties)
@@ -60,6 +61,7 @@
LogManager.logInfo(LogConstants.CTX_DQP,
DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceIsNull",
serviceName)); //$NON-NLS-1$
}else{
ApplicationService appService = injector.getInstance(type);
+ appService = loader.loadService(serviceName, appService);
String loggingContext = DQPServiceNames.SERVICE_LOGGING_CONTEXT[i];
if (loggingContext != null) {
appService = (ApplicationService)LogManager.createLoggingProxy(loggingContext,
appService, new Class[] {type}, MessageLevel.DETAIL);
Added: trunk/engine/src/main/java/com/metamatrix/common/application/ServiceLoader.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/application/ServiceLoader.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/common/application/ServiceLoader.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.application;
+
+/**
+ * Used as an entry mechanism for the Designer to extend service classes
+ * without depending upon embedded.
+ */
+public class ServiceLoader {
+
+ public ApplicationService loadService(String serviceType, ApplicationService service) {
+ return service;
+ }
+
+}
Property changes on:
trunk/engine/src/main/java/com/metamatrix/common/application/ServiceLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -61,7 +61,6 @@
public static final String DEFAULT_LOGFILE_SIZE= "10"; //$NON-NLS-1$
public static final String DEFAULT_MAX_ROLLOVER_FILES = "10"; //$NON-NLS-1$
public static final String DEFAULT_SEPARATE_TXN_LOG = "false";
//$NON-NLS-1$
- public static final String DEFAULT_TXN_STORE_DIR =
System.getProperty("metamatrix.xatxnmgr.txnstore_dir",
System.getProperty("user.dir")); //$NON-NLS-1$ //$NON-NLS-2$
public static final String DEFAULT_TXN_STATUS_PORT = "0"; //$NON-NLS-1$
// processor level methods
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -586,6 +586,8 @@
public void processRequest()
throws QueryValidatorException, QueryParserException, QueryResolverException,
MetaMatrixComponentException, QueryPlannerException {
+ LogManager.logDetail(LogConstants.CTX_DQP, this.requestId, "executing",
this.requestMsg.isPreparedStatement()?"prepared":"",
this.requestMsg.getCommandString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
initMetadata();
Command processingCommand = generatePlan();
Modified: trunk/server/src/main/java/com/metamatrix/server/CacheProvider.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/CacheProvider.java 2009-05-28
01:42:53 UTC (rev 1002)
+++ trunk/server/src/main/java/com/metamatrix/server/CacheProvider.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -22,15 +22,20 @@
package com.metamatrix.server;
+import java.util.List;
+import java.util.Properties;
+
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jgroups.Channel;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
+import com.metamatrix.common.config.CurrentConfiguration;
@Singleton
class CacheProvider implements Provider<org.jboss.cache.Cache> {
@@ -47,6 +52,10 @@
Cache cache = new
DefaultCacheFactory().createCache("jboss-cache-configuration.xml", false);
//$NON-NLS-1$
Configuration config = cache.getConfiguration();
+ List<IndividualCacheLoaderConfig> configs =
config.getCacheLoaderConfig().getIndividualCacheLoaderConfigs();
+ Properties p = configs.get(0).getProperties();
+ p.setProperty("location",
CurrentConfiguration.getInstance().getDefaultHost().getDataDirectory() +
"/cache"); //$NON-NLS-1$ //$NON-NLS-2$
+ configs.get(0).setProperties(p);
config.getRuntimeConfig().setChannel(channel);
config.setClusterName(this.channelName);
Modified:
trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java
===================================================================
---
trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java 2009-05-28
01:42:53 UTC (rev 1002)
+++
trunk/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java 2009-05-28
11:04:30 UTC (rev 1003)
@@ -91,8 +91,8 @@
String txnMgrUniqueName = "txnmgr_" +
props.getProperty(TransactionService.HOSTNAME, "").replace('.',
'_') + "_" + vmName; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// set the directory for storing the in-flight transactions
- String baseDir = props.getProperty(TransactionService.TXN_STORE_DIR,
TransactionService.DEFAULT_TXN_STORE_DIR);
- Configuration.setObjectStoreRoot(baseDir + File.separator +
"MetaMatrixTxnStore" + File.separator + txnMgrUniqueName); //$NON-NLS-1$
+ String baseDir = props.getProperty(TransactionService.TXN_STORE_DIR,
System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
+ Configuration.setObjectStoreRoot(baseDir + File.separator +
"TeiidTxnStore" + File.separator + txnMgrUniqueName); //$NON-NLS-1$
configureLogging(txnMgrUniqueName, props);