Author: shawkins
Date: 2009-02-26 14:44:06 -0500 (Thu, 26 Feb 2009)
New Revision: 509
Added:
trunk/client/src/main/resources/teiid-client-settings.properties
Removed:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/PrintStreamSocketLog.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketLog.java
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java
Log:
TEIID-385 removing socket log also added default teiid-client-settings.properties
Deleted:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/PrintStreamSocketLog.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/PrintStreamSocketLog.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/PrintStreamSocketLog.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -1,242 +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.comm.platform.socket;
-
-import java.io.PrintStream;
-
-/**
- * Writes log messages to a PrintStream.
- */
-public class PrintStreamSocketLog implements SocketLog{
- private PrintStream stream;
- private String staticContext;
-
- private int logLevel = SocketLog.NONE;
-
- public PrintStreamSocketLog(PrintStream stream, String staticContext, int logLevel)
{
- this.stream = stream;
- this.staticContext = staticContext;
- this.logLevel = logLevel;
- }
-
-
-
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logCritical(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logCritical(String context,
- String message) {
- if (isLogged(context, SocketLog.CRITICAL)) {
- log(SocketLog.CRITICAL, context, message);
- }
- }
-
-
-
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logCritical(java.lang.String,
java.lang.Throwable, java.lang.String)
- * @since 4.3
- */
- public void logCritical(String context,
- Throwable throwable,
- String message) {
- if (isLogged(context, SocketLog.CRITICAL)) {
- log(SocketLog.CRITICAL, context, throwable, message);
- }
- }
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logError(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logError(String context,
- String message) {
- if (isLogged(context, SocketLog.ERROR)) {
- log(SocketLog.ERROR, context, message);
- }
- }
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logError(java.lang.String,
java.lang.Throwable, java.lang.String)
- * @since 4.3
- */
- public void logError(String context,
- Throwable throwable,
- String message) {
- if (isLogged(context, SocketLog.ERROR)) {
- log(SocketLog.ERROR, context, throwable, message);
- }
- }
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logWarning(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logWarning(String context,
- String message) {
- if (isLogged(context, SocketLog.WARNING)) {
- log(SocketLog.WARNING, context, message);
- }
- }
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logWarning(java.lang.String,
java.lang.Throwable, java.lang.String)
- * @since 4.3
- */
- public void logWarning(String context,
- Throwable throwable,
- String message) {
- if (isLogged(context, SocketLog.WARNING)) {
- log(SocketLog.WARNING, context, throwable, message);
- }
- }
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logInfo(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logInfo(String context,
- String message) {
- if (isLogged(context, SocketLog.INFO)) {
- log(SocketLog.INFO, context, message);
- }
- }
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logInfo(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logInfo(String context,
- Throwable throwable,
- String message) {
- if (isLogged(context, SocketLog.INFO)) {
- log(SocketLog.INFO, context, throwable, message);
- }
- }
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logDetail(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logDetail(String context,
- String message) {
- if (isLogged(context, SocketLog.DETAIL)) {
- log(SocketLog.DETAIL, context, message);
- }
- }
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logDetail(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logDetail(String context,
- Throwable throwable,
- String message) {
- if (isLogged(context, SocketLog.DETAIL)) {
- log(SocketLog.DETAIL, context, throwable, message);
- }
- }
-
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logTrace(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logTrace(String context,
- String message) {
- if (isLogged(context, SocketLog.TRACE)) {
- log(SocketLog.TRACE, context, message);
- }
- }
- /**
- * @see
com.metamatrix.common.comm.platform.socket.SocketLog#logTrace(java.lang.String,
java.lang.String)
- * @since 4.3
- */
- public void logTrace(String context,
- Throwable throwable,
- String message) {
- if (isLogged(context, SocketLog.TRACE)) {
- log(SocketLog.TRACE, context, throwable, message);
- }
- }
-
-
- private void log(int level, String context, String message) {
- stream.print(getLogLevelString(level));
- stream.print("\t["); //$NON-NLS-1$
- stream.print(staticContext);
- stream.print("]\t"); //$NON-NLS-1$
- stream.print(context);
- stream.print("\t"); //$NON-NLS-1$
- stream.println(message);
- }
-
- private void log(int level, String context, Throwable t, String message) {
- log(level, context, message);
- t.printStackTrace(stream);
- }
-
-
-
- public boolean isLogged(String context, int level) {
- return this.logLevel >= level;
- }
-
-
- private static String getLogLevelString(int level) {
- switch(level) {
- case SocketLog.CRITICAL:
- return "CRITICAL"; //$NON-NLS-1$
- case SocketLog.ERROR:
- return "ERROR"; //$NON-NLS-1$
- case SocketLog.WARNING:
- return "WARNING"; //$NON-NLS-1$
- case SocketLog.INFO:
- return "INFO"; //$NON-NLS-1$
- case SocketLog.DETAIL:
- return "DETAIL"; //$NON-NLS-1$
- case SocketLog.TRACE:
- return "TRACE"; //$NON-NLS-1$
-
- default:
- return "NONE"; //$NON-NLS-1$
- }
- }
-
- public static int getLogLevelInt(String level) {
- if (level.equalsIgnoreCase("CRITICAL")) { //$NON-NLS-1$
- return SocketLog.CRITICAL;
- } else if (level.equalsIgnoreCase("ERROR")) { //$NON-NLS-1$
- return SocketLog.ERROR;
- } else if (level.equalsIgnoreCase("WARNING")) { //$NON-NLS-1$
- return SocketLog.WARNING;
- } else if (level.equalsIgnoreCase("INFO")) { //$NON-NLS-1$
- return SocketLog.INFO;
- } else if (level.equalsIgnoreCase("DETAIL")) { //$NON-NLS-1$
- return SocketLog.DETAIL;
- } else if (level.equalsIgnoreCase("TRACE")) { //$NON-NLS-1$
- return SocketLog.TRACE;
- } else {
- return SocketLog.NONE;
- }
- }
-}
Deleted:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketLog.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketLog.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketLog.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -1,93 +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.comm.platform.socket;
-
-/**
- * Logger used by the socket communication framework.
- */
-public interface SocketLog {
-
-
- //Message levels copied from com.metamatrix.common.log.MessageLevel
-
- /**
- * Message level value that specifies that no messages are to be recorded.
- */
- public static final int NONE = 0;
-
- /**
- * Message level value that specifies that critical messages are to be recorded.
- */
- public static final int CRITICAL = 1;
-
- /**
- * Message level value that specifies that error messages and critical
- * messages are to be recorded.
- */
- public static final int ERROR = 2;
-
- /**
- * Message level value that specifies that warning, error and critical
- * messages are to be recorded.
- */
- public static final int WARNING = 3;
-
- /**
- * Message level value that specifies that information, warning, error and critical
- * messages are to be recorded.
- */
- public static final int INFO = 4;
-
- /**
- * Message level value that specifies that detailed, information, warning, error and
critical
- * messages are to be recorded.
- */
- public static final int DETAIL = 5;
-
- /**
- * Message level value that specifies that all messages are to be recorded.
- */
- public static final int TRACE = 6;
-
-
-
- void logCritical(String context, String message);
- void logCritical(String context, Throwable throwable, String message);
-
- void logError(String context, String message);
- void logError(String context, Throwable throwable, String message);
-
- void logWarning(String context, String message);
- void logWarning(String context, Throwable throwable, String message);
-
- void logInfo(String context, String message);
- void logInfo(String context, Throwable throwable, String message);
-
- void logDetail(String context, String message);
- void logDetail(String context, Throwable throwable, String message);
-
- void logTrace(String context, String message);
- void logTrace(String context, Throwable throwable, String message);
-
- boolean isLogged(String context, int logLevel);
-}
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -49,46 +49,6 @@
* This class provides some utility methods to create ssl sockets using the
* keystores and trust stores. these are the properties required for the making the
* ssl connection
- * <p>
- * The search for the key stores is follows the path
- * MM defined properties ---> javax defined properties
- * <p/>
- * <ul>
- * <b>2-way SSL (MetaMatrix based)</b>
- * <li>-Dcom.metamatrix.ssl.keyStore (required)
- * <li>-Dcom.metamatrix.ssl.keyStorePassword (required)
- * <li>-Dcom.metamatrix.ssl.trustStore (required)
- * <li>-Dcom.metamatrix.ssl.trustStorePassword (required)
- * <li>-Dcom.metamatrix.ssl.protocol (optional;default=SSLv3)
- * <li>-Dcom.metamatrix.ssl.algorithm (optional;default=SunX509)
- * <li>-Dcom.metamatrix.ssl.keyStoreType (optional;default=JKS)
- * </ul>
- * <p/>
- * <ul>
- * <b>2-way SSL (javax based; can used where there are no conflicts in
JVM)</b>
- * <li>-Djavax.net.ssl.keyStore (required)
- * <li>-Djavax.net.ssl.keyStorePassword (required)
- * <li>-Djavax.net.ssl.trustStore (required)
- * <li>-Djavax.net.ssl.trustStorePassword (required)
- * <li>-Djavax.net.ssl.keyStoreType (optional)
- * </ul>
- * <p/>
- * <ul>
- * <b>1-way SSL (metamatrix Based)</b>
- * <li>-Dcom.metamatrix.ssl.trustStore (required)
- * <li>-Dcom.metamatrix.ssl.trustStorePassword (required)
- * <li>-Dcom.metamatrix.ssl.protocol (optional;default=SSLv3)
- * <li>-Dcom.metamatrix.ssl.algorithm (optional;default=SunX509)
- * <li>-Dcom.metamatrix.ssl.keyStoreType (optional;default=JKS)
- * </ul>
- * <p/>
- * <ul>
- * <b>1-way SSL (javax based; can used where there are no conflicts in
JVM)</b>
- * <li>-Djavax.net.ssl.trustStore (required)
- * <li>-Djavax.net.ssl.trustStorePassword (required)
- * <li>-Djavax.net.ssl.keyStoreType (optional)
- * </ul>
- *
*/
public class SocketUtil {
@@ -100,7 +60,6 @@
static final String KEYSTORE_PASSWORD =
"com.metamatrix.ssl.keyStorePassword"; //$NON-NLS-1$
static final String KEYSTORE_FILENAME = "com.metamatrix.ssl.keyStore";
//$NON-NLS-1$
- static final String DEFAULT_ALGORITHM = "SunX509"; //$NON-NLS-1$
static final String DEFAULT_KEYSTORE_PROTOCOL = "SSLv3"; //$NON-NLS-1$
static final String DEFAULT_KEYSTORE_TYPE = "JKS"; //$NON-NLS-1$
@@ -138,7 +97,7 @@
// -Dcom.metamatrix.ssl.protocol (default SSLv3)
String keystoreProtocol = props.getProperty(PROTOCOL, DEFAULT_KEYSTORE_PROTOCOL);
// -Dcom.metamatrix.ssl.algorithm (default SunX509)
- String keystoreAlgorithm = props.getProperty(KEYSTORE_ALGORITHM,
DEFAULT_ALGORITHM);
+ String keystoreAlgorithm = props.getProperty(KEYSTORE_ALGORITHM);
// -Dcom.metamatrix.ssl.trustStore (if null; keystore filename used)
String truststore = props.getProperty(TRUSTSTORE_FILENAME, keystore);
// -Dcom.metamatrix.ssl.trustStorePassword (if null; keystore password used)
@@ -206,6 +165,9 @@
String protocol) throws IOException {
try {
+ if (algorithm == null) {
+ algorithm = KeyManagerFactory.getDefaultAlgorithm();
+ }
// Configure the Keystore Manager
KeyManager[] keyManagers = null;
if (keystore != null) {
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -40,6 +40,8 @@
import java.util.TimerTask;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -52,7 +54,6 @@
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
@@ -68,7 +69,7 @@
private Map<HostInfo, SocketServerInstance> existingConnections = new
HashMap<HostInfo, SocketServerInstance>();
private SocketServerInstanceFactory connectionFactory;
private ServerDiscovery serverDiscovery;
- private SocketLog log;
+ private static Logger log = Logger.getLogger("org.teiid.client.sockets");
private boolean secure;
private Properties connProps;
@@ -82,13 +83,12 @@
public SocketServerConnection(
SocketServerInstanceFactory connectionFactory, boolean secure,
ServerDiscovery serverDiscovery, Properties connProps,
- Timer pingTimer, SocketLog log) throws CommunicationException, ConnectionException {
+ Timer pingTimer) throws CommunicationException, ConnectionException {
this.connectionFactory = connectionFactory;
this.serverDiscovery = serverDiscovery;
this.connProps = connProps;
this.secure = secure;
this.logon = this.getService(ILogon.class);
- this.log = log;
authenticate();
@@ -157,7 +157,7 @@
}
throw new
SingleInstanceCommunicationException(ex,CommPlatformPlugin.Util.getString("SocketServerInstance.Connection_Error.Connect_Failed",
hostInfo.getHostName(), String.valueOf(hostInfo.getPortNumber()), ex.getMessage()));
//$NON-NLS-1$
}
- log.logDetail("SocketServerConnection.selectServerInstance", ex,
"Unable to connect to host"); //$NON-NLS-1$ //$NON-NLS-2$
+ log.log(Level.FINE, "Unable to connect to host", ex); //$NON-NLS-1$
}
throw new
CommunicationException(CommPlatformPlugin.Util.getString("SocketServerInstancePool.No_valid_host_available",
hostCopy.toString())); //$NON-NLS-1$
}
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -38,8 +38,6 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.comm.platform.socket.Handshake;
-import com.metamatrix.common.comm.platform.socket.PrintStreamSocketLog;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.common.comm.platform.socket.SocketUtil;
import com.metamatrix.common.comm.platform.socket.SocketUtil.SSLEngineFactory;
import com.metamatrix.common.util.NetUtils;
@@ -74,7 +72,6 @@
private static SocketServerConnectionFactory INSTANCE;
- private SocketLog log;
private ObjectChannelFactory channelFactory;
private Timer pingTimer;
private Properties props;
@@ -84,7 +81,7 @@
if (INSTANCE == null) {
INSTANCE = new SocketServerConnectionFactory();
Properties props = System.getProperties();
- InputStream is =
SocketServerConnectionFactory.class.getResourceAsStream("/federate-settings.properties");
//$NON-NLS-1$
+ InputStream is =
SocketServerConnectionFactory.class.getResourceAsStream("/teiid-client-settings.properties");
//$NON-NLS-1$
if (is != null) {
props = new Properties(props);
try {
@@ -109,7 +106,6 @@
public void init(Properties props, boolean usePing) {
this.props = props;
- this.log = getLog(SocketServerConnectionFactory.class.getSimpleName());
this.pingTimer = new Timer("SocketPing", true); //$NON-NLS-1$
this.channelFactory = new NioObjectChannelFactory(
getConserveBandwidth(), getInputBufferSize(),
@@ -133,7 +129,7 @@
sslEngine = this.sslEngineFactory.getSSLEngine();
}
}
- SocketServerInstanceImpl ssii = new SocketServerInstanceImpl(info, sslEngine, this.log,
getSynchronousTTL());
+ SocketServerInstanceImpl ssii = new SocketServerInstanceImpl(info, sslEngine,
getSynchronousTTL());
ssii.connect(this.channelFactory, Handshake.HANDSHAKE_TIMEOUT);
return ssii;
}
@@ -163,7 +159,7 @@
discovery.init(url, connectionProperties);
- return new SocketServerConnection(this, url.isUsingSSL(), discovery,
connectionProperties, pingTimer, this.log);
+ return new SocketServerConnection(this, url.isUsingSSL(), discovery,
connectionProperties, pingTimer);
}
/*
@@ -196,21 +192,6 @@
return PropertiesUtils.getIntProperty(props, SOCKET_MAX_THREADS,
DEFAULT_MAX_THREADS);
}
- public SocketLog getLog(String contextName) {
- SocketLog result = new PrintStreamSocketLog(System.out, contextName,
getLogLevel());
- return result;
- }
-
- /**
- * Get the logLevel that SocketLog will use.
- * @return
- * @since 4.3
- */
- public int getLogLevel() {
- String logLevelString = props.getProperty(SOCKET_LOG_LEVEL,
DEFAULT_SOCKET_LOG_LEVEL);
- return PrintStreamSocketLog.getLogLevelInt(logLevelString);
- }
-
public int getInputBufferSize() {
return PropertiesUtils.getIntProperty(props, SOCKET_INPUT_BUFFER_SIZE,
DEFAULT_SOCKET_INPUT_BUFFER_SIZE);
}
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -38,6 +38,8 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.net.ssl.SSLEngine;
@@ -52,7 +54,6 @@
import com.metamatrix.common.comm.platform.CommPlatformPlugin;
import com.metamatrix.common.comm.platform.socket.Handshake;
import com.metamatrix.common.comm.platform.socket.ObjectChannel;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.common.comm.platform.socket.ObjectChannel.ChannelListener;
import com.metamatrix.common.comm.platform.socket.ObjectChannel.ChannelListenerFactory;
import com.metamatrix.common.util.crypto.CryptoException;
@@ -75,7 +76,7 @@
private HostInfo hostInfo;
private SSLEngine engine;
private ObjectChannel socketChannel;
- private SocketLog log;
+ private Logger log = Logger.getLogger("org.teiid.client.sockets");
private long synchTimeout;
private Cryptor cryptor;
@@ -89,9 +90,8 @@
}
- public SocketServerInstanceImpl(final HostInfo host, SSLEngine engine, SocketLog log,
long synchTimeout) {
+ public SocketServerInstanceImpl(final HostInfo host, SSLEngine engine, long
synchTimeout) {
this.hostInfo = host;
- this.log = log;
this.engine = engine;
this.synchTimeout = synchTimeout;
}
@@ -213,14 +213,14 @@
public void exceptionOccurred(Throwable e) {
if (e instanceof CommunicationException) {
if (e.getCause() instanceof InvalidClassException) {
- log.logError("SocketServerInstance.read", e, "Unknown class
or incorrect class version:"); //$NON-NLS-1$ //$NON-NLS-2$
+ log.log(Level.SEVERE, "Unknown class or incorrect class version:",
e); //$NON-NLS-1$ //$NON-NLS-2$
} else {
- log.logDetail("SocketServerInstance.read", e, "Unable to
read: socket was already closed."); //$NON-NLS-1$ //$NON-NLS-2$
+ log.log(Level.FINE, "Unable to read: socket was already closed.",
e); //$NON-NLS-1$ //$NON-NLS-2$
}
} else if (e instanceof EOFException) {
- log.logDetail("SocketServerInstance.read", e, "Unable to read:
socket was already closed."); //$NON-NLS-1$ //$NON-NLS-2$
+ log.log(Level.FINE, "Unable to read: socket was already closed.",
e); //$NON-NLS-1$ //$NON-NLS-2$
} else {
- log.logDetail("SocketServerInstance.read", e, "Unable to read:
unexpected exception"); //$NON-NLS-1$ //$NON-NLS-2$
+ log.log(Level.WARNING, "Unable to read: unexpected exception", e);
//$NON-NLS-1$ //$NON-NLS-2$
}
synchronized (this) {
@@ -242,32 +242,24 @@
}
public void receivedMessage(Object packet) {
- log.logDetail("SocketServerInstance.read", "reading");
//$NON-NLS-1$ //$NON-NLS-2$
- if (log.isLogged("SocketServerInstance.read", SocketLog.DETAIL)) {
//$NON-NLS-1$
- log.logDetail("SocketServerInstance.read", "read:" +
packet); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ log.log(Level.FINE, "reading packet"); //$NON-NLS-1$ //$NON-NLS-2$
if (packet instanceof Message) {
Message messagePacket = (Message)packet;
processAsynchronousPacket(messagePacket);
} else if (packet instanceof Handshake) {
receivedHahdshake((Handshake)packet);
} else {
- if (log.isLogged("SocketServerInstance.read", SocketLog.DETAIL)) {
//$NON-NLS-1$
- log.logDetail("SocketServerInstance.read", "packet
ignored:" + packet); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ log.log(Level.FINE, "packet ignored:" + packet); //$NON-NLS-1$
//$NON-NLS-2$
}
}
private void processAsynchronousPacket(Message message) {
Serializable messageKey = message.getMessageKey();
- if (log.isLogged("SocketServerInstance.read", SocketLog.DETAIL)) {
//$NON-NLS-1$
- log.logDetail("SocketServerInstance.read", "read asynch
message:" + message); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ log.log(Level.FINE, "read asynch message:" + messageKey); //$NON-NLS-1$
//$NON-NLS-2$
MessageListener listener = asynchronousListeners.remove(messageKey);
if (listener != null) {
listener.deliverMessage(message, messageKey);
}
- log.logDetail("SocketServerInstanceImpl.deliverMessage", "message
delivered"); //$NON-NLS-1$ //$NON-NLS-2$
}
public void shutdown() {
Added: trunk/client/src/main/resources/teiid-client-settings.properties
===================================================================
--- trunk/client/src/main/resources/teiid-client-settings.properties
(rev 0)
+++ trunk/client/src/main/resources/teiid-client-settings.properties 2009-02-26 19:44:06
UTC (rev 509)
@@ -0,0 +1,105 @@
+########################################
+# Settings file for Teiid clients
+########################################
+
+########################################
+# SSL Settings
+########################################
+
+#
+# Set the key store type. Defaults to JKS
+#
+
+com.metamatrix.ssl.keyStoreType=JKS
+
+#
+# Set the key store algorithm, defaults to
+# the system property "ssl.TrustManagerFactory.algorithm"
+#
+
+#com.metamatrix.ssl.algorithm=
+
+#
+# Set to the classpath or filesystem location of the
+# key store.
+#
+# This property is required only if performing 2-way
+# authentication that requires a specific private
+# key.
+#
+
+#com.metamatrix.ssl.keyStore=
+
+#
+# Set the key store password (not required)
+#
+
+#com.metamatrix.ssl.keyStorePassword=
+
+#
+# Set to the classpath or filesystem location of the
+# trust store.
+#
+# This property is required if performing 1-way
+# authentication that requires trust not provided
+# by the system defaults.
+#
+# Set to NONE for anonymous authentication using
+# the TLS_DH_anon_WITH_AES_128_CBC_SHA cipher suite
+#
+
+#com.metamatrix.ssl.trustStore=
+
+#
+# Set the trust store password (not required)
+#
+
+#com.metamatrix.ssl.trustStorePassword=
+
+#
+# Set the cipher protocol, defaults to SSLv3
+#
+
+com.metamatrix.ssl.protocol=SSLv3
+
+
+########################################
+# Misc Socket Configuration
+########################################
+
+#
+# Set the max number of NIO worker threads
+#
+metamatrix.sockets.max.threads=15
+
+#
+# Set the max time to live for an NIO worker thread
+#
+
+metamatrix.sockets.ttl=120000
+
+#
+# Set the max time to live for non-execution synchrnous
+# calls.
+#
+
+metamatrix.synchronous.sockets.ttl=120000
+
+#
+# Set the input buffer size
+#
+
+metamatrix.sockets.inputBufferSize=102400
+
+#
+# Set the output buffer size
+#
+
+metamatrix.sockets.outputBufferSize=102400
+
+#
+# Set to true to enable Nagle's algorithm to conserve bandwidth
+# by minimizing the number of segments that are sent.
+#
+
+metamatrix.sockets.conserveBandwidth=false
Property changes on: trunk/client/src/main/resources/teiid-client-settings.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
===================================================================
---
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -40,7 +40,6 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.common.util.crypto.NullCryptor;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.dqp.client.ResultsFuture;
@@ -130,7 +129,7 @@
};
ServerDiscovery discovery = new UrlServerDiscovery(new
MMURL("mm://host1:1,host2:2"));
try {
- new SocketServerConnection(instanceFactory, false, discovery, p, null,
Mockito.mock(SocketLog.class));
+ new SocketServerConnection(instanceFactory, false, discovery, p, null);
fail("exception expected");
} catch (CommunicationException e) {
assertEquals("No valid host available. Attempted connections to: [host1:1,
host2:2]", e.getMessage());
@@ -184,7 +183,7 @@
return instance;
}
};
- SocketServerConnection connection = new SocketServerConnection(instanceFactory, false,
discovery, p, null, Mockito.mock(SocketLog.class));
+ SocketServerConnection connection = new SocketServerConnection(instanceFactory, false,
discovery, p, null);
return connection;
}
Modified:
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java
===================================================================
---
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -39,7 +39,6 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.platform.socket.Handshake;
import com.metamatrix.common.comm.platform.socket.ObjectChannel;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.common.comm.platform.socket.ObjectChannel.ChannelListener;
import com.metamatrix.common.comm.platform.socket.ObjectChannel.ChannelListenerFactory;
import com.metamatrix.dqp.client.ResultsFuture;
@@ -81,7 +80,7 @@
private SocketServerInstanceImpl createInstance(ObjectChannelFactory channelFactory)
throws CommunicationException, IOException {
- SocketServerInstanceImpl ssii = new SocketServerInstanceImpl(new
HostInfo("foo", 1), null, Mockito.mock(SocketLog.class), 1); //$NON-NLS-1$
+ SocketServerInstanceImpl ssii = new SocketServerInstanceImpl(new
HostInfo("foo", 1), null, 1); //$NON-NLS-1$
ssii.connect(channelFactory, 1);
return ssii;
}
Modified:
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -30,7 +30,6 @@
import com.metamatrix.common.comm.platform.CommPlatformPlugin;
import com.metamatrix.common.comm.platform.socket.Handshake;
import com.metamatrix.common.comm.platform.socket.ObjectChannel;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.common.comm.platform.socket.SocketVMController;
import com.metamatrix.common.comm.platform.socket.ObjectChannel.ChannelListener;
import com.metamatrix.common.log.LogManager;
@@ -135,7 +134,7 @@
}
private void processMessagePacket(Message packet) {
- if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT,
SocketLog.DETAIL)) {
+ if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT,
MessageLevel.DETAIL)) {
LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, "processing
message:" + packet); //$NON-NLS-1$
}
workerPool.execute(new ServerWorkItem(this, packet.getMessageKey(), packet,
this.server, this.sessionService));
Modified:
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -37,13 +37,13 @@
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.comm.platform.socket.ObjectChannel;
import com.metamatrix.common.comm.platform.socket.SSLAwareChannelHandler;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.common.comm.platform.socket.SocketVMController;
import com.metamatrix.common.comm.platform.socket.ObjectChannel.ChannelListener;
import com.metamatrix.common.comm.platform.socket.ObjectChannel.ChannelListenerFactory;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.queue.WorkerPool;
import com.metamatrix.common.queue.WorkerPoolFactory;
+import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.MetaMatrixProductVersion;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
import com.metamatrix.platform.vm.controller.SocketListenerStats;
@@ -80,7 +80,7 @@
this.server = server;
this.workerPool = workerPool;
- if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT,
SocketLog.DETAIL)) {
+ if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT,
MessageLevel.DETAIL)) {
LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, "server = "
+ this.server + "binding to port:" + port); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified:
trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java 2009-02-26
18:10:59 UTC (rev 508)
+++
trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java 2009-02-26
19:44:06 UTC (rev 509)
@@ -31,7 +31,6 @@
import junit.framework.TestCase;
-import org.mockito.Mockito;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -44,7 +43,6 @@
import com.metamatrix.common.comm.api.MessageListener;
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.common.comm.platform.socket.SocketLog;
import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
import com.metamatrix.common.comm.platform.socket.client.SocketServerInstance;
import com.metamatrix.common.comm.platform.socket.client.SocketServerInstanceFactory;
@@ -215,7 +213,7 @@
return serverInstance;
}
- }, false, new UrlServerDiscovery(new MMURL("foo", 1, false)), new
Properties(), null, Mockito.mock(SocketLog.class)); //$NON-NLS-1$
+ }, false, new UrlServerDiscovery(new MMURL("foo", 1, false)), new
Properties(), null); //$NON-NLS-1$
return connection;
}