modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 49 ++++++---- modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java | 46 ++++++--- modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDeploymentComponent.java | 21 ++++ modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Ejb3BeanRuntimeComponent.java | 17 +-- modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java | 19 ++- modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterConfigurationDiscovery.java | 11 +- modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterContextComponent.java | 21 ++++ modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java | 4 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/VHostComponent.java | 8 - modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebRuntimeComponent.java | 29 +++-- 10 files changed, 153 insertions(+), 72 deletions(-)
New commits: commit 833fd25e91ba090d69aa4a074b7bd2c766becc11 Author: Thomas Segismont tsegismo@redhat.com Date: Tue Dec 10 13:42:16 2013 +0100
AS7 plugin minor changes: share base component logger and ASConnection verbose mode
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java index a6043c4..2451743 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java @@ -18,6 +18,8 @@ */ package org.rhq.modules.plugins.jbossas7;
+import static org.rhq.modules.plugins.jbossas7.ASConnection.verbose; + import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; @@ -82,6 +84,8 @@ import org.rhq.modules.plugins.jbossas7.json.Result; public class BaseComponent<T extends ResourceComponent<?>> implements AS7Component<T>, MeasurementFacet, ConfigurationFacet, DeleteResourceFacet, CreateChildResourceFacet, OperationFacet {
+ private static final Log LOG = LogFactory.getLog(BaseComponent.class); + static final String INTERNAL = "_internal:"; static final int INTERNAL_SIZE = INTERNAL.length(); static final String EXPRESSION = "_expr:"; @@ -90,7 +94,11 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
public static final String MANAGED_SERVER = "Managed Server";
- final Log log = LogFactory.getLog(this.getClass()); + /** + * @deprecated as of 4.10. Use your own logger or {@link #getLog()} method. + */ + @Deprecated + final Log log = LOG;
ResourceContext<T> context; Configuration pluginConfiguration; @@ -101,7 +109,6 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone String key; boolean includeRuntime;
- private boolean verbose = ASConnection.verbose; private BaseServerComponent serverComponent; protected ASConnection testConnection;
@@ -192,7 +199,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
Result res = getASConnection().execute(op); if (!res.isSuccess()) { - log.warn("Getting metric [" + req.getName() + "] at [ " + address + "] failed: " + getLog().warn("Getting metric [" + req.getName() + "] at [ " + address + "] failed: " + res.getFailureDescription()); continue; } @@ -217,7 +224,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone addMetric2Report(report, req, val, resolveExpression); } } catch (NumberFormatException e) { - log.warn("Non numeric input for [" + req.getName() + "] : [" + val + "]"); + getLog().warn("Non numeric input for [" + req.getName() + "] : [" + val + "]"); } } else if (req.getDataType() == DataType.TRAIT) {
@@ -226,8 +233,8 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone ResolveExpression resolveExpressionOperation = new ResolveExpression(expression); Result result = getASConnection().execute(resolveExpressionOperation); if (!result.isSuccess()) { - if (log.isWarnEnabled()) { - log.warn("Skipping trait [" + req.getName() + if (getLog().isWarnEnabled()) { + getLog().warn("Skipping trait [" + req.getName() + "] in measurement report. Could not resolve expression [" + expression + "], failureDescription:" + result.getFailureDescription()); continue; @@ -250,8 +257,8 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone ResolveExpression resolveExpressionOperation = new ResolveExpression(expression); Result result = getASConnection().execute(resolveExpressionOperation); if (!result.isSuccess()) { - if (log.isWarnEnabled()) { - log.warn("Skipping metric [" + req.getName() + if (getLog().isWarnEnabled()) { + getLog().warn("Skipping metric [" + req.getName() + "] in measurement report. Could not resolve expression [" + expression + "], failureDescription:" + result.getFailureDescription()); return; @@ -354,7 +361,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
@Override public void deleteResource() throws Exception { - log.info("Removing AS7 resource [" + path + "]..."); + getLog().info("Removing AS7 resource [" + path + "]...");
if (context.getResourceType().getName().equals(MANAGED_SERVER)) { // We need to do two steps because of AS7-4032 @@ -461,7 +468,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
JsonNode uploadResult = uploadConnection.finishUpload(); if (verbose) { - log.info(uploadResult); + getLog().info(uploadResult); }
if (ASUploadConnection.isErrorReply(uploadResult)) { @@ -496,7 +503,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone String deploymentName, String hash) {
boolean toServerGroup = context.getResourceKey().contains("server-group="); - log.info("Deploying [" + runtimeName + "] (toDomainOnly=" + !toServerGroup + ")..."); + getLog().info("Deploying [" + runtimeName + "] (toDomainOnly=" + !toServerGroup + ")...");
ASConnection connection = getASConnection();
@@ -546,7 +553,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone resourceKey = serverGroupAddress.getPath();
if (verbose) { - log.info("Deploy operation: " + cop); + getLog().info("Deploy operation: " + cop); }
result = connection.execute(cop, 300); @@ -556,14 +563,14 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone String failureDescription = result.getFailureDescription(); report.setErrorMessage(failureDescription); report.setStatus(CreateResourceStatus.FAILURE); - log.warn("Deploy of [" + runtimeName + "] failed: " + failureDescription); + getLog().warn("Deploy of [" + runtimeName + "] failed: " + failureDescription); } else { report.setStatus(CreateResourceStatus.SUCCESS); report.setResourceName(runtimeName); report.setResourceKey(resourceKey); report.getPackageDetails().setSHA256(hash); report.getPackageDetails().setInstallationTimestamp(System.currentTimeMillis()); - log.info("Deploy of [" + runtimeName + "] succeeded - Resource key is [" + resourceKey + "]."); + getLog().info("Deploy of [" + runtimeName + "] succeeded - Resource key is [" + resourceKey + "]."); }
return report; @@ -656,7 +663,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone } operation.addAdditionalProperty(pl.getName(), items); } else { - log.error("PropertyMap for " + prop.getName() + " not yet supported"); + getLog().error("PropertyMap for " + prop.getName() + " not yet supported"); } } } @@ -698,7 +705,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd; return getObjectForProperty(prop, pds); } else { - log.warn("Property [" + prop.getName() + "] is not understood yet"); + getLog().warn("Property [" + prop.getName() + "] is not understood yet"); return null; } } @@ -866,7 +873,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone if (defaultValue != null) { multicastHost = defaultValue; } else { - log.error("Failed to resolve expression value [" + expressionValue + getLog().error("Failed to resolve expression value [" + expressionValue + "] of 'multicast-address' attribute."); } } @@ -912,4 +919,12 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone } }
+ /** + * Get the logger for AS7 plugin resource components. + * + * @return + */ + public static Log getLog() { + return LOG; + } } diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java index 9a15a85..94c101f 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java @@ -1,5 +1,26 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2013 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + package org.rhq.modules.plugins.jbossas7;
+import static org.rhq.modules.plugins.jbossas7.ASConnection.verbose; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; @@ -29,7 +50,6 @@ import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.pluginapi.content.ContentFacet; import org.rhq.core.pluginapi.content.ContentServices; import org.rhq.core.pluginapi.content.FileContentDelegate; -import org.rhq.core.pluginapi.inventory.CreateResourceReport; import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceContext; @@ -52,8 +72,8 @@ import org.rhq.modules.plugins.jbossas7.json.Result; */ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> implements OperationFacet, ContentFacet {
+ private static final String DOMAIN_DATA_CONTENT_SUBDIR = "/data/content"; - private boolean verbose = ASConnection.verbose; private File deploymentFile;
@Override @@ -123,13 +143,13 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp
@Override public DeployPackagesResponse deployPackages(Set<ResourcePackageDetails> packages, ContentServices contentServices) { - log.debug("Starting deployment.."); + getLog().debug("Starting deployment.."); DeployPackagesResponse response = new DeployPackagesResponse();
if (packages.size() != 1) { response.setOverallRequestResult(ContentResponseResult.FAILURE); response.setOverallRequestErrorMessage("Can only deploy one package at a time"); - log.warn("deployPackages can only deploy one package at a time"); + getLog().warn("deployPackages can only deploy one package at a time"); }
ResourcePackageDetails detail = packages.iterator().next(); @@ -145,7 +165,7 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp } ResourceType resourceType = context.getResourceType();
- log.info("Deploying " + resourceType.getName() + " Resource with key [" + detail.getKey() + "]..."); + getLog().info("Deploying " + resourceType.getName() + " Resource with key [" + detail.getKey() + "]...");
try { contentServices.downloadPackageBits(context.getContentContext(), detail.getKey(), out, true); @@ -158,7 +178,7 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp
JsonNode uploadResult = uploadConnection.finishUpload(); if (verbose) { - log.info(uploadResult); + getLog().info(uploadResult); }
if (ASUploadConnection.isErrorReply(uploadResult)) { @@ -183,7 +203,7 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp response.setOverallRequestResult(ContentResponseResult.FAILURE); }
- log.info("Result of deployment of " + resourceType.getName() + " Resource with key [" + detail.getKey() + "]: " + getLog().info("Result of deployment of " + resourceType.getName() + " Resource with key [" + detail.getKey() + "]: " + response);
return response; @@ -288,7 +308,7 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp return deploymentFile; } } else { - log.warn("Could not determine the location of the deployment - the content descriptor wasn't found for deployment" + getLog().warn("Could not determine the location of the deployment - the content descriptor wasn't found for deployment" + getAddress() + "."); return null; } @@ -296,7 +316,7 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp
Boolean archive = (Boolean) content.get(0).get("archive"); if (archive != null && !archive) { - log.debug("Exploded deployments not supported for retrieving the content."); + getLog().debug("Exploded deployments not supported for retrieving the content."); return null; }
@@ -338,7 +358,7 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp } deploymentFile = getDeploymentFileFromHash(hash, contentPath); } else { - log.warn("Failed to determine the deployment file of " + getAddress() + getLog().warn("Failed to determine the deployment file of " + getAddress() + " deployment. Neither path nor hash attributes were available."); }
@@ -362,7 +382,7 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp
return new File(relativeTo, path); } else { - log.warn("Unsupported property used as a base for deployment path specification: " + relativeTo); + getLog().warn("Unsupported property used as a base for deployment path specification: " + relativeTo); return null; } } @@ -394,8 +414,8 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp FileContentDelegate fileContentDelegate = new FileContentDelegate(); sha256 = fileContentDelegate.retrieveDeploymentSHA(file, context.getResourceDataDirectory()); } catch (Exception iex) { - if (log.isDebugEnabled()) { - log.debug("Problem calculating digest of package [" + file.getPath() + "]." + iex.getMessage()); + if (getLog().isDebugEnabled()) { + getLog().debug("Problem calculating digest of package [" + file.getPath() + "]." + iex.getMessage()); } }
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDeploymentComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDeploymentComponent.java index 54cffbf..532d403 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDeploymentComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DomainDeploymentComponent.java @@ -1,3 +1,22 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2013 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + package org.rhq.modules.plugins.jbossas7;
import java.util.ArrayList; @@ -49,7 +68,7 @@ public class DomainDeploymentComponent extends DeploymentComponent implements Op String resourceKey = context.getResourceKey(); resourceKey = resourceKey.substring(resourceKey.indexOf("=") + 1);
- log.info("Promoting [" + resourceKey + "] to server group(s) [" + serverGroups + "]..."); + getLog().info("Promoting [" + resourceKey + "] to server group(s) [" + serverGroups + "]...");
PropertySimple simple = parameters.getSimple("enabled"); Boolean enabled = false; diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Ejb3BeanRuntimeComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Ejb3BeanRuntimeComponent.java index 7f7bf33..4f8d88a 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Ejb3BeanRuntimeComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/Ejb3BeanRuntimeComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2013 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -13,8 +13,8 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
package org.rhq.modules.plugins.jbossas7; @@ -163,12 +163,13 @@ public class Ejb3BeanRuntimeComponent extends BaseComponent<BaseComponent<?>> { } else { OSGiVersion currentAsVersion = getASVersion(); if (currentAsVersion == null) { - log.warn("Could not determine the AS version while reporting unexpected result of method" + - " stats. Request: " + request); + getLog().warn( + "Could not determine the AS version while reporting unexpected result of method" + + " stats. Request: " + request); } else if (FIRST_VERSION_SUPPORTING_METHOD_STATS.compareTo(currentAsVersion) <= 0) { - log.error("Unexpected type of results when querying method stats for measurement request " + - request + ". Expected map but got " + (value == null ? "null" : - value.getClass().getName())); + getLog().error( + "Unexpected type of results when querying method stats for measurement request " + request + + ". Expected map but got " + (value == null ? "null" : value.getClass().getName())); } } } diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java index 5c02170..c70fd3d 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java @@ -57,10 +57,8 @@ public class ManagedASComponent extends BaseComponent<HostControllerComponent<?> public void start(ResourceContext<HostControllerComponent<?>> hostControllerComponentResourceContext) throws InvalidPluginConfigurationException, Exception { super.start(hostControllerComponentResourceContext); - logFileEventDelegate = new LogFileEventResourceComponentHelper(context); logFileEventDelegate.startLogFileEventPollers(); - }
@Override @@ -87,7 +85,7 @@ public class ManagedASComponent extends BaseComponent<HostControllerComponent<?> try { result = getASConnection().execute(getStatus); } catch (Exception e) { - log.warn(e.getMessage()); + getLog().warn(e.getMessage()); return AvailabilityType.DOWN; } if (!result.isSuccess()) @@ -149,18 +147,21 @@ public class ManagedASComponent extends BaseComponent<HostControllerComponent<?> }
if ("null".equals(val)) { - if (realName.equals("product-name")) + if (realName.equals("product-name")) { val = "JBoss AS"; - else if (realName.equals("product-version")) + } + else if (realName.equals("product-version")) { val = getStringValue(props.get("release-version")); - else - log.debug("Value for " + realName + " was 'null' and no replacement found"); + } + else if (getLog().isDebugEnabled()) { + getLog().debug("Value for " + realName + " was 'null' and no replacement found"); + } } MeasurementDataTrait data = new MeasurementDataTrait(request, val); report.addData(data); } - } else { - log.debug("getSKMRequests failed: " + res.getFailureDescription()); + } else if (getLog().isDebugEnabled()) { + getLog().debug("getSKMRequests failed: " + res.getFailureDescription()); } }
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterConfigurationDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterConfigurationDiscovery.java index d8f3ea1..b58dfd4 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterConfigurationDiscovery.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterConfigurationDiscovery.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2011 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -13,11 +13,14 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + package org.rhq.modules.plugins.jbossas7;
+import static org.rhq.modules.plugins.jbossas7.ASConnection.verbose; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -109,7 +112,7 @@ public class ModClusterConfigurationDiscovery extends SubsystemDiscovery { } }
- if (Boolean.getBoolean("as7plugin.verbose")) + if (verbose) log.info("total path: [" + path + "]");
if (lookForChildren) { diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterContextComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterContextComponent.java index 836b6a7..d22aa32 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterContextComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModClusterContextComponent.java @@ -1,3 +1,22 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2013 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + package org.rhq.modules.plugins.jbossas7;
import org.rhq.core.domain.configuration.Configuration; @@ -27,7 +46,7 @@ public class ModClusterContextComponent extends ModClusterComponent implements A int indexOfSeparator = this.context.getResourceKey().indexOf(":"); context = ProxyInfo.Context.fromString(this.context.getResourceKey().substring(indexOfSeparator + 1)); } catch (Exception e) { - log.warn("Invalid resourcekey is being used for modcluster component: " + e.getMessage()); + getLog().warn("Invalid resourcekey is being used for modcluster component: " + e.getMessage()); return AvailabilityType.DOWN; }
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java index e8f8301..8b68f46 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java @@ -19,6 +19,8 @@
package org.rhq.modules.plugins.jbossas7;
+import static org.rhq.modules.plugins.jbossas7.ASConnection.verbose; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -112,7 +114,7 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon } }
- if (Boolean.getBoolean("as7plugin.verbose")) { + if (verbose) { log.info("total path: [" + path + "]"); }
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/VHostComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/VHostComponent.java index 342bcba..4f67159 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/VHostComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/VHostComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2012 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -13,8 +13,8 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
package org.rhq.modules.plugins.jbossas7; @@ -56,7 +56,7 @@ public class VHostComponent extends BaseComponent<VHostComponent> implements Mea } report.addData(data); } else - log.warn("Could not get aliases for " + getAddress() + ": " + res.getFailureDescription()); + getLog().warn("Could not get aliases for " + getAddress() + ": " + res.getFailureDescription()); } else { leftovers.add(request); } diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebRuntimeComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebRuntimeComponent.java index 072f4d7..9573cfb 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebRuntimeComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebRuntimeComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2012 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -13,9 +13,10 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + package org.rhq.modules.plugins.jbossas7;
import java.io.File; @@ -56,12 +57,12 @@ public class WebRuntimeComponent extends BaseComponent<BaseComponent<?>> { }
if (logFile != null) { - if (log.isDebugEnabled()) { + if (getLog().isDebugEnabled()) { if (logFile.isFile()) { - log.debug("[" + resourceContext.getResourceKey() + "] is using the response time log file [" + getLog().debug("[" + resourceContext.getResourceKey() + "] is using the response time log file [" + logFile + "]"); } else { - log.debug("The response time log file [" + logFile + "] for [" + getLog().debug("The response time log file [" + logFile + "] for [" + resourceContext.getResourceKey() + "] does not exist yet."); } } @@ -70,8 +71,8 @@ public class WebRuntimeComponent extends BaseComponent<BaseComponent<?>> { this.responseTimeLogParser.setExcludes(responseTimeConfig.getExcludes()); this.responseTimeLogParser.setTransforms(responseTimeConfig.getTransforms()); } else { - if (log.isDebugEnabled()) { - log.debug("Cannot monitor response time for [" + resourceContext.getResourceKey() + if (getLog().isDebugEnabled()) { + getLog().debug("Cannot monitor response time for [" + resourceContext.getResourceKey() + "] - unknown log file location"); } } @@ -96,12 +97,12 @@ public class WebRuntimeComponent extends BaseComponent<BaseComponent<?>> { this.responseTimeLogParser.parseLog(callTimeData); report.addData(callTimeData); } catch (Exception e) { - log.error("Failed to retrieve call-time metric '" + RESPONSE_TIME_METRIC + "' for " + getLog().error("Failed to retrieve call-time metric '" + RESPONSE_TIME_METRIC + "' for " + context.getResourceType() + " Resource with key [" + context.getResourceKey() + "].", e); } } else { - log.error("The '" + RESPONSE_TIME_METRIC + "' metric is enabled for " + context.getResourceType() + getLog().error("The '" + RESPONSE_TIME_METRIC + "' metric is enabled for " + context.getResourceType() + " Resource with key [" + context.getResourceKey() + "], but no value is defined for the '" + ResponseTimeConfiguration.RESPONSE_TIME_LOG_FILE_CONFIG_PROP + "' connection property."); // TODO: Communicate this error back to the server for display in the GUI. @@ -147,13 +148,13 @@ public class WebRuntimeComponent extends BaseComponent<BaseComponent<?>> { String logFileName = String.format("rt/%s%s_rt.log", virtualHost, contextRoot); logFile = new File(logDir, logFileName); } else { - if (log.isDebugEnabled()) { - log.debug("Unknown context root for: " + getAddress()); + if (getLog().isDebugEnabled()) { + getLog().debug("Unknown context root for: " + getAddress()); } } } else { - if (log.isDebugEnabled()) { - log.debug("Unknown virtual host for: " + getAddress()); + if (getLog().isDebugEnabled()) { + getLog().debug("Unknown virtual host for: " + getAddress()); } } } catch (Exception e) {
rhq-commits@lists.fedorahosted.org