From: <gla...@hy...> - 2010-03-17 18:36:38
|
Author: glaullon Date: 2010-03-17 11:36:30 -0700 (Wed, 17 Mar 2010) New Revision: 14391 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14391 Modified: trunk/plugins/tomcat/src/org/hyperic/hq/plugin/tomcat/TomcatServerDetector.java Log: Tomcat / TC Server Modified: trunk/plugins/tomcat/src/org/hyperic/hq/plugin/tomcat/TomcatServerDetector.java =================================================================== --- trunk/plugins/tomcat/src/org/hyperic/hq/plugin/tomcat/TomcatServerDetector.java 2010-03-17 18:30:15 UTC (rev 14390) +++ trunk/plugins/tomcat/src/org/hyperic/hq/plugin/tomcat/TomcatServerDetector.java 2010-03-17 18:36:30 UTC (rev 14391) @@ -23,6 +23,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.hyperic.hq.product.PluginException; import org.hyperic.hq.product.ProductPlugin; @@ -31,6 +34,7 @@ import org.hyperic.hq.product.jmx.MxServerDetector; import org.hyperic.hq.product.jmx.MxUtil; import org.hyperic.hq.product.jmx.MxServerDetector.MxProcess; +import org.hyperic.hq.product.pluginxml.PluginData; import org.hyperic.util.config.ConfigOption; import org.hyperic.util.config.ConfigResponse; import org.hyperic.util.config.ConfigSchema; @@ -168,18 +172,32 @@ if (!correctVersion) { return false; } - // catalina-ha.jar will be in both tc Server 6.0 and Apache Tomcat 6.0. - // We need - // to further distinguish.... - final String tcServerVersionFile = getTypeProperty("SpringSource tc Server 6.0", "VERSION_FILE"); - if (tcServerVersionFile == null) { - // tc Server plugin is not installed - return true; + + Iterator keys = PluginData.getGlobalProperties().keySet().iterator(); + String extend_server = null; + while (keys.hasNext()) { + String key = (String) keys.next(); + if (key.toUpperCase().endsWith(".EXTENDS")) { + String val = (String) PluginData.getGlobalProperties().get(key); + Pattern p = Pattern.compile(val); + Matcher m = p.matcher(getTypeInfo().getName()); + boolean find = m.find(); + getLog().debug("[isInstallTypeVersion] " + key + "=" + val + " (" + getTypeInfo().getName() + ") m.find()=" + find); + if (find) { + extend_server = key.substring(0, key.lastIndexOf(".")); + final String tcServerVersionFile = getTypeProperty(extend_server, "VERSION_FILE"); + if (tcServerVersionFile != null) { + File file = new File(catalinaHome, tcServerVersionFile); + if (file.exists()) { + getLog().debug("[isInstallTypeVersion] '" + getTypeInfo().getName() + " [" + process.getInstallPath() + "]' is a '" + extend_server + "'"); + return false; + } else { + getLog().debug("[isInstallTypeVersion] '" + getTypeInfo().getName() + " [" + process.getInstallPath() + "]' is not a '" + extend_server + "'"); + } + } + } + } } - File file = new File(catalinaHome, tcServerVersionFile); - if (file.exists()) { - return false; - } return true; } |