[teiid-commits] teiid SVN: r1492 - in trunk: common-internal/src/main/java/com/metamatrix/platform/vm and 14 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Sep 29 16:44:36 EDT 2009


Author: shawkins
Date: 2009-09-29 16:44:35 -0400 (Tue, 29 Sep 2009)
New Revision: 1492

Added:
   trunk/runtime/src/main/java/org/teiid/transport/SocketListenerStats.java
Removed:
   trunk/common-internal/src/main/java/com/metamatrix/platform/service/
   trunk/common-internal/src/main/java/com/metamatrix/platform/vm/controller/
   trunk/common-internal/src/main/java/com/metamatrix/vdb/edit/
   trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
   trunk/engine/src/main/java/com/metamatrix/dqp/ResourceFinder.java
Modified:
   trunk/engine/src/main/java/com/metamatrix/common/application/ApplicationEnvironment.java
   trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
   trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
   trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java
   trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
   trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java
   trunk/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java
   trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
Log:
TEIID-286: moving socketlistenerstats, removing ResourceFinder and the Application class.

Deleted: trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/application/Application.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/main/java/com/metamatrix/common/application/Application.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.application;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-
-/**
- */
-public class Application {
-
-    protected ApplicationEnvironment environment = new ApplicationEnvironment();
-    private ArrayList<String> installedServices = new ArrayList<String>();
-
-    /* 
-     * @see com.metamatrix.common.application.Application#installService(com.metamatrix.common.application.ApplicationService)
-     */
-    public final void installService(String type, ApplicationService service) throws ApplicationInitializationException {
-        if(service == null) {
-            return;
-        }
-        
-        try {
-            service.start(this.environment);
-            this.environment.bindService(type, service);
-            installedServices.add(0, type);
-        } catch(ApplicationLifecycleException e) {
-            throw new ApplicationInitializationException(e, CommonPlugin.Util.getString("BasicApplication.Failed_while_installing_service_of_type__1") + type); //$NON-NLS-1$
-        }
-    }
-
-    public ApplicationEnvironment getEnvironment() {
-        return this.environment;
-    }
-    /**
-     * @see com.metamatrix.common.application.Application#stop()
-     */
-    public void stop() throws ApplicationLifecycleException {
-        for (Iterator i = installedServices.iterator(); i.hasNext();) {
-            String type = (String)i.next();
-            ApplicationService service = environment.findService(type);
-            environment.unbindService(type);
-            service.stop();
-            i.remove();
-        }
-    }
-
-}

