[teiid-commits] teiid SVN: r1608 - in trunk/console/src/main/java/org/teiid/rhq/plugin: util and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Nov 30 15:16:38 EST 2009


Author: tejones
Date: 2009-11-30 15:16:38 -0500 (Mon, 30 Nov 2009)
New Revision: 1608

Added:
   trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
Modified:
   trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
Log:
TEIID-807: Moved constants to separate class

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java	2009-11-30 18:04:19 UTC (rev 1607)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java	2009-11-30 20:16:38 UTC (rev 1608)
@@ -21,10 +21,7 @@
  */
 package org.teiid.rhq.plugin;
 
-import java.io.File;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 
 import javax.naming.InitialContext;
@@ -32,22 +29,16 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.ManagedComponent;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
-import org.mc4j.ems.connection.EmsConnection;
-import org.mc4j.ems.connection.bean.EmsBean;
-import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.PropertySimple;
 import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
 import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
 import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
 import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.plugins.jmx.JMXDiscoveryComponent;
+import org.teiid.rhq.plugin.util.PluginConstants;
 
 /**
  * This is the parent node for a MetaMatrix system
@@ -56,7 +47,10 @@
 	
 	private static final Log LOG = LogFactory
 			.getLog(PlatformDiscoveryComponent.class);
+	
+	public static final String p = "connectorAddress"; //$NON-NLS-1$
 
+
 	private final Log log = LogFactory.getLog(this.getClass());
 
 	/**
@@ -73,12 +67,12 @@
 		Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
 
 		InitialContext ic = new InitialContext();
-		ProfileService ps = (ProfileService) ic.lookup("ProfileService");
+		ProfileService ps = (ProfileService) ic.lookup(PluginConstants.PROFILE_SERVICE);
 
 		ManagementView vm = ps.getViewManager();
 		vm.load();
-		ComponentType type = new ComponentType("ConnectionFactory", "NoTx");
-		ManagedComponent mc = vm.getComponent("teiid-runtime-engine",
+		ComponentType type = new ComponentType(PluginConstants.CONNECTION_FACTORY_TYPE, PluginConstants.NO_TX_SUBTYPE);
+		ManagedComponent mc = vm.getComponent(PluginConstants.TEIID_RUNTIME_ENGINE,
 				type);
 
 		/*
@@ -90,6 +84,7 @@
 												// defaultPluginConfig
 
 		String managerName = mc.getName();
+		
 		c.put(new PropertySimple("objectName", managerName));
 		/**
 		 * 
@@ -99,9 +94,9 @@
 		DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
 				discoveryContext.getResourceType(), // ResourceType
 				managerName, // Resource Key
-				"Data Service Runtime Engine", // Resource Name
+				PluginConstants.TEIID_ENGINE_RESOURCE_NAME, // Resource Name
 				null, // Version TODO can we get that from discovery ?
-				"The JBoss Enterprise Data Service Engine", // Description
+				PluginConstants.TEIID_ENGINE_RESOURCE_DESCRIPTION, // Description
 				c, // Plugin Config
 				null // Process info from a process scan
 		);
@@ -110,67 +105,6 @@
 		discoveredResources.add(detail);
 		log.info("Discovered Teiid instance: " + managerName);
 		return discoveredResources;
-
-		// String name = discoveryContext.getResourceType().getName();
-		// String desc = discoveryContext.getResourceType().getDescription();
-		// String version = ConnectionConstants.VERSION;
-		//            
-		//            LOG.info("Discovering " + desc); //$NON-NLS-1$
-		//            
-		//            
-		// // now perform your own discovery mechanism, if you have one. For
-		// each
-		// // resource discovered, you need to
-		// // create a details object that describe the resource that you
-		// // discovered.
-		// HashSet<DiscoveredResourceDetails> set = new
-		// HashSet<DiscoveredResourceDetails>();
-		//
-		// Set<String> systemkeys = null ;
-		//
-		// try {
-		// systemkeys = connMgr.getInstallationSystemKeys();
-		// } catch (Exception e) {
-		// systemkeys = new HashSet(1);
-		// systemkeys.add("NotDefined");
-		//
-		// // TODO
-		// // - when the serverList cannot be obtained
-		//                
-		// // DO NOT throw exception, still want to create the
-		// // resource, but it will show not active / available
-		// }
-		//
-		//
-		//
-		// Iterator<String> serverIter = systemkeys.iterator();
-		// int hostCount = -1;
-		// while (serverIter.hasNext()) {
-		// hostCount++;
-		// String systemKey = serverIter.next();
-		//                    
-		// DiscoveredResourceDetails resource = new
-		// DiscoveredResourceDetails(discoveryContext.getResourceType(),
-		// systemKey, name,
-		// version, desc, null, null);
-		//	
-		// Configuration configuration = resource.getPluginConfiguration();
-		// configuration.put(new PropertySimple(Component.NAME, name));
-		// configuration.put(new PropertySimple(Component.IDENTIFIER, name));
-		// configuration.put(new PropertySimple(Component.SYSTEM_KEY,
-		// systemKey));
-		//	                    
-		//	
-		// set.add(resource);
-		//
-		// }
-		//
-		// return set;
-		// } catch (InvalidPluginConfigurationException ipe) {
-		// throw ipe;
-		// } catch (Throwable t) {
-		// throw new InvalidPluginConfigurationException(t);
-		// }
-		//
+	
 	}
 }
\ No newline at end of file

Added: trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java	                        (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java	2009-11-30 20:16:38 UTC (rev 1608)
@@ -0,0 +1,235 @@
+/*
+ * 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.rhq.plugin.util;
+
+
+/** 
+ * These are the Constants that used in conjunction with using the 
+ * @since 5.5.3
+ */
+public interface PluginConstants {
+	
+	/**
+     * These are properties required for connecting to the profile service and getting a handle
+     * to a specific component related to Teiid.
+     */
+	
+	// The system key is the value used to obtain a connection.   
+	// In embedded, its a predefined value
+	// In enterprise, its the installation directory
+	    public final static String PROFILE_SERVICE = "ProfileService"; //$NON-NLS-1$
+        public final static String CONNECTION_FACTORY_TYPE = "ConnectionFactory"; //$NON-NLS-1$
+        public final static String NO_TX_SUBTYPE = "NoTx"; //$NON-NLS-1$
+        public final static String TEIID_RUNTIME_ENGINE = "teiid-runtime-engine"; //$NON-NLS-1$
+        public final static String TEIID_ENGINE_RESOURCE_NAME = "Data Service Runtime Engine"; //$NON-NLS-1$
+        public final static String TEIID_ENGINE_RESOURCE_DESCRIPTION = "JBoss Enterprise Data Service Runtime Engine"; //$NON-NLS-1$
+//        public final static String INSTALL_DIR = "install.dir"; //$NON-NLS-1$
+
+    /**
+     * These are global properties used by all components
+     */
+        /*
+         * This is the key for the fully qualified identifier. 
+         * For Runtime components it should be the deployedcomponent full name
+         * For Resource components it should be the Service Defn full name
+         * for adding to the value maps for metrics and operations.
+         */
+        public final static String IDENTIFIER = "identifier"; //$NON-NLS-1$
+        
+
+    /**
+     * These properties are exposed via the #getProperty method call.
+     */
+        public static String SYSTEM_NAME = "cluster.name"; //$NON-NLS-1$
+        public static String SYSTEM_NAME_IDENTIFIER = "JGroups"; //$NON-NLS-1$
+        
+        /**
+         * Use these component type names when calling Connection related methods
+         * that require the type.
+         * @since 1.0
+         */
+        public  interface ComponentType {
+            public final static String PLATFORM = "Platform"; //$NON-NLS-1$            
+            
+        	public interface Runtime {
+        		
+        		public interface System {
+					public final static String TYPE = "Runtime.System"; //$NON-NLS-1$
+
+					public static interface Operations {
+
+						public final static String BOUNCE_SYSTEM = "bounceSystem"; //$NON-NLS-1$					
+						public final static String GET_LONGRUNNINGQUERIES = "listLongRunningQueries"; //$NON-NLS-1$
+						
+					}      
+					
+					public static interface Metrics {
+
+						public final static String QUERY_COUNT = "queryCount"; //$NON-NLS-1$            
+						public final static String SESSION_COUNT = "sessionCount"; //$NON-NLS-1$
+						public final static String LONG_RUNNING_QUERIES = "longRunningQueries"; //$NON-NLS-1$     
+						
+					}
+        		}
+        		       		
+        		public interface Host {
+					public final static String TYPE = "Runtime.Host"; //$NON-NLS-1$
+
+					public static interface Operations {
+					   	public final static String GET_HOSTS = "getHosts"; //$NON-NLS-1$            
+											
+					}        			
+        		}
+        		
+        		public interface Process {
+
+					public final static String TYPE = "Runtime.Process"; //$NON-NLS-1$
+					public static interface Operations {
+					
+					}
+       			
+        		}
+        		
+        		
+        		public interface Connector {
+
+					public final static String TYPE = "Runtime.Connector"; //$NON-NLS-1$
+					public static interface Operations {
+
+						public final static String RESTART_CONNECTOR = "restart"; //$NON-NLS-1$            
+						public final static String STOP_CONNECTOR = "stop"; //$NON-NLS-1$ 
+						
+					}
+       			
+        		}
+        		
+//        		public interface Service {
+//
+//					public final static String TYPE = "Runtime.Service"; //$NON-NLS-1$
+//					public static interface Operations {
+//
+//						public final static String RESTART_SERVICE = "restart"; //$NON-NLS-1$            
+//						public final static String STOP_SERVICE = "stop"; //$NON-NLS-1$ 
+//						
+//					}
+//       			
+//        		} 
+        		
+        		public interface Session {
+
+					public final static String TYPE = "Runtime.Sesssion"; //$NON-NLS-1$
+					public static interface Query {
+
+						public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
+					}
+       			
+
+       			
+        		} 
+        		
+        		public interface Queries {
+
+					public final static String TYPE = "Runtime.Queries"; //$NON-NLS-1$
+					public static interface Query {
+
+						public final static String GET_QUERIES = "listQueries"; //$NON-NLS-1$
+					}
+       			
+
+       			
+        		} 
+        	
+        	}
+        	public interface Resource {
+        		public interface Service {
+
+					public final static String TYPE = "Resource.Service"; //$NON-NLS-1$
+					public static interface Operations {
+						
+					}
+					
+					public static interface Query {
+						
+					}
+       			
+        		}   
+        		public interface Connector {
+
+					public final static String TYPE = "Resource.Connector"; //$NON-NLS-1$
+					public static interface Operations {
+						
+					}
+       			
+        		}
+        	}
+        	
+        	public interface Security {
+        		
+        	}
+            /**
+             * Use these metric names when calling getValues() on the connection
+             * interface.
+             * @since 1.0
+             */
+            public  interface Metric {
+            	public final static String HIGH_WATER_MARK = "highWatermark"; //$NON-NLS-1$
+                
+            }
+            
+            /**
+             * Use these operation names when calling executeOperation() on the connection
+             * interface.
+             * @since 1.0
+             */
+            public static interface Operation {
+            	public final static String KILL_REQUEST = "killRequest"; //$NON-NLS-1$
+                public final static String GET_VDBS = "listVDBs"; //$NON-NLS-1$
+                
+                public final static String GET_PROPERTIES = "getProperties"; //$NON-NLS-1$
+                 
+                /**
+                 * Use these value names when calling executeOperation() on the connection
+                 * interface. These will correlate with parameters used in operations.
+                 * @since 1.0
+                 */
+                public static interface Value {
+                	public final static String STOP_NOW = "stopNow"; //$NON-NLS-1$               
+                	public final static String WAIT_UNTIL_FINISHED = "waitUntilFinished"; //$NON-NLS-1$
+                	
+                	public final static String INCLUDE_SOURCE_QUERIES = "includeSourceQueries"; //$NON-NLS-1$
+                	
+                	public final static String LONG_RUNNING_QUERY_LIMIT = "longRunningQueryLimit"; //$NON-NLS-1$
+                	
+                	public final static String FIELD_LIST = "fieldList"; //$NON-NLS-1$
+                	
+                	public final static String REQUEST_ID = "requestID"; //$NON-NLS-1$
+                	
+                	public final static String NAME = "Name"; //$NON-NLS-1$
+                	public final static String VALUE = "Value"; //$NON-NLS-1$
+                    
+                }
+                
+            }
+            
+        }  
+        
+   }



More information about the teiid-commits mailing list