[teiid-commits] teiid SVN: r965 - in trunk/server/src: main/java/com/metamatrix/platform/admin/apiimpl and 6 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sun May 17 21:43:03 EDT 2009


Author: vhalbert at redhat.com
Date: 2009-05-17 21:43:02 -0400 (Sun, 17 May 2009)
New Revision: 965

Modified:
   trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
   trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
   trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java
   trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java
   trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java
   trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java
   trunk/server/src/main/resources/com/metamatrix/admin/server/i18n.properties
   trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java
   trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
   trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
   trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java
   trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java
Log:
Teiid-580 - adding support for monitoring connector connection pools - exposing the stats out the server

Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -1009,6 +1009,12 @@
 		// TODO Auto-generated method stub
 		return getMonitoringAdmin().getServices(identifier);
 	}
+
+	@Override
+	public Collection getConnectionPoolStats(String identifier)
+			throws AdminException {
+		return getMonitoringAdmin().getConnectionPoolStats(identifier);
+	}
 	
 	
 	

Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -54,6 +54,7 @@
 import com.metamatrix.admin.api.objects.VDB;
 import com.metamatrix.admin.api.server.ServerMonitoringAdmin;
 import com.metamatrix.admin.objects.MMAdminObject;
+import com.metamatrix.admin.objects.MMConnectionPool;
 import com.metamatrix.admin.objects.MMConnectorBinding;
 import com.metamatrix.admin.objects.MMConnectorType;
 import com.metamatrix.admin.objects.MMDQP;
@@ -82,6 +83,7 @@
 import com.metamatrix.common.extensionmodule.ExtensionModuleDescriptor;
 import com.metamatrix.common.extensionmodule.exception.ExtensionModuleNotFoundException;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.core.util.DateUtil;
 import com.metamatrix.core.util.FileUtil;
 import com.metamatrix.core.util.FileUtils;
@@ -884,6 +886,71 @@
         return results;
     }
 