Modified: trunk/engine/src/main/java/com/metamatrix/common/application/ApplicationEnvironment.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/application/ApplicationEnvironment.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/main/java/com/metamatrix/common/application/ApplicationEnvironment.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -22,9 +22,14 @@
 
 package com.metamatrix.common.application;
 
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
+import com.metamatrix.cache.CacheFactory;
+import com.metamatrix.common.CommonPlugin;
+import com.metamatrix.common.application.exception.ApplicationInitializationException;
+import com.metamatrix.common.application.exception.ApplicationLifecycleException;
+
 /**
  * The environment is available internally to the application as a means 
  * of finding application services of a particular type or to retrieve
@@ -32,7 +37,13 @@
  */
 public class ApplicationEnvironment {
 
-    private Map<String, ApplicationService> services = new HashMap<String, ApplicationService>();
+    private LinkedHashMap<String, ApplicationService> services = new LinkedHashMap<String, ApplicationService>();
+    
+    private CacheFactory cache;
+    
+    public ApplicationEnvironment() {
+    	
+    }
 
     /* 
      * @see com.metamatrix.common.application.ApplicationEnvironment#bindService(java.lang.String, com.metamatrix.common.application.ApplicationService)
@@ -41,18 +52,42 @@
         this.services.put(type, service);
     }
 
+    public ApplicationService findService(String type) {
+        return this.services.get(type);
+    }
+    
+    public CacheFactory getCacheFactory() {
+		return cache;
+	}
+    
+    public void setCacheFactory(CacheFactory cache) {
+		this.cache = cache;
+	}
+    
     /* 
-     * @see com.metamatrix.common.application.ApplicationEnvironment#unbindService(java.lang.String)
+     * @see com.metamatrix.common.application.Application#installService(com.metamatrix.common.application.ApplicationService)
      */
-    public void unbindService(String type) {
-        this.services.remove(type);
+    public final void installService(String type, ApplicationService service) throws ApplicationInitializationException {
+        if(service == null) {
+            return;
+        }
+        
+        try {
+            service.start(this);
+            this.bindService(type, service);
+        } catch(ApplicationLifecycleException e) {
+            throw new ApplicationInitializationException(e, CommonPlugin.Util.getString("BasicApplication.Failed_while_installing_service_of_type__1") + type); //$NON-NLS-1$
+        }
     }
 
-    /* 
-     * @see com.metamatrix.common.application.ApplicationEnvironment#findService(java.lang.String)
+    /**
+     * @see com.metamatrix.common.application.Application#stop()
      */
-    public ApplicationService findService(String type) {
-        return this.services.get(type);
+    public void stop() throws ApplicationLifecycleException {
+        for (Map.Entry<String, ApplicationService> entry : services.entrySet()) {
+            entry.getValue().stop();
+		}
+        services.clear();
     }
     
 }

Deleted: trunk/engine/src/main/java/com/metamatrix/dqp/ResourceFinder.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/ResourceFinder.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/ResourceFinder.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp;
-
-
-import com.google.inject.Injector;
-import com.metamatrix.cache.CacheFactory;
-
-public class ResourceFinder {
-	protected static Injector injector;
-	
-	public static CacheFactory getCacheFactory() {
-		if (injector == null) {
-			throw new IllegalStateException();
-		}
-		return injector.getInstance(CacheFactory.class);
-	}	
-	
-	public static void setInjector(Injector i) {
-		injector = i;
-	}
-}

Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleCollapseSource.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -434,17 +434,11 @@
         List clauses = from.getClauses();
         FromClause rootClause = (FromClause) clauses.get(0);
        
-        // If only one group, this is as good as we can do
-        if(rootClause instanceof UnaryFromClause) {
-            return;
-        }
-       
         // If all joins are inner joins, move criteria to WHERE and make 
         // FROM a list of groups instead of a tree of JoinPredicates
         if(! hasOuterJoins(rootClause)) {
             from.setClauses(new ArrayList());
             shredJoinTree(rootClause, query);
-
         } // else leave as is
     }    
 

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -73,7 +73,6 @@
 import com.metamatrix.core.util.ReflectionHelper;
 import com.metamatrix.core.util.StringUtil;
 import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.ResourceFinder;
 import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
@@ -356,7 +355,7 @@
         	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, props.getProperty(ConnectorPropertyNames.MAX_RESULTSET_CACHE_SIZE, DEFAULT_MAX_RESULTSET_CACHE_SIZE)); 
         	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, props.getProperty(ConnectorPropertyNames.MAX_RESULTSET_CACHE_AGE, DEFAULT_MAX_RESULTSET_CACHE_AGE)); 
         	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, props.getProperty(ConnectorPropertyNames.RESULTSET_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_VDB)); 
-    		this.rsCache = createResultSetCache(rsCacheProps);
+    		this.rsCache = new ResultSetCache(rsCacheProps, env.getCacheFactory());
         }
 		this.workItemFactory = new ConnectorWorkItemFactory(this, this.rsCache, synchWorkers);
     	this.state = ConnectorStatus.OPEN;
@@ -479,10 +478,6 @@
         return new ConnectorWrapper(c);
     }
     
-    protected ResultSetCache createResultSetCache(Properties rsCacheProps) {
-		return new ResultSetCache(rsCacheProps, ResourceFinder.getCacheFactory());
-	}
-
     /**
      * Stop this connector.
      */

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -44,11 +44,12 @@
 import org.teiid.dqp.internal.cache.ResultSetCache;
 import org.teiid.dqp.internal.cache.ResultSetCacheUtil;
 
+import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.common.application.Application;
+import com.metamatrix.cache.CacheFactory;
 import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.ApplicationService;
 import com.metamatrix.common.application.DQPConfigSource;
