[jopr-commits] JOPR SVN: r1137 - trunk/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat.

jopr-commits at lists.jboss.org jopr-commits at lists.jboss.org
Tue Sep 1 17:08:25 EDT 2009


Author: ips
Date: 2009-09-01 17:08:25 -0400 (Tue, 01 Sep 2009)
New Revision: 1137

Modified:
   trunk/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java
Log:
set catalina.base dir correctly during manual add of a Tomcat Server (fix for part of https://jira.jboss.org/jira/browse/JOPR-354); if port can't be determined during a manual add, display the port as "Unknown Port", rather than "null", in the default Resource name



Modified: trunk/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java
===================================================================
--- trunk/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java	2009-09-01 05:56:59 UTC (rev 1136)
+++ trunk/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java	2009-09-01 21:08:25 UTC (rev 1137)
@@ -222,20 +222,22 @@
     private DiscoveredResourceDetails parsePluginConfig(ResourceDiscoveryContext context,
         Configuration pluginConfiguration) {
 
-        String catalinaHome = pluginConfiguration.getSimpleValue(
-            TomcatServerComponent.PLUGIN_CONFIG_CATALINA_HOME_PATH, "invalid");
+        String catalinaHome = pluginConfiguration.getSimple(
+            TomcatServerComponent.PLUGIN_CONFIG_CATALINA_HOME_PATH).getStringValue();
         try {
             catalinaHome = FileUtils.getCanonicalPath(catalinaHome);
         } catch (Exception e) {
+            log.warn("Failed to canonicalize catalina.home path [" + catalinaHome + "] - cause: " + e);
             // leave as is
         }
         File catalinaHomeDir = new File(catalinaHome);
 
-        String catalinaBase = pluginConfiguration.getSimpleValue(
-            TomcatServerComponent.PLUGIN_CONFIG_CATALINA_HOME_PATH, catalinaHome);
+        String catalinaBase = pluginConfiguration.getSimple(
+            TomcatServerComponent.PLUGIN_CONFIG_CATALINA_BASE_PATH).getStringValue();
         try {
             catalinaBase = FileUtils.getCanonicalPath(catalinaBase);
         } catch (Exception e) {
+            log.warn("Failed to canonicalize catalina.base path [" + catalinaBase + "] - cause: " + e);
             // leave as is
         }
 
@@ -245,7 +247,7 @@
         String port = UNKNOWN_PORT;
         String address = null;
 
-        // TODO : Should we even allow this remote server stuff? I think we risk a resourceKey collsion with a local
+        // TODO : Should we even allow this remote server stuff? I think we risk a resourceKey collision with a local
         // server.
 
         // if the specified home dir does not exist locally assume this is a remote Tomcat server
@@ -268,9 +270,12 @@
             //Don't know how to tackle that problem in a manual add.
             TomcatConfig tomcatConfig = parseTomcatConfig(catalinaBase);
             version = determineVersion(catalinaHome, catalinaBase, systemInfo);
-            address = tomcatConfig.getAddress();
-            hostname = systemInfo.getHostname();
-            port = tomcatConfig.getPort();
+            if (tomcatConfig.getAddress() != null) {
+               address = tomcatConfig.getAddress();
+            }
+            if (tomcatConfig.getPort() != null) {
+               port = tomcatConfig.getPort();
+            }
         }
 
         String productName = PRODUCT_NAME;



More information about the jopr-commits mailing list