Author: rareddy
Date: 2009-02-20 19:28:43 -0500 (Fri, 20 Feb 2009)
New Revision: 479
Added:
trunk/build/assembly/embedded/embedded-client-jar.xml
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalServerConnection.java
trunk/embedded/src/main/resources/deploy.properties
trunk/embedded/src/main/resources/jboss-cache-configuration.xml
trunk/embedded/src/test/resources/jboss-cache-configuration.xml
trunk/server/src/main/java/com/metamatrix/server/LogConfigurationProvider.java
trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java
Removed:
trunk/cache-jbosscache/src/main/resources/jboss-cache-configuration.xml
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionTracker.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/DefaultLogConfigurationFactory.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/LogConfigurationFactory.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/DelimitedLogMessageFormat.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/LogMessageFormat.java
trunk/common-internal/src/test/java/com/metamatrix/common/log/format/TestLogMessageFormat.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedManager.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPListener.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigUtil.java
trunk/embedded/src/main/resources/mm.properties
trunk/engine/src/main/java/com/metamatrix/dqp/application/
trunk/server/src/main/java/com/metamatrix/platform/config/ConfigurationChangeListener.java
trunk/server/src/main/java/com/metamatrix/platform/vm/util/VMUtils.java
Modified:
trunk/build/assembly/embedded/embedded-dependencies.xml
trunk/build/assembly/embedded/embedded-dist.xml
trunk/build/assembly/embedded/embedded-jar.xml
trunk/build/assembly/src.xml
trunk/build/kit-embedded/examples/portfolio/run.bat
trunk/build/kit-embedded/examples/portfolio/run.sh
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java
trunk/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java
trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
trunk/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java
trunk/common-internal/pom.xml
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/BasicLogConfiguration.java
trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java
trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java
trunk/console/src/main/java/com/metamatrix/console/main/AdminConsoleMain.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.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/transport/LocalTransportHandler.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/jdbc/TestEmbeddedDriver.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
trunk/pom.xml
trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java
trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java
trunk/server/src/main/java/com/metamatrix/common/log/I18nLogManager.java
trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java
trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/ConsoleAuditDestination.java
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java
trunk/server/src/main/java/com/metamatrix/server/HostController.java
trunk/server/src/main/java/com/metamatrix/server/HostControllerGuiceModule.java
trunk/server/src/main/java/com/metamatrix/server/Main.java
trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java
Log:
TEIID-66, TEIID-361: Embedded can only have one instance running; Guice start-up;
Connection listening re-factored; LogManager made configurable. Reviewed By SH.
Added: trunk/build/assembly/embedded/embedded-client-jar.xml
===================================================================
--- trunk/build/assembly/embedded/embedded-client-jar.xml (rev 0)
+++ trunk/build/assembly/embedded/embedded-client-jar.xml 2009-02-21 00:28:43 UTC (rev
479)
@@ -0,0 +1,35 @@
+<!--This script builds a JAR for the Embedded Server Installation -->
+<assembly>
+
+ <id>client</id>
+
+ <formats>
+ <format>jar</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <baseDirectory>teiid-embedded-client</baseDirectory>
+
+ <moduleSets>
+ <moduleSet>
+ <includeSubModules>true</includeSubModules>
+
+ <includes>
+ <include>org.jboss.teiid:teiid-client</include>
+ <include>org.jboss.teiid:teiid-client-jdbc</include>
+ <include>org.jboss.teiid:teiid-common-core</include>
+ </includes>
+
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>true</unpack>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>:jar:*</include>
+ </includes>
+ </binaries>
+
+ </moduleSet>
+ </moduleSets>
+
+</assembly>
\ No newline at end of file
Property changes on: trunk/build/assembly/embedded/embedded-client-jar.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/build/assembly/embedded/embedded-dependencies.xml
===================================================================
--- trunk/build/assembly/embedded/embedded-dependencies.xml 2009-02-20 21:08:28 UTC (rev
478)
+++ trunk/build/assembly/embedded/embedded-dependencies.xml 2009-02-21 00:28:43 UTC (rev
479)
@@ -45,7 +45,6 @@
<!-- these should have been excluded by module dependency structure,
but until we fix those this will help-->
<exclude>antlr*</exclude>
<exclude>bsh*</exclude>
- <exclude>jgroups*</exclude>
<exclude>netty*</exclude>
<exclude>stringtemplate*</exclude>
</excludes>
Modified: trunk/build/assembly/embedded/embedded-dist.xml
===================================================================
--- trunk/build/assembly/embedded/embedded-dist.xml 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/build/assembly/embedded/embedded-dist.xml 2009-02-21 00:28:43 UTC (rev 479)
@@ -17,10 +17,17 @@
<includes>
<include>teiid-${version}-embedded.jar</include>
</includes>
+ <outputDirectory>lib</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>target/distribution</directory>
+ <includes>
+ <include>teiid-${version}-client.jar</include>
+ </includes>
<outputDirectory>/</outputDirectory>
</fileSet>
-
-
+
<fileSet>
<directory>target/distribution/teiid-${version}-embedded-dependencies.dir</directory>
<includes>
Modified: trunk/build/assembly/embedded/embedded-jar.xml
===================================================================
--- trunk/build/assembly/embedded/embedded-jar.xml 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/build/assembly/embedded/embedded-jar.xml 2009-02-21 00:28:43 UTC (rev 479)
@@ -16,9 +16,6 @@
<includes>
<include>org.jboss.teiid:teiid-cache-jbosscache</include>
- <include>org.jboss.teiid:teiid-client</include>
- <include>org.jboss.teiid:teiid-client-jdbc</include>
- <include>org.jboss.teiid:teiid-common-core</include>
<include>org.jboss.teiid:teiid-common-internal</include>
<include>org.jboss.teiid:teiid-connector-api</include>
Modified: trunk/build/assembly/src.xml
===================================================================
--- trunk/build/assembly/src.xml 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/build/assembly/src.xml 2009-02-21 00:28:43 UTC (rev 479)
@@ -36,6 +36,8 @@
<exclude>.classpath</exclude>
<exclude>.project</exclude>
<exclude>**/.settings/**</exclude>
+ <exclude>**/*.log</exclude>
+
</excludes>
</fileSet>
</fileSets>
Modified: trunk/build/kit-embedded/examples/portfolio/run.bat
===================================================================
--- trunk/build/kit-embedded/examples/portfolio/run.bat 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/build/kit-embedded/examples/portfolio/run.bat 2009-02-21 00:28:43 UTC (rev 479)
@@ -2,7 +2,7 @@
set CLIENT_PATH=java/*;PortfolioModel/
rem Second one for the JARs in Teiid embedded
-set TEIID_PATH=../../teiid-6.0.0-SNAPSHOT-embedded.jar;../../lib/*;../../extensions/*
+set TEIID_PATH=../../teiid-6.0.0-SNAPSHOT-client.jar;../../lib/*;../../extensions/*
java -cp %CLIENT_PATH%;%TEIID_PATH% JDBCClient "select * from CustomerAccount"
Modified: trunk/build/kit-embedded/examples/portfolio/run.sh
===================================================================
--- trunk/build/kit-embedded/examples/portfolio/run.sh 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/build/kit-embedded/examples/portfolio/run.sh 2009-02-21 00:28:43 UTC (rev 479)
@@ -4,6 +4,6 @@
CLIENT_PATH=java/*:PortfolioModel/
#Second one for the JARs in Teiid embedded
-TEIID_PATH=../../teiid-6.0.0-SNAPSHOT-embedded.jar:../../lib/*:../../extensions/*
+TEIID_PATH=../../teiid-6.0.0-SNAPSHOT-client.jar:../../lib/*:../../extensions/*
java -cp ${CLIENT_PATH}:${TEIID_PATH} JDBCClient "select * from
CustomerAccount"
Deleted: trunk/cache-jbosscache/src/main/resources/jboss-cache-configuration.xml
===================================================================
--- trunk/cache-jbosscache/src/main/resources/jboss-cache-configuration.xml 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/cache-jbosscache/src/main/resources/jboss-cache-configuration.xml 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
- <mbean code="org.jboss.cache.pojo.jmx.CacheJmxWrapper"
name="jboss.cache:service=FederateCache">
- <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup</attribute>
- <attribute name="IsolationLevel">READ_COMMITTED</attribute>
- <attribute
name="LockParentForChildInsertRemove">true</attribute>
-
- <attribute name="CacheMode">LOCAL</attribute>
- <attribute name="UseLazyDeserialization">true</attribute>
-
- <!--
- The max amount of time (in milliseconds) we wait until the
- initial state (ie. the contents of the cache) are retrieved from
- existing members in a clustered environment
- -->
- <attribute name="StateRetrievalTimeout">20000</attribute>
-
- <!--
- Number of milliseconds to wait until all responses for a
- synchronous call have been received.
- -->
- <attribute name="SyncReplTimeout">20000</attribute>
-
- <!-- Max number of milliseconds to wait for a lock acquisition -->
- <attribute name="LockAcquisitionTimeout">15000</attribute>
-
- <!-- Shutdown hook behavior. Valid choices are: DEFAULT, REGISTER and
DONT_REGISTER. this element is omitted, DEFAULT is used. -->
- <attribute name="ShutdownHookBehavior">DEFAULT</attribute>
-
- <attribute name="FetchInMemoryState">true</attribute>
-
- <attribute name="CacheLoaderConfig" replace="false">
- <config>
-
- <!-- are the cache loaders shared in a cluster? -->
- <shared>false</shared>
- <!-- if passivation is true, only the first cache loader is used; the rest
are ignored -->
- <passivation>true</passivation>
-
- <cacheloader>
- <class>org.jboss.cache.loader.FileCacheLoader</class>
- <properties>location=./target/scratch/federate</properties>
-
- <!--fetch the persistent state of a cache when joining a
cluster-->
- <fetchPersistentState>true</fetchPersistentState>
-
- <!-- empties the specified cache loader when cache loader starts up
-->
- <purgeOnStartup>true</purgeOnStartup>
-
- <!-- cache loader is shared among different cache instances -->
- <shared>false</shared>
- </cacheloader>
- </config>
- </attribute>
-
- <attribute name="EvictionPolicyConfig">
- <config>
- <attribute name="wakeUpIntervalSeconds">3</attribute>
- <!-- This defaults to 200000 if not specified -->
- <attribute name="eventQueueSize">100000</attribute>
- <!-- Name of the DEFAULT eviction policy class. -->
- <attribute
name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
- <!-- Cache wide default -->
- <region name="/_default_">
- <attribute name="maxNodes">10000</attribute>
- <attribute name="timeToLiveSeconds">0</attribute>
- </region>
- </config>
- </attribute>
-
- </mbean>
-</server>
\ No newline at end of file
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -53,7 +53,7 @@
*
* @return long SessionID
*/
- public long getSessionID();
+ public String getSessionID();
/**
* Get the SQL Command sent to the Server for a Request
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -34,7 +34,7 @@
public class MMRequest extends MMAdminObject implements Request{
String userName = ""; //$NON-NLS-1$;
- long sessionID;
+ String sessionID;
String requestID;
Date created;
Date processingDate;
@@ -52,7 +52,7 @@
public MMRequest(String[] identifierParts) {
super(identifierParts);
- this.sessionID = Long.parseLong(identifierParts[0]);
+ this.sessionID = identifierParts[0];
this.requestID = identifierParts[1];
if (identifierParts.length >= 3) {
this.nodeID = identifierParts[2];
@@ -100,7 +100,7 @@
*
* @return long SessionID
*/
- public long getSessionID() {
+ public String getSessionID() {
return sessionID;
}
@@ -167,7 +167,7 @@
* @param sessionID The sessionID to set.
* @since 4.3
*/
- public void setSessionID(long sessionID) {
+ public void setSessionID(String sessionID) {
this.sessionID = sessionID;
}
/**
Added:
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java
(rev 0)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -0,0 +1,45 @@
+/*
+ * 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.comm.api;
+
+import com.metamatrix.common.comm.api.ServerConnection;
+
+
+/**
+ * An implementor of this interface, when registered with the ServerConnection will
+ * receive notifications about the connection life cycle events.
+ */
+public interface ServerConnectionListener {
+ /**
+ * A connection has been added to DQP
+ * @param connection The client connection instance, never null
+ */
+ void connectionAdded(ServerConnection connection);
+
+ /**
+ * A connection has been removed for DQP
+ * @param connection The client connection instance, never null
+ */
+ void connectionRemoved(ServerConnection connection);
+
+}
Property changes on:
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -41,12 +41,6 @@
public Connection createConnection(Properties properties) throws SQLException;
/**
- * Register a Connection lifecycle listener to the this DQP instance
- * @param listener a listerner for connection related events.
- */
- public void registerConnectionListener(ConnectionListener listener);
-
- /**
* Shutdown the connection factory, including the DQP and all its existing
connections
*/
public void shutdown() throws SQLException;
Deleted:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionTracker.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionTracker.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionTracker.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,72 +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.jdbc;
-
-import java.net.URL;
-import java.sql.Connection;
-import java.util.HashSet;
-import java.util.Set;
-
-
-/**
- * This object keeps track of connections for a given dqp instance which is
- * identified by the "dqpURL". The main responsibility of this listener is to
- * take down the DQP instance when the connection count to the DQP goes down
- * to zero.
- */
-class EmbeddedConnectionTracker implements ConnectionListener {
-
- private URL dqpURL = null;
- private EmbeddedDriver dqpDriver = null;
- private Set connections = new HashSet();
-
-
- public EmbeddedConnectionTracker(URL dqpURL, EmbeddedDriver dqpDriver) {
- this.dqpURL = dqpURL;
- this.dqpDriver = dqpDriver;
- }
-
- public void connectionAdded(String id, Connection connection) {
- synchronized (connections) {
- connections.add(connection);
- }
- }
-
- public void connectionRemoved(String id, Connection connection) {
- synchronized (connections) {
- connections.remove(connection);
- if(connections.size() == 0) {
- dqpDriver.shutdown(dqpURL);
- }
- }
- }
-
- public Set getConnections() {
- Set tempSet = null;
- synchronized (connections) {
- tempSet = new HashSet(connections);
- }
- return tempSet;
- }
-
-}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -25,7 +25,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
+import java.io.ObjectInputStream;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -34,15 +34,14 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
-import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.metamatrix.common.classloader.NonDelegatingClassLoader;
+import com.metamatrix.common.protocol.MMURLConnection;
import com.metamatrix.common.protocol.MetaMatrixURLStreamHandlerFactory;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.jdbc.util.MMJDBCURL;
@@ -76,7 +75,7 @@
static final String DQP_IDENTITY = "dqp.identity"; //$NON-NLS-1$
static final String MM_IO_TMPDIR = "mm.io.tmpdir"; //$NON-NLS-1$
- private static Hashtable transportMap = new Hashtable();
+ private static EmbeddedTransport currentTransport = null;
static Pattern urlPattern = Pattern.compile(URL_PATTERN);
static Pattern basePattern = Pattern.compile(BASE_PATTERN);
@@ -128,29 +127,31 @@
Connection conn = transport.createConnection(info);
- // only upon sucessful creation of the connection, keep the transport
+ // only upon successful creation of the connection, keep the transport
// available for future connections
- transportMap.put(dqpURL, transport);
+ currentTransport = transport;
return conn;
}
/**
- * Get the DQP tranport or build the transport if one not available from the
+ * Get the DQP transport or build the transport if one not available from the
* DQP URL supplied. DQP transport contains all the details about DQP.
- * @param dqpURL - URL to the DQP.proeprties file
+ * @param dqpURL - URL to the DQP.properties file
* @return EmbeddedTransport
* @throws SQLException
* @since 4.4
*/
- private EmbeddedTransport getDQPTransport(URL dqpURL, Properties info) throws
SQLException {
- EmbeddedTransport transport = (EmbeddedTransport)transportMap.get(dqpURL);
- if (transport != null) {
+ private 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$
DriverManager.println(logMsg);
}
else {
- transport = new EmbeddedTransport(dqpURL, info, this);
+ // shutdown any previous instance; we do encourage single instance in a given
VM
+ shutdown();
+ transport = new EmbeddedTransport(dqpURL, info);
String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDriver.use_new_transport");
//$NON-NLS-1$
DriverManager.println(logMsg);
}
@@ -226,7 +227,7 @@
* @return default connection URL
*/
String getDefaultConnectionURL() {
- return "classpath:/mm.properties"; //$NON-NLS-1$
+ return "classpath:/deploy.properties"; //$NON-NLS-1$
}
/**
@@ -317,15 +318,14 @@
* Shutdown the DQP instance which has been started using the given URL
* @param dqpURL
*/
- public synchronized void shutdown(URL dqpURL) {
- EmbeddedTransport transport = (EmbeddedTransport) transportMap.get(dqpURL);
- if (transport != null) {
+ public static synchronized void shutdown() {
+ if (currentTransport != null) {
try {
- transport.shutdown();
+ currentTransport.shutdown();
+ currentTransport = null;
} catch (SQLException e) {
DriverManager.println(e.getMessage());
}
- transportMap.remove(dqpURL);
}
}
@@ -335,52 +335,47 @@
*/
static class EmbeddedTransport {
private EmbeddedConnectionFactory connectionFactory;
- private EmbeddedConnectionTracker connectionTracker;
private ClassLoader classLoader;
private String workspaceDirectory;
+ private URL url;
- public EmbeddedTransport(URL dqpURL, Properties info, EmbeddedDriver driver)
throws SQLException {
+ public EmbeddedTransport(URL dqpURL, Properties info) throws SQLException {
+ this.url = dqpURL;
+
// Create a temporary workspace directory
this.workspaceDirectory = createWorkspace(getDQPIdentity());
- // create a connection tracker to eep track of number of connections for
this
- // dqp instance.
- this.connectionTracker = new EmbeddedConnectionTracker(dqpURL, driver);
-
//Load the properties from dqp.properties file
Properties props = loadDQPProperties(dqpURL);
props.putAll(info);
this.classLoader = this.getClass().getClassLoader();
- // If the dqp.classpath property exists, a non-delagating classloader will be
created
- // for the DQP,otherwise the DQP classes will be loaded from the existing
classloader
- // (unifiedclassloader scenario)
- String classPath = props.getProperty("dqp.classpath");
//$NON-NLS-1$
- if (classPath != null && classPath.length() > 0) {
- // fully qualify the class path into urls.
- URL[] dqpClassPath = resolveClassPath(classPath, dqpURL);
- this.classLoader = new NonDelegatingClassLoader(dqpClassPath,
Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
- String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDriver.use_classpath");
//$NON-NLS-1$
- DriverManager.println(logMsg);
- for (int i = 0; i < dqpClassPath.length; i++) {
- DriverManager.println(dqpClassPath[i].toString());
- }
- }
+ // a non-delegating class loader will be created from where all third party
dependent jars can be loaded
+ ArrayList<URL> runtimeClasspath = new ArrayList<URL>();
- // Now using this classloader create the connection factory to the dqp.
+ // find jars in the "lib" directory; patches is reverse alpaha and
not case sensitive so small letters then capitals
+ runtimeClasspath.addAll(libClassPath(dqpURL, "lib/patches/",
MMURLConnection.REVERSEALPHA)); //$NON-NLS-1$
+ runtimeClasspath.addAll(libClassPath(dqpURL, "lib/",
MMURLConnection.DATE)); //$NON-NLS-1$
+
+ URL[] dqpClassPath = runtimeClasspath.toArray(new
URL[runtimeClasspath.size()]);
+ this.classLoader = new NonDelegatingClassLoader(dqpClassPath,
Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
+ String logMsg =
BaseDataSource.getResourceMessage("EmbeddedDriver.use_classpath");
//$NON-NLS-1$
+ DriverManager.println(logMsg);
+ for (int i = 0; i < dqpClassPath.length; i++) {
+ DriverManager.println(dqpClassPath[i].toString());
+ }
+
+
+ // Now using this class loader create the connection factory to the dqp.
ClassLoader current = null;
try {
- // this is turn off shutdown thread hook for logging
- System.setProperty("shutdownHookInstalled",
String.valueOf(Boolean.TRUE)); //$NON-NLS-1$
-
current = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.classLoader);
String className =
"com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl"; //$NON-NLS-1$
Class clazz = this.classLoader.loadClass(className);
this.connectionFactory = (EmbeddedConnectionFactory)clazz.newInstance();
-
this.connectionFactory.registerConnectionListener(this.connectionTracker);
} catch (Exception e) {
DriverManager.println(e.getClass() +": "+e.getMessage());
//$NON-NLS-1$
throw new EmbeddedSQLException(e);
@@ -389,43 +384,43 @@
}
}
+ URL getURL() {
+ return this.url;
+ }
+
/**
- * Given dqp.classpath string with relative, absolute paths convert them to
- * URLs to be used by the non delagating classloader.
- * @param classPath - class path given in the properties file
- * @param dqpContext - context URL of the dqp.properties file
- * @return resolved fully qualified url list of class path.
+ * Note that this only works when embedded loaded with "mmfile"
protocol in the URL.
+ * @param dqpURL
+ * @return
*/
- URL[] resolveClassPath(String classPath, URL dqpContext) throws SQLException {
-
- //Load and check to make sure that a classpath exists in the properties
- if(classPath == null || classPath.trim().length() == 0) {
- String logMsg =
BaseDataSource.getResourceMessage("EmbeddedTransport.no_classpath");
//$NON-NLS-1$
- DriverManager.println(logMsg);
- throw new EmbeddedSQLException(logMsg);
- }
-
+ private List<URL> libClassPath (URL dqpURL, String directory, String
sortStyle) {
+ ObjectInputStream in = null;
+ ArrayList<URL> urlList = new ArrayList<URL>();
try {
- // Create URLs out of the classpath string
- List urls = new ArrayList();
- StringTokenizer st = new StringTokenizer(classPath,";");
//$NON-NLS-1$
- while(st.hasMoreTokens()) {
- String path = st.nextToken();
- path = path.trim();
- if (path.length() > 0) {
- // URLHelper is our special URL constructor based on the MM
specific
- // protocols like "classpath:" and "mmfile:".
- urls.add(URLHelper.buildURL(dqpContext, path));
+ urlList.add(URLHelper.buildURL(dqpURL, directory));
+ dqpURL = URLHelper.buildURL(dqpURL,
directory+"?action=list&filter=.jar&sort="+sortStyle); //$NON-NLS-1$
+ in = new ObjectInputStream(dqpURL.openStream());
+ String[] urls = (String[])in.readObject();
+ for (int i = 0; i < urls.length; i++) {
+
+ boolean add = true;
+ URL jarURL = URLHelper.buildURL(urls[i]);
+ if (add) {
+ urlList.add(jarURL);
}
+ }
+ } catch(IOException e) {
+ //ignore, treat as if lib does not exist
+ } catch(ClassNotFoundException e) {
+ //ignore, treat as if lib does not exist
+ } finally {
+ if (in != null) {
+ try{in.close();}catch(IOException e) {}
}
- return (URL[])urls.toArray(new URL[urls.size()]);
- } catch (MalformedURLException e) {
- DriverManager.println(e.getClass() +": "+e.getMessage());
//$NON-NLS-1$
- DriverManager.println(e.getStackTrace().toString());
- throw new EmbeddedSQLException(e);
- }
- }
-
+ }
+ return urlList;
+ }
+
/**
* Load DQP Properties from the URL supplied.
* @param dqpURL - URL to the "dqp.properties" object
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -119,7 +119,7 @@
* @param info contains properies needed to establish a MetaMatrix connection.
* @throws SQLException if the driver cannot establish connection to metamatrix.
*/
- MMConnection(ServerConnection serverConn, Properties info, String url) {
+ public MMConnection(ServerConnection serverConn, Properties info, String url) {
this.serverConn = serverConn;
this.url = url;
this.dqp = serverConn.getService(ClientSideDQP.class);
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -34,10 +34,16 @@
* @since 4.4
*/
public abstract class MMURLConnection extends URLConnection {
- protected static final String READ = "read"; //$NON-NLS-1$
- protected static final String WRITE = "write"; //$NON-NLS-1$
- protected static final String LIST = "list"; //$NON-NLS-1$
- protected static final String DELETE = "delete"; //$NON-NLS-1$
+ protected static final String READ = "read"; //$NON-NLS-1$
+ protected static final String WRITE = "write"; //$NON-NLS-1$
+ protected static final String LIST = "list"; //$NON-NLS-1$
+ protected static final String DELETE = "delete"; //$NON-NLS-1$
+
+ public static final String FILE_LIST_SORT = "sort"; //$NON-NLS-1$
+ public static final String DATE = "date"; //$NON-NLS-1$
+ public static final String ALPHA = "alpha"; //$NON-NLS-1$
+ public static final String REVERSEALPHA = "reversealpha"; //$NON-NLS-1$
+
protected String action = READ;
protected Properties props = null;
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -40,6 +40,8 @@
import java.net.URL;
import java.net.URLConnection;
import java.security.Permission;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.StringTokenizer;
import com.metamatrix.common.protocol.MMURLConnection;
@@ -56,8 +58,7 @@
* @since 4.4
*/
public class MMFileURLConnection extends MMURLConnection {
-
- public static String PROTOCOL = "mmfile"; //$NON-NLS-1$
+ public static String PROTOCOL = "mmfile"; //$NON-NLS-1$
File file;
File deleted;
public static String DELETED = ".deleted"; //$NON-NLS-1$
@@ -167,12 +168,39 @@
return false;
}
};
-
+
File[] matchedFiles = file.listFiles(fileFilter);
String[] urls = new String[matchedFiles.length];
+
+ String sort = props.getProperty(FILE_LIST_SORT, DATE);
+ if (sort.equals(DATE)) {
+ Arrays.sort(matchedFiles, new Comparator<File>() {
+ @Override
+ public int compare(File o1, File o2) {
+ return Long.valueOf(o2.lastModified()).compareTo(o1.lastModified()); // latest
first.
+ }
+ });
+ } else if (sort.equals(ALPHA)) {
+ Arrays.sort(matchedFiles, new Comparator<File>() {
+ @Override
+ public int compare(File o1, File o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+
+ } else if (sort.equals(REVERSEALPHA)) {
+ Arrays.sort(matchedFiles, new Comparator<File>() {
+ @Override
+ public int compare(File o1, File o2) {
+ return o2.getName().compareTo(o1.getName());
+ }
+ });
+ }
+
for (int i = 0; i < matchedFiles.length; i++) {
urls[i] = URLHelper.buildURL(url, matchedFiles[i].getName()).toString();
}
+
// Build input stream from the object
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(out);
@@ -237,7 +265,7 @@
} catch (IOException e) {
}
}
- } else if (name.equalsIgnoreCase("date")) //$NON-NLS-1$
+ } else if (name.equalsIgnoreCase(DATE))
headerField = String.valueOf(file.lastModified());
else {
// This always returns null currently
Modified: trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/common-core/src/main/java/com/metamatrix/core/log/LogMessage.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -22,91 +22,28 @@
package com.metamatrix.core.log;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
+import java.io.Serializable;
-import com.metamatrix.core.CorePlugin;
-public class LogMessage implements Externalizable {
+public class LogMessage implements Serializable{
- public static final String VM_NAME = "VMName"; //$NON-NLS-1$
- public static final String HOST_NAME = "HostName"; //$NON-NLS-1$
-
-// public static String VM_NAME = VMNaming.getVMName();
-// public static String HOST_NAME = VMNaming.getLogicalHostName();
-//
-// private static final String DEFAULT_VM_NAME = ""; //$NON-NLS-1$
-
- private static final String NULL_MSG_TEXT = "Null"; //$NON-NLS-1$
-//
-// static {
-// if ( VM_NAME == null || VM_NAME.trim().length() == 0 ) {
-// VM_NAME = VMNaming.getVMIDString();
-// }
-// if ( VM_NAME == null || VM_NAME.trim().length() == 0 ) {
-// VM_NAME = DEFAULT_VM_NAME;
-// }
-// }
-
- private String msgID;
-
private String context;
private int level;
private Object[] msgParts;
private Throwable exception;
private long timestamp;
private String threadName;
- private String hostName;
- private String vmName;
private int errorCode;
public LogMessage() {
}
- public LogMessage(String msgID, String context, int level) {
- this.msgID = msgID;
- this.context = context;
- this.level = level;
- this.msgParts = null;
- this.timestamp = System.currentTimeMillis();
- this.threadName = Thread.currentThread().getName();
- this.hostName = HOST_NAME;
- this.vmName = VM_NAME;
- }
-
- public LogMessage(String msgID, String context, int level, Throwable e) {
- this(msgID, context, level);
- this.exception = e;
- }
-
-
- public LogMessage(String msgID, String context, int level, Object[] msgParts ) {
- this.msgID = msgID;
- this.context = context;
- this.level = level;
- this.msgParts = convertMsgParts(msgParts);
- this.timestamp = System.currentTimeMillis();
- this.threadName = Thread.currentThread().getName();
- this.hostName = HOST_NAME;
- this.vmName = VM_NAME;
- }
-
- public LogMessage(String msgID, String context, int level, Throwable e, Object[]
msgParts ) {
- this(msgID, context, level, msgParts);
- this.exception = e;
- }
-
public LogMessage(String context, int level, Object[] msgParts ) {
- this.msgID= null;
this.context = context;
this.level = level;
this.msgParts = convertMsgParts(msgParts);
this.timestamp = System.currentTimeMillis();
this.threadName = Thread.currentThread().getName();
- this.hostName = HOST_NAME;
- this.vmName = VM_NAME;
}
public LogMessage(String context, int level, Throwable e, Object[] msgParts) {
@@ -139,14 +76,6 @@
return this.threadName;
}
- public String getVMName() {
- return this.vmName;
- }
-
- public String getHostName() {
- return this.hostName;
- }
-
public long getTimestamp() {
return this.timestamp;
}
@@ -155,74 +84,8 @@
return this.exception;
}
- public String getText() {
- String msg = null;
- if (msgID != null) {
- if (msgParts == null) {
- msg = CorePlugin.Util.getString(msgID);
- } else {
- msg = CorePlugin.Util.getString(msgID, msgParts);
-
- }
-
- } else {
-
- StringBuffer text = null;
- if(msgParts != null) {
- text = new StringBuffer();
- for(int i=0; i<msgParts.length; i++) {
- if (i>0) text.append(" "); //$NON-NLS-1$
- Object omsg = msgParts[i];
- if ( omsg != null ) {
- text.append(omsg.toString());
- }
- }
- }
-
- if (text == null) {
- msg = NULL_MSG_TEXT;
- } else {
- msg = text.toString();
- }
-
-
- }
-
- if (msg == null || msg.length() == 0) {
- msg = NULL_MSG_TEXT;
- }
-
-
- return msg;
- }
-
- // implements Externalizable
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(context);
- out.writeInt(level);
- out.writeObject(msgParts);
- out.writeObject(exception);
- out.writeLong(timestamp);
- out.writeObject(threadName);
- out.writeObject(vmName);
- out.writeInt(this.errorCode);
- }
-
- // implements Externalizable
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- this.context = (String) in.readObject();
- this.level = in.readInt();
- this.msgParts = (Object[]) in.readObject();
- this.exception = (Throwable) in.readObject();
- this.timestamp = in.readLong();
- this.threadName = (String) in.readObject();
- this.vmName = (String) in.readObject();
- this.errorCode = in.readInt();
- }
-
-
//do a toString() to the object array before adding to the worker
//to make sure the current state is recorded
private Object[] convertMsgParts(Object[] oriMsgParts){
@@ -237,6 +100,25 @@
return oriMsgParts;
}
+ public String getText() {
+ StringBuffer text = null;
+ if(msgParts != null) {
+ text = new StringBuffer();
+ for(int i=0; i<msgParts.length; i++) {
+ if (i>0) text.append(" "); //$NON-NLS-1$
+ Object omsg = msgParts[i];
+ if ( omsg != null ) {
+ text.append(omsg.toString());
+ }
+ }
+ }
+
+ if (text == null) {
+ return "NULL"; //$NON-NLS-1$
+ } else {
+ return text.toString();
+ }
+ }
/**
* @return Returns the errorCode.
Modified:
trunk/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -34,7 +34,6 @@
import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.LogMessage;
import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.SystemLogWriter;
/**
* The PlatformLog class is designed to be extended by any {@link Logger} implementation
that is to
@@ -83,42 +82,10 @@
*/
public class PlatformLog implements LogListener {
- // =========================================================================
- // Static Members
- // =========================================================================
- private static final PlatformLog INSTANCE = new PlatformLog();
- private static ShutdownThread SHUTDOWNTHREAD = null;
- private static final String SHUTDOWN_HOOK_INSTALLED_PROPERTY =
"shutdownHookInstalled"; //$NON-NLS-1$
-
- static {
- String hook = System.getProperty(SHUTDOWN_HOOK_INSTALLED_PROPERTY);
- if ( hook == null || hook.equalsIgnoreCase(String.valueOf(Boolean.FALSE))) {
- /**
- * By default, add a listener to write to System.out and System.err,
- * and that is automatically shutdown upon VM termination.
- */
- SHUTDOWNTHREAD = new ShutdownThread(INSTANCE);
- INSTANCE.addListener( new SystemLogWriter() );
- try {
- Runtime.getRuntime().addShutdownHook(SHUTDOWNTHREAD);
- System.setProperty(SHUTDOWN_HOOK_INSTALLED_PROPERTY,
Boolean.TRUE.toString());
- } catch (IllegalStateException e) {
- //ignore: this happens if we try to register the shutdown hook after the
system
- //is already shutting down. there's nothing we can do about it.
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
- }
-
- public static PlatformLog getInstance() {
- return INSTANCE;
- }
-
private static final String DEFAULT_LOG_WORKER_THREAD_NAME = "LogWorker";
//$NON-NLS-1$
private static final long DEFAULT_TIMEOUT = 60000; // time to wait for a
message
- private static final long SHUTDOWN_TIMEOUT = 20000; // max time to wait
for shutdown
+ private static final long SHUTDOWN_TIMEOUT = 20000; // max time to wait for
shutdown
/**
* Flag specifying whether to write debugging statements to {@link #DEBUG_STREAM}.
@@ -182,24 +149,6 @@
}
/**
- * Used by the DQP to ensure that the shutdown thread is removed from the VM
- * in which the DQP is embedded.
- * @since 4.2
- */
- public static void deregisterShutdownHook() {
- try {
- if (SHUTDOWNTHREAD != null) {
- Runtime.getRuntime().removeShutdownHook(SHUTDOWNTHREAD);
- }
- } catch (IllegalStateException e) {
- //ignore: this happens if we try to register the shutdown hook after the
system
- //is already shutting down. there's nothing we can do about it.
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
-
- /**
* Shut down and process all content. This method is equivalent to calling
* {@link #shutdown(boolean)} with a parameter value of
<code>true</code>.
*/
@@ -258,6 +207,8 @@
}
this.logListeners.clear();
}
+
+ this.executor = null;
}
public synchronized void start() {
@@ -342,20 +293,4 @@
}
}
-
-class ShutdownThread extends Thread {
- private static final String SHUTDOWN_THREAD_NAME = "Shutdown"; //$NON-NLS-1$
- private PlatformLog log;
-
- ShutdownThread(final PlatformLog platformLog) {
- super(SHUTDOWN_THREAD_NAME);
- this.log = platformLog;
- }
-
- public void run() {
- final boolean processRemainingContent = true;
- this.log.shutdown(processRemainingContent);
- }
-
-}
Modified: trunk/common-internal/pom.xml
===================================================================
--- trunk/common-internal/pom.xml 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/common-internal/pom.xml 2009-02-21 00:28:43 UTC (rev 479)
@@ -64,6 +64,11 @@
<artifactId>stringtemplate</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+
</dependencies>
</project>
\ No newline at end of file
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -27,10 +27,6 @@
public interface LogConfiguration extends Comparable, Cloneable {
- boolean isContextDiscarded( String context );
-
- boolean isLevelDiscarded( int level );
-
/**
* Obtain the set of contexts for messages that are to be discarded.
* If this method returns an empty set, then messages in all contexts
@@ -55,45 +51,17 @@
int getMessageLevel();
/**
- * Compares this object to another. If the specified object is an instance of
- * the MetadataID class, then this method compares the name; otherwise, it throws a
- * ClassCastException (as instances are comparable only to instances of the same
- * class).
- * Note: this method <i>is</i> consistent with
<code>equals()</code>, meaning
- * that <code>(compare(x, y)==0) == (x.equals(y))</code>.
- * <p>
- * @param obj the object that this instance is to be compared to.
- * @return a negative integer, zero, or a positive integer as this object
- * is less than, equal to, or greater than the specified object, respectively.
- * @throws IllegalArgumentException if the specified object reference is null
- * @throws ClassCastException if the specified object's type prevents it
- * from being compared to this instance.
+ * Direct the log configuration to record all known logging contexts.
*/
- int compareTo(Object obj);
+ void recordAllContexts();
/**
- * Returns true if the specified object is semantically equal to this instance.
- * Note: this method is consistent with <code>compareTo()</code>.
- * <p>
- * @param obj the object that this instance is to be compared to.
- * @return whether the object is equal to this object.
+ * Clone the object.
+ * @return
*/
- boolean equals(Object obj);
-
- /**
- * String representation of logging configuration.
- * @return String representation
- */
- String toString();
-
Object clone();
-
+
/**
- * Direct the log configuration to record all known logging contexts.
- */
- void recordAllContexts();
-
- /**
* Direct the log configuration to discard the given contexts and
* not record them.
* @param contexts the collection of contexts that should be discarded.
@@ -112,4 +80,7 @@
* @param level the lowest level to record.
*/
void setMessageLevel(int level);
+
+
+ boolean isMessageToBeRecorded(String context, int msgLevel);
}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogManager.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -27,18 +27,15 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import com.google.inject.Inject;
import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
import com.metamatrix.common.log.config.BasicLogConfiguration;
-import com.metamatrix.common.log.config.DefaultLogConfigurationFactory;
-import com.metamatrix.common.log.config.LogConfigurationException;
-import com.metamatrix.common.util.ErrorMessageKeys;
import com.metamatrix.common.util.LogCommonConstants;
import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.LogMessage;
import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.internal.core.log.PlatformLog;
+import com.metamatrix.core.log.NullLogWriter;
/**
@@ -92,86 +89,13 @@
*/
public final class LogManager {
- /**
- * The name of the System property that contains the set of comma-separated
- * context names for messages <i>not</i> to be recorded. A message
context is simply
- * some string that identifies something about the component that generates
- * the message. The value for the contexts is application specific.
- * <p>
- * This is an optional property that defaults to no contexts (i.e., messages
- * with any context are recorded).
- */
- public static final String SYSTEM_LOG_CONTEXT_PROPERTY_NAME =
DefaultLogConfigurationFactory.LOG_CONTEXT_PROPERTY_NAME;
-
- /**
- * The name of the System property that contains 'true' if the log messages
- * are to be sent to System.out, or 'false' otherwise. This is an optional
- * property that defaults to 'true'. Note, however, that if the message
- * level for the logger is specified to be something other than NONE but
- * no file destination is specified, the value for this propery is
- * always assumed to be 'true'.
- * <p>
- * If the System.out is captured by the LogManager, the LogManager always
- * treats this property value as 'false'.
- */
- public static final String SYSTEM_LOG_CONSOLE_PROPERTY_NAME =
"metamatrix.log.console"; //$NON-NLS-1$
-
- /**
- * The name of the System property that should be 'true' if System.out is to
- * be captured by the LogManager, or false if System.out is not be be captured.
- * This is an optional property that defaults to 'false'.
- */
- public static final String SYSTEM_LOG_CAPTURE_SYSTEM_OUT =
"metamatrix.log.captureSystemOut"; //$NON-NLS-1$
-
- /**
- * The name of the System property that should be 'true' if System.err is to
- * be captured by the LogManager, or false if System.err is not be be captured.
- * This is an optional property that defaults to 'false'.
- */
- public static final String SYSTEM_LOG_CAPTURE_SYSTEM_ERR =
"metamatrix.log.captureSystemErr"; //$NON-NLS-1$
-
- /**
- * The name of the System property that should be set to the name of the file
- * to which System.out is sent only if also captured by the LogManager.
- * This is an optional property. If set to the same value as
- * #SYSTEM_ERR_FILENAME (case insensitive comparison), then the same file will be
used for both.
- */
- public static final String SYSTEM_OUT_FILENAME =
"metamatrix.log.systemOutFilename"; //$NON-NLS-1$
-
- /**
- * The name of the System property that should be set to the name of the file
- * to which System.err is sent only if also captured by the LogManager.
- * This is an optional property. If set to the same value as
- * #SYSTEM_OUT_FILENAME (case insensitive comparison), then the same file will be
used for both.
- */
- public static final String SYSTEM_ERR_FILENAME =
"metamatrix.log.systemErrFilename"; //$NON-NLS-1$
-
- private static LogManager INSTANCE = new LogManager(PlatformLog.getInstance());
-
- private LogConfiguration configuration;
- private PlatformLog platformLog;
+ @Inject
+ static LogConfiguration configuration = new BasicLogConfiguration(); // either
injected or manually set using the set methods
- protected LogManager(PlatformLog platformLog) {
- this.platformLog = platformLog;
- // Get the preferred LogConfiguration ...
- try {
- configuration =
(LogConfiguration)CurrentConfiguration.getInstance().getConfiguration().getLogConfiguration().clone();
- } catch ( ConfigurationException e ) {
+ @Inject
+ static LogListener logListener = new NullLogWriter(); // either injected or manually
set using the set methods
- // Get the initial LogConfiguration from the System properties ...
- try {
- configuration =
BasicLogConfiguration.createLogConfiguration(System.getProperties());
- } catch ( LogConfigurationException le ) {
- throw new MetaMatrixRuntimeException(le, ErrorMessageKeys.LOG_ERR_0005,
CommonPlugin.Util.getString( ErrorMessageKeys.LOG_ERR_0005) );
- }
- }
- }
-
- static LogManager getInstance() {
- return INSTANCE;
- }
-
/**
* Send a critical message to the log. This level of message is generally
* used to record an event or error that must be recorded (if any logging
@@ -187,7 +111,7 @@
* not logged if this parameter is null
*/
public static void logCritical(String context, String message) {
- LogManager.getInstance().logMessage(MessageLevel.CRITICAL, context, message);
+ logMessage(MessageLevel.CRITICAL, context, message);
}
/**
@@ -206,7 +130,7 @@
* @param message the log message (may be null)
*/
public static void logCritical(String context, Throwable e, String message) {
- LogManager.getInstance().logMessage(MessageLevel.CRITICAL,context,e,message);
+ logMessage(MessageLevel.CRITICAL,context,e,message);
}
/**
@@ -222,7 +146,7 @@
* not logged if this parameter is null
*/
public static void logError(String context, String message) {
- LogManager.getInstance().logMessage(MessageLevel.ERROR, context,message);
+ logMessage(MessageLevel.ERROR, context,message);
}
/**
@@ -239,7 +163,7 @@
* @param message the log message (may be null)
*/
public static void logError(String context, Throwable e, String message) {
- LogManager.getInstance().logMessage(MessageLevel.ERROR,context,e,message);
+ logMessage(MessageLevel.ERROR,context,e,message);
}
/**
@@ -255,7 +179,7 @@
* not logged if this parameter is null
*/
public static void logWarning(String context, String message) {
- LogManager.getInstance().logMessage(MessageLevel.WARNING, context,message);
+ logMessage(MessageLevel.WARNING, context,message);
}
/**
@@ -272,7 +196,7 @@
* @param message the log message (may be null)
*/
public static void logWarning(String context, Throwable e, String message) {
- LogManager.getInstance().logMessage(MessageLevel.WARNING,context,e,message);
+ logMessage(MessageLevel.WARNING,context,e,message);
}
/**
@@ -289,7 +213,7 @@
* not logged if this parameter is null
*/
public static void logInfo(String context, String message) {
- LogManager.getInstance().logMessage(MessageLevel.INFO, context,message);
+ logMessage(MessageLevel.INFO, context,message);
}
/**
@@ -305,7 +229,7 @@
* not logged if this parameter is null
*/
public static void logDetail(String context, Object ... msgParts) {
- LogManager.getInstance().logMessage(MessageLevel.DETAIL, context, msgParts);
+ logMessage(MessageLevel.DETAIL, context, msgParts);
}
/**
@@ -322,7 +246,7 @@
* @param message the log message (may be null)
*/
public static void logDetail(String context, Throwable e, String message) {
- LogManager.getInstance().logMessage(MessageLevel.DETAIL,context,e,message);
+ logMessage(MessageLevel.DETAIL,context,e,message);
}
/**
@@ -339,7 +263,7 @@
* not logged if this parameter is null
*/
public static void logTrace(String context, Object ... msgParts) {
- LogManager.getInstance().logMessage(MessageLevel.TRACE, context, msgParts);
+ logMessage(MessageLevel.TRACE, context, msgParts);
}
/**
@@ -357,7 +281,7 @@
* @param msgParts the individual parts of the log message (may be null)
*/
public static void logTrace(String context, Throwable e, Object ... msgParts) {
- LogManager.getInstance().logMessage(MessageLevel.TRACE,context,e,msgParts);
+ logMessage(MessageLevel.TRACE,context,e,msgParts);
}
/**
@@ -372,7 +296,7 @@
* not logged if this parameter is null
*/
public static void log(int msgLevel, String context, String message) {
- LogManager.getInstance().logMessage(msgLevel, context, message);
+ logMessage(msgLevel, context, message);
}
/**
@@ -388,7 +312,7 @@
* not logged if this parameter is null
*/
public static void log(int msgLevel, String context, Throwable e, String message) {
- LogManager.getInstance().logMessage(msgLevel, context, e, message);
+ logMessage(msgLevel, context, e, message);
}
/**
@@ -398,24 +322,29 @@
* @return a modifiable copy of the current log configuration
*/
public static LogConfiguration getLogConfigurationCopy() {
- return getInstance().getConfigurationCopy();
+ if (configuration == null) {
+ throw new
MetaMatrixRuntimeException(CommonPlugin.Util.getString("LogManager_not_configured"));
//$NON-NLS-1$
+ }
+ return (LogConfiguration)configuration.clone();
}
public static void setLogConfiguration( LogConfiguration config ) {
- getInstance().setConfiguration(config);
- }
-
- public LogConfiguration getConfigurationCopy() {
- return (LogConfiguration)configuration.clone();
- }
-
- public void setConfiguration(LogConfiguration config) {
if ( config != null ) {
logMessage(MessageLevel.INFO, LogCommonConstants.CTX_LOGGING,
CommonPlugin.Util.getString("MSG.003.014.0015", config)); //$NON-NLS-1$
configuration = (LogConfiguration) config.clone();
}
- }
-
+ }
+
+ public static void setLogListener(LogListener listener) {
+ logListener.shutdown();
+ if (listener != null) {
+ logListener = listener;
+ }
+ else {
+ logListener = new NullLogWriter();
+ }
+ }
+
/**
* Utility method to identify whether a log message with the specified
* context and level will be recorded in the LogManager's destinations.
@@ -425,42 +354,23 @@
* or false if it would be discarded by the LogManager.
*/
public static boolean isMessageToBeRecorded(String context, int msgLevel) {
- return getInstance().isLoggingEnabled(context, msgLevel);
+ return configuration.isMessageToBeRecorded(context, msgLevel);
}
-
- public boolean isLoggingEnabled(String context, int msgLevel) {
- if ( context == null ) {
- return false;
- }
-
- // If the messsage's level is greater than the logging level,
- // then the message should NOT be recorded ...
- if ( configuration.getMessageLevel() == MessageLevel.NONE || msgLevel <=
MessageLevel.NONE ||
- configuration.isLevelDiscarded( msgLevel ) || configuration.isContextDiscarded(
context )) {
- return false;
- }
- return true;
- }
-
- protected void logMessage(int level, String context, Object ... msgParts) {
+ private static void logMessage(int level, String context, Object ... msgParts) {
logMessage(level, context, null, msgParts);
}
- protected void logMessage(int level, String context, Throwable e, Object ...
msgParts) {
- if (msgParts == null || msgParts.length == 0 || !isLoggingEnabled(context, level)) {
+ private static void logMessage(int level, String context, Throwable e, Object ...
msgParts) {
+ if (msgParts == null || msgParts.length == 0 || !isMessageToBeRecorded(context, level))
{
return;
}
-
- LogMessage msg = new LogMessage( context, level, e, msgParts);
- forwardMessage(msg);
+
+ LogMessage msg = new LogMessage( context, level, e, msgParts);
+ logListener.logMessage(msg);
}
- protected void forwardMessage(LogMessage msg) {
- platformLog.logMessage(msg);
- }
-
public static Object createLoggingProxy(final String loggingContext,
final Object instance,
final Class[] interfaces,
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/BasicLogConfiguration.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/BasicLogConfiguration.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/BasicLogConfiguration.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -39,7 +39,7 @@
* LogConfiguration, plus static utility methods for converting a
* LogConfiguration object to and from a Properties object representation.
*/
-public class BasicLogConfiguration implements LogConfiguration, Serializable {
+public class BasicLogConfiguration implements LogConfiguration, Serializable, Cloneable
{
//************************************************************
// static constants, members, methods
@@ -216,13 +216,12 @@
this.unmodifiableContexts = Collections.unmodifiableSet(this.discardedContexts);
}
- public boolean isContextDiscarded( String context ) {
- boolean discarded = ((context != null) &&
- this.discardedContexts.contains(context));
+ boolean isContextDiscarded( String context ) {
+ boolean discarded = ((context != null) &&
this.discardedContexts.contains(context));
return discarded;
}
- public boolean isLevelDiscarded( int level ) {
+ boolean isLevelDiscarded( int level ) {
return ( level > msgLevel );
}
@@ -406,4 +405,19 @@
public void setMessageLevel(int level) {
this.msgLevel = level;
}
+
+
+ @Override
+ public boolean isMessageToBeRecorded(String context, int msgLevel) {
+ if ( context == null ) {
+ return false;
+ }
+
+ // If the messsage's level is greater than the logging level,
+ // then the message should NOT be recorded ...
+ if ( getMessageLevel() == MessageLevel.NONE || msgLevel <= MessageLevel.NONE
|| isLevelDiscarded( msgLevel ) || isContextDiscarded( context )) {
+ return false;
+ }
+ return true;
+ }
}
Deleted:
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/DefaultLogConfigurationFactory.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/DefaultLogConfigurationFactory.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/DefaultLogConfigurationFactory.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,40 +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.common.log.config;
-
-
-
-public class DefaultLogConfigurationFactory implements LogConfigurationFactory {
-
- /**
- * The name of the System property that contains the set of comma-separated
- * context names for messages <i>not</i> to be recorded. A message
context is simply
- * some string that identifies something about the component that generates
- * the message. The value for the contexts is application specific.
- * <p>
- * This is an optional property that defaults to no contexts (i.e., messages
- * with any context are recorded).
- */
- public static final String LOG_CONTEXT_PROPERTY_NAME =
"metamatrix.log.contexts"; //$NON-NLS-1$
-
-}
Deleted:
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/LogConfigurationFactory.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/LogConfigurationFactory.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/log/config/LogConfigurationFactory.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,29 +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.common.log.config;
-
-
-
-public interface LogConfigurationFactory {
-
-}
Deleted:
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/DelimitedLogMessageFormat.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/DelimitedLogMessageFormat.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/DelimitedLogMessageFormat.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,103 +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.common.log.format;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import com.metamatrix.core.log.LogMessage;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.util.MetaMatrixExceptionUtil;
-import com.metamatrix.core.util.StringUtil;
-
-/**
- * This class formats LogMessages using a format with delimiters that is easily parsed.
- * The format is:
- * <p><pre>
- * yyyy.MM.dd HH:mm:ss
- * </pre></p>
- * For example, <pre>"1952.01.12 13:30:32"</pre>.
- */
-public class DelimitedLogMessageFormat implements LogMessageFormat {
- public static final String TIMESTAMP_FORMAT = "yyyy.MM.dd HH:mm:ss.SSS";
//$NON-NLS-1$
-
-
- // Cache date formatter which is expensive to create
- private static DateFormat DATE_FORMATTER = new SimpleDateFormat(TIMESTAMP_FORMAT);
- private static final String DEFAULT_FORMATTED_MESSAGE = ""; //$NON-NLS-1$
-// private static final String DELIMITER_STRING = "|";
- private static final char DELIMITER_CHAR = '|';
-
- /**
- * Format the specified message and return the String representation.
- * @param message the log message to be formated.
- * @return the String representation of the log message.
- */
- public String formatMessage( LogMessage message ) {
- if ( message == null ) {
- return DEFAULT_FORMATTED_MESSAGE;
- }
- StringBuffer msg = new StringBuffer();
- msg.append( DATE_FORMATTER.format( new Date(message.getTimestamp()) ) );
- msg.append( DELIMITER_CHAR );
- msg.append( message.getHostName() );
- msg.append( DELIMITER_CHAR );
- msg.append( message.getVMName() );
- msg.append( DELIMITER_CHAR );
- msg.append( message.getThreadName() );
- msg.append( DELIMITER_CHAR );
- msg.append( message.getContext() );
- msg.append( DELIMITER_CHAR );
- msg.append( MessageLevel.getLabelForLevel(message.getLevel()) );
- msg.append( DELIMITER_CHAR );
- msg.append( message.getText() );
-
- Throwable e = message.getException();
- if ( e != null) {
- StringWriter strWriter = new StringWriter();
- PrintWriter strPrinter = new PrintWriter(strWriter, true);
-
- // Get the stack trace into a string writer we can access
- e.printStackTrace(strPrinter);
- msg.append(StringUtil.getLineSeparator());
- msg.append(strWriter);
-
- java.util.Iterator children =
MetaMatrixExceptionUtil.getChildrenIterator(e);
- while (children.hasNext()){
- e = (Throwable)children.next();
- strWriter = new StringWriter();
- strPrinter = new PrintWriter(strWriter, true);
- e.printStackTrace(strPrinter);
- msg.append(StringUtil.getLineSeparator());
- msg.append(strWriter);
- }
-
- }
-
- return msg.toString();
- }
-
-}
Deleted:
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/LogMessageFormat.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/LogMessageFormat.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/log/format/LogMessageFormat.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,35 +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.common.log.format;
-
-import com.metamatrix.core.log.LogMessage;
-
-public interface LogMessageFormat {
-
- /**
- * Format the specified message and return the String representation.
- * @param message the log message to be formated.
- * @return the String representation of the log message.
- */
- public String formatMessage( LogMessage message );
-}
Modified:
trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java
===================================================================
---
trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/test/java/com/metamatrix/common/log/TestLogManager.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -28,6 +28,7 @@
import junit.framework.TestCase;
+import com.metamatrix.common.log.config.BasicLogConfiguration;
import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.LogMessage;
import com.metamatrix.core.log.MessageLevel;
@@ -46,6 +47,13 @@
super(name);
}
+ @Override
+ protected void setUp() throws Exception {
+ LogManager.configuration = new BasicLogConfiguration();
+ LogManager.logListener = new PlatformLog();
+
+ }
+
// =========================================================================
// T E S T C A S E S
// =========================================================================
@@ -55,26 +63,26 @@
*/
public void testIsMessageToBeRecordedStringI() {
String context = "SomeContext"; //$NON-NLS-1$
- LogManager manager = new LogManager(null);
- assertTrue(manager.isLoggingEnabled(context, MessageLevel.CRITICAL) );
- LogConfiguration cfg = LogManager.getInstance().getConfigurationCopy();
+
+ assertTrue(LogManager.isMessageToBeRecorded(context, MessageLevel.CRITICAL) );
+
+ LogConfiguration cfg = LogManager.getLogConfigurationCopy();
cfg.discardContext(context);
- manager.setConfiguration(cfg);
- assertFalse(manager.isLoggingEnabled(context, MessageLevel.CRITICAL) );
+ LogManager.setLogConfiguration(cfg);
+ assertFalse(LogManager.isMessageToBeRecorded(context, MessageLevel.CRITICAL) );
}
/**
* Test that all msgs logged are equal and output in same order.
*/
public void testLogMessage() throws Exception {
- PlatformLog log = new PlatformLog();
- LogManager manager = new LogManager(log);
- LogConfiguration cfg = manager.getConfigurationCopy();
+
+ LogConfiguration cfg = LogManager.getLogConfigurationCopy();
cfg.setMessageLevel( MessageLevel.INFO );
- manager.setConfiguration(cfg);
-
+ LogManager.setLogConfiguration(cfg);
+
ListLogger listener = new ListLogger(6);
- log.addListener(listener);
+ LogManager.logListener = listener;
List<String> sentMsgList = new ArrayList<String>();
sentMsgList.add("A message 1"); //$NON-NLS-1$
@@ -86,12 +94,11 @@
for (Iterator iter = sentMsgList.iterator(); iter.hasNext();) {
String msg = (String) iter.next();
- manager.logMessage(MessageLevel.INFO, "SomeContext", msg);
//$NON-NLS-1$
+ LogManager.logInfo("SomeContext", msg); //$NON-NLS-1$
}
List recevedMsgList = listener.getLoggedMessages();
assertEquals(sentMsgList, recevedMsgList);
- log.shutdown();
}
/**
@@ -139,4 +146,6 @@
}
+
+
}
Deleted:
trunk/common-internal/src/test/java/com/metamatrix/common/log/format/TestLogMessageFormat.java
===================================================================
---
trunk/common-internal/src/test/java/com/metamatrix/common/log/format/TestLogMessageFormat.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/common-internal/src/test/java/com/metamatrix/common/log/format/TestLogMessageFormat.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,76 +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.common.log.format;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.api.exception.ComponentNotFoundException;
-import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.log.LogMessage;
-
-/**
- *
- */
-public class TestLogMessageFormat extends TestCase {
-
- // ################################## FRAMEWORK ################################
-
- public TestLogMessageFormat(String name) {
- super(name);
- }
-
- // ################################## TEST HELPERS ################################
-
- private static Throwable generateThrowable(){
- Exception e2 = new Exception("Test0"); //$NON-NLS-1$
- MetaMatrixException e = new ComponentNotFoundException(e2, "Test1");
//$NON-NLS-1$
- //e = new MetaMatrixException(e, "Test2");
- MetaMatrixRuntimeException ee = new MetaMatrixRuntimeException(e,
"Test3"); //$NON-NLS-1$
- e = new MetaMatrixProcessingException(ee, "Test4"); //$NON-NLS-1$
- return e;
- }
-
- private static LogMessageFormat getLogMessageFormat(){
-// return new ReadableLogMessageFormat();
- return new DelimitedLogMessageFormat();
- }
-
- // ################################## ACTUAL TESTS ################################
-
- /**
- */
- public void testLogFormat(){
- String context = "FAKE_CONTEXT"; //$NON-NLS-1$
- int level = 2;
- Throwable e = generateThrowable();
- Object[] msgParts = new Object[]{ "This is a fake log message for
testing."}; //$NON-NLS-1$
- LogMessage logMessage = new LogMessage(context, level, e, msgParts);
- LogMessageFormat format = getLogMessageFormat();
-
- String firstLine = format.formatMessage(logMessage).split("\\n")[0];
//$NON-NLS-1$
- assertTrue(firstLine.endsWith("|HostName|VMName|main|FAKE_CONTEXT|ERROR|This
is a fake log message for testing.")); //$NON-NLS-1$
- }
-
-}
Modified:
trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java
===================================================================
---
trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/connector-sdk/src/main/java/com/metamatrix/core/commandshell/CommandShell.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -36,6 +36,7 @@
import java.util.Set;
import java.util.Stack;
+import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.CorePlugin;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.FileLogWriter;
@@ -146,25 +147,13 @@
private void redirectLogging() {
- //get the java System property: redirect if "false", not if
"true" or null
- String logConsoleString = System.getProperty(PROPERTY_LOG_CONSOLE);
- String FALSE = Boolean.toString(false);
- boolean redirect = FALSE.equalsIgnoreCase(logConsoleString);
-
- if (redirect) {
- //remove the listener that writes to System.out and System.err
- Collection listeners = PlatformLog.getInstance().getLogListeners();
- for (Iterator it = listeners.iterator(); it.hasNext();) {
- LogListener ll = (LogListener) it.next();
- if (ll instanceof SystemLogWriter) {
- PlatformLog.getInstance().removeListener(ll);
- }
- }
-
- //add a listener that writes to a file
- File file = new File(DEFAULT_LOG_FILE);
- PlatformLog.getInstance().addListener(new FileLogWriter(file));
- }
+ //add a listener that writes to a file
+ File file = new File(DEFAULT_LOG_FILE);
+ FileLogWriter flw = new FileLogWriter(file);
+
+ PlatformLog logger = new PlatformLog();
+ logger.addListener(flw);
+ LogManager.setLogListener(logger);
}
Modified: trunk/console/src/main/java/com/metamatrix/console/main/AdminConsoleMain.java
===================================================================
---
trunk/console/src/main/java/com/metamatrix/console/main/AdminConsoleMain.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/console/src/main/java/com/metamatrix/console/main/AdminConsoleMain.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -254,7 +254,9 @@
System.setErr(log);
}
FileLogWriter flw = new FileLogWriter(tmpFile);
- PlatformLog.getInstance().addListener(flw);
+ PlatformLog logger = new PlatformLog();
+ logger.addListener(flw);
+ LogManager.setLogListener(logger);
} catch (Exception ex) {
ex.printStackTrace();
}
Deleted: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedManager.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedManager.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedManager.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,148 +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.
- */
-
-/*
- * Date: Jun 24, 2003
- * Time: 1:13:49 PM
- */
-package com.metamatrix.dqp.embedded;
-
-import java.net.URL;
-import java.util.Date;
-import java.util.Properties;
-
-import com.metamatrix.common.application.DQPConfigSource;
-import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.dqp.internal.process.DQPCore;
-import com.metamatrix.dqp.service.ConfigurationService;
-import com.metamatrix.dqp.service.DQPServiceNames;
-
-/**
- * Manages the life cycle of the embedded DQP. Like handling the creation and deletion
- * of the DQP. Knows about configuration elements and connection management to the
- * Embedded DQP. All direct operations to the DQP must go though the manager object
- * (other than what goes on Connection object requests), there should not be any
- * referecnes to DQP instance directly manuplulating the API. If such case arises
- * implement as methods on DQP interface.
- */
-public class DQPEmbeddedManager {
-
- private DQPConfigSource configSource;
- private DQPCore dqpInstance;
- private long dqpStarttime = -1;
- DQPListener dqpListener = null;
-
- /**
- * Construct DQPEmbeddedManager.
- */
- public DQPEmbeddedManager(URL dqpURL, Properties connectionProperties, DQPListener
listener) throws ApplicationInitializationException {
- this.configSource = new EmbeddedConfigSource(dqpURL, connectionProperties);
- this.dqpListener = listener;
- }
-
- /**
- * Main access method to DQP. Will either find the DQP or
- * start and initialize as necessary.
- * @return The DQP to use.
- * @throws ApplicationInitializationException when an error occurs
- * during DQP initialization.
- */
- public synchronized DQPCore createDQP() throws ApplicationInitializationException {
- if ( dqpInstance == null ) {
- dqpInstance = new DQPCore();
- dqpInstance.start(configSource);
- dqpStarttime = System.currentTimeMillis();
- DQPEmbeddedPlugin.logInfo("DQPEmbeddedManager.start_dqp", new
Object[] {new Date(System.currentTimeMillis()).toString()}); //$NON-NLS-1$
-
- // Notify the listener that DQP started
- if (dqpListener != null) {
- dqpListener.onStart();
- }
- }
- return dqpInstance;
- }
-
- /**
- * Get the DQP instance holded by this manager
- * @return DQP instance if has been created;null otherwise
- */
- public DQPCore getDQP() {
- return dqpInstance;
- }
-
- /**
- * Shutdown the DQP and its connections.
- * @throws ApplicationLifecycleException
- */
- public synchronized void shutdown() throws ApplicationLifecycleException {
- if (dqpInstance != null) {
-
- // stop the DQP
- dqpInstance.stop();
- dqpInstance = null;
- configSource = null;
- dqpStarttime = -1;
-
- // Notify the listener that DQP being stopped
- if (dqpListener != null) {
- dqpListener.onShutdown();
- dqpListener = null;
- }
-
- DQPEmbeddedPlugin.logInfo("DQPEmbeddedManager.shutdown_dqp", new
Object[] {new Date(System.currentTimeMillis()).toString()}); //$NON-NLS-1$
-
- // shutdown the logger
- EmbeddedConfigUtil.shutdownLogger();
- }
- }
-
- /**
- * Returns the long defining the time in milliseconds when it started.
- * @return -1 if the DQP not started.
- * @since 4.3
- */
- public long getDQPStartTime() {
- return dqpStarttime;
- }
-
- /**
- * Check if the DQP has been started.
- * @return
- * @since 4.3
- */
- public boolean isDQPAlive() {
- return dqpInstance != null;
- }
-
- /**
- * Get the properties of the DQP.
- * @return null if the DQP not started. properties started with otherwise.
- * @since 4.3
- */
- public Properties getDQPProperties() {
- if (isDQPAlive()) {
- return
((ConfigurationService)dqpInstance.getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE)).getSystemProperties();
- }
- return null;
- }
-}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -28,10 +28,8 @@
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_CAPTURE_SYSTEM_PRINTSTREAMS =
"dqp.captureSystemStreams"; //$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_CLASSPATH = "dqp.classpath"; //$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$
Deleted: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPListener.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPListener.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/DQPListener.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,41 +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;
-
-
-/**
- * When registered with the DQP manager, the registar wil notified about the
- * life cycle events of the DQP.
- * @since 4.3
- */
-public interface DQPListener {
- /**
- * This event gets notified as soon as the DQP is Started
- */
- void onStart();
-
- /**
- * Upon the shutdown of the dqp this method gets called
- */
- void onShutdown();
-}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -24,19 +24,18 @@
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import com.google.inject.Binder;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
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;
@@ -45,16 +44,19 @@
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
- * responsibility is to encapsulate the knowedge of creating of the various application
+ * responsibility is to encapsulate the knowledge of creating of the various application
* services used the DQP.
*
*/
public class EmbeddedConfigSource implements DQPConfigSource {
+ private static final String SERVER_CONFIG_FILE_EXTENSION = ".properties";
//$NON-NLS-1$
- private Properties props;
+ private Properties props;
private boolean useTxn;
/**
@@ -62,13 +64,24 @@
* @param configFile
* @throws ApplicationInitializationException
*/
- public EmbeddedConfigSource(URL dqpURL, Properties connectionProperties) 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
ApplicationInitializationException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigSource.Can_not_load_config_file_2",
dqpURL)); //$NON-NLS-1$
+ throw new
MetaMatrixRuntimeException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigSource.Can_not_load_config_file_2",
dqpURL)); //$NON-NLS-1$
}
// Load the "dqp.properties" file.
@@ -95,12 +108,9 @@
// this path.
props.put(DQPEmbeddedProperties.DQP_BOOTSTRAP_PROPERTIES_FILE, dqpURL);
- // First configure logging..
- configureLogging(dqpURL);
-
useTxn = PropertiesUtils.getBooleanProperty(props,
EmbeddedTransactionService.TRANSACTIONS_ENABLED, true);
} catch (IOException e) {
- throw new ApplicationInitializationException(e);
+ throw new MetaMatrixRuntimeException(e);
}
}
@@ -124,44 +134,6 @@
return this.props;
}
- /**
- * Configure the logging for the DQP
- * @throws MetaMatrixComponentException
- * @since 4.3
- */
- void configureLogging(URL dqpURL) throws ApplicationInitializationException{
- boolean captureSystemStreams =
Boolean.valueOf(props.getProperty(DQPEmbeddedProperties.DQP_CAPTURE_SYSTEM_PRINTSTREAMS,
"false")).booleanValue(); //$NON-NLS-1$
- String logLevel = props.getProperty(DQPEmbeddedProperties.DQP_LOGLEVEL);
- String logFile = props.getProperty(DQPEmbeddedProperties.DQP_LOGFILE);
- String classpath = props.getProperty(DQPEmbeddedProperties.DQP_CLASSPATH);
- boolean unifiedClassLoader = !(classpath != null &&
classpath.length()>0);
- String instanceId = props.getProperty(DQPEmbeddedProperties.DQP_IDENTITY);
-
- try {
- // Configure Logging
- try {
- if (logFile != null &&
!logFile.equalsIgnoreCase(EmbeddedConfigUtil.STDOUT)) {
- String modifiedLogFileName = logFile;
- int dotIndex = logFile.lastIndexOf('.');
- if (dotIndex != -1) {
- modifiedLogFileName =
logFile.substring(0,dotIndex)+"_"+instanceId+"."+logFile.substring(dotIndex+1);
//$NON-NLS-1$ //$NON-NLS-2$
- }
- else {
- modifiedLogFileName = logFile+"_"+instanceId;
//$NON-NLS-1$
- }
- URL logURL = URLHelper.buildURL(dqpURL, modifiedLogFileName);
- logFile = logURL.getPath();
- }
- } catch (MalformedURLException e) {
- // we may have absolute source, this is just for notification to
somewhere.
- e.printStackTrace();
- }
- EmbeddedConfigUtil.configureLogger(logFile, logLevel, captureSystemStreams,
unifiedClassLoader);
- } catch (MetaMatrixComponentException e) {
- throw new ApplicationInitializationException(e);
- }
- }
-
@Override
public void updateBindings(Binder binder) {
Deleted: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigUtil.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigUtil.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigUtil.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,186 +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;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.log.LogConfiguration;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.log.config.BasicLogConfiguration;
-import com.metamatrix.core.log.FileLimitSizeLogWriter;
-import com.metamatrix.core.log.LogListener;
-import com.metamatrix.core.log.NullLogWriter;
-import com.metamatrix.core.log.SystemLogWriter;
-import com.metamatrix.internal.core.log.PlatformLog;
-
-/**
- * DQPConfigUtil
- */
-public class EmbeddedConfigUtil {
- static final String STDOUT = "STDOUT"; //$NON-NLS-1$
- private static Object lock = new Object();
- private static int count = 0;
-
- static {
- System.setProperty("shutdownHookInstalled",
String.valueOf(Boolean.TRUE)); //$NON-NLS-1$
- }
-
- private EmbeddedConfigUtil() {
- }
-
- /**
- * Set the log level to tehe specified level
- * @param logLevel the new log level
- * @throws MetaMatrixComponentException if the logLevel String cannot be parsed as an
integer
- * @since 4.3
- */
- public static void setLogLevel(String logLevel) throws MetaMatrixComponentException
{
- // Set up log level (default to none)
- int level = 0;
- if(logLevel != null && logLevel.trim().length() > 0) {
- try {
- level = Integer.parseInt(logLevel);
- } catch(NumberFormatException e) {
- throw new
MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("DQPComponent.Unable_to_parse_level")
+ logLevel); //$NON-NLS-1$
- }
- }
- LogConfiguration config = LogManager.getLogConfigurationCopy();
- config.setMessageLevel(level);
- LogManager.setLogConfiguration(config);
- LogManager.logInfo("DQP", "LogManager configured with level =
" + level); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Replaces the old set of discarded contexts with those provided.
- * @param contexts the new set of contexts to be discarded.
- * @since 4.3
- */
- public static void setDiscardedContexts(Collection contexts) {
- LogManager.setLogConfiguration(new BasicLogConfiguration(contexts,
LogManager.getLogConfigurationCopy().getMessageLevel()));
- LogManager.logInfo("DQP", "LogManager discarded contexts " +
contexts); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Installs a new log listener for the DQP, if a log listener of the same type does
not already exist.
- * @param newListener The LogListener to be installed
- * @throws MetaMatrixComponentException
- * @since 4.3
- */
- public static void installLogListener(LogListener newListener) throws
MetaMatrixComponentException {
- if (newListener == null) {
- // Make no changes to the current listeners
- return;
- }
-
- PlatformLog log = PlatformLog.getInstance();
- List listeners = new ArrayList(log.getLogListeners());
- if (listeners.size() == 1 &&
listeners.get(0).getClass().equals(newListener.getClass())) {
- // if the platform log writer is already established, dont do anything else
- return;
- }
-
- // remove all existing listeners from the platform logger - we will add one back
later if needed
- removeListeners(listeners);
-
- // Set up log listener
- log.addListener(newListener);
- }
-
- private static void removeListeners(List listeners) {
- // Walk through the listeners and remove them
- for(int i=0; i<listeners.size(); i++) {
- PlatformLog.getInstance().removeListener((LogListener)listeners.get(i));
- }
- }
-
- /**
- * Configures the PlatformLog to work correctly with the DQP. The
- * PlatformLog is configured to NOT log to System.out (as this is frowned upon
- * in a user's environment). If a logFile and logLevel are specified,
- * a file log is configured and LogManager is set up to pay attention to the
- * log level.
- *
- * @param logFile Log file name or null if no logging should occur
- * @param logLevel Log level or null for default level
- */
- public static void configureLogger(String logFile, String logLevel, boolean
captureSystemStreams, boolean useSingleLogger)
- throws MetaMatrixComponentException {
-
- PlatformLog log = PlatformLog.getInstance();
- List previousListeners = new ArrayList(log.getLogListeners());
- if (previousListeners.size() == 0 || !useSingleLogger) {
- if(logFile != null && logFile.trim().length() > 0) {
- if (logFile.equalsIgnoreCase(STDOUT)) {
- SystemLogWriter logWriter = new SystemLogWriter();
- installLogListener(logWriter);
- }
- else {
- File file = new File(logFile);
- FileLimitSizeLogWriter logWriter = new FileLimitSizeLogWriter(file,
captureSystemStreams);
- installLogListener(logWriter);
- }
- } else {
- // Pass a safe copy of listeners to be removed.
- removeListeners(previousListeners);
- NullLogWriter logNull = new NullLogWriter();
- installLogListener(logNull);
- }
-
- // now set the log level
- if(logLevel != null) {
- setLogLevel(logLevel);
- }else {
- setLogLevel("3"); //$NON-NLS-1$
- }
- }
- // Increment counter to keep count of number of DQPs which are using this
- // logger object. In the case of unifiedClassLoader we would like to have
- // single logger.
- synchronized(lock) {
- count++;
- }
- }
-
- /**
- *
- * @since 4.3
- */
- public static void shutdownLogger() {
- // decrement the counter and when it reaches zero then only shutdown the logger
- // becuase in the case of the unified class laoder we have only one logger and
we
- // would like to close at the end of last dqp shutdown.
- synchronized(lock) {
- count--;
- }
-
- if (count == 0) {
- PlatformLog.getInstance().shutdown(false);
- PlatformLog.getInstance().start();
- //LogManager.stop();
- }
- }
-}
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -62,12 +62,12 @@
import com.metamatrix.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.dqp.embedded.DQPEmbeddedManager;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.DataService;
import com.metamatrix.dqp.service.VDBService;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
import com.metamatrix.platform.util.ProductInfoConstants;
import com.metamatrix.server.serverapi.RequestInfo;
@@ -96,9 +96,9 @@
Cache.QUERY_SERVICE_RESULT_SET_CACHE
};
- DQPEmbeddedManager manager = null;
+ EmbeddedConnectionFactoryImpl manager = null;
- BaseAdmin(DQPEmbeddedManager manager){
+ BaseAdmin(EmbeddedConnectionFactoryImpl manager){
this.manager = manager;
}
@@ -135,20 +135,20 @@
* @return Returns the manager.
* @since 4.3
*/
- public DQPEmbeddedManager getManager() {
+ public EmbeddedConnectionFactoryImpl getManager() {
return this.manager;
}
VDBService getVDBService() {
- return
(VDBService)getManager().getDQP().getEnvironment().findService(DQPServiceNames.VDB_SERVICE);
+ return (VDBService)getManager().findService(DQPServiceNames.VDB_SERVICE);
}
DataService getDataService() {
- return
(DataService)getManager().getDQP().getEnvironment().findService(DQPServiceNames.DATA_SERVICE);
+ return (DataService)getManager().findService(DQPServiceNames.DATA_SERVICE);
}
ConfigurationService getConfigurationService() {
- return
(ConfigurationService)getManager().getDQP().getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE);
+ return
(ConfigurationService)getManager().findService(DQPServiceNames.CONFIGURATION_SERVICE);
}
protected Object convertToAdminObjects(Object src) {
@@ -511,9 +511,9 @@
*/
public SystemObject getSystem() {
MMSystem system = new MMSystem();
- system.setStartTime(new Date(manager.getDQPStartTime()));
- system.setStarted(manager.isDQPAlive());
- system.setProperties(manager.getDQPProperties());
+ system.setStartTime(new Date(manager.getStartTime()));
+ system.setStarted(manager.isAlive());
+ system.setProperties(manager.getProperties());
return system;
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -59,7 +59,6 @@
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.common.vdb.api.VDBDefn;
import com.metamatrix.core.vdb.VDBStatus;
-import com.metamatrix.dqp.embedded.DQPEmbeddedManager;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.dqp.embedded.configuration.ConnectorConfigurationReader;
@@ -67,6 +66,7 @@
import com.metamatrix.dqp.embedded.configuration.ServerConfigFileWriter;
import com.metamatrix.dqp.embedded.configuration.VDBConfigurationReader;
import com.metamatrix.dqp.service.ConfigurationService;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
/**
@@ -75,7 +75,7 @@
*/
public class DQPConfigAdminImpl extends BaseAdmin implements EmbeddedConfigAdmin {
- public DQPConfigAdminImpl(DQPEmbeddedManager manager) {
+ public DQPConfigAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -44,8 +44,8 @@
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.dqp.embedded.DQPEmbeddedManager;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
import com.metamatrix.server.serverapi.RequestInfo;
@@ -55,7 +55,7 @@
*/
public class DQPMonitoringAdminImpl extends BaseAdmin implements EmbeddedMonitoringAdmin
{
- public DQPMonitoringAdminImpl(DQPEmbeddedManager manager) {
+ public DQPMonitoringAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
}
@@ -328,7 +328,7 @@
switch(type) {
case MMAdminObject.OBJECT_TYPE_SYSTEM_OBJECT:
- Properties properties = manager.getDQPProperties();
+ Properties properties = manager.getProperties();
return convertPropertyDefinitions(properties);
case MMAdminObject.OBJECT_TYPE_CONNECTOR_BINDING:
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -22,6 +22,7 @@
package com.metamatrix.dqp.embedded.admin;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -40,10 +41,10 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.dqp.embedded.DQPEmbeddedManager;
+import com.metamatrix.common.log.LogManager;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.embedded.EmbeddedConfigUtil;
import com.metamatrix.dqp.message.RequestID;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
/**
@@ -51,7 +52,7 @@
*/
public class DQPRuntimeStateAdminImpl extends BaseAdmin implements
EmbeddedRuntimeStateAdmin {
- public DQPRuntimeStateAdminImpl(DQPEmbeddedManager manager) {
+ public DQPRuntimeStateAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
}
@@ -66,7 +67,7 @@
terminateSession(AdminObject.WILDCARD);
getManager().shutdown();
- } catch (ApplicationLifecycleException e) {
+ } catch (SQLException e) {
throw new AdminComponentException(e);
}
}
@@ -83,7 +84,7 @@
// Now shutdown the DQP, it will automatically start next timea new
connection is
// requested.
getManager().shutdown();
- } catch (ApplicationLifecycleException e) {
+ } catch (SQLException e) {
throw new AdminComponentException(e);
}
}
@@ -211,21 +212,17 @@
public void terminateSession(String identifier)
throws AdminException {
- if (identifier == null || (!identifier.equals(AdminObject.WILDCARD) &&
!identifier.matches("\\d+"))) { //$NON-NLS-1$
- throw new
AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier"));
//$NON-NLS-1$
- }
-
Set<ServerConnection> connections = getClientConnections();
ArrayList matchedConnections = new ArrayList();
- for (Iterator i = connections.iterator(); i.hasNext();) {
- ServerConnection clientConnection = (ServerConnection)i.next();
+
+ for (ServerConnection clientConnection:connections) {
String id = clientConnection.getLogonResult().getSessionID().toString();
if (matches(identifier, id)) {
matchedConnections.add(clientConnection);
}
}
- // Double iteration because to avoid concurrent modification of underlaying map.
+ // Double iteration because to avoid concurrent modification of underlying map.
for (Iterator i = matchedConnections.iterator(); i.hasNext();) {
ServerConnection clientConnection = (ServerConnection)i.next();
@@ -323,11 +320,7 @@
public void setLogListener(EmbeddedLogger listener)
throws AdminException {
if(listener != null) {
- try{
- EmbeddedConfigUtil.installLogListener(new DQPLogListener(listener));
- }catch(MetaMatrixComponentException e) {
- throw new AdminProcessingException(e);
- }
+ LogManager.setLogListener(new DQPLogListener(listener));
}
else {
throw new AdminProcessingException("Admin_invalid_log_listener");
//$NON-NLS-1$
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -23,7 +23,7 @@
package com.metamatrix.dqp.embedded.admin;
import com.metamatrix.admin.api.embedded.EmbeddedSecurityAdmin;
-import com.metamatrix.dqp.embedded.DQPEmbeddedManager;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
/**
@@ -31,7 +31,7 @@
*/
public class DQPSecurityAdminImpl extends BaseAdmin implements EmbeddedSecurityAdmin {
- public DQPSecurityAdminImpl(DQPEmbeddedManager manager) {
+ public DQPSecurityAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
}
}
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-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -43,6 +43,7 @@
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
@@ -60,7 +61,6 @@
import com.metamatrix.common.vdb.api.VDBDefn;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.vdb.VDBStatus;
-import com.metamatrix.dqp.application.ClientConnectionListener;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.dqp.embedded.configuration.ExtensionModuleReader;
@@ -278,14 +278,6 @@
}
/**
- * @see com.metamatrix.dqp.service.ConfigurationService#getResetSystemStreams()
- * @since 4.3
- */
- public String captureSystemStreams() throws MetaMatrixComponentException {
- return
userPreferences.getProperty(DQPEmbeddedProperties.DQP_CAPTURE_SYSTEM_PRINTSTREAMS);
- }
-
- /**
* @see com.metamatrix.dqp.service.ConfigurationService#getVDBs()
* @since 4.3
*/
@@ -1267,8 +1259,8 @@
* @see com.metamatrix.dqp.service.ConfigurationService#getConnectionListener()
* @since 4.3.2
*/
- public ClientConnectionListener getConnectionListener() throws
MetaMatrixComponentException {
- return new ClientConnectionListener() {
+ public ServerConnectionListener getConnectionListener() {
+ return new ServerConnectionListener() {
/**
* A Client Connection to DQP has been added
*/
@@ -1498,16 +1490,6 @@
return userPreferences.getProperty(DQPEmbeddedProperties.DQP_IDENTITY);
}
- /**
- * @see com.metamatrix.dqp.service.ConfigurationService#useUnifiedClassLoader()
- */
- public boolean useUnifiedClassLoader() {
- String val = userPreferences.getProperty(DQPEmbeddedProperties.DQP_CLASSPATH);
- if (val == null || val.length() == 0) {
- return true;
- }
- return false;
- }
public String getProcessorBatchSize() {
return
userPreferences.getProperty(DQPEmbeddedProperties.BufferService.DQP_PROCESSOR_BATCH_SIZE,
"2000"); //$NON-NLS-1$
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -35,7 +35,6 @@
import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.dqp.embedded.DQPEmbeddedManager;
import com.metamatrix.dqp.embedded.admin.DQPConfigAdminImpl;
import com.metamatrix.dqp.embedded.admin.DQPMonitoringAdminImpl;
import com.metamatrix.dqp.embedded.admin.DQPRuntimeStateAdminImpl;
@@ -55,26 +54,21 @@
// constant value giving product name
private final static String SERVER_NAME = "MetaMatrix Query";
//$NON-NLS-1$
- DQPEmbeddedManager manager = null;
+ EmbeddedConnectionFactoryImpl manager = null;
ConnectionListener listener = null;
- public static EmbeddedConnection newInstance(DQPEmbeddedManager manager,
ServerConnection serverConn, Properties info, ConnectionListener listner) {
- return new EmbeddedConnection(manager, serverConn, info, listner);
- }
-
/**
* ctor
*/
- public EmbeddedConnection(DQPEmbeddedManager manager,
- ServerConnection serverConn,
- Properties info,
- ConnectionListener listner) {
+ public EmbeddedConnection(EmbeddedConnectionFactoryImpl manager, ServerConnection
serverConn, Properties info, ConnectionListener listener) {
super(serverConn, info, null);
this.manager = manager;
- this.listener = listner;
+ this.listener = listener;
// tell the listener that connection has been created
- this.listener.connectionAdded(getConnectionId(), this);
+ if (listener != null) {
+ this.listener.connectionAdded(getConnectionId(), this);
+ }
}
/**
@@ -98,7 +92,7 @@
Exception ex = null;
// We we perform any DQP functions check if the DQP is still alive
- if (!manager.isDQPAlive()) {
+ if (!manager.isAlive()) {
throw new
AdminProcessingException(JDBCPlugin.Util.getString("EmbeddedConnection.DQP_shutDown"));
//$NON-NLS-1$
}
@@ -159,4 +153,12 @@
boolean isSameProcess(MMConnection conn) {
return (conn instanceof EmbeddedConnection);
}
+
+ @Override
+ public void close() throws SQLException {
+ if (this.listener != null) {
+ this.listener.connectionRemoved(getConnectionId(), this);
+ }
+ super.close();
+ }
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -23,9 +23,8 @@
package com.metamatrix.jdbc;
import java.sql.Connection;
-import java.sql.DriverManager;
import java.sql.SQLException;
-import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -34,15 +33,22 @@
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.application.ApplicationService;
+import com.metamatrix.common.application.DQPConfigSource;
+import com.metamatrix.common.application.exception.ApplicationInitializationException;
+import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.vdb.api.VDBArchive;
+import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.dqp.ResourceFinder;
-import com.metamatrix.dqp.application.ClientConnectionListener;
-import com.metamatrix.dqp.embedded.DQPListener;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.internal.process.DQPCore;
+import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.VDBService;
+import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.jdbc.transport.LocalTransportHandler;
@@ -55,46 +61,34 @@
private static final int ACTIVE = 3;
private boolean initialized = false;
private LocalTransportHandler handler = null;
- private boolean shutdownInProgress = false;
-
- // List of Connection Listeners for the DQP
- private ArrayList connectionListeners = new ArrayList();
-
+ private volatile boolean shutdownInProgress = false;
+ private DQPCore dqp;
+ private long starttime = -1L;
+ private Thread shutdownThread;
+
private EmbeddedConnectionListener listener = new EmbeddedConnectionListener();
- /**
- * Factory Constructor
- */
- static EmbeddedConnectionFactoryImpl newInstance() {
- return new EmbeddedConnectionFactoryImpl();
- }
-
/**
* @see com.metamatrix.jdbc.EmbeddedConnectionFactory#createConnection()
*/
public Connection createConnection(Properties props) throws SQLException {
- Injector injector = Guice.createInjector(new EmbeddedGuiceModule());
- ResourceFinder.setInjector(injector);
-
- // Initialize the transport
- initialize(props);
- try {
- // create a server connection. If the VDB_VERSION used as
"UseLatest" the client
- // connection is based on String "UseLatest"
- this.handler.initManager(props);
- // check for the valid connection properties
+ try {
+ // Initialize the transport
+ initialize(props);
+
+ // check for the valid connection properties
checkConnectionProperties (props);
ServerConnection serverConn = this.handler.createConnection(props);
- // Should occur every time in classloader using existing attributes
- return EmbeddedConnection.newInstance(this.handler.getManager(), serverConn,
props, listener);
+ // Should occur every time in class loader using existing attributes
+ return new EmbeddedConnection(this, serverConn, props, listener);
} catch (ConnectionException e) {
throw new EmbeddedSQLException(e);
- } catch (CommunicationException e) {
- throw new EmbeddedSQLException(e);
- }
+ } catch (ApplicationInitializationException e) {
+ throw new EmbeddedSQLException(e);
+ }
}
/**
@@ -106,40 +100,72 @@
* @throws SQLException
* @since 4.3
*/
- private void initialize(Properties props) throws SQLException {
- if (!initialized || !this.handler.isAlive()) {
+ private synchronized void initialize(Properties props) throws
ApplicationInitializationException {
+ if (!initialized) {
- // This monitors the life cycle events for the DQP
- DQPListener dqpListener = new DQPListener() {
- public void onStart() {
- }
- public void onShutdown() {
- try {
- shutdown();
- }catch (SQLException e) {
- DriverManager.println(e.getMessage());
- }
- }
- };
+ Injector injector = Guice.createInjector(new EmbeddedGuiceModule(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 monitors the lifecyle events for the connections inside a DQP
- // these are DQP side connections.
- ClientConnectionListener connectionListener = new ClientConnectionListener()
{
- public void connectionAdded(ServerConnection connection) {
- }
- public void connectionRemoved(ServerConnection connection) {
-
listener.connectionTerminated(connection.getLogonResult().getSessionID().toString());
- }
- };
-
- //in new classloader - all of these should be created lazily and held
locally
- this.handler = new LocalTransportHandler(dqpListener, connectionListener);
- this.initialized = true;
+ this.initialized = true;
+ this.starttime = System.currentTimeMillis();
+ DQPEmbeddedPlugin.logInfo("DQPEmbeddedManager.start_dqp", new
Object[] {new Date(System.currentTimeMillis()).toString()}); //$NON-NLS-1$
}
}
+
+ class ShutdownWork extends Thread {
+ ShutdownWork(){
+ super("embedded-shudown-thread"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ try {
+ shutdown(false);
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ }
+
+ public synchronized boolean isAlive() {
+ return (dqp != null);
+ }
+
+ public long getStartTime() {
+ return this.starttime;
+ }
+
+ public Properties getProperties() {
+ if (isAlive()) {
+ return
((ConfigurationService)findService(DQPServiceNames.CONFIGURATION_SERVICE)).getSystemProperties();
+ }
+ return null;
+ }
- public void registerConnectionListener(ConnectionListener listener) {
- connectionListeners.add(listener);
+ public synchronized DQPCore getDQP() {
+ if (!isAlive()) {
+ throw new
MetaMatrixRuntimeException(JDBCPlugin.Util.getString("LocalTransportHandler.Transport_shutdown"));
//$NON-NLS-1$
+ }
+ return this.dqp;
+ }
+
+ public ApplicationService findService(String type) {
+ return this.dqp.getEnvironment().findService(type);
}
/**
@@ -149,11 +175,20 @@
*
* @see com.metamatrix.jdbc.EmbeddedConnectionFactory#shutdown()
*/
- public void shutdown() throws SQLException{
+ public void shutdown() throws SQLException {
+ shutdown(true);
+ }
+
+ private void shutdown(boolean undoShutdownHook) throws SQLException {
+
+ if (undoShutdownHook) {
+ Runtime.getRuntime().removeShutdownHook(this.shutdownThread);
+ }
+
// 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 (!shutdownInProgress) {
+ if (!this.shutdownInProgress && this.initialized) {
// this will by pass, and only let shutdown called once.
shutdownInProgress = true;
@@ -162,14 +197,25 @@
// connections are not properly closed; or somebody called shutdown.
listener.closeConnections();
- // then close the dqp handler it self, which root for the factory.
- this.handler.shutdown();
+ try {
+ this.dqp.stop();
+ } catch (ApplicationLifecycleException e) {
+ LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage());
+ }
+ this.dqp = null;
+
+ this.handler = null;
+
+ this.initialized = false;
+
// shutdown the cache.
ResourceFinder.getCacheFactory().destroy();
- }
+
+ shutdownInProgress = false;
+ }
}
-
+
/**
* Are the connection properties supplied for connection match with those of the
* DQP
@@ -182,7 +228,7 @@
String vdbVersion = props.getProperty(BaseDataSource.VDB_VERSION,
EmbeddedDataSource.USE_LATEST_VDB_VERSION);
try {
- VDBService service =
(VDBService)handler.getManager().getDQP().getEnvironment().findService(DQPServiceNames.VDB_SERVICE);
+ VDBService service = (VDBService)findService(DQPServiceNames.VDB_SERVICE);
List<VDBArchive> vdbs = service.getAvailableVDBs();
// We are looking for the latest version find that now
@@ -226,29 +272,6 @@
}
/**
- * Notify all the connection listeners that a connection is added
- * @param connection
- */
- void notifyConnectionAdded(String id, Connection connection) {
- for (Iterator i = connectionListeners.iterator(); i.hasNext();) {
- ConnectionListener listner = (ConnectionListener)i.next();
- listner.connectionAdded(id, connection);
- }
- }
-
- /**
- * Notify all the connection listeners that a connection is added
- * @param connection
- */
- void notifyConnectionRemoved(String id, Connection connection) {
- for (Iterator i = connectionListeners.iterator(); i.hasNext();) {
- ConnectionListener listner = (ConnectionListener)i.next();
- listner.connectionRemoved(id, connection);
- }
- }
-
-
- /**
* A internal connection listener for the connections; based on this
* it manages the DQP instance. These are client side (JDBC) connections
*/
@@ -260,17 +283,11 @@
public void connectionAdded(String id, Connection connection) {
// Add the connection to locol count
connections.put(id, connection);
-
- // then also notify all the listeners
- notifyConnectionAdded(id, connection);
}
public void connectionRemoved(String id, Connection connection) {
// remove from local count
connections.remove(id);
-
- // also notify all the listeners
- notifyConnectionRemoved(id, connection);
}
/**
@@ -300,18 +317,6 @@
if (firstException != null) {
throw new EmbeddedSQLException(firstException);
}
- }
-
- /**
- * A hook which notifies the client connections that a server connection
- * has been terminated
- * @param connection
- */
- private void connectionTerminated(String id) {
- // remove from local count
- Connection connection = (Connection)connections.remove(id);
-
- notifyConnectionRemoved(id, connection);
- }
+ }
}
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,23 +1,64 @@
+/*
+ * 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.jdbc;
+import java.util.Properties;
+
import org.jboss.cache.Cache;
import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import com.metamatrix.cache.CacheFactory;
import com.metamatrix.cache.jboss.JBossCacheFactory;
+import com.metamatrix.common.application.DQPConfigSource;
+import com.metamatrix.common.log.LogConfiguration;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.core.log.LogListener;
+import com.metamatrix.dqp.embedded.EmbeddedConfigSource;
public class EmbeddedGuiceModule extends AbstractModule {
-
+
+ private Properties props;
+
+ public EmbeddedGuiceModule(Properties props) {
+ 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);
+ bind(DQPConfigSource.class).toInstance(new EmbeddedConfigSource(this.props));
- // currently this is setup in embedded buffer service - needs to move in here.
- //bind(BufferManager.class).toProvider(BufferManagerProvider.class).in(Scopes.SINGLETON);
+ 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);
}
+
}
Added: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
(rev 0)
+++
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -0,0 +1,54 @@
+/*
+ * 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.jdbc;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.metamatrix.common.application.DQPConfigSource;
+import com.metamatrix.common.log.LogConfiguration;
+import com.metamatrix.common.log.config.BasicLogConfiguration;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+
+@Singleton
+class LogConfigurationProvider implements Provider<LogConfiguration> {
+
+ @Inject
+ DQPConfigSource configSource;
+
+ @Override
+ public LogConfiguration get() {
+ String logLevel =
configSource.getProperties().getProperty(DQPEmbeddedProperties.DQP_LOGLEVEL);
+ int level = 0;
+ if(logLevel != null && logLevel.trim().length() > 0) {
+ try {
+ level = Integer.parseInt(logLevel);
+ } catch(NumberFormatException e) {
+ throw new
MetaMatrixRuntimeException(DQPEmbeddedPlugin.Util.getString("DQPComponent.Unable_to_parse_level")
+ logLevel); //$NON-NLS-1$
+ }
+ }
+ return new BasicLogConfiguration(level);
+ }
+
+}
Property changes on:
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
(rev 0)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -0,0 +1,89 @@
+/*
+ * 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.jdbc;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.metamatrix.common.application.DQPConfigSource;
+import com.metamatrix.common.protocol.URLHelper;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.log.FileLimitSizeLogWriter;
+import com.metamatrix.core.log.LogListener;
+import com.metamatrix.core.log.NullLogWriter;
+import com.metamatrix.core.log.SystemLogWriter;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+import com.metamatrix.internal.core.log.PlatformLog;
+
+@Singleton
+class LogListernerProvider implements Provider<LogListener> {
+ private static final String STDOUT = "STDOUT"; //$NON-NLS-1$
+
+ @Inject
+ DQPConfigSource configSource;
+
+ @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$
+
+ // Configure Logging
+ try {
+ String dqpURLString = dqpURL.toString();
+ dqpURL = URLHelper.buildURL(dqpURLString);
+ if (logFile != null) {
+ if (logFile.equalsIgnoreCase(STDOUT)) {
+ PlatformLog log = new PlatformLog();
+ log.addListener(new SystemLogWriter());
+ return log;
+ }
+ else {
+ String modifiedLogFileName = logFile;
+ int dotIndex = logFile.lastIndexOf('.');
+ if (dotIndex != -1) {
+ modifiedLogFileName =
logFile.substring(0,dotIndex)+"_"+instanceId+"."+logFile.substring(dotIndex+1);
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ else {
+ modifiedLogFileName = logFile+"_"+instanceId;
//$NON-NLS-1$
+ }
+ URL logURL = URLHelper.buildURL(dqpURL, modifiedLogFileName);
+ File file = new File(logURL.getPath());
+ PlatformLog log = new PlatformLog();
+ log.addListener(new FileLimitSizeLogWriter(file));
+ return log;
+ }
+ }
+ else {
+ return new NullLogWriter();
+ }
+ } catch (MalformedURLException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ }
+
+}
Property changes on:
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalServerConnection.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalServerConnection.java
(rev 0)
+++
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalServerConnection.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -0,0 +1,108 @@
+/*
+ * 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.jdbc.transport;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.client.ExceptionUtil;
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.api.ServerConnectionListener;
+import com.metamatrix.dqp.client.ClientSideDQP;
+import com.metamatrix.dqp.internal.process.DQPWorkContext;
+import com.metamatrix.jdbc.JDBCPlugin;
+import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.MetaMatrixSessionID;
+
+public class LocalServerConnection implements ServerConnection {
+
+ private final LogonResult result;
+ private boolean shutdown;
+ private DQPWorkContext workContext;
+ private ClientSideDQP dqp;
+ private ServerConnectionListener listener;
+
+ public LocalServerConnection(MetaMatrixSessionID sessionId, Properties
connectionProperties, ClientSideDQP dqp, ServerConnectionListener listener) {
+ result = new LogonResult(sessionId,
connectionProperties.getProperty(MMURL.CONNECTION.USER_NAME), connectionProperties, -1,
"local"); //$NON-NLS-1$
+
+ //Initialize the workContext
+ workContext = new DQPWorkContext();
+ workContext.setSessionId(result.getSessionID());
+ workContext.setVdbName(connectionProperties.getProperty(MMURL.JDBC.VDB_NAME));
+ workContext.setVdbVersion(connectionProperties.getProperty(MMURL.JDBC.VDB_VERSION));
+ DQPWorkContext.setWorkContext(workContext);
+
+ this.dqp = dqp;
+ this.listener = listener;
+
+ if (this.listener != null) {
+ this.listener.connectionAdded(this);
+ }
+ }
+
+ public <T> T getService(Class<T> iface) {
+ if (iface != ClientSideDQP.class) {
+ throw new IllegalArgumentException("unknown service"); //$NON-NLS-1$
+ }
+ return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new
Class[] {ClientSideDQP.class}, new InvocationHandler() {
+
+ public Object invoke(Object arg0, Method arg1, Object[] arg2)
+ throws Throwable {
+
+ if (!isOpen()) {
+ throw ExceptionUtil.convertException(arg1, new
MetaMatrixComponentException(JDBCPlugin.Util.getString("LocalTransportHandler.session_inactive")));
//$NON-NLS-1$
+ }
+
+ DQPWorkContext.setWorkContext(workContext);
+ try {
+ return arg1.invoke(dqp, arg2);
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+ });
+ }
+
+ public boolean isOpen() {
+ return !shutdown;
+ }
+
+ public void shutdown() {
+ if (shutdown) {
+ return;
+ }
+ if (this.listener != null) {
+ this.listener.connectionRemoved(this);
+ }
+ this.shutdown = true;
+ }
+
+ public LogonResult getLogonResult() {
+ return result;
+ }
+}
Property changes on:
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalServerConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalTransportHandler.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalTransportHandler.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalTransportHandler.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -22,204 +22,54 @@
package com.metamatrix.jdbc.transport;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.net.URL;
+import java.util.ArrayList;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicLong;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.client.ExceptionUtil;
-import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.api.ServerConnectionFactory;
-import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.dqp.application.ClientConnectionListener;
import com.metamatrix.dqp.client.ClientSideDQP;
-import com.metamatrix.dqp.embedded.DQPEmbeddedManager;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.embedded.DQPListener;
-import com.metamatrix.dqp.internal.process.DQPWorkContext;
-import com.metamatrix.dqp.service.ConfigurationService;
-import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.jdbc.EmbeddedDataSource;
-import com.metamatrix.jdbc.JDBCPlugin;
-import com.metamatrix.platform.security.api.LogonResult;
import com.metamatrix.platform.security.api.MetaMatrixSessionID;
public class LocalTransportHandler implements ServerConnectionFactory {
-
- private final class LocalServerConnection implements ServerConnection {
- private final LogonResult result;
- private boolean shutdown;
- private DQPWorkContext workContext;
-
- private LocalServerConnection(Properties connectionProperties) {
- result = new LogonResult(new MetaMatrixSessionID(SESSION_ID
- .getAndIncrement()), connectionProperties
- .getProperty(MMURL.CONNECTION.USER_NAME), connectionProperties, -1,
"local"); //$NON-NLS-1$
-
- //Initialize the workContext
- workContext = new DQPWorkContext();
- workContext.setSessionId(result.getSessionID());
- workContext.setVdbName(connectionProperties.getProperty(MMURL.JDBC.VDB_NAME));
- workContext.setVdbVersion(connectionProperties.getProperty(MMURL.JDBC.VDB_VERSION));
- DQPWorkContext.setWorkContext(workContext);
- if (configurationConnectionListener != null) {
- configurationConnectionListener.connectionAdded(this);
- }
- }
-
- public <T> T getService(Class<T> iface) {
- if (iface != ClientSideDQP.class) {
- throw new IllegalArgumentException("unknown service"); //$NON-NLS-1$
- }
- final ClientSideDQP dqp = getManager().getDQP();
- return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new
Class[] {ClientSideDQP.class}, new InvocationHandler() {
-
- public Object invoke(Object arg0, Method arg1, Object[] arg2)
- throws Throwable {
-
- if (!isOpen()) {
- throw ExceptionUtil.convertException(arg1, new
MetaMatrixComponentException(JDBCPlugin.Util.getString("LocalTransportHandler.session_inactive")));
//$NON-NLS-1$
- }
-
- DQPWorkContext.setWorkContext(workContext);
- try {
- return arg1.invoke(dqp, arg2);
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
- });
- }
-
- public boolean isOpen() {
- return !shutdown && isAlive();
- }
-
- public void shutdown() {
- if (shutdown) {
- return;
- }
- if (configurationConnectionListener != null) {
- configurationConnectionListener.connectionRemoved(this);
- }
- if (connectionListener != null) {
- connectionListener.connectionRemoved(this);
- }
- this.shutdown = true;
- }
-
- public LogonResult getLogonResult() {
- return result;
- }
- }
-
- private static final String SERVER_CONFIG_FILE_EXTENSION = ".properties";
//$NON-NLS-1$
private AtomicLong SESSION_ID = new AtomicLong(1);
- private ClientConnectionListener configurationConnectionListener;
- private DQPEmbeddedManager dqpManager;
- private DQPListener dqpListener = null;
- private ClientConnectionListener connectionListener = null;
+ private ConnectionListenerList listenerList = new ConnectionListenerList();
+ private ClientSideDQP dqp;
- // Keeps track of whether this transport has been shutdown.
- // After it is shutdown connections may still have a reference to it.
- private boolean alive = true;
-
- public LocalTransportHandler() {
- this(null,null);
- }
-
/**
* Default constructor - used by reflection to create a new instance.
*/
- public LocalTransportHandler(DQPListener dqpListener, ClientConnectionListener
connListener) {
- this.dqpListener = dqpListener;
- this.connectionListener = connListener;
+ public LocalTransportHandler(ClientSideDQP dqp) throws
ApplicationInitializationException {
+ this.dqp = dqp;
}
- public synchronized boolean isAlive() {
- return alive && (dqpManager != null && dqpManager.isDQPAlive());
- }
-
- private void checkAlive() {
- if (!isAlive()) {
- throw new
MetaMatrixRuntimeException(JDBCPlugin.Util.getString("LocalTransportHandler.Transport_shutdown"));
//$NON-NLS-1$
- }
- }
-
- private synchronized void initManager(URL dqpURL, Properties connProperties) throws
ApplicationInitializationException {
- if(dqpManager != null) {
- return;
- }
-
- if(dqpURL == null) {
- throw new
ApplicationInitializationException(JDBCPlugin.Util.getString("LocalTransportHandler.No_configuration_file_set_in_property",
DQPEmbeddedProperties.DQP_BOOTSTRAP_PROPERTIES_FILE)); //$NON-NLS-1$
- }
+ public ServerConnection createConnection(final Properties connectionProperties) throws
ConnectionException {
+ return new LocalServerConnection(new
MetaMatrixSessionID(SESSION_ID.getAndIncrement()), connectionProperties, dqp,
listenerList);
+ }
- String dqpFileName = dqpURL.toString().toLowerCase();
- if (!dqpFileName.endsWith(SERVER_CONFIG_FILE_EXTENSION)) {
- throw new
ApplicationInitializationException(JDBCPlugin.Util.getString("LocalTransportHandler.Invalid_config_file_extension",
dqpFileName) ); //$NON-NLS-1$
- }
-
- dqpManager = new DQPEmbeddedManager(dqpURL, connProperties, this.dqpListener);
- dqpManager.createDQP();
- ConfigurationService configService =
(ConfigurationService)dqpManager.getDQP().getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE);
- if (configService != null) {
- try {
- configurationConnectionListener = configService.getConnectionListener();
- }catch(MetaMatrixComponentException e) {
- configurationConnectionListener = null;
- }
- }
- }
+ public synchronized void registerListener(ServerConnectionListener listener) {
+ this.listenerList.add(listener);
+ }
+
+
+ private final class ConnectionListenerList extends
ArrayList<ServerConnectionListener> implements ServerConnectionListener{
- /**
- * @see com.metamatrix.jdbc.transport.TransportHandler#shutdown()
- */
- public synchronized void shutdown() {
- alive = false;
- if (dqpManager != null) {
- try {
- dqpManager.shutdown();
- } catch (ApplicationLifecycleException e) {
- // TODO ignore?
- }
- dqpManager = null;
- }
- }
-
- public synchronized DQPEmbeddedManager getManager() {
- checkAlive();
- return dqpManager;
- }
-
- synchronized void setManager(DQPEmbeddedManager manager) {
- dqpManager = manager;
- }
+ @Override
+ public void connectionAdded(ServerConnection connection) {
+ for (ServerConnectionListener l: this) {
+ l.connectionAdded(connection);
+ }
+ }
- public ServerConnection createConnection(final Properties connectionProperties) throws
CommunicationException,
- ConnectionException {
- initManager(connectionProperties);
-
- return new LocalServerConnection(connectionProperties);
+ @Override
+ public void connectionRemoved(ServerConnection connection) {
+ for (ServerConnectionListener l: this) {
+ l.connectionRemoved(connection);
+ }
+ }
}
-
- public void initManager(final Properties connectionProperties)
- throws ConnectionException {
- try {
- URL dqpURL =
(URL)connectionProperties.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE);
- initManager(dqpURL, connectionProperties);
- } catch(ApplicationInitializationException e) {
- throw new ConnectionException(e);
- }
- }
}
Copied: trunk/embedded/src/main/resources/deploy.properties (from rev 466,
trunk/embedded/src/main/resources/mm.properties)
===================================================================
--- trunk/embedded/src/main/resources/deploy.properties (rev 0)
+++ trunk/embedded/src/main/resources/deploy.properties 2009-02-21 00:28:43 UTC (rev 479)
@@ -0,0 +1,6 @@
+#default properties file for Teiid Embedded
+mm.io.tmpdir=${user.dir}/teiid-workspace/temp
+dqp.extensions=mmfile://${user.dir}/teiid-workspace/extensions
+dqp.logFile=mmfile://${user.dir}/teiid-workspace/teiid-embedded.log
+dqp.logLevel=2
+metamatrix.xatxnmgr.txnstore_dir=${user.dir}/teiid-workspace
\ No newline at end of file
Property changes on: trunk/embedded/src/main/resources/deploy.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/embedded/src/main/resources/jboss-cache-configuration.xml
===================================================================
--- trunk/embedded/src/main/resources/jboss-cache-configuration.xml
(rev 0)
+++ trunk/embedded/src/main/resources/jboss-cache-configuration.xml 2009-02-21 00:28:43
UTC (rev 479)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.cache.pojo.jmx.CacheJmxWrapper"
name="jboss.cache:service=FederateCache">
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup</attribute>
+ <attribute name="IsolationLevel">READ_COMMITTED</attribute>
+ <attribute
name="LockParentForChildInsertRemove">true</attribute>
+
+ <attribute name="CacheMode">LOCAL</attribute>
+ <attribute name="UseLazyDeserialization">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Shutdown hook behavior. Valid choices are: DEFAULT, REGISTER and
DONT_REGISTER. this element is omitted, DEFAULT is used. -->
+ <attribute name="ShutdownHookBehavior">DEFAULT</attribute>
+
+ <attribute name="FetchInMemoryState">true</attribute>
+
+ <attribute name="CacheLoaderConfig" replace="false">
+ <config>
+
+ <!-- are the cache loaders shared in a cluster? -->
+ <shared>false</shared>
+ <!-- if passivation is true, only the first cache loader is used; the rest
are ignored -->
+ <passivation>true</passivation>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <properties>location=./teiid/cache</properties>
+
+ <!--fetch the persistent state of a cache when joining a
cluster-->
+ <fetchPersistentState>true</fetchPersistentState>
+
+ <!-- empties the specified cache loader when cache loader starts up
-->
+ <purgeOnStartup>true</purgeOnStartup>
+
+ <!-- cache loader is shared among different cache instances -->
+ <shared>false</shared>
+ </cacheloader>
+ </config>
+ </attribute>
+
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">3</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">100000</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute
name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ </mbean>
+</server>
\ No newline at end of file
Property changes on: trunk/embedded/src/main/resources/jboss-cache-configuration.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/embedded/src/main/resources/mm.properties
===================================================================
--- trunk/embedded/src/main/resources/mm.properties 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/embedded/src/main/resources/mm.properties 2009-02-21 00:28:43 UTC (rev 479)
@@ -1,6 +0,0 @@
-#default properties file for Federate Embedded
-mm.io.tmpdir=${user.dir}/federate-workspace/temp
-dqp.extensions=mmfile://${user.dir}/federate-workspace/extensions
-dqp.logFile=mmfile://${user.dir}/federate-workspace/federate-embedded.log
-dqp.logLevel=2
-metamatrix.xatxnmgr.txnstore_dir=${user.dir}/federate-workspace
\ No newline at end of file
Modified:
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -24,6 +24,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Properties;
import junit.framework.TestCase;
@@ -33,6 +34,7 @@
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 {
@@ -45,7 +47,10 @@
}
public void testServiceLoading() throws Exception {
- EmbeddedConfigSource source = new
EmbeddedConfigSource(buildDQPUrl(UnitTestUtil.getTestDataPath() +
"/bqt/fakebqt.properties"), null);//$NON-NLS-1$
+ Properties p = new Properties();
+ p.put(EmbeddedDataSource.DQP_BOOTSTRAP_FILE,
buildDQPUrl(UnitTestUtil.getTestDataPath() + "/bqt/fakebqt.properties"));
//$NON-NLS-1$
+
+ EmbeddedConfigSource source = new EmbeddedConfigSource(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-02-20
21:08:28 UTC (rev 478)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -73,19 +73,19 @@
}
public void testUseExtensionPath() throws Exception {
- service.userPreferences = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ service.userPreferences = EmbeddedTestUtil.getProperties();
assertTrue(service.useExtensionClasspath());
}
public void testUseExtensionPathFalse() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
p.remove("dqp.extensions"); //$NON-NLS-1$
service.userPreferences = p;
assertFalse(service.useExtensionClasspath());
}
public void testGetAvailableVDBFiles() throws Exception {
- service.userPreferences = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ service.userPreferences = EmbeddedTestUtil.getProperties();
HashMap vdbFiles = VDBConfigurationReader.loadVDBS(service.getVDBLocations());
int count = vdbFiles.keySet().size();
assertEquals(2, count);
@@ -100,7 +100,7 @@
}
public void testGetConfigFileURL() throws Exception {
- service.userPreferences = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ service.userPreferences = EmbeddedTestUtil.getProperties();
assertTrue(service.getConfigFile().toString().endsWith("dqp/config/ServerConfig.xml"));
//$NON-NLS-1$
}
@@ -108,7 +108,7 @@
BasicConnectorBinding binding = 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$
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(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.loadedConnectorBindings.put("foo", alternatebinding);
//$NON-NLS-1$
@@ -117,7 +117,7 @@
}
public void defer_testInitializeEncryption() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
p.setProperty(DQPEmbeddedProperties.DQP_KEYSTORE, "Cluster.key");
//$NON-NLS-1$
service.userPreferences = p;
service.initializeEncryption();
@@ -125,20 +125,20 @@
}
public void testGetDefaultExtensionPath() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
p.remove(DQPEmbeddedProperties.DQP_EXTENSIONS);
service.userPreferences = p;
assertTrue(service.getDefaultExtensionPath().toString().endsWith("dqp/extensions/"));
//$NON-NLS-1$
}
public void testGetDirectoryToStoreVDBS() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
assertTrue(service.getVDBSaveLocation().toString().endsWith("dqp/config/"));
//$NON-NLS-1$
}
public void testGetDirectoryToStoreVDBSByVDBName() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
p.setProperty(DQPEmbeddedProperties.VDB_DEFINITION,
"./config/QT_Ora9DS.vdb"); //$NON-NLS-1$
service.userPreferences = p;
service.initializeService(p);
@@ -150,7 +150,7 @@
}
public void testGetFileToSaveNewFile() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
p.setProperty(DQPEmbeddedProperties.VDB_DEFINITION,
"./config/QT_Ora9DS.vdb"); //$NON-NLS-1$
service.initializeService(p);
@@ -163,7 +163,7 @@
}
public void testGetFileAlreadyExisting() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -174,7 +174,7 @@
}
public void testGetFullyQualifiedPath() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = 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$
@@ -187,14 +187,14 @@
}
public void testGetNextVdbVersion() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
assertEquals(2, service.getNextVdbVersion("QT_Ora9DS")); //$NON-NLS-1$
}
public void testDeleteInUseConnectorBinding() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
try {
@@ -206,7 +206,7 @@
}
public void testDeleteNonExistingConnectorBinding() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
try {
@@ -218,7 +218,7 @@
}
public void testDeleteConnectorBinding() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -234,7 +234,7 @@
public void testDeleteConnectorType() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -255,7 +255,7 @@
}
public void testDeleteConnectorTypeInUse() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -270,7 +270,7 @@
}
public void testDeleteVDB() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -283,7 +283,7 @@
}
public void testGetLogFile() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ 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;
@@ -293,7 +293,7 @@
}
public void testGetSystemProperties() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -304,17 +304,8 @@
assertEquals("20000", sp.getProperty("MaxFetchSize"));
//$NON-NLS-1$ //$NON-NLS-2$
}
- public void testGetResetSystemPrintStreams() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
- p.setProperty(DQPEmbeddedProperties.DQP_CAPTURE_SYSTEM_PRINTSTREAMS,
"true"); //$NON-NLS-1$
- service.userPreferences = p;
- service.initializeService(p);
-
- assertTrue(Boolean.valueOf(service.captureSystemStreams()).booleanValue());
- }
-
public void testGetSystemConfiguration() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
assertNull(service.configurationModel);
@@ -323,28 +314,28 @@
}
public void testGetSystemVDB() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
assertNotNull(service.getSystemVdb());
}
public void testGetUDFFileName() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
p.setProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS,
"./lib/foo.txt"); //$NON-NLS-1$
service.userPreferences = p;
assertTrue(service.getUDFFile().toString().endsWith(UnitTestUtil.getTestScratchPath()+"/dqp/lib/foo.txt"));
//$NON-NLS-1$
}
public void testGetVDBs() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
assertTrue(service.getVDBs().size() == 2);
}
public void testSaveConnectorBinding() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -375,7 +366,7 @@
public void testSaveConnectorType() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -400,7 +391,7 @@
public void testSaveVDB() throws Exception{
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -413,7 +404,7 @@
}
public void testGetProcessorBatchSize() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -421,7 +412,7 @@
}
public void testGetConnectorBatchSize() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -429,7 +420,7 @@
}
public void testLoadedConnectorBindings() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -451,7 +442,7 @@
}
public void testAddConnectorBinding() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
@@ -463,7 +454,7 @@
}
public void testGetConnectorTypes() throws Exception {
- Properties p = EmbeddedTestUtil.getProperties(); //$NON-NLS-1$;
+ Properties p = EmbeddedTestUtil.getProperties();
service.userPreferences = p;
service.initializeService(p);
Modified: trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -50,105 +50,105 @@
*/
public void testAcceptsURL() throws SQLException {
// Windows Path
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties;version=1"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties;version=1"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
//$NON-NLS-1$
// Alternative windows path
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:/metamatrix/dqp/dqp.properties"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:/metamatrix/dqp/dqp.properties;version=1"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:/metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:/metamatrix/dqp/dqp.properties"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:/metamatrix/dqp/dqp.properties;version=1"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@c:/metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
//$NON-NLS-1$
// Abosolute path (Unix or windows)
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=1"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=1"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
//$NON-NLS-1$
// relative path
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@../../metamatrix/dqp/dqp.properties"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@../../metamatrix/dqp/dqp.properties;version=1"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@../../metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@../../metamatrix/dqp/dqp.properties"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@../../metamatrix/dqp/dqp.properties;version=1"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@../../metamatrix/dqp/dqp.properties;version=1;txnAutoWrap=ON;partialResultsMode=YES"));
//$NON-NLS-1$
// File URL should be supported (not sure)
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@file:///c:/metamatrix/dqp/dqp.properties"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@testdata/dqp/dqp.properties;partialResultsMode=true"));
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@file:///c:/metamatrix/dqp/dqp.properties"));
//$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@testdata/dqp/dqp.properties;partialResultsMode=true"));
//$NON-NLS-1$
// ClassPath based URL
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@classpath:/dqp.properties;partialResultsMode=true"));
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT@classpath:/dqp.properties;partialResultsMode=true"));
//$NON-NLS-1$
// These are specific to the MMDriver and should not be suported
-
assertFalse(driver.acceptsURL("jdbc:metamatrix:BQT@mm://host:7001;version=1"));
-
assertFalse(driver.acceptsURL("jdbc:metamatrix:BQT@mms://host:7001;version=1"));
+
assertFalse(driver.acceptsURL("jdbc:metamatrix:BQT@mm://host:7001;version=1"));
//$NON-NLS-1$
+
assertFalse(driver.acceptsURL("jdbc:metamatrix:BQT@mms://host:7001;version=1"));
//$NON-NLS-1$
//assertFalse(driver.acceptsURL("jdbc:metamatrix:BQT@http://host:7001;version=1"));
- assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT"));
-
assertFalse(driver.acceptsURL("jdbc:metamatrix:BQT!/path/foo.properties"));
- assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT;"));
-
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT;version=1;logFile=foo.txt"));
+ assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT")); //$NON-NLS-1$
+
assertFalse(driver.acceptsURL("jdbc:metamatrix:BQT!/path/foo.properties"));
//$NON-NLS-1$
+ assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT;")); //$NON-NLS-1$
+
assertTrue(driver.acceptsURL("jdbc:metamatrix:BQT;version=1;logFile=foo.txt"));
//$NON-NLS-1$
}
public void testParseURL() throws SQLException{
Properties p = new Properties();
-
driver.parseURL("jdbc:metamatrix:BQT@c:\\metamatrix\\dqp\\dqp.properties", p);
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("mmfile:/c:/metamatrix/dqp/dqp.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(2, p.size());
}
public void testParseURL2() throws SQLException {
Properties p = new Properties();
-
driver.parseURL("jdbc:metamatrix:BQT@\\metamatrix\\dqp\\dqp.properties;version=3",
p);
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("mmfile:/metamatrix/dqp/dqp.properties"));
- assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3"));
- assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3"));
+
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$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3"));
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3"));
//$NON-NLS-1$
assertEquals(4, p.size());
}
public void testParseURL3() throws SQLException{
Properties p = new Properties();
-
driver.parseURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=4;txnAutoWrap=ON;partialResultsMode=YES;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log",
p);
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("mmfile:/metamatrix/dqp/dqp.properties"));
- assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4"));
- assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4"));
-
assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON"));
-
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("YES"));
-
assertTrue(p.getProperty(BaseDataSource.LOG_FILE).equals("D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
+
driver.parseURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=4;txnAutoWrap=ON;partialResultsMode=YES;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log",
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$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4"));
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("YES"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(BaseDataSource.LOG_FILE).equals("D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
assertEquals(7, p.size());
}
public void testParseURL4() throws SQLException{
Properties p = new Properties();
-
driver.parseURL("jdbc:metamatrix:BQT@testdata/dqp/dqp.properties;partialResultsMode=true",
p);
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("mmfile:testdata/dqp/dqp.properties"));
-
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("true"));
+
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$
+
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("true"));
//$NON-NLS-1$
assertEquals(3, p.size());
}
public void testParseURL5() throws SQLException{
Properties p = new Properties();
- driver.parseURL("jdbc:metamatrix:BQT", p);
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("classpath:/mm.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$
}
public void testParseURL55() throws SQLException{
Properties p = new Properties();
- driver.parseURL("jdbc:metamatrix:BQT;", p);
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("classpath:/mm.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$
}
public void testParseURL6() throws SQLException{
Properties p = new Properties();
-
driver.parseURL("jdbc:metamatrix:BQT;partialResultsMode=true;version=1", p);
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
-
assertTrue(p.get(EmbeddedDataSource.DQP_BOOTSTRAP_FILE).toString().equals("classpath:/mm.properties"));
-
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("true"));
- assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("1"));
-
assertTrue(p.getProperty("vdb.definition").equals("BQT.vdb"));
+
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.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$
assertEquals(6, p.size());
}
Added: trunk/embedded/src/test/resources/jboss-cache-configuration.xml
===================================================================
--- trunk/embedded/src/test/resources/jboss-cache-configuration.xml
(rev 0)
+++ trunk/embedded/src/test/resources/jboss-cache-configuration.xml 2009-02-21 00:28:43
UTC (rev 479)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.cache.pojo.jmx.CacheJmxWrapper"
name="jboss.cache:service=FederateCache">
+ <attribute
name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup</attribute>
+ <attribute name="IsolationLevel">READ_COMMITTED</attribute>
+ <attribute
name="LockParentForChildInsertRemove">true</attribute>
+
+ <attribute name="CacheMode">LOCAL</attribute>
+ <attribute name="UseLazyDeserialization">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- Shutdown hook behavior. Valid choices are: DEFAULT, REGISTER and
DONT_REGISTER. this element is omitted, DEFAULT is used. -->
+ <attribute name="ShutdownHookBehavior">DEFAULT</attribute>
+
+ <attribute name="FetchInMemoryState">true</attribute>
+
+ <attribute name="CacheLoaderConfig" replace="false">
+ <config>
+
+ <!-- are the cache loaders shared in a cluster? -->
+ <shared>false</shared>
+ <!-- if passivation is true, only the first cache loader is used; the rest
are ignored -->
+ <passivation>true</passivation>
+
+ <cacheloader>
+ <class>org.jboss.cache.loader.FileCacheLoader</class>
+ <properties>location=./target/scratch/federate</properties>
+
+ <!--fetch the persistent state of a cache when joining a
cluster-->
+ <fetchPersistentState>true</fetchPersistentState>
+
+ <!-- empties the specified cache loader when cache loader starts up
-->
+ <purgeOnStartup>true</purgeOnStartup>
+
+ <!-- cache loader is shared among different cache instances -->
+ <shared>false</shared>
+ </cacheloader>
+ </config>
+ </attribute>
+
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">3</attribute>
+ <!-- This defaults to 200000 if not specified -->
+ <attribute name="eventQueueSize">100000</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute
name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ </mbean>
+</server>
\ No newline at end of file
Property changes on: trunk/embedded/src/test/resources/jboss-cache-configuration.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -31,13 +31,13 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
import com.metamatrix.common.config.api.ConnectorBinding;
import com.metamatrix.common.config.api.ConnectorBindingType;
import com.metamatrix.common.config.api.ExtensionModule;
import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.dqp.application.ClientConnectionListener;
@@ -117,14 +117,6 @@
public String getLogLevel();
/**
- * Capture the System.out and System.err streams and direct them to the
- * log file.
- * @return true if yes; false otherwise
- * @throws MetaMatrixComponentException
- */
- public String captureSystemStreams() throws MetaMatrixComponentException;
-
- /**
* Save the given vdb file into underlying persistent mechanism used by
* this configuration service
* @param vdb - VDB to be saved
@@ -312,8 +304,7 @@
* @throws MetaMatrixComponentException
* @since 4.3.2
*/
- public ClientConnectionListener getConnectionListener()
- throws MetaMatrixComponentException;
+ public ServerConnectionListener getConnectionListener();
/**
@@ -393,13 +384,8 @@
*/
public String getInstanceIdenifier();
+
/**
- * Should DQP use the unified class loader?
- * @return true if yes; false otherwise
- */
- public boolean useUnifiedClassLoader();
-
- /**
* This returns the active client connections that have been made to the DQP
* @return list of connections which are currently available;never null
*/
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -66,7 +66,7 @@
DQPCore dqpCore = new DQPCore();
dqpCore.start(configSource);
- PlatformLog log = PlatformLog.getInstance();
+ PlatformLog log = new PlatformLog();
List<LogListener> list = log.getLogListeners();
for(LogListener l: list) {
log.removeListener(l);
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-02-20 21:08:28 UTC (rev 478)
+++ trunk/pom.xml 2009-02-21 00:28:43 UTC (rev 479)
@@ -127,9 +127,10 @@
<descriptors>
<descriptor>build/assembly/src.xml</descriptor>
<descriptor>build/assembly/bin.xml</descriptor>
- <descriptor>build/assembly/embedded/embedded-jar.xml</descriptor>
+
<descriptor>build/assembly/embedded/embedded-client-jar.xml</descriptor>
<descriptor>build/assembly/embedded/embedded-dependencies.xml</descriptor>
<descriptor>build/assembly/embedded/embedded-connector-dependencies.xml</descriptor>
+
<descriptor>build/assembly/embedded/embedded-jar.xml</descriptor>
<descriptor>build/assembly/embedded/embedded-dist.xml</descriptor>
<descriptor>build/assembly/cdk/cdk-dependencies.xml</descriptor>
<descriptor>build/assembly/cdk/cdk-dist.xml</descriptor>
Modified: trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/server/src/main/java/com/metamatrix/common/log/DbLogListener.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -42,7 +42,7 @@
/**
* Listen for log messages and write them to a database.
*/
- public DbLogListener(Properties prop) throws DbWriterException {
+ public DbLogListener(Properties prop){
if (prop == null) {
final String msg =
CommonPlugin.Util.getString("DbLogListener.The_Properties_reference_may_not_be_null");
//$NON-NLS-1$
throw new IllegalArgumentException(msg);
@@ -50,13 +50,9 @@
writer = new DbLogWriter(prop);
writer.initialize();
enabled = PropertiesUtils.getBooleanProperty(prop, LOG_DB_ENABLED, true);
-
}
- protected void init(Properties props) throws DbWriterException {
- }
-
public void logMessage(LogMessage msg) {
if (enabled) {
@@ -64,9 +60,6 @@
}
}
- /* (non-Javadoc)
- * @see com.metamatrix.core.log.LogListener#shutdown()
- */
public void shutdown() {
writer.shutdown();
}
@@ -77,7 +70,7 @@
}
- public void enableDBLogging(boolean enable) {
+ void enableDBLogging(boolean enable) {
enabled = enable;
}
Modified: trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/server/src/main/java/com/metamatrix/common/log/DbLogWriter.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -32,6 +32,7 @@
import com.metamatrix.common.CommonPlugin;
import com.metamatrix.common.config.JDBCConnectionPoolHelper;
import com.metamatrix.common.util.ErrorMessageKeys;
+import com.metamatrix.common.util.VMNaming;
import com.metamatrix.core.log.LogMessage;
import com.metamatrix.core.util.DateUtil;
import com.metamatrix.core.util.StringUtil;
@@ -46,7 +47,7 @@
*/
public class DbLogWriter {
- /**
+ /**
* Static String to use as the user name when checking out connections from the pool
*/
static final String LOGGING = "LOGGING";//$NON-NLS-1$
@@ -55,8 +56,7 @@
* The name of the System property that contains the name of the LogMessageFormat
* class that is used to format messages sent to the file destination.
* This is an optional property; if not specified and the file destination
- * is used, then the {@link
com.metamatrix.common.logging.format.DelimitedLogMessageFormat DelimitedLogMessageFormat}
- * is used.
+ * is used
*/
static final String PROPERTY_PREFIX = "metamatrix.log."; //$NON-NLS-1$
@@ -193,7 +193,7 @@
* itself.
* @throws LogDestinationInitFailedException if there was an error during
initialization.
*/
- public void initialize() throws DbWriterException {
+ public void initialize() {
sequenceNumber = 0;
lastSequenceStart = 0;
@@ -309,10 +309,10 @@
stmt.setString(5, StringUtil.truncString(message.getText(), maxMsgLength));
// Message hostname column
- stmt.setString(6, StringUtil.truncString(message.getHostName(), maxGeneralLength));
+ stmt.setString(6, StringUtil.truncString(VMNaming.getConfigName(), maxGeneralLength));
// Message VM ID column
- stmt.setString(7, StringUtil.truncString(message.getVMName(), maxGeneralLength));
+ stmt.setString(7, StringUtil.truncString(VMNaming.getVMName(), maxGeneralLength));
// Message thread name column
stmt.setString(8, StringUtil.truncString(message.getThreadName(), maxGeneralLength));
Modified: trunk/server/src/main/java/com/metamatrix/common/log/I18nLogManager.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/I18nLogManager.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/server/src/main/java/com/metamatrix/common/log/I18nLogManager.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -22,7 +22,7 @@
package com.metamatrix.common.log;
-import com.metamatrix.core.log.LogMessage;
+import com.metamatrix.core.CorePlugin;
import com.metamatrix.core.log.MessageLevel;
/**
@@ -31,7 +31,8 @@
*/
public final class I18nLogManager {
private static I18nLogManager INSTANCE = new I18nLogManager();
-
+ private static final String NULL_MSG_TEXT = "Null"; //$NON-NLS-1$
+
private I18nLogManager() {
}
@@ -114,46 +115,56 @@
}
private void logMessage(int level, String msgID, String context, Object[] msgParts)
{
- // Check quickly the level of the message:
- // If the messsage's level is greater than the logging level,
- // then the message should NOT be recorded ...
if (!LogManager.isMessageToBeRecorded(context, level)) {
return;
}
-
- LogMessage msg = new LogMessage(msgID, context, level, msgParts);
- LogManager.getInstance().forwardMessage(msg);
-// System.out.println("Enqueuing message: " + msg.getText() );
+ LogManager.log(level, context, geti18nMsg(msgID, msgParts));
}
+ private String geti18nMsg(String msgID, Object[] msgParts) {
+ if (msgID != null) {
+ if (msgParts == null) {
+ return CorePlugin.Util.getString(msgID);
+ } else {
+
+ return CorePlugin.Util.getString(msgID, msgParts);
+
+ }
+ }
+ else {
+ StringBuffer text = null;
+ if(msgParts != null) {
+ text = new StringBuffer();
+ for(int i=0; i<msgParts.length; i++) {
+ if (i>0) text.append(" "); //$NON-NLS-1$
+ Object omsg = msgParts[i];
+ if ( omsg != null ) {
+ text.append(omsg.toString());
+ }
+ }
+ }
+
+ if (text == null) {
+ return NULL_MSG_TEXT;
+ } else {
+ return text.toString();
+ }
+ }
+ }
+
private void logMessage(int level, String msgID, String context, Throwable e) {
- // Check quickly the level of the message:
- // If the messsage's level is greater than the logging level,
- // then the message should NOT be recorded ...
if (!LogManager.isMessageToBeRecorded(context, level)) {
return;
}
-
-
- LogMessage msg = new LogMessage(msgID, context, level, e);
-// System.out.println("Enqueuing message: " + msg.getText() );
- LogManager.getInstance().forwardMessage(msg);
+ LogManager.log(level, context, e, geti18nMsg(msgID, null));
}
private void logMessage(int level, String msgID, String context, Throwable e,
Object[] msgParts) {
- // Check quickly the level of the message:
- // If the messsage's level is greater than the logging level,
- // then the message should NOT be recorded ...
if (!LogManager.isMessageToBeRecorded(context, level)) {
return;
}
-
-
- LogMessage msg = new LogMessage(msgID, context, level, e, msgParts);
-// System.out.println("Enqueuing message: " + msg.getText() );
- LogManager.getInstance().forwardMessage(msg);
+ LogManager.log(level, context, e, geti18nMsg(msgID, msgParts));
}
-
}
Modified: trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -38,15 +38,9 @@
import com.metamatrix.common.CommonPlugin;
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.JDBCConnectionPoolHelper;
-import com.metamatrix.common.config.ResourceNames;
-import com.metamatrix.common.config.api.ResourceDescriptor;
import com.metamatrix.common.connection.ManagedConnectionException;
-import com.metamatrix.common.jdbc.JDBCUtil;
-import com.metamatrix.common.properties.UnmodifiableProperties;
import com.metamatrix.common.util.ErrorMessageKeys;
import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.common.util.crypto.CryptoException;
-import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.core.util.DateUtil;
@@ -58,7 +52,7 @@
* The name of the System property that contains the name of the LogMessageFormat
* class that is used to format messages sent to the file destination.
* This is an optional property; if not specified and the file destination
- * is used, then the {@link
com.metamatrix.common.logging.format.DelimitedLogMessageFormat DelimitedLogMessageFormat}
+ * is used
* is used.
*/
static final String PROPERTY_PREFIX = "metamatrix.log."; //$NON-NLS-1$
Deleted:
trunk/server/src/main/java/com/metamatrix/platform/config/ConfigurationChangeListener.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/config/ConfigurationChangeListener.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/server/src/main/java/com/metamatrix/platform/config/ConfigurationChangeListener.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,88 +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.platform.config;
-
-import java.util.EventObject;
-
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.Configuration;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.log.DbLogListener;
-import com.metamatrix.core.event.EventObjectListener;
-import com.metamatrix.platform.config.event.ConfigurationChangeEvent;
-
-/**
- * This class will listen for Changes to Configuration and
- */
-public class ConfigurationChangeListener implements EventObjectListener {
-
- /**
- * The name of the System property that contains the set of comma-separated
- * context names for messages <i>not</i> to be recorded. A message context
is simply
- * some string that identifies something about the component that generates
- * the message. The value for the contexts is application specific.
- * <p>
- * This is an optional property that defaults to no contexts (i.e., messages
- * with any context are recorded).
- */
- public static final String LOG_CONTEXT_PROPERTY_NAME =
"metamatrix.log.contexts"; //$NON-NLS-1$
-
- public static final String LOG_LEVEL_PROPERTY_NAME = "metamatrix.log";
//$NON-NLS-1$
-
- public static final String LOG_DB_ENABLED =
"metamatrix.log.jdbcDatabase.enabled"; //$NON-NLS-1$
-
- Configuration currentConfig = null;
-
- private DbLogListener logger = null;
-
- public ConfigurationChangeListener() {
-
- }
-
- public ConfigurationChangeListener(DbLogListener dblogger) {
- logger = dblogger;
- }
-
- /* (non-Javadoc)
- * @see
com.metamatrix.core.event.EventObjectListener#processEvent(java.util.EventObject)
- */
- public void processEvent(EventObject obj) {
- if(obj instanceof ConfigurationChangeEvent){
- try {
- currentConfig = CurrentConfiguration.getInstance().getConfiguration();
-
- if (logger != null) {
- logger.determineIfEnabled(currentConfig.getProperties());
- }
-
- } catch( ConfigurationException ce ) {
- ce.printStackTrace();
- System.out.println(ce);
- }
- }
- }
-
- public void shutdown() {
- }
-
-}
Modified:
trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/ConsoleAuditDestination.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/ConsoleAuditDestination.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/server/src/main/java/com/metamatrix/platform/security/audit/destination/ConsoleAuditDestination.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -39,9 +39,6 @@
/**
* The name of the property that contains the name of the LogMessageFormat
* class that is used to format messages sent to the console.
- * This is an optional property; if not specified then the
- * {@link com.metamatrix.common.logging.format.DelimitedLogMessageFormat
DelimitedLogMessageFormat}
- * is used.
*/
public static final String MESSAGE_FORMAT_PROPERTY_NAME =
AuditDestination.PROPERTY_PREFIX + "consoleFormat"; //$NON-NLS-1$
Modified:
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -517,24 +517,18 @@
return;
}
- // Create a thread that will actually kill the vm so that this method can (the
stub anyway) return.
- Thread stopper = new Thread() {
-
+ this.startServicePool.execute(new Runnable() {
public void run() {
// Wait before killing the VM.
try {
- sleep(force_shutdown_time * 1000);
+ Thread.sleep(force_shutdown_time * 1000);
} catch (Exception e) {}
-
// And exit.
System.exit(1);
}
- };
-
- stopper.start();
+ });
}
-
private synchronized void stop(boolean now, boolean shutdown) {
try {
stopServices(now, shutdown);
@@ -616,9 +610,11 @@
* Shut down all services without waiting for work to complete.
* Essential services will also be shutdown.
*/
- public void shutdownNow() {
+ public synchronized void shutdownNow() {
logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0041));
doStopVM(true, true);
+ this.shuttingDown = true;
+ notifyAll();
}
public void shutdownService(ServiceID serviceID) {
@@ -687,7 +683,7 @@
public void ping() {
}
- public boolean isShuttingDown() {
+ public synchronized boolean isShuttingDown() {
return shuttingDown;
}
Deleted: trunk/server/src/main/java/com/metamatrix/platform/vm/util/VMUtils.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/util/VMUtils.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/util/VMUtils.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -1,77 +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.platform.vm.util;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Properties;
-
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.core.log.FileLimitSizeLogWriter;
-import com.metamatrix.internal.core.log.PlatformLog;
-
-public class VMUtils {
-
- /**
- * initializeVMLogFile is called by the different controllers (i.e.,
SocketVMController, HostController, etc)
- * to setup the log file using the LimitSize log file writer.
- * @param fileName
- * @throws Exception
- * @since 4.2
- */
- public static void startLogFile(String path, String logFile) throws
ConfigurationException, IOException{
- File tmpFile = new File(path, logFile);
- tmpFile.getParentFile().mkdirs();
-
- // if log file exists then create a archive
- if (tmpFile.exists()) {
- int index = logFile.lastIndexOf("."); //$NON-NLS-1$
- String archiveName =
FileLimitSizeLogWriter.buildArchiveFileName(logFile.substring(0, index),
logFile.substring(index));
- tmpFile.renameTo(new File(path, archiveName));
- }
-
- FileOutputStream fos = new FileOutputStream(tmpFile);
- PrintStream ps = new PrintStream(fos);
-
- System.setOut(ps);
- System.setErr(ps);
-
- Properties logProps = new Properties();
- Properties configProps = CurrentConfiguration.getInstance().getProperties();
- if (configProps.containsKey(FileLimitSizeLogWriter.FILE_SIZE_LIMIT)) {
-
logProps.setProperty(FileLimitSizeLogWriter.FILE_SIZE_LIMIT,configProps.getProperty(FileLimitSizeLogWriter.FILE_SIZE_LIMIT));
- }
- if (configProps.containsKey(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME)) {
-
logProps.setProperty(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME,configProps.getProperty(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME));
- }
-
- FileLimitSizeLogWriter flw = new FileLimitSizeLogWriter(tmpFile, logProps,
false);
-
- PlatformLog.getInstance().addListener(flw);
-
- }
-
-}
Modified: trunk/server/src/main/java/com/metamatrix/server/HostController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/HostController.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/server/src/main/java/com/metamatrix/server/HostController.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -49,9 +49,7 @@
import com.metamatrix.common.messaging.MessageBus;
import com.metamatrix.common.util.LogCommonConstants;
import com.metamatrix.common.util.VMNaming;
-import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.FileUtils;
-import com.metamatrix.core.util.StringUtil;
import com.metamatrix.dqp.ResourceFinder;
import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.registry.ClusteredRegistryState;
@@ -60,7 +58,6 @@
import com.metamatrix.platform.registry.VMRegistryBinding;
import com.metamatrix.platform.util.ErrorMessageKeys;
import com.metamatrix.platform.util.LogMessageKeys;
-import com.metamatrix.platform.vm.util.VMUtils;
@Singleton
public class HostController implements HostManagement {
@@ -95,7 +92,7 @@
// normal startup.
StartupStateController.performSystemInitialization(true);
- startLogging();
+ createTempDirectories();
Runtime.getRuntime().addShutdownHook(new ShutdownThread());
@@ -149,13 +146,7 @@
return null;
}
- private void startLogging() throws ConfigurationException, IOException {
-
- // setup the log file
- String hostFileName = StringUtil.replaceAll(host.getFullName(), ".",
"_"); //$NON-NLS-1$ //$NON-NLS-2$
-
- VMUtils.startLogFile(host.getLogDirectory(), hostFileName + "_hc.log");
//$NON-NLS-1$
-
+ private void createTempDirectories() throws ConfigurationException, IOException {
// If the java-i-tmp directory doesn't exist, it needs to be created
// because extension jars class loading will fail because
// java internals can' write to a non-existent directory.
Modified: trunk/server/src/main/java/com/metamatrix/server/HostControllerGuiceModule.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/server/HostControllerGuiceModule.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/server/src/main/java/com/metamatrix/server/HostControllerGuiceModule.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -33,8 +33,12 @@
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.api.Host;
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.log.LogConfiguration;
+import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.messaging.MessageBus;
import com.metamatrix.common.messaging.VMMessageBus;
+import com.metamatrix.core.log.LogListener;
+import com.metamatrix.core.util.StringUtil;
import com.metamatrix.platform.registry.ClusteredRegistryState;
import com.metamatrix.platform.registry.HostMonitor;
@@ -70,6 +74,14 @@
bind(ClusteredRegistryState.class).in(Scopes.SINGLETON);
bind(MessageBus.class).to(VMMessageBus.class).in(Scopes.SINGLETON); // VM Message bus
is in common-internal
bind(HostMonitor.class).in(Scopes.SINGLETON);
+
+ bind(LogConfiguration.class).toProvider(LogConfigurationProvider.class).in(Scopes.SINGLETON);
+
+ String logFileName = StringUtil.replaceAll(host.getFullName(), ".",
"_")+"_hc.log"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bind(LogListener.class).toProvider(new
ServerLogListernerProvider(host.getLogDirectory(), logFileName,
false)).in(Scopes.SINGLETON);
+
+ // this needs to be removed.
+ binder().requestStaticInjection(LogManager.class);
}
}
Added: trunk/server/src/main/java/com/metamatrix/server/LogConfigurationProvider.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/LogConfigurationProvider.java
(rev 0)
+++
trunk/server/src/main/java/com/metamatrix/server/LogConfigurationProvider.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -0,0 +1,116 @@
+/*
+ * 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.server;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.EventObject;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.metamatrix.common.config.CurrentConfiguration;
+import com.metamatrix.common.config.api.Configuration;
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.log.LogConfiguration;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.log.config.BasicLogConfiguration;
+import com.metamatrix.common.log.config.LogConfigurationException;
+import com.metamatrix.common.messaging.MessageBus;
+import com.metamatrix.common.messaging.MessagingException;
+import com.metamatrix.common.util.LogContextsUtil;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.event.EventObjectListener;
+import com.metamatrix.core.util.StringUtil;
+import com.metamatrix.platform.config.event.ConfigurationChangeEvent;
+
+@Singleton
+class LogConfigurationProvider implements Provider<LogConfiguration> {
+
+ private static final String LOG_CONTEXT_PROPERTY_NAME =
"metamatrix.log.contexts"; //$NON-NLS-1$
+ private static final String LOG_LEVEL_PROPERTY_NAME = "metamatrix.log";
//$NON-NLS-1$
+
+ @Inject
+ MessageBus messsgeBus;
+
+
+ @Override
+ public LogConfiguration get() {
+
+ try {
+ final LogConfiguration orig =
(LogConfiguration)CurrentConfiguration.getInstance().getConfiguration().getLogConfiguration().clone();
+
+ try {
+ this.messsgeBus.addListener(ConfigurationChangeEvent.class, new EventObjectListener()
{
+ public void processEvent(EventObject obj) {
+ if(obj instanceof ConfigurationChangeEvent){
+ try {
+ Configuration currentConfig =
CurrentConfiguration.getInstance().getConfiguration();
+ int level =
Integer.parseInt(currentConfig.getProperty(LOG_LEVEL_PROPERTY_NAME));
+ String[] contexts = getContext();
+
+ BasicLogConfiguration newConfig = new
BasicLogConfiguration(Arrays.asList(contexts), level);
+ if (!newConfig.equals(LogManager.getLogConfigurationCopy())) {
+ LogManager.setLogConfiguration(newConfig);
+ }
+ } catch( ConfigurationException ce ) {
+ LogManager.logError(LogContextsUtil.CommonConstants.CTX_MESSAGE_BUS, ce,
ce.getMessage());
+ }
+ }
+ }
+
+ private String[] getContext() {
+ String[] result = null;
+ Collection discardedContexts = null;
+ String discardedContextsString =
CurrentConfiguration.getInstance().getProperties().getProperty(LOG_CONTEXT_PROPERTY_NAME);
+ if (discardedContextsString != null){
+ discardedContexts = StringUtil.split(discardedContextsString,",");
//$NON-NLS-1$
+ }
+
+ //get the Set of all contexts, remove the ones which are
+ //currently "discarded"
+ Set contextsSet = new HashSet(LogContextsUtil.ALL_CONTEXTS);
+ if (discardedContexts != null){
+ contextsSet.removeAll(discardedContexts);
+ }
+ result = new String[contextsSet.size()];
+ result = (String[]) contextsSet.toArray(result);
+ return result;
+ }
+ });
+ } catch (MessagingException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ return orig;
+
+ } catch ( ConfigurationException e ) {
+ try {
+ return
BasicLogConfiguration.createLogConfiguration(System.getProperties());
+ } catch ( LogConfigurationException e1) {
+ throw new MetaMatrixRuntimeException(e1);
+ }
+ }
+
+ }
+}
Property changes on:
trunk/server/src/main/java/com/metamatrix/server/LogConfigurationProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/server/src/main/java/com/metamatrix/server/Main.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/Main.java 2009-02-20 21:08:28 UTC
(rev 478)
+++ trunk/server/src/main/java/com/metamatrix/server/Main.java 2009-02-21 00:28:43 UTC
(rev 479)
@@ -23,7 +23,6 @@
package com.metamatrix.server;
import java.io.File;
-import java.util.Properties;
import com.google.inject.Guice;
import com.google.inject.Inject;
@@ -32,23 +31,15 @@
import com.metamatrix.common.config.api.Host;
import com.metamatrix.common.config.api.VMComponentDefn;
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.log.DbLogListener;
-import com.metamatrix.common.log.DbWriterException;
-import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.messaging.MessageBus;
-import com.metamatrix.common.util.LogCommonConstants;
-import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.common.messaging.MessagingException;
import com.metamatrix.common.util.VMNaming;
+import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.util.FileUtils;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.dqp.ResourceFinder;
-import com.metamatrix.internal.core.log.PlatformLog;
import com.metamatrix.platform.PlatformPlugin;
-import com.metamatrix.platform.config.ConfigurationChangeListener;
-import com.metamatrix.platform.config.event.ConfigurationChangeEvent;
-import com.metamatrix.platform.util.LogMessageKeys;
import com.metamatrix.platform.vm.api.controller.VMControllerInterface;
-import com.metamatrix.platform.vm.util.VMUtils;
/**
* This is main server starter class.
@@ -61,6 +52,9 @@
@Inject
VMControllerInterface vmController;
+ @Inject
+ LogListener logListener;
+
public static void main(String[] args) throws Exception{
if (args.length < 2 || args.length > 4) {
@@ -90,10 +84,7 @@
// write info log
writeInfoLog(host, vmName);
-
- // Start the log file
- VMUtils.startLogFile(host.getLogDirectory(), buildPrefix(host.getName(), vmName)
+ ".log"); //$NON-NLS-1$
-
+
createTempDirectory();
// wire up guice modules
@@ -116,23 +107,17 @@
private void launchServer() {
try {
- DbLogListener dbListener = startDbLogging();
- ConfigurationChangeListener configListener = new
ConfigurationChangeListener(dbListener);
- this.messageBus.addListener(ConfigurationChangeEvent.class, configListener);
-
+ Runtime.getRuntime().addShutdownHook(new ShutdownWork());
+
// start the VM
this.vmController.startVM();
- while(!this.vmController.isShuttingDown()) {
- Thread.sleep(1000);
- }
+ synchronized (this.vmController) {
+ while(!this.vmController.isShuttingDown()) {
+ this.vmController.wait(1000);
+ }
+ }
- configListener.shutdown();
-
- this.messageBus.shutdown();
-
- // shutdown cache
- ResourceFinder.getCacheFactory().destroy();
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
@@ -159,25 +144,33 @@
String hostFileName = StringUtil.replaceAll(hostName, ".", "_");
//$NON-NLS-1$ //$NON-NLS-2$
return hostFileName + "_" + vmName; //$NON-NLS-1$
}
-
- private static DbLogListener startDbLogging() throws Exception, DbWriterException {
- Properties currentProps = CurrentConfiguration.getInstance().getProperties();
- Properties resultsProps = PropertiesUtils.clone(currentProps, null, true,
false);
-
- // write a db log listener
- DbLogListener dll = new DbLogListener(resultsProps);
-
- // start the logger
- PlatformLog.getInstance().addListener(dll);
- LogManager.logInfo(LogCommonConstants.CTX_CONTROLLER,
PlatformPlugin.Util.getString(LogMessageKeys.VM_0052));
-
- return dll;
- }
-
+
private static void writeInfoLog(Host host, String vmName) {
// trigger the logging of the current application info to a log file for
debugging
LogApplicationInfo logApplInfo = new LogApplicationInfo(host.getFullName(),
vmName, host.getLogDirectory(), buildPrefix(host.getFullName(), vmName) +
"_info.log"); //$NON-NLS-1$
logApplInfo.start();
}
+
+ /**
+ * All work to be done during shutdown
+ */
+ class ShutdownWork extends Thread {
+
+ @Override
+ public void run() {
+
+ try {
+ messageBus.shutdown();
+ } catch (MessagingException e) {
+ e.printStackTrace();
+ }
+
+ // shutdown cache
+ ResourceFinder.getCacheFactory().destroy();
+
+ // shutdown logging
+ logListener.shutdown();
+ }
+ }
}
Modified: trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java 2009-02-20
21:08:28 UTC (rev 478)
+++ trunk/server/src/main/java/com/metamatrix/server/ServerGuiceModule.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -36,9 +36,13 @@
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
import com.metamatrix.common.id.dbid.DBIDGenerator;
import com.metamatrix.common.id.dbid.DBIDGeneratorException;
+import com.metamatrix.common.log.LogConfiguration;
+import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.messaging.MessageBus;
import com.metamatrix.common.messaging.VMMessageBus;
import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.log.LogListener;
+import com.metamatrix.core.util.StringUtil;
import com.metamatrix.platform.registry.ClusteredRegistryState;
import com.metamatrix.platform.registry.VMMonitor;
import com.metamatrix.platform.service.proxy.ProxyManager;
@@ -96,6 +100,18 @@
// this needs to be removed.
binder().requestStaticInjection(PlatformProxyHelper.class);
+
+ bind(LogConfiguration.class).toProvider(LogConfigurationProvider.class).in(Scopes.SINGLETON);
+ bind(LogListener.class).toProvider(ServerLogListernerProvider.class).in(Scopes.SINGLETON);
+
+ // Start the log file
+ String logFileName = StringUtil.replaceAll(host.getFullName(), ".",
"_")+".log"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bind(LogListener.class).toProvider(new
ServerLogListernerProvider(host.getLogDirectory(), logFileName,
true)).in(Scopes.SINGLETON);
+
+
+ // this needs to be removed.
+ binder().requestStaticInjection(LogManager.class);
+
}
}
Added: trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java
(rev 0)
+++
trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -0,0 +1,149 @@
+/*
+ * 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.server;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.EventObject;
+import java.util.Properties;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.metamatrix.common.config.CurrentConfiguration;
+import com.metamatrix.common.config.api.Configuration;
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.log.DbLogListener;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.messaging.MessageBus;
+import com.metamatrix.common.messaging.MessagingException;
+import com.metamatrix.common.util.LogContextsUtil;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.event.EventObjectListener;
+import com.metamatrix.core.log.FileLimitSizeLogWriter;
+import com.metamatrix.core.log.LogListener;
+import com.metamatrix.internal.core.log.PlatformLog;
+import com.metamatrix.platform.config.event.ConfigurationChangeEvent;
+
+@Singleton
+class ServerLogListernerProvider implements Provider<LogListener> {
+
+ String logFile;
+ String path;
+ boolean addDBLogger;
+ DbLogListener dbLogger;
+
+ @Inject
+ MessageBus messsgeBus;
+
+ public ServerLogListernerProvider(String path, String fileName, boolean addDbLogger) {
+ this.path = path;
+ this.logFile = fileName;
+ this.addDBLogger = addDbLogger;
+ }
+
+ @Override
+ public LogListener get() {
+
+ final PlatformLog realLog = new PlatformLog();
+
+ try {
+ FileLimitSizeLogWriter flw = buildFileLogger();
+ realLog.addListener(flw);
+
+ } catch (FileNotFoundException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+
+ if (this.addDBLogger) {
+ this.dbLogger = buildDBLogger();
+ realLog.addListener(this.dbLogger);
+
+ try {
+
+ this.messsgeBus.addListener(ConfigurationChangeEvent.class, new EventObjectListener()
{
+
+ public void processEvent(EventObject obj) {
+ if(obj instanceof ConfigurationChangeEvent){
+ if(obj instanceof ConfigurationChangeEvent){
+ try {
+ Configuration currentConfig =
CurrentConfiguration.getInstance().getConfiguration();
+ dbLogger.determineIfEnabled(currentConfig.getProperties());
+ } catch( ConfigurationException ce ) {
+ LogManager.logError(LogContextsUtil.CommonConstants.CTX_MESSAGE_BUS, ce,
ce.getMessage());
+ }
+ }
+ }
+ }
+ });
+
+ } catch (MessagingException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ }
+ return realLog;
+ }
+
+ private DbLogListener buildDBLogger() {
+ Properties currentProps = CurrentConfiguration.getInstance().getProperties();
+ Properties resultsProps = PropertiesUtils.clone(currentProps, null, true, false);
+ return new DbLogListener(resultsProps);
+ }
+
+ private FileLimitSizeLogWriter buildFileLogger()
+ throws FileNotFoundException {
+ File tmpFile = new File(path, logFile);
+ tmpFile.getParentFile().mkdirs();
+
+ // if log file exists then create a archive
+ if (tmpFile.exists()) {
+ int index = logFile.lastIndexOf("."); //$NON-NLS-1$
+ String archiveName = FileLimitSizeLogWriter.buildArchiveFileName(logFile.substring(0,
index), logFile.substring(index));
+ tmpFile.renameTo(new File(path, archiveName));
+ }
+
+ FileOutputStream fos = new FileOutputStream(tmpFile);
+ PrintStream ps = new PrintStream(fos);
+
+ System.setOut(ps);
+ System.setErr(ps);
+
+ Properties logProps = new Properties();
+ Properties configProps = CurrentConfiguration.getInstance().getProperties();
+ if (configProps.containsKey(FileLimitSizeLogWriter.FILE_SIZE_LIMIT)) {
+ logProps.setProperty(FileLimitSizeLogWriter.FILE_SIZE_LIMIT,configProps.getProperty(FileLimitSizeLogWriter.FILE_SIZE_LIMIT));
+ }
+ if (configProps.containsKey(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME)) {
+ logProps.setProperty(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME,configProps.getProperty(FileLimitSizeLogWriter.FILE_SIZE_MONITOR_TIME));
+ }
+
+ FileLimitSizeLogWriter flw = new FileLimitSizeLogWriter(tmpFile,logProps, false);
+ return flw;
+ }
+
+
+
+}
Property changes on:
trunk/server/src/main/java/com/metamatrix/server/ServerLogListernerProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java 2009-02-20
21:08:28 UTC (rev 478)
+++
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java 2009-02-21
00:28:43 UTC (rev 479)
@@ -396,7 +396,7 @@
MMRequest request = (MMRequest) results.iterator().next();
assertEquals(REQUEST_1_1, request.getIdentifier());
- assertEquals(1, request.getSessionID());
+ assertEquals("1", request.getSessionID()); //$NON-NLS-1$
assertEquals("1", request.getRequestID()); //$NON-NLS-1$
assertEquals("user1", request.getUserName()); //$NON-NLS-1$
@@ -443,7 +443,7 @@
MMSourceRequest request = (MMSourceRequest) results.iterator().next();
assertEquals(REQUEST_1_1_1, request.getIdentifier());
- assertEquals(1, request.getSessionID());
+ assertEquals("1", request.getSessionID()); //$NON-NLS-1$
assertEquals(REQUEST_1_1, request.getRequestID());
assertEquals("connectorBinding1", request.getConnectorBindingName());
//$NON-NLS-1$
assertEquals("user1", request.getUserName()); //$NON-NLS-1$