Author: rareddy
Date: 2009-02-26 18:42:51 -0500 (Thu, 26 Feb 2009)
New Revision: 517
Removed:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DriverManagerLogger.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/JDBCLogger.java
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/AbstractMetadataProvider.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DeferredMetadataProvider.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/FilteredResultsMetadata.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAResource.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/ResultsMetadataWithProvider.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/StaticMetadataProvider.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java
trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java
Log:
TEIID-385: replaced with java logging. RequestAware logging is no longer available.
Modified: trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java 2009-02-26 22:08:21
UTC (rev 516)
+++ trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java 2009-02-26 23:42:51
UTC (rev 517)
@@ -45,20 +45,8 @@
public static final String VDB_VERSION = "VirtualDatabaseVersion";
//$NON-NLS-1$
// constant for vdb version part of serverURL
public static final String VERSION = "version"; //$NON-NLS-1$
- // string constant that the url contains
- public static final String LOG_FILE = "logFile"; //$NON-NLS-1$
- // string constant that the url contains
- public static final String LOG_LEVEL = "logLevel"; //$NON-NLS-1$
-
- // logging level that would log messages
- public static final int LOG_NONE = 0;
- // logging level that would log error messages
- public static final int LOG_ERROR = 1;
- // logging level that would log all info level messages
- public static final int LOG_INFO = 2;
- // logging level that would traces method calls
- public static final int LOG_TRACE = 3;
- public static final String CREDENTIALS = "credentials"; //$NON-NLS-1$
+
+ public static final String CREDENTIALS = "credentials"; //$NON-NLS-1$
}
public static interface CONNECTION {
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/AbstractMetadataProvider.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/AbstractMetadataProvider.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/AbstractMetadataProvider.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -24,13 +24,9 @@
import java.sql.SQLException;
-import com.metamatrix.core.log.Logger;
-
/**
*/
public abstract class AbstractMetadataProvider implements ResultsMetadataProvider {
- Logger logger;
-
public String getStringValue(int columnIndex, Integer metadataPropertyKey) throws
SQLException {
return (String) getValue(columnIndex, metadataPropertyKey);
}
@@ -42,20 +38,4 @@
public boolean getBooleanValue(int columnIndex, Integer metadataPropertyKey) throws
SQLException {
return ((Boolean) getValue(columnIndex, metadataPropertyKey)).booleanValue();
}
-
- /**
- * JDBC Logger
- * @param logger
- */
- void setLogger(Logger logger) {
- this.logger = logger;
- }
-
- /**
- * JDBC Logger
- * @return logger
- */
- public Logger getLogger() {
- return this.logger;
- }
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -113,19 +113,6 @@
public static final String USER_NAME = MMURL.CONNECTION.USER_NAME;
// constant for password part of url
public static final String PASSWORD = MMURL.CONNECTION.PASSWORD;
- // string constant that the url contains
- public static final String LOG_FILE = MMURL.JDBC.LOG_FILE;
- // string constant that the url contains
- public static final String LOG_LEVEL = MMURL.JDBC.LOG_LEVEL;
- // logging level that would log messages
- public static final int LOG_NONE = MMURL.JDBC.LOG_NONE;
- // logging level that would log exception stack traces
- public static final int LOG_ERROR = MMURL.JDBC.LOG_ERROR;
- // logging level that would log messages
- public static final int LOG_INFO = MMURL.JDBC.LOG_INFO;
- // logging level that would traces method calls
- public static final int LOG_TRACE = MMURL.JDBC.LOG_TRACE;
-
protected static final int DEFAULT_TIMEOUT = 0;
protected static final int DEFAULT_LOG_LEVEL = 0;
@@ -194,25 +181,6 @@
*/
private String applicationName;
- /**
- * The path and file name to which JDBC Log Statements will be written.
- * This property is <i>optional</i>; if none is specified, then no Log
Statements will be written.
- */
- private String logFile;
-
- /**
- * The level of Log Statements. This property is only used if the
<code>logFile</code> property
- * is specified, and must be either
- * <ul>
- * <li>"<code>0</code>" - no JDBC log messages will be
written to the file</li>
- * <li>"<code>1</code>" - all JDBC log messages will be
written to the file</li>
- * <li>"<code>2</code>" - all JDBC log messages as well
as stack traces of any exceptions thrown from
- * this driver will be written to the file</li>
- * </ul>
- * This property is <i>optional</i> and defaults to
"<code>0</code>".
- */
- private int logLevel;
-
/** Support partial results mode or not.*/
private String partialResultsMode;
@@ -322,7 +290,6 @@
*/
public BaseDataSource() {
this.loginTimeout = DEFAULT_TIMEOUT;
- this.logLevel = DEFAULT_LOG_LEVEL;
}
//
--------------------------------------------------------------------------------------------
@@ -359,14 +326,6 @@
props.put(MMURL.CONNECTION.CLIENT_TOKEN_PROP, token);
}
- if ( this.getLogFile() != null && this.getLogFile().trim().length() != 0
) {
- props.setProperty(BaseDataSource.LOG_FILE,this.getLogFile().trim());
- }
-
- if ( this.getLogLevel() != 0 ) {
-
props.setProperty(BaseDataSource.LOG_LEVEL,Integer.toString(this.getLogLevel()));
- }
-
if (this.getPartialResultsMode() != null &&
this.getPartialResultsMode().trim().length() != 0) {
props.setProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE,
this.getPartialResultsMode());
}
@@ -429,16 +388,6 @@
throw new SQLException(reason);
}
- reason = reasonWhyInvalidLogFile(this.logFile);
- if ( reason != null ) {
- throw new SQLException(reason);
- }
-
- reason = reasonWhyInvalidLogLevel(this.logLevel);
- if ( reason != null ) {
- throw new SQLException(reason);
- }
-
final String pwd = password != null ? password : getPassword();
reason = reasonWhyInvalidPassword(pwd);
if ( reason != null ) {
@@ -666,29 +615,6 @@
}
/**
- * Returns the path and file name to which JDBC Log Statements will be written.
- * @return the name of the log file for this data source; may be null
- */
- public String getLogFile() {
- return logFile;
- }
-
- /**
- * Returns the level of logging. This property is only used if the
<code>logFile</code> property
- * is specified, and must be either
- * <ul>
- * <li>"<code>0</code>" - no JDBC log messages will be
written to the file</li>
- * <li>"<code>1</code>" - all JDBC log messages will be
written to the file</li>
- * <li>"<code>2</code>" - all JDBC log messages as well
as stack traces of any exceptions thrown from
- * this driver will be written to the file<li>
- * </ul>
- * @return The logging level for this data source
- */
- public int getLogLevel() {
- return logLevel;
- }
-
- /**
* Sets the name of the application. Supplying this property may allow an
administrator of a
* MetaMatrix Server to better identify individual connections and usage patterns.
* This property is <i>optional</i>.
@@ -764,29 +690,6 @@
this.description = description;
}
- /**
- * Sets the path and file name to which JDBC Log Statements will be written.
- * @param logFile The log file for this data source
- */
- public void setLogFile(final String logFile) {
- this.logFile = logFile;
- }
-
- /**
- * Sets the level of logging. This property is only used if the
<code>logFile</code> property
- * is specified, and must be either
- * <ul>
- * <li>"<code>0</code>" - no JDBC log messages will be
written to the file</li>
- * <li>"<code>1</code>" - all JDBC log messages will be
written to the file</li>
- * <li>"<code>2</code>" - all JDBC log messages as well
as stack traces of any exceptions thrown from
- * this driver will be written to the file<li>
- * </ul>
- * @param logLevel The logging level for this data source
- */
- public void setLogLevel(final int logLevel) {
- this.logLevel = logLevel;
- }
-
public void setPartialResultsMode(String partialResultsMode) {
this.partialResultsMode = partialResultsMode;
}
@@ -1012,31 +915,6 @@
}
/**
- * Return the reason why the supplied log file may be invalid, or null
- * if it is considered valid.
- * @param logFile a possible value for the property
- * @return the reason why the property is invalid, or null if it is considered valid
- * @see #setLogFile(String)
- */
- public static String reasonWhyInvalidLogFile( final String logFile ) {
- return null;
- }
-
- /**
- * Return the reason why the supplied log level may be invalid, or null * if it
is considered valid.
- * @param logLevel a possible value for the property
- * @return the reason why the property is invalid, or null if it is considered valid
- * @see #setLogLevel(int)
- */
- public static String reasonWhyInvalidLogLevel( final int logLevel ) {
- if ( logLevel < BaseDataSource.LOG_NONE || logLevel >
BaseDataSource.LOG_TRACE ) {
- Object[] params = new Object[] {new Integer(BaseDataSource.LOG_NONE), new
Integer(BaseDataSource.LOG_ERROR), new Integer(BaseDataSource.LOG_INFO), new
Integer(BaseDataSource.LOG_TRACE)};
- return getResourceMessage("MMDataSource.Log_level_invalid",
params); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
* The reason why partialResultsMode is invalid.
* @param partialMode boolean flag
* @return String reason
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DeferredMetadataProvider.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DeferredMetadataProvider.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DeferredMetadataProvider.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -28,7 +28,6 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.core.log.Logger;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.dqp.client.MetadataResult;
import com.metamatrix.dqp.metadata.ResultsMetadataConstants;
@@ -46,7 +45,7 @@
DeferredMetadataProvider() {
}
- public static DeferredMetadataProvider createWithInitialData(String[] columnNames,
String[] columnTypes, MMStatement statement, long requestID, Logger logger) {
+ public static DeferredMetadataProvider createWithInitialData(String[] columnNames,
String[] columnTypes, MMStatement statement, long requestID) {
if(columnNames == null || columnTypes == null || columnNames.length !=
columnTypes.length) {
Object[] params = new Object[] {
StringUtil.toString(columnNames), StringUtil.toString(columnTypes)
@@ -56,7 +55,6 @@
DeferredMetadataProvider provider = null;
provider = new DeferredMetadataProvider();
- provider.setLogger(logger);
provider.setDeferredLookupAttributes(statement, requestID);
provider.loadPartialMetadata(columnNames, columnTypes);
return provider;
@@ -75,7 +73,7 @@
columnMetadata[i].put(ResultsMetadataConstants.DATA_TYPE, columnTypes[i]);
}
- this.staticProvider = StaticMetadataProvider.createWithData(columnMetadata, -1,
getLogger());
+ this.staticProvider = StaticMetadataProvider.createWithData(columnMetadata, -1);
}
private void loadFullMetadata() throws SQLException {
@@ -87,7 +85,7 @@
} catch (MetaMatrixProcessingException e) {
throw MMSQLException.create(e);
}
- this.staticProvider =
StaticMetadataProvider.createWithData(results.getColumnMetadata(),
results.getParameterCount(), getLogger());
+ this.staticProvider =
StaticMetadataProvider.createWithData(results.getColumnMetadata(),
results.getParameterCount());
}
public int getColumnCount() throws SQLException {
Deleted: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DriverManagerLogger.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DriverManagerLogger.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/DriverManagerLogger.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -1,69 +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.io.PrintWriter;
-
-import com.metamatrix.core.log.Logger;
-
-
-/**
- * Default logger for the JDBC, this hooks to driver manager code
- *
- * Note: remember that all the messages logged in the JDBC layer are
- * logged with MessageLevel class's log levels, they need to be mapped
- * to the jdbc levels.
- */
-public class DriverManagerLogger implements Logger {
-
- int allowedSeverity = BaseDataSource.LOG_NONE;
- PrintWriter writer = null;
-
- public DriverManagerLogger(int loglevel, PrintWriter writer) {
- this.allowedSeverity = loglevel;
- this.writer = writer;
- }
-
- private boolean allow(int level) {
- return (JDBCLogger.convertToJDBCLogLevel(level) <= this.allowedSeverity);
- }
-
- /**
- * @see com.metamatrix.core.log.Logger#log(int, java.lang.String)
- */
- public void log(int severity, String message) {
- if (this.writer != null && allow(severity)) {
- this.writer.println(message);
- }
- }
-
- /**
- * @see com.metamatrix.core.log.Logger#log(int, java.lang.Throwable,
java.lang.String)
- */
- public void log(int severity, Throwable t, String message) {
- if (this.writer != null && allow(severity)) {
- this.writer.println(message);
- t.printStackTrace(this.writer);
- }
- }
-}
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/FilteredResultsMetadata.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/FilteredResultsMetadata.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/FilteredResultsMetadata.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -24,7 +24,6 @@
import java.sql.SQLException;
-import com.metamatrix.core.log.Logger;
import com.metamatrix.jdbc.api.ResultSetMetaData;
/**
@@ -33,16 +32,14 @@
private ResultSetMetaData delegate;
private int actualColumnCount;
- Logger logger;
- static FilteredResultsMetadata newInstance (ResultSetMetaData rsmd, int
actualColumnCount, Logger logger) {
- return new FilteredResultsMetadata(rsmd, actualColumnCount, logger);
+ static FilteredResultsMetadata newInstance (ResultSetMetaData rsmd, int
actualColumnCount) {
+ return new FilteredResultsMetadata(rsmd, actualColumnCount);
}
- FilteredResultsMetadata(ResultSetMetaData rsmd, int actualColumnCount, Logger logger)
{
+ FilteredResultsMetadata(ResultSetMetaData rsmd, int actualColumnCount) {
this.delegate = rsmd;
this.actualColumnCount = actualColumnCount;
- this.logger = logger;
}
public int getColumnCount() throws SQLException {
Deleted: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/JDBCLogger.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/JDBCLogger.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/JDBCLogger.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -1,102 +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 com.metamatrix.core.log.LogListener;
-import com.metamatrix.core.log.LogMessage;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
-
-
-/**
- * This is Logger used for the logging the Client side JDBC Specific log
- * messages.
- */
-class JDBCLogger implements Logger {
- static final String PLUGIN_ID = "JDBC"; //$NON-NLS-1$
-
- LogListener listener = null;
- int allowedSeverity = BaseDataSource.LOG_NONE;
- String connectonId;
-
- /**
- * ctor
- * @param severity
- * @param listener
- */
- public JDBCLogger(int severity, LogListener listener, String connId){
- this.allowedSeverity = severity;
- this.listener = listener;
- this.connectonId = connId;
- }
-
-
- /**
- * The problem is JDBC Logging levels & core MessageLevel levels and
- * IStatus logging levels all are different. Tried to minimize the code to
- * specify MessageLevel, however user configures to the JDBC level on URL, and
- * need to write in IStatus level to make use of Listeners. (what a mess)
- * @param level
- * @return true if allowed
- */
- private boolean allow(int level) {
- return (convertToJDBCLogLevel(level) <= this.allowedSeverity);
- }
-
- /**
- * Convert the message level to jdbc log level
- * @param messageLevel
- * @return jdbc level
- */
- static int convertToJDBCLogLevel(int messageLevel) {
- switch(messageLevel) {
- case MessageLevel.CRITICAL:
- case MessageLevel.ERROR:
- return BaseDataSource.LOG_ERROR;
- case MessageLevel.WARNING:
- case MessageLevel.INFO:
- return BaseDataSource.LOG_INFO;
- case MessageLevel.TRACE:
- return BaseDataSource.LOG_TRACE;
- default:
- return BaseDataSource.LOG_NONE;
- }
- }
-
- /**
- * @see com.metamatrix.core.log.Logger#log(int, java.lang.String)
- */
- public void log(int severity, String message) {
- log(severity, null, message);
- }
-
- /**
- * @see com.metamatrix.core.log.Logger#log(int, java.lang.Throwable,
java.lang.String)
- */
- public void log(int severity, Throwable t, String message) {
- if (message != null && allow(severity)) {
- LogMessage msg = new LogMessage(PLUGIN_ID, severity, t, new Object[]
{connectonId, message});
- listener.logMessage(msg);
- }
- }
-}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -43,7 +43,6 @@
import java.util.Map;
import com.metamatrix.common.util.TimestampWithTimezone;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.message.ResultsMessage;
/**
@@ -392,10 +391,7 @@
try {
return sendRequestMessageAndWait(commands, false, true, getParameterValues(),
false, isBatchedCommand);
} catch ( Throwable ex ) {
- // logging
- String msg =
JDBCPlugin.Util.getString("MMStatement.Error_executing_stmt", commands[0]);
//$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, ex, msg);
- throw MMSQLException.create(ex, msg);
+ throw MMSQLException.create(ex,
JDBCPlugin.Util.getString("MMStatement.Error_executing_stmt", commands[0]));
//$NON-NLS-1$
}
}
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-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -22,14 +22,12 @@
package com.metamatrix.jdbc;
-import java.io.File;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -49,6 +47,8 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.transaction.xa.Xid;
@@ -57,9 +57,6 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.core.log.FileLogWriter;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.jdbc.api.ExecutionProperties;
import com.metamatrix.platform.util.ProductInfoConstants;
@@ -79,19 +76,17 @@
*/
public abstract class MMConnection extends WrapperImpl implements
com.metamatrix.jdbc.api.Connection {
-
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
+
// Unique request ID generator
private long requestIDGenerator;
// url used to create the connection
private String url;
+
// properties object containing the connection properties.
protected Properties propInfo;
- private int logLevel = BaseDataSource.LOG_NONE;
- private FileLogWriter logWriter;
- private Logger logger;
-
// status of connection object
private boolean closed = false;
// determines if a statement executed should be immediately committed.
@@ -168,25 +163,9 @@
} else {
info.put(ExecutionProperties.ALLOW_DBL_QUOTED_VARIABLE,
Boolean.FALSE.toString());
}
-
- // Get the connection properties from properties object info.
- String logFile = info.getProperty(BaseDataSource.LOG_FILE);
- logLevel = readLoggingLevel(info, logLevel);
-
- if(logFile != null && logLevel > BaseDataSource.LOG_NONE){
- logWriter = new FileLogWriter(new File(logFile));
- logger = new JDBCLogger(logLevel, logWriter,
serverConn.getLogonResult().getSessionID().toString());
- }
- else {
- logger = new DriverManagerLogger(logLevel, DriverManager.getLogWriter());
- }
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMConnection.Session_success"); //$NON-NLS-1$
- logger.log(MessageLevel.INFO, logMsg);
- if (logLevel >= BaseDataSource.LOG_ERROR) {
- logConnectionProperties(url, info);
- }
+ logger.info(JDBCPlugin.Util.getString("MMConnection.Session_success"));
//$NON-NLS-1$
+ logConnectionProperties(url, info);
// properties object used in obtaining connection
this.propInfo = info;
@@ -218,7 +197,7 @@
modifiedUrl.append(";").append(connUrl.substring(endIndex));
//$NON-NLS-1$
}
}
- logger.log(MessageLevel.INFO, "Connection Url="+modifiedUrl);
//$NON-NLS-1$
+ logger.info("Connection Url="+modifiedUrl); //$NON-NLS-1$
}
// Now clone the properties object and remove password and trusted token
@@ -228,40 +207,18 @@
String key = (String)enumeration.nextElement();
Object anObj = info.get(key);
// Log each property except for password and token.
- if (!MMURL.JDBC.CREDENTIALS.equalsIgnoreCase(key) &&
!MMURL.CONNECTION.PASSWORD.equalsIgnoreCase(key) &&
!MMURL.CONNECTION.CLIENT_TOKEN_PROP.equalsIgnoreCase(key)) { //$NON-NLS-1$
- logger.log(MessageLevel.INFO, key+"="+anObj);
//$NON-NLS-1$
+ if (!MMURL.JDBC.CREDENTIALS.equalsIgnoreCase(key) &&
!MMURL.CONNECTION.PASSWORD.equalsIgnoreCase(key) &&
!MMURL.CONNECTION.CLIENT_TOKEN_PROP.equalsIgnoreCase(key)) {
+ logger.info(key+"="+anObj); //$NON-NLS-1$
}
}
}
}
-
- public static int readLoggingLevel(Properties info, int defaultValue) {
- String loggingLevel = info.getProperty(BaseDataSource.LOG_LEVEL);
- if(loggingLevel != null){
- // get the logging level, aready verified this is an integer
- return Integer.parseInt(loggingLevel);
- }
- return defaultValue;
- }
-
- public static boolean isLoggingOn(Properties info) {
- int logLevel = readLoggingLevel(info, BaseDataSource.LOG_NONE);
- return logLevel > BaseDataSource.LOG_NONE;
- }
String getUrl() {
return this.url;
}
-
+
/**
- * retun the jdbc logger
- * @return
- */
- public Logger getLogger() {
- return logger;
- }
-
- /**
* Connection identifier of this connection
* @return identifier
* @throws SQLException
@@ -319,22 +276,11 @@
throw (SQLException)firstException;
}
} catch (SQLException se) {
- String logMsg =
JDBCPlugin.Util.getString("MMConnection.Err_connection_close", se.getMessage());
//$NON-NLS-1$
- logger.log(MessageLevel.ERROR, se, logMsg);
- throw MMSQLException.create(se, logMsg);
- //throw new MMSQLException(logMsg, se);
+ throw MMSQLException.create(se,
JDBCPlugin.Util.getString("MMConnection.Err_connection_close",
se.getMessage())); //$NON-NLS-1$
} finally {
- //logging
- String logMsg =
JDBCPlugin.Util.getString("MMConnection.Connection_close_success");
//$NON-NLS-1$
- logger.log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMConnection.Connection_close_success"));
//$NON-NLS-1$
// set the status of the connection to closed
- closed = true;
-
- // close the stream after writing to it
- if(logWriter != null) {
- logWriter.shutdown();
- logWriter = null;
- }
+ closed = true;
}
}
@@ -399,7 +345,7 @@
} catch (XATransactionException e) {
throw MMSQLException.create(e);
}
- logger.log(MessageLevel.INFO,
JDBCPlugin.Util.getString("MMConnection.Commit_success")); //$NON-NLS-1$
+ logger.info(JDBCPlugin.Util.getString("MMConnection.Commit_success"));
//$NON-NLS-1$
}
private void beginLocalTxn() throws SQLException {
@@ -764,9 +710,7 @@
} catch (XATransactionException e) {
throw MMSQLException.create(e);
}
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMConnection.Rollback_success"); //$NON-NLS-1$
- logger.log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMConnection.Rollback_success"));
//$NON-NLS-1$
} finally {
if (startTxn) {
beginLocalTxn();
@@ -826,10 +770,7 @@
}
// During transaction do not allow to change this flag
if (!autoCommitFlag || this.transactionXid != null) {
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Invalid_During_Transaction",
"setReadOnly(" + readOnly + ")");//$NON-NLS-1$
//$NON-NLS-2$//$NON-NLS-3$
- MMSQLException e = new MMSQLException(logMsg);
- logger.log(MessageLevel.ERROR, e, logMsg);
- throw e;
+ throw new
MMSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_During_Transaction",
"setReadOnly(" + readOnly + ")"));//$NON-NLS-1$
//$NON-NLS-2$//$NON-NLS-3$
}
this.readOnly = readOnly;
}
@@ -842,11 +783,7 @@
void checkConnection() throws SQLException{
//Check to see the connection is closed and proceed if it is not
if (closed) {
- //logging
- String msg =
JDBCPlugin.Util.getString("MMConnection.Cant_use_closed_connection");
//$NON-NLS-1$
- MMSQLException e = new MMSQLException(msg);
- logger.log(MessageLevel.ERROR, e, msg);
- throw e;
+ throw new
MMSQLException(JDBCPlugin.Util.getString("MMConnection.Cant_use_closed_connection"));
//$NON-NLS-1$
}
}
@@ -930,7 +867,7 @@
try {
statement = createStatement();
statement.setQueryTimeout(timeout);
- statement.execute("select 1");
+ statement.execute("select 1"); //$NON-NLS-1$
return true;
} catch (SQLException e) {
return false;
@@ -949,12 +886,12 @@
//close all open statements
this.closeStatements();
} catch (SQLException e) {
- this.getLogger().log(MessageLevel.WARNING, e,
JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error")); //$NON-NLS-1$
+ logger.log(Level.WARNING,
JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e);
//$NON-NLS-1$
}
try {
//rollback if still in a transaction
if (!this.getAutoCommit()) {
- this.getLogger().log(MessageLevel.WARNING,
JDBCPlugin.Util.getString("MMXAConnection.rolling_back")); //$NON-NLS-1$
+
logger.warning(JDBCPlugin.Util.getString("MMXAConnection.rolling_back"));
//$NON-NLS-1$
if (this.getTransactionXid() == null) {
this.rollback(false);
@@ -963,7 +900,7 @@
}
}
} catch (SQLException e) {
- this.getLogger().log(MessageLevel.WARNING, e,
JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error")); //$NON-NLS-1$
+ logger.log(Level.WARNING,
JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e);
//$NON-NLS-1$
}
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -22,16 +22,11 @@
package com.metamatrix.jdbc;
-import java.io.FileWriter;
-import java.io.PrintWriter;
import java.sql.Connection;
import java.util.Properties;
import com.metamatrix.common.api.MMURL;
import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.log.NullLogger;
import com.metamatrix.jdbc.util.MMJDBCURL;
/**
@@ -101,8 +96,6 @@
private String discoveryStrategy;
- private transient Logger logger;
-
/**
* Constructor for MMDataSource.
*/
@@ -223,7 +216,6 @@
final MMDriver driver = new MMDriver();
return driver.createMMConnection(buildURL(), props);
} catch (MetaMatrixCoreException e) {
- getLogger().log(MessageLevel.CRITICAL, e, e.getMessage());
throw MMSQLException.create(e, e.getMessage());
}
}
@@ -469,30 +461,6 @@
return
JDBCPlugin.Util.getString("MMDataSource.alternateServer_is_invalid", new
String[] { "" + reasonCount, reason }); //$NON-NLS-1$ //$NON-NLS-2$
}
-
- /**
- * JDBC Logger; we create a logger once we create a connection, but if we
- * fail to make connection we need a default logger based on the set paramters
- * wish we have one place to do this.
- * @return
- */
- public Logger getLogger() {
- if (this.logger == null) {
- try {
- if (getLogFile() != null) {
- this.logger = new DriverManagerLogger(getLogLevel(), new
PrintWriter(new FileWriter(getLogFile())));
- }
- else {
- this.logger = new DriverManagerLogger(getLogLevel(),
getLogWriter());
- }
- } catch (Exception e) {
- this.logger = new NullLogger();
- }
- }
- return this.logger;
- }
-
-
/**
* @return Returns the transparentFailover.
*/
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -37,14 +37,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.logging.Logger;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.message.ResultsMessage;
import com.metamatrix.dqp.metadata.ResultsMetadataConstants;
import com.metamatrix.dqp.metadata.ResultsMetadataDefaults;
@@ -61,7 +60,7 @@
*/
public class MMDatabaseMetaData extends WrapperImpl implements
com.metamatrix.jdbc.api.DatabaseMetaData {
-
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
/** CONSTANTS */
private static final String PERCENT = "%"; //$NON-NLS-1$
@@ -360,14 +359,6 @@
}
/**
- * JDBC Logger
- * @return logger
- */
- public Logger getLogger() {
- return this.driverConnection.getLogger();
- }
-
- /**
* <p>Checks whether the current user has the required security rights to call
* all the procedures returned by the method getProcedures.</p>
* @return true if the precedures are selectable else return false
@@ -487,7 +478,7 @@
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.Best_row_sucess", table);
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(logMsg);
// construct results object from column values and their metadata
return createResultSet(records, metadataList);
@@ -515,14 +506,14 @@
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.Catalog_success"); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(logMsg);
// construct results object from column values and their metadata
return createResultSet(records, metadataList);
}
private ResultSet createResultSet(List records, Map[] columnMetadata) throws
SQLException {
- ResultSetMetaData rsmd =
ResultsMetadataWithProvider.newInstance(StaticMetadataProvider.createWithData(columnMetadata,
0, this.getLogger()), getLogger());
+ ResultSetMetaData rsmd =
ResultsMetadataWithProvider.newInstance(StaticMetadataProvider.createWithData(columnMetadata,
0));
return createResultSet(records, rsmd);
}
@@ -546,7 +537,7 @@
for (int i = 0; i < columnNames.length; i++) {
metadata[i] = getColumnMetadata(null, columnNames[i], dataTypes[i],
ResultsMetadataConstants.NULL_TYPES.UNKNOWN);
}
- return new MMResultSet(resultsMsg, stmt,
ResultsMetadataWithProvider.newInstance(StaticMetadataProvider.createWithData(metadata, 0,
getLogger()), getLogger()), 0);
+ return new MMResultSet(resultsMsg, stmt,
ResultsMetadataWithProvider.newInstance(StaticMetadataProvider.createWithData(metadata,
0)), 0);
}
private ResultsMessage createDummyResultsMessage(String[] columnNames, String[]
dataTypes, List records) {
@@ -699,17 +690,12 @@
} catch(Exception e) {
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCols_error", columnNamePattern,
tableNamePattern, e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
throw MMSQLException.create(e, logMsg);
}
- // close the resultset and driver connection
-// results.close();
-// prepareQuery.close();
-
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCols_success",
columnNamePattern, tableNamePattern); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(logMsg);
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
@@ -820,7 +806,6 @@
} catch(Exception e) {
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCrossRef_error", primaryTable,
foreignTable, e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
throw MMSQLException.create(e, logMsg);
}
@@ -828,7 +813,7 @@
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCrossRef_success",
primaryTable, foreignTable); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(logMsg);
return resultSet;
}
@@ -1007,15 +992,12 @@
} catch(Exception e) {
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getExpKey_error", table,
e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
throw MMSQLException.create(e, logMsg);
}
ResultSet resultSet = getReferenceKeys(results);
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getExpKey_success", table);
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getExpKey_success",
table));//$NON-NLS-1$
return resultSet;
}
@@ -1083,17 +1065,13 @@
// make a query against runtimemetadata and get results
results = (MMResultSet) prepareQuery.executeQuery();
} catch(Exception e) {
- // logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getImpKey_error", table,
e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
throw MMSQLException.create(e, logMsg);
}
ResultSet resultSet = getReferenceKeys(results);
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getImpKey_success", table);
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getImpKey_success",
table)); //$NON-NLS-1$
return resultSet;
}
@@ -1162,20 +1140,11 @@
rmetadata = results.getMetaData();
} catch (Exception e) {
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getIndex_error", table,
e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
- throw MMSQLException.create(e, logMsg);
+ throw MMSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getIndex_error", table,
e.getMessage())); //$NON-NLS-1$
}
- // close the results and driver connection
-// results.close();
-// prepareQuery.close();
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getIndex_success",
table)); //$NON-NLS-1$
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getIndex_success", table);
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
-
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
}
@@ -1467,20 +1436,11 @@
rmetadata = results.getMetaData();
} catch (Exception e) {
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getPrimaryKey_error", table,
e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
- throw MMSQLException.create(e, logMsg);
+ throw MMSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getPrimaryKey_error", table,
e.getMessage())); //$NON-NLS-1$
}
- // close the results and driver connection
- //results.close();
- //prepareQuery.close();
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getPrimaryKey_success"));
//$NON-NLS-1$
- // loging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getPrimaryKey_success");
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
-
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
}
@@ -1570,20 +1530,11 @@
rmetadata = results.getMetaData();
} catch (Exception e) {
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProcCol_error",
columnNamePattern, e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
- throw MMSQLException.create(e, logMsg);
+ throw MMSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProcCol_error",
columnNamePattern, e.getMessage())); //$NON-NLS-1$
}
- // close the results and driver connection
- //results.close();
- //prepareQuery.close();
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getProcCol_success",
columnNamePattern, procedureNamePattern)); //$NON-NLS-1$
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProcCol_success",
columnNamePattern, procedureNamePattern); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
-
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
}
@@ -1686,20 +1637,11 @@
rmetadata = results.getMetaData();
} catch (Exception e) {
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProc_error",
procedureNamePattern, e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
- throw MMSQLException.create(e, logMsg);
+ throw MMSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProc_error",
procedureNamePattern, e.getMessage())); //$NON-NLS-1$
}
- // close the results
- //results.close();
- //prepareQuery.close();
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getProc_success",
procedureNamePattern)); //$NON-NLS-1$
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProc_success",
procedureNamePattern); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
-
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
}
@@ -1776,20 +1718,11 @@
rmetadata = results.getMetaData();
} catch(Exception e) {
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getschema_error", e.getMessage());
//$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
- throw MMSQLException.create(e, logMsg);
+ throw MMSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getschema_error",
e.getMessage())); //$NON-NLS-1$
}
- // close the results (need to close case results exceed cursor size)
-// results.close();
-// prepareQuery.close();
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getschema_success"));
//$NON-NLS-1$
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getschema_success");
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
-
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
}
@@ -2070,10 +2003,7 @@
} catch (SQLException e) {
throw e;
} catch (Exception e) {
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getTable_error", tableNamePattern,
e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
- throw MMSQLException.create(e, logMsg);
+ throw MMSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getTable_error", tableNamePattern,
e.getMessage())); //$NON-NLS-1$
}
// close the results (need to close case results exceed cursor size)
@@ -2083,9 +2013,7 @@
// manually send out a close request is very necessary for PreparedStatement.
//prepareQuery.close();
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getTable_success",
tableNamePattern); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getTable_success",
tableNamePattern)); //$NON-NLS-1$
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
@@ -2152,9 +2080,7 @@
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.TABLE_TYPES.TABLE_TYPE,
MMJDBCSQLTypeInfo.STRING,
ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getTableType_success");
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getTableType_success"));
//$NON-NLS-1$
// construct results object from column values and their metadata
return createResultSet(records, metadataList);
@@ -2219,11 +2145,9 @@
metadataList[16] = getColumnMetadata("System.DataTypes",
JDBCColumnNames.TYPE_INFO.SQL_DATETIME_SUB, MMJDBCSQLTypeInfo.INTEGER,
ResultsMetadataConstants.NULL_TYPES.NULLABLE,
ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE,
Boolean.FALSE);//$NON-NLS-1$
metadataList[17] = getColumnMetadata("System.DataTypes",
JDBCColumnNames.TYPE_INFO.NUM_PREC_RADIX, MMJDBCSQLTypeInfo.INTEGER,
ResultsMetadataConstants.NULL_TYPES.NULLABLE,
ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE,
Boolean.FALSE);//$NON-NLS-1$
- ResultSetMetaData rmetadata =
ResultsMetadataWithProvider.newInstance(StaticMetadataProvider.createWithData(metadataList,
0, getLogger()), getLogger());
+ ResultSetMetaData rmetadata =
ResultsMetadataWithProvider.newInstance(StaticMetadataProvider.createWithData(metadataList,
0));
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getTypes_success"); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getTypes_success"));
//$NON-NLS-1$
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
@@ -2308,9 +2232,7 @@
// Method not supported, retuning empty ResultSet
ResultSet resultSet = getBestRowIdentifier(catalog, schema, table, 0, true);
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getVersionCols_success");
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getVersionCols_success"));
//$NON-NLS-1$
return resultSet;
}
@@ -3289,9 +3211,7 @@
// close the resultset and driver connection
//results.close();
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getRefKey_success");
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMDatabaseMetadata.getRefKey_success"));
//$NON-NLS-1$
// construct results object from column values and their metadata
return createResultSet(records, rmetadata);
@@ -3385,10 +3305,7 @@
return results;
} catch (Exception e) {
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getModels_error",
modelNamePattern, e.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, e, logMsg);
- throw MMSQLException.create(e, logMsg);
+ throw MMSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getModels_error",
modelNamePattern, e.getMessage())); //$NON-NLS-1$
}
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java 2009-02-26 22:08:21
UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java 2009-02-26 23:42:51
UTC (rev 517)
@@ -22,9 +22,6 @@
package com.metamatrix.jdbc;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
@@ -33,6 +30,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
+import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -43,7 +41,6 @@
import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.jdbc.api.ConnectionProperties;
import com.metamatrix.jdbc.util.MMJDBCURL;
@@ -58,7 +55,8 @@
*/
public final class MMDriver extends BaseDriver {
-
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
+
static final String JDBC = BaseDataSource.JDBC;
static final String URL_PREFIX = JDBC + BaseDataSource.METAMATRIX_PROTOCOL;
static final int MAJOR_VERSION = 5;
@@ -135,7 +133,7 @@
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDriver.Connection_sucess"); //$NON-NLS-1$
- myConnection.getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(logMsg);
return myConnection;
}
@@ -185,42 +183,8 @@
info.setProperty(BaseDataSource.VDB_VERSION, jdbcURL.getVDBVersion());
}
- if(optionalParams.containsKey(BaseDataSource.LOG_FILE)) {
- String value = optionalParams.getProperty(BaseDataSource.LOG_FILE);
- if(value != null) {
- try {
- File f = new File(value);
- boolean exists = f.exists();
- FileWriter fw = new FileWriter(f, true);
- fw.close();
- if (!exists) {
- f.delete();
- }
- } catch(IOException ioe) {
- String msg =
JDBCPlugin.Util.getString("MMDriver.Invalid_log_name", value); //$NON-NLS-1$
- throw MMSQLException.create(ioe, msg);
- //throw new MMSQLException(msg, ioe);
- }
- }
- }
- if(optionalParams.containsKey(BaseDataSource.LOG_LEVEL)) {
- try {
- int loglevel =
Integer.parseInt(optionalParams.getProperty(BaseDataSource.LOG_LEVEL));
- if(loglevel < BaseDataSource.LOG_NONE || loglevel >
BaseDataSource.LOG_TRACE) {
- Object[] params = new Object[] {new
Integer(BaseDataSource.LOG_NONE), new Integer(BaseDataSource.LOG_ERROR), new
Integer(BaseDataSource.LOG_INFO), new Integer(BaseDataSource.LOG_TRACE)};
- String msg =
JDBCPlugin.Util.getString("MMDriver.Log_level_invalid", params); //$NON-NLS-1$
- throw new MMSQLException(msg);
- }
- } catch(NumberFormatException nfe) {
- Object[] params = new Object[] {new Integer(BaseDataSource.LOG_NONE),
new Integer(BaseDataSource.LOG_ERROR), new Integer(BaseDataSource.LOG_INFO), new
Integer(BaseDataSource.LOG_TRACE)};
- String msg =
JDBCPlugin.Util.getString("MMDriver.Log_level_invalid", params); //$NON-NLS-1$
- throw MMSQLException.create(nfe, msg);
- //throw new MMSQLException(msg, nfe);
- }
- }
} catch(IllegalArgumentException iae) {
- String msg = JDBCPlugin.Util.getString("MMDriver.urlFormat");
//$NON-NLS-1$
- throw new MMSQLException(msg);
+ throw new
MMSQLException(JDBCPlugin.Util.getString("MMDriver.urlFormat")); //$NON-NLS-1$
}
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -48,6 +48,7 @@
import java.util.Map;
import java.util.TimeZone;
import java.util.TreeMap;
+import java.util.logging.Logger;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
@@ -57,7 +58,6 @@
import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.util.TimestampWithTimezone;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.dqp.client.MetadataResult;
import com.metamatrix.dqp.message.ResultsMessage;
@@ -75,7 +75,8 @@
*/
public class MMPreparedStatement extends MMStatement implements PreparedStatement {
-
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
+
// sql, which this prepared statement is operating on
protected String prepareSql;
@@ -241,9 +242,7 @@
throw ex;
}
- // logging for getting result set.
- String logMsg = JDBCPlugin.Util.getString("MMStatement.Success_query",
prepareSql); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(JDBCPlugin.Util.getString("MMStatement.Success_query",
prepareSql)); //$NON-NLS-1$
}
private void processUpdateMessage(ResultsMessage resultsMsg) throws SQLException {
@@ -280,9 +279,7 @@
//Check to see the statement is closed and throw an exception
checkStatement();
if (getMMConnection().isReadOnly()) {
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Operation_Not_Supported",
prepareSql);//$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, logMsg);
- throw new MMSQLException(logMsg);
+ throw new
MMSQLException(JDBCPlugin.Util.getString("MMStatement.Operation_Not_Supported",
prepareSql)); //$NON-NLS-1$
}
// See NOTE1
@@ -315,11 +312,9 @@
}else{
rowsAffected = resultSet.getInt(1);
}
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Success_update", prepareSql);
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMStatement.Success_update",
prepareSql)); //$NON-NLS-1$
} catch (SQLException se) {
- String msg =
JDBCPlugin.Util.getString("MMStatement.Err_getting_update_row"); //$NON-NLS-1$
- setException(MMSQLException.create(se, msg));
+ setException(MMSQLException.create(se,
JDBCPlugin.Util.getString("MMStatement.Err_getting_update_row")));
//$NON-NLS-1$
} finally {
resultSet.close();
resultSet = null;
@@ -329,10 +324,7 @@
ex = getException();
if(ex != null) {
- //logging
- String logMsg = JDBCPlugin.Util.getString("MMStatement.Err_update",
prepareSql, ex.getMessage()); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, ex, logMsg);
- throw MMSQLException.create(ex, ex.getMessage());
+ throw MMSQLException.create(ex,
JDBCPlugin.Util.getString("MMStatement.Err_update", prepareSql,
ex.getMessage())); //$NON-NLS-1$
}
}
@@ -366,8 +358,8 @@
} catch (MetaMatrixProcessingException e) {
throw MMSQLException.create(e);
}
- StaticMetadataProvider provider =
StaticMetadataProvider.createWithData(results.getColumnMetadata(),
results.getParameterCount(), getLogger());
- metadata = ResultsMetadataWithProvider.newInstance(provider,
getLogger());
+ StaticMetadataProvider provider =
StaticMetadataProvider.createWithData(results.getColumnMetadata(),
results.getParameterCount());
+ metadata = ResultsMetadataWithProvider.newInstance(provider);
}
}
@@ -768,10 +760,7 @@
try {
return sendRequestMessageAndWait(commands, true, false, isPreparedBatchUpdate?
getParameterValuesList(): getParameterValues(), false, isPreparedBatchUpdate);
} catch ( Throwable ex ) {
- // logging
- String msg =
JDBCPlugin.Util.getString("MMStatement.Error_executing_stmt", commands[0]);
//$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, ex, msg);
- throw MMSQLException.create(ex, msg);
+ throw MMSQLException.create(ex,
JDBCPlugin.Util.getString("MMStatement.Error_executing_stmt", commands[0]));
//$NON-NLS-1$
}
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -46,6 +46,7 @@
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ExecutionException;
+import java.util.logging.Logger;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -54,8 +55,6 @@
import com.metamatrix.common.types.Streamable;
import com.metamatrix.common.types.XMLType;
import com.metamatrix.common.util.TimestampWithTimezone;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.client.ResultsFuture;
import com.metamatrix.dqp.client.impl.StreamingLobChunckProducer;
import com.metamatrix.dqp.message.ResultsMessage;
@@ -71,7 +70,8 @@
*/
public class MMResultSet extends WrapperImpl implements
com.metamatrix.jdbc.api.ResultSet, BatchFetcher {
-
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
+
private static final int BEFORE_FIRST_ROW = 0;
// the object which was last read from Results
@@ -126,12 +126,10 @@
this.serverTimeZone = statement.getServerTimeZone();
if (metadata == null) {
- ResultsMetadataProvider provider = DeferredMetadataProvider
- .createWithInitialData(resultsMsg.getColumnNames(),
+ ResultsMetadataProvider provider =
DeferredMetadataProvider.createWithInitialData(resultsMsg.getColumnNames(),
resultsMsg.getDataTypes(), statement,
- statement.getCurrentRequestID(), getLogger());
- rmetadata = ResultsMetadataWithProvider.newInstance(provider,
- getLogger());
+ statement.getCurrentRequestID());
+ rmetadata = ResultsMetadataWithProvider.newInstance(provider);
} else {
rmetadata = metadata;
}
@@ -140,7 +138,7 @@
this.resultColumns = columnCount - parameters;
if (this.parameters > 0) {
- rmetadata = FilteredResultsMetadata.newInstance(rmetadata, resultColumns,
getLogger());
+ rmetadata = FilteredResultsMetadata.newInstance(rmetadata, resultColumns);
}
}
@@ -337,7 +335,7 @@
}
public Batch requestBatch(int beginRow, int endRow) throws SQLException{
- getLogger().log(MessageLevel.DETAIL, "CursorResultsImpl.requestBatch] thread
name: " + Thread.currentThread().getName() + " requestID: " + requestID +
" beginRow: " + beginRow + " endinRow: " + endRow ); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ logger.fine("CursorResultsImpl.requestBatch] thread name: " +
Thread.currentThread().getName() + " requestID: " + requestID + " beginRow:
" + beginRow + " endinRow: " + endRow ); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$
checkClosed();
try {
ResultsFuture<ResultsMessage> results =
statement.getDQP().processCursorRequest(requestID, beginRow, endRow);
@@ -1089,15 +1087,6 @@
}
/**
- * JDBC Logger
- *
- * @return logger
- */
- public Logger getLogger() {
- return this.statement.getLogger();
- }
-
- /**
* <p>
* This method returns the meta data of the result set, such as the number,
* types and properties of this resultSets columns.
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -45,6 +45,8 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
@@ -52,8 +54,6 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.SqlUtil;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.dqp.message.ParameterInfo;
import com.metamatrix.dqp.message.RequestMessage;
@@ -75,6 +75,7 @@
*/
public class MMStatement extends WrapperImpl implements Statement {
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
// State constants
protected static final int TIMED_OUT = 4;
@@ -159,9 +160,6 @@
//Map<out/inout/return param index --> index in results>
protected Map outParamIndexMap = new HashMap();
-
- // JDBC Logger
- Logger logger = null;
/**
* Factory Constructor
@@ -194,18 +192,8 @@
// silently failover to default
}
}
-
- this.logger = new RequestIdAwareLogger(this.driverConnection.getLogger());
}
- /**
- * JDBC Logger
- * @return logger
- */
- public Logger getLogger() {
- return logger;
- }
-
protected ClientSideDQP getDQP() {
return this.driverConnection.getDQP();
}
@@ -326,9 +314,7 @@
// Remove link from connection to statement
this.driverConnection.closeStatement(this);
- //logging
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Close_stmt_success"); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+
logger.info(JDBCPlugin.Util.getString("MMStatement.Close_stmt_success"));
//$NON-NLS-1$
driverConnection = null;
}
@@ -340,12 +326,7 @@
protected void checkStatement() throws SQLException {
//Check to see the connection is closed and proceed if it is not
if ( isClosed ) {
- //logging
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Stmt_closed"); //$NON-NLS-1$
- if (driverConnection != null) {
- getLogger().log(MessageLevel.INFO, logMsg);
- }
- throw new MMSQLException(logMsg);
+ throw new
MMSQLException(JDBCPlugin.Util.getString("MMStatement.Stmt_closed"));
//$NON-NLS-1$
}
}
@@ -359,7 +340,7 @@
return;
}
serverException = MMSQLException.create(exception);
- getLogger().log(MessageLevel.ERROR, exception, serverException.getMessage());
+ logger.log(Level.SEVERE, serverException.getMessage(), exception);
}
protected MMSQLException getException() {
@@ -420,10 +401,9 @@
rowsAffected = resultSet.getInt(1);
}
String logMsg =
JDBCPlugin.Util.getString("MMStatement.Success_update", commands[0]);
//$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(logMsg);
} catch (SQLException se) {
- String msg =
JDBCPlugin.Util.getString("MMStatement.Err_getting_update_row"); //$NON-NLS-1$
- setException(MMSQLException.create(se, msg));
+ setException(MMSQLException.create(se,
JDBCPlugin.Util.getString("MMStatement.Err_getting_update_row")));
//$NON-NLS-1$
}
}
}
@@ -510,9 +490,7 @@
public int executeUpdate(String sql) throws SQLException {
if (driverConnection.isReadOnly()) {
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Operation_Not_Supported",
sql);//$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, logMsg);
- throw new MMSQLException(logMsg);
+ throw new
MMSQLException(JDBCPlugin.Util.getString("MMStatement.Operation_Not_Supported",
sql)); //$NON-NLS-1$
}
String[] commands = new String[] {sql};
executeSql(commands, false);
@@ -548,9 +526,7 @@
throw this.serverException;
}
- // logging for getting query result
- String logMsg = JDBCPlugin.Util.getString("MMStatement.Success_query",
Arrays.asList(commands)); //$NON-NLS-1$
- getLogger().log(MessageLevel.INFO, logMsg);
+ logger.info(JDBCPlugin.Util.getString("MMStatement.Success_query",
Arrays.asList(commands))); //$NON-NLS-1$
}
/**
@@ -867,7 +843,7 @@
// logging
String msg =
JDBCPlugin.Util.getString("MMStatement.Error_executing_stmt", isBatchedCommand ?
"" : commands[0]); //$NON-NLS-1$ //$NON-NLS-2$
if(driverConnection != null) {
- getLogger().log(MessageLevel.ERROR, ex, msg);
+ logger.log(Level.SEVERE, msg, ex);
}
throw MMSQLException.create(ex);
}
@@ -925,8 +901,7 @@
* Ends the command and sets the status to TIMED_OUT.
*/
protected void timeoutOccurred() {
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Timeout_ocurred_in_Statement.");
//$NON-NLS-1$
- getLogger().log(MessageLevel.WARNING, logMsg);
+
logger.warning(JDBCPlugin.Util.getString("MMStatement.Timeout_ocurred_in_Statement."));
//$NON-NLS-1$
try {
cancel();
commandStatus = TIMED_OUT;
@@ -936,8 +911,7 @@
this.resultSet.close();
}
} catch (SQLException se) {
- logMsg =
JDBCPlugin.Util.getString("MMStatement.Error_timing_out."); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, se, logMsg);
+ logger.log(Level.SEVERE,
JDBCPlugin.Util.getString("MMStatement.Error_timing_out."), se); //$NON-NLS-1$
}
}
@@ -1157,10 +1131,7 @@
try {
return SqlUtil.isUpdateSql(sql);
} catch(IllegalArgumentException e) {
- // Bad sql string
- String logMsg =
JDBCPlugin.Util.getString("MMStatement.Invalid_query_type", sql); //$NON-NLS-1$
- getLogger().log(MessageLevel.ERROR, logMsg);
- throw new MMSQLException(logMsg);
+ throw new
MMSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_query_type",
sql)); //$NON-NLS-1$
}
}
@@ -1191,26 +1162,6 @@
this.defaultCalendar = cal;
}
- /**
- * A simple wrapper to grab the request id from the
- * statement.
- */
- class RequestIdAwareLogger implements Logger {
- Logger delegate = null;
- RequestIdAwareLogger(Logger sourcelogger){
- this.delegate = sourcelogger;
- }
- public void log(int severity, String message) {
- this.delegate.log(severity, convert(message));
- }
- public void log(int severity, Throwable t, String message) {
- this.delegate.log(severity, t, convert(message));
- }
- String convert(String msg){
- return "<Req="+currentRequestID+">
"+msg;//$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
public boolean isPoolable() throws SQLException {
checkStatement();
return false;
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -37,8 +37,6 @@
import javax.sql.XAConnection;
import javax.transaction.xa.XAResource;
-import com.metamatrix.core.log.Logger;
-
/**
* Implementation of XAConnection.
*/
@@ -116,14 +114,7 @@
return connection;
}
-
- public Logger getLogger() {
- if (connection == null) {
- return null;
- }
- return connection.getLogger();
- }
-
+
public synchronized void addConnectionEventListener(ConnectionEventListener listener){
if(listeners == null){
listeners = new HashSet();
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAResource.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAResource.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAResource.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -23,6 +23,8 @@
package com.metamatrix.jdbc;
import java.sql.SQLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
@@ -31,13 +33,13 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.core.log.Logger;
-import com.metamatrix.core.log.MessageLevel;
/**
* Implementation of XAResource.
*/
public class MMXAResource implements XAResource{
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc");
//$NON-NLS-1$
+
private MMXAConnection mmConnection;
private int timeOut;
@@ -48,11 +50,7 @@
public MMXAResource(MMXAConnection mmConnection){
this.mmConnection = mmConnection;
}
-
- public Logger getLogger() {
- return this.mmConnection.getLogger();
- }
-
+
/**
* @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid, boolean)
*/
@@ -66,9 +64,9 @@
}
}
- private XAException handleError(Exception e,
- String logMsg) {
- getLogger().log(MessageLevel.ERROR, e, logMsg);
+ private XAException handleError(Exception e,String logMsg) {
+ logger.log(Level.SEVERE, logMsg, e);
+
if(e instanceof MMSQLException){
Throwable ex = ((MMSQLException)e).getCause();
if(ex instanceof XAException){
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/ResultsMetadataWithProvider.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/ResultsMetadataWithProvider.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/ResultsMetadataWithProvider.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -25,7 +25,6 @@
import java.sql.SQLException;
import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
-import com.metamatrix.core.log.Logger;
import com.metamatrix.dqp.metadata.ResultsMetadataConstants;
/**
@@ -33,20 +32,18 @@
public class ResultsMetadataWithProvider extends WrapperImpl implements
com.metamatrix.jdbc.api.ResultSetMetaData {
private ResultsMetadataProvider provider;
- Logger logger;
/**
* Factory Constructor
* @param statement
* @param valueID
*/
- public static ResultsMetadataWithProvider newInstance(ResultsMetadataProvider
provider, Logger logger) {
- return new ResultsMetadataWithProvider(provider, logger);
+ public static ResultsMetadataWithProvider newInstance(ResultsMetadataProvider
provider) {
+ return new ResultsMetadataWithProvider(provider);
}
- public ResultsMetadataWithProvider(ResultsMetadataProvider provider, Logger logger)
{
+ public ResultsMetadataWithProvider(ResultsMetadataProvider provider) {
setMetadataProvider(provider);
- this.logger = logger;
}
void setMetadataProvider(ResultsMetadataProvider provider) {
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/StaticMetadataProvider.java
===================================================================
---
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/StaticMetadataProvider.java 2009-02-26
22:08:21 UTC (rev 516)
+++
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/StaticMetadataProvider.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -25,7 +25,6 @@
import java.sql.SQLException;
import java.util.Map;
-import com.metamatrix.core.log.Logger;
/**
*/
@@ -38,11 +37,10 @@
StaticMetadataProvider() {
}
- public static StaticMetadataProvider createWithData(Map[] columnMetadata, int
paramCount, Logger logger) {
+ public static StaticMetadataProvider createWithData(Map[] columnMetadata, int
paramCount) {
StaticMetadataProvider provider = null;
provider = new StaticMetadataProvider();
- provider.setLogger(logger);
provider.setData(columnMetadata);
provider.setParameterCount(paramCount);
return provider;
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -49,8 +49,6 @@
BaseDataSource.VDB_VERSION,
BaseDataSource.USER_NAME,
BaseDataSource.PASSWORD,
- BaseDataSource.LOG_FILE,
- BaseDataSource.LOG_LEVEL,
ExecutionProperties.PROP_TXN_AUTO_WRAP,
ExecutionProperties.PROP_PARTIAL_RESULTS_MODE,
ExecutionProperties.RESULT_SET_CACHE_MODE,
@@ -228,15 +226,7 @@
}
return properties.getProperty(BaseDataSource.VERSION);
}
-
- public String getLogFile() {
- return properties.getProperty(BaseDataSource.LOG_FILE);
- }
-
- public String getLogLevel() {
- return properties.getProperty(BaseDataSource.LOG_LEVEL);
- }
-
+
public String getTransactionAutowrapMode() {
return properties.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
}
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -69,8 +69,6 @@
dataSource.setDatabaseVersion(STD_DATABASE_VERSION);
dataSource.setDatabaseName(STD_DATABASE_NAME);
dataSource.setPortNumber(STD_PORT_NUMBER);
- dataSource.setLogFile(STD_LOG_FILE);
- dataSource.setLogLevel(STD_LOG_LEVEL);
dataSource.setDataSourceName(STD_DATA_SOURCE_NAME);
dataSource.setTransactionAutoWrap(STD_TXN_AUTO_WRAP);
dataSource.setPartialResultsMode(STD_PARTIAL_MODE);
@@ -91,8 +89,6 @@
return MMDataSource.reasonWhyInvalidDataSourceName(value);
} else if ( propertyName.equals("Description") ) { //$NON-NLS-1$
return MMDataSource.reasonWhyInvalidDescription(value);
- } else if ( propertyName.equals("LogFile") ) { //$NON-NLS-1$
- return MMDataSource.reasonWhyInvalidLogFile(value);
} else if ( propertyName.equals("ServerName") ) { //$NON-NLS-1$
return MMDataSource.reasonWhyInvalidServerName(value);
} else if ( propertyName.equals("TransactionAutoWrap") ) {
//$NON-NLS-1$
@@ -112,9 +108,7 @@
}
protected String getReasonWhyInvalid( final String propertyName, final int value ) {
- if ( propertyName.equals("LogLevel") ) { //$NON-NLS-1$
- return MMDataSource.reasonWhyInvalidLogLevel(value);
- } else if ( propertyName.equals("PortNumber") ) { //$NON-NLS-1$
+ if ( propertyName.equals("PortNumber") ) { //$NON-NLS-1$
return MMDataSource.reasonWhyInvalidPortNumber(value);
}
fail("Unknown property name \"" + propertyName +
"\""); //$NON-NLS-1$ //$NON-NLS-2$
@@ -144,7 +138,6 @@
public void helpTestBuildingURL( final String vdbName, final String vdbVersion,
final String serverName, final int portNumber,
final String alternateServers,
- final String logfile, final int loglevel,
final String txnAutoWrap, final String partialMode,
final int fetchSize, final boolean showPlan,
final boolean secure, final String expectedURL) {
@@ -154,8 +147,6 @@
ds.setDatabaseVersion(vdbVersion);
ds.setDatabaseName(vdbName);
ds.setPortNumber(portNumber);
- ds.setLogFile(logfile);
- ds.setLogLevel(loglevel);
ds.setFetchSize(fetchSize);
ds.setTransactionAutoWrap(txnAutoWrap);
ds.setPartialResultsMode(partialMode);
@@ -172,7 +163,6 @@
public Connection helpTestConnection( final String vdbName, final String vdbVersion,
final String serverName, final int portNumber, final
String alternateServers,
final String user, final String password,
- final String logfile, final int loglevel,
final String dataSourceName,
final String txnAutoWrap, final String partialMode,
final String configFile )
@@ -186,8 +176,6 @@
ds.setPortNumber(portNumber);
ds.setUser(user);
ds.setPassword(password);
- ds.setLogFile(logfile);
- ds.setLogLevel(loglevel);
ds.setDataSourceName(dataSourceName);
ds.setTransactionAutoWrap(txnAutoWrap);
ds.setPartialResultsMode(partialMode);
@@ -252,16 +240,6 @@
assertEquals(result,STD_PORT_NUMBER);
}
- public void testGetLogFile() {
- final String result = dataSource.getLogFile();
- assertEquals(result,STD_LOG_FILE);
- }
-
- public void testGetLogLevel() {
- final int result = dataSource.getLogLevel();
- assertEquals(result,STD_LOG_LEVEL);
- }
-
public void testGetDataSourceName() {
final String result = dataSource.getDataSourceName();
assertEquals(result,STD_DATA_SOURCE_NAME);
@@ -375,43 +353,6 @@
helpTestReasonWhyInvalid("Description", null, VALID); //$NON-NLS-1$
}
-
- public void testReasonWhyInvalidLogFile1() {
- helpTestReasonWhyInvalid("LogFile", "Valid Log File", VALID);
//$NON-NLS-1$ //$NON-NLS-2$
- }
- public void testReasonWhyInvalidLogFile2() {
- helpTestReasonWhyInvalid("LogFile", "", VALID); //$NON-NLS-1$
//$NON-NLS-2$
- }
- public void testReasonWhyInvalidLogFile3() {
- helpTestReasonWhyInvalid("LogFile", null, VALID); //$NON-NLS-1$
- }
-
-
- public void testReasonWhyInvalidLogLevel1() {
- helpTestReasonWhyInvalid("LogLevel", 0, VALID); //$NON-NLS-1$
- }
- public void testReasonWhyInvalidLogLevel2() {
- helpTestReasonWhyInvalid("LogLevel", 1, VALID); //$NON-NLS-1$
- }
- public void testReasonWhyInvalidLogLevel3() {
- helpTestReasonWhyInvalid("LogLevel", 2, VALID); //$NON-NLS-1$
- }
- public void testReasonWhyInvalidLogLevel4() {
- helpTestReasonWhyInvalid("LogLevel", 3, VALID); //$NON-NLS-1$
- }
- public void testReasonWhyInvalidLogLevel5() {
- helpTestReasonWhyInvalid("LogLevel", 4, INVALID); //$NON-NLS-1$
- }
- public void testReasonWhyInvalidLogLevel6() {
- helpTestReasonWhyInvalid("LogLevel", -1, INVALID); //$NON-NLS-1$
- }
- public void testReasonWhyInvalidLogLevel7() {
- helpTestReasonWhyInvalid("LogLevel", 300, INVALID); //$NON-NLS-1$
- }
- public void testReasonWhyInvalidLogLevel8() {
- helpTestReasonWhyInvalid("LogLevel", -300, INVALID); //$NON-NLS-1$
- }
-
public void testReasonWhyInvalidPortNumber1() {
helpTestReasonWhyInvalid("PortNumber", 1, VALID); //$NON-NLS-1$
}
@@ -559,13 +500,11 @@
final String vdbName = "vdbName"; //$NON-NLS-1$
final String vdbVersion = "1.2.3"; //$NON-NLS-1$
final int portNumber = 7001;
- final String logfile = null;
- final int loglevel = 1;
final String transactionAutoWrap = null;
final String partialMode = "true"; //$NON-NLS-1$
final boolean secure = false;
-
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,logfile,loglevel,transactionAutoWrap,
partialMode, 500, false, secure,
-
"jdbc:metamatrix:vdbName@mm://hostname:7001;fetchSize=500;logLevel=1;serverURL=mm://hostname:7001;VirtualDatabaseVersion=1.2.3;partialResultsMode=true;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
+
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap,
partialMode, 500, false, secure,
+
"jdbc:metamatrix:vdbName@mm://hostname:7001;fetchSize=500;serverURL=mm://hostname:7001;VirtualDatabaseVersion=1.2.3;partialResultsMode=true;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
}
public void testBuildingURL2() {
@@ -573,13 +512,11 @@
final String vdbName = "vdbName"; //$NON-NLS-1$
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = 7001;
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
-
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,logfile,loglevel,transactionAutoWrap,
partialMode, -1, false, secure,
-
"jdbc:metamatrix:vdbName@mm://hostname:7001;logLevel=1;serverURL=mm://hostname:7001;logFile=myLogFile;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
+
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap,
partialMode, -1, false, secure,
+
"jdbc:metamatrix:vdbName@mm://hostname:7001;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
}
public void testBuildURL3() {
@@ -587,13 +524,11 @@
final String vdbName = "vdbName"; //$NON-NLS-1$
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = 7001;
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
-
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,logfile,loglevel,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:metamatrix:vdbName@mm://hostname:7001;logLevel=1;serverURL=mm://hostname:7001;logFile=myLogFile;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap,
partialMode, -1, true, secure,
+
"jdbc:metamatrix:vdbName@mm://hostname:7001;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
}
// Test secure protocol
@@ -602,13 +537,11 @@
final String vdbName = "vdbName"; //$NON-NLS-1$
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = 7001;
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = true;
-
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,logfile,loglevel,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:metamatrix:vdbName@mms://hostname:7001;logLevel=1;serverURL=mms://hostname:7001;logFile=myLogFile;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap,
partialMode, -1, true, secure,
+
"jdbc:metamatrix:vdbName@mms://hostname:7001;serverURL=mms://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
}
/*
@@ -622,13 +555,11 @@
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = 7001;
final String alternateServers =
"hostName:7002,hostName2:7001,hostName2:7002"; //$NON-NLS-1$
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
-
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,logfile,loglevel,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:metamatrix:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;logLevel=1;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;logFile=myLogFile;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap,
partialMode, -1, true, secure,
+
"jdbc:metamatrix:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
}
/*
@@ -642,13 +573,11 @@
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = 7001;
final String alternateServers =
"hostName:7002,hostName2:7001,hostName2:7002"; //$NON-NLS-1$
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = true;
-
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,logfile,loglevel,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:metamatrix:vdbName@mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;logLevel=1;serverURL=mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;logFile=myLogFile;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap,
partialMode, -1, true, secure,
+
"jdbc:metamatrix:vdbName@mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;serverURL=mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
}
/*
@@ -663,20 +592,18 @@
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = 7001;
final String alternateServers =
"hostName:7002,hostName2,hostName2:7002"; //$NON-NLS-1$
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String transactionAutoWrap = MMDataSource.TXN_AUTO_WRAP_PESSIMISTIC;
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
-
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,logfile,loglevel,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:metamatrix:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;logLevel=1;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;logFile=myLogFile;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap,
partialMode, -1, true, secure,
+
"jdbc:metamatrix:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
}
public void testBuildURL_AdditionalProperties() {
final MMDataSource ds = new MMDataSource();
- ds.setAdditionalProperties("foo=bar;a=b");
- ds.setServerName("hostName");
- ds.setDatabaseName("vdbName");
+ ds.setAdditionalProperties("foo=bar;a=b"); //$NON-NLS-1$
+ ds.setServerName("hostName"); //$NON-NLS-1$
+ ds.setDatabaseName("vdbName"); //$NON-NLS-1$
ds.setPortNumber(1);
assertEquals("jdbc:metamatrix:vdbName@mm://hostname:1;fetchSize=2000;serverURL=mm://hostname:1;a=b;VirtualDatabaseName=vdbName;foo=bar",
ds.buildURL()); //$NON-NLS-1$
}
@@ -686,13 +613,11 @@
final String vdbName = "vdbName"; //$NON-NLS-1$
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = -1; // this is what is invalid
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String dataSourceName = null;
final String transactionAutoWrap = null;
final String configFile = UnitTestUtil.getTestDataPath() +
"/config.txt"; //$NON-NLS-1$
try {
- helpTestConnection(vdbName,vdbVersion,serverName,portNumber, null, null,
null, logfile,loglevel,dataSourceName,transactionAutoWrap,
+ helpTestConnection(vdbName,vdbVersion,serverName,portNumber, null, null,
null, dataSourceName,transactionAutoWrap,
"false", configFile); // TRUE TO OVERRIDE USERNAME &
PASSWORD //$NON-NLS-1$
fail("Unexpectedly able to connect"); //$NON-NLS-1$
} catch ( SQLException e) {
@@ -711,29 +636,15 @@
final String vdbVersion = ""; //$NON-NLS-1$
final int portNumber = 31000;
final String alternateServers = "hostName:-1"; // this is what is
invalid //$NON-NLS-1$
- final String logfile = "myLogFile"; //$NON-NLS-1$
- final int loglevel = 1;
final String dataSourceName = null;
final String transactionAutoWrap = null;
final String configFile = UnitTestUtil.getTestDataPath() +
"/config.txt"; //$NON-NLS-1$
try {
helpTestConnection(vdbName, vdbVersion, serverName, portNumber,
- alternateServers, null, null, logfile, loglevel,
- dataSourceName, transactionAutoWrap, "false", configFile);
// TRUE TO OVERRIDE USERNAME & PASSWORD
+ alternateServers, null, null, dataSourceName, transactionAutoWrap,
"false", configFile); //$NON-NLS-1$ // TRUE TO OVERRIDE USERNAME &
PASSWORD
fail("Unexpectedly able to connect"); //$NON-NLS-1$
} catch ( SQLException e) {
// this is expected!
}
}
-
- public void testSerialization() throws Exception {
- MMDataSource dataSource = new MMDataSource();
-
- assertNotNull(dataSource.getLogger());
-
- dataSource = UnitTestUtil.helpSerialize(dataSource);
-
- assertNotNull(dataSource.getLogger());
- }
-
}
\ No newline at end of file
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -113,15 +113,14 @@
public void testParseURL3() throws SQLException{
Properties p = new Properties();
-
MMDriver.getInstance().parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;txnAutoWrap=ON;partialResultsMode=YES;logFile=jdbcLogFile.log",
p); //$NON-NLS-1$
+
MMDriver.getInstance().parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;txnAutoWrap=ON;partialResultsMode=YES",
p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_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("jdbcLogFile.log"));
//$NON-NLS-1$
assertTrue(p.getProperty(MMURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302"));
//$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4"));
//$NON-NLS-1$
- assertEquals(7, p.size());
+ assertEquals(6, p.size());
}
public void testGetPropertyInfo1() throws Exception {
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -700,7 +700,6 @@
static MMStatement createMockStatement() throws SQLException {
MMStatement statement = mock(MMStatement.class);
- stub(statement.getLogger()).toReturn(mock(Logger.class));
stub(statement.getDQP()).toReturn(mock(ClientSideDQP.class));
stub(statement.getResultSetType()).toReturn(
ResultSet.TYPE_SCROLL_INSENSITIVE);
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -78,13 +78,12 @@
public void testCaseConversion() {
// Different case ------------------------------------HERE -v
----------------and HERE -v
- String URL =
"jdbc:metamatrix:bqt@mm://localhost:12345;VERSION=1;user=xyz;password=***;loglevel=1;configFile=testdata/bqt/dqp_stmt_e2e.xmi";
//$NON-NLS-1$
+ String URL =
"jdbc:metamatrix:bqt@mm://localhost:12345;VERSION=1;user=xyz;password=***;configFile=testdata/bqt/dqp_stmt_e2e.xmi";
//$NON-NLS-1$
Properties expectedProperties = new Properties();
expectedProperties.setProperty("version", "1"); //$NON-NLS-1$
//$NON-NLS-2$
expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$
//$NON-NLS-2$
expectedProperties.setProperty("password", "***");
//$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("logLevel", "1");
//$NON-NLS-1$ //$NON-NLS-2$
expectedProperties.setProperty("configFile",
"testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
MMJDBCURL url = new MMJDBCURL(URL);
assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
Modified: trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java 2009-02-26
22:08:21 UTC (rev 516)
+++ trunk/embedded/src/test/java/com/metamatrix/jdbc/TestEmbeddedDriver.java 2009-02-26
23:42:51 UTC (rev 517)
@@ -107,15 +107,13 @@
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); //$NON-NLS-1$
+
driver.parseURL("jdbc:metamatrix:BQT@/metamatrix/dqp/dqp.properties;version=4;txnAutoWrap=ON;partialResultsMode=YES;",
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());
+ assertEquals(6, p.size());
}
public void testParseURL4() throws SQLException{