[federate-commits] Federate SVN: r33 - in trunk: federate-client/src/main/java/com/metamatrix/common/comm/platform/client and 20 other directories.

federate-commits at lists.jboss.org federate-commits at lists.jboss.org
Mon Nov 24 15:53:26 EST 2008


Author: shawkins
Date: 2008-11-24 15:53:26 -0500 (Mon, 24 Nov 2008)
New Revision: 33

Removed:
   trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMServerConnection.java
   trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ReconnectingServerConnection.java
Modified:
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/transport/MultiTransportFactory.java
   trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
   trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java
   trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
   trunk/federate-client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
   trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
   trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
   trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
   trunk/federate-client/src/main/java/com/metamatrix/dqp/client/impl/ServerFacadeImpl.java
   trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java
   trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java
   trunk/federate-client/src/main/java/com/metamatrix/platform/util/ProductInfoConstants.java
   trunk/federate-client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties
   trunk/federate-client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
   trunk/federate-common-internal/src/main/java/com/metamatrix/common/api/MMURL_Properties.java
   trunk/federate-console/src/main/java/com/metamatrix/console/connections/ConnectionInfo.java
   trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
   trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/transport/LocalTransportHandler.java
   trunk/federate-server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
   trunk/federate-server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
   trunk/federate-server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
   trunk/federate-server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java
   trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java
   trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java
Log:
FEDERATE-13 - simplifying connection and productinfo property usage

Modified: trunk/federate-client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -26,7 +26,6 @@
 
 import java.util.Properties;
 
-import com.metamatrix.common.api.MMURL;
 import com.metamatrix.common.comm.exception.CommunicationException;
 import com.metamatrix.common.comm.exception.ConnectionException;
 
@@ -34,7 +33,6 @@
 	
     /**
      * Establish a connection to the server.  
-     * @param url the server
      * @param connProps The properties used by the transport to find a connection.  These 
      * properties are typically specific to the transport.
      * @return A connection, never null
@@ -42,6 +40,6 @@
      * @throws CommunicationException If an error occurs in connecting, typically due to 
      * problems with the connection properties (bad user name, bad password, bad host name, etc)
      */
-	ServerConnection createConnection(MMURL url, Properties connectionProperties) throws CommunicationException, ConnectionException;
+	ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException;
 
 }

Modified: trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -32,7 +32,6 @@
 import com.metamatrix.admin.api.exception.AdminException;
 import com.metamatrix.admin.api.server.ServerAdmin;
 import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.common.api.MMURL;
 import com.metamatrix.common.api.MMURL_Properties;
 import com.metamatrix.common.comm.api.ServerConnection;
 import com.metamatrix.common.comm.exception.CommunicationException;
