modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/CatalinaServiceComponent.java | 21 +++++- modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/FileConfiguredMBeanResourceComponent.java | 4 - modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ModClusterDiscoveryComponent.java | 31 +++++++--- modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/config/JBossWebServerFile.java | 4 - 4 files changed, 42 insertions(+), 18 deletions(-)
New commits: commit f2bae4b6b175464b5a0e44281727cd7611e3a7f5 Merge: 438c31b 6abff41 Author: Stefan Negrea snegrea@redhat.com Date: Sun Aug 28 10:59:41 2011 -0500
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 438c31bc4e4fb1bde6585b5a153d0d921e7318a4 Author: Stefan Negrea snegrea@redhat.com Date: Sun Aug 28 10:59:14 2011 -0500
BZ728621 - The correct procedure to update mod_cluster properties for JBoss 42 is: 1) update JMX properties 2) invoke refresh command to propagate updates to https 3) persist changes server configuration file so that they are reloaded after a restart
diff --git a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/CatalinaServiceComponent.java b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/CatalinaServiceComponent.java index 1b390c5..6e90103 100644 --- a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/CatalinaServiceComponent.java +++ b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/CatalinaServiceComponent.java @@ -18,6 +18,7 @@ */ package org.rhq.plugins.modcluster;
+import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.ConfigurationUpdateStatus; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; @@ -34,11 +35,21 @@ public class CatalinaServiceComponent extends MBeanResourceComponent {
@Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { + //Update JMX properties super.updateResourceConfiguration(report);
- try { - saveResouceConfigurationToFile(report, true); - } catch (Exception e) { + if (report.getStatus() == ConfigurationUpdateStatus.SUCCESS) { + //Propagate the JMX configuration updates to HTTPD + try { + super.invokeOperation("refresh", new Configuration()); + } catch (Exception e) { + report.setErrorMessage("Failed to save the resource configuration to file. " + e.getMessage()); + } + + //Persist configuration changes to configuration file + if (report.getStatus() == ConfigurationUpdateStatus.SUCCESS) { + saveResouceConfigurationToFile(report, true); + } } }
@@ -63,8 +74,7 @@ public class CatalinaServiceComponent extends MBeanResourceComponent { } } catch (Exception e) { property.setErrorMessage(ThrowableUtil.getStackAsString(e)); - report - .setErrorMessage("Failed setting resource configuration - see property error messages for details"); + report.setErrorMessage("Failed setting resource configuration. " + e.getMessage()); log.info("Failure setting MBean Resource configuration value for " + key, e); } } @@ -72,6 +82,7 @@ public class CatalinaServiceComponent extends MBeanResourceComponent {
jbossWebServerFile.saveConfigurationFile(); } catch (Exception e) { + report.setErrorMessage("Failed to save the resource configuration to file. " + e.getMessage()); log.debug("Unable to save mod_cluster configuration file.", e); } } diff --git a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/FileConfiguredMBeanResourceComponent.java b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/FileConfiguredMBeanResourceComponent.java index b87bfcd..cc7ea37 100644 --- a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/FileConfiguredMBeanResourceComponent.java +++ b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/FileConfiguredMBeanResourceComponent.java @@ -141,8 +141,7 @@ public class FileConfiguredMBeanResourceComponent extends MBeanResourceComponent } } catch (Exception e) { property.setErrorMessage(ThrowableUtil.getStackAsString(e)); - report - .setErrorMessage("Failed setting resource configuration - see property error messages for details"); + report.setErrorMessage("Failed setting resource configuration. " + e.getMessage()); log.info("Failure setting MBean Resource configuration value for " + key, e); } } @@ -150,6 +149,7 @@ public class FileConfiguredMBeanResourceComponent extends MBeanResourceComponent
modClusterBeanFile.saveConfigurationFile(); } catch (Exception e) { + report.setErrorMessage("Failed to save the resource configuration to file. " + e.getMessage()); log.debug("Unable to save mod_cluster configuration file.", e); } } diff --git a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ModClusterDiscoveryComponent.java b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ModClusterDiscoveryComponent.java index b9a73b5..9e4d87e 100644 --- a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ModClusterDiscoveryComponent.java +++ b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ModClusterDiscoveryComponent.java @@ -52,17 +52,32 @@ public class ModClusterDiscoveryComponent extends MBeanResourceDiscoveryComponen
@SuppressWarnings("static-access") public String findServerHomeDirectory(ResourceComponent parentResourceComponent) { - if (parentResourceComponent instanceof ApplicationServerComponent) { - ApplicationServerComponent parentComponent = (ApplicationServerComponent) parentResourceComponent; + try { + if (parentResourceComponent instanceof ApplicationServerComponent) { + ApplicationServerComponent parentComponent = (ApplicationServerComponent) parentResourceComponent;
- return parentComponent.getResourceContext().getPluginConfiguration().getSimple("serverHomeDir") - .getStringValue(); + return parentComponent.getResourceContext().getPluginConfiguration().getSimple("serverHomeDir") + .getStringValue();
- } else if (parentResourceComponent instanceof JBossASServerComponent) { - JBossASServerComponent parentComponent = (JBossASServerComponent) parentResourceComponent; + } + } catch (java.lang.NoClassDefFoundError e) { + //Do absolutely nothing, that means the class loader does not have this module loaded. + //Just continue with the next discovery attempt. + } + + try { + if (parentResourceComponent instanceof JBossASServerComponent) { + + JBossASServerComponent parentComponent = (JBossASServerComponent) parentResourceComponent; + + System.out.println(parentComponent.getPluginConfiguration() + .getSimple(parentComponent.CONFIGURATION_PATH_CONFIG_PROP).getStringValue());
- return parentComponent.getPluginConfiguration().getSimple(parentComponent.JBOSS_HOME_DIR_CONFIG_PROP) - .getStringValue(); + return parentComponent.getPluginConfiguration() + .getSimple(parentComponent.CONFIGURATION_PATH_CONFIG_PROP).getStringValue(); + } + } catch (java.lang.NoClassDefFoundError e) { + //Do absolutely nothing, that means the class loader does not have this module loaded. }
return null; diff --git a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/config/JBossWebServerFile.java b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/config/JBossWebServerFile.java index 01f992e..d5f8680 100644 --- a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/config/JBossWebServerFile.java +++ b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/config/JBossWebServerFile.java @@ -16,7 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - package org.rhq.plugins.modcluster.config;
import java.io.File; @@ -24,7 +23,6 @@ import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.lang.NotImplementedException; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -73,7 +71,7 @@ public class JBossWebServerFile extends AbstractConfigurationFile {
@Override public String getPropertyValue(String propertyName) { - throw new NotImplementedException( + throw new UnsupportedOperationException( "Property values should be retrieved from the JMX interface not from the configuration file."); }