@@ -67,7 +68,6 @@
 import com.metamatrix.core.log.MessageLevel;
 import com.metamatrix.core.util.LRUCache;
 import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.ResourceFinder;
 import com.metamatrix.dqp.client.ClientSideDQP;
 import com.metamatrix.dqp.client.MetadataResult;
 import com.metamatrix.dqp.client.ResultsFuture;
@@ -99,7 +99,7 @@
  * Implements the core DQP processing.
  */
 @Singleton
-public class DQPCore extends Application implements ClientSideDQP {
+public class DQPCore implements ClientSideDQP {
 	
 	static class ConnectorCapabilitiesCache  {
 		
@@ -188,12 +188,14 @@
 	private Map<String, ClientState> clientState = Collections.synchronizedMap(new HashMap<String, ClientState>());
 	private DQPContextCache contextCache;
     private ServiceLoader loader = new ServiceLoader();
+    private CacheFactory cacheFactory;
+    
+    private ApplicationEnvironment environment = new ApplicationEnvironment();
 
     /**
      * perform a full shutdown and wait for 10 seconds for all threads to finish
      * @throws ApplicationLifecycleException 
      */
-	@Override
     public void stop() throws ApplicationLifecycleException {
 		LogManager.logDetail(LogConstants.CTX_DQP, "Stopping the DQP"); //$NON-NLS-1$
     	processWorkerPool.shutdownNow();
@@ -202,7 +204,11 @@
 		} catch (InterruptedException e) {
 		}
     	contextCache.shutdown();
-    	super.stop();
+    	this.environment.stop();
+    	
+    	if (cacheFactory != null) {
+    		cacheFactory.destroy();
+    	}
     }
     
     /**
@@ -282,7 +288,7 @@
 	    	request = new Request();
 	    }
 	    ClientState state = this.getClientState(workContext.getConnectionID(), true);
-	    request.initialize(requestMsg, getEnvironment(), bufferManager,
+	    request.initialize(requestMsg, environment, bufferManager,
 				dataTierMgr, vdbCapabilties, transactionService,
 				processorDebugAllowed, state.tempTableStoreImpl,
 				workContext, chunkSize);
@@ -636,11 +642,11 @@
 			}
             
 			appService.initialize(configSource.getProperties());
-        	installService(serviceName, appService);
+        	this.environment.installService(serviceName, appService);
             LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceInstalled", serviceName)); //$NON-NLS-1$
         }
         
-		ConfigurationService cs = (ConfigurationService)this.getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE);
+		ConfigurationService cs = (ConfigurationService)this.environment.findService(DQPServiceNames.CONFIGURATION_SERVICE);
 		Properties p = configSource.getProperties();
 		if (cs != null) {
 			p = cs.getSystemProperties();
@@ -650,8 +656,6 @@
     
 	
 	public void start(Properties props) {
-		ApplicationEnvironment env = this.getEnvironment();
-		
 		PropertiesUtils.setBeanProperties(this, props, null);
 		
         this.processorTimeslice = PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.PROCESS_TIMESLICE, DEFAULT_PROCESSOR_TIMESLICE);
@@ -669,7 +673,7 @@
         	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, props.getProperty(DQPEmbeddedProperties.MAX_RESULTSET_CACHE_SIZE, DEFAULT_MAX_RESULTSET_CACHE_SIZE));
         	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, props.getProperty(DQPEmbeddedProperties.MAX_RESULTSET_CACHE_AGE, DEFAULT_MAX_RESULTSET_CACHE_AGE));
         	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, props.getProperty(DQPEmbeddedProperties.RESULTSET_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_VDB)); 
-			this.rsCache = new ResultSetCache(rsCacheProps, ResourceFinder.getCacheFactory());
+			this.rsCache = new ResultSetCache(rsCacheProps, cacheFactory);
         }
 
         //prepared plan cache
@@ -680,20 +684,20 @@
         LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPCore.Processor_debug_allowed_{0}", this.processorDebugAllowed)); //$NON-NLS-1$
                         
         //get buffer manager
-        BufferService bufferService = (BufferService) env.findService(DQPServiceNames.BUFFER_SERVICE);
+        BufferService bufferService = (BufferService) this.environment.findService(DQPServiceNames.BUFFER_SERVICE);
         bufferManager = bufferService.getBufferManager();
         contextCache = bufferService.getContextCache();
 
-        transactionService = (TransactionService )env.findService(DQPServiceNames.TRANSACTION_SERVICE);
-        metadataService = (MetadataService) env.findService(DQPServiceNames.METADATA_SERVICE);
+        transactionService = (TransactionService )this.environment.findService(DQPServiceNames.TRANSACTION_SERVICE);
+        metadataService = (MetadataService) this.environment.findService(DQPServiceNames.METADATA_SERVICE);
 
         // Create the worker pools to tie the queues together
         processWorkerPool = WorkerPoolFactory.newWorkerPool(PROCESS_PLAN_QUEUE_NAME, PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.PROCESS_POOL_MAX_THREADS, DEFAULT_MAX_PROCESS_WORKERS)); 
  
         dataTierMgr = new DataTierManagerImpl(this,
-                                            (DataService) env.findService(DQPServiceNames.DATA_SERVICE),
-                                            (VDBService) env.findService(DQPServiceNames.VDB_SERVICE),
-                                            (BufferService) env.findService(DQPServiceNames.BUFFER_SERVICE),
+                                            (DataService) this.environment.findService(DQPServiceNames.DATA_SERVICE),
+                                            (VDBService) this.environment.findService(DQPServiceNames.VDB_SERVICE),
+                                            (BufferService) this.environment.findService(DQPServiceNames.BUFFER_SERVICE),
                                             this.maxCodeTables,
                                             this.maxCodeRecords,
                                             this.maxCodeTableRecords);        
@@ -782,7 +786,7 @@
 	public MetadataResult getMetadata(long requestID)
 			throws MetaMatrixComponentException, MetaMatrixProcessingException {
 		DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-		MetaDataProcessor processor = new MetaDataProcessor(this.metadataService, this, this.prepPlanCache, getEnvironment());
+		MetaDataProcessor processor = new MetaDataProcessor(this.metadataService, this, this.prepPlanCache, this.environment);
 		return processor.processMessage(workContext.getRequestID(requestID), workContext, null, true);
 	}
 
@@ -790,7 +794,21 @@
 			boolean allowDoubleQuotedVariable)
 			throws MetaMatrixComponentException, MetaMatrixProcessingException {
 		DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-		MetaDataProcessor processor = new MetaDataProcessor(this.metadataService, this, this.prepPlanCache, getEnvironment());
+		MetaDataProcessor processor = new MetaDataProcessor(this.metadataService, this, this.prepPlanCache, this.environment);
 		return processor.processMessage(workContext.getRequestID(requestID), workContext, preparedSql, allowDoubleQuotedVariable);
 	}
+	
+	public ApplicationEnvironment getEnvironment() {
+		return environment;
+	}
+	
+	@Inject
+	public void setCacheFactory(CacheFactory cacheFactory) {
+		this.cacheFactory = cacheFactory;
+		this.environment.setCacheFactory(cacheFactory);
+	}
+	
+	public void setEnvironment(ApplicationEnvironment environment) {
+		this.environment = environment;
+	}
 }
\ No newline at end of file

Modified: trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -22,7 +22,6 @@
 
 package com.metamatrix.dqp.config;
 
-import java.util.HashMap;
 import java.util.Properties;
 
 import junit.framework.TestCase;
@@ -30,7 +29,6 @@
 import org.mockito.Mockito;
 import org.teiid.dqp.internal.process.DQPCore;
 
-import com.metamatrix.common.application.ApplicationService;
 import com.metamatrix.common.application.DQPConfigSource;
 import com.metamatrix.dqp.service.AutoGenDataService;
 import com.metamatrix.dqp.service.BufferService;

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -41,7 +41,6 @@
 import org.teiid.connector.api.ConnectorIdentity;
 import org.teiid.connector.api.ConnectorPropertyNames;
 import org.teiid.connector.api.ExecutionContext;
-import org.teiid.dqp.internal.cache.ResultSetCache;
 import org.teiid.dqp.internal.datamgr.impl.TestConnectorWorkItem.QueueResultsReceiver;
 import org.teiid.dqp.internal.pooling.connector.ConnectionPool;
 import org.teiid.dqp.internal.pooling.connector.FakeSourceConnectionFactory;
@@ -130,6 +129,7 @@
         ApplicationEnvironment env = new ApplicationEnvironment();
         env.bindService(DQPServiceNames.METADATA_SERVICE, new FakeMetadataService());
         env.bindService(DQPServiceNames.TRANSACTION_SERVICE, new FakeTransactionService());
+        env.setCacheFactory(new FakeCache.FakeCacheFactory());
         cm.start(env);
 	}
     
@@ -157,13 +157,7 @@
     }
     
     @Test public void testCaching() throws Exception {
-    	ConnectorManager cm = new ConnectorManager() {
-    		@Override
-    		protected ResultSetCache createResultSetCache(Properties rsCacheProps) {
-    			assertEquals(String.valueOf(3600000), rsCacheProps.get(ResultSetCache.RS_CACHE_MAX_AGE));
-    			return new ResultSetCache(rsCacheProps, new FakeCache.FakeCacheFactory());
-    		}
-    	};
+    	ConnectorManager cm = new ConnectorManager();
         Properties props = new Properties();
         props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
         props.setProperty(ConnectorPropertyNames.USE_RESULTSET_CACHE, Boolean.TRUE.toString());

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -86,11 +86,8 @@
         vdbService.addModel(vdbName, vdbVersion, "BQT3", ModelInfo.PRIVATE, false); //$NON-NLS-1$
         env.bindService(DQPServiceNames.VDB_SERVICE, vdbService);
 
-        core = new DQPCore() {
-            public ApplicationEnvironment getEnvironment() {
-                return env; 
-            }
-        };
+        core = new DQPCore();
+        core.setEnvironment(env);
         core.start(new Properties());
     }
     

Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -41,6 +41,7 @@
 import org.teiid.transport.AdminAuthorizationInterceptor;
 import org.teiid.transport.LocalServerConnection;
 import org.teiid.transport.LogonImpl;
+import org.teiid.transport.SocketListenerStats;
 import org.teiid.transport.SocketTransport;
 
 import com.google.inject.Guice;
@@ -64,7 +65,6 @@
 import com.metamatrix.core.MetaMatrixCoreException;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.util.MixinProxy;
-import com.metamatrix.dqp.ResourceFinder;
 import com.metamatrix.dqp.client.ClientSideDQP;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
@@ -78,7 +78,6 @@
 import com.metamatrix.dqp.util.LogConstants;
 import com.metamatrix.platform.security.api.ILogon;
 import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.vm.controller.SocketListenerStats;
 
 
 /** 
@@ -152,7 +151,6 @@
 
         EmbeddedGuiceModule config = new EmbeddedGuiceModule(bootstrapURL, props, this.jmxServer, address);
 		Injector injector = Guice.createInjector(config);
-		ResourceFinder.setInjector(injector);
 		config.setInjector(injector);
 		
 		// start the DQP
@@ -341,9 +339,6 @@
         	this.socketTransport = null;
         }
         
-        // shutdown the cache.
-        ResourceFinder.getCacheFactory().destroy();
-        
 		this.restart = restart;
     }
 

Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -45,7 +45,6 @@
 import com.metamatrix.core.log.MessageLevel;
 import com.metamatrix.core.util.NamedThreadFactory;
 import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.vm.controller.SocketListenerStats;
 
 /**
  * Server-side class to listen for new connection requests and create a SocketClientConnection for each connection request.

Copied: trunk/runtime/src/main/java/org/teiid/transport/SocketListenerStats.java (from rev 1488, trunk/common-internal/src/main/java/com/metamatrix/platform/vm/controller/SocketListenerStats.java)
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketListenerStats.java	                        (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketListenerStats.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.transport;
+
+import java.io.Serializable;
+
+
+/** 
+ * Data holder for statistics about the server-side SocketListener.
+ * @since 4.3
+ */
+public class SocketListenerStats implements Serializable {
+
+    public long objectsRead = 0;
+    public long objectsWritten = 0;
+    
+    public int sockets = 0;
+    public int maxSockets = 0;
+}
+

Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -37,7 +37,6 @@
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
 import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.vm.controller.SocketListenerStats;
 
 /**
  * This class starts a Socket for DQP connections and listens on the port and hands out the connections to the 

Modified: trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java
===================================================================
--- trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -30,7 +30,7 @@
 import junit.framework.TestCase;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.application.Application;
+import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.config.api.ConnectorBinding;
 import com.metamatrix.common.config.api.ConnectorBindingType;
 import com.metamatrix.common.vdb.api.VDBArchive;
@@ -51,7 +51,7 @@
     
     protected void setUp() throws Exception {
     	EmbeddedTestUtil.createTestDirectory();
-        Application registry = new Application();
+        ApplicationEnvironment registry = new ApplicationEnvironment();
         configService = new EmbeddedConfigurationService();
         registry.installService(DQPServiceNames.CONFIGURATION_SERVICE, configService);
         vdbService = new EmbeddedVDBService();
@@ -155,7 +155,7 @@
         vdbService.stopService();
         configService.stopService();
         
-        Application registry = new Application();
+        ApplicationEnvironment registry = new ApplicationEnvironment();
         configService = new EmbeddedConfigurationService();
         configService.setUserPreferences(p);
         configService.initializeService(p);

Modified: trunk/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java
===================================================================
--- trunk/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/runtime/src/test/java/com/metamatrix/dqp/service/buffer/TestLocalBufferService.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -26,7 +26,7 @@
 
 import junit.framework.TestCase;
 
-import com.metamatrix.common.application.Application;
+import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.exception.ApplicationInitializationException;
 import com.metamatrix.common.buffer.impl.BufferConfig;
 import com.metamatrix.common.buffer.impl.BufferManagerImpl;
@@ -46,7 +46,7 @@
 
     public void testMissingRequiredProperties() throws Exception {        
         try {
-            Application r = new Application();
+        	ApplicationEnvironment r = new ApplicationEnvironment();
             ConfigurationService cs = new EmbeddedConfigurationService();
             Properties p = EmbeddedTestUtil.getProperties(UnitTestUtil.getTestDataPath() + "/admin/buffertest1.properties"); //$NON-NLS-1$
             p.setProperty(DQPEmbeddedProperties.DQP_WORKDIR, System.getProperty("java.io.tmpdir")+"/teiid/1");         //$NON-NLS-1$ //$NON-NLS-2$
@@ -70,7 +70,7 @@
     public void testCheckMemPropertyGotSet() throws Exception {
         EmbeddedBufferService svc = null;
         ConfigurationService cs = null;
-        Application r = new Application();
+        ApplicationEnvironment r = new ApplicationEnvironment();
         cs = new EmbeddedConfigurationService();
         Properties p = EmbeddedTestUtil.getProperties(UnitTestUtil.getTestDataPath() + "/admin/buffertest2.properties"); //$NON-NLS-1$
         p.setProperty(DQPEmbeddedProperties.DQP_WORKDIR, System.getProperty("java.io.tmpdir")+"/teiid/1");         //$NON-NLS-1$ //$NON-NLS-2$
@@ -97,7 +97,7 @@
 
     public void testCheckMemPropertyGotSet2() throws Exception {
         EmbeddedBufferService svc = null;
-        Application r = new Application();
+        ApplicationEnvironment r = new ApplicationEnvironment();
         ConfigurationService cs = new EmbeddedConfigurationService();
         Properties p = EmbeddedTestUtil.getProperties(UnitTestUtil.getTestDataPath() + "/admin/buffertest3.properties"); //$NON-NLS-1$
         p.setProperty(DQPEmbeddedProperties.DQP_WORKDIR, System.getProperty("java.io.tmpdir")+"/teiid/1");         //$NON-NLS-1$ //$NON-NLS-2$

Modified: trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2009-09-29 17:30:43 UTC (rev 1491)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2009-09-29 20:44:35 UTC (rev 1492)
@@ -50,7 +50,6 @@
 import com.metamatrix.platform.security.api.ILogon;
 import com.metamatrix.platform.security.api.LogonResult;
 import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.vm.controller.SocketListenerStats;
 
 public class TestCommSockets {
 



More information about the teiid-commits mailing list