@@ -157,17 +156,21 @@
                                          final char[] password,
                                          final String serverURL,
                                          final String applicationName) throws AdminException {
-    	final MMURL mmUrl = new MMURL(serverURL);
-    	
     	final Properties p = new Properties();
     	p.setProperty(MMURL_Properties.JDBC.APP_NAME, applicationName);
     	p.setProperty(MMURL_Properties.JDBC.USER_NAME, userName);
     	p.setProperty(MMURL_Properties.JDBC.PASSWORD, new String(password));
-    	p.setProperty(MMURL_Properties.CONNECTION.PRODUCT_NAME, MetaMatrixProductNames.Platform.PRODUCT_NAME);
+    	p.setProperty(MMURL_Properties.SERVER.SERVER_URL, serverURL);
+    	return createAdmin(p);
+    }
+
+	public ServerAdmin createAdmin(final Properties p)
+			throws AdminComponentException, AdminException {
+		p.setProperty(MMURL_Properties.CONNECTION.PRODUCT_NAME, MetaMatrixProductNames.Platform.PRODUCT_NAME);
     	
     	ServerConnection registry;
 		try {
-			registry = SocketServerConnectionFactory.getInstance().createConnection(mmUrl, p);
+			registry = SocketServerConnectionFactory.getInstance().createConnection(p);
 		} catch (CommunicationException e) {
 			throw new AdminComponentException(e.getMessage());
 		} catch (ConnectionException e) {

Deleted: trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ReconnectingServerConnection.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ReconnectingServerConnection.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ReconnectingServerConnection.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -1,149 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (C) 2008 Red Hat, Inc.
- * Copyright (C) 2000-2007 MetaMatrix, Inc.
- * Licensed to Red Hat, Inc. under one or more contributor 
- * license agreements.  See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- * 
- * 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.client;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import com.metamatrix.client.ExceptionUtil;
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.comm.api.ServerInstanceContext;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.platform.security.api.LogonResult;
-
-/**
- * Creates a registry that will reconnect itself on failure.
- */
-public class ReconnectingServerConnection implements ServerConnection {
-	
-	private final static int RETRY_COUNT = 3;
-	
-	final class RegistryProxy implements InvocationHandler {
-
-		public Object invoke(Object proxy, Method method, Object[] args)
-				throws Throwable {
-			try {
-				Throwable t = null;
-				for (int i = 0; i < RETRY_COUNT; i++) {
-					Object impl = null;
-		    		ServerConnection currentRegistry = getServiceRegistry();
-		    		synchronized (impls) {
-			    		impl = impls.get(proxy.getClass());
-			    		if (impl == null) {
-			        		impl = currentRegistry.getService(proxy.getClass());
-			        		impls.put(proxy.getClass(), impl);
-			    		}
-		    		}
-		
-		    		try {
-		    			method.invoke(impl, args);
-		    		} catch (InvocationTargetException e) {
-		    			if (!currentRegistry.isOpen()) {
-		    				t = e.getCause();
-		    				continue;
-		    			}
-		    			throw e.getTargetException();
-		    		}
-				}			
-				throw t;
-			} catch (Throwable t) {
-				throw ExceptionUtil.convertException(method, t);
-			}
-		}
-	}
-
-	private synchronized ServerConnection getServiceRegistry() throws CommunicationException, ConnectionException {
-		if (shutdown) {
-			throw new IllegalStateException("shutdown"); //TODO
-		}
-		if (registry == null || !registry.isOpen()) {
-			registry = SocketServerConnectionFactory.getInstance().createConnection(mmUrl, p);
-			result = registry.getLogonResult();
-			synchronized (impls) {
-				impls.clear();
-			}
-		}
-		return registry;
-	}	
-
-	private ServerConnection registry;
-	private final MMURL mmUrl;
-	private final Properties p;
-	private Map<Class, Object> impls = new HashMap<Class, Object>();
-
-	private volatile boolean shutdown;
-	private volatile ServerInstanceContext context;
-	private volatile LogonResult result;
-	
-	public ReconnectingServerConnection(MMURL mmUrl, Properties p) throws CommunicationException, ConnectionException {
-		this.mmUrl = mmUrl;
-		this.p = p;
-		this.getServiceRegistry(); //init
-	}
-
-	public ServerInstanceContext getContext() {
-		return context;
-	}
-
-	public <T> T getService(Class<T> iface) {
-		return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, new RegistryProxy());
-	}
-
-	public boolean isOpen() {
-		try {
-			return !this.shutdown && this.getServiceRegistry().isOpen();
-		} catch (CommunicationException e) {
-			return false;
-		} catch (ConnectionException e) {
-			return false;
-		}
-	}
-
-	public synchronized void shutdown() {
-		if (shutdown) {
-			return;
-		}
-		try {
-			this.getServiceRegistry().shutdown();
-		} catch (CommunicationException e) {
-			this.shutdown = true;
-		} catch (ConnectionException e) {
-			this.shutdown = true;
-		}
-		this.shutdown = true;
-	}
-
-	public LogonResult getLogonResult() {
-		return result;
-	}
-
-}

Modified: trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -32,7 +32,6 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.net.UnknownHostException;
 import java.util.Properties;
 import java.util.Timer;
 import java.util.TimerTask;
@@ -55,7 +54,6 @@
 import com.metamatrix.common.comm.exception.ConnectionException;
 import com.metamatrix.common.comm.platform.CommPlatformPlugin;
 import com.metamatrix.common.comm.platform.socket.SocketConstants;
-import com.metamatrix.common.util.NetUtils;
 import com.metamatrix.dqp.client.ClientSideDQP;
 import com.metamatrix.dqp.client.ResultsFuture;
 import com.metamatrix.platform.security.api.ILogon;
@@ -68,28 +66,11 @@
     private SocketServerInstance serverConnection;
     private LogonResult logonResult;
     private ILogon logon;
-    private Properties connProps;
     private Timer pingTimer;
     
 	public SocketServerConnection(SocketServerInstance serverConnection, Properties connProps, Timer pingTimer) throws CommunicationException, ConnectionException {
 		this.serverConnection = serverConnection;
-		this.connProps = connProps;
 		this.logon = this.getService(ILogon.class);
-        try {
-        	this.connProps.put(ProductInfoConstants.CLIENT_IP_ADDRESS, NetUtils.getHostAddress());
-        } catch (UnknownHostException err1) {
-        	this.connProps.put(ProductInfoConstants.CLIENT_IP_ADDRESS, "UnknownClientAddress"); //$NON-NLS-1$
-        }
-        
-        try {
-        	this.connProps.put(ProductInfoConstants.CLIENT_HOSTNAME, NetUtils.getHostname());
-        } catch (UnknownHostException err1) {
-        	this.connProps.put(ProductInfoConstants.CLIENT_HOSTNAME, "UnknownClientHost"); //$NON-NLS-1$
-        }
-       
-        if (!this.connProps.containsKey(MMURL_Properties.JDBC.APP_NAME)) {
-        	this.connProps.setProperty(MMURL_Properties.JDBC.APP_NAME, "JDBC API"); //$NON-NLS-1$
-        }
 
         // Log on to server
         try {

Modified: trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -24,28 +24,37 @@
 
 package com.metamatrix.common.comm.platform.socket.client;
 
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Properties;
 import java.util.Timer;
 
+import com.metamatrix.common.api.HostInfo;
 import com.metamatrix.common.api.MMURL;
 import com.metamatrix.common.api.MMURL_Properties;
+import com.metamatrix.common.api.MMURL_Properties.CONNECTION;
 import com.metamatrix.common.comm.api.ServerConnection;
 import com.metamatrix.common.comm.api.ServerConnectionFactory;
 import com.metamatrix.common.comm.exception.CommunicationException;
 import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.comm.platform.CommPlatformPlugin;
 import com.metamatrix.common.comm.platform.socket.SocketConstants;
+import com.metamatrix.common.comm.platform.socket.SocketLog;
 import com.metamatrix.common.util.MetaMatrixProductNames;
+import com.metamatrix.common.util.NetUtils;
 
 public class SocketServerConnectionFactory implements ServerConnectionFactory {
 	
 	private static SocketServerConnectionFactory INSTANCE;
 	
-	private SocketServerInstanceFactory connectionFactory = new SocketServerInstanceFactory(SocketConstants.getLog(SocketServerInstanceFactory.class.getSimpleName()), 
-            Thread.currentThread().getContextClassLoader(),
-            SocketConstants.getInputBufferSize(),
-            SocketConstants.getOutputBufferSize(),
-            SocketConstants.getConserveBandwidth());
-	
+    private SocketLog log = SocketConstants.getLog(SocketServerConnectionFactory.class.getSimpleName());
+    private ObjectChannelFactory channelFactory = new NioObjectChannelFactory(
+			SocketConstants.getConserveBandwidth(), SocketConstants
+					.getInputBufferSize(), SocketConstants
+					.getOutputBufferSize(), Thread.currentThread()
+					.getContextClassLoader());
 	private Timer pingTimer = new Timer("SocketPing", true); //$NON-NLS-1$
 	
 	public static synchronized SocketServerConnectionFactory getInstance() {
@@ -55,16 +64,67 @@
 		return INSTANCE;
 	}
 	
-	public ServerConnection createConnection(MMURL url, Properties connectionProperties) throws CommunicationException, ConnectionException {
+	SocketServerInstanceImpl establishConnection(MMURL url) throws CommunicationException {
 		
+		List<HostInfo> hostKeys = new ArrayList<HostInfo>(url.getHostInfo());
+		
+		for (int i = 0; i < hostKeys.size(); i++) {
+			HostInfo hostInfo = hostKeys.remove((int)(Math.random() * hostKeys.size()));
+			
+			SocketServerInstanceImpl serverInstance = null;
+			try {
+				serverInstance = new SocketServerInstanceImpl(hostInfo, url.isUsingSSL(), this.log, this.channelFactory);
+			} catch (IOException e) {
+				if (url.getHostInfo().size() == 1) {
+					throw hostException(hostInfo, e);
+				}
+				continue;
+			}
+			
+	        return serverInstance;
+		}
+        throw new CommunicationException(CommPlatformPlugin.Util.getString("SocketServerInstancePool.No_valid_host_available"))  ; //$NON-NLS-1$
+    }
+
+	private CommunicationException hostException(HostInfo hostInfo, IOException e) {
+		if (e instanceof UnknownHostException) {
+			return new CommunicationException(e, CommPlatformPlugin.Util.getString("SocketServerInstance.Connection_Error.Uknown_Host", hostInfo.getHostName() ) ); //$NON-NLS-1$
+		}
+		return new CommunicationException(e, CommPlatformPlugin.Util.getString("SocketServerInstance.Connection_Error.Connect_Failed", hostInfo.getHostName(), String.valueOf(hostInfo.getPortNumber()), e.getMessage() )); //$NON-NLS-1$
+	}
+	
+	/**
+	 * @param connectionProperties will be updated with additional information before logon
+	 */
+	public ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
+		
+		updateConnectionProperties(connectionProperties);
+		
+		MMURL url = new MMURL(connectionProperties.getProperty(MMURL_Properties.SERVER.SERVER_URL));
+		
+		SocketServerInstanceImpl connection = establishConnection(url);
+		
+		return new SocketServerConnection(connection, connectionProperties, pingTimer);
+	}
+
+	static void updateConnectionProperties(Properties connectionProperties) {
+		try {
+			connectionProperties.put(CONNECTION.CLIENT_IP_ADDRESS, NetUtils.getHostAddress());
+        } catch (UnknownHostException err1) {
+        	connectionProperties.put(CONNECTION.CLIENT_IP_ADDRESS, "UnknownClientAddress"); //$NON-NLS-1$
+        }
+        
+        try {
+        	connectionProperties.put(CONNECTION.CLIENT_HOSTNAME, NetUtils.getHostname());
+        } catch (UnknownHostException err1) {
+        	connectionProperties.put(CONNECTION.CLIENT_HOSTNAME, "UnknownClientHost"); //$NON-NLS-1$
+        }
+               
 		String productName = connectionProperties.getProperty(MMURL_Properties.CONNECTION.PRODUCT_NAME);
 		
 		if (MetaMatrixProductNames.Platform.PRODUCT_NAME.equalsIgnoreCase(productName)) {
-			return new ReconnectingServerConnection(url, connectionProperties);
+			connectionProperties.setProperty(MMURL_Properties.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
 		}
-		
-		SocketServerInstanceImpl connection = connectionFactory.establishConnection(url);
-		return new SocketServerConnection(connection, connectionProperties, pingTimer); 
 	}
 
 }

Modified: trunk/federate-client/src/main/java/com/metamatrix/dqp/client/impl/ServerFacadeImpl.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/dqp/client/impl/ServerFacadeImpl.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/dqp/client/impl/ServerFacadeImpl.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -39,7 +39,6 @@
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.common.api.MMURL;
 import com.metamatrix.common.comm.api.ServerConnection;
 import com.metamatrix.common.comm.api.ServerConnectionFactory;
 import com.metamatrix.common.comm.exception.CommunicationException;
@@ -82,7 +81,7 @@
     public PortableContext createSession(ConnectionInfo connectionInfo) throws MetaMatrixComponentException, MetaMatrixProcessingException {
         ServerConnectionInfo connInfo = validateConnectionInfo(connectionInfo);
         try {
-            ServerConnection conn = connectionFactory.createConnection(new MMURL(connInfo.getServerUrl()), connInfo.getConnectionProperties());
+            ServerConnection conn = connectionFactory.createConnection(connInfo.getConnectionProperties());
 
             ServerSessionContext context = new ServerSessionContext(connInfo, conn.getContext().getPortableString());
             connections.put(context, new ConnectionHolder(conn));
@@ -341,7 +340,7 @@
         }
         synchronized (holder) {
 			if (holder.getServiceRegistry() == null) {
-				holder.setServiceRegistry(connectionFactory.createConnection(new MMURL(context.getConnectionContext()), context.getConnectionProperties()));
+				holder.setServiceRegistry(connectionFactory.createConnection(context.getConnectionProperties()));
 			}
 		}
         return holder;

Modified: trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -33,7 +33,7 @@
 public final class MetaMatrixSessionID implements
                                       Serializable,
                                       Cloneable,
-                                      Comparable {
+                                      Comparable<MetaMatrixSessionID> {
 
     public final static long serialVersionUID = -7872739911360962975L;
     
@@ -71,9 +71,8 @@
      * @throws ClassCastException
      *             if the specified object's type prevents it from being compared to this instance.
      */
-    public int compareTo(Object obj) {
-        MetaMatrixSessionID that = (MetaMatrixSessionID)obj; // May throw ClassCastException
-        return (int) (this.id - that.id); //May throw NullPointerException
+    public int compareTo(MetaMatrixSessionID obj) {
+        return (int) (this.id - obj.id); //May throw NullPointerException
     }
     /**
      * Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with
@@ -91,7 +90,7 @@
 
         // Check if object can be compared to this one
         // (this includes checking for null ) ...
-        if ( this.getClass().isInstance(obj) ) {
+        if (obj instanceof MetaMatrixSessionID) {
             MetaMatrixSessionID that = (MetaMatrixSessionID)obj;
         	return this.id == that.id;
         }

Modified: trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -43,12 +43,14 @@
     private int state;
     private String product;
     private Properties productInfo;
+    private String clientIp;
+    private String clientHostname;
 
     /**
      * Master constructor, allows a MetaMatrixSessionInfo to be created with
      * any state and any timestamps.
      */
-    public MetaMatrixSessionInfo(MetaMatrixSessionID sessionID, String userName, long timeCreated, long timeStateChanged, String applicationName, int state, String clusterName, Properties productInfo, String product){
+    public MetaMatrixSessionInfo(MetaMatrixSessionID sessionID, String userName, long timeCreated, long timeStateChanged, String applicationName, int state, String clusterName, Properties productInfo, String product, String clientIp, String clientHostname){
         this.timeCreated = timeCreated;
         this.lastPingTime = timeCreated;
         this.timeStateChanged = timeStateChanged;
@@ -57,6 +59,8 @@
         this.product = product;
         this.sessionToken = new SessionToken(sessionID, clusterName, userName, productInfo);
         this.productInfo = productInfo;
+        this.clientIp = clientIp;
+        this.clientHostname = clientHostname;
     }
 
     public MetaMatrixSessionID getSessionID() {
@@ -160,4 +164,12 @@
     public Properties getProductInfo() {
     	return this.productInfo;
     }
+
+	public String getClientIp() {
+		return clientIp;
+	}
+
+	public String getClientHostname() {
+		return clientHostname;
+	}
 }

Modified: trunk/federate-client/src/main/java/com/metamatrix/platform/util/ProductInfoConstants.java
===================================================================
--- trunk/federate-client/src/main/java/com/metamatrix/platform/util/ProductInfoConstants.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/java/com/metamatrix/platform/util/ProductInfoConstants.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -29,8 +29,6 @@
 public interface ProductInfoConstants {
 
 	public static final String VIRTUAL_DB = ClientConnectionProperties.VDB_NAME;
-	public static final String VDB_VERSION = ClientConnectionProperties.VDB_VERSION; 
-    public static final String CLIENT_IP_ADDRESS = "clientIpAddress"; //$NON-NLS-1$
-    public static final String CLIENT_HOSTNAME = "clientHostName"; //$NON-NLS-1$
+	public static final String VDB_VERSION = ClientConnectionProperties.VDB_VERSION;
 
 }

Modified: trunk/federate-client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties
===================================================================
--- trunk/federate-client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties	2008-11-24 20:53:26 UTC (rev 33)
@@ -116,4 +116,6 @@
 
 ClientHeartbeat.Error_refreshing_resources=Error refreshing heartbeat resources 
 
-SSLAwareChannelHandler.channel_closed=Channel closed
\ No newline at end of file
+SSLAwareChannelHandler.channel_closed=Channel closed
+
+ReconnectingServerConnection.closed=Server connection is closed
\ No newline at end of file

Modified: trunk/federate-client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
===================================================================
--- trunk/federate-client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -27,73 +27,22 @@
  */
 package com.metamatrix.common.comm.platform.socket.client;
 
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.Properties;
-import java.util.Timer;
 
-import org.mockito.Mockito;
+import junit.framework.TestCase;
 
 import com.metamatrix.common.api.MMURL_Properties;
-import com.metamatrix.common.util.NetUtils;
-import com.metamatrix.jdbc.api.ConnectionProperties;
-import com.metamatrix.platform.security.api.ILogon;
-import com.metamatrix.platform.security.api.LogonResult;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
-import com.metamatrix.platform.util.ProductInfoConstants;
+import com.metamatrix.common.util.MetaMatrixProductNames;
 
-import junit.framework.TestCase;
-
 /**
  * <code>TestCase</case> for <code>SocketServerConnection</code>
  * @see SocketServerConnection
  * @since Westport
  */
 public class TestSocketServerConnection extends TestCase {
+	
 
 	/**
-	 * Validate that the user name property in the connection properties object is 
-	 * updated with the user name from <code>LogonResult</code> after a 
-	 * <code>SocketServerConnection</code> is established. 
-	 * 
-	 * <p>The expected results contains a fully-qualified user 
-	 * name while the initial connection properties uses the 
-	 * unqualified version of the user name.</p>
-	 * 
-	 * <p>This test case simulates what occurs when a client 
-	 * establishes a connection with a server and the user name 
-	 * provided at connection time is the unqualified user name. In 
-	 * such cases the server will attempt to resolve the 
-	 * unqualified user name to a membership domain and then use the 
-	 * fully-qualified user name in the session cache. The server 
-	 * also returns this fully-qualified user name in the 
-	 * <code>LogonResult</code> which is returned to <code>SocketServerConnection</code></p>
-	 * @throws Throwable 
-	 *  
-	 * @since Westport    
-	 */
-	public void testSocketServerConnection_PropertiesUserName() throws Throwable {
-		// an unqualified user name
-		String userName = "tuser"; //$NON-NLS-1$
-		// the user's membership domain name
-		String membershipDomainName = "test.domain"; //$NON-NLS-1$
-
-		// for our pre connection properties
-		Properties p = new Properties();
-		// put the unqualified user name in our connection properties
-		p.setProperty(MMURL_Properties.JDBC.USER_NAME, userName);
-		
-		// for our post connection properties
-		Properties e = new Properties();
-		// put the unqualified user name in our connection properties
-		e.setProperty(MMURL_Properties.JDBC.USER_NAME, userName + "@" + membershipDomainName); //$NON-NLS-1$
-       
-		LogonResult lr = this.createLogonResult(null, userName + "@" + membershipDomainName, null, 0); //$NON-NLS-1$
-		this.doTestSocketServerConnectionProperties(p, e, lr, true);
-	}
-
-	/**
 	 * Validate that the client host name and IP address property in 
 	 * the connection properties object is set after a <code>SocketServerConnection</code> 
 	 * is established. 
@@ -109,206 +58,15 @@
 	 * @since Westport    
 	 */
 	public void testSocketServerConnection_PropertiesClientHost() throws Throwable {
-		// for our pre connection properties
 		Properties p = new Properties();
+		
+		p.setProperty(MMURL_Properties.CONNECTION.PRODUCT_NAME, MetaMatrixProductNames.Platform.PRODUCT_NAME);
 
-		// for our post connection properties
-		Properties e = new Properties();
-		// the host name and IP address are expected
-        try {
-        	e.setProperty(ProductInfoConstants.CLIENT_IP_ADDRESS, NetUtils.getHostAddress());
-        } catch (UnknownHostException err1) {
-        	e.setProperty(ProductInfoConstants.CLIENT_IP_ADDRESS, "UnknownClientAddress"); //$NON-NLS-1$
-        }
-        try {
-        	e.setProperty(ProductInfoConstants.CLIENT_HOSTNAME, NetUtils.getHostname());
-        } catch (UnknownHostException err1) {
-        	e.setProperty(ProductInfoConstants.CLIENT_HOSTNAME, "UnknownClientHost"); //$NON-NLS-1$
-        }
+		SocketServerConnectionFactory.updateConnectionProperties(p);
        
-		LogonResult lr = this.createLogonResult(null, null, null, 0);
-		this.doTestSocketServerConnectionProperties(p, e, lr, true);
+		assertTrue(p.containsKey(MMURL_Properties.CONNECTION.CLIENT_HOSTNAME));
+		assertTrue(p.containsKey(MMURL_Properties.CONNECTION.CLIENT_IP_ADDRESS));
+		assertEquals(Boolean.TRUE.toString(), p.getProperty(MMURL_Properties.CONNECTION.AUTO_FAILOVER));
 	}
 
-	/**
-	 * Validate that the VDB name and version properties are being  
-	 * set in the connection properties object after a <code>SocketServerConnection</code> 
-	 * is established. 
-	 * 
-	 * <p>The expected result contains the VDB name and version for  
-	 * both DQP and non-DQP properties. The initial connection 
-	 * properties object only contains the VDB name for the non-DQP 
-	 * property and no version number is defined. It is expected that 
-	 * the connection properties will be updated to reflect the VDB 
-	 * version returned by <code>LogonResult</code> and the VDB name 
-	 * and version will be set for both DQP and non-DQP properties 
-	 * within the connection properties object.</p>
-	 * @throws Throwable 
-	 *  
-	 * @since Westport    
-	 */
-	public void testSocketServerConnection_PropertiesVdbVersion() throws Throwable {
-		// for our pre connection properties
-		Properties p = new Properties();
-		p.setProperty(ConnectionProperties.VDB_NAME, "MyVDB"); //$NON-NLS-1$
-		// for our post connection properties
-		Properties e = new Properties();
-		// the vdbName and vdbVersion are expected
-		e.setProperty(ConnectionProperties.VDB_NAME, "MyVDB"); //$NON-NLS-1$
-		e.setProperty(ConnectionProperties.VDB_VERSION, "4"); //$NON-NLS-1$
-		e.setProperty(ConnectionProperties.VDB_NAME_DQP, "MyVDB"); //$NON-NLS-1$
-		e.setProperty(ConnectionProperties.VDB_VERSION_DQP, "4"); //$NON-NLS-1$
-		// for the productInfo properties to come back from LogonResult
-		Properties pi = new Properties();
-		// the vdbName and vdbVersion need to be set
-		pi.setProperty(ProductInfoConstants.VIRTUAL_DB, "MyVDB"); //$NON-NLS-1$
-		pi.setProperty(ProductInfoConstants.VDB_VERSION, "4"); //$NON-NLS-1$
-		
-		LogonResult lr = this.createLogonResult(null, null, pi, 0);
-		this.doTestSocketServerConnectionProperties(p, e, lr, true);
-	}
-
-	/**
-	 * Creates and returns a <code>LogonResult</code> object using 
-	 * the specified parameters
-	 * 
-	 * <p>All parameters can be set to <code>null</code> if the 
-	 * contents of the <code>LogonResult</code> is not relevant.</p>
-	 *
-	 * <p>The purpose of the method is as a helper to return a fully 
-	 * constructed <code>LogonResult</code> object similar to what 
-	 * would be returned by an implementation of the <code>ILogon.logon()</code> 
-	 * method. 
-	 *
-	 * @param sessionID a session ID or <code>null</code>
-	 * @param userName a user name (either unqualified or fully-qualified) or <code>null</code>
-	 * @param productInfo a list of properties related to the target product or <code>null</code> - for example for Platform this might contain the properties for vdbName, vdbVersion, etc
-	 * @param pingInterval the client ping interval - this is usually 0 
-	 * @return A reference to a <code>LogonResult</code> object.
-	 * @see LogonResult
-	 * @since Westport
-	 */
-	private LogonResult createLogonResult(MetaMatrixSessionID sessionID, String userName, Properties productInfo, long pingInterval) {
-		Properties pi = productInfo;
-		if ( pi == null ) pi = new Properties();
-		return new LogonResult(sessionID, userName, pi, pingInterval);
-	}
-	
-	/**
-	 * Helper test method which performs the creation of actual 
-	 * values and can assert the expected values equal the actual 
-	 * values
-	 * 
-	 * <p>The method creates an instance of <code>SocketServerConnection</code> 
-	 * and provides the new instance with mock and overridden methods 
-	 * for performing its initialization.</p>
-	 * 
-	 * During normal construction of <code>SocketServerConnection</code> 
-	 * an implementation of <code>ILogon.logon()</code> is invoked.
-	 * It is not expected that this implementation is needed for 
-	 * testing <code>SocketServerConnection</code> but the 
-	 * constructor does need the result of the invocation. This result 
-	 * can be provided by <code>logonResult</code>.    
-	 * 
-	 * <p>A list of properties that represent the initial connection 
-	 * properties are used in the initialization of <code>SocketServerConnection</code>
-	 * and the expectation is that once <code>SocketServerConnection</code> 
-	 * has been initialized the initial connection properties will 
-	 * be updated to reflect status and state information found in 
-	 * <code>logonResult</code>.</p>
-	 * 
-	 * <p>If <code>shouldAssert</code> the method will compare the 
-	 * contents of <code>expectedProperties</code> to the contents 
-	 * of <code>connectionProperties</code> and <code>fail()</code>
-	 * the <code>TestCase</code> if one or more of the values in 
-	 * <code>expectedProperties</code> does not match the 
-	 * corresponding value in <code>connectionProperties</code> or 
-	 * if the value is missing from <code>connectionProperties</code>.
-	 * 
-	 * <p>If not <code>shouldAssert</code> the comparison on 
-	 * <code>expectedProperties</code> and <code>connectionProperties</code>
-	 * is still performed but instead of invoking the <code>fail()</code> 
-	 * method of the <code>TestCase</code> a report is returned 
-	 * which contains the results of the comparison.  The report is 
-	 * contained in a <code>ArrayList</code> with each failed 
-	 * property comparison contained as an entry in the <code>ArrayList</code>.
-	 * Each entry in the <code>ArrayList</code> is made up of a <code>String[]</code>
-	 * array that contains three elements.  Element <code>[0]</code> 
-	 * represents the property name while element <code>[1]</code> and 
-	 * <code>[2]</code> represent the expected and actual values 
-	 * respectively. If all expected values are accounted for and 
-	 * were returned as actual values no report will exist and the 
-	 * method will return <code>null</code>.   
-	 * 
-	 * @param connectionProperties a list of properties that represent an initial connection request
-	 * @param expectedProperties a list of properties that represent the connection properties after a connection has been established
-	 * @param logonResult a <code>LogonResult</code> object that will be returned to <code>SocketServerConnection</code> during its initialization
-	 * @param shouldAssert <code>true if the <code>TestCase</code> should fail if one or more of the expected results doesn't match the actual results
-	 * @return If <code>shouldAssert</code> is <code>true</code>, 
-	 *         <code>null</code> will be returned. Otherwise, if all 
-	 *         the expected results matched the actual results, 
-	 *         <code>null</code> will be returned.  If one or more of 
-	 *         the expected results did not match the actual results, 
-	 *         a report will be returned as an <code>ArrayList</code> 
-	 *         with each element in the list made up of 
-	 *         <code>String[]{ "propertyName", "expectedValue", "actualValue" }</code>
-	 * @throws Throwable
-	 * @see SocketServerConnection#SocketServerConnection(SocketServerInstance, Properties, Timer)
-	 * @see ILogon#logon()
-	 * @see LogonResult
-	 * @since Westport
-	 */
-	protected ArrayList<String[]> doTestSocketServerConnectionProperties(Properties connectionProperties, Properties expectedProperties, LogonResult logonResult, boolean shouldAssert) throws Throwable {
-		// a mock of LogonImpl
-		final ILogon logonImpl = Mockito.mock(ILogon.class);
-		// a mock of SocketServerInstance as it is needed by SocketServerConnection
-		SocketServerInstance ssi = Mockito.mock(SocketServerInstance.class);
-		
-		// the mock LogonImpl's logon method will always return logonResult
-		Mockito.stub(logonImpl.logon(connectionProperties)).toReturn(logonResult);
-		SocketServerConnection connection = null;
-		// get a pseudo connection making sure to pass connection props that have an unqualified user name
-		connection = new SocketServerConnection(ssi, connectionProperties, null) {
-			// we need to override the getService method so that we can return our mock LogonImpl
-			public <T> T getService(Class<T> iface) {
-				if ( iface.getName().equals(ILogon.class.getName()) ) {
-					return (T)logonImpl;
-				}
-				return null;
-			}
-		};
-
-		if ( expectedProperties != null && connectionProperties != null ) {
-			Enumeration<Object> ePropKeys = expectedProperties.keys();
-			ArrayList<String[]> errorList = new ArrayList<String[]>();
-			while ( ePropKeys.hasMoreElements() ) {
-				String eKey = (String)ePropKeys.nextElement();
-				String eValue = expectedProperties.getProperty(eKey);
-				String value = connectionProperties.getProperty(eKey);
-				if ( eValue != null && value != null ) {
-					if ( !eValue.equals(value) ) errorList.add(new String[]{eKey, eValue, value});
-				} else if ( eValue != value ) errorList.add(new String[]{eKey, eValue, value});
-			}
-			if ( errorList.size() > 0 ) {
-				String failMessage = ""; //$NON-NLS-1$
-				
-				if ( shouldAssert ) {
-					failMessage += "connectionProperties did not contain one or more of the expectedProperties:\n"; //$NON-NLS-1$
-					for ( int i = 0; i < errorList.size(); i++ ) {
-						failMessage += "   {Key: " + errorList.get(i)[0] + ", Expected: \"" + errorList.get(i)[1] + "\", Actual: \"" + errorList.get(i)[2] + "\"}\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-					}
-					failMessage = failMessage.trim();
-					fail( failMessage );
-				}
-			}
-			return errorList;
-		} else if ( expectedProperties != connectionProperties ) {
-			if ( shouldAssert ) {
-				fail("Expected and actual Properties objects failed compariosn - Possibly one of them was <null>."); //$NON-NLS-1$
-			}
-			ArrayList<String[]> errorList = new ArrayList<String[]>();
-			errorList.add( new String[]{"Properties", "expectedProperties", "connectionProperties"} ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-		}
-		return null;
-	}
 }

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -68,7 +68,7 @@
     /**
      * Factory Constructor (be sure to cast it to  MMCallableStatement)
      */
-    static MMPreparedStatement newInstance(MMConnection connection, String procedureCall, int resultSetType, int resultSetConcurrency) throws SQLException {
+    static MMCallableStatement newInstance(MMConnection connection, String procedureCall, int resultSetType, int resultSetConcurrency) throws SQLException {
         return new MMCallableStatement(connection, procedureCall, resultSetType, resultSetConcurrency);        
     }
     

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -63,6 +63,7 @@
 import com.metamatrix.dqp.client.ClientSideDQP;
 import com.metamatrix.jdbc.api.ConnectionProperties;
 import com.metamatrix.jdbc.api.ExecutionProperties;
+import com.metamatrix.platform.util.ProductInfoConstants;
 
 /**
  * <p>The Connection object represents driver's connection to the MetaMatrix embedded server.
@@ -98,7 +99,7 @@
     private boolean autoCommitFlag = true;
 
     // collection of all open statements on this connection
-    private Collection statements = new ArrayList();
+    private Collection<MMStatement> statements = new ArrayList<MMStatement>();
     // cached DatabaseMetadata
     private com.metamatrix.jdbc.api.DatabaseMetaData dbmm = null;
 
@@ -447,7 +448,7 @@
         validateResultSetConcurrency(resultSetConcurrency);
 
         // add the statement object to the map
-        Statement newStatement = MMStatement.newInstance(this, resultSetType, resultSetConcurrency);
+        MMStatement newStatement = MMStatement.newInstance(this, resultSetType, resultSetConcurrency);
         statements.add(newStatement);
 
         return newStatement;
@@ -523,51 +524,21 @@
         //Check to see the connection is open
         checkConnection();
         //get the virtual database name to which we are connected.
-
-        return (String)propInfo.get(BaseDataSource.VDB_NAME);
+
+        return this.serverConn.getLogonResult().getProductInfo(ProductInfoConstants.VIRTUAL_DB);
     }
 
     /**
-     * Get vdb version associated with this connection.
-     * @return String stands for vdb version
-     * @throws SQLException
-     */
-    String getVDBVersion() throws SQLException {
-        checkConnection();
-
-        // get the vdb version from the properties or url
-        if (propInfo.get(BaseDataSource.VDB_VERSION) != null) {
-            return (String) propInfo.get(BaseDataSource.VDB_VERSION);
-        }
-        // TODO: If no value was specified on logon, then
-        // the default value is the *newest* (aka greatest)
-        // version available, which may or may not be version 1.
-        // Need to obtain this from the server.
-        return null;
-    }
-
-    /**
      * Get's the name of the user who got this connection.
      * @return Sring object giving the user name
      * @throws SQLException if the connection is closed
      */
     String getUserName() throws SQLException {
         checkConnection();
-
-        return (String) propInfo.get(BaseDataSource.USER_NAME);
+
+        return this.serverConn.getLogonResult().getUserName();
     }
     
-    /**
-     * Get's the password of the user who got this connection.
-     * @return Sring object giving the password
-     * @throws SQLException if the connection is closed
-     */
-    String getPassword() throws SQLException {
-        checkConnection();
-
-        return (String) propInfo.get(BaseDataSource.PASSWORD);
-    }
-
     public DatabaseMetaData getMetaData() throws SQLException {
         //Check to see the connection is open
         checkConnection();
@@ -699,7 +670,7 @@
         validateSQL(sql);
         
         // add the statement object to the map
-        CallableStatement newStatement = (CallableStatement)MMCallableStatement.newInstance(this, sql, resultSetType, resultSetConcurrency);
+        MMCallableStatement newStatement = MMCallableStatement.newInstance(this, sql, resultSetType, resultSetConcurrency);
         statements.add(newStatement);
         return newStatement;
     }
@@ -748,7 +719,7 @@
         validateSQL(sql);
         
         // add the statement object to the map
-        PreparedStatement newStatement = MMPreparedStatement.newInstance(this, sql, resultSetType, resultSetConcurrency);
+        MMPreparedStatement newStatement = MMPreparedStatement.newInstance(this, sql, resultSetType, resultSetConcurrency);
         statements.add(newStatement);
         return newStatement;
     }

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -24,22 +24,22 @@
 
 package com.metamatrix.jdbc;
 
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.util.Properties;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.Properties;
+
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.api.MMURL_Properties;
+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.api.ConnectionProperties;
+import com.metamatrix.jdbc.api.ExecutionProperties;
+import com.metamatrix.jdbc.util.MMJDBCURL;
 
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.api.MMURL_Properties;
-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.api.ConnectionProperties;
-import com.metamatrix.jdbc.api.ExecutionProperties;
-import com.metamatrix.jdbc.util.MMJDBCURL;
-
 /**
  * The MetaMatrix JDBC DataSource implementation class of {@link javax.sql.DataSource} and
  * {@link javax.sql.XADataSource}.
@@ -120,13 +120,6 @@
     
     private String autoFailover;
     
-    // constant indicating server's URL
-    static final String SERVER_URL = "serverURL"; //$NON-NLS-1$
-    // constant for host part of serverURL
-    static final String HOST = MMURL_Properties.SERVER.HOST;
-    // constant for port part of serverURL
-    static final String PORT = MMURL_Properties.SERVER.PORT;
-    
     private Logger logger;
 
     /**
@@ -142,7 +135,7 @@
     protected Properties buildProperties(final String userName, final String password) {               
         Properties props = super.buildProperties(userName, password);
         
-        props.setProperty(MMDataSource.SERVER_URL,this.buildServerURL());
+        props.setProperty(MMURL_Properties.SERVER.SERVER_URL,this.buildServerURL());
         
         if ( this.alternateServers != null ) {
         	String hostList = this.serverName;
@@ -162,11 +155,6 @@
         			}
         		}
         	}
-            props.setProperty(MMDataSource.HOST, hostList );
-            props.setProperty(MMDataSource.PORT, portList );
-        } else {
-        	props.setProperty(MMDataSource.HOST, this.serverName);
-            props.setProperty(MMDataSource.PORT, String.valueOf(this.portNumber));
         }
 
         if (this.getSocketsPerVM() != null) {
@@ -174,7 +162,7 @@
         }
         
         if (this.getAutoFailover() != null) {
-            props.setProperty(ExecutionProperties.AUTO_FAILOVER, this.getAutoFailover());
+            props.setProperty(CONNECTION.AUTO_FAILOVER, this.getAutoFailover());
         }
         
         if (this.getCredentials() != null) {

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -24,35 +24,36 @@
 
 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;
-import java.sql.SQLException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.common.api.MMURL_Properties;
+import com.metamatrix.common.api.MMURL_Properties.CONNECTION;
+import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.util.ApplicationInfo;
+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.api.ExecutionProperties;
+import com.metamatrix.jdbc.transport.MultiTransportFactory;
+import com.metamatrix.jdbc.util.MMJDBCURL;
 
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.common.util.ApplicationInfo;
-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.api.ExecutionProperties;
-import com.metamatrix.jdbc.transport.MultiTransportFactory;
-import com.metamatrix.jdbc.util.MMJDBCURL;
-
 /**
  * <p> The java.sql.DriverManager class uses this class to connect to MetaMatrix.
  * The Driver Manager maintains a pool of MMDriver objects, which it could use
@@ -84,7 +85,7 @@
     
     static MultiTransportFactory CONNECTION_FACTORY = new MultiTransportFactory();
 
-    private static MMDriver singleton = new MMDriver();
+    private static MMDriver INSTANCE = new MMDriver();
         
     // Static initializer
     static {
@@ -99,7 +100,7 @@
         }
         
         try {
-            DriverManager.registerDriver(singleton);
+            DriverManager.registerDriver(INSTANCE);
         } catch(SQLException e) {
             // Logging
             String logMsg = JDBCPlugin.Util.getString("MMDriver.Err_registering", e.getMessage()); //$NON-NLS-1$
@@ -108,7 +109,7 @@
     }
 
     public static MMDriver getInstance() {
-        return singleton;
+        return INSTANCE;
     }
     
     /**
@@ -142,9 +143,9 @@
 
         try {
             // parse the URL to add it's properties to properties object
-            MMURL mmurl = parseURL(url, info);
+            parseURL(url, info);
 
-            myConnection = createMMConnection(mmurl, info);
+            myConnection = createMMConnection(url, info);
         } catch (MetaMatrixCoreException e) {
             DriverManager.println(e.getMessage());
             throw MMSQLException.create(e, e.getMessage());
@@ -158,14 +159,14 @@
         return myConnection;
     }
 
-    MMServerConnection createMMConnection(MMURL url, Properties info)
+    MMServerConnection createMMConnection(String url, Properties info)
         throws ConnectionException, CommunicationException, LogonException {
 
         String transport = setupTransport(info);
-        ServerConnection serverConn = CONNECTION_FACTORY.establishConnection(transport, url, info);
+        ServerConnection serverConn = CONNECTION_FACTORY.establishConnection(transport, info);
 
         // construct a MMConnection object.
-        MMServerConnection connection = MMServerConnection.newInstance(serverConn, info, url.getAppServerURL());
+        MMServerConnection connection = MMServerConnection.newInstance(serverConn, info, url);
         return connection;
     }
 
@@ -184,19 +185,15 @@
      * @param The properties object which is to be updated with properties in the URL.
      * @throws SQLException if the URL is not in the expected format.
      */
-    MMURL parseURL(String url, Properties info) throws SQLException {
+    static void parseURL(String url, Properties info) throws SQLException {
         if(url == null) {
             String msg = JDBCPlugin.Util.getString("MMDriver.urlFormat"); //$NON-NLS-1$
             throw new MMSQLException(msg);
         }
-        MMURL mmURL = null;
         try {
             MMJDBCURL jdbcURL = new MMJDBCURL(url);
-            mmURL = new MMURL(jdbcURL.getConnectionURL());
             info.setProperty(BaseDataSource.VDB_NAME, jdbcURL.getVDBName());
-            info.setProperty(MMDataSource.SERVER_URL, mmURL.getAppServerURL());
-            info.setProperty(MMDataSource.HOST, mmURL.getHosts());
-            info.setProperty(MMDataSource.PORT, mmURL.getPorts());
+            info.setProperty(MMURL_Properties.SERVER.SERVER_URL, jdbcURL.getConnectionURL());
             Properties optionalParams = jdbcURL.getProperties();
             MMJDBCURL.normalizeProperties(info);
             Enumeration keys = optionalParams.keys();
@@ -253,8 +250,6 @@
         }  
         
         createCredentialToken(info); 
-        
-        return mmURL;
     }
 
     /** 
@@ -264,7 +259,7 @@
      * @throws MMSQLException
      * @since 4.3
      */
-    void createCredentialToken(Properties info) throws MMSQLException {
+    static void createCredentialToken(Properties info) throws MMSQLException {
         // Handle creation of SessionToken from credentials property
         if(info.containsKey(ConnectionProperties.PROP_CREDENTIALS)) {
             // Check if both credentials AND session token are used - if so, this is an error
@@ -285,7 +280,7 @@
         }
     }
 
-	private HashMap buildCredentialMap(Properties info, String credentials) {
+	static private HashMap buildCredentialMap(Properties info, String credentials) {
 		HashMap credentialMap = new HashMap();
 		boolean defaultToLogon = false;
 		if(credentials.startsWith(ConnectionProperties.DEFAULT_TO_LOGON)) {
@@ -370,14 +365,10 @@
             driverProps.add(new DriverPropertyInfo(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD, null));
         }
         
-        if (info.getProperty(ExecutionProperties.SOCKETS_PER_VM) == null) {
-            driverProps.add(new DriverPropertyInfo(ExecutionProperties.SOCKETS_PER_VM, null));
+        if (info.getProperty(CONNECTION.AUTO_FAILOVER) == null) {
+            driverProps.add(new DriverPropertyInfo(CONNECTION.AUTO_FAILOVER, null));
         }
         
-        if (info.getProperty(ExecutionProperties.AUTO_FAILOVER) == null) {
-            driverProps.add(new DriverPropertyInfo(ExecutionProperties.AUTO_FAILOVER, null));
-        }
-        
         if (info.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS) == null) {
             driverProps.add(new DriverPropertyInfo(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS, null));
         }

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -31,7 +31,6 @@
 import com.metamatrix.admin.api.server.ServerAdmin;
 import com.metamatrix.common.comm.api.ServerConnection;
 import com.metamatrix.common.comm.platform.client.ServerAdminFactory;
-import com.metamatrix.jdbc.util.MMJDBCURL;
 
 /** 
  * @since 4.3
@@ -41,7 +40,7 @@
     // constant value giving product name
     private final static String SERVER_NAME = "MetaMatrix Enterprise"; //$NON-NLS-1$
     
-    ServerAdmin serverAdmin;
+    private ServerAdmin serverAdmin;
     
     /**
      * Factory Constructor 
@@ -62,7 +61,7 @@
      * @since 4.3
      */
     public MMServerConnection(ServerConnection serverConn, Properties info, String url) {
-        super(serverConn, info, url);        
+        super(serverConn, info, url);
     }
 
     /** 
@@ -72,10 +71,8 @@
     public synchronized Admin getAdminAPI() throws SQLException {
         try {
             if (serverAdmin == null) {
-                String serverUrl = getServerURL(getUrl());                
-                
                 ServerAdminFactory factory = ServerAdminFactory.getInstance();
-                serverAdmin = factory.createAdmin(getUserName(), getPassword().toCharArray(), serverUrl);
+                serverAdmin = factory.createAdmin(this.propInfo);
             }
         } catch(Exception e) {
         	throw MMSQLException.create(e);
@@ -94,21 +91,6 @@
         }
     }
     
-    /**
-     * MM JDBC requires a valid VDB be in the connection URL
-     * but server URL, which is used to get a serve Admin
-     * connection, fails with a full JDBC URL.
-     *
-     * @param jdbcURLString The URL for the JDBC connection.
-     * @return the URL suitable for connecting to the server
-     * Admin connection.
-     * @since 4.3
-     */
-    protected static String getServerURL(String jdbcURLString) {
-        MMJDBCURL jdbcURL = new MMJDBCURL(jdbcURLString);
-        return jdbcURL.getConnectionURL();
-    }
-
     /** 
      * @see com.metamatrix.jdbc.MMConnection#getDatabaseName()
      */

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -31,26 +31,10 @@
 
 public class WrapperImpl implements Wrapper {
 	
-	private Object proxy;
-	private Object wrappedObject;
-	
-	public WrapperImpl() {
-		this.proxy = this;
-		this.wrappedObject = null;
-	}
-	
-	public WrapperImpl(Object wrappedObject) {
-		this.wrappedObject = wrappedObject;
-	}
-
 	public boolean isWrapperFor(Class<?> iface) throws SQLException {
 		ArgCheck.isNotNull(iface);
 		
-		if (wrappedObject != null && iface.isAssignableFrom(wrappedObject.getClass())) {
-			return true;
-		}
-		
-		return iface.isAssignableFrom(proxy.getClass());
+		return iface.isInstance(this);
 	}
 
 	public <T> T unwrap(Class<T> iface) throws SQLException {
@@ -58,21 +42,7 @@
 			throw new SQLException(JDBCPlugin.Util.getString("WrapperImpl.wrong_class", iface)); //$NON-NLS-1$
 		}
 		
-		if (wrappedObject == null || !iface.isAssignableFrom(wrappedObject.getClass())) {
-			return (T)proxy;
-		}
-		
-		if (wrappedObject instanceof Wrapper) {
-			Wrapper wrapper = (Wrapper)wrappedObject;
-			if (wrapper.isWrapperFor(iface)) {
-				return wrapper.unwrap(iface);
-			}
-		}
-		return (T)wrappedObject;
+		return iface.cast(this);
 	}
 
-	public void setProxy(Object proxy) {
-		this.proxy = proxy;
-	}
-
 }

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/transport/MultiTransportFactory.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/transport/MultiTransportFactory.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/transport/MultiTransportFactory.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -29,7 +29,6 @@
 import java.util.Properties;
 
 import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.common.api.MMURL;
 import com.metamatrix.common.api.MMURL_Properties;
 import com.metamatrix.common.comm.api.ServerConnection;
 import com.metamatrix.common.comm.api.ServerConnectionFactory;
@@ -62,7 +61,7 @@
      * @throws LogonException 
      * @see com.metamatrix.common.comm.api.ServerConnectionFactory#establishConnection(java.lang.String, java.util.Properties)
      */
-    public ServerConnection establishConnection(String transport, MMURL url, Properties connProps) throws ConnectionException, CommunicationException, LogonException {
+    public ServerConnection establishConnection(String transport, Properties connProps) throws ConnectionException, CommunicationException, LogonException {
         ServerConnectionFactory handler = null;
         synchronized(handlers) {
             // Look for existing handler
@@ -83,7 +82,11 @@
         //specific to JDBC
         connProps.setProperty(MMURL_Properties.CONNECTION.PRODUCT_NAME, MetaMatrixProductNames.MetaMatrixServer.PRODUCT_NAME);
         
-        return handler.createConnection(url, connProps);
+        if (!connProps.containsKey(MMURL_Properties.JDBC.APP_NAME)) {
+        	connProps.setProperty(MMURL_Properties.JDBC.APP_NAME, "JDBC API"); //$NON-NLS-1$
+        }
+        
+        return handler.createConnection(connProps);
     }
     
     private ServerConnectionFactory createHandler(String transport) {
@@ -96,7 +99,7 @@
         } else if(transport.equals(SOCKET_TRANSPORT)) {
             return SocketServerConnectionFactory.getInstance();            
         } else {
-            throw new AssertionError();
+            throw new AssertionError("unknown transport"); //$NON-NLS-1$
         }
     }
 

Modified: trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
===================================================================
--- trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -31,6 +31,7 @@
 import java.util.Map;
 import java.util.Properties;
 
+import com.metamatrix.common.api.MMURL_Properties.CONNECTION;
 import com.metamatrix.jdbc.BaseDataSource;
 import com.metamatrix.jdbc.api.ConnectionProperties;
 import com.metamatrix.jdbc.api.ExecutionProperties;
@@ -272,7 +273,7 @@
     }
     
     public String getTransparentFailover() {
-        return properties.getProperty(ExecutionProperties.AUTO_FAILOVER);
+        return properties.getProperty(CONNECTION.AUTO_FAILOVER);
     }
     
     public String getDisableLocalTransactions() {

Modified: trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java
===================================================================
--- trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -34,6 +34,9 @@
 
 import com.metamatrix.common.comm.api.ServerConnection;
 import com.metamatrix.dqp.client.ClientSideDQP;
+import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.MetaMatrixSessionID;
+import com.metamatrix.platform.util.ProductInfoConstants;
 
 public class TestMMConnection extends TestCase {
 
@@ -46,13 +49,17 @@
         super(name);
     }
     
-    MMServerConnection getMMConnection() {
+    MMServerConnection getMMConnection() throws SQLException {
     	ServerConnection mock = mock(ServerConnection.class);
     	stub(mock.getService(ClientSideDQP.class)).toReturn(mock(ClientSideDQP.class));
     	Properties props = new Properties();
     	props.setProperty(BaseDataSource.VDB_NAME, STD_DATABASE_NAME);
     	props.setProperty(BaseDataSource.VDB_VERSION, STD_DATABASE_VERSION);
     	props.setProperty(BaseDataSource.USER_NAME, "metamatrixadmin"); //$NON-NLS-1$
+    	Properties productInfo = new Properties();
+    	productInfo.setProperty(ProductInfoConstants.VIRTUAL_DB, STD_DATABASE_NAME);
+    	productInfo.setProperty(ProductInfoConstants.VDB_VERSION, STD_DATABASE_VERSION);
+    	stub(mock.getLogonResult()).toReturn(new LogonResult(new MetaMatrixSessionID(1), "metamatrixadmin", productInfo, 1));
     	return new MMServerConnection(mock, props, serverUrl);
     }
 
@@ -64,10 +71,6 @@
         assertEquals("Actual schema is not equql to the expected one. ", STD_DATABASE_NAME, getMMConnection().getSchema()); //$NON-NLS-1$
     }
 
-    public void testGetVDBVersion() throws Exception {
-        assertEquals("Actual schema is not equql to the expected one. ", STD_DATABASE_VERSION, getMMConnection().getVDBVersion()); //$NON-NLS-1$
-    }
-
     public void testNativeSql() throws Exception {
         String sql = "SELECT * FROM BQT1.SmallA"; //$NON-NLS-1$
         assertEquals("Actual schema is not equql to the expected one. ", sql, getMMConnection().nativeSQL(sql)); //$NON-NLS-1$

Deleted: trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMServerConnection.java
===================================================================
--- trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMServerConnection.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMServerConnection.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (C) 2008 Red Hat, Inc.
- * Copyright (C) 2000-2007 MetaMatrix, Inc.
- * Licensed to Red Hat, Inc. under one or more contributor 
- * license agreements.  See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.jdbc;
-
-import java.net.URLEncoder;
-
-import junit.framework.TestCase;
-
-
-/** 
- * @since 4.3
- */
-public class TestMMServerConnection extends TestCase {
-
-    
-    public void testGetServerURL_NoProperties() {        
-        String result = MMServerConnection.getServerURL("jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401;user=ddifranco;password=mm"); //$NON-NLS-1$
-        assertEquals("mm://slwxp172:44401", result);         //$NON-NLS-1$
-    }
-
-    public void testGetServerURL_Properties() {        
-        String result = MMServerConnection.getServerURL("jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401;user=ddifranco;password=mm"); //$NON-NLS-1$
-        assertEquals("mm://slwxp172:44401", result);         //$NON-NLS-1$
-    }
-    
-    /**
-     * Test getServerURL with a valid URL and password that contains at least 
-     * one ASCII character in the range of 32 to 126 excluding the ; and = sign.
-     *
-     * @since 5.0.2
-     */
-    public void testGetServerURL_PasswordProperties() throws Exception {        
-        String result = null;
-        String srcURL = "jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401;user=ddifranco;password="; //$NON-NLS-1$
-        String password = null;
-        String tgtURL = "mm://slwxp172:44401"; //$NON-NLS-1$
-        
-
-        for ( char ch = 32; ch <= 126; ch++ ) {
-            //exclude URL reserved characters
-        	if ( ch != ';' && ch != '=' && ch != '%') {
-        		password = ch+"mm"; //$NON-NLS-1$
-        		result = MMServerConnection.getServerURL(srcURL+URLEncoder.encode(password, "UTF-8")); //$NON-NLS-1$ 
-        		assertEquals("Failed to obtain correct ServerURL when using password "+password,tgtURL, result);         //$NON-NLS-1$
-        	}
-        }
-        	
-    }
-    
-    public void testGetServerURL_2Servers() {       
-        String result = MMServerConnection.getServerURL("jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401,slabc123:12345;user=ddifranco;password=mm"); //$NON-NLS-1$
-        assertEquals("mm://slwxp172:44401,slabc123:12345", result);         //$NON-NLS-1$
-    }
-
-}

Modified: trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
===================================================================
--- trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -29,15 +29,16 @@
 import java.sql.SQLException;
 import java.util.Properties;
 
+import junit.framework.TestCase;
+
+import com.metamatrix.common.api.MMURL_Properties.CONNECTION;
 import com.metamatrix.jdbc.BaseDataSource;
 import com.metamatrix.jdbc.EmbeddedDriver;
 import com.metamatrix.jdbc.MMDriver;
 import com.metamatrix.jdbc.api.ConnectionProperties;
 import com.metamatrix.jdbc.api.ExecutionProperties;
 
-import junit.framework.TestCase;
 
-
 /** 
  * @since 4.3
  */
@@ -61,7 +62,7 @@
         expectedProperties.setProperty("logLevel", "1");
         expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi");
         expectedProperties.setProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS, "true");
-        expectedProperties.setProperty(ExecutionProperties.AUTO_FAILOVER, "false");
+        expectedProperties.setProperty(CONNECTION.AUTO_FAILOVER, "false");
         MMJDBCURL url = new MMJDBCURL(URL); //$NON-NLS-1$
         assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
         assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
@@ -311,5 +312,44 @@
 		}
 
     }
+    
+    public void testGetServerURL_NoProperties() {        
+        String result = new MMJDBCURL("jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+        assertEquals("mm://slwxp172:44401", result);         //$NON-NLS-1$
+    }
 
+    public void testGetServerURL_Properties() {        
+        String result = new MMJDBCURL("jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+        assertEquals("mm://slwxp172:44401", result);         //$NON-NLS-1$
+    }
+    
+    /**
+     * Test getServerURL with a valid URL and password that contains at least 
+     * one ASCII character in the range of 32 to 126 excluding the ; and = sign.
+     *
+     * @since 5.0.2
+     */
+    public void testGetServerURL_PasswordProperties() throws Exception {        
+        String result = null;
+        String srcURL = "jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401;user=ddifranco;password="; //$NON-NLS-1$
+        String password = null;
+        String tgtURL = "mm://slwxp172:44401"; //$NON-NLS-1$
+        
+
+        for ( char ch = 32; ch <= 126; ch++ ) {
+            //exclude URL reserved characters
+        	if ( ch != ';' && ch != '=' && ch != '%') {
+        		password = ch+"mm"; //$NON-NLS-1$
+        		result = new MMJDBCURL(srcURL+URLEncoder.encode(password, "UTF-8")).getConnectionURL(); //$NON-NLS-1$ 
+        		assertEquals("Failed to obtain correct ServerURL when using password "+password,tgtURL, result);         //$NON-NLS-1$
+        	}
+        }
+        	
+    }
+    
+    public void testGetServerURL_2Servers() {       
+        String result = new MMJDBCURL("jdbc:metamatrix:designtimecatalog at mm://slwxp172:44401,slabc123:12345;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+        assertEquals("mm://slwxp172:44401,slabc123:12345", result);         //$NON-NLS-1$
+    }
+
 }

Modified: trunk/federate-common-internal/src/main/java/com/metamatrix/common/api/MMURL_Properties.java
===================================================================
--- trunk/federate-common-internal/src/main/java/com/metamatrix/common/api/MMURL_Properties.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-common-internal/src/main/java/com/metamatrix/common/api/MMURL_Properties.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -131,12 +131,16 @@
     
     public interface CONNECTION {
     	public static final String PRODUCT_NAME = "productName"; //$NON-NLS-1$
+		public static final String CLIENT_IP_ADDRESS = "clientIpAddress"; //$NON-NLS-1$
+		public static final String CLIENT_HOSTNAME = "clientHostName"; //$NON-NLS-1$
+		/**
+		 * If true, will automatically select a new server instance after a communication exception.
+		 * @since 5.6
+		 */
+		public static final String AUTO_FAILOVER = "autoFailover";  //$NON-NLS-1$
     }
     
     public interface SERVER {
-        public static final String HOST = "host"; //$NON-NLS-1$
-        // constant for port part of serverURL
-        public static final String PORT = "port"; //$NON-NLS-1$
         public static final String SERVER_URL = "serverURL"; //$NON-NLS-1$
         
         /**

Modified: trunk/federate-console/src/main/java/com/metamatrix/console/connections/ConnectionInfo.java
===================================================================
--- trunk/federate-console/src/main/java/com/metamatrix/console/connections/ConnectionInfo.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-console/src/main/java/com/metamatrix/console/connections/ConnectionInfo.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -49,7 +49,6 @@
 import com.metamatrix.console.models.ModelManager;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.util.HashCodeUtil;
-import com.metamatrix.platform.security.api.LogonResult;
 import com.metamatrix.platform.security.api.MetaMatrixSessionID;
 
 public class ConnectionInfo {
@@ -143,17 +142,6 @@
         // until the connection can tell us which one it actually used
         connectedHost = (String) hosts.get(0);
         connectedPort = (String) ports.get(0);
-        
-        
-        //TODO-- see if mmurl.getHosts() and mmurl.getPorts() return the correct strings
-        //for host and port.
-        //But in the meantime...
-//        int delimLoc = url.indexOf("//"); //$NON-NLS-1$
-//        int colonLoc = url.indexOf(":", delimLoc); //$NON-NLS-1$
-//        host = url.substring(delimLoc + 2, colonLoc);
-//        host = host.trim();
-//        port = url.substring(colonLoc + 1);
-//        port = port.trim();
     }
 	
 	public void setUser(String user) {
@@ -320,7 +308,8 @@
         properties.setProperty(MMURL_Properties.JDBC.PASSWORD, new String(password));
         properties.setProperty(MMURL_Properties.JDBC.APP_NAME, applicationName);
         properties.setProperty(MMURL_Properties.CONNECTION.PRODUCT_NAME, MetaMatrixProductNames.Platform.PRODUCT_NAME);
-        connection = SocketServerConnectionFactory.getInstance().createConnection(mmurl, properties);
+        properties.setProperty(MMURL_Properties.SERVER.SERVER_URL, mmurl.getAppServerURL());
+        connection = SocketServerConnectionFactory.getInstance().createConnection(properties);
         ModelManager.clearServices(this);
 
         String postLoginName = connection.getLogonResult().getUserName();

Modified: trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -59,13 +59,13 @@
 public class EmbeddedConnectionFactoryImpl implements EmbeddedConnectionFactory {
     private static final int ACTIVE = 3;
     private boolean initialized = false;
-    LocalTransportHandler handler = null;    
+    private LocalTransportHandler handler = null;    
     private boolean shutdownInProgress = false;
     
     // List of Connection Listeners for the DQP
-    ArrayList connectionListeners = new ArrayList(); 
+    private ArrayList connectionListeners = new ArrayList(); 
         
-    EmbeddedConnectionListener listener = new EmbeddedConnectionListener();    
+    private EmbeddedConnectionListener listener = new EmbeddedConnectionListener();    
 
     /**
      * Factory Constructor 
@@ -91,7 +91,7 @@
             // check for the valid connection properties
             checkConnectionProperties (props);
 
-            ServerConnection serverConn = this.handler.createConnection(null, props);
+            ServerConnection serverConn = this.handler.createConnection(props);
                         
             // Should occur every time in classloader using existing attributes
             return EmbeddedConnection.newInstance(this.handler.getManager(), serverConn, props, listener);            

Modified: trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/transport/LocalTransportHandler.java
===================================================================
--- trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/transport/LocalTransportHandler.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-embedded/src/main/java/com/metamatrix/jdbc/transport/LocalTransportHandler.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -215,8 +215,7 @@
         dqpManager = manager;
     }
 
-	public ServerConnection createConnection(MMURL url,
-			final Properties connectionProperties) throws CommunicationException,
+	public ServerConnection createConnection(final Properties connectionProperties) throws CommunicationException,
 			ConnectionException {
 		initManager(connectionProperties);
         

Modified: trunk/federate-server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
===================================================================
--- trunk/federate-server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -61,6 +61,7 @@
 import com.metamatrix.admin.objects.MMSourceRequest;
 import com.metamatrix.admin.objects.MMSystem;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.api.MMURL_Properties.CONNECTION;
 import com.metamatrix.common.config.api.ComponentObject;
 import com.metamatrix.common.config.api.ComponentType;
 import com.metamatrix.common.config.api.Configuration;
@@ -1029,16 +1030,8 @@
                     session.setProductName(info.getProductName()); 
                     session.setLastPingTime(info.getLastPingTime());
                     session.setSessionState(info.getState());
-
-                    
-                    if (info.getProductInfo(ProductInfoConstants.CLIENT_IP_ADDRESS) != null) {
-                       session.setIPAddress(info.getProductInfo(ProductInfoConstants.CLIENT_IP_ADDRESS)) ;
-                    }
-                    
-                    if (info.getProductInfo(ProductInfoConstants.CLIENT_HOSTNAME) != null) {
-                        session.setHostName(info.getProductInfo(ProductInfoConstants.CLIENT_HOSTNAME)) ;
-                     }                    
-                    
+                    session.setIPAddress(info.getClientIp());
+                    session.setHostName(info.getClientHostname());
                     results.add(session);
                 }
             }

Modified: trunk/federate-server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
===================================================================
--- trunk/federate-server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -93,10 +93,7 @@
         this.server = server;
         this.workerPool = workerPool;
         if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT, SocketLog.DETAIL)) { 
-            LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, "server = " + this.server); //$NON-NLS-1$
-        }
-    	if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT, SocketLog.DETAIL)) { 
-    		LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, "binding to port:" + hostInfo.getPortNumber()); //$NON-NLS-1$
+            LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, "server = " + this.server + "binding to port:" + hostInfo.getPortNumber()); //$NON-NLS-1$ //$NON-NLS-2$
 		}
 		
 		ThreadPoolExecutor executor = new ThreadPoolExecutor(0,

Modified: trunk/federate-server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
===================================================================
--- trunk/federate-server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-server/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -46,6 +46,7 @@
 import com.metamatrix.cache.CacheConfiguration;
 import com.metamatrix.cache.CacheFactory;
 import com.metamatrix.cache.CacheConfiguration.Policy;
+import com.metamatrix.common.api.MMURL_Properties;
 import com.metamatrix.common.config.CurrentConfiguration;
 import com.metamatrix.common.config.api.Configuration;
 import com.metamatrix.common.id.dbid.DBIDGenerator;
@@ -225,6 +226,8 @@
 		ArgCheck.isNotNull(applicationName);
         ArgCheck.isNotNull(properties);
         
+        Properties productInfo = new Properties();
+        
         //
         // Authenticate user...
         // if not authenticated, this method throws exception
@@ -252,8 +255,8 @@
                 throw new SessionServiceException(e,PlatformPlugin.Util.getString("SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database_{0}_of_version_{1}", new Object[] {vdbName, vdbVersion})); //$NON-NLS-1$
             }
             // Reset product info with validated constants
-            properties.put(ProductInfoConstants.VIRTUAL_DB, vdbID.getName());
-            properties.put(ProductInfoConstants.VDB_VERSION, vdbID.getVersion());
+            productInfo.put(ProductInfoConstants.VIRTUAL_DB, vdbID.getName());
+            productInfo.put(ProductInfoConstants.VDB_VERSION, vdbID.getVersion());
         }
 
         if (sessionMaxLimit > 0 && getActiveSessionsCount() >= sessionMaxLimit) {
@@ -273,8 +276,10 @@
         										applicationName,
         										MetaMatrixSessionState.ACTIVE,
                                                 clusterName,
-        										properties,
-        										productName);
+                                                productInfo,
+        										productName, 
+        										properties.getProperty(MMURL_Properties.CONNECTION.CLIENT_IP_ADDRESS), 
+        										properties.getProperty(MMURL_Properties.CONNECTION.CLIENT_HOSTNAME));
         this.sessionCache.put(newSession.getSessionID(), newSession);
         return newSession;
 	}

Modified: trunk/federate-server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java
===================================================================
--- trunk/federate-server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -103,7 +103,7 @@
         productInfo1.put(ProductInfoConstants.VIRTUAL_DB, "vdb1"); //$NON-NLS-1$
         productInfo1.put(ProductInfoConstants.VDB_VERSION, "1");//$NON-NLS-1$
         MetaMatrixSessionInfo info1 = new MetaMatrixSessionInfo(id1, "user1", 1, 1, "app1", 1, "cluster1",  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-                                                                productInfo1, "product1"); //$NON-NLS-1$
+                                                                productInfo1, "product1", null, null); //$NON-NLS-1$
         sessions.add(info1);
 
         
@@ -112,7 +112,7 @@
         productInfo2.put(ProductInfoConstants.VIRTUAL_DB, "vdb2"); //$NON-NLS-1$
         productInfo2.put(ProductInfoConstants.VDB_VERSION, "2"); //$NON-NLS-1$
         MetaMatrixSessionInfo info2 = new MetaMatrixSessionInfo(id2, "user2", 2, 2, "app2", 2, "cluster2",  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        		productInfo2, "product2"); //$NON-NLS-1$
+        		productInfo2, "product2", null, null); //$NON-NLS-1$
         sessions.add(info2);
         
         return sessions;

Modified: trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java
===================================================================
--- trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -35,6 +35,7 @@
 
 import com.metamatrix.api.exception.security.LogonException;
 import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.api.MMURL_Properties;
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.comm.exception.CommunicationException;
 import com.metamatrix.common.comm.exception.ConnectionException;
@@ -72,11 +73,11 @@
 						"testIO", 1, 120000), null); //$NON-NLS-1$
 
 		try {
+			Properties p = new Properties();
+			p.setProperty(MMURL_Properties.SERVER.SERVER_URL, new MMURL(addr.getHostName(),
+					listener.getPort() - 1, false).getAppServerURL()); //wrong port
 			SocketServerConnectionFactory.getInstance()
-					.createConnection(
-							new MMURL(addr.getHostName(),
-									listener.getPort() - 1, false), //wrong port
-							new Properties());
+					.createConnection(p);
 			fail("exception expected"); //$NON-NLS-1$
 		} catch (CommunicationException e) {
 
@@ -137,10 +138,12 @@
 		assertEquals(0, stats.objectsWritten);
 		assertEquals(0, stats.sockets);
 
+		Properties p = new Properties();
+		p.setProperty(MMURL_Properties.SERVER.SERVER_URL, new MMURL(addr.getHostName(), listener.getPort(),
+				secure).getAppServerURL()); 
+		
 		return (SocketServerConnection) SocketServerConnectionFactory
-				.getInstance().createConnection(
-						new MMURL(addr.getHostName(), listener.getPort(),
-								secure), new Properties());
+				.getInstance().createConnection(p);
 	}
 
 	public void testSSLConnectWithNonSSLServer() throws Exception {

Modified: trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java
===================================================================
--- trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java	2008-11-24 20:35:20 UTC (rev 32)
+++ trunk/federate-server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java	2008-11-24 20:53:26 UTC (rev 33)
@@ -51,7 +51,7 @@
 
 		MetaMatrixSessionInfo resultInfo = new MetaMatrixSessionInfo(
 				new MetaMatrixSessionID(1), userName, 0, 0, applicationName, 0,
-				"bar", new Properties(), "product"); //$NON-NLS-1$ //$NON-NLS-2$
+				"bar", new Properties(), "product", null, null); //$NON-NLS-1$ //$NON-NLS-2$
 
 		Mockito.stub(ssi.createSession(userName, null, null, applicationName,
 								productName, p)).toReturn(resultInfo);




More information about the federate-commits mailing list