modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
| 44 -
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/PropertySimpleTest.java
| 3
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigurationMaskingUtility.java
| 198 -----
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSet.java
| 27
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
| 10
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/AbstractGroupResourceConfigurationUIBean.java
| 1
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/EditGroupResourceConfigurationUIBean.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ViewResourceConfigurationUpdateUIBean.java
| 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
| 12
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java
| 12
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
| 5
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
| 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java
| 1
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java
| 1
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ConnectionPropertiesUIBean.java
| 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewConfigurationChildResourceUIBean.java
| 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewPackageChildResourceUIBean.java
| 5
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ManuallyAddChildResourceUIBean.java
| 10
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/history/ViewPluginConfigurationUpdateUIBean.java
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
| 344 +++++++---
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/util/ConfigurationMaskingUtility.java
| 184 +++++
21 files changed, 488 insertions(+), 394 deletions(-)
New commits:
commit 63d7f294509a56abbe4cb5670cab49ad973cbafa
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu May 26 17:14:39 2011 -0400
[BZ 690943] mask password properties in all Configurations returned by SLSB APIs and
unmask them in SLSB APIs that update existing Configurations; remove old masking framework
from core-gui, portal-war, and PropertySimple domain entity, as it is superseded by the
new code in the SLSB layer (
https://bugzilla.redhat.com/show_bug.cgi?id=690943)
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
index f8d4cea..8edc331 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -27,7 +27,6 @@ import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
-import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@@ -46,18 +45,23 @@ import org.jetbrains.annotations.Nullable;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
public class PropertySimple extends Property implements Serializable {
- public static final int MAX_VALUE_LENGTH = 2000;
-
private static final long serialVersionUID = 1L;
- @Column(name = "override")
- private Boolean override;
+ public static final int MAX_VALUE_LENGTH = 2000;
+
+ /**
+ * This is the special value for simple properties of type PASSWORD that are masked.
Masking and unmasking of
+ * PASSWORD properties is done by the ConfigurationManagerBean SLSB, and, for the
sake of security, prevents RHQ
+ * clients from being able to view the current value of PASSWORD properties. The
value is made obscure enough to
+ * make the chances of it being the same as the property's unmasked value next to
nil.
+ */
+ private static final String MASKED_VALUE = "_._._[MaSKeD]_._._";
@Column(name = "string_value", length = MAX_VALUE_LENGTH)
private String stringValue;
- @Transient
- private transient String unmaskedStringValue;
+ @Column(name = "override")
+ private Boolean override;
/**
* Constructor for {@link PropertySimple} that stores a <code>null</code>
value.
@@ -69,9 +73,9 @@ public class PropertySimple extends Property implements Serializable {
protected PropertySimple(PropertySimple original, boolean keepId) {
super(original, keepId);
- this.override = original.override;
- this.unmaskedStringValue = original.unmaskedStringValue;
+
this.stringValue = original.stringValue;
+ this.override = original.override;
}
/**
@@ -99,11 +103,9 @@ public class PropertySimple extends Property implements Serializable
{
return;
}
- String sVal = value.toString();
- if (sVal.length() > MAX_VALUE_LENGTH)
- stringValue = sVal.substring(0, MAX_VALUE_LENGTH);
- else
- stringValue = sVal;
+ String valueAsString = value.toString();
+ stringValue = valueAsString.length() > MAX_VALUE_LENGTH ?
+ valueAsString.substring(0, MAX_VALUE_LENGTH) : valueAsString;
}
/**
@@ -258,12 +260,16 @@ public class PropertySimple extends Property implements Serializable
{
this.override = override;
}
- public String getUnmaskedStringValue() {
- return this.unmaskedStringValue;
+ public boolean isMasked() {
+ return MASKED_VALUE.equals(this.stringValue);
}
- public void setUnmaskedStringValue(String unmaskedStringValue) {
- this.unmaskedStringValue = unmaskedStringValue;
+ public void mask() {
+ // Don't mask properties with null values (i.e. unset properties), otherwise
they will appear to have a
+ // value when rendered in the GUI (see
http://jira.jboss.com/jira/browse/JBNADM-2248).
+ if (this.stringValue != null) {
+ this.stringValue = MASKED_VALUE;
+ }
}
@Override
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/PropertySimpleTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/PropertySimpleTest.java
index 7b49837..ee8960a 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/PropertySimpleTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/PropertySimpleTest.java
@@ -41,7 +41,6 @@ public class PropertySimpleTest {
assertEquals(copy.getName(), original.getName(), "Failed to copy the name
property");
assertEquals(copy.getErrorMessage(), original.getErrorMessage(), "Failed to
copy the errorMessage property");
assertEquals(copy.getOverride(), original.getOverride(), "Failed to copy the
override property");
- assertEquals(copy.getUnmaskedStringValue(), original.getUnmaskedStringValue(),
"Failed to copy the unmaskedStringValue property");
assertEquals(copy.getStringValue(), original.getStringValue(), "Failed to
copy the stringValue property");
}
@@ -55,7 +54,6 @@ public class PropertySimpleTest {
assertEquals(copy.getName(), original.getName(), "Failed to copy the name
property");
assertEquals(copy.getErrorMessage(), original.getErrorMessage(), "Failed to
copy the errorMessage property");
assertEquals(copy.getOverride(), original.getOverride(), "Failed to copy the
override property");
- assertEquals(copy.getUnmaskedStringValue(), original.getUnmaskedStringValue(),
"Failed to copy the unmaskedStringValue property");
assertEquals(copy.getStringValue(), original.getStringValue(), "Failed to
copy the stringValue property");
}
@@ -63,7 +61,6 @@ public class PropertySimpleTest {
PropertySimple original = new PropertySimple("simpleProperty",
"Simple Property");
original.setId(1);
original.setErrorMessage("error message");
- original.setUnmaskedStringValue("Unmasked Simple Property");
return original;
}
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigurationMaskingUtility.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigurationMaskingUtility.java
deleted file mode 100644
index 2c28af9..0000000
---
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigurationMaskingUtility.java
+++ /dev/null
@@ -1,198 +0,0 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * 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 and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser 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.core.gui.configuration;
-
-import java.util.Map;
-
-import org.jetbrains.annotations.NotNull;
-
-import org.rhq.core.domain.configuration.AbstractPropertyMap;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.PropertyList;
-import org.rhq.core.domain.configuration.PropertyMap;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.PropertyDefinition;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.core.domain.configuration.definition.PropertySimpleType;
-
-/**
- * A class that provides static methods for masking and unmasking password properties
within {@link Configuration}s,
- * The reason for masking a property's value is so that the current values of such
properties cannot be viewed by a
- * user by viewing the HTML source of a Configuration GUI page, e.g.:
- *
- * <input type="password" value="MASKED" .../>
- *
- * would be rendered, rather than:
- *
- * <input type="password" value="actual_password"
.../>
- *
- * @author Ian Springer
- */
-public abstract class ConfigurationMaskingUtility {
-
- private static final String MASKED_PROPERTY_VALUE = "___MASKED___";
-
- /**
- * Mask the values of all simple properties of type PASSWORD in the configuration.
The configuration does not
- * need to be normalized; that is, properties defined by the configuration definition
do not need to exist in the
- * configuration.
- *
- * @param configuration the configuration to be masked
- * @param configurationDefinition the configuration definition corresponding to the
specified configuration
- */
- public static void maskConfiguration(@NotNull
- Configuration configuration, @NotNull
- ConfigurationDefinition configurationDefinition) {
- if (configurationDefinition == null)
- return;
-
- Map<String, PropertyDefinition> childPropertyDefinitions =
configurationDefinition.getPropertyDefinitions();
- for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values()) {
- maskProperty(childPropertyDefinition, configuration);
- }
- }
-
- /**
- * Unmask the values of all masked simple properties of type PASSWORD in the
configuration. The configuration does not
- * need to be normalized; that is, properties defined by the configuration definition
do not need to exist in the
- * configuration.
- *
- * @param configuration the configuration to be unmasked
- * @param configurationDefinition the configuration definition corresponding to the
specified configuration
- */
- public static void unmaskConfiguration(@NotNull
- Configuration configuration, @NotNull
- ConfigurationDefinition configurationDefinition) {
- if (configurationDefinition == null)
- return;
-
- Map<String, PropertyDefinition> childPropertyDefinitions =
configurationDefinition.getPropertyDefinitions();
- for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values()) {
- unmaskProperty(childPropertyDefinition, configuration);
- }
- }
-
- private static void maskProperty(PropertyDefinition propertyDefinition,
AbstractPropertyMap parentPropertyMap) {
- if (parentPropertyMap.get(propertyDefinition.getName()) == null) {
- // If the property doesn't even exist, there's nothing to mask.
- return;
- }
- if (propertyDefinition instanceof PropertyDefinitionSimple) {
- PropertyDefinitionSimple propertyDefinitionSimple =
(PropertyDefinitionSimple) propertyDefinition;
- if (propertyDefinitionSimple.getType() == PropertySimpleType.PASSWORD) {
- // It's a password - squirrel away the unmasked value, then mask it.
- PropertySimple propertySimple =
parentPropertyMap.getSimple(propertyDefinition.getName());
- if (propertySimple.getStringValue() == null) {
- // Don't mask properties with null values (i.e. unset
properties), otherwise they will appear to have a
- // value when rendered in the GUI (see
http://jira.jboss.com/jira/browse/JBNADM-2248).
- return;
- }
- if (MASKED_PROPERTY_VALUE.equals(propertySimple.getStringValue())) {
- throw new IllegalStateException(
- "maskConfiguration() was called more than once on the same
Configuration.");
- }
- propertySimple.setUnmaskedStringValue(propertySimple.getStringValue());
- propertySimple.setStringValue(MASKED_PROPERTY_VALUE);
- }
- }
- // If the property is a Map, recurse into it and mask its child properties.
- else if (propertyDefinition instanceof PropertyDefinitionMap) {
- PropertyMap propertyMap =
parentPropertyMap.getMap(propertyDefinition.getName());
- PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap)
propertyDefinition;
- maskPropertyMap(propertyMap, propertyDefinitionMap);
- } else if (propertyDefinition instanceof PropertyDefinitionList) {
- PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList)
propertyDefinition;
- PropertyDefinition listMemberPropertyDefinition =
propertyDefinitionList.getMemberDefinition();
- // If the property is a List of Maps, iterate the list, and recurse into each
Map and mask its child
- // properties.
- if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
- PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap)
listMemberPropertyDefinition;
- PropertyList propertyList =
parentPropertyMap.getList(propertyDefinition.getName());
- for (Property property : propertyList.getList()) {
- PropertyMap propertyMap = (PropertyMap) property;
- maskPropertyMap(propertyMap, propertyDefinitionMap);
- }
- }
- }
- }
-
- private static void maskPropertyMap(AbstractPropertyMap propertyMap,
PropertyDefinitionMap propertyDefinitionMap) {
- Map<String, PropertyDefinition> childPropertyDefinitions =
propertyDefinitionMap.getPropertyDefinitions();
- for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values()) {
- maskProperty(childPropertyDefinition, propertyMap);
- }
- }
-
- private static void unmaskProperty(PropertyDefinition propertyDefinition,
AbstractPropertyMap parentPropertyMap) {
- if (parentPropertyMap.get(propertyDefinition.getName()) == null) {
- // If the property doesn't even exist, there's nothing to unmask.
- return;
- }
- if (propertyDefinition instanceof PropertyDefinitionSimple) {
- PropertyDefinitionSimple propertyDefinitionSimple =
(PropertyDefinitionSimple) propertyDefinition;
- if (propertyDefinitionSimple.getType() == PropertySimpleType.PASSWORD) {
- // It's a password - if it's masked, unmask it.
- PropertySimple propertySimple =
parentPropertyMap.getSimple(propertyDefinition.getName());
- if (MASKED_PROPERTY_VALUE.equals(propertySimple.getStringValue())) {
- if
(MASKED_PROPERTY_VALUE.equals(propertySimple.getUnmaskedStringValue())) {
- throw new IllegalStateException("Unmasked string value of
property '"
- + propertySimple.getName()
- + "' is set to MASKED_PROPERTY_VALUE - something
went very wrong.");
- }
-
propertySimple.setStringValue(propertySimple.getUnmaskedStringValue());
- }
- }
- }
- // If the property is a Map, recurse into it and unmask its child properties.
- else if (propertyDefinition instanceof PropertyDefinitionMap) {
- PropertyMap propertyMap =
parentPropertyMap.getMap(propertyDefinition.getName());
- PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap)
propertyDefinition;
- unmaskPropertyMap(propertyMap, propertyDefinitionMap);
- } else if (propertyDefinition instanceof PropertyDefinitionList) {
- PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList)
propertyDefinition;
- PropertyDefinition listMemberPropertyDefinition =
propertyDefinitionList.getMemberDefinition();
- // If the property is a List of Maps, iterate the list, and recurse into each
Map and unmask its child
- // properties.
- if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
- PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap)
listMemberPropertyDefinition;
- PropertyList propertyList =
parentPropertyMap.getList(propertyDefinition.getName());
- for (int i = 0; i < propertyList.getList().size(); i++) {
- PropertyMap propertyMap = (PropertyMap)
propertyList.getList().get(i);
- unmaskPropertyMap(propertyMap, propertyDefinitionMap);
- }
- }
- }
- }
-
- private static void unmaskPropertyMap(AbstractPropertyMap propertyMap,
PropertyDefinitionMap propertyDefinitionMap) {
- Map<String, PropertyDefinition> childPropertyDefinitions =
propertyDefinitionMap.getPropertyDefinitions();
- for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values()) {
- unmaskProperty(childPropertyDefinition, propertyMap);
- }
- }
-
-}
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSet.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSet.java
index d84aa14..ad0aea8 100644
---
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSet.java
+++
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSet.java
@@ -33,7 +33,6 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
/**
* @author Ian Springer
@@ -60,7 +59,7 @@ public class ConfigurationSet {
return;
Map<String, PropertyDefinition> childPropertyDefinitions =
this.configurationDefinition
.getPropertyDefinitions();
- List<AbstractPropertyMap> sourceParentPropertyMaps = new ArrayList();
+ List<AbstractPropertyMap> sourceParentPropertyMaps = new
ArrayList<AbstractPropertyMap>();
for (ConfigurationSetMember member : this.members)
sourceParentPropertyMaps.add(member.getConfiguration());
for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values())
@@ -72,7 +71,7 @@ public class ConfigurationSet {
return;
Map<String, PropertyDefinition> childPropertyDefinitions =
this.configurationDefinition
.getPropertyDefinitions();
- List<AbstractPropertyMap> sourceParentPropertyMaps = new ArrayList();
+ List<AbstractPropertyMap> sourceParentPropertyMaps = new
ArrayList<AbstractPropertyMap>();
for (ConfigurationSetMember member : this.members)
sourceParentPropertyMaps.add(member.getConfiguration());
for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values())
@@ -91,20 +90,6 @@ public class ConfigurationSet {
return groupConfiguration;
}
- public void mask() {
- for (ConfigurationSetMember member : this.members) {
- ConfigurationMaskingUtility.maskConfiguration(member.getConfiguration(),
this.configurationDefinition);
- }
- ConfigurationMaskingUtility.maskConfiguration(this.groupConfiguration,
this.configurationDefinition);
- }
-
- public void unmask() {
- for (ConfigurationSetMember member : this.members) {
- ConfigurationMaskingUtility.unmaskConfiguration(member.getConfiguration(),
this.configurationDefinition);
- }
- ConfigurationMaskingUtility.unmaskConfiguration(this.groupConfiguration,
this.configurationDefinition);
- }
-
private static void calculateGroupProperty(PropertyDefinition propertyDefinition,
List<AbstractPropertyMap> sourceParentPropertyMaps, AbstractPropertyMap
targetParentPropertyMap) {
if (propertyDefinition instanceof PropertyDefinitionSimple) {
@@ -126,7 +111,7 @@ public class ConfigurationSet {
}
// If the property is a Map, recurse into it and group together its child
properties.
else if (propertyDefinition instanceof PropertyDefinitionMap) {
- List<AbstractPropertyMap> nestedSourceParentPropertyMaps = new
ArrayList();
+ List<AbstractPropertyMap> nestedSourceParentPropertyMaps = new
ArrayList<AbstractPropertyMap>();
for (AbstractPropertyMap sourceParentPropertyMap : sourceParentPropertyMaps)
{
PropertyMap nestedSourceParentPropertyMap = sourceParentPropertyMap
.getMap(propertyDefinition.getName());
@@ -206,7 +191,7 @@ public class ConfigurationSet {
}
// If the property is a Map, recurse into it and merge its child properties.
else if (propertyDefinition instanceof PropertyDefinitionMap) {
- List<AbstractPropertyMap> nestedSourceParentPropertyMaps = new
ArrayList();
+ List<AbstractPropertyMap> nestedSourceParentPropertyMaps = new
ArrayList<AbstractPropertyMap>();
for (AbstractPropertyMap sourceParentPropertyMap : memberParentPropertyMaps)
nestedSourceParentPropertyMaps.add(sourceParentPropertyMap.getMap(propertyDefinition.getName()));
PropertyMap groupPropertyMap =
groupParentPropertyMap.getMap(propertyDefinition.getName());
@@ -257,14 +242,14 @@ public class ConfigurationSet {
private static Map<String, Map<String, Integer>>
createMemberNameValueFrequenciesMap(
List<AbstractPropertyMap> sourceParentPropertyMaps) {
- Map<String, Map<String, Integer>> nameValueFrequenciesMap = new
HashMap();
+ Map<String, Map<String, Integer>> nameValueFrequenciesMap = new
HashMap<String, Map<String, Integer>>();
for (AbstractPropertyMap map : sourceParentPropertyMaps) {
for (String propertyName : map.getMap().keySet()) {
PropertySimple propertySimple = map.getSimple(propertyName);
String propertyValue = (propertySimple != null) ?
propertySimple.getStringValue() : null;
Map<String, Integer> valueFrequencies =
nameValueFrequenciesMap.get(propertyName);
if (valueFrequencies == null) {
- valueFrequencies = new HashMap();
+ valueFrequencies = new HashMap<String, Integer>();
nameValueFrequenciesMap.put(propertyName, valueFrequencies);
}
Integer valueFrequency = (valueFrequencies.containsKey(propertyValue)) ?
(valueFrequencies
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/AbstractGroupResourceConfigurationUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/AbstractGroupResourceConfigurationUIBean.java
index 57e575c..cbf92f7 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/AbstractGroupResourceConfigurationUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/AbstractGroupResourceConfigurationUIBean.java
@@ -84,7 +84,6 @@ public abstract class AbstractGroupResourceConfigurationUIBean {
} else {
this.configurationSet =
GroupResourceConfigurationUtility.buildConfigurationSet(
EnterpriseFacesContextUtility.getSubject(), this.group,
this.resourceConfigurations);
- this.configurationSet.mask();
}
return;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/EditGroupResourceConfigurationUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/EditGroupResourceConfigurationUIBean.java
index a1c2c45..b325f57 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/EditGroupResourceConfigurationUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/EditGroupResourceConfigurationUIBean.java
@@ -67,8 +67,6 @@ public class EditGroupResourceConfigurationUIBean extends
AbstractGroupResourceC
try {
// TODO: See if there's some way for the config renderer to handle
calling applyGroupConfiguration(),
// so the managed bean doesn't have to worry about doing it.
- getConfigurationSet().unmask();
-
getConfigurationSet().applyGroupConfiguration();
getConfigurationManager().scheduleGroupResourceConfigurationUpdate(
EnterpriseFacesContextUtility.getSubject(), getGroup().getId(),
getResourceConfigurations());
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ViewResourceConfigurationUpdateUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ViewResourceConfigurationUpdateUIBean.java
index 551d853..3676272 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ViewResourceConfigurationUpdateUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ViewResourceConfigurationUpdateUIBean.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.configuration.history;
import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import
org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean;
import org.rhq.enterprise.gui.legacy.ParamConstants;
@@ -45,9 +44,6 @@ public class ViewResourceConfigurationUpdateUIBean extends
ExistingResourceConfi
AbstractResourceConfigurationUpdate configurationUpdate =
this.configurationManager
.getResourceConfigurationUpdate(EnterpriseFacesContextUtility.getSubject(),
configId);
Configuration configuration = (configurationUpdate != null) ?
configurationUpdate.getConfiguration() : null;
- if (configuration != null) {
- ConfigurationMaskingUtility.maskConfiguration(configuration,
getConfigurationDefinition());
- }
return configuration;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index 0be2147..698f288 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -47,7 +47,6 @@ import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
@@ -90,7 +89,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
if (isRawSupported() || isStructuredAndRawSupported()) {
initConfigDirectories();
} else {
- rawConfigDirectories = Collections.EMPTY_LIST;
+ rawConfigDirectories = Collections.emptyList();
}
}
@@ -181,7 +180,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
setConfiguration(configuration);
for (RawConfiguration raw : configuration.getRawConfigurations()) {
- System.out.println(raw.getPath() + " -\n" + (new
String(raw.getContents())) + "\n");
+ System.out.println(raw.getPath() + " -\n" + raw.getContents() +
"\n");
}
updateModifiedCache();
@@ -205,11 +204,9 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String updateConfiguration(boolean fromStructured) {
- Configuration mergedConfiguration = null;
- ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
int resourceId = EnterpriseFacesContextUtility.getResource().getId();
+ Configuration mergedConfiguration = getMergedConfiguration();
- mergedConfiguration = getMergedConfiguration();
AbstractResourceConfigurationUpdate updateRequest = this.configurationManager
.updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(),
resourceId,
mergedConfiguration, fromStructured);
@@ -282,9 +279,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
AbstractResourceConfigurationUpdate configurationUpdate =
this.configurationManager
.getLatestResourceConfigurationUpdate(subject, resourceId);
Configuration configuration = (configurationUpdate != null) ?
configurationUpdate.getConfiguration() : null;
- if (configuration != null) {
- ConfigurationMaskingUtility.maskConfiguration(configuration,
getConfigurationDefinition());
- }
return configuration;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java
index f717637..b462508 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java
@@ -18,14 +18,10 @@
*/
package org.rhq.enterprise.gui.configuration.resource;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.*;
-import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -52,10 +48,6 @@ public class ResourceConfigurationComponent {
AbstractResourceConfigurationUpdate configurationUpdate =
configurationManager.getLatestResourceConfigurationUpdate(subject,
resourceId);
Configuration configuration = (configurationUpdate != null) ?
configurationUpdate.getConfiguration() : null;
-
- if (configuration != null) {
- ConfigurationMaskingUtility.maskConfiguration(configuration,
resourceConfigurationDefinition);
- }
}
@@ -70,10 +62,6 @@ public class ResourceConfigurationComponent {
configurationManager.getLatestResourceConfigurationUpdate(subject,
resourceId);
Configuration configuration = (configurationUpdate != null) ?
configurationUpdate.getConfiguration() : null;
- if (configuration != null) {
- ConfigurationMaskingUtility.maskConfiguration(configuration,
resourceConfigurationDefinition);
- }
-
return configuration;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index fb500b7..d356a3f 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -31,13 +31,10 @@ import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-import org.richfaces.model.UploadItem;
-
import javax.ejb.EJBException;
import javax.faces.application.FacesMessage;
import java.io.Serializable;
@@ -147,8 +144,6 @@ public class ResourceConfigurationEditor extends
ResourceConfigurationViewer imp
public String updateConfiguration() {
ConfigurationManagerLocal configurationMgr =
LookupUtil.getConfigurationManager();
- ConfigurationMaskingUtility.unmaskConfiguration(resourceConfiguration,
resourceConfigurationDefinition);
-
try {
AbstractResourceConfigurationUpdate updateRequest;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
index a02cfe1..cd2adb4 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -47,7 +47,6 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.legacy.WebUser;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
@@ -146,11 +145,6 @@ public class ResourceConfigurationViewer {
AbstractResourceConfigurationUpdate configurationUpdate = configurationManager
.getLatestResourceConfigurationUpdate(subject, resourceId);
resourceConfiguration = (configurationUpdate != null) ?
configurationUpdate.getConfiguration() : null;
-
- if (resourceConfiguration != null) {
- ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration,
resourceConfigurationDefinition);
- }
-
}
protected void initRawConfigDirectories() {
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java
index fc142bf..8995d2f 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java
@@ -69,7 +69,6 @@ public abstract class AbstractGroupPluginConfigurationUIBean {
}
this.configurationSet =
GroupPluginConfigurationUtility.buildConfigurationSet(EnterpriseFacesContextUtility
.getSubject(), this.group, this.pluginConfigurations);
- this.configurationSet.mask();
return;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java
index d1f874a..33577f9 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java
@@ -65,7 +65,6 @@ public class EditGroupPluginConfigurationUIBean extends
AbstractGroupPluginConfi
try {
// TODO: See if there's some way for the config renderer to handle
calling applyGroupConfiguration(),
// so the managed bean doesn't have to worry about doing it.
- getConfigurationSet().unmask();
getConfigurationSet().applyGroupConfiguration();
getConfigurationManager().scheduleGroupPluginConfigurationUpdate(
EnterpriseFacesContextUtility.getSubject(), getGroup().getId(),
getPluginConfigurations());
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ConnectionPropertiesUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ConnectionPropertiesUIBean.java
index 4927d8f..fdfeec9 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ConnectionPropertiesUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ConnectionPropertiesUIBean.java
@@ -27,7 +27,6 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
@@ -61,9 +60,6 @@ public class ConnectionPropertiesUIBean extends
AbstractConfigurationUIBean {
protected Configuration lookupConfiguration() {
Configuration configuration =
this.configurationManager.getPluginConfiguration(EnterpriseFacesContextUtility
.getSubject(), EnterpriseFacesContextUtility.getResource().getId());
- if (configuration != null) {
- ConfigurationMaskingUtility.maskConfiguration(configuration,
getConfigurationDefinition());
- }
return configuration;
}
@@ -92,8 +88,6 @@ public class ConnectionPropertiesUIBean extends
AbstractConfigurationUIBean {
}
public String update() {
- ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
-
Subject subject = EnterpriseFacesContextUtility.getSubject();
Resource resource = EnterpriseFacesContextUtility.getResource();
Configuration newConfiguration = getConfiguration();
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewConfigurationChildResourceUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewConfigurationChildResourceUIBean.java
index bdcf336..5b71027 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewConfigurationChildResourceUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewConfigurationChildResourceUIBean.java
@@ -36,7 +36,6 @@ import
org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
@@ -96,7 +95,6 @@ public class CreateNewConfigurationChildResourceUIBean extends
AbstractConfigura
// Collect data for create call
Resource parentResource = EnterpriseFacesContextUtility.getResource();
Configuration resourceConfiguration = getConfiguration();
- ConfigurationMaskingUtility.unmaskConfiguration(resourceConfiguration,
getConfigurationDefinition());
try {
ResourceFactoryManagerLocal resourceFactoryManager =
LookupUtil.getResourceFactoryManager();
@@ -194,7 +192,6 @@ public class CreateNewConfigurationChildResourceUIBean extends
AbstractConfigura
Configuration resourceConfig = (resourceConfigTemplate != null) ?
resourceConfigTemplate.createConfiguration()
: new Configuration();
ConfigurationUtility.normalizeConfiguration(resourceConfig,
getConfigurationDefinition());
- ConfigurationMaskingUtility.maskConfiguration(resourceConfig,
getConfigurationDefinition());
return resourceConfig;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewPackageChildResourceUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewPackageChildResourceUIBean.java
index 3479c4a..3f1a3cc 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewPackageChildResourceUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/CreateNewPackageChildResourceUIBean.java
@@ -47,7 +47,6 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.core.util.exception.ThrowableUtil;
@@ -174,7 +173,6 @@ public class CreateNewPackageChildResourceUIBean {
// Collect data for create call
Resource parentResource = EnterpriseFacesContextUtility.getResource();
Configuration deployTimeConfiguration = getConfiguration();
- ConfigurationMaskingUtility.unmaskConfiguration(deployTimeConfiguration,
getConfigurationDefinition());
String packageName = fileItem.getFileName();
// some browsers (IE in particular) passes an absolute filename, we just want
the name of the file, no paths
@@ -302,9 +300,6 @@ public class CreateNewPackageChildResourceUIBean {
Configuration deployTimeConfiguration = (deployTimeConfigurationTemplates !=
null) ? deployTimeConfigurationTemplates
.createConfiguration()
: new Configuration();
- if (deployTimeConfiguration != null) {
- ConfigurationMaskingUtility.maskConfiguration(deployTimeConfiguration,
configDef);
- }
return deployTimeConfiguration;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ManuallyAddChildResourceUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ManuallyAddChildResourceUIBean.java
index 31b6342..e13befa 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ManuallyAddChildResourceUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ManuallyAddChildResourceUIBean.java
@@ -35,7 +35,6 @@ import
org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.discovery.MergeResourceResponse;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.legacy.ParamConstants;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
@@ -151,7 +150,6 @@ public class ManuallyAddChildResourceUIBean {
}
public String addResource() {
- ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
MergeResourceResponse mergeResourceResponse = null;
try {
mergeResourceResponse =
discoveryBoss.manuallyAddResource(EnterpriseFacesContextUtility.getSubject(),
@@ -221,14 +219,10 @@ public class ManuallyAddChildResourceUIBean {
pluginConfigTemplate = getConfigurationDefinition().getDefaultTemplate();
}
- Configuration pluginConfig = (pluginConfigTemplate != null) ?
pluginConfigTemplate.createConfiguration()
+ configuration = (pluginConfigTemplate != null) ?
pluginConfigTemplate.createConfiguration()
: new Configuration();
- if (pluginConfig != null) {
- ConfigurationMaskingUtility.maskConfiguration(pluginConfig,
this.configurationDefinition);
- configuration = pluginConfig;
- }
- return pluginConfig;
+ return configuration;
}
public ResourceType getType() {
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/history/ViewPluginConfigurationUpdateUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/history/ViewPluginConfigurationUpdateUIBean.java
index ff226c6..c131fd9 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/history/ViewPluginConfigurationUpdateUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/history/ViewPluginConfigurationUpdateUIBean.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.inventory.resource.history;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import
org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean;
import org.rhq.enterprise.gui.legacy.ParamConstants;
@@ -44,9 +43,6 @@ public class ViewPluginConfigurationUpdateUIBean extends
ExistingResourceConfigu
AbstractResourceConfigurationUpdate configurationUpdate =
this.configurationManager
.getPluginConfigurationUpdate(EnterpriseFacesContextUtility.getSubject(),
configId);
Configuration configuration = (configurationUpdate != null) ?
configurationUpdate.getConfiguration() : null;
- if (configuration != null) {
- ConfigurationMaskingUtility.maskConfiguration(configuration,
getConfigurationDefinition());
- }
return configuration;
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 62c12c4..bef0519 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.configuration;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -99,6 +100,7 @@ import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.configuration.job.AbstractGroupConfigurationUpdateJob;
import org.rhq.enterprise.server.configuration.job.GroupPluginConfigurationUpdateJob;
import org.rhq.enterprise.server.configuration.job.GroupResourceConfigurationUpdateJob;
+import org.rhq.enterprise.server.configuration.util.ConfigurationMaskingUtility;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.jaxb.WebServiceTypeAdapter;
import org.rhq.enterprise.server.jaxb.adapter.ConfigurationAdapter;
@@ -173,9 +175,17 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
// Hibernate session goes away.
Query query =
entityManager.createNamedQuery(Configuration.QUERY_GET_PLUGIN_CONFIG_BY_RESOURCE_ID);
query.setParameter("resourceId", resourceId);
- Configuration result = (Configuration) query.getSingleResult();
+ Configuration pluginConfiguration = (Configuration) query.getSingleResult();
- return result;
+ // Mask the configuration before returning it.
+ Resource resource = resourceManager.getResourceById(subjectManager.getOverlord(),
resourceId);
+ ConfigurationDefinition pluginConfigurationDefinition =
getPluginConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), resource.getResourceType().getId());
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ ConfigurationMaskingUtility.maskConfiguration(pluginConfiguration,
pluginConfigurationDefinition);
+
+ return pluginConfiguration;
}
public void completePluginConfigurationUpdate(Integer updateId) {
@@ -200,7 +210,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
resource.setConnected(true);
-
removeAnyExistingInvalidPluginConfigurationErrors(subjectManager.getOverlord(),
resource);
+ removeAnyExistingInvalidPluginConfigurationErrors(resource);
// Flush before merging to ensure the update has been persisted and avoid
StaleStateExceptions.
entityManager.flush();
entityManager.merge(update);
@@ -244,15 +254,20 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
public PluginConfigurationUpdate updatePluginConfiguration(Subject subject, int
resourceId,
- @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration configuration)
throws ResourceNotFoundException {
+ @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration
newPluginConfiguration)
+ throws ResourceNotFoundException {
Subject overlord = subjectManager.getOverlord();
Resource resource = resourceManager.getResourceById(overlord, resourceId);
// make sure the user has the proper permissions to do this
ensureModifyPermission(subject, resource);
+ // Make sure to unmask the configuration before persisting the update.
+ Configuration existingPluginConfiguration = resource.getPluginConfiguration();
+ ConfigurationMaskingUtility.unmaskConfiguration(newPluginConfiguration,
existingPluginConfiguration);
+
// create our new update request and assign it to our resource - its status will
initially be "in progress"
- PluginConfigurationUpdate update = new PluginConfigurationUpdate(resource,
configuration, subject.getName());
+ PluginConfigurationUpdate update = new PluginConfigurationUpdate(resource,
newPluginConfiguration, subject.getName());
update.setStatus(ConfigurationUpdateStatus.SUCCESS);
entityManager.persist(update);
@@ -307,18 +322,36 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
// Hibernate session goes away.
Query query =
entityManager.createNamedQuery(Configuration.QUERY_GET_RESOURCE_CONFIG_BY_RESOURCE_ID);
query.setParameter("resourceId", resourceId);
- Configuration result = (Configuration) query.getSingleResult();
- return result;
+ Configuration resourceConfiguration = (Configuration) query.getSingleResult();
+
+ // Mask the configuration before returning it.
+ Resource resource = resourceManager.getResourceById(subjectManager.getOverlord(),
resourceId);
+ ConfigurationDefinition resourceConfigurationDefinition =
getResourceConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), resource.getResourceType().getId());
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration,
resourceConfigurationDefinition);
+
+ return resourceConfiguration;
}
public ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(Subject
subject, int resourceId,
boolean fromStructured) {
- log.debug("Getting current resource configuration for resource [" +
resourceId + "]");
+ log.debug("Getting current Resource configuration for Resource [" +
resourceId + "]...");
- Resource resource;
- ResourceConfigurationUpdate current;
+ Resource resource = entityManager.getReference(Resource.class, resourceId);
+ if (resource == null) {
+ throw new NoResultException("Cannot get latest resource configuration
for unknown Resource ["
+ + resourceId + "].");
+ }
+
+ if (!authorizationManager.hasResourcePermission(subject,
Permission.CONFIGURE_READ, resource.getId())) {
+ throw new PermissionException("User [" + subject.getName()
+ + "] does not have permission to view Resource configuration for
[" + resource + "].");
+ }
+ ResourceConfigurationUpdate current;
// Get the latest configuration as known to the server (i.e. persisted in the
DB).
try {
Query query = entityManager
@@ -327,19 +360,8 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
current = (ResourceConfigurationUpdate) query.getSingleResult();
resource = current.getResource();
} catch (NoResultException nre) {
- current = null; // The resource hasn't been successfully configured yet.
-
- // We still need the resource, so we can get its agent.
- resource = entityManager.find(Resource.class, resourceId);
- if (resource == null) {
- throw new NoResultException("Cannot get latest resource
configuration for unknown resource ["
- + resourceId + "]");
- }
- }
-
- if (!authorizationManager.hasResourcePermission(subject,
Permission.CONFIGURE_READ, resource.getId())) {
- throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource configuration for
[" + resource + "]");
+ // The Resource hasn't been successfully configured yet - return null.
+ current = null;
}
// Check whether or not a resource configuration update is currently in
progress.
@@ -388,6 +410,14 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
+ "]; will assume latest resource configuration update is the
current resource configuration.");
}
+ // Mask the configuration before returning the update.
+ Configuration configuration = current.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getResourceConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), resource.getResourceType().getId());
+ // We do not want the masked configuration persisted, so detach all entities
before masking the configuration.
+ entityManager.clear();
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+
return current;
}
@@ -424,31 +454,38 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
public PluginConfigurationUpdate getLatestPluginConfigurationUpdate(Subject subject,
int resourceId) {
- log.debug("Getting current plugin configuration for resource [" +
resourceId + "]");
+ log.debug("Getting current plugin configuration for resource [" +
resourceId + "]...");
- Resource resource;
- PluginConfigurationUpdate current;
+ Resource resource = entityManager.getReference(Resource.class, resourceId);
+ if (resource == null) {
+ throw new NoResultException("Cannot get latest plugin configuration for
unknown Resource ["
+ + resourceId + "].");
+ }
+
+ if (!authorizationManager.canViewResource(subject, resource.getId())) {
+ throw new PermissionException("User [" + subject.getName()
+ + "] does not have permission to view plugin configuration for
[" + resource + "].");
+ }
+ PluginConfigurationUpdate current;
// Get the latest configuration as known to the server (i.e. persisted in the
DB).
try {
Query query =
entityManager.createNamedQuery(PluginConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
query.setParameter("resourceId", resourceId);
current = (PluginConfigurationUpdate) query.getSingleResult();
- resource = current.getResource();
- } catch (NoResultException nre) {
- current = null; // The resource hasn't been successfully configured yet.
- // We still need the resource, so we can get its agent.
- resource = entityManager.find(Resource.class, resourceId);
- if (resource == null) {
- throw new NoResultException("Cannot get latest plugin configuration
for unknown resource ["
- + resourceId + "]");
- }
- }
+ resource = current.getResource();
- if (!authorizationManager.canViewResource(subject, resource.getId())) {
- throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view plugin configuration for
[" + resource + "]");
+ // Mask the configuration before returning the update.
+ Configuration configuration = current.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getPluginConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), resource.getResourceType().getId());
+ // We do not want the masked configuration persisted, so detach all entities
before masking the configuration.
+ entityManager.clear();
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ } catch (NoResultException nre) {
+ // The resource hasn't been successfully configured yet - return null.
+ current = null;
}
return current;
@@ -461,7 +498,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
query.setParameter("resourceId", resourceId);
ResourceConfigurationUpdate latestConfigUpdate =
(ResourceConfigurationUpdate) query.getSingleResult();
if (!authorizationManager.hasResourcePermission(subject,
Permission.CONFIGURE_READ, latestConfigUpdate
- .getResource().getId())) {
+ .getResource().getId())) {
throw new PermissionException("User [" + subject.getName()
+ "] does not have permission to view Resource configuration for
["
+ latestConfigUpdate.getResource() + "]");
@@ -592,6 +629,16 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
+ " does not match latest associated
ResourceConfigurationUpdate with SUCCESS status.");
}
}
+
+ // Mask the configurations before returning them.
+ ConfigurationDefinition resourceConfigurationDefinition =
getResourceConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), group.getResourceType().getId());
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (Configuration resourceConfiguration : currentPersistedConfigs.values()) {
+ ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration,
resourceConfigurationDefinition);
+ }
+
return currentPersistedConfigs;
}
@@ -607,6 +654,15 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
// If we got this far, no updates are in progress, so go ahead and load the
plugin configs from the DB.
Map<Integer, Configuration> currentPersistedConfigs =
getPersistedPluginConfigurationsForCompatibleGroup(group);
+ // Mask the configurations before returning them.
+ ConfigurationDefinition pluginConfigurationDefinition =
getPluginConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), group.getResourceType().getId());
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (Configuration pluginConfiguration : currentPersistedConfigs.values()) {
+ ConfigurationMaskingUtility.maskConfiguration(pluginConfiguration,
pluginConfigurationDefinition);
+ }
+
return currentPersistedConfigs;
}
@@ -820,6 +876,9 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
}
+ /**
+ * @deprecated use {@link
#findPluginConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria)}
+ */
@SuppressWarnings("unchecked")
public PageList<PluginConfigurationUpdate>
findPluginConfigurationUpdates(Subject subject, int resourceId,
Long beginDate, Long endDate, PageControl pc) {
@@ -863,9 +922,22 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
}
+ // Mask the configurations before returning the updates.
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (PluginConfigurationUpdate update : updates) {
+ Configuration configuration = update.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getPluginConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), update.getResource().getId());
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+
return new PageList<PluginConfigurationUpdate>(updates, (int) totalCount,
pc);
}
+ /**
+ * @deprecated use {@link
#findResourceConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria)}
+ */
@SuppressWarnings("unchecked")
public PageList<ResourceConfigurationUpdate>
findResourceConfigurationUpdates(Subject subject, Integer resourceId,
Long beginDate, Long endDate, boolean suppressOldest, PageControl pc) {
@@ -912,6 +984,16 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
}
+ // Mask the configurations before returning the updates.
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (ResourceConfigurationUpdate update : updates) {
+ Configuration configuration = update.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getResourceConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), update.getResource().getId());
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+
return new PageList<ResourceConfigurationUpdate>(updates, (int) totalCount,
pc);
}
@@ -1070,7 +1152,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
ResourceConfigurationUpdate newUpdate =
configurationManager.persistNewResourceConfigurationUpdateHistory(
- subject, resourceId, configToUpdate, ConfigurationUpdateStatus.INPROGRESS,
subject.getName(), false);
+ subject, resourceId, configToUpdate,
ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate);
return newUpdate;
}
@@ -1108,7 +1190,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
@Nullable
public ResourceConfigurationUpdate updateResourceConfiguration(Subject subject, int
resourceId,
- @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration newConfiguration)
+ @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration
newResourceConfiguration)
throws ResourceNotFoundException {
if (isStructuredAndRawSupported(resourceId)) {
@@ -1123,14 +1205,19 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
+ "] does not have the permission to update configuration for
resource[id=" + resourceId + "]");
}
- // must do this in a separate transaction so it is committed prior to sending the
agent request
- // (consider synchronizing to avoid the condition where someone calls this method
twice quickly
- // in two different txs which would put two updates in INPROGRESS and cause
havoc)
- ResourceConfigurationUpdate newUpdate;
- // here we call ourself, but we do so via the EJB interface so we pick up the
REQUIRES_NEW semantics
- // this can return null if newConfiguration is not actually different.
- newUpdate =
configurationManager.persistNewResourceConfigurationUpdateHistory(subject, resourceId,
- newConfiguration, ConfigurationUpdateStatus.INPROGRESS, subject.getName(),
false);
+ // Make sure to unmask the configuration before persisting the update.
+ Resource resource = resourceManager.getResource(subjectManager.getOverlord(),
resourceId);
+ Configuration existingResourceConfiguration =
resource.getResourceConfiguration();
+ ConfigurationMaskingUtility.unmaskConfiguration(newResourceConfiguration,
existingResourceConfiguration);
+
+ // Calling the persist method via the EJB interface to pick up the method's
REQUIRES_NEW semantics and persist
+ // the update in a separate transaction; this way, the update is committed prior
to sending the agent request
+ // Note, the persist method will return null if newConfiguration is no different
than the current Resource
+ // configuration.
+ // TODO: Consider synchronizing to avoid the condition where someone calls this
method twice quickly in two
+ // different tx's, which would put two updates in INPROGRESS and cause
havoc.
+ ResourceConfigurationUpdate newUpdate =
configurationManager.persistNewResourceConfigurationUpdateHistory(subject, resourceId,
+ newResourceConfiguration, ConfigurationUpdateStatus.INPROGRESS,
subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate);
@@ -1300,7 +1387,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
// find the current update request that is persisted - this is the one that is
being reported as being complete
ResourceConfigurationUpdate update =
entityManager.find(ResourceConfigurationUpdate.class, response
- .getConfigurationUpdateId());
+ .getConfigurationUpdateId());
if (update == null) {
throw new IllegalStateException(
"The completed request passed in does not match any request for any
resource in inventory: " + response);
@@ -1334,7 +1421,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
public void checkForCompletedGroupResourceConfigurationUpdate(int
resourceConfigUpdateId) {
ResourceConfigurationUpdate resourceConfigUpdate =
entityManager.find(ResourceConfigurationUpdate.class,
- resourceConfigUpdateId);
+ resourceConfigUpdateId);
if (resourceConfigUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS) {
// If this update isn't done, then, by definition, the group update
isn't done either.
return;
@@ -1437,7 +1524,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
public boolean hasPluginConfiguration(int resourceTypeId) {
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- ConfigurationDefinition.QUERY_FIND_PLUGIN_BY_RESOURCE_TYPE_ID);
+ ConfigurationDefinition.QUERY_FIND_PLUGIN_BY_RESOURCE_TYPE_ID);
countQuery.setParameter("resourceTypeId", resourceTypeId);
long count = (Long) countQuery.getSingleResult();
@@ -1525,13 +1612,17 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
public Configuration getConfiguration(Subject subject, int configurationId) {
- return getConfigurationById(configurationId);
+ @SuppressWarnings({"UnnecessaryLocalVariable"})
+ Configuration configuration = getConfigurationById(configurationId);
+ return configuration;
}
public Configuration getConfigurationFromDefaultTemplate(ConfigurationDefinition
definition) {
ConfigurationDefinition managedDefinition =
entityManager.find(ConfigurationDefinition.class, definition
.getId());
- return managedDefinition.getDefaultTemplate().getConfiguration();
+ Configuration configuration =
managedDefinition.getDefaultTemplate().getConfiguration();
+ ConfigurationMaskingUtility.maskConfiguration(configuration, managedDefinition);
+ return configuration;
}
private void handlePluginConfiguratonUpdateRemoteException(Resource resource, String
summary, String detail) {
@@ -1541,10 +1632,8 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
this.resourceManager.addResourceError(invalidPluginConfigError);
}
- private void removeAnyExistingInvalidPluginConfigurationErrors(Subject subject,
Resource resource) {
-
+ private void removeAnyExistingInvalidPluginConfigurationErrors(Resource resource) {
this.resourceManager.clearResourceConfigError(resource.getId());
-
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@@ -1577,10 +1666,14 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
// Create and persist updates for each of the members.
for (Integer resourceId : memberPluginConfigurations.keySet()) {
- Configuration memberResourceConfiguration =
memberPluginConfigurations.get(resourceId);
+ Configuration memberPluginConfiguration =
memberPluginConfigurations.get(resourceId);
+ // Make sure to unmask the configuration before persisting the update.
+ Resource resource = resourceManager.getResource(subjectManager.getOverlord(),
resourceId);
+ Configuration existingPluginConfiguration =
resource.getPluginConfiguration();
+ ConfigurationMaskingUtility.unmaskConfiguration(memberPluginConfiguration,
existingPluginConfiguration);
Resource flyWeight = new Resource(resourceId);
PluginConfigurationUpdate memberUpdate = new
PluginConfigurationUpdate(flyWeight,
- memberResourceConfiguration, subject.getName());
+ memberPluginConfiguration, subject.getName());
memberUpdate.setGroupConfigurationUpdate(groupUpdate);
entityManager.persist(memberUpdate);
}
@@ -1631,14 +1724,18 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
try {
updateId = configurationManager.createGroupConfigurationUpdate(groupUpdate);
} catch (SchedulerException sche) {
- String message = "Error scheduling update for group[id=" +
group.getId() + "]:";
+ String message = "Error scheduling resource configuration update for
group[id=" + group.getId() + "]";
log.error(message, sche);
- new ResourceGroupUpdateException(message + sche.getMessage());
+ throw new ResourceGroupUpdateException(message + ": " + sche);
}
// Create and persist updates for each of the members.
for (Integer resourceId : newResourceConfigurationMap.keySet()) {
Configuration memberResourceConfiguration =
newResourceConfigurationMap.get(resourceId);
+ // Make sure to unmask the configuration before persisting the update.
+ Resource resource = resourceManager.getResource(subjectManager.getOverlord(),
resourceId);
+ Configuration existingResourceConfiguration =
resource.getResourceConfiguration();
+ ConfigurationMaskingUtility.unmaskConfiguration(memberResourceConfiguration,
existingResourceConfiguration);
Resource flyWeight = new Resource(resourceId);
ResourceConfigurationUpdate memberUpdate = new
ResourceConfigurationUpdate(flyWeight,
memberResourceConfiguration, subject.getName());
@@ -1698,12 +1795,18 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
}
+ /**
+ * @deprecated use {@link
#findGroupPluginConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.GroupPluginConfigurationUpdateCriteria)}
+ */
public GroupPluginConfigurationUpdate getGroupPluginConfigurationById(int
configurationUpdateId) {
GroupPluginConfigurationUpdate update =
entityManager.find(GroupPluginConfigurationUpdate.class,
configurationUpdateId);
return update;
}
+ /**
+ * @deprecated use {@link
#findGroupResourceConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria)}
+ */
public GroupResourceConfigurationUpdate getGroupResourceConfigurationById(int
configurationUpdateId) {
GroupResourceConfigurationUpdate update =
entityManager.find(GroupResourceConfigurationUpdate.class,
configurationUpdateId);
@@ -1747,6 +1850,9 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return new PageList<ConfigurationUpdateComposite>(results, (int) count,
pageControl);
}
+ /**
+ * @deprecated use {@link
#findPluginConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria)}
+ */
@SuppressWarnings("unchecked")
public PageList<Integer> findPluginConfigurationUpdatesByParentId(int
configurationUpdateId, PageControl pageControl) {
pageControl.initDefaultOrderingField("cu.modifiedTime");
@@ -1769,6 +1875,9 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return (Long) countQuery.getSingleResult();
}
+ /**
+ * @deprecated use {@link
#findResourceConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria)}
+ */
@SuppressWarnings("unchecked")
public PageList<Integer> findResourceConfigurationUpdatesByParentId(int
groupConfigurationUpdateId,
PageControl pageControl) {
@@ -1796,24 +1905,48 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
public Map<Integer, Configuration>
getResourceConfigurationMapForGroupUpdate(Subject subject,
Integer groupResourceConfigurationUpdateId) {
// this method will perform the CONFIGURE_READ security check for us, no need to
keep reference to result
- getGroupResourceConfigurationUpdate(subject,
groupResourceConfigurationUpdateId);
+ GroupResourceConfigurationUpdate groupResourceConfigurationUpdate =
getGroupResourceConfigurationUpdate(subject,
+ groupResourceConfigurationUpdateId);
Tuple<String, Object> groupIdParameter = new Tuple<String,
Object>("groupConfigurationUpdateId",
groupResourceConfigurationUpdateId);
- return
executeGetConfigurationMapQuery(Configuration.QUERY_GET_RESOURCE_CONFIG_MAP_BY_GROUP_UPDATE_ID,
100,
- groupIdParameter);
+ Map<Integer, Configuration> results =
executeGetConfigurationMapQuery(Configuration.QUERY_GET_RESOURCE_CONFIG_MAP_BY_GROUP_UPDATE_ID,
100,
+ groupIdParameter);
+
+ // Mask the configurations before returning them.
+ ConfigurationDefinition configurationDefinition =
getResourceConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(),
groupResourceConfigurationUpdate.getGroup().getResourceType().getId());
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (Configuration configuration : results.values()) {
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+
+ return results;
}
@SuppressWarnings("unchecked")
public Map<Integer, Configuration>
getPluginConfigurationMapForGroupUpdate(Subject subject,
Integer groupPluginConfigurationUpdateId) {
// this method will perform the CONFIGURE_READ security check for us, no need to
keep reference to result
- getGroupPluginConfigurationUpdate(subject, groupPluginConfigurationUpdateId);
+ GroupPluginConfigurationUpdate groupPluginConfigurationUpdate =
getGroupPluginConfigurationUpdate(subject,
+ groupPluginConfigurationUpdateId);
Tuple<String, Object> groupIdParameter = new Tuple<String,
Object>("groupConfigurationUpdateId",
groupPluginConfigurationUpdateId);
- return
executeGetConfigurationMapQuery(Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_UPDATE_ID,
100,
- groupIdParameter);
+ Map<Integer, Configuration> results =
executeGetConfigurationMapQuery(Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_UPDATE_ID,
100,
+ groupIdParameter);
+
+ // Mask the configurations before returning them.
+ ConfigurationDefinition configurationDefinition =
getPluginConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(),
groupPluginConfigurationUpdate.getGroup().getResourceType().getId());
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (Configuration configuration : results.values()) {
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+
+ return results;
}
@SuppressWarnings("unchecked")
@@ -1839,17 +1972,19 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
resultsSize = (int) count;
}
- // initialize the map to be 150% more than the results, so that the fill factor
only reached 66%
+ // initialize the map to be 150% more than the results, so that the fill factor
only reaches 66%
Map<Integer, Configuration> results = new HashMap<Integer,
Configuration>((int) (resultsSize * 1.5));
List<Object[]> pagedResults = query.getResultList();
for (Object[] result : pagedResults) {
- results.put((Integer) result[0], (Configuration) result[1]);
+ Integer resourceId = (Integer) result[0];
+ Configuration configuration = (Configuration) result[1];
+ results.put(resourceId, configuration);
}
return results;
}
/**
- * @deprecated use criteria-based API
+ * @deprecated use {@link
#findGroupPluginConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.GroupPluginConfigurationUpdateCriteria)}
*/
@SuppressWarnings("unchecked")
public PageList<GroupPluginConfigurationUpdate>
findGroupPluginConfigurationUpdates(int groupId, PageControl pc) {
@@ -1864,14 +1999,13 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
long count = (Long) countQuery.getSingleResult();
- List<GroupPluginConfigurationUpdate> results = null;
- results = query.getResultList();
+ List<GroupPluginConfigurationUpdate> results = query.getResultList();
return new PageList<GroupPluginConfigurationUpdate>(results, (int) count,
pc);
}
/**
- * @deprecated use criteria-based API
+ * @deprecated use {@link
#findGroupResourceConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria)}
*/
@SuppressWarnings("unchecked")
public PageList<GroupResourceConfigurationUpdate>
findGroupResourceConfigurationUpdates(Subject subject,
@@ -1892,8 +2026,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
long count = (Long) countQuery.getSingleResult();
- List<GroupResourceConfigurationUpdate> results = null;
- results = query.getResultList();
+ List<GroupResourceConfigurationUpdate> results = query.getResultList();
return new PageList<GroupResourceConfigurationUpdate>(results, (int) count,
pc);
}
@@ -2051,7 +2184,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
/**
- * @deprecated use criteria-based API
+ * @deprecated use {@link
#findGroupPluginConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.GroupPluginConfigurationUpdateCriteria)}
*/
public GroupPluginConfigurationUpdate getGroupPluginConfigurationUpdate(Subject
subject, int configurationUpdateId) {
GroupPluginConfigurationUpdate update =
getGroupPluginConfigurationById(configurationUpdateId);
@@ -2068,7 +2201,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
/**
- * @deprecated use criteria-based API
+ * @deprecated use {@link
#findGroupResourceConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria)}
*/
public GroupResourceConfigurationUpdate getGroupResourceConfigurationUpdate(Subject
subject,
int configurationUpdateId) {
@@ -2115,7 +2248,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
public Configuration mergeConfiguration(Configuration config) {
-
Configuration out = entityManager.merge(config);
return out;
}
@@ -2134,6 +2266,16 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
PageList<ResourceConfigurationUpdate> updates = queryRunner.execute();
+ // Mask the configurations before returning the updates.
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (ResourceConfigurationUpdate update : updates) {
+ Configuration configuration = update.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getResourceConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), update.getResource().getId());
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+
return updates;
}
@@ -2151,6 +2293,16 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
PageList<PluginConfigurationUpdate> updates = queryRunner.execute();
+ // Mask the configurations before returning the updates.
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (PluginConfigurationUpdate update : updates) {
+ Configuration configuration = update.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getPluginConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(), update.getResource().getId());
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+
return updates;
}
@@ -2168,6 +2320,23 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
PageList<GroupResourceConfigurationUpdate> updates =
queryRunner.execute();
+ List<String> fetchFields = generator.getFetchFields(criteria);
+ Set<String> fetchFieldSet = new HashSet(fetchFields);
+ if (fetchFieldSet.contains("configurationUpdates")) {
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (GroupResourceConfigurationUpdate update : updates) {
+ List<ResourceConfigurationUpdate> memberUpdates =
update.getConfigurationUpdates();
+ // Mask the configurations before returning the updates.
+ for (ResourceConfigurationUpdate memberUpdate : memberUpdates) {
+ Configuration configuration = memberUpdate.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getResourceConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(),
memberUpdate.getResource().getId());
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+ }
+ }
+
return updates;
}
@@ -2185,6 +2354,23 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
PageList<GroupPluginConfigurationUpdate> updates = queryRunner.execute();
+ List<String> fetchFields = generator.getFetchFields(criteria);
+ Set<String> fetchFieldSet = new HashSet(fetchFields);
+ if (fetchFieldSet.contains("configurationUpdates")) {
+ // We do not want the masked configurations persisted, so detach all entities
before masking the configurations.
+ entityManager.clear();
+ for (GroupPluginConfigurationUpdate update : updates) {
+ List<PluginConfigurationUpdate> memberUpdates =
update.getConfigurationUpdates();
+ // Mask the configurations before returning the updates.
+ for (PluginConfigurationUpdate memberUpdate : memberUpdates) {
+ Configuration configuration = memberUpdate.getConfiguration();
+ ConfigurationDefinition configurationDefinition =
getPluginConfigurationDefinitionForResourceType(
+ subjectManager.getOverlord(),
memberUpdate.getResource().getId());
+ ConfigurationMaskingUtility.maskConfiguration(configuration,
configurationDefinition);
+ }
+ }
+ }
+
return updates;
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/util/ConfigurationMaskingUtility.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/util/ConfigurationMaskingUtility.java
new file mode 100644
index 0000000..325d6df
--- /dev/null
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/util/ConfigurationMaskingUtility.java
@@ -0,0 +1,184 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser 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.enterprise.server.configuration.util;
+
+import org.jetbrains.annotations.NotNull;
+import org.rhq.core.domain.configuration.AbstractPropertyMap;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A class that provides static methods for masking and unmasking password properties
within {@link Configuration}s,
+ * The reason for masking a property's value is so that the current values of such
properties cannot be viewed by a
+ * user by viewing the HTML source of a Configuration GUI page, e.g.:
+ *
+ * <input type="password" value="********" .../>
+ *
+ * would be rendered, rather than:
+ *
+ * <input type="password" value="ACTUAL_PASSWORD"
.../>
+ *
+ * @author Ian Springer
+ */
+public class ConfigurationMaskingUtility {
+
+ /**
+ * Mask the values of all simple properties of type PASSWORD in the configuration.
The configuration does not
+ * need to be normalized; that is, properties defined by the configuration definition
do not need to exist in the
+ * configuration.
+ *
+ * @param configuration the configuration to be masked
+ * @param configurationDefinition the configuration definition corresponding to the
specified configuration; this is
+ * used to determine which properties to mask - all
simple properties of type
+ * PASSWORD at any level within the configuration are
masked
+ */
+ public static void maskConfiguration(@NotNull
+ Configuration configuration, @NotNull
+ ConfigurationDefinition configurationDefinition) {
+ if (configurationDefinition == null)
+ return;
+
+ Map<String, PropertyDefinition> childPropertyDefinitions =
configurationDefinition.getPropertyDefinitions();
+ for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values()) {
+ maskProperty(childPropertyDefinition, configuration);
+ }
+ }
+
+ /**
+ * Unmask the values of all masked simple properties of type PASSWORD in the
configuration. The configuration does not
+ * need to be normalized; that is, properties defined by the configuration definition
do not need to exist in the
+ * configuration.
+ *
+ * @param configuration the configuration to be unmasked
+ * @param unmaskedConfiguration the unmasked configuration that should be used as the
reference to unmask the
+ * configuration
+ */
+ public static void unmaskConfiguration(@NotNull
+ Configuration configuration, @NotNull
+ Configuration unmaskedConfiguration) {
+ Map<String, Property> memberProperties = configuration.getAllProperties();
+ for (Property memberProperty : memberProperties.values()) {
+ unmaskProperty(memberProperty.getName(), configuration,
unmaskedConfiguration);
+ }
+ }
+
+ private static void maskProperty(PropertyDefinition propertyDefinition,
AbstractPropertyMap parentPropertyMap) {
+ if (parentPropertyMap.get(propertyDefinition.getName()) == null) {
+ // If the property doesn't even exist, there's nothing to mask.
+ return;
+ }
+ if (propertyDefinition instanceof PropertyDefinitionSimple) {
+ PropertyDefinitionSimple propertyDefinitionSimple =
(PropertyDefinitionSimple) propertyDefinition;
+ if (propertyDefinitionSimple.getType() == PropertySimpleType.PASSWORD) {
+ PropertySimple propertySimple =
parentPropertyMap.getSimple(propertyDefinition.getName());
+ propertySimple.mask();
+ }
+ }
+ // If the property is a Map, recurse into it and mask its child properties.
+ else if (propertyDefinition instanceof PropertyDefinitionMap) {
+ PropertyMap propertyMap =
parentPropertyMap.getMap(propertyDefinition.getName());
+ PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap)
propertyDefinition;
+ maskPropertyMap(propertyMap, propertyDefinitionMap);
+ } else if (propertyDefinition instanceof PropertyDefinitionList) {
+ PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList)
propertyDefinition;
+ PropertyDefinition listMemberPropertyDefinition =
propertyDefinitionList.getMemberDefinition();
+ // If the property is a List of Maps, iterate the list, and recurse into each
Map and mask its child
+ // properties.
+ if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
+ PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap)
listMemberPropertyDefinition;
+ PropertyList propertyList =
parentPropertyMap.getList(propertyDefinition.getName());
+ for (Property property : propertyList.getList()) {
+ PropertyMap propertyMap = (PropertyMap) property;
+ maskPropertyMap(propertyMap, propertyDefinitionMap);
+ }
+ }
+ }
+ }
+
+ private static void maskPropertyMap(AbstractPropertyMap propertyMap,
PropertyDefinitionMap propertyDefinitionMap) {
+ Map<String, PropertyDefinition> childPropertyDefinitions =
propertyDefinitionMap.getPropertyDefinitions();
+ for (PropertyDefinition childPropertyDefinition :
childPropertyDefinitions.values()) {
+ maskProperty(childPropertyDefinition, propertyMap);
+ }
+ }
+
+ private static void unmaskProperty(String propertyName, AbstractPropertyMap
parentPropertyMap,
+ AbstractPropertyMap unmaskedParentPropertyMap) {
+ Property property = parentPropertyMap.get(propertyName);
+ if (property == null) {
+ // The property doesn't even exist, so there's nothing to unmask.
+ return;
+ }
+ if (property instanceof PropertySimple) {
+ PropertySimple propertySimple = (PropertySimple) property;
+ unmaskPropertySimple(propertySimple, unmaskedParentPropertyMap);
+ }
+ // If the property is a Map, recurse into it and unmask its child properties.
+ else if (property instanceof PropertyMap) {
+ PropertyMap propertyMap = (PropertyMap) property;
+ PropertyMap unmaskedPropertyMap =
unmaskedParentPropertyMap.getMap(property.getName());
+ unmaskPropertyMap(propertyMap, unmaskedPropertyMap);
+ } else if (property instanceof PropertyList) {
+ PropertyList propertyList = (PropertyList) property;
+ List<Property> memberProperties = propertyList.getList();
+ // If the property is a List of Maps, iterate the list, and recurse into each
Map and unmask its child
+ // properties.
+ if (!memberProperties.isEmpty() && memberProperties.get(0) instanceof
PropertyMap) {
+ PropertyList unmaskedPropertyList =
unmaskedParentPropertyMap.getList(propertyList.getName());
+ for (int i = 0; i < propertyList.getList().size(); i++) {
+ PropertyMap propertyMap = (PropertyMap) memberProperties.get(i);
+ PropertyMap unmaskedPropertyMap = (PropertyMap)
unmaskedPropertyList.getList().get(i);
+ unmaskPropertyMap(propertyMap, unmaskedPropertyMap);
+ }
+ }
+ }
+ }
+
+ private static void unmaskPropertySimple(PropertySimple propertySimple,
AbstractPropertyMap unmaskedParentPropertyMap) {
+ if (propertySimple.isMasked()) {
+ PropertySimple unmaskedPropertySimple =
unmaskedParentPropertyMap.getSimple(propertySimple.getName());
+ String unmaskedValue = (unmaskedPropertySimple != null) ?
unmaskedPropertySimple.getStringValue() : null;
+ propertySimple.setStringValue(unmaskedValue);
+ }
+ }
+
+ private static void unmaskPropertyMap(AbstractPropertyMap propertyMap, PropertyMap
unmaskedPropertyMap) {
+ Map<String, Property> memberProperties = propertyMap.getMap();
+ for (Property memberProperty : memberProperties.values()) {
+ unmaskProperty(memberProperty.getName(), propertyMap, unmaskedPropertyMap);
+ }
+ }
+
+}
commit af0ce7892063376177d8857307ed0487fc6c3487
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue May 24 09:55:36 2011 -0400
move identical calls out of end of if, else-if, and else blocks, and put a single call
after the if-else
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 1b20ad4..71f5ec5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -253,7 +253,7 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends
Layout> extends Lo
// select the tab and subTab (no event fired, we're already dealing with
the correct path)
this.tabSet.selectTab(tab);
// this call adds the subtab canvas as a member of the subtablayout
- // don't show the subtab canvas until after we perform any necessay
rendering.
+ // don't show the subtab canvas until after we perform any necessary
rendering.
tab.getLayout().selectSubTab(subtab, false);
// get the target canvas
@@ -265,17 +265,12 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends
Layout> extends Lo
// refresh.
if (subView instanceof BookmarkableView) {
((BookmarkableView) subView).renderView(viewPath);
- subView.setVisible(true);
-
} else if (subView instanceof RefreshableView && subView.isDrawn())
{
// Refresh the data on the subtab, so it's not stale.
Log.debug("Refreshing data for [" +
subView.getClass().getName() + "]...");
((RefreshableView) subView).refresh();
- subView.setVisible(true);
-
- } else {
- subView.setVisible(true);
}
+ subView.setVisible(true);
// ensure the tabset is enabled (disabled in onTabSelected), and redraw
this.tabSet.setIgnoreSelectEvents(false);
@@ -336,4 +331,5 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends
Layout> extends Lo
tabSet.destroy();
super.destroy();
}
+
}