[teiid-commits] teiid SVN: r2641 - in branches/7.1.x: build/kits/jboss-container and 7 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Oct 11 12:42:48 EDT 2010


Author: rareddy
Date: 2010-10-11 12:42:47 -0400 (Mon, 11 Oct 2010)
New Revision: 2641

Removed:
   branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java
   branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
   branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java
   branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java
Modified:
   branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
   branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
   branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
   branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
   branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
   branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java
   branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
   branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1299: Removing the unimplemented methods from the Admin API.  Renaming, getWorkManagerStats to getWorkerPoolStats.

Modified: branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -37,7 +37,6 @@
 import org.teiid.adminapi.AdminException;
 import org.teiid.adminapi.AdminFactory;
 import org.teiid.adminapi.CacheStatistics;
-import org.teiid.adminapi.ProcessObject;
 import org.teiid.adminapi.PropertyDefinition;
 import org.teiid.adminapi.Request;
 import org.teiid.adminapi.Session;
@@ -183,13 +182,6 @@
 		return getAdmin().getTemplatePropertyDefinitions(templateName);
 	}
 
-	@Doc(text = "Get the ProcessObject instances for the given identifier")
-	public static Collection<ProcessObject> getProcesses(
-			@Doc(text = "identifier") String processIdentifier)
-			throws AdminException {
-		return getAdmin().getProcesses(processIdentifier);
-	}
-
 	@Doc(text = "Get all Request instances")
 	public static Collection<Request> getRequests() throws AdminException {
 		return getAdmin().getRequests();
@@ -224,11 +216,10 @@
 		return getAdmin().getVDBs();
 	}
 
-	@Doc(text = "Get WorkerPoolStatistics for the given WorkManager")
-	public static WorkerPoolStatistics getWorkManagerStats(
-			@Doc(text = "identifier") String identifier)
+	@Doc(text = "Get thread pool statistics for Teiid")
+	public static WorkerPoolStatistics getWorkerPoolStats()
 			throws AdminException {
-		return getAdmin().getWorkManagerStats(identifier);
+		return getAdmin().getWorkerPoolStats();
 	}
 	
 	@Doc(text = "Get cache statistics for given cache type")
@@ -256,14 +247,6 @@
     	getAdmin().setAnyAuthenticatedForDataRole(vdbName, vdbVersion, dataRole, anyAuthenticated);
     }
 