+    
+    /**
+     * Get monitoring information about connection pool stats for the connector bindings.
+     * @see com.metamatrix.admin.api.server.ServerMonitoringAdmin#getConnectionPoolStats(java.lang.String)
+     * @param identifier Identifier of a host, process, or connector binding to get information for.
+     * For example "hostname", or "hostname.processname", or "hostname.processname.bindingname"
+     * <p>If identifier is "*", this method returns information about all connection pools in the system.
+     * @return a <code>Collection</code> of <code>com.metamatrix.admin.api.ConnectionPool</code>
+     * @since 6.1
+     */
+     public Collection getConnectionPoolStats(String identifier) throws AdminException  {
+         
+         if (identifier == null) {
+             throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+         }
+         
+         ArrayList results = null;
+         try {
+ 			//get pools from RuntimeStateAdminAPIHelper
+ 			Collection serviceBindings = this.registry.getServiceBindings(null, null);
+
+ 			//convert runtime data into MMQueueStatistics objects
+ 			results = new ArrayList(serviceBindings.size());
+ 			for (Iterator iter = serviceBindings.iterator(); iter.hasNext();) {
+ 			    ServiceRegistryBinding binding = (ServiceRegistryBinding) iter.next();
+ 			    DeployedComponent component = binding.getDeployedComponent();
+ 			    
+ 			    if (component.isDeployedConnector()) {
+			            String[] identifierParts = new String[] {binding.getHostName(), 
+	 			                component.getVMComponentDefnID().getName(), 
+	 			                component.getServiceComponentDefnID().getFullName()};                
+ 			            if (identifierMatches(identifier, identifierParts)) {
+ 			            	 			                
+ 		 			        Collection statsCollection = getRuntimeStateAdminAPIHelper().getConnectionPoolStats(binding);
+ 		 			        if (statsCollection != null) {
+	 		 			        for (Iterator iter2 = statsCollection.iterator(); iter2.hasNext();) {
+	 		 			        	ConnectionPoolStats stats = (ConnectionPoolStats) iter2.next();
+	 		 			        	
+	 		 			        	MMConnectionPool mmstats = new MMConnectionPool();
+	 		 			        	
+	 		 			        	mmstats.setConnectorBindingName(component.getServiceComponentDefnID().getFullName());
+	 		 			        	mmstats.setConnectorBindingIdentifier(component.getFullName());
+	 		 			        	
+	 		 			        	mmstats.setConnectionsInUse(stats.getConnectionsInuse());
+	 		 			        	mmstats.setConnectionsCreated(stats.getConnectionsCreated());
+	 		 			        	mmstats.setConnectionsDestroyed(stats.getConnectionsDestroyed());
+	 		 			        	mmstats.setConnectionsWaiting(stats.getConnectionsWaiting());
+	 		 			        	mmstats.setTotalConnections(stats.getTotalConnections());	 		 			        	
+	 		 			        	
+	 		 			        	results.add(mmstats);	 		 			        	
+	 		 			        }
+ 		 			        }
+
+ 			            }
+ 			    	
+ 			                
+ 			    }
+ 			}
+ 		} catch (MetaMatrixComponentException e) {
+ 			throw new AdminComponentException(e);
+ 		} catch (ServiceException e) {
+ 			throw new AdminComponentException(e);
+ 		}
+         return results;
+     }    
    
 
     /**
@@ -1181,10 +1248,19 @@
 			        config = getConfigurationServiceProxy().getCurrentConfiguration();
 			        ConnectorBinding configBinding = config.getConnectorBinding(MMAdminObject.getNameFromIdentifier(objectIdentifier));
 			        
-			        component = getConnectorBindingComponent(objectIdentifier);
+			        component = getDeployedComponent(objectIdentifier);
 			        
 			        return convertPropertyDefinitions(component, configBinding.getProperties());
 			        
+			    case MMAdminObject.OBJECT_TYPE_SERVICE:
+			        config = getConfigurationServiceProxy().getCurrentConfiguration();
+			        ServiceComponentDefn svc = config.getServiceComponentDefn(MMAdminObject.getNameFromIdentifier(objectIdentifier));
+			        
+			        component = this.getDeployedComponent(objectIdentifier);
+			        
+			        return convertPropertyDefinitions(component, svc.getProperties());
+
+			        
 			    case MMAdminObject.OBJECT_TYPE_CONNECTOR_TYPE:
 			        ComponentType componentType = getConnectorTypeComponentType(objectIdentifier);
 			        return convertPropertyDefinitions(componentType, new Properties());                
@@ -1305,22 +1381,23 @@
     }
     
     
-    private ComponentObject getConnectorBindingComponent(String identifier) throws ConfigurationException {
+    private ComponentObject getDeployedComponent(String identifier) throws ConfigurationException {
         Configuration config = getConfigurationServiceProxy().getCurrentConfiguration();
         Collection components = config.getDeployedComponents();
         for (Iterator iter = components.iterator(); iter.hasNext(); ) {
             BasicDeployedComponent bdc = (BasicDeployedComponent)iter.next();
-            
             String[] identifierParts = new String[] {
                 bdc.getHostID().getName(), bdc.getVMComponentDefnID().getName(), bdc.getName()
             };
             if (identifierMatches(identifier, identifierParts)) {
                 return bdc;
             }
+
         }
         return null;
     }
     
+    
     private ComponentType getConnectorTypeComponentType(String identifier) throws ConfigurationException {
         Collection types = getConfigurationServiceProxy().getAllComponentTypes(false);
         for (Iterator iter = types.iterator(); iter.hasNext();) {

Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -189,15 +189,9 @@
     /**
      * Return Collection of QueueStats for service.
      * 
-     * @param callerSessionID
-     *            ID of the caller's current session.
-     * @param serviceID
-     *            ID of the service.
+     * @param binding
+     *            The {@link ServiceRegistryBinding} for the connector 
      * @return Collection of QueueStats objects.
-     * @throws AuthorizationException
-     *             if caller is not authorized to perform this method.
-     * @throws InvalidSessionException
-     *             if the <code>callerSessionID</code> is not valid or is expired.
      * @throws MetaMatrixComponentException
      *             if an error occurred in communicating with a component.
      */
@@ -207,7 +201,24 @@
 		    return service.getQueueStatistics();
 		}
         return Collections.EMPTY_LIST;
-    }      
+    }  
+    
+    /**
+     * Return Collection of ConnectionPoolStats for a service.
+     * 
+     * @param binding
+     *            The {@link ServiceRegistryBinding} for the connector 
+     * @return Collection of ConnectionPoolStat objects.
+     * @throws MetaMatrixComponentException
+     *             if an error occurred in communicating with a component.
+     */
+    public Collection getConnectionPoolStats(ServiceRegistryBinding binding) throws MetaMatrixComponentException {
+		ServiceInterface service = binding.getService();
+		if (service != null) {
+		    return service.getConnectionPoolStats();
+		}
+        return Collections.EMPTY_LIST;
+    }  
 
     /**
      * Return ServiceRegistryBinding for the given serviceID

Modified: trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -29,6 +29,7 @@
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.config.api.DeployedComponentID;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.platform.service.controller.ServiceData;
 
 public interface ServiceInterface {
@@ -119,7 +120,16 @@
      */
     WorkerPoolStats getQueueStatistics(String name);
     
+    
     /**
+     * Returns a list of ConnectionPoolStat objects for the specific 
+     * ConnectorBinding service
+     * If there are no ConnectionPoolStats, null is returned.
+     */
+    Collection<ConnectionPoolStats> getConnectionPoolStats();
+    
+    
+    /**
      * There are reflective based calls on this
      */
     void setInitException(Throwable t);

