From: <do...@hy...> - 2007-06-04 20:19:51
|
Author: dougm Date: 2007-06-04 13:19:48 -0700 (Mon, 04 Jun 2007) New Revision: 4635 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=4635 Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java Log: move resolve() method to WebsphereUtil Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java 2007-06-04 20:13:16 UTC (rev 4634) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereCollector.java 2007-06-04 20:19:48 UTC (rev 4635) @@ -26,7 +26,6 @@ package org.hyperic.hq.plugin.websphere; import java.util.Map; -import java.util.Set; import org.hyperic.hq.product.Collector; import org.hyperic.hq.product.CollectorResult; @@ -156,31 +155,7 @@ protected ObjectName resolve(AdminClient mServer, ObjectName name) throws PluginException { - if (!name.isPattern()) { - return name; - } - try { - Set beans = mServer.queryNames(name, null); - if (beans.size() != 1) { - String msg = - name + " query returned " + - beans.size() + " results"; - throw new PluginException(msg); - } - - ObjectName fullName = - (ObjectName)beans.iterator().next(); - - if (log.isDebugEnabled()) { - log.debug(name + " resolved to: " + fullName); - } - - return fullName; - } catch (Exception e) { - String msg = - "resolve(" + name + "): " + e.getMessage(); - throw new PluginException(msg, e); - } + return WebsphereUtil.resolve(mServer, name); } protected Object getAttribute(AdminClient mServer, Modified: trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java =================================================================== --- trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java 2007-06-04 20:13:16 UTC (rev 4634) +++ trunk/plugins/websphere/src/org/hyperic/hq/plugin/websphere/WebsphereUtil.java 2007-06-04 20:19:48 UTC (rev 4635) @@ -189,6 +189,36 @@ return count; } + public static ObjectName resolve(AdminClient mServer, ObjectName name) + throws PluginException { + + if (!name.isPattern()) { + return name; + } + try { + Set beans = mServer.queryNames(name, null); + if (beans.size() != 1) { + String msg = + name + " query returned " + + beans.size() + " results"; + throw new PluginException(msg); + } + + ObjectName fullName = + (ObjectName)beans.iterator().next(); + + if (log.isDebugEnabled()) { + log.debug(name + " resolved to: " + fullName); + } + + return fullName; + } catch (Exception e) { + String msg = + "resolve(" + name + "): " + e.getMessage(); + throw new PluginException(msg, e); + } + } + public static boolean isRunning(Metric metric) { //for the moment avail == 1 MBean is registered. AdminClient mServer; |