-	@Doc(text = "Set a runtime property")
-	public static void setRuntimeProperty(
-			@Doc(text = "name") String propertyName, 
-			@Doc(text = "value") String propertyValue)
-			throws AdminException {
-		getAdmin().setRuntimeProperty(propertyName, propertyValue);
-	}
-
 	@Doc(text = "Terminate a session and associated requests")
 	public static void terminateSession(
 			@Doc(text = "session id") String sessionId) throws AdminException {

Modified: branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html	2010-10-11 16:42:47 UTC (rev 2641)
@@ -50,6 +50,7 @@
   <li>Overwriting an existing VDB will cause old connections to be terminated.  Production systems should rely on VDB versioning.
   <li>The jdbc:metamatrix JDBC URL prefix is no longer accepted.  Use jdbc:teiid instead.
   <li>Model visibility no longer restricts access to tables and procedures.  Setting visible to false will only hide entries from system tables.  Data roles should be used to restrict data access.
+  <li>On Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods are not supported.
 </ul>
 <h4>from 7.0</h4>
 <ul>

Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/Admin.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -75,13 +75,6 @@
     void deleteVDB(String vdbName, int vdbVersion) throws AdminException;
     
     /**
-     * Set a process level property. 
-     * @param propertyName - name of the property
-     * @param propertyValue - value of the property
-     */
-    void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException;
-    
-    /**
      * Get the VDBs that currently deployed in the system
      *
      * @return Collection of {@link VDB}s.  There could be multiple VDBs with the
@@ -116,13 +109,12 @@
     Translator getTranslator(String deployedName) throws AdminException;
 
     /**
-     * Get the Work Manager stats that correspond to the specified identifier pattern.
+     * Get the Worker Pool statistics in runtime engine.
      *
-     * @param identifier - an identifier for the queues {@link QueueWorkerPool}. 
-     * @return Collection of {@link QueueWorkerPool}
+     * @return {@link WorkerPoolStatistics}
      * @throws AdminException 
      */
-    WorkerPoolStatistics getWorkManagerStats(String identifier) throws AdminException;
+    WorkerPoolStatistics getWorkerPoolStats() throws AdminException;
     
     /**
      * Get the Caches that correspond to the specified identifier pattern
@@ -169,18 +161,6 @@
      */
     Collection<Transaction> getTransactions() throws AdminException;
     
-    
-   /**
-     * Get the processes that correspond to the specified identifier pattern.
-     *
-     * @param processIdentifier the unique identifier for for a {@link org.teiid.adminapi.ProcessObject ProcessObject}
-     * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
-     * if all Processes are desired.
-     * @return Collection of {@link org.teiid.adminapi.ProcessObject ProcessObject}
-     * @throws AdminException if there's a system error.
-     */
-    Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException;
-
     /**
      * Clear the cache or caches specified by the cacheIdentifier.
      * @param cacheType Cache Type

Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -28,9 +28,7 @@
 import java.lang.reflect.Proxy;
 import java.util.Properties;
 
-import org.teiid.client.security.LogonException;
 import org.teiid.client.util.ExceptionUtil;
-import org.teiid.core.TeiidRuntimeException;
 import org.teiid.core.util.PropertiesUtils;
 import org.teiid.jdbc.JDBCPlugin;
 import org.teiid.net.CommunicationException;
@@ -42,29 +40,26 @@
 
 
 /** 
- * Singleton factory for ServerAdmins.
- * @since 4.3
+ * Singleton factory for class for creating Admin connections to the Teiid
  */
 public class AdminFactory {
 	
-    private static final int DEFAULT_BOUNCE_WAIT = 2000;
-        
     private final class AdminProxy implements InvocationHandler {
 
-    	private Admin target;
-    	private ServerConnection registry;
+    	private Admin admin;
+    	private ServerConnection serverConnection;
     	private boolean closed;
     	
     	public AdminProxy(Properties p) throws ConnectionException, CommunicationException {
-    		this.registry = serverConnectionFactory.getConnection(p);
-    		this.target = registry.getService(Admin.class);
+    		this.serverConnection = serverConnectionFactory.getConnection(p);
+    		this.admin = serverConnection.getService(Admin.class);
 		}
     	
     	private synchronized Admin getTarget() throws AdminComponentException {
     		if (closed) {
     			throw new AdminComponentException(JDBCPlugin.Util.getString("admin_conn_closed")); //$NON-NLS-1$
     		}
-    		return target;
+    		return admin;
     	}
     	
 		@Override
@@ -81,11 +76,7 @@
 				return method.invoke(getTarget(), args);
 			} catch (InvocationTargetException e) {
 				if (ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
-					this.target = null;
-					if (method.getName().endsWith("restart")) { //$NON-NLS-1$
-						bounceSystem(true);
-						return null;
-					}
+					this.admin = null;
 				}
 				throw e.getTargetException();
 			}
@@ -96,53 +87,22 @@
 				return;
 			}
 			this.closed = true;
-			if (registry != null) {
-				registry.close();
+			if (serverConnection != null) {
+				serverConnection.close();
 			}
-		}
-		
-		public void bounceSystem(boolean waitUntilDone) {
-	        if (!waitUntilDone) {
-	        	return;
-	        }
-        	//we'll wait 2 seconds for the server to come up
-        	try {
-				Thread.sleep(bounceWait);
-			} catch (InterruptedException e) {
-				throw new TeiidRuntimeException(e);
-			}
-			
-			//we'll wait 30 seconds for the server to come back up
-        	for (int i = 0; i < 15; i++) {
-        		try {
-        			getTarget().getProcesses(AdminObject.WILDCARD);
-        			return;
-        		} catch (Exception e) {
-                    //reestablish a connection and retry
-                    try {
-						Thread.sleep(bounceWait);
-					} catch (InterruptedException ex) {
-						throw new TeiidRuntimeException(ex);
-					}                                        
-        		}
-        	}
-		}
+		}		
     }
 
 	public static final String DEFAULT_APPLICATION_NAME = "Admin"; //$NON-NLS-1$
 
-    /**Singleton instance*/
-    private static AdminFactory instance = new AdminFactory(SocketServerConnectionFactory.getInstance(), DEFAULT_BOUNCE_WAIT);
+    private static AdminFactory instance = new AdminFactory(SocketServerConnectionFactory.getInstance());
     
     private ServerConnectionFactory serverConnectionFactory;
-    private int bounceWait;
     
