[infinispan-commits] Infinispan SVN: r918 - trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Oct 7 08:59:24 EDT 2009
Author: galder.zamarreno at jboss.com
Date: 2009-10-07 08:59:24 -0400 (Wed, 07 Oct 2009)
New Revision: 918
Added:
trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerComponent.java
trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerDiscovery.java
Removed:
trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanComponent.java
trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanDiscovery.java
Modified:
trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheComponent.java
trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheDiscovery.java
Log:
[ISPN-135] (Automatically generate the JOPR XML descriptor for the JOPR plugin) Renamed Infinispan* classes to CacheManager* because they reprensent discovery of a cache manager and the cache manager component itself.
Modified: trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheComponent.java
===================================================================
--- trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheComponent.java 2009-10-07 12:55:35 UTC (rev 917)
+++ trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheComponent.java 2009-10-07 12:59:24 UTC (rev 918)
@@ -46,8 +46,9 @@
* Component class for Caches within Infinispan
*
* @author Heiko W. Rupp
+ * @author Galder Zamarreño
*/
-public class CacheComponent implements ResourceComponent<InfinispanComponent>, MeasurementFacet, OperationFacet {
+public class CacheComponent implements ResourceComponent<CacheManagerComponent>, MeasurementFacet, OperationFacet {
private final Log log = LogFactory.getLog(this.getClass());
/**
@@ -62,7 +63,7 @@
}
- private ResourceContext<InfinispanComponent> context;
+ private ResourceContext<CacheManagerComponent> context;
/**
* The naming pattern of the current bean without the actual bean name
*/
@@ -84,7 +85,7 @@
*
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
*/
- public void start(ResourceContext<InfinispanComponent> context) throws Exception {
+ public void start(ResourceContext<CacheManagerComponent> context) throws Exception {
this.context = context;
//
Modified: trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheDiscovery.java
===================================================================
--- trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheDiscovery.java 2009-10-07 12:55:35 UTC (rev 917)
+++ trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheDiscovery.java 2009-10-07 12:59:24 UTC (rev 918)
@@ -38,8 +38,9 @@
* Discovery class for individual cache instances
*
* @author Heiko W. Rupp
+ * @author Galder Zamarreño
*/
-public class CacheDiscovery implements ResourceDiscoveryComponent<InfinispanComponent> {
+public class CacheDiscovery implements ResourceDiscoveryComponent<CacheManagerComponent> {
private static final Log log = LogFactory.getLog(CacheDiscovery.class);
/**
@@ -50,7 +51,7 @@
/**
* Run the discovery
*/
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<InfinispanComponent> discoveryContext) throws Exception {
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<CacheManagerComponent> discoveryContext) throws Exception {
if (log.isTraceEnabled()) log.trace("Discover resources with context: " + discoveryContext);
Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
Copied: trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerComponent.java (from rev 915, trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanComponent.java)
===================================================================
--- trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerComponent.java (rev 0)
+++ trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerComponent.java 2009-10-07 12:59:24 UTC (rev 918)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.jopr.infinispan;
+
+import org.mc4j.ems.connection.EmsConnection;
+import org.mc4j.ems.connection.bean.EmsBean;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+
+import java.util.Set;
+
+/**
+ * The component class for the Infinispan manager
+ *
+ * @author Heiko W. Rupp
+ * @author Galder Zamarreño
+ */
+public class CacheManagerComponent implements ResourceComponent, MeasurementFacet {
+ private ResourceContext context;
+ private ConnectionHelper helper;
+
+
+ /**
+ * Return availability of this resource. We do this by checking the connection to it. If the Manager would expose
+ * some "run state" we could check for that too.
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
+ */
+ public AvailabilityType getAvailability() {
+ EmsConnection conn = getConnection();
+ try {
+ conn.refresh();
+ EmsBean bean = conn.getBean(context.getResourceKey());
+ if (bean != null)
+ bean.refreshAttributes();
+ return AvailabilityType.UP;
+ } catch (Exception e) {
+ return AvailabilityType.DOWN;
+ }
+ }
+
+ /**
+ * Start the resource connection
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
+ */
+ public void start(ResourceContext context) throws InvalidPluginConfigurationException, Exception {
+
+ this.context = context;
+ helper = new ConnectionHelper();
+ getConnection();
+ }
+
+ /**
+ * Tear down the rescource connection
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop()
+ */
+ public void stop() {
+ helper.closeConnection();
+
+ }
+
+ /**
+ * Gather measurement data
+ *
+ * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport,
+ * java.util.Set)
+ */
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
+
+ EmsConnection conn = getConnection();
+ EmsBean bean = conn.getBean(context.getPluginConfiguration().getSimpleValue("objectName", null));
+ bean.refreshAttributes();
+
+ for (MeasurementScheduleRequest req : metrics) {
+ // TODO check with Traits in the future - also why are the values Strings?
+ String tmp = (String) bean.getAttribute(req.getName()).getValue();
+ Double val = Double.valueOf(tmp);
+ MeasurementDataNumeric res = new MeasurementDataNumeric(req, val);
+ report.addData(res);
+ }
+ }
+
+ /**
+ * Helper to obtain a connection
+ *
+ * @return EmsConnection object
+ */
+ protected EmsConnection getConnection() {
+ EmsConnection conn = helper.getEmsConnection(context.getPluginConfiguration());
+ return conn;
+ }
+
+}
\ No newline at end of file
Copied: trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerDiscovery.java (from rev 917, trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanDiscovery.java)
===================================================================
--- trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerDiscovery.java (rev 0)
+++ trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/CacheManagerDiscovery.java 2009-10-07 12:59:24 UTC (rev 918)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.jopr.infinispan;
+
+import static org.infinispan.jmx.CacheManagerJmxRegistration.*;
+import static org.infinispan.jmx.ComponentsJmxRegistration.*;
+import static org.infinispan.manager.DefaultCacheManager.*;
+import org.infinispan.util.logging.Log;
+import org.infinispan.util.logging.LogFactory;
+import org.mc4j.ems.connection.EmsConnection;
+import org.mc4j.ems.connection.bean.EmsBean;
+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.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jmx.JMXDiscoveryComponent;
+import org.rhq.plugins.jmx.ObjectNameQueryUtility;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Discovery class for Infinispan engines
+ *
+ * @author Heiko W. Rupp
+ * @author Galder Zamarreño
+ */
+public class CacheManagerDiscovery implements ResourceDiscoveryComponent<CacheManagerComponent> {
+ private static final Log log = LogFactory.getLog(CacheManagerDiscovery.class);
+
+// // Assume a java5+ jmx-remote connector on port 6996
+// public static String REMOTE = "service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:6996/jmxrmi";
+
+// public static String MANAGER_OBJECT = "*:cache-name=[global],jmx-resource=CacheManager";
+
+ private static final String MANAGER_OBJECT = "*:" + CACHE_NAME_KEY + '=' + GLOBAL_JMX_GROUP + "," + JMX_RESOURCE_KEY + "=" + OBJECT_NAME;
+ private static final String CONNECTOR = "org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor";
+
+ /**
+ * Run the discovery
+ */
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<CacheManagerComponent> discoveryContext) throws Exception {
+ boolean trace = log.isTraceEnabled();
+ if (trace) log.trace("Discover resources with context: " + discoveryContext);
+
+ Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
+ // TODO check if we e.g. run inside a JBossAS to which we have a connection already that we can reuse.
+ Configuration c = discoveryContext.getDefaultPluginConfiguration();
+ c.put(c.getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY));
+ c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, CONNECTOR));
+ c.put(new PropertySimple("objectName", MANAGER_OBJECT));
+
+// c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY, c.getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY)));
+// c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, connector));
+// c.put(new PropertySimple("objectName", MANAGER_OBJECT));
+
+ ConnectionHelper helper = new ConnectionHelper();
+ EmsConnection conn = helper.getEmsConnection(c);
+
+ if (trace) log.trace("Connection to ems server stablished: " + conn);
+
+ // Run query for manager_object
+ ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(MANAGER_OBJECT);
+ List<EmsBean> beans = conn.queryBeans(queryUtility.getTranslatedQuery());
+ if (trace) log.trace("Querying [" + queryUtility.getTranslatedQuery() + "] returned beans: " + beans);
+
+ for (EmsBean bean : beans) {
+
+ String managerName = bean.getBeanName().getCanonicalName();
+ c.put(new PropertySimple("objectName", managerName));
+ /**
+ *
+ * A discovered resource must have a unique key, that must
+ * stay the same when the resource is discovered the next
+ * time
+ */
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
+ discoveryContext.getResourceType(), // ResourceType
+ managerName, // Resource Key
+ "Infinispan Cache Manager", // Resource Name
+ null, // Version TODO can we get that from discovery ?
+ "The Infinispan Manager", // Description
+ c, // Plugin Config
+ null // Process info from a process scan
+ );
+
+ // Add to return values
+ discoveredResources.add(detail);
+ log.info("Discovered Infinispan instance: " + managerName);
+ }
+ return discoveredResources;
+
+ }
+}
\ No newline at end of file
Deleted: trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanComponent.java
===================================================================
--- trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanComponent.java 2009-10-07 12:55:35 UTC (rev 917)
+++ trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanComponent.java 2009-10-07 12:59:24 UTC (rev 918)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.jopr.infinispan;
-
-import org.mc4j.ems.connection.EmsConnection;
-import org.mc4j.ems.connection.bean.EmsBean;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-
-import java.util.Set;
-
-/**
- * The component class for the Infinispan manager
- *
- * @author Heiko W. Rupp
- */
-public class InfinispanComponent implements ResourceComponent, MeasurementFacet {
- private ResourceContext context;
- private ConnectionHelper helper;
-
-
- /**
- * Return availability of this resource. We do this by checking the connection to it. If the Manager would expose
- * some "run state" we could check for that too.
- *
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
- */
- public AvailabilityType getAvailability() {
- EmsConnection conn = getConnection();
- try {
- conn.refresh();
- EmsBean bean = conn.getBean(context.getResourceKey());
- if (bean != null)
- bean.refreshAttributes();
- return AvailabilityType.UP;
- } catch (Exception e) {
- return AvailabilityType.DOWN;
- }
- }
-
- /**
- * Start the resource connection
- *
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
- */
- public void start(ResourceContext context) throws InvalidPluginConfigurationException, Exception {
-
- this.context = context;
- helper = new ConnectionHelper();
- getConnection();
- }
-
- /**
- * Tear down the rescource connection
- *
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop()
- */
- public void stop() {
- helper.closeConnection();
-
- }
-
- /**
- * Gather measurement data
- *
- * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport,
- * java.util.Set)
- */
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
-
- EmsConnection conn = getConnection();
- EmsBean bean = conn.getBean(context.getPluginConfiguration().getSimpleValue("objectName", null));
- bean.refreshAttributes();
-
- for (MeasurementScheduleRequest req : metrics) {
- // TODO check with Traits in the future - also why are the values Strings?
- String tmp = (String) bean.getAttribute(req.getName()).getValue();
- Double val = Double.valueOf(tmp);
- MeasurementDataNumeric res = new MeasurementDataNumeric(req, val);
- report.addData(res);
- }
- }
-
- /**
- * Helper to obtain a connection
- *
- * @return EmsConnection object
- */
- protected EmsConnection getConnection() {
- EmsConnection conn = helper.getEmsConnection(context.getPluginConfiguration());
- return conn;
- }
-
-}
\ No newline at end of file
Deleted: trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanDiscovery.java
===================================================================
--- trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanDiscovery.java 2009-10-07 12:55:35 UTC (rev 917)
+++ trunk/jopr-plugin/src/main/java/org/infinispan/jopr/infinispan/InfinispanDiscovery.java 2009-10-07 12:59:24 UTC (rev 918)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.jopr.infinispan;
-
-import static org.infinispan.jmx.CacheManagerJmxRegistration.*;
-import static org.infinispan.jmx.ComponentsJmxRegistration.*;
-import static org.infinispan.manager.DefaultCacheManager.*;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
-import org.mc4j.ems.connection.EmsConnection;
-import org.mc4j.ems.connection.bean.EmsBean;
-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.ResourceDiscoveryComponent;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.plugins.jmx.JMXDiscoveryComponent;
-import org.rhq.plugins.jmx.ObjectNameQueryUtility;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Discovery class for Infinispan engines
- *
- * @author Heiko W. Rupp
- * @author Galder Zamarreño
- */
-public class InfinispanDiscovery implements ResourceDiscoveryComponent<InfinispanComponent> {
- private static final Log log = LogFactory.getLog(InfinispanDiscovery.class);
-
-// // Assume a java5+ jmx-remote connector on port 6996
-// public static String REMOTE = "service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:6996/jmxrmi";
-
-// public static String MANAGER_OBJECT = "*:cache-name=[global],jmx-resource=CacheManager";
-
- private static final String MANAGER_OBJECT = "*:" + CACHE_NAME_KEY + '=' + GLOBAL_JMX_GROUP + "," + JMX_RESOURCE_KEY + "=" + OBJECT_NAME;
- private static final String CONNECTOR = "org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor";
-
- /**
- * Run the discovery
- */
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<InfinispanComponent> discoveryContext) throws Exception {
- boolean trace = log.isTraceEnabled();
- if (trace) log.trace("Discover resources with context: " + discoveryContext);
-
- Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
- // TODO check if we e.g. run inside a JBossAS to which we have a connection already that we can reuse.
- Configuration c = discoveryContext.getDefaultPluginConfiguration();
- c.put(c.getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY));
- c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, CONNECTOR));
- c.put(new PropertySimple("objectName", MANAGER_OBJECT));
-
-// c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY, c.getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY)));
-// c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, connector));
-// c.put(new PropertySimple("objectName", MANAGER_OBJECT));
-
- ConnectionHelper helper = new ConnectionHelper();
- EmsConnection conn = helper.getEmsConnection(c);
-
- if (trace) log.trace("Connection to ems server stablished: " + conn);
-
- // Run query for manager_object
- ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(MANAGER_OBJECT);
- List<EmsBean> beans = conn.queryBeans(queryUtility.getTranslatedQuery());
- if (trace) log.trace("Querying [" + queryUtility.getTranslatedQuery() + "] returned beans: " + beans);
-
- for (EmsBean bean : beans) {
-
- String managerName = bean.getBeanName().getCanonicalName();
- c.put(new PropertySimple("objectName", managerName));
- /**
- *
- * A discovered resource must have a unique key, that must
- * stay the same when the resource is discovered the next
- * time
- */
- DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
- discoveryContext.getResourceType(), // ResourceType
- managerName, // Resource Key
- "Infinispan Cache Manager", // Resource Name
- null, // Version TODO can we get that from discovery ?
- "The Infinispan Manager", // Description
- c, // Plugin Config
- null // Process info from a process scan
- );
-
- // Add to return values
- discoveredResources.add(detail);
- log.info("Discovered Infinispan instance: " + managerName);
- }
- return discoveredResources;
-
- }
-}
\ No newline at end of file
More information about the infinispan-commits
mailing list