Modified: trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -37,6 +37,7 @@
 import com.metamatrix.common.config.api.DeployedComponentID;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.common.util.LogCommonConstants;
 import com.metamatrix.common.util.PasswordMaskUtil;
 import com.metamatrix.core.event.EventObjectListener;
@@ -559,4 +560,10 @@
     	return data;
     }
     
+
+	public Collection<ConnectionPoolStats> getConnectionPoolStats() {
+		return Collections.EMPTY_LIST;
+	}
+    
+    
 }

Modified: trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -71,6 +71,7 @@
 import com.metamatrix.common.messaging.MessagingException;
 import com.metamatrix.common.object.PropertyDefinition;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.common.util.LogCommonConstants;
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.common.util.crypto.CryptoException;
@@ -530,4 +531,10 @@
         LogManager.logInfo(LogCommonConstants.CTX_CONFIG, ServerPlugin.Util.getString(messageProperty, value)); 
     }
     
+	public Collection<ConnectionPoolStats> getConnectionPoolStats() {
+//		return Collections.EMPTY_LIST;
+		
+		return this.connectorMgr.getConnectionPoolStats();
+	}
+    
 }
\ No newline at end of file

Modified: trunk/server/src/main/resources/com/metamatrix/admin/server/i18n.properties
===================================================================
--- trunk/server/src/main/resources/com/metamatrix/admin/server/i18n.properties	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/main/resources/com/metamatrix/admin/server/i18n.properties	2009-05-18 01:43:02 UTC (rev 965)
@@ -68,6 +68,8 @@
 ServerConfigAdminImpl.No_Objects_Found=No AdminObjects found for identifier {0} and class {1}.
 ServerConfigAdminImpl.Multiple_Objects_Found=Multiple AdminObjects found for identifier {0} and class {1}.
 
+ServerConfigAdminImpl.Service_was_null_when_updating_properties=Problem updating properties for Service {0}
+
 ServerRuntimeStateAdminImpl.clearing_cache=Clearing cache for cache identifier {0}.
 ServerSecurityAdminImpl.User_name_too_long=The user name may not be null and cannot be longer than {0} charachters
 ServerSecurityAdminImpl.neither_User_nor_Group=Parameter memberType is neither a User nor a Group.

Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -37,6 +37,7 @@
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.config.api.DeployedComponentID;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.platform.service.api.CacheAdmin;
 import com.metamatrix.platform.service.api.ServiceID;
 import com.metamatrix.platform.service.api.ServiceInterface;
@@ -160,4 +161,11 @@
 		return null;
 	}
 
+	@Override
+	public Collection<ConnectionPoolStats> getConnectionPoolStats() {
+		return null;
+	}
+	
+	
+
 }

Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -69,6 +69,7 @@
 import com.metamatrix.common.config.model.ConfigurationModelContainerImpl;
 import com.metamatrix.common.config.xml.XMLConfigurationImportExportUtility;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.platform.PlatformPlugin;
@@ -793,4 +794,18 @@
 		return null;
 	}
 
+
+
+
+
+
+
+
+	@Override
+	public Collection<ConnectionPoolStats> getConnectionPoolStats() {
+		return null;
+	}
+	
+	
+
 }

Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -44,6 +44,7 @@
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.config.api.DeployedComponentID;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.platform.security.api.MetaMatrixSessionID;
@@ -296,4 +297,11 @@
 		return null;
 	}
 
+	@Override
+	public Collection<ConnectionPoolStats> getConnectionPoolStats() {
+		return null;
+	}
+	
+	
+
 }

Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -38,6 +38,7 @@
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.config.api.DeployedComponentID;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.platform.security.api.Credentials;
 import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
 import com.metamatrix.platform.security.api.MetaMatrixSessionID;
@@ -271,4 +272,11 @@
 		return null;
 	}
 
+	@Override
+	public Collection<ConnectionPoolStats> getConnectionPoolStats() {
+		return null;
+	}
+	
+	
+
 }

Modified: trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java	2009-05-18 01:36:17 UTC (rev 964)
+++ trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java	2009-05-18 01:43:02 UTC (rev 965)
@@ -31,6 +31,7 @@
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.config.api.DeployedComponentID;
 import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.stats.ConnectionPoolStats;
 import com.metamatrix.platform.service.api.ServiceID;
 
 public class FakeService implements FakeServiceInterface {
@@ -115,4 +116,11 @@
 	public ServiceData getServiceData() {
 		return null;
 	}
+	@Override
+	public Collection<ConnectionPoolStats> getConnectionPoolStats() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	
 }




More information about the teiid-commits mailing list