-    AdminFactory(ServerConnectionFactory connFactory, int bounceWait) {
+    AdminFactory(ServerConnectionFactory connFactory) {
     	this.serverConnectionFactory = connFactory;
-    	this.bounceWait = bounceWait;
     }
     
-    /**Get the singleton instance*/
     public static AdminFactory getInstance() {
         return instance;
     }
@@ -155,11 +115,7 @@
      * @param password
      * @param serverURL
      * @return
-     * @throws LogonException
      * @throws AdminException
-     * @throws CommunicationException 
-     * @throws LogonException 
-     * @since 4.3
      */
     public Admin createAdmin(String userName,
                              char[] password,
@@ -174,12 +130,9 @@
      * @param userName
      * @param password
      * @param serverURL
+     * @param applicationName
      * @return
-     * @throws LogonException
      * @throws AdminException
-     * @throws CommunicationException 
-     * @throws LogonException 
-     * @since 4.3
      */
     public Admin createAdmin(String userName,
                                    char[] password,

Deleted: branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/ProcessObject.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -1,140 +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 org.teiid.adminapi;
-
-import java.net.InetAddress;
-import java.util.Date;
-
-
-/** 
- * A Process in the Teiid System
- * 
- * <p>The identifier pattern for a Process is <code>"processName"</code>.
- * This Process identifier is considered to be unique across the system.</p>
- * @since 4.3
- */
-public interface ProcessObject extends
-                        AdminObject {
-    
-  
-    /**
-     * Get the Host name 
-     *  
-     * @return String host name where the process is running
-     * @since 4.3
-     */
-    public String getHostName();	
-	
-	/**
-     * Get the Process name 
-     *  
-     * @return String A unique identifier for this Process.
-     * @since 4.3
-     */
-    public String getProcessName();
-
-
-    /**
-     * Get the port number for this Process
-     *  
-     * @return listener port for this host
-     * @since 4.3
-     */
-    public int getPort();
-    
-    /**
-     * Get the IP address for the Process 
-     * @return the IP address for the Process 
-     * @since 4.3
-     */
-    public InetAddress getInetAddress(); 
-       
-    /**
-     * Is this process enabled in Configuration
-     *  
-     * @return whether this process is enabled.
-     * @since 4.3
-     */
-    public boolean isEnabled();
-
-    /**
-     * @return amount of free memory for this Java process.
-     */
-    public long getFreeMemory();    
-    
-    
-    /**
-     * @return thread count for this Java process.
-     */
-    public int getThreadCount();
-
-    /**
-     * @return total memory allocated for this Java process.
-     */
-    public long getTotalMemory();
-
-    
-    /**
-     * @return whether this process is running.
-     * @since 4.3
-     */
-    public boolean isRunning();
-      
-    /** 
-     * @return Returns the objectsRead.
-     * @since 4.3
-     */
-    public long getObjectsRead();
- 
-    /** 
-     * @return Returns the objectsWritten.
-     * @since 4.3
-     */
-    public long getObjectsWritten();
-    
-    
-    /** 
-     * @return Returns the maxSockets.
-     * @since 4.3
-     */
-    public int getMaxSockets();
-        
-    /** 
-     * @return Returns the sockets.
-     * @since 4.3
-     */
-    public int getSockets();
-        
-    /** 
-     * @return Returns the startTime.
-     * @since 4.3
-     */
-    public Date getStartTime();
-    
-    
-    /** 
-     * @return Returns the queueWorkerPool.
-     * @since 4.3
-     */
-    public WorkerPoolStatistics getQueueWorkerPool();
-}

Deleted: branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -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 org.teiid.adminapi;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-
-
-public abstract class TeiidAdmin implements Admin, Serializable {
-
-	@Override
-	public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
-		ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
-		//list.add(manager.getProcess());
-		return list;		
-	}
-	
-	@Override
-    public void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException {
-		throw new AdminProcessingException("feature coming soon..");
-    }	
-}

Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -30,7 +30,7 @@
 public interface DQPManagement {
     List<RequestMetadata> getRequestsForSession(String sessionId) ;
     List<RequestMetadata> getRequests();
-    WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier);
+    WorkerPoolStatisticsMetadata getWorkerPoolStatistics();
     void terminateSession(String terminateeId);
     boolean cancelRequest(String sessionId, long requestId) throws AdminException;
     Collection<String> getCacheTypes();

Deleted: branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/socket/AdminApiServerDiscovery.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -1,104 +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 org.teiid.net.socket;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.ProcessObject;
-import org.teiid.client.security.LogonResult;
-import org.teiid.net.HostInfo;
-import org.teiid.net.TeiidURL;
-
-
-/**
- * Will discover hosts based upon an anon admin api call.
- */
-public class AdminApiServerDiscovery extends UrlServerDiscovery {
-	
-	/**
-	 * If the FIREWALL_HOST property is set, then this host name will be used instead of the process
-	 * names returned by the AdminApi
-	 */
-	public static final String USE_URL_HOST = "AdminApiServerDiscovery.useUrlHost"; //$NON-NLS-1$
-	
-	public static final int DISCOVERY_TIMEOUT = 120000;
-	
-	static class ClusterInfo {
-		volatile long lastDiscoveryTime;
-		volatile List<HostInfo> knownHosts = new ArrayList<HostInfo>();
-	}
-	
-	private static Map<String, ClusterInfo> clusterInfo = Collections.synchronizedMap(new HashMap<String, ClusterInfo>());
-	
-	private boolean useUrlHost;
-	
-	@Override
-	public void init(TeiidURL url, Properties p) {
-		super.init(url, p);
-		//TODO: this could be on a per cluster basis
-		useUrlHost = Boolean.valueOf(p.getProperty(USE_URL_HOST)).booleanValue();
-	}
-	
-	@Override
-	public List<HostInfo> getKnownHosts(LogonResult result,
-			SocketServerInstance instance) {
-		if (result == null) {
-			return super.getKnownHosts(result, instance);
-		}
-		ClusterInfo info = clusterInfo.get(result.getClusterName());
-		if (info == null) {
-			info = new ClusterInfo();
-		}
-		synchronized (info) {
-			if (instance != null 
-					&& (info.lastDiscoveryTime < System.currentTimeMillis() - DISCOVERY_TIMEOUT || info.knownHosts.isEmpty())) {
-				Admin serverAdmin = instance.getService(Admin.class);
-				try {
-					Collection<ProcessObject> processes = serverAdmin.getProcesses("*"); //$NON-NLS-1$
-					info.knownHosts.clear();
-					for (ProcessObject processObject : processes) {
-						if (!processObject.isEnabled() || !processObject.isRunning()) {
-							continue;
-						}
-						info.knownHosts.add(new HostInfo(useUrlHost?instance.getHostInfo().getHostName():processObject.getInetAddress().getHostName(), processObject.getPort()));
-					}
-					info.lastDiscoveryTime = System.currentTimeMillis();
-				} catch (AdminException e) {
-					//ignore - will get an update on the next successful connection
-				}
-			}
-			if (info.knownHosts.size() == 0) {
-				return super.getKnownHosts(result, instance);
-			}
-			return new ArrayList<HostInfo>(info.knownHosts);
-		}
-	}
-}

Deleted: branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestAdminApiServerDiscovery.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -1,79 +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 org.teiid.net.socket;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.mockito.Mockito;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.ProcessObject;
-import org.teiid.client.security.LogonResult;
-import org.teiid.net.HostInfo;
-import org.teiid.net.TeiidURL;
-
-
-public class TestAdminApiServerDiscovery extends TestCase {
-
-	public void testFirewallHost() throws Exception {
-		AdminApiServerDiscovery discovery = new AdminApiServerDiscovery();
-		Properties p = new Properties();
-		p.setProperty(AdminApiServerDiscovery.USE_URL_HOST, Boolean.TRUE.toString());
-		TeiidURL mmurl = new TeiidURL("foo", 1, false); //$NON-NLS-1$
-		discovery.init(mmurl, p);
-		HostInfo knownHost = mmurl.getHostInfo().get(0);
-		//we will start off using the url host
-		assertEquals(1, discovery.getKnownHosts(null, null).size()); 
-		
-		SocketServerInstance instance = Mockito.mock(SocketServerInstance.class);
-		Admin serverAdmin = Mockito.mock(Admin.class);
-		
-		List<ProcessObject> processes = new ArrayList<ProcessObject>();
-		ProcessObject p1 = Mockito.mock(ProcessObject.class);
-		Mockito.stub(p1.getPort()).toReturn(5);
-		processes.add(p1);
-		ProcessObject p2 = Mockito.mock(ProcessObject.class);
-		Mockito.stub(p2.isEnabled()).toReturn(true);
-		Mockito.stub(p2.isRunning()).toReturn(true);
-		Mockito.stub(p2.getPort()).toReturn(6);
-		Mockito.stub(p2.getInetAddress()).toReturn(InetAddress.getByName("0.0.0.0")); //$NON-NLS-1$
-		processes.add(p2);
-		Mockito.stub(serverAdmin.getProcesses("*")).toReturn(processes); //$NON-NLS-1$
-		Mockito.stub(instance.getService(Admin.class)).toReturn(serverAdmin);
-		Mockito.stub(instance.getHostInfo()).toReturn(knownHost);
-		
-		discovery.connectionSuccessful(knownHost);
-		List<HostInfo> knownHosts = discovery.getKnownHosts(new LogonResult(), instance);
-		
-		assertEquals(1, knownHosts.size());
-		HostInfo h = knownHosts.get(0);
-		//the returned host should have the url name, but the process port
-		assertEquals("foo", h.getHostName()); //$NON-NLS-1$
-		assertEquals(6, h.getPortNumber());
-	}
-	
-}

Modified: branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/client/src/test/java/org/teiid/net/socket/TestSocketServiceRegistry.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -29,13 +29,12 @@
 import org.teiid.adminapi.Admin;
 import org.teiid.adminapi.AdminException;
 import org.teiid.client.DQP;
-import org.teiid.client.security.ILogon;
 import org.teiid.client.util.ExceptionUtil;
 import org.teiid.client.xa.XATransactionException;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidRuntimeException;
 
-
+ at SuppressWarnings("nls")
 public class TestSocketServiceRegistry extends TestCase {
 
 	interface Foo{
@@ -53,7 +52,7 @@
 	
 	public void testAdminExceptionConversion() throws Exception {
 		
-		Method m = Admin.class.getMethod("getProcesses", new Class[] {String.class});
+		Method m = Admin.class.getMethod("getCacheStats", new Class[] {String.class});
 		
 		Throwable t = ExceptionUtil.convertException(m, new TeiidComponentException());
 		

Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -472,7 +472,7 @@
     	return this.requests.get(processorID);
 	}
 	
-    public WorkerPoolStatisticsMetadata getWorkManagerStatistics() {
+    public WorkerPoolStatisticsMetadata getWorkerPoolStatistics() {
     	return this.processWorkerPool.getStats();
     }
            

Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -23,6 +23,7 @@
 package org.teiid.adminapi.jboss;
 
 import java.io.InputStream;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
@@ -59,7 +60,6 @@
 import org.teiid.adminapi.PropertyDefinition;
 import org.teiid.adminapi.Request;
 import org.teiid.adminapi.Session;
-import org.teiid.adminapi.TeiidAdmin;
 import org.teiid.adminapi.Transaction;
 import org.teiid.adminapi.Translator;
 import org.teiid.adminapi.VDB;
@@ -75,7 +75,7 @@
 import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
 import org.teiid.jboss.IntegrationPlugin;
 
-public class Admin extends TeiidAdmin {	
+public class Admin implements org.teiid.adminapi.Admin, Serializable {	
 	private static final String CONNECTOR_PREFIX = "connector-"; //$NON-NLS-1$
 	private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
 	private static final long serialVersionUID = 7081309086056911304L;
@@ -355,10 +355,10 @@
 	}
 	
 	@Override
-	public WorkerPoolStatistics getWorkManagerStats(String identifier) throws AdminException {
+	public WorkerPoolStatistics getWorkerPoolStats() throws AdminException {
 		try {
 			ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
-			MetaValue value = ManagedUtil.executeOperation(mc, "getWorkManagerStatistics", SimpleValueSupport.wrap(identifier));//$NON-NLS-1$
+			MetaValue value = ManagedUtil.executeOperation(mc, "getWorkerPoolStatistics");//$NON-NLS-1$
 			return (WorkerPoolStatistics)MetaValueFactory.getInstance().unwrap(value, WorkerPoolStatisticsMetadata.class);	
 		} catch (Exception e) {
 			throw new AdminComponentException(e.getMessage(), e);

Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2010-10-11 15:02:22 UTC (rev 2640)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2010-10-11 16:42:47 UTC (rev 2641)
@@ -29,7 +29,6 @@
 import java.sql.Clob;
 import java.sql.SQLException;
 import java.sql.SQLXML;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -393,16 +392,9 @@
 	
 	
 	@Override
-	@ManagementOperation(description="Get Runtime workmanager statistics", impact=Impact.ReadOnly,params={@ManagementParameter(name="identifier",description="Use \"runtime\" for engine, or connector name for connector")})
-    public WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier) {
-		if ("runtime".equalsIgnoreCase(identifier)) { //$NON-NLS-1$
-			return this.dqpCore.getWorkManagerStatistics();
-		}
-		/*ConnectorManager cm = this.dqpCore.getConnectorManagerRepository().getConnectorManager(identifier);
-		if (cm != null) {
-			return cm.getWorkManagerStatistics();
-		}*/
-		return null;
+	@ManagementOperation(description="Get thread statistics worker pool", impact=Impact.ReadOnly,params={@ManagementParameter(name="identifier",description="Get thread statistics worker pool")})
+    public WorkerPoolStatisticsMetadata getWorkerPoolStatistics(){
+		return this.dqpCore.getWorkerPoolStatistics();
 	}
 	
 	@Override



More information about the teiid-commits mailing list