.classpath
| 1
.settings/org.eclipse.jdt.ui.prefs
| 4
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
| 22
modules/core/client-api/src/main/resources/rhq-configuration.xsd
| 2
modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
| 2
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/DynamicConfigurationPropertyValue.java
| 70 +
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
| 77 -
modules/core/domain/src/main/java/org/rhq/core/domain/content/Architecture.java
| 6
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
| 10
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
| 6
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
| 2
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
| 81 -
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
| 2
modules/core/domain/src/test/resources/META-INF/persistence.xml
| 37
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileRenderer.java
| 70 +
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileUIComponent.java
| 38
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigRenderer.java
| 58 +
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigUIComponent.java
| 143 +++
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/DynamicPropertyRetriever.java
| 5
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
| 9
modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
| 43
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
| 3
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java
| 49 +
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
| 68 -
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementSupport.java
| 4
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
| 165 ++-
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationUtilityServiceImpl.java
| 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
| 15
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
| 33
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
| 11
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
| 155 +--
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
| 24
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
| 268 +++---
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
| 113 ++
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
| 100 +-
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
| 51 -
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
| 5
modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
| 54 +
modules/core/util/src/test/java/org/rhq/core/template/TemplateEngineTest.java
| 62 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/DatabaseDynamicPropertyRetriever.java
| 5
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
| 439 ++++++----
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java
| 55 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
| 99 ++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/ViewRawTestConfigurationUIBean.java
| 32
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeStateAdvisor.java
| 8
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
| 16
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
| 21
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
| 20
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/test-beans.xml
| 8
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
| 58 -
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tags/on.component.taglib.xml
| 6
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
| 6
modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
| 4
modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
| 25
modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
| 248 +++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
| 2
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
| 373 +++++++-
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
| 56 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
| 45 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
| 420 +++++----
modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
| 31
modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
| 30
modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
| 32
modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
| 52 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
| 49 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBean.java
| 23
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyLocal.java
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
| 6
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
| 71 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
| 97 +-
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBeanTest.java
| 26
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
| 8
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
| 6
modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
| 11
modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
| 35
modules/enterprise/server/plugins/rhnhosted/src/test/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/MockRhnXmlRpcExecutor.java
| 2
modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
| 9
modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
| 6
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
| 42
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
| 80 +
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
| 13
modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
| 38
modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawConfigServerTest.groovy
| 12
modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy
| 2
pom.xml
| 2
91 files changed, 3377 insertions(+), 1140 deletions(-)
New commits:
commit d9e02aa86cd9b4a560a214c93f49cd21fed11bd1
Author: Shannon Hughes <shughes(a)fred.hughes.lan>
Date: Thu Jan 28 22:08:37 2010 -0500
fixing augeas and cobber due to RawConfig refactoring
diff --git
a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
index 272fffb..dd900cf 100644
---
a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
+++
b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
@@ -82,7 +82,7 @@ public class AugeasRawConfigHelper {
aug.save();
toUpdate.setPath(existingConfig.getPath());
- toUpdate.setContents(FileUtils.readFileToByteArray(new File(file)));
+ toUpdate.setContents(FileUtils.readFileToString(new File(file)));
} finally {
if (aug != null) {
aug.close();
@@ -111,18 +111,17 @@ public class AugeasRawConfigHelper {
public void save(RawConfiguration config) throws Exception {
File f = new File(config.getPath());
- FileUtils.writeStringToFile(f, normalizeToUnix(config.getContents()));
+ FileUtils.writeStringToFile(f, config.getContents());
}
private String getFile(Augeas aug) {
return aug.get(transformPrefix + "/incl");
}
- private Augeas createAugeas(String lens, byte[] binary) throws Exception {
+ private Augeas createAugeas(String lens, String contents) throws Exception {
Augeas aug = new Augeas(rootPath, loadPath, Augeas.NO_MODL_AUTOLOAD);
File fl = File.createTempFile("_rhq", null);
- String contents = normalizeToUnix(binary);
- //write the 'to' file to disk
+ //write the 'to' file to disk
FileUtils.writeStringToFile(fl, contents);
aug.set(transformPrefix + "/lens", lens);
aug.set(transformPrefix + "/incl", fl.getAbsolutePath());
diff --git
a/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
b/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
index c0bb0c5..3e80c01 100644
--- a/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
+++ b/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
@@ -123,12 +123,12 @@ public class CobblerComponent extends AugeasConfigurationComponent
implements Au
Set<RawConfiguration> configs = new HashSet<RawConfiguration>();
RawConfiguration modules = new RawConfiguration();
modules.setPath(MODULES_PATH);
- modules.setContents(FileUtils.readFileToByteArray(new File(MODULES_PATH)));
+ modules.setContents(FileUtils.readFileToString(new File(MODULES_PATH)));
configs.add(modules);
RawConfiguration settings = new RawConfiguration();
settings.setPath(SETTINGS_PATH);
- settings.setContents(FileUtils.readFileToByteArray(new
File(SETTINGS_PATH)));
+ settings.setContents(FileUtils.readFileToString(new File(SETTINGS_PATH)));
configs.add(settings);
return configs;
} catch (Exception e) {
@@ -187,7 +187,6 @@ public class CobblerComponent extends AugeasConfigurationComponent
implements Au
// TODO Auto-generated method stub
}
- @Override
public Property createProperty(String propName, String augeasPath, Augeas aug) {
if ("settings/manage_dhcp".equals(propName) ||
"settings/manage_dns".equals(propName)) {
return new PropertySimple(propName,
"1".equals(aug.get(augeasPath)));
@@ -195,7 +194,6 @@ public class CobblerComponent extends AugeasConfigurationComponent
implements Au
return new PropertySimple(propName, aug.get(augeasPath));
}
- @Override
public String getPropertyValue(String propName, Configuration from) {
if ("settings/manage_dhcp".equals(propName) ||
"settings/manage_dns".equals(propName)) {
PropertySimple prop = (PropertySimple) from.get(propName);
commit 0d1eb673a948f025c10a1d4dd5694281b71abec7
Merge: eef9371... 16f0613...
Author: Shannon Hughes <shughes(a)fred.hughes.lan>
Date: Thu Jan 28 20:38:06 2010 -0500
using 3.3.2.sr1 for richfaces conflict.
Conflicts:
pom.xml
commit eef9371ce2a7232e1f2ae9a844d3627a4a2a245d
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Thu Jan 28 10:54:52 2010 -0500
Added package architectures as dynamic config value and updated disk source to use
it.
diff --git a/modules/core/client-api/src/main/resources/rhq-configuration.xsd
b/modules/core/client-api/src/main/resources/rhq-configuration.xsd
index e9791c1..590f459 100644
--- a/modules/core/client-api/src/main/resources/rhq-configuration.xsd
+++ b/modules/core/client-api/src/main/resources/rhq-configuration.xsd
@@ -245,6 +245,7 @@
<xs:enumeration value="roles"/>
<xs:enumeration value="package-types"/>
<xs:enumeration value="resource-type-with-plugin"/>
+ <xs:enumeration value="package-architectures"/>
</xs:restriction>
</xs:simpleType>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Architecture.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Architecture.java
index 0c2411f..40c2c36 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Architecture.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Architecture.java
@@ -45,7 +45,9 @@ import org.rhq.core.domain.resource.Resource;
@Entity
@NamedQueries( {
@NamedQuery(name = Architecture.QUERY_FIND_BY_NAME, query = "SELECT arch FROM
Architecture arch WHERE arch.name = :name"),
- @NamedQuery(name = Architecture.QUERY_FIND_ALL, query = "SELECT arch FROM
Architecture arch") })
+ @NamedQuery(name = Architecture.QUERY_FIND_ALL, query = "SELECT arch FROM
Architecture arch"),
+ @NamedQuery(name = Architecture.QUERY_DYNAMIC_CONFIG_VALUES, query = "SELECT
arch.name, arch.name FROM Architecture arch")
+})
@SequenceGenerator(name = "SEQ", sequenceName =
"RHQ_ARCHITECTURE_ID_SEQ")
@Table(name = "RHQ_ARCHITECTURE")
public class Architecture implements Serializable {
@@ -56,6 +58,8 @@ public class Architecture implements Serializable {
public static final String QUERY_FIND_BY_NAME = "Architecture.findByName";
public static final String QUERY_FIND_ALL = "Architecture.findAll";
+ public static final String QUERY_DYNAMIC_CONFIG_VALUES =
"Architecture.dynamicConfigValues";
+
// Attributes --------------------------------------------
@Column(name = "ID", nullable = false)
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
index ad7d8e0..d84531e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
@@ -28,6 +28,7 @@ import java.util.Map;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.resource.ResourceType;
@@ -44,6 +45,7 @@ public class PropertyExpressionEvaluator {
public static final String KEY_ROLES = "roles";
public static final String KEY_PACKAGE_TYPES = "package-types";
public static final String KEY_RESOURCE_TYPE_PLUGIN =
"resource-type-with-plugin";
+ public static final String KEY_PACKAGE_ARCHITECTURES =
"package-architectures";
/**
* @see #getQueryNameForKey(String)
@@ -56,6 +58,7 @@ public class PropertyExpressionEvaluator {
temp.put(KEY_ROLES, Role.QUERY_DYNAMIC_CONFIG_VALUES);
temp.put(KEY_PACKAGE_TYPES, PackageType.QUERY_DYNAMIC_CONFIG_VALUES);
temp.put(KEY_RESOURCE_TYPE_PLUGIN,
ResourceType.QUERY_DYNAMIC_CONFIG_WITH_PLUGIN);
+ temp.put(KEY_PACKAGE_ARCHITECTURES, Architecture.QUERY_DYNAMIC_CONFIG_VALUES);
KEY_TO_QUERY_NAME = Collections.unmodifiableMap(temp);
}
diff --git
a/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
b/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
index 1a7de07..4ec6f82 100644
---
a/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
+++
b/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -36,8 +36,10 @@
description="The name that identifies the kind of
package this type represents (e.g. 'ear', 'rpm')">
<c:database-backing key="package-types"/>
</c:dynamic-property>
- <c:simple-property name="architectureName"
required="true" summary="true" default="noarch"
- description="The specific hardware architecture
this type of package can be deployed on. If there is no specific architecture required,
use 'noarch'. (e.g. 'i686', 'amd64')"/>
+ <c:dynamic-property name="architectureName"
required="true" summary="true"
+ description="The specific hardware architecture
this type of package can be deployed on. If there is no specific architecture required,
use 'noarch'. (e.g. 'i686', 'amd64')">
+ <c:database-backing key="package-architectures"/>
+ </c:dynamic-property>
<c:dynamic-property name="resourceType"
required="true" summary="true"
description="The name of the resource type on
which this package can be deployed. This is the resource type name as defined in the agent
plugin. (e.g. 'Linux', 'JBossAS Server')">
<c:database-backing
key="resource-type-with-plugin"/>
commit d88b8087990f046be3bb49cdc5586f57b06ddf95
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Thu Jan 28 10:21:14 2010 -0500
Added "Plugin - Resource Type" as a dynamic config property value. Updated
disk source to use this.
diff --git a/modules/core/client-api/src/main/resources/rhq-configuration.xsd
b/modules/core/client-api/src/main/resources/rhq-configuration.xsd
index 869de57..e9791c1 100644
--- a/modules/core/client-api/src/main/resources/rhq-configuration.xsd
+++ b/modules/core/client-api/src/main/resources/rhq-configuration.xsd
@@ -244,6 +244,7 @@
<xs:enumeration value="users"/>
<xs:enumeration value="roles"/>
<xs:enumeration value="package-types"/>
+ <xs:enumeration value="resource-type-with-plugin"/>
</xs:restriction>
</xs:simpleType>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index b0a9776..aed3360 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -185,7 +185,10 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ " SELECT rt.name " //
+ " FROM ResourceType rt " //
+ "GROUP BY rt.name " //
- + " HAVING COUNT(rt.name) > 1") })
+ + " HAVING COUNT(rt.name) > 1"),
+ @NamedQuery(name = ResourceType.QUERY_DYNAMIC_CONFIG_WITH_PLUGIN, query =
"" //
+ + "SELECT rt.plugin || ' - ' || rt.name, rt.plugin || '-' ||
rt.name FROM ResourceType rt" )
+})
@NamedNativeQueries( {
// TODO: Add authz conditions to the below query.
@NamedNativeQuery(name = ResourceType.QUERY_FIND_CHILDREN_BY_CATEGORY, query =
"" //
@@ -231,7 +234,8 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ "FROM RHQ_resource_type_parents rtp2 "
+ "WHERE rtp2.resource_type_id = crt2.id) " + "AND crt2.category =
? " +
// "ORDER BY crt2.name" +
- ")) ORDER BY name", resultSetMapping =
ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY) })
+ ")) ORDER BY name", resultSetMapping =
ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY)
+ })
@SqlResultSetMapping(name = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY, entities = {
@EntityResult(entityClass = ResourceType.class) })
// @Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public class ResourceType implements Externalizable, Comparable<ResourceType> {
@@ -269,6 +273,8 @@ public class ResourceType implements Externalizable,
Comparable<ResourceType> {
public static final String QUERY_FIND_RESOURCE_FACETS =
"ResourceType.findResourceFacets";
public static final String QUERY_FIND_DUPLICATE_TYPE_NAMES =
"ResourceType.findDuplicateTypeNames";
+ public static final String QUERY_DYNAMIC_CONFIG_WITH_PLUGIN =
"ResourceType.dynamicConfigWithPlugin";
+
@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ")
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
index 4a4993d..ad7d8e0 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/PropertyExpressionEvaluator.java
@@ -29,6 +29,7 @@ import java.util.Map;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.resource.ResourceType;
/**
* Translates the configuration property value lookup key into a named query in the
system.
@@ -42,6 +43,7 @@ public class PropertyExpressionEvaluator {
public static final String KEY_USERS = "users";
public static final String KEY_ROLES = "roles";
public static final String KEY_PACKAGE_TYPES = "package-types";
+ public static final String KEY_RESOURCE_TYPE_PLUGIN =
"resource-type-with-plugin";
/**
* @see #getQueryNameForKey(String)
@@ -53,6 +55,7 @@ public class PropertyExpressionEvaluator {
temp.put(KEY_USERS, Subject.QUERY_DYNAMIC_CONFIG_VALUES);
temp.put(KEY_ROLES, Role.QUERY_DYNAMIC_CONFIG_VALUES);
temp.put(KEY_PACKAGE_TYPES, PackageType.QUERY_DYNAMIC_CONFIG_VALUES);
+ temp.put(KEY_RESOURCE_TYPE_PLUGIN,
ResourceType.QUERY_DYNAMIC_CONFIG_WITH_PLUGIN);
KEY_TO_QUERY_NAME = Collections.unmodifiableMap(temp);
}
diff --git
a/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
b/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
index 2c2f204..336117f 100644
---
a/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
+++
b/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
@@ -313,8 +313,15 @@ public class DiskSource implements ContentProvider, PackageSource,
RepoSource {
SupportedPackageType supportedPackageType = new SupportedPackageType();
supportedPackageType.packageTypeName =
configuration.getSimpleValue("packageTypeName", null);
supportedPackageType.architectureName =
configuration.getSimpleValue("architectureName", null);
- supportedPackageType.resourceTypeName =
configuration.getSimpleValue("resourceTypeName", null);
- supportedPackageType.resourceTypePluginName =
configuration.getSimpleValue("resourceTypePluginName", null);
+
+ String resourceAndPlugin =
configuration.getSimpleValue("resourceType", null);
+
+ String resourceType = resourceAndPlugin.substring(
(resourceAndPlugin.indexOf('-') + 1) );
+ String pluginType = resourceAndPlugin.substring(0,
resourceAndPlugin.indexOf('-'));
+
+ supportedPackageType.resourceTypeName = resourceType;
+ supportedPackageType.resourceTypePluginName = pluginType;
+
String filenameFilter =
configuration.getSimpleValue("filenameFilter", null);
supportedPackageTypes.put(filenameFilter, supportedPackageType);
}
diff --git
a/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
b/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
index f9e4467..1a7de07 100644
---
a/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
+++
b/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -38,10 +38,10 @@
</c:dynamic-property>
<c:simple-property name="architectureName"
required="true" summary="true" default="noarch"
description="The specific hardware architecture
this type of package can be deployed on. If there is no specific architecture required,
use 'noarch'. (e.g. 'i686', 'amd64')"/>
- <c:simple-property name="resourceTypeName"
required="true" summary="true"
- description="The name of the resource type on
which this package can be deployed. This is the resource type name as defined in the agent
plugin. (e.g. 'Linux', 'JBossAS Server')"/>
- <c:simple-property name="resourceTypePluginName"
required="true" summary="true"
- description="The name of the plugin that defined
the resource type. (e.g. 'Platform', 'JBossAS')"/>
+ <c:dynamic-property name="resourceType"
required="true" summary="true"
+ description="The name of the resource type on
which this package can be deployed. This is the resource type name as defined in the agent
plugin. (e.g. 'Linux', 'JBossAS Server')">
+ <c:database-backing
key="resource-type-with-plugin"/>
+ </c:dynamic-property>
</c:group>
<c:group name="Repo Source">
commit 77f9d11e35ff8a622505d47d4800ca12d0848d60
Merge: 1f67b2e... bcdc326...
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jan 27 16:56:54 2010 -0500
Merge branch 'master' of ssh://jsanda@git.fedorahosted.org/git/rhq/rhq
commit 1f67b2e63fe503b65420a07a860fc8b601ca1826
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jan 27 16:14:18 2010 -0500
Fixing merge error
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
index a6d33df..fc9fb63 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
@@ -282,10 +282,6 @@ public class TestContentProvider implements ContentProvider,
PackageSource, Repo
return "foo";
}
- public SyncProgressWeight getSyncProgressWeight() {
- return SyncProgressWeight.DEFAULT_WEIGHTS;
- }
-
/**
* Returns a list of repo names that were used to all calls to
* {@link #synchronizePackages(String, PackageSyncReport, Collection)}
commit bcdc326ccd925beca43d12d336f575dc50583f26
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Wed Jan 27 15:49:25 2010 -0500
Refactored dynamic configuration properties to be retrieved with a display/value pair.
This way, we are able to display "pretty" values to the user yet use different
values programmatically.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index f10dc64..2aadf7d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@ -184,7 +184,7 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ " AND s.fsystem = FALSE " //
+ " AND s.factive = TRUE"), //
@NamedQuery(name = Subject.QUERY_DYNAMIC_CONFIG_VALUES, query = "" //
- + "SELECT s.name FROM Subject AS s WHERE s.fsystem = false")
+ + "SELECT s.name, s.name FROM Subject AS s WHERE s.fsystem = false")
})
@SequenceGenerator(name = "RHQ_SUBJECT_ID_SEQ", sequenceName =
"RHQ_SUBJECT_ID_SEQ")
@Table(name = "RHQ_SUBJECT")
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
index 089ca55..482fa08 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
@@ -92,7 +92,7 @@ import org.rhq.core.domain.auth.Subject;
+ " FROM RoleNotification rn" //
+ " WHERE rn.alertDefinition.id = :alertDefinitionId )
"), //
@NamedQuery(name = Role.QUERY_DYNAMIC_CONFIG_VALUES, query = "" //
- + "SELECT r.name FROM Role AS r")
+ + "SELECT r.name, r.name FROM Role AS r")
})
@SequenceGenerator(name = "RHQ_ROLE_ID_SEQ", sequenceName =
"RHQ_ROLE_ID_SEQ")
@Table(name = "RHQ_ROLE")
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/DynamicConfigurationPropertyValue.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/DynamicConfigurationPropertyValue.java
new file mode 100644
index 0000000..433fe6a
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/DynamicConfigurationPropertyValue.java
@@ -0,0 +1,70 @@
+/*
+* RHQ Management Platform
+* Copyright (C) 2009 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.domain.configuration;
+
+/**
+ * Represents a single value that should be displayed to a user as an enumerated
possibility for a dynamic
+ * configuration property. This object pairs a display name (shown to the user in the UI)
with the programmatic
+ * value that is used if this value is selected.
+ *
+ * @author Jason Dobies
+ */
+public class DynamicConfigurationPropertyValue {
+
+ /**
+ * Display name to use for the value. This will be displayed to the user in the UI.
+ */
+ private String display;
+
+ /**
+ * Programmatic representation of the value that will be used when this value is
selected by
+ * the user.
+ */
+ private String value;
+
+ public DynamicConfigurationPropertyValue(String display, String value) {
+ this.display = display;
+ this.value = value;
+ }
+
+ public String getDisplay() {
+ return display;
+ }
+
+ public void setDisplay(String display) {
+ this.display = display;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "Value [Display = " + display + ", Value = " + value +
"]";
+ }
+}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
index 3615a6a..4e4558e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
@@ -71,7 +71,7 @@ import org.rhq.core.domain.resource.ResourceType;
+ "JOIN pt.resourceType rt "
+ "LEFT JOIN FETCH pt.deploymentConfigurationDefinition cd "
+ "LEFT JOIN FETCH cd.templates cts " + "WHERE rt.id = :typeId AND
pt.isCreationData = true"),
- @NamedQuery(name = PackageType.QUERY_DYNAMIC_CONFIG_VALUES, query = "SELECT
pt.displayName FROM PackageType AS pt")
+ @NamedQuery(name = PackageType.QUERY_DYNAMIC_CONFIG_VALUES, query = "SELECT
pt.displayName, pt.name FROM PackageType AS pt")
})
@SequenceGenerator(name = "SEQ", sequenceName =
"RHQ_PACKAGE_TYPE_ID_SEQ")
@Table(name = "RHQ_PACKAGE_TYPE")
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/DynamicPropertyRetriever.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/DynamicPropertyRetriever.java
index 1010cc7..9f90c44 100644
---
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/DynamicPropertyRetriever.java
+++
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/DynamicPropertyRetriever.java
@@ -24,6 +24,7 @@ package org.rhq.core.gui.configuration.helper;
import java.util.List;
+import org.rhq.core.domain.configuration.DynamicConfigurationPropertyValue;
import org.rhq.core.domain.configuration.PropertyDefinitionDynamic;
/**
@@ -32,7 +33,7 @@ import org.rhq.core.domain.configuration.PropertyDefinitionDynamic;
* <p/>
* <strong>In order to associate implementations of this interface with the
rendering code, calls must be made to
* {@link
PropertyRenderingUtility#putDynamicPropertyRetriever(org.rhq.core.domain.configuration.PropertyDynamicType,
- * DynamicPropertyRetriever)} to map the property type to the instance.</strong>
+ * DynamicPropertyRetriever)} to map the property type to the instance.</strong>
* <p/>
* This functionality is abstracted out to prevent the core-gui module from having to
make non-core
* dependencies. Modules using core-gui can implement this interface using whatever means
available,
@@ -48,5 +49,5 @@ public interface DynamicPropertyRetriever {
* @param propertyDefinition cannot be <code>null</code>
* @return list of values to use as both the name and value of the UI inputs; empty
list if none are found
*/
- List<String> loadValues(PropertyDefinitionDynamic propertyDefinition);
+ List<DynamicConfigurationPropertyValue> loadValues(PropertyDefinitionDynamic
propertyDefinition);
}
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
index c73205a..0d5531e 100644
---
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
+++
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
@@ -44,6 +44,7 @@ import javax.faces.validator.ValidatorException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.rhq.core.domain.configuration.DynamicConfigurationPropertyValue;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyDefinitionDynamic;
import org.rhq.core.domain.configuration.PropertyDynamicType;
@@ -129,11 +130,11 @@ public class PropertyRenderingUtility {
}
// Retrieve the values and load them into UI options
- List<String> values = retriever.loadValues(propertyDefinitionDynamic);
- for (String option : values) {
+ List<DynamicConfigurationPropertyValue> values =
retriever.loadValues(propertyDefinitionDynamic);
+ for (DynamicConfigurationPropertyValue option : values) {
UISelectItem selectItem =
FacesComponentUtility.createComponent(UISelectItem.class, null);
- selectItem.setItemLabel(option);
- selectItem.setItemValue(option);
+ selectItem.setItemLabel(option.getDisplay());
+ selectItem.setItemValue(option.getValue());
input.getChildren().add(selectItem);
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/DatabaseDynamicPropertyRetriever.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/DatabaseDynamicPropertyRetriever.java
index 3dc4e3e..ff9d0ae 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/DatabaseDynamicPropertyRetriever.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/DatabaseDynamicPropertyRetriever.java
@@ -24,6 +24,7 @@ package org.rhq.enterprise.gui.configuration;
import java.util.List;
+import org.rhq.core.domain.configuration.DynamicConfigurationPropertyValue;
import org.rhq.core.domain.configuration.PropertyDefinitionDynamic;
import org.rhq.core.gui.configuration.helper.DynamicPropertyRetriever;
import org.rhq.enterprise.server.configuration.DynamicConfigurationPropertyLocal;
@@ -36,10 +37,10 @@ import org.rhq.enterprise.server.util.LookupUtil;
*/
public class DatabaseDynamicPropertyRetriever implements DynamicPropertyRetriever {
- public List<String> loadValues(PropertyDefinitionDynamic propertyDefinition) {
+ public List<DynamicConfigurationPropertyValue>
loadValues(PropertyDefinitionDynamic propertyDefinition) {
String key = propertyDefinition.getKey();
DynamicConfigurationPropertyLocal bean =
LookupUtil.getDynamicConfigurationProperty();
- List<String> values = bean.lookupValues(key);
+ List<DynamicConfigurationPropertyValue> values = bean.lookupValues(key);
return values;
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBean.java
index dd9f844..efe233e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBean.java
@@ -22,6 +22,7 @@
*/
package org.rhq.enterprise.server.configuration;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -33,11 +34,12 @@ import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.DynamicConfigurationPropertyValue;
import org.rhq.enterprise.server.RHQConstants;
/**
* @see DynamicConfigurationPropertyLocal
- *
+ *
* @author Jason Dobies
*/
@Stateless
@@ -49,7 +51,7 @@ public class DynamicConfigurationPropertyBean implements
DynamicConfigurationPro
private EntityManager entityManager;
@SuppressWarnings("unchecked")
- public List<String> lookupValues(String key) {
+ public List<DynamicConfigurationPropertyValue> lookupValues(String key) {
String queryName = PropertyExpressionEvaluator.getQueryNameForKey(key);
@@ -62,8 +64,21 @@ public class DynamicConfigurationPropertyBean implements
DynamicConfigurationPro
}
Query query = entityManager.createNamedQuery(queryName);
- List<String> results = query.getResultList();
+ List<Object[]> results = query.getResultList();
- return results;
+ List<DynamicConfigurationPropertyValue> values =
+ new ArrayList<DynamicConfigurationPropertyValue>(results.size());
+ for (Object[] result : results) {
+ DynamicConfigurationPropertyValue value = translate(result);
+ values.add(value);
+ }
+
+ return values;
+ }
+
+ public DynamicConfigurationPropertyValue translate(Object[] results) {
+ DynamicConfigurationPropertyValue value =
+ new DynamicConfigurationPropertyValue((String) results[0], (String)
results[1]);
+ return value;
}
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyLocal.java
index 613e28c..b2d847e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyLocal.java
@@ -24,6 +24,8 @@ package org.rhq.enterprise.server.configuration;
import java.util.List;
+import org.rhq.core.domain.configuration.DynamicConfigurationPropertyValue;
+
/**
* Responsible for retrieving configuration property values from the database.
*
@@ -39,6 +41,6 @@ public interface DynamicConfigurationPropertyLocal {
* in {@link PropertyExpressionEvaluator}
* @return list of values matching the requested key; empty list if the key is not
supported
*/
- List<String> lookupValues(String key);
+ List<DynamicConfigurationPropertyValue> lookupValues(String key);
}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBeanTest.java
index 6367f92..088fb09 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/DynamicConfigurationPropertyBeanTest.java
@@ -35,6 +35,7 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.configuration.DynamicConfigurationPropertyValue;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
@@ -58,12 +59,12 @@ public class DynamicConfigurationPropertyBeanTest extends
AbstractEJB3Test {
@Test(enabled = ENABLED)
public void invalidKey() throws Exception {
// Test
- List<String> stringList = bean.lookupValues("foo");
+ List<DynamicConfigurationPropertyValue> stringList =
bean.lookupValues("foo");
- // Verify
- assert stringList != null;
+ //Verify
+ assert stringList !=null;
assert stringList.size() == 0;
- }
+ }
@Test(enabled = ENABLED)
public void user() throws Exception {
@@ -71,20 +72,22 @@ public class DynamicConfigurationPropertyBeanTest extends
AbstractEJB3Test {
int existingUserCount = countForQuery(Subject.QUERY_FIND_ALL);
// Test
- List<String> users =
bean.lookupValues(PropertyExpressionEvaluator.KEY_USERS);
+ List<DynamicConfigurationPropertyValue> users =
+ bean.lookupValues(PropertyExpressionEvaluator.KEY_USERS);
// Verify
outputList(users);
assert users.size() == existingUserCount : "Expected: " +
existingUserCount + ", Found: " + users.size();
- }
+ }
@Test(enabled = ENABLED)
- public void roles() throws Exception {
+ public void roles() throws Exception{
// Setup
int existingRoleCount = countForQuery(Role.QUERY_FIND_ALL);
// Test
- List<String> roles =
bean.lookupValues(PropertyExpressionEvaluator.KEY_ROLES);
+ List<DynamicConfigurationPropertyValue> roles =
+ bean.lookupValues(PropertyExpressionEvaluator.KEY_ROLES);
// Verify
outputList(roles);
@@ -117,7 +120,8 @@ public class DynamicConfigurationPropertyBeanTest extends
AbstractEJB3Test {
assert existingPackageTypes > 0 : "Package type created in setup was not
written correctly";
// Test
- List<String> types =
bean.lookupValues(PropertyExpressionEvaluator.KEY_PACKAGE_TYPES);
+ List<DynamicConfigurationPropertyValue> types =
+ bean.lookupValues(PropertyExpressionEvaluator.KEY_PACKAGE_TYPES);
// Verify
assert types.size() == existingPackageTypes : "Expected: " +
existingPackageTypes + ", Found: " + types.size();
@@ -155,9 +159,9 @@ public class DynamicConfigurationPropertyBeanTest extends
AbstractEJB3Test {
return count;
}
- private void outputList(List<String> items) {
+ private void outputList(List<DynamicConfigurationPropertyValue> items) {
System.out.println("Items returned from lookupValues:");
- for (String item : items) {
+ for (DynamicConfigurationPropertyValue item : items) {
System.out.println(item);
}
}
diff --git
a/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
b/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
index 8ed6e75..f9e4467 100644
---
a/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
+++
b/modules/enterprise/server/plugins/disk/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -25,21 +25,6 @@
<c:group name="General">
<c:simple-property name="rootDirectory"
type="directory" required="true"
description="The root directory that contains all
content that is to be served by this content provider. In an HA environment, this must be
on a distributed file system that all servers can access."/>
-
- <c:dynamic-property name="users" displayName="User
Display Name" description="TEST - List of all users in the system."
- required="true"
activationPolicy="shutdown">
- <c:database-backing key="users"/>
- </c:dynamic-property>
-
- <c:dynamic-property name="roles" description="TEST -
List of all roles in the system."
- readOnly="true"
required="false">
- <c:database-backing key="roles"/>
- </c:dynamic-property>
-
- <c:dynamic-property name="packageTypes"
description="TEST - List of all package types in the system."
- required="false"
summary="true">
- <c:database-backing key="package-types"/>
- </c:dynamic-property>
</c:group>
<c:group name="Package Source">
@@ -47,8 +32,10 @@
type="boolean" description="Indicates
if this instance of the plugin should act as a package source"/>
<c:simple-property name="filenameFilter"
required="true" summary="true" default=".*"
description="A regular expression that identifies
a file of this package type (e.g. '.*\.jar',
'.*/i686/.*\.rpm$')"/>
- <c:simple-property name="packageTypeName"
required="true" summary="true"
- description="The name that identifies the kind of
package this type represents (e.g. 'ear', 'rpm')"/>
+ <c:dynamic-property name="packageTypeName"
required="true" summary="true"
+ description="The name that identifies the kind of
package this type represents (e.g. 'ear', 'rpm')">
+ <c:database-backing key="package-types"/>
+ </c:dynamic-property>
<c:simple-property name="architectureName"
required="true" summary="true" default="noarch"
description="The specific hardware architecture
this type of package can be deployed on. If there is no specific architecture required,
use 'noarch'. (e.g. 'i686', 'amd64')"/>
<c:simple-property name="resourceTypeName"
required="true" summary="true"
commit 597c60cb164470972f798c239a48ff4057721714
Merge: f530c34... d291388...
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jan 27 15:21:15 2010 -0500
Merge branch 'master' into raw-config
commit f530c34c291cde6ab03d94c457b05ba24ea671f5
Merge: 7640fd1... a98da0a...
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jan 27 12:35:23 2010 -0500
Merge branch 'raw-config' of ssh://jsanda@git.fedorahosted.org/git/rhq/rhq
into raw-config
commit 7640fd1179c15b8b9da3f632fa5f114ddf070db9
Merge: b898ed3... af588cb...
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jan 27 12:34:11 2010 -0500
Merge branch 'master' into raw-config
Conflicts:
.classpath
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
commit a98da0a8deb14774f961552a2b630ccdb888ccd4
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Jan 27 11:10:18 2010 -0500
Extracted construction of templating engine to pair it with SystemInfo
diff --git
a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
index a7b2f12..3a29fff 100644
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
@@ -29,9 +29,12 @@ import java.lang.reflect.Method;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
+import java.util.TreeMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.template.TemplateEngine;
import org.rhq.core.util.exception.ThrowableUtil;
/**
@@ -74,7 +77,8 @@ public class SystemInfoFactory {
nativeLibraryLoadable = true;
} catch (Throwable t) {
nativeLibraryLoadable = false; // can't load the native libs if we
don't even have the JNI classes
- LOG.warn("System info API not accessible on this platform (native shared
library not found in java.library.path).");
+ LOG
+ .warn("System info API not accessible on this platform (native
shared library not found in java.library.path).");
LOG.trace("Stack trace...", t);
}
@@ -97,8 +101,8 @@ public class SystemInfoFactory {
if (isNativeSystemInfoAvailable() && !isNativeSystemInfoDisabled()) {
try {
version = "Version=" + invokeApi(NativeApi.VERSION_STRING) +
" (" + invokeApi(NativeApi.BUILD_DATE)
- + "); Native version=" +
invokeApi(NativeApi.NATIVE_VERSION_STRING) + " ("
- + invokeApi(NativeApi.NATIVE_BUILD_DATE) + ")";
+ + "); Native version=" +
invokeApi(NativeApi.NATIVE_VERSION_STRING) + " ("
+ + invokeApi(NativeApi.NATIVE_BUILD_DATE) + ")";
} catch (Throwable t) {
error = t;
}
@@ -308,7 +312,7 @@ public class SystemInfoFactory {
rootDir =
System.getProperty("rhq.native-libraries-root-directory");
if (rootDir == null) {
jarLocation =
Class.forName(NATIVE_LIBRARY_CLASS_NAME).getProtectionDomain().getCodeSource()
- .getLocation();
+ .getLocation();
if (jarLocation != null) {
// the root directory where all JNI libraries are located is the
// same directory as where the SIGAR jar is found
@@ -319,7 +323,7 @@ public class SystemInfoFactory {
rootDir = jniLocation.getAbsolutePath();
} else {
throw new Exception("Native JNI libraries cannot be found:
" + "jar-location=[" + jarLocation
- + "], jni-location=[" + jniLocation +
"]");
+ + "], jni-location=[" + jniLocation + "]");
}
}
}
@@ -334,4 +338,33 @@ public class SystemInfoFactory {
*/
private SystemInfoFactory() {
}
+
+ public static TemplateEngine fetchTemplateEngine() {
+
+ SystemInfo systemInfo = createSystemInfo();
+
+ Map<String, String> tokens = new HashMap<String, String>();
+ tokens.put("rhq.hostname", systemInfo.getHostname());
+ tokens.put("rhq.os.name", systemInfo.getOperatingSystemName());
+ tokens.put("rhq.os.version", systemInfo.getOperatingSystemVersion());
+ tokens.put("rhq.os.type",
systemInfo.getOperatingSystemType().toString());
+ tokens.put("rhq.cpu.count",
Integer.toString(systemInfo.getNumberOfCpus()));
+ tokens.put("rhq.architecture", systemInfo.getSystemArchitecture());
+
+ for (NetworkAdapterInfo networkAdapter : systemInfo.getAllNetworkAdapters()) {
+ String key = "rhq.interfaces." + networkAdapter.getName();
+ tokens.put(key + ".mac", networkAdapter.getMacAddressString());
+ tokens.put(key + ".type", networkAdapter.getType());
+ tokens.put(key + ".flags", networkAdapter.getAllFlags());
+
+ if (!networkAdapter.getUnicastAddresses().isEmpty()) {
+ tokens.put(key + ".address",
networkAdapter.getUnicastAddresses().get(0).getHostAddress());
+ }
+ if (!networkAdapter.getMulticastAddresses().isEmpty()) {
+ tokens.put(key + ".multicast.address",
networkAdapter.getMulticastAddresses().get(0).getHostAddress());
+ }
+ }
+ TemplateEngine templateEngine = new TemplateEngine(tokens);
+ return templateEngine;
+ }
}
\ No newline at end of file
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 1181bea..580da62 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -24,7 +24,6 @@ package org.rhq.core.pc.configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.maven.artifact.versioning.ComparableVersion;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationAgentService;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
@@ -33,8 +32,6 @@ import
org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ContainerService;
import org.rhq.core.pc.PluginContainer;
@@ -46,14 +43,12 @@ import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.system.SystemInfoFactory;
import org.rhq.core.template.TemplateEngine;
-import org.rhq.enterprise.client.proxy.ResourceClientProxy.Measurement;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set;
-import java.util.TreeMap;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
@@ -74,8 +69,6 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
private static final int FACET_METHOD_TIMEOUT = 60 * 1000; // 60 seconds
- private static final ComparableVersion NON_LEGACY_VERSION = new
ComparableVersion("2.1");
-
private PluginContainerConfiguration pluginContainerConfiguration;
private ScheduledExecutorService threadPool;
@@ -191,15 +184,14 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
private void mergeRawsIntoStructured(Configuration configuration,
ResourceConfigurationFacet facet) {
Configuration structuredConfig = facet.loadStructuredConfiguration();
- TemplateEngine templateEngine = fetchTemplateEngine();
-
+ TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
if (structuredConfig != null) {
prepareConfigForMergeIntoStructured(configuration, structuredConfig);
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
String contents = templateEngine.replaceTokens(new
String(rawConfig.getContents()));
- rawConfig.setContents(contents.getBytes());
+ rawConfig.setContents(contents);
structuredConfig.addRawConfiguration(rawConfig);
facet.mergeStructuredConfiguration(rawConfig, configuration);
@@ -207,29 +199,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
}
- private TemplateEngine fetchTemplateEngine() {
- Resource platformResource =
PluginContainer.getInstance().getInventoryManager().getPlatform();
- TreeMap<String, String> tokens = new TreeMap<String, String>();
- tokens.put("rhq.hostname", platformResource.getName());
-
-
- MeasurementFacet facet = componentService.getComponent(platformResource.getId(),
MeasurementFacet.class,
- FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
-
-
-
- for (Resource childResource : platformResource.getChildResources()) {
- if (childResource.getResourceType().getName().equals("Network
Adapter" )){
- String key =
"rhq.interfaces."+childResource.getName()+".mac";
- tokens.put(key ,childResource.getDescription());
- }
- }
-
-
- TemplateEngine templateEngine = new TemplateEngine(tokens);
- return templateEngine;
- }
-
+
private void prepareConfigForMergeIntoStructured(Configuration config, Configuration
latestStructured) {
config.getAllProperties().clear();
for (Property property : latestStructured.getProperties()) {
commit b898ed3cce86c40d6369473b5f4af21bced14ef9
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jan 27 10:46:39 2010 -0500
Fixing rerendering logic to display updated path name label
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 7af5f2d..e40b9f1 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -204,9 +204,7 @@ THIS TEXT WILL BE REMOVED.
<rich:panelMenu mode="ajax"
expandMode="client"
iconCollapsedGroup="/images/icn_tree_folder.gif"
-
iconExpandedGroup="/images/icn_tree_folder.gif"
- limitToList="true"
- reRender="fileContents">
+
iconExpandedGroup="/images/icn_tree_folder.gif">
<c:forEach items="#{rawConfigDirectories}"
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
@@ -219,7 +217,7 @@ THIS TEXT WILL BE REMOVED.
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
limitToList="true"
-
reRender="fileContents,selectedFileHeader,modalEditor"/>
+
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
@@ -241,7 +239,7 @@ THIS TEXT WILL BE REMOVED.
<a4j:status id="selectedFileHeader"
startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
commit a91ec38042f668b5db1d74701988b18dffdf7aeb
Merge: d31a520... c435e7f...
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Jan 27 09:18:51 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config-confirm
commit c435e7fc9cc1848c9a9c0d1f32cc1da30d5b3234
Merge: a15c771... 9ba9416...
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Jan 26 13:38:36 2010 -0500
Merge branch 'master' into raw-config
Conflicts:
.classpath
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
diff --cc modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
index 15424a2,f485fc7..126fb6f
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
@@@ -16,17 -17,15 +17,25 @@@
<component class="org.jboss.seam.web.MultipartFilter">
- <property name="createTempFiles">false</property>
+ <property name="createTempFiles">true</property>
<property name="maxRequestSize">1000000</property>
+ <property name="urlPattern">*.xhtml</property>
</component>
- <!-- Load i18n bundles -->
+ <component
class="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"
+ name="ExistingResourceConfigurationViewUIBean"
+ scope="page"/>
+
+ <component
class="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"
+ name="ExistingResourceConfigurationUIBean"
+ scope="session"/>
+
++ <!-- Load i18n bundles -->
+ <core:resource-loader>
+ <core:bundle-names>
+ <value>messages</value>
+ <value>ApplicationResources</value>
+ </core:bundle-names>
- </core:resource-loader>
++ </core:resource-loader>
++
</components>
diff --cc
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
index 55d5751,ad0766d..7a9ebd9
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
@@@ -330,9 -318,4 +335,8 @@@ public class TestContentProvider implem
return null;
}
-
+ public SyncProgressWeight getSyncProgressWeight() {
+ return SyncProgressWeight.DEFAULT_WEIGHTS;
+ }
+
}
commit a15c771e767126dcf08873fc21dad50c55fbefd5
Merge: bb4bdd7... 8b86c0b...
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Jan 26 13:29:47 2010 -0500
Merge branch 'raw-config' of ssh://jsanda@git.fedorahosted.org/git/rhq/rhq
into raw-config
commit bb4bdd7e2b9c061ca663c75ee0b5a503c5ecbaa5
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Jan 26 13:21:56 2010 -0500
Refactoring RawConfiguration entity to store file contents as a string instead of as
an array of bytes
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
index 04d5fb3..947606e 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml
@@ -114,7 +114,7 @@
<column name="ID" type="INTEGER" required="true"
default="sequence-only" initial="10001"
primarykey="true"/>
<column name="CONFIG_ID" type="INTEGER"
required="true" references="RHQ_CONFIG(ID)"/>
<column name="PATH" type="VARCHAR2"
required="false" size="512"/>
- <column name="CONTENTS" type="BLOB"
required="true"/>
+ <column name="CONTENTS" type="CLOB"
required="true"/>
<column name="SHA256" type="VARCHAR2" size="64"
required="true"/>
<column name="CTIME" type="LONG"
required="true"/>
<column name="MTIME" type="LONG"
required="true"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 5e8a703..86b4aa4 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -1498,7 +1498,7 @@
<schema-addColumn table="RHQ_RAW_CONFIG"
column="CONTENTS" columnType="BLOB"/>
<schema-alterColumn table="RHQ_RAW_CONFIG"
column="CONTENTS"
- columnType="BLOB"
+ columnType="CLOB"
nullable="false"/>
<schema-addColumn table="RHQ_RAW_CONFIG"
column="SHA256" columnType="VARCHAR2"/>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index 1bb27c9..e4e3d7e 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -25,12 +25,14 @@ package org.rhq.core.domain.configuration;
import org.rhq.core.util.MessageDigestGenerator;
+import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
@@ -41,10 +43,8 @@ import java.io.Serializable;
/**
* Resources support structured configuration as well as raw configuration which is
represented by this class. A raw
* configuration is typically in the form of a file on the file system. This could be
httpd.conf in the case of apache.
- * Note however that while a raw configuration generally refers to some configuration
file, this class does not limit
- * the actual configuration source to files.
* <p/>
- * A raw configuration is stored as an array of bytes and has a SHA-256 hash with which
it can be uniquely identified.
+ * A raw configuration is stored as a CLOB and has a SHA-256 hash with which it can be
uniquely identified.
* <p/>
* A RawConfiguration is always associated with its parent {@link
org.rhq.core.domain.configuration.Configuration} which
* can be structured, raw, or both. A Configuration can have multiple RawConfigurations
associated with it. Suppose for
@@ -67,8 +67,9 @@ public class RawConfiguration implements Serializable,
DeepCopyable<RawConfigura
@Column(name = "PATH", nullable = true)
private String path;
+ @Lob
@Column(name = "CONTENTS", nullable = false)
- private byte[] contents;
+ private String contents;
@Column(name = "SHA256", nullable = false)
private String sha256;
@@ -83,6 +84,7 @@ public class RawConfiguration implements Serializable,
DeepCopyable<RawConfigura
@JoinColumn(name = "CONFIG_ID", nullable = false)
private Configuration configuration;
+ /** @return The database identifier or primary key */
public int getId() {
return id;
}
@@ -91,77 +93,62 @@ public class RawConfiguration implements Serializable,
DeepCopyable<RawConfigura
this.id = id;
}
+ /** @return The file system path of the configuration that this object represents */
public String getPath() {
return path;
}
+ /** @param path The new file system path of the configuration file represented by
this object */
public void setPath(String path) {
this.path = path;
}
- /**
- * Returns a copy of the contents as an array of bytes. Modifications to the
underlying array have to happen through
- * {@link #setContents(byte[])}; otherwise, we could wind up with an incorrect
SHA-256 hash. This behavior is
- * enforced by returning a copy instead of a reference to the underlying array. By
returning a copy, callers can only
- * modify the underlying array by calling the setter.
- *
- * @return A copy of the file contents as an array of bytes
- */
- public byte[] getContents() {
- return copy(contents);
+ /** @return The contents of the raw configuration which typically will be a file */
+ public String getContents() {
+ return contents;
}
/**
- * Replaces the contents of this raw config with a copy of the specified bytes. The
SHA-256 hash returned from
- * {@link #getSha256()} will be changed as well, provided the contents actually
changed in some way.
+ * Replaces the contents of the raw configuration. The SHA-256 hash returned from
{@link #getSha256()} will be
+ * updated as well.
*
- * @param newContents The new bytes
+ * @param contents The new contents
*/
- public void setContents(byte[] newContents) {
- this.contents = copy(newContents);
+ public void setContents(String contents) {
+ this.contents = contents;
updateSha256();
}
- private byte[] copy(byte[] original) {
- byte[] copy = new byte[original.length];
- for (int i = 0; i < original.length; ++i) {
- copy[i] = original[i];
- }
- return copy;
- }
-
private void updateSha256() {
MessageDigestGenerator sha256Generator = new
MessageDigestGenerator("SHA-256");
- sha256Generator.add(contents);
+ sha256Generator.add(contents.getBytes());
sha256 = sha256Generator.getDigestString();
}
- /** @return A SHA-256 hash of the bytes for this raw configuration, which can be
accessed via {@link #getContents()} */
+ /**
+ * @return A SHA-256 hash of the contents for this raw configuration, which can be
accessed via
+ * {@link #getContents()}
+ */
public String getSha256() {
return sha256;
}
+ /** @return A timestamp of when this object was created */
public long getCtime() {
return ctime;
}
- public void setCtime(long ctime) {
- this.ctime = ctime;
- }
-
+ /** @return A timestamp of when this object was last modified */
public long getMtime() {
return mtime;
}
- public void setMtime(long mtime) {
- this.mtime = mtime;
- }
-
/** @return The owning {@link org.rhq.core.domain.configuration.Configuration} object
*/
public Configuration getConfiguration() {
return configuration;
}
+ /** @param configuration The parent configuration object */
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
@@ -228,6 +215,15 @@ public class RawConfiguration implements Serializable,
DeepCopyable<RawConfigura
return sha256.hashCode() * path.hashCode() * 37;
}
+ /**
+ * Returns a string representation of this object that is in the following format,
+ *
+ * <code>
+ * RawConfiguration[id=1, path=/foo/bar/raw.txt, sha256=13xcx9sd82e,
configuration=<configuration.toString()>]
+ * </code>
+ *
+ * @return A string representation of this object
+ */
@Override
public String toString() {
return new StringBuilder()
@@ -240,6 +236,13 @@ public class RawConfiguration implements Serializable,
DeepCopyable<RawConfigura
.toString();
}
+ /**
+ * Creates a deep copy of this object that includes all of the properties except for
the parent configuration. If
+ * the <code>keepId</code> flag is <code>false</code>, then
the id property is not copied.
+ *
+ * @param keepId A flag indicating whether or not the id should be copied
+ * @return A copy of this object
+ */
public RawConfiguration deepCopy(boolean keepId) {
RawConfiguration copy = new RawConfiguration();
if (keepId) {
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
index c1aba0c..e9fa2d9 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
@@ -417,14 +417,14 @@ public class ConfigurationTest {
}
private RawConfiguration createRawConfiguration(String path) {
- byte[] contents = new byte[10];
+ byte[] bytes = new byte[10];
Random random = new Random();
- random.nextBytes(contents);
+ random.nextBytes(bytes);
RawConfiguration rawConfig = new RawConfiguration();
rawConfig.setPath(path);
- rawConfig.setContents(contents);
+ rawConfig.setContents(new String(bytes));
return rawConfig;
}
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
index bbd9ff5..65a0773 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
@@ -40,7 +40,7 @@ public class RawConfigurationIntegrationTest extends AbstractEJB3Test {
RawConfiguration rawConfig = new RawConfiguration();
rawConfig.setConfiguration(config);
- rawConfig.setContents(new byte[] {1, 2, 3, 4, 5});
+ rawConfig.setContents("contents");
rawConfig.setPath("/tmp/foo.txt");
entityMgr.persist(rawConfig);
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
index 3a373b2..12e7ed0 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
@@ -39,44 +39,9 @@ import java.io.IOException;
public class RawConfigurationTest {
@Test
- public void getContentsShouldReturnADeepCopyOfArray() {
- RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents(getBytes());
-
- byte[] contents = rawConfig.getContents();
- contents[0] = 5;
-
- assertEquals(
- rawConfig.getContents(),
- getBytes(),
- "The contents property should only be mutable through setContents().
Therefore getContents() must return a copy of the underlying array."
- );
- }
-
- @Test
- public void setContentsShouldUpdateContentsArrayWithCopyOfSpecifiedValue() {
- byte[] bytes = getBytes();
-
- RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents(bytes);
-
- bytes[0] = 9;
-
- assertEquals(
- rawConfig.getContents(),
- getBytes(),
- "setContents() should update the underlying array to refer to a copy of
the incoming array to enforce the contents property being mutable only through
setContents()."
- );
- }
-
- byte[] getBytes() {
- return new byte[] {1, 2, 3};
- }
-
- @Test
public void sha256ShouldChangeWhenContentsChange() throws Exception {
RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+ rawConfig.setContents("contents");
String actualSha256 = rawConfig.getSha256();
@@ -84,7 +49,7 @@ public class RawConfigurationTest {
assertEquals(actualSha256, expectedSha256, "Failed to calculate the SHA-256
correctly.");
- byte[] newContents = new byte[] {1, 3, 5, 7, 11, 13, 17, 19, 23};
+ String newContents = "new contents";
rawConfig.setContents(newContents);
actualSha256 = rawConfig.getSha256();
@@ -94,8 +59,8 @@ public class RawConfigurationTest {
assertEquals(actualSha256, expectedSha256, "Failed to update sha256 when
contents property changes");
}
- String calculateSHA256(byte[] data) throws DecoderException {
- return DigestUtils.sha256Hex(data);
+ String calculateSHA256(String string) throws DecoderException {
+ return DigestUtils.sha256Hex(string);
}
@Test
@@ -124,7 +89,7 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsWhenRawConfigurationArgHasNullContents() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(getBytes());
+ r1.setContents("contents");
RawConfiguration r2 = new RawConfiguration();
@@ -134,11 +99,11 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsWhenRawConfigurationArgHasNullPath() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(getBytes());
+ r1.setContents("contents");
r1.setPath("/tmp/foo");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents(getBytes());
+ r2.setContents("contents");
assertFalse(r1.equals(r2), "equals() should return false when one of the raw
configs does not have its paths set");
}
@@ -153,10 +118,10 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsAndHashCodeAreSymmetricWhenPathIsNull() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(getBytes());
+ r1.setContents("contents");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents(getBytes());
+ r2.setContents("contents");
assertTrue(r1.equals(r2), "equals() should be true when contents are the
same and path is null for both.");
assertTrue(r2.equals(r1), "equals() should be symmetric.");
@@ -167,11 +132,11 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsAndHashCodeAreSymmetricWhenPathIsNotNull() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(getBytes());
+ r1.setContents("contents");
r1.setPath("/tmp/foo");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents(getBytes());
+ r2.setContents("contents");
r2.setPath("/tmp/foo");
assertTrue(r1.equals(r2), "equals() should be true when contents and paths
are the same.");
@@ -182,14 +147,16 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsAndHashCodeTransitiveWhenPathIsNull() {
+ String contents = "contents";
+
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(getBytes());
+ r1.setContents(contents);
RawConfiguration r2 = new RawConfiguration();
- r2.setContents(getBytes());
+ r2.setContents(contents);
RawConfiguration r3 = new RawConfiguration();
- r3.setContents(getBytes());
+ r3.setContents(contents);
assertTrue(r1.equals(r2) && r2.equals(r3), "equals() should be true
when contents are the same and paths are null.");
assertTrue(r1.equals(r3), "equals() should be transitive when contents are
the same and paths are null.");
@@ -199,16 +166,18 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsAndHashCodeTransitiveWhenPathIsNotNull() {
+ String contents = "contents";
+
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(getBytes());
+ r1.setContents(contents);
r1.setPath("/tmp/foo");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents(getBytes());
+ r2.setContents(contents);
r2.setPath("/tmp/foo");
RawConfiguration r3 = new RawConfiguration();
- r3.setContents(getBytes());
+ r3.setContents(contents);
r3.setPath("/tmp/foo");
assertTrue(r1.equals(r2) && r2.equals(r3), "equals() should be true
when contents and paths are the same.");
@@ -244,22 +213,22 @@ public class RawConfigurationTest {
@Test
public void deepCopyShouldCopyContentsWhenCopyingId() {
RawConfiguration original = new RawConfiguration();
- original.setContents(new byte[] {1, 2, 3, 4, 5});
+ original.setContents("contents");
RawConfiguration copy = original.deepCopy(true);
- assertFalse(original.getContents() == copy.getContents(), "The values in the
contents array should be copied, not the reference to the original object.");
+ assertEquals(original.getContents(), copy.getContents(), "Failed to copy the
contents property");
assertEquals(copy.getContents(), original.getContents(), "Failed to copy
contents property.");
}
@Test
public void deepCopyShouldCopyContentsWhenNotCopyingId() {
RawConfiguration original = new RawConfiguration();
- original.setContents(new byte[] {1, 2, 3, 4, 5});
+ original.setContents("contents");
RawConfiguration copy = original.deepCopy(false);
- assertFalse(original.getContents() == copy.getContents(), "The values in the
contents array should be copied, not the reference to the original object.");
+ assertEquals(original.getContents(), copy.getContents(), "Failed to copy the
contents property");
assertEquals(copy.getContents(), original.getContents(), "Failed to copy
contents property.");
}
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
index 109031a..17920ec 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
@@ -255,7 +255,7 @@ public class ConfigurationTest extends AbstractEJB3Test {
RawConfiguration createRawConfiguration() {
RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents(new byte[] {1, 2, 3, 4, 5});
+ rawConfig.setContents("contents");
rawConfig.setPath("/tmp/foo");
return rawConfig;
diff --git a/modules/core/domain/src/test/resources/META-INF/persistence.xml
b/modules/core/domain/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..018ea4d
--- /dev/null
+++ b/modules/core/domain/src/test/resources/META-INF/persistence.xml
@@ -0,0 +1,37 @@
+<!--
+ ~ 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 as published by
+ ~ the Free Software Foundation version 2 of the License.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program; if not, write to the Free Software
+ ~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ -->
+
+<persistence
xmlns="http://java.sun.com/xml/ns/persistence">
+ <persistence-unit name="rhq-test"
transaction-type="RESOURCE_LOCAL">
+ <jar-file>target/classes</jar-file>
+ <properties>
+ <property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
+ <property name="hibernate.connection.driver_class"
value="org.postgresql.Driver"/>
+ <property name="hibernate.connection.username"
value="rhqadmin"/>
+ <property name="hibernate.connection.password"
value="rhqadmin"/>
+ <property name="hibernate.connection.url"
value="jdbc:postgresql://127.0.0.1:5432/rhq"/>
+ <property name="hibernate.jdbc.batch_size" value="30"/>
+ <property name="hibernate.cache.use_second_level_cache"
value="false"/>
+ <property name="hibernate.show_sql" value="true" />
+ <property name="hibernate.format_sql" value="true" />
+ <property name="hibernate.use_sql_comments" value="true"
/>
+ <property name="hibernate.connection.autocommit"
value="false"/>
+ </properties>
+ </persistence-unit>
+</persistence>
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
index 1f8b2b7..bccbc56 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
@@ -44,15 +44,15 @@ public class ConfigManagementFactoryImpl implements
ConfigManagementFactory {
}
public ConfigManagement getStrategy(int resourceId) throws PluginContainerException
{
- ConfigManagement loadConfig = createStrategy(resourceId);
- initStrategyDependencies(loadConfig);
+ ConfigManagement configManagement = createStrategy(resourceId);
+ initStrategyDependencies(configManagement);
- return loadConfig;
+ return configManagement;
}
- private void initStrategyDependencies(ConfigManagement loadConfig) {
- loadConfig.setComponentService(componentService);
- loadConfig.setConfigurationUtilityService(configUtilityService);
+ private void initStrategyDependencies(ConfigManagement configManagement) {
+ configManagement.setComponentService(componentService);
+ configManagement.setConfigurationUtilityService(configUtilityService);
}
private ConfigManagement createStrategy(int resourceId) throws
PluginContainerException {
@@ -70,16 +70,16 @@ public class ConfigManagementFactoryImpl implements
ConfigManagementFactory {
return new StructuredAndRawConfigManagement();
case STRUCTURED:
default:
- boolean daemonOnly = true;
- boolean onlyIfStarted = true;
- ResourceComponent resourceComponent =
componentService.getComponent(resourceId,
- ResourceComponent .class, FacetLockType.READ,
ConfigManagement.FACET_METHOD_TIMEOUT,
- daemonOnly, onlyIfStarted);
- if (resourceComponent instanceof ResourceConfigurationFacet){
- return new StructuredConfigManagement();
- }else{
- return new LegacyConfigManagement();
- }
+ boolean daemonOnly = true;
+ boolean onlyIfStarted = true;
+ ResourceComponent resourceComponent =
componentService.getComponent(resourceId,
+ ResourceComponent.class, FacetLockType.READ,
ConfigManagement.FACET_METHOD_TIMEOUT,
+ daemonOnly, onlyIfStarted);
+ if (resourceComponent instanceof ResourceConfigurationFacet){
+ return new StructuredConfigManagement();
+ } else{
+ return new LegacyConfigManagement();
+ }
}
}
}
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
index 4864fe2..32888ad 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
@@ -25,13 +25,13 @@ package org.rhq.core.pc.configuration;
import static org.testng.Assert.*;
+import org.rhq.core.pc.util.FacetLockType;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
-import org.rhq.core.pc.util.ComponentService;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
-import org.rhq.test.JMockTest;
import org.jmock.Expectations;
public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
@@ -51,24 +51,17 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
}
@Test
- public void factoryShouldReturnLegacyLoadConfigWhenAmpsVersionIsLessThan2dot1()
throws Exception {
- context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(LEGACY_AMPS_VERSION));
- }});
-
- ConfigManagement loadConfig = factory.getStrategy(resourceId);
-
- assertTrue(
- loadConfig instanceof LegacyConfigManagement,
- "Expected to get an instance of " +
LegacyConfigManagement.class.getSimpleName() + " when the " +
- "resource is from a plugin having an ampsVersion less than " +
NON_LEGACY_AMPS_VERSION
- );
- }
+ public void factoryShouldInitializeLegacyConfigMgmtWithComponentService() throws
Exception {
+ final boolean daemonOnly = true;
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
- @Test
- public void factoryShouldInitializeLegacyLoadConfigWithComponentService() throws
Exception {
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(LEGACY_AMPS_VERSION));
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
+
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsStructured()));
}});
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -77,20 +70,14 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
}
@Test
- public void factoryShouldInitializeLegacyLoadConfigWithConfigurationUtilityService()
throws Exception {
- context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(LEGACY_AMPS_VERSION));
- }});
-
- ConfigManagement loadConfig = factory.getStrategy(resourceId);
-
- assertConfigurationUtilityServiceInitialized(loadConfig);
- }
+ public void factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()
throws Exception {
+ final boolean daemonOnly = true;
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
- @Test
- public void
factoryShouldReturnStructuredLoadConfigWhenAmpsVersionIs2dot1AndFormatIsStructured()
throws Exception {
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
allowing(componentService).getResourceType(resourceId);
will(returnValue(createResourceTypeThatSupportsStructured()));
@@ -98,18 +85,19 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
ConfigManagement loadConfig = factory.getStrategy(resourceId);
- assertTrue(
- loadConfig instanceof StructuredConfigManagement,
- "Expected to get an instance of " +
StructuredConfigManagement.class.getSimpleName() +
- "when resource is from a plugin having an ampsversion >= " +
NON_LEGACY_AMPS_VERSION + " and the resource " +
- "configuration format is structured."
- );
+ assertConfigurationUtilityServiceInitialized(loadConfig);
}
@Test
- public void factoryShouldInitializeLoadStructuredWithComponentService() throws
Exception {
+ public void factoryShouldInitializeStructuredConfigMgmtWithComponentService() throws
Exception {
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
+
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
+ boolean daemonOnly = true;
+
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
allowing(componentService).getResourceType(resourceId);
will(returnValue(createResourceTypeThatSupportsStructured()));
@@ -121,9 +109,15 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
}
@Test
- public void factoryShouldInitializeLoadStructuredWithConfigurationUtilityService()
throws Exception {
+ public void
factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService() throws
Exception {
+ final boolean daemonOnly = true;
+
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
+
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
allowing(componentService).getResourceType(resourceId);
will(returnValue(createResourceTypeThatSupportsStructured()));
@@ -135,28 +129,15 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
}
@Test
- public void factoryShouldReturnLoadRawWhenAmpsVersionIs2dot1AndFormatIsRaw() throws
Exception {
- context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
-
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsRaw()));
- }});
-
- ConfigManagement loadConfig = factory.getStrategy(resourceId);
+ public void factoryShouldInitializeRawConfigMgmtWithComponentService() throws
Exception {
+ final boolean daemonOnly = true;
- assertTrue(
- loadConfig instanceof RawConfigManagement,
- "Expected to get an instance of " +
RawConfigManagement.class.getSimpleName() + " when " +
- "resource is from a plugin having an ampsversion >= " +
NON_LEGACY_AMPS_VERSION + " and the resource " +
- "configuration format is raw."
- );
- }
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
- @Test
- public void factoryShouldInitializeLoadRawWithComponentService() throws Exception {
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
allowing(componentService).getResourceType(resourceId);
will(returnValue(createResourceTypeThatSupportsStructured()));
@@ -168,9 +149,15 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
}
@Test
- public void factoryShouldInitializeLoadRawWithConfigurationUtilityService() throws
Exception {
+ public void factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()
throws Exception {
+ final boolean daemonOnly = true;
+
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
+
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
allowing(componentService).getResourceType(resourceId);
will(returnValue(createResourceTypeThatSupportsStructured()));
@@ -182,28 +169,15 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
}
@Test
- public void
factoryShouldReturnLoadStructuredAndRawWhenAmpsVersionIs2dot1AndFormatIsBoth() throws
Exception {
- context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
-
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructuredAndRaw()));
- }});
-
- ConfigManagement loadConfig = factory.getStrategy(resourceId);
+ public void factoryShouldInitializeLoadStructuredAndRawWithComponentService() throws
Exception {
+ final boolean daemonOnly = true;
- assertTrue(
- loadConfig instanceof StructuredAndRawConfigManagement,
- "Expected to get an instance of" +
StructuredAndRawConfigManagement.class.getSimpleName() +
- " when resource is from a plugin having an ampsVersion >= " +
NON_LEGACY_AMPS_VERSION + " and the " +
- "resource configuration format is both (structured and raw)."
- );
- }
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
- @Test
- public void factoryShouldInitializeLoadStructuredAndRawWithComponentService() throws
Exception {
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
allowing(componentService).getResourceType(resourceId);
will(returnValue(createResourceTypeThatSupportsStructured()));
@@ -216,25 +190,32 @@ public class ConfigManagementFactoryImplTest extends
ConfigManagementTest {
@Test
public void
factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService() throws
Exception {
+ final boolean daemonOnly = true;
+ final boolean onlyIfStarted = true;
+
+ final ResourceComponent resourceComponent =
context.mock(ResourceComponent.class);
+
context.checking(new Expectations() {{
- allowing(componentService).getAmpsVersion(resourceId);
will(returnValue(NON_LEGACY_AMPS_VERSION));
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class,
FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
allowing(componentService).getResourceType(resourceId);
will(returnValue(createResourceTypeThatSupportsStructured()));
}});
- ConfigManagement loadConfig = factory.getStrategy(resourceId);
+ ConfigManagement configManagement = factory.getStrategy(resourceId);
- assertConfigurationUtilityServiceInitialized(loadConfig);
+ assertConfigurationUtilityServiceInitialized(configManagement);
}
- void assertComponentServiceInitialized(ConfigManagement loadConfig) {
- assertNotNull(loadConfig.getComponentService(), "The factory must initialize
the componentService " +
+ void assertComponentServiceInitialized(ConfigManagement configMgmt) {
+ assertNotNull(configMgmt.getComponentService(), "The factory must initialize
the componentService " +
"property of the loadConfig object.");
}
- void assertConfigurationUtilityServiceInitialized(ConfigManagement loadConfig) {
- assertNotNull(loadConfig.getConfigurationUtilityService(), "The factory must
initialize the " +
+ void assertConfigurationUtilityServiceInitialized(ConfigManagement configMgmt) {
+ assertNotNull(configMgmt.getConfigurationUtilityService(), "The factory must
initialize the " +
"configurationUtilityService property of the loadConfig
object.");
}
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
index b9c3415..f55ca5a 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
@@ -77,7 +77,7 @@ public class ConfigManagementTest extends JMockTest {
RawConfiguration createRawConfiguration(String path) {
RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents(randomBytes());
+ rawConfig.setContents(new String(randomBytes()));
rawConfig.setPath(path);
return rawConfig;
@@ -103,11 +103,6 @@ public class ConfigManagementTest extends JMockTest {
actualConfig.getRawConfigurations(),
"The raw configs were not loaded correctly."
);
-// assertEquals(
-// actualConfig.getRawConfigurations(),
-// expectedRaws,
-// "The raw configs were not loaded correctly."
-// );
}
void assertStructuredLoaded(Configuration expectedConfig, Configuration actualConfig)
{
@@ -116,12 +111,6 @@ public class ConfigManagementTest extends JMockTest {
actualConfig.getProperties(),
"The structured configuration was not loaded correctly."
);
-
-// assertEquals(
-// actualConfig.getAllProperties(),
-// expectedConfig.getAllProperties(),
-// "The structured configuration was not loaded correctly."
-// );
}
void assertNotesSetToDefault(Configuration loadedConfig) {
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 98eec26..150f055 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
@@ -351,7 +351,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
} else {
current = new RawConfiguration();
current.setPath("/dev/null");
- current.setContents("".getBytes());
+ current.setContents("");
}
}
return current;
@@ -488,7 +488,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
String original = new String(getCurrent().getContents());
if (!updated.equals(original)) {
current = current.deepCopy(false);
- current.setContents(updated.getBytes());
+ current.setContents(updated);
markCurrentRawConfigUIBeanModified();
getModified().put(current.getPath(), current);
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 4248ad6..bdeffb8 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
@@ -1930,20 +1930,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return update;
}
- public Collection<RawConfiguration> findRawConfigurationsByConfigurationId(int
configId) {
- Configuration config = entityManager.find(Configuration.class, configId);
-
- if (config == null) {
- return Collections.EMPTY_LIST;
- }
-
- return config.getRawConfigurations();
- }
-
- public RawConfiguration findRawConfigurationById(int rawConfigId) {
- return entityManager.find(RawConfiguration.class, rawConfigId);
- }
-
public Configuration translateResourceConfiguration(Subject subject, int resourceId,
Configuration configuration,
boolean fromStructured) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index f54254c..f3e7d8b 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -482,10 +482,6 @@ public interface ConfigurationManagerLocal {
*/
ConfigurationDefinition getPackageTypeConfigurationDefinition(Subject subject, int
packageTypeId);
- Collection<RawConfiguration> findRawConfigurationsByConfigurationId(int
configId);
-
- RawConfiguration findRawConfigurationById(int rawConfigId);
-
Configuration translateResourceConfiguration(Subject subject, int resourceId,
Configuration configuration,
boolean fromStructured) throws ResourceNotFoundException,
TranslationNotSupportedException;
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index 9281e14..c3bad13 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -932,72 +932,6 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
}
}
- @Test
- public void testFindRawConfigurationById() throws Exception {
- Configuration config = persistNewConfigWithRawConfigs();
-
- getTransactionManager().begin();
- EntityManager entityMgr = getEntityManager();
-
- try {
- for (RawConfiguration rawConfig : config.getRawConfigurations()) {
- assertNotNull(
- "Failed to find raw config by id[" + rawConfig.getId() +
"]",
- entityMgr.find(RawConfiguration.class, rawConfig.getId())
- );
- }
- }
- finally {
- getTransactionManager().rollback();
-
- getTransactionManager().begin();
- delete(config);
- getTransactionManager().commit();
- }
- }
-
- @Test
- public void testFindRawConfigurationsByConfigurationId() throws Exception {
- Configuration config = persistNewConfigWithRawConfigs();
-
- getTransactionManager().begin();
-
- try {
- Collection<RawConfiguration> rawConfigs =
configurationManager.findRawConfigurationsByConfigurationId(
- config.getId());
-
- assertEquals("Failed to find raw configs for " + config,
config.getRawConfigurations().size(), rawConfigs.size());
- }
- finally {
- getTransactionManager().rollback();
-
- getTransactionManager().begin();
- delete(config);
- getTransactionManager().commit();
- }
- }
-
- Configuration persistNewConfigWithRawConfigs() throws Exception {
- getTransactionManager().begin();
-
- Configuration config = new Configuration();
- config.addRawConfiguration(createRawConfiguration("12345"));
- config.addRawConfiguration(createRawConfiguration("54321"));
-
- persist(config);
-
- getTransactionManager().commit();
-
- return config;
- }
-
- RawConfiguration createRawConfiguration(String sha256) {
- RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents(new byte[] {});
-
- return rawConfig;
- }
-
void persist(Object entity) throws Exception {
EntityManager entityMgr = getEntityManager();
getEntityManager().persist(entity);
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
index 5ba68e1..fa50d29 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
@@ -187,52 +187,55 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
configurationMgr.updateResourceConfiguration(fixture.subject, fixture.resourceId,
fixture.configuration);
}
- @Test
- public void
updateResourceConfigShouldTranslateStructuredWhenStructredConfigHasEdits() throws
Exception {
- final ResourceConfigUpdateFixture fixture =
newStructuredAndRawResourceConfigUpdateFixture();
-
- final Configuration translatedConfig = fixture.configuration.deepCopy();
- translatedConfig.addRawConfiguration(new RawConfiguration());
-
- final ResourceConfigurationUpdate expectedUpdate = new
ResourceConfigurationUpdate(fixture.resource,
- translatedConfig, fixture.subject.getName());
- expectedUpdate.setId(-1);
-
- final AgentClient agentClient = context.mock(AgentClient.class);
- final ConfigurationAgentService configAgentService =
context.mock(ConfigurationAgentService.class);
-
- final ConfigurationUpdateRequest expectedUpdateRequest = new
ConfigurationUpdateRequest(expectedUpdate.getId(),
- expectedUpdate.getConfiguration(), expectedUpdate.getResource().getId());
-
- final Sequence configUdpate =
context.sequence("structured-config-update");
-
- context.checking(new Expectations() {{
- allowing(entityMgr).find(Resource.class, fixture.resourceId);
will(returnValue(fixture.resource));
-
- allowing(authorizationMgr).canViewResource(fixture.subject,
fixture.resourceId); will(returnValue(true));
-
- oneOf(configAgentService).merge(fixture.configuration, fixture.resourceId,
FROM_STRUCTURED);
- will(returnValue(translatedConfig)); inSequence(configUdpate);
-
-
oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject,
- fixture.resourceId, translatedConfig, INPROGRESS,
fixture.subject.getName(),
- fixture.isPartOfGroupUpdate);
- will(returnValue(expectedUpdate));
- inSequence(configUdpate);
-
- allowing(agentMgr).getAgentClient(expectedUpdate.getResource().getAgent());
will(returnValue(agentClient));
-
- allowing(agentClient).getConfigurationAgentService();
will(returnValue(configAgentService));
-
-
oneOf(configAgentService).updateResourceConfiguration(with(matchingUpdateRequest(expectedUpdateRequest)));
- inSequence(configUdpate);
- }});
-
- ResourceConfigurationUpdate actualUpdate =
configurationMgr.updateStructuredOrRawConfiguration(fixture.subject,
- fixture.resourceId, fixture.configuration, FROM_STRUCTURED);
-
- assertSame(actualUpdate, expectedUpdate, "Expected to get back the persisted
configuration update");
- }
+// @Test
+// public void
updateResourceConfigShouldTranslateStructuredWhenStructredConfigHasEdits() throws
Exception {
+// final ResourceConfigUpdateFixture fixture =
newStructuredAndRawResourceConfigUpdateFixture();
+//
+// final Configuration translatedConfig = fixture.configuration.deepCopy();
+// translatedConfig.addRawConfiguration(new RawConfiguration());
+//
+// final ResourceConfigurationUpdate expectedUpdate = new
ResourceConfigurationUpdate(fixture.resource,
+// translatedConfig, fixture.subject.getName());
+// expectedUpdate.setId(-1);
+//
+// final AgentClient agentClient = context.mock(AgentClient.class);
+// final ConfigurationAgentService configAgentService =
context.mock(ConfigurationAgentService.class);
+//
+// final ConfigurationUpdateRequest expectedUpdateRequest = new
ConfigurationUpdateRequest(expectedUpdate.getId(),
+// expectedUpdate.getConfiguration(), expectedUpdate.getResource().getId());
+//
+// final Sequence configUdpate =
context.sequence("structured-config-update");
+//
+// context.checking(new Expectations() {{
+// allowing(entityMgr).find(Resource.class, fixture.resourceId);
will(returnValue(fixture.resource));
+//
+// allowing(authorizationMgr).canViewResource(fixture.subject,
fixture.resourceId); will(returnValue(true));
+//
+// oneOf(configAgentService).merge(fixture.configuration, fixture.resourceId,
FROM_STRUCTURED);
+// will(returnValue(translatedConfig)); inSequence(configUdpate);
+//
+//
oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject,
+// fixture.resourceId, translatedConfig, INPROGRESS,
fixture.subject.getName(),
+// fixture.isPartOfGroupUpdate);
+// will(returnValue(expectedUpdate));
+// inSequence(configUdpate);
+//
+// allowing(agentMgr).getAgentClient(expectedUpdate.getResource().getAgent());
will(returnValue(agentClient));
+//
+// allowing(agentClient).getConfigurationAgentService();
will(returnValue(configAgentService));
+//
+// oneOf(configAgentService).validate(fixture.configuration,
fixture.resourceId, FROM_STRUCTURED);
+// inSequence(configUdpate);
+//
+//
oneOf(configAgentService).updateResourceConfiguration(with(matchingUpdateRequest(expectedUpdateRequest)));
+// inSequence(configUdpate);
+// }});
+//
+// ResourceConfigurationUpdate actualUpdate =
configurationMgr.updateStructuredOrRawConfiguration(fixture.subject,
+// fixture.resourceId, fixture.configuration, FROM_STRUCTURED);
+//
+// assertSame(actualUpdate, expectedUpdate, "Expected to get back the
persisted configuration update");
+// }
@Test
public void updateResourceConfigShouldNotTranslateStructuredWhenRawNotSupported()
throws Exception {
@@ -311,6 +314,8 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
allowing(agentClient).getConfigurationAgentService();
will(returnValue(configAgentService));
+ oneOf(configAgentService).validate(fixture.configuration, fixture.resourceId,
FROM_RAW);
+
oneOf(configAgentService).updateResourceConfiguration(with(matchingUpdateRequest(expectedUpdateRequest)));
inSequence(configUdpate);
}});
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
index 7c750d1..6d7b3f5 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
@@ -14,10 +14,6 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
File rawConfigDir
-// File rawConfig1
-// File rawConfig2
-// File rawConfig3
-
List rawConfigs = []
def ant = new AntBuilder()
@@ -34,15 +30,11 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
def index = 1
numberOfConfigFiles.times { rawConfigs << new File(rawConfigDir,
"raw-test-${it + index++}.txt") }
-// rawConfig1 = new File(rawConfigDir, "raw-test-1.txt")
-// rawConfig2 = new File(rawConfigDir, "raw-test-2.txt")
-// rawConfig3 = new File(rawConfigDir, "raw-test-3.txt")
createRawConfigDir()
index = 1
rawConfigs.each { rawConfig -> createConfigFile(rawConfig, index++) }
-// createConfigFile()
}
def createRawConfigDir() {
@@ -75,14 +67,9 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
Set<RawConfiguration> loadRawConfigurations() {
def rawConfigSet = new HashSet()
- rawConfigs.each { rawConfigSet.add(new RawConfiguration(path: it.absolutePath,
contents: it.readBytes())) }
+ rawConfigs.each { rawConfigSet.add(new RawConfiguration(path: it.absolutePath,
contents: it.text)) }
return rawConfigSet
-
-// def rawConfigs = new HashSet()
-// rawConfigs.add(new RawConfiguration(path: rawConfig1.absolutePath, contents:
rawConfig1.readBytes()))
-//
-// return rawConfigs
}
RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index 2866427..f1a0455 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -109,10 +109,10 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
Set<RawConfiguration> loadRawConfigurations() {
def rawConfigs = new HashSet<RawConfiguration>()
- rawConfigs.add(new RawConfiguration(path: rawConfig1.absolutePath, contents:
rawConfig1.readBytes()))
- rawConfigs.add(new RawConfiguration(path: rawConfig2.absolutePath, contents:
rawConfig2.readBytes()))
- rawConfigs.add(new RawConfiguration(path: rawConfig3.absolutePath, contents:
rawConfig3.readBytes()))
- rawConfigs.add(new RawConfiguration(path: rawConfig4.absolutePath, contents:
rawConfig4.readBytes()))
+ rawConfigs.add(new RawConfiguration(path: rawConfig1.absolutePath, contents:
rawConfig1.text))
+ rawConfigs.add(new RawConfiguration(path: rawConfig2.absolutePath, contents:
rawConfig2.text))
+ rawConfigs.add(new RawConfiguration(path: rawConfig3.absolutePath, contents:
rawConfig3.text))
+ rawConfigs.add(new RawConfiguration(path: rawConfig4.absolutePath, contents:
rawConfig4.text))
return rawConfigs
}
@@ -130,17 +130,16 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
rawPropertiesConfig.setProperty(propertyName, property.stringValue)
}
- def stream = new ByteArrayOutputStream()
- rawPropertiesConfig.save(stream)
- rawConfiguration.contents = stream.toByteArray()
+ def writer = new StringWriter()
+ rawPropertiesConfig.save(writer)
+ rawConfiguration.contents = writer.toString()
return rawConfiguration
}
def loadRawPropertiesConfiguration(rawConfig) {
- def stream = new ByteArrayInputStream(rawConfig.contents)
def rawPropertiesConfig = new PropertiesConfiguration()
- rawPropertiesConfig.load(stream)
+ rawPropertiesConfig.load(new StringReader(rawConfig.contents))
return rawPropertiesConfig
}
@@ -186,7 +185,7 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
void validateStructuredConfiguration(Configuration config) {
def failValidation =
resourceContext.pluginConfiguration.getSimple("failStructuredValidation")
if (failValidation.getBooleanValue()) {
- throw new RuntimeException("Validation failed for $configuration");
+ throw new RuntimeException("Validation failed for $confi153guration");
}
}
commit d31a520de773d483bc44b1932fc52380d3a79a96
Merge: da09882... 8b86c0b...
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Jan 26 09:29:15 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config-confirm
commit da09882e2657b1b9ec51d19e0c2575c5d07fd722
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 25 15:07:30 2010 -0500
Proof of concept for rhq template engine values.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 9da62c0..1181bea 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -46,7 +46,9 @@ import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.template.TemplateEngine;
+import org.rhq.enterprise.client.proxy.ResourceClientProxy.Measurement;
import java.util.LinkedList;
import java.util.Queue;
@@ -205,17 +207,22 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
}
- private static TemplateEngine fetchTemplateEngine() {
+ private TemplateEngine fetchTemplateEngine() {
Resource platformResource =
PluginContainer.getInstance().getInventoryManager().getPlatform();
TreeMap<String, String> tokens = new TreeMap<String, String>();
tokens.put("rhq.hostname", platformResource.getName());
+
+ MeasurementFacet facet = componentService.getComponent(platformResource.getId(),
MeasurementFacet.class,
+ FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+
+
+
for (Resource childResource : platformResource.getChildResources()) {
if (childResource.getResourceType().getName().equals("Network
Adapter" )){
String key =
"rhq.interfaces."+childResource.getName()+".mac";
tokens.put(key ,childResource.getDescription());
- }
-
+ }
}
commit 8b86c0b07e73d2b7a8408c35abadf2ef225464f3
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 25 09:29:56 2010 -0500
Disabling usage of flash for upload. It was set to auto but looked like it was still
trying to use flash when it was not available.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
index b5a356c..7c22818 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
@@ -39,8 +39,7 @@
listHeight="50px"
fileUploadListener="#{fileUploader.fileUploadListener}"
addControlLabel="Browse"
- immediateUpload="false"
- allowFlash="auto">
+ immediateUpload="false">
<f:facet name="label">
<h:outputText value="{_KB}KB from {KB}KB uploaded ---
{mm}:{ss}"/>
</f:facet>
@@ -54,4 +53,4 @@
</rich:modalPanel>
</f:subview>
-</ui:composition>
\ No newline at end of file
+</ui:composition>
commit b95c02c3829ab16f6dec78e218214845e72e81f7
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 25 00:15:41 2010 -0500
Fixing <h:outputlink> tags for view full screen and upload links so that do not
post back to server
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index bf83f76..f8e7bba 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -127,9 +127,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="4"
style="width:100%;">
<h:outputLabel value=" "/>
- <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
- <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
@@ -170,8 +170,6 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
- <ui:include src="upload-modal.xhtml"/>
- <ui:include src="view-raw-modal.xhtml"/>
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredSupported}">
@@ -287,9 +285,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="4"
style="width:100%;">
<h:outputLabel value=" "/>
- <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
- <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
@@ -330,12 +328,11 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
-
- <ui:include src="upload-modal.xhtml"/>
- <ui:include src="view-raw-modal.xhtml"/>
</c:when>
</c:choose>
+ <ui:include src="upload-modal.xhtml"/>
+ <ui:include src="view-raw-modal.xhtml"/>
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index 25cec92..e077962 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -8,7 +8,7 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <f:subview id="subview">
+ <f:subview id="modalEditorSubview">
<rich:modalPanel id="modalEditor" width="800"
height="600">
<f:facet name="header">
<h:panelGroup>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index d0850d8..7af5f2d 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -86,6 +86,7 @@ THIS TEXT WILL BE REMOVED.
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+ limitToList="true"
reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
</rich:panelMenuGroup>
@@ -97,9 +98,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="4"
style="width:100%;">
<h:outputLabel value=" "/>
- <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
- <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
<h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
@@ -217,6 +218,7 @@ THIS TEXT WILL BE REMOVED.
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+ limitToList="true"
reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
</rich:panelMenuGroup>
@@ -228,9 +230,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="4"
style="width:100%;">
<h:outputLabel value=" "/>
- <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
- <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
+ <h:outputLink value="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
<h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
commit d0d773680c995cc94bddc96d39b2d0b0430739a5
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Jan 23 21:57:21 2010 -0500
Updating logic for displaying the number of files changed
The number of files changed was getting lost between translations since the modified
cache
get purged on a translation call. I added a counter to keep track of the number of
changed
files.
I also had to update some of the richfaces code on edit.xhtml so that both the upper
and
the lower labels get rerendered when the file is edited.
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 c2e4bf5..98eec26 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
@@ -77,6 +77,8 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
private String modalEditorContents;
+ private int numberOfModifiedFiles;
+
public ExistingResourceConfigurationUIBean() {
removeSessionScopedBeanIfInView("/rhq/resource/configuration/view.xhtml",
ExistingResourceConfigurationUIBean.class);
@@ -311,10 +313,14 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
RawConfiguration originalRaw = raws.get(editedRaw.getPath());
if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
+ --numberOfModifiedFiles;
RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
rawUIBean.setModified(false);
getModified().remove(editedRaw.getPath());
}
+ else {
+ ++numberOfModifiedFiles;
+ }
return null;
}
@@ -436,15 +442,15 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String getModifiedFilesMsg() {
- if (!isDisplayChangedFilesLabel() || getModified().size() == 0) {
+ if (!isDisplayChangedFilesLabel() || numberOfModifiedFiles == 0) {
return "";
}
- if (getModified().size() == 1) {
+ if (numberOfModifiedFiles == 1) {
return "1 file changed in this configuration";
}
- return getModified().size() + " files changed in this configuration";
+ return numberOfModifiedFiles + " files changed in this configuration";
}
public boolean isModified(String path) {
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 3e96df8..bf83f76 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -229,7 +229,7 @@ THIS TEXT WILL BE REMOVED.
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
- reRender="fileUpload,upperCommitPanel"
+ reRender="fileUpload,upperCommitPanel,lowerCommitPanel"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
<h:panelGrid columns="2"
@@ -254,7 +254,7 @@ THIS TEXT WILL BE REMOVED.
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
icon="#{rawConfigUIBean.icon}"
binding="#{rawConfigUIBean.panelMenuItem}"
- onclick="cursor_wait(); selectedFile
= #{rawConfigUIBean.path};"
+ onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
limitToList="true"
@@ -308,7 +308,7 @@ THIS TEXT WILL BE REMOVED.
readonly="false">
<a4j:support event="onkeyup"
ignoreDupeResponses="true"
- reRender="fileMenu,upperCommitPanel"
+
reRender="fileMenu,upperCommitPanel,lowerCommitPanel"
requestDelay="1000"
action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
</h:inputTextarea>
@@ -317,7 +317,7 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
<h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
- <h:panelGroup style="text-align:right">
+ <h:panelGroup id="lowerCommitPanel"
style="text-align:right">
<h:outputText
value="#{ExistingResourceConfigurationUIBean.modifiedFilesMsg}"
rendered="#{ExistingResourceConfigurationUIBean.rawMode}"
style="padding-right:10px"/>
commit 19e5f0e7fbe1a83dc2a0c1b3948327b349a03d37
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Jan 23 14:38:33 2010 -0500
Adding back call to update modified cache on tranlsation to raw
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 b552f22..c2e4bf5 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
@@ -148,7 +148,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
current = null;
setConfiguration(configuration);
-// updateModifiedCache();
+ updateModifiedCache();
mode = RAW_MODE;
return null;
}
commit c5136f8f0e0613dc1400358cc1ef40e3670dca1b
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Jan 23 14:28:34 2010 -0500
Moving the toolbar links one row above the file name label that appears before the
text area
Moving the toolbar up gives more room for the file name label to so as to avoid
wrapping
when long path names are encountered.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 0e252a3..3e96df8 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -125,17 +125,20 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+ <h:outputLabel value=" "/>
+
+ <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
- <a href="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</a>
+ <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
</h:commandLink>
+
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
@@ -282,17 +285,20 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+ <h:outputLabel value=" "/>
+
+ <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
- <a href="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</a>
+ <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
</h:commandLink>
+
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
</h:panelGrid>
<rich:panel id="fileContentsPanel"
style="margin-left:1px; border: none;">
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 4abf675..d0850d8 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -95,17 +95,20 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
+ <h:outputLabel value=" "/>
+
+ <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
+
+ <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
+
<h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
</h:commandLink>
+
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
@@ -223,17 +226,20 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
+ <h:outputLabel value=" "/>
+
+ <h:outputLink
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</h:outputLink>
+
+ <h:outputLink
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</h:outputLink>
+
<h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
</h:commandLink>
+
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
commit 33381b04f5c74101bcbe01403abf90278c4989ee
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Jan 23 02:00:04 2010 -0500
Adding logic for generating the number of files changes message
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 0f92b49..b552f22 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
@@ -148,7 +148,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
current = null;
setConfiguration(configuration);
- updateModifiedCache();
+// updateModifiedCache();
mode = RAW_MODE;
return null;
}
@@ -313,6 +313,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
rawUIBean.setModified(false);
+ getModified().remove(editedRaw.getPath());
}
return null;
}
@@ -422,6 +423,30 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return mode == RAW_MODE;
}
+ public boolean isDisplayChangedFilesLabel() {
+ if (isStructuredMode()) {
+ return false;
+ }
+
+ if (isRawSupported()) {
+ return true;
+ }
+
+ return isRawMode();
+ }
+
+ public String getModifiedFilesMsg() {
+ if (!isDisplayChangedFilesLabel() || getModified().size() == 0) {
+ return "";
+ }
+
+ if (getModified().size() == 1) {
+ return "1 file changed in this configuration";
+ }
+
+ return getModified().size() + " files changed in this configuration";
+ }
+
public boolean isModified(String path) {
return getModified().keySet().contains(path);
}
commit 93f1d77ed02e4539b7c4dbcbf614dfa5137642a3
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Jan 23 01:57:15 2010 -0500
Adding logic to generate the number of files changed label that appears next to the
commit button
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 6d6beec..0e252a3 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -36,6 +36,8 @@ THIS TEXT WILL BE REMOVED.
var currentFileModified = false;
+ var selectedFile = '';
+
function setCurrentFileModified() {
currentFileModified = true;
}
@@ -53,8 +55,11 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" style="width:100%">
<h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
- <h:panelGroup style="text-align:right">
- <h:outputText style="padding-right:10px">n files changed in
this configuration</h:outputText>
+ <h:panelGroup id="upperCommitPanel"
style="text-align:right">
+ <h:outputText id="changedFilesLabel"
+
rendered="#{ExistingResourceConfigurationUIBean.displayChangedFilesLabel}"
+ style="padding-right:10px"
+
value="#{ExistingResourceConfigurationUIBean.modifiedFilesMsg}"/>
<h:commandButton value="Commit"
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
title="Click to Save Changes"
@@ -150,7 +155,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <h:outputText style="padding-right:10px">n files
changed in this configuration</h:outputText>
+ <h:outputText
value="#{ExistingResourceConfigurationUIBean.modifiedFilesMsg}"
+
rendered="#{ExistingResourceConfigurationUIBean.rawMode}"
+ style="padding-right:10px"/>
<h:commandButton value="Commit"
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
title="Click to Save Changes"
@@ -192,7 +199,7 @@ THIS TEXT WILL BE REMOVED.
valueChangeListener="#{ExistingResourceConfigurationUIBean.changeTabs}">
<rich:tab id="structuredTab"
label="Basic Mode"
- reRender="uploadForm"
+ reRender="fileUpload,upperCommitPanel"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
<onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
@@ -219,7 +226,7 @@ THIS TEXT WILL BE REMOVED.
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
- reRender="uploadForm"
+ reRender="fileUpload,upperCommitPanel"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
<h:panelGrid columns="2"
@@ -244,7 +251,7 @@ THIS TEXT WILL BE REMOVED.
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
icon="#{rawConfigUIBean.icon}"
binding="#{rawConfigUIBean.panelMenuItem}"
- onclick="cursor_wait();"
+ onclick="cursor_wait(); selectedFile
= #{rawConfigUIBean.path};"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
limitToList="true"
@@ -295,7 +302,7 @@ THIS TEXT WILL BE REMOVED.
readonly="false">
<a4j:support event="onkeyup"
ignoreDupeResponses="true"
- reRender="fileMenu"
+ reRender="fileMenu,upperCommitPanel"
requestDelay="1000"
action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
</h:inputTextarea>
@@ -305,7 +312,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <h:outputText style="padding-right:10px">n files
changed in this configuration</h:outputText>
+ <h:outputText
value="#{ExistingResourceConfigurationUIBean.modifiedFilesMsg}"
+
rendered="#{ExistingResourceConfigurationUIBean.rawMode}"
+ style="padding-right:10px"/>
<h:commandButton value="Commit"
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
title="Click to Save Changes"
commit 268aa150aeb81cccc3f9efb7234a70d8b2c46118
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Jan 22 16:06:05 2010 -0500
Proof of concept for templating
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index dc3955a..9da62c0 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -33,6 +33,8 @@ import
org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ContainerService;
import org.rhq.core.pc.PluginContainer;
@@ -44,10 +46,12 @@ import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.template.TemplateEngine;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set;
+import java.util.TreeMap;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
@@ -185,16 +189,40 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
private void mergeRawsIntoStructured(Configuration configuration,
ResourceConfigurationFacet facet) {
Configuration structuredConfig = facet.loadStructuredConfiguration();
+ TemplateEngine templateEngine = fetchTemplateEngine();
+
+
if (structuredConfig != null) {
prepareConfigForMergeIntoStructured(configuration, structuredConfig);
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
+ String contents = templateEngine.replaceTokens(new
String(rawConfig.getContents()));
+ rawConfig.setContents(contents.getBytes());
+
structuredConfig.addRawConfiguration(rawConfig);
facet.mergeStructuredConfiguration(rawConfig, configuration);
}
}
}
+ private static TemplateEngine fetchTemplateEngine() {
+ Resource platformResource =
PluginContainer.getInstance().getInventoryManager().getPlatform();
+ TreeMap<String, String> tokens = new TreeMap<String, String>();
+ tokens.put("rhq.hostname", platformResource.getName());
+
+ for (Resource childResource : platformResource.getChildResources()) {
+ if (childResource.getResourceType().getName().equals("Network
Adapter" )){
+ String key =
"rhq.interfaces."+childResource.getName()+".mac";
+ tokens.put(key ,childResource.getDescription());
+ }
+
+ }
+
+
+ TemplateEngine templateEngine = new TemplateEngine(tokens);
+ return templateEngine;
+ }
+
private void prepareConfigForMergeIntoStructured(Configuration config, Configuration
latestStructured) {
config.getAllProperties().clear();
for (Property property : latestStructured.getProperties()) {
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
index 7c258b4..0e56625 100644
--- a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -38,7 +38,8 @@ public class TemplateEngine {
String next = matcher.group();
Matcher keyMatcher = keyPattern.matcher(next);
if (keyMatcher.find()) {
- String value = tokens.get(keyMatcher.group());
+ String key = keyMatcher.group();
+ String value = tokens.get(key);
if (value != null) {
next = value;
}
commit c6242c2d59ce4316edfed58630a7f51cd6bad185
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 22 14:07:54 2010 -0500
Removing resource name that was directly above the tabs
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index d99ac30..6d6beec 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -52,7 +52,6 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
<h:panelGrid columns="2" style="width:100%">
- <h:outputText value="#{ResourceUIBean.name}"/>
<h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
<h:outputText style="padding-right:10px">n files changed in
this configuration</h:outputText>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 2e3864e..4abf675 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -46,7 +46,6 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
<h:panelGrid columns="2" style="width:100%">
- <h:outputText value="#{ResourceUIBean.name}"/>
<h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
<h:commandButton value="Edit"
@@ -71,7 +70,7 @@ THIS TEXT WILL BE REMOVED.
<rich:panel style="width:100%">
<f:facet name="header">Files</f:facet>
<rich:panelMenu mode="ajax"
- expandMode="client"
+ expandMode="client"
iconCollapsedGroup="/images/icn_tree_folder.gif"
iconExpandedGroup="/images/icn_tree_folder.gif"
limitToList="true"
commit 3ec326edcbfb065d7952022e879f3d8d1d03efb3
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 22 13:51:36 2010 -0500
Updating resource tree navigation logic for configuration UI
When you are on a configuration ui screen, be it a view or edit screen, and click on
a
different resource in the resource tree, you will now be sent to view.xhtml for that
resource.
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeStateAdvisor.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeStateAdvisor.java
index 6fee523..18554d3 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeStateAdvisor.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeStateAdvisor.java
@@ -118,10 +118,12 @@ public class ResourceTreeStateAdvisor implements TreeStateAdvisor {
|| (path.startsWith("/rhq/resource/events")
&& !facets.isEvent())) {
// This resource doesn't support those facets
path = fallbackPath;
- } else if
((path.startsWith("/rhq/resource/configuration/edit.xhtml") ||
-
path.startsWith("/rhq/resource/configuration/edit-raw.xhtml"))
- && facets.isConfiguration()) {
+ } else if
((path.startsWith("/rhq/resource/configuration/view-map.xhtml") ||
+
path.startsWith("/rhq/resource/configuration/edit-map.xhtml") ||
+
path.startsWith("/rhq/resource/configuration/add-map.xhtml") ||
+
path.startsWith("/rhq/resource/configuration/edit.xhtml") &&
facets.isConfiguration())) {
path = "/rhq/resource/configuration/view.xhtml";
+
} else if
(!path.startsWith("/rhq/resource/content/view.xhtml")
&&
path.startsWith("/rhq/resource/content/") && facets.isContent()) {
path = "/rhq/resource/content/view.xhtml";
commit 8515b0fb9adb688942b7b39ba3baba1a7646e548
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 22 12:14:48 2010 -0500
Fixing download behavior so that the file name matches the file name listed on the
page
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 17113c4..0f92b49 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
@@ -498,8 +498,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
public String download() {
try {
+ File file = new File(getCurrentPath());
+
HttpServletResponse response = FacesContextUtility.getResponse();
- response.setHeader("Content-Disposition",
"attachment;filename=" + getCurrentPath());
+ response.setHeader("Content-Disposition",
"attachment;filename=" + file.getName());
OutputStream ostream = response.getOutputStream();
ostream.write(getCurrentContents().getBytes());
ostream.flush();
commit d8e228989067835e680819482634fc564c69c396
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 22 11:28:42 2010 -0500
Removing dead code
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 bb18d4c..17113c4 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
@@ -317,11 +317,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return null;
}
-// public String getComponentsToRerenderOnEdit() {
-// RawConfiguration editedRaw = getCurrent();
-// RawConfiguration
-// }
-
public void undoEdit(String path) {
modified.remove(path);
RawConfigUIBean bean = findRawConfigUIBeanByPath(path);
commit 00868bfc61dcadd37fa551aef6205b68b8c413cd
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 21 22:00:02 2010 -0500
Updating logic for key events to indicate whether or not a file has been modified
When you start editing the contents of a raw config file, an event get fired off to
the
server to determine if the edits have modified the file. If so, the file menu is
updated
to reflect that the file has been modified. If you further edit the file to undo you
edits, the file menu will get updated to reflect that the file has been restored to
its original state.
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 85f9617..7771834 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -69,7 +69,7 @@ public class RawConfigUIBean {
public void setModified(boolean modified) {
this.modified = modified;
-// panelMenuItem.setIcon(getIcon());
+ panelMenuItem.setIcon(getIcon());
}
public String getPath() {
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 18e08ca..d99ac30 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -73,38 +73,46 @@ THIS TEXT WILL BE REMOVED.
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<h:panelGrid columns="1">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
-
- <rich:panelMenu id="fileMenu"
- mode="ajax"
- expandMode="client"
-
iconCollapsedGroup="/images/icn_tree_folder.gif"
-
iconExpandedGroup="/images/icn_tree_folder.gif">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
-
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
- <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
- icon="#{rawConfigUIBean.icon}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
-
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
- <h:panelGroup>
- <h:outputText
value="#{#rawConfigUIBean.fileName}"/>
- <c:if test="#{rawConfigUIBean.modified}">
- <h:commandButton value="Undo"/>
- </c:if>
- </h:panelGroup>
- </rich:panelMenuItem>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+
+ <rich:panelMenu id="fileMenu"
+ mode="ajax"
+ expandMode="client"
+
iconCollapsedGroup="/images/icn_tree_folder.gif"
+
iconExpandedGroup="/images/icn_tree_folder.gif">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
+ <c:forEach
items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ icon="#{rawConfigUIBean.icon}"
+
binding="#{rawConfigUIBean.panelMenuItem}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+ limitToList="true"
+
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
+ <h:panelGroup>
+ <h:outputText
value="#{#rawConfigUIBean.fileName}"/>
+ <h:commandButton value="Undo"
+ styleClass="buttonmed"
+
rendered="#{rawConfigUIBean.modified}">
+ <a4j:support event="onclick"
+ onsumbit="cursor_wait()"
+ oncomplete="cursor_clear()"
+
action="#{ExistingResourceConfigurationUIBean.undoEdit(rawConfigUIBean.path)}"
+
reRender="fileMenu,fileContents"/>
+ </h:commandButton>
+ </h:panelGroup>
+ </rich:panelMenuItem>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
+ </rich:panel>
<rich:panel style="border:none">
<h:graphicImage url="/images/star_on_24.png"/>
<h:outputText value="- Contains uncommitted
changes"/>
@@ -119,7 +127,7 @@ THIS TEXT WILL BE REMOVED.
<a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<a href="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</a>
-
+
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
@@ -131,7 +139,7 @@ THIS TEXT WILL BE REMOVED.
style="width:100%"
value="#{ExistingResourceConfigurationUIBean.currentContents}"
readonly="false">
- <a4j:support event="onkeypress"
+ <a4j:support event="onkeyup"
ignoreDupeResponses="true"
reRender="fileMenu"
requestDelay="1000"
@@ -244,15 +252,15 @@ THIS TEXT WILL BE REMOVED.
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
<h:panelGroup>
<h:outputText
value="#{#rawConfigUIBean.fileName}"/>
- <c:if
test="#{rawConfigUIBean.modified}">
- <h:commandButton value="Undo"
styleClass="buttonmed">
- <a4j:support event="onclick"
- onsumbit="cursor_wait()"
- oncomplete="cursor_clear()"
-
action="#{ExistingResourceConfigurationUIBean.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenu"/>
- </h:commandButton>
- </c:if>
+ <h:commandButton value="Undo"
+ styleClass="buttonmed"
+
rendered="#{rawConfigUIBean.modified}">
+ <a4j:support event="onclick"
+ onsumbit="cursor_wait()"
+ oncomplete="cursor_clear()"
+
action="#{ExistingResourceConfigurationUIBean.undoEdit(rawConfigUIBean.path)}"
+
reRender="fileMenu,fileContents"/>
+ </h:commandButton>
</h:panelGroup>
</rich:panelMenuItem>
</c:forEach>
@@ -286,7 +294,7 @@ THIS TEXT WILL BE REMOVED.
style="width:100%"
value="#{ExistingResourceConfigurationUIBean.currentContents}"
readonly="false">
- <a4j:support event="onkeypress"
+ <a4j:support event="onkeyup"
ignoreDupeResponses="true"
reRender="fileMenu"
requestDelay="1000"
commit 73319df68d65c2150e92d24449a3374e73bbfddd
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 21 18:38:01 2010 -0500
Made the member variable private.
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
index 4181bba..7c258b4 100644
--- a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -5,7 +5,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TemplateEngine {
- public final Map<String, String> tokens;
+ private final Map<String, String> tokens;
/**
* In English, the open delimiter <%
commit 633a8a6f5a51ea12ee3ea93c3745edb78b672c1c
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 21 16:34:25 2010 -0500
Using the more efficient Java Matcher and Pattern classes over the String.replaceAll
approach.
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
index eef1b8e..4181bba 100644
--- a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -1,24 +1,53 @@
package org.rhq.core.template;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class TemplateEngine {
- public final Map<String, String> tokens;
+ public final Map<String, String> tokens;
- public TemplateEngine(Map<String, String> tokens) {
- super();
- this.tokens = tokens;
- }
+ /**
+ * In English, the open delimiter <%
+ * zero or more white space characters
+ * The following pattern at least once:
+ * one or more word characters followed by an optional period
+ * zero or more white space characters
+ * The closing delimiter %>
+ * Thus <% rhq.system %> and <%rhq.system%> are equivalent
+ * <% rhq.platform.ip_address %> is Valid.
+ * <% & %> is not a valid token
+ *
+ */
- public String replaceTokens(String input){
-
- for (String token : tokens.keySet()) {
- //Since . is a special regex character,
- //replace it with \. before building the larger regex
- String regex = "<%\\s*" + token.replaceAll("\\.",
"\\\\.") + "\\s*%>";
- input = input.replaceAll(regex, tokens.get(token) );
- }
-
- return input;
- }
+ static String tokenRegex = "<%\\s*(\\w+\\.?)+\\s*%>";
+ static String keyRegex = "(\\w+\\.?)+";
+
+ static Pattern tokenPattern = Pattern.compile(tokenRegex);
+ static Pattern keyPattern = Pattern.compile(keyRegex);
+
+ public TemplateEngine(Map<String, String> tokens) {
+ super();
+ this.tokens = tokens;
+ }
+
+ public String replaceTokens(String input) {
+ StringBuffer buffer = new StringBuffer();
+ Matcher matcher = tokenPattern.matcher(input);
+ while (matcher.find()) {
+ String next = matcher.group();
+ Matcher keyMatcher = keyPattern.matcher(next);
+ if (keyMatcher.find()) {
+ String value = tokens.get(keyMatcher.group());
+ if (value != null) {
+ next = value;
+ }
+ }
+ //If we didn't find a replacement for the key
+ //We leave the original value unchanged
+ matcher.appendReplacement(buffer, next);
+ }
+ matcher.appendTail(buffer);
+ return buffer.toString();
+ }
}
commit 3e930f2105a7da3b7f6e37d3687bf2726cf964b3
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 21 15:53:50 2010 -0500
Adding initial support for marking a file modified based on keyboard events
When you start editing a config file, an ajax request is triggered from a keyboard
event.
The server side code determines if there have been edits and if so, the current file
in
the menu will be rerendered and marked updated.
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 2b8bdc9..bb18d4c 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
@@ -307,10 +307,21 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String editCurrent() {
- String changedContents = getCurrentContents();
+ RawConfiguration editedRaw = getCurrent();
+ RawConfiguration originalRaw = raws.get(editedRaw.getPath());
+
+ if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
+ RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
+ rawUIBean.setModified(false);
+ }
return null;
}
+// public String getComponentsToRerenderOnEdit() {
+// RawConfiguration editedRaw = getCurrent();
+// RawConfiguration
+// }
+
public void undoEdit(String path) {
modified.remove(path);
RawConfigUIBean bean = findRawConfigUIBeanByPath(path);
@@ -320,7 +331,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
bean.setIcon("/images/blank.png");
}
-
}
public int getConfigId() {
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 0bdbd47..18e08ca 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -130,7 +130,13 @@ THIS TEXT WILL BE REMOVED.
<h:inputTextarea id="fileContents"
style="width:100%"
value="#{ExistingResourceConfigurationUIBean.currentContents}"
- readonly="false"/>
+ readonly="false">
+ <a4j:support event="onkeypress"
+ ignoreDupeResponses="true"
+ reRender="fileMenu"
+ requestDelay="1000"
+
action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
+ </h:inputTextarea>
</rich:panel>
</h:panelGrid>
</h:panelGrid>
@@ -280,14 +286,11 @@ THIS TEXT WILL BE REMOVED.
style="width:100%"
value="#{ExistingResourceConfigurationUIBean.currentContents}"
readonly="false">
- <ui:remove>
- <a4j:support event="onkeydown"
- onsubmit="return !currentFileModified;"
- oncomplete="currentFileModified = true;"
+ <a4j:support event="onkeypress"
+ ignoreDupeResponses="true"
reRender="fileMenu"
- requestDelay="3000"
+ requestDelay="1000"
action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
- </ui:remove>
</h:inputTextarea>
</rich:panel>
</h:panelGrid>
commit b6a0d16a6f942c7a7c536b213ca0fd88629da291
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 21 14:23:03 2010 -0500
Fixing upload for raw-only
In the case where raw-only is supported, I forgot to add in the subview that contains
the
modal window with the upload component.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index e725134..0bdbd47 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -34,7 +34,7 @@ THIS TEXT WILL BE REMOVED.
document.body.style.cursor = 'default';
}
- var currentFileModifed = false;
+ var currentFileModified = false;
function setCurrentFileModified() {
currentFileModified = true;
@@ -147,6 +147,7 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
+ <ui:include src="upload-modal.xhtml"/>
<ui:include src="view-raw-modal.xhtml"/>
</c:when>
@@ -279,10 +280,14 @@ THIS TEXT WILL BE REMOVED.
style="width:100%"
value="#{ExistingResourceConfigurationUIBean.currentContents}"
readonly="false">
+ <ui:remove>
<a4j:support event="onkeydown"
+ onsubmit="return !currentFileModified;"
+ oncomplete="currentFileModified = true;"
reRender="fileMenu"
requestDelay="3000"
action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
+ </ui:remove>
</h:inputTextarea>
</rich:panel>
</h:panelGrid>
commit 560f369dc44559f3f839180a9a6d0685b54b32bd
Merge: 4f9777a... c5351b1...
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 21 13:55:58 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config-confirm
commit c5351b10217dc42b367411a7e4aa5a3b6bcdc8bb
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 21 12:49:05 2010 -0500
Adding new upload behavior for raw-only edit
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 17f968f..e725134 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -34,8 +34,14 @@ THIS TEXT WILL BE REMOVED.
document.body.style.cursor = 'default';
}
- function open_modal_editor() {
+ var currentFileModifed = false;
+ function setCurrentFileModified() {
+ currentFileModified = true;
+ }
+
+ function resetCurrentFile() {
+ currentFileModified;
}
</script>
@@ -111,9 +117,9 @@ THIS TEXT WILL BE REMOVED.
startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
<a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
+
+ <a href="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</a>
+
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
@@ -261,11 +267,6 @@ THIS TEXT WILL BE REMOVED.
<a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<a href="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</a>
- <ui:remove>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
- </ui:remove>
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
@@ -278,9 +279,9 @@ THIS TEXT WILL BE REMOVED.
style="width:100%"
value="#{ExistingResourceConfigurationUIBean.currentContents}"
readonly="false">
- <a4j:support event="onchange"
+ <a4j:support event="onkeydown"
reRender="fileMenu"
- requestDelay="1000"
+ requestDelay="3000"
action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
</h:inputTextarea>
</rich:panel>
commit 1b08277e41344cf82e62a830ee5c4c9668cebe08
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 21 12:23:37 2010 -0500
Modifying upload functionality so that the upload component is now rendered in a modal
window
The upload dialog/modal window is rendered on the edit page when you click the
'Upload New' link.
Once you upload the file, the modal window closes, the contents of the file in text
area are
replaced with the contents of the uploaded file, and the file will be marked as being
modified
in the file menu.
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 9b9767b..2b8bdc9 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
@@ -291,8 +291,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
LookupUtil.getConfigurationManager().updateResourceConfiguration(subject,
getResourceId(),
getMergedConfiguration());
- nullify();
-
return "/rhq/resource/configuration/view.xhtml?id=" + getResourceId();
}
@@ -308,36 +306,21 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return getConfiguration();
}
- public void undoEdit() {
-
+ public String editCurrent() {
+ String changedContents = getCurrentContents();
+ return null;
}
- public String discard() {
- nullify();
- return "/rhq/resource/configuration/view.xhtml?id=" + getResourceId();
- }
+ public void undoEdit(String path) {
+ modified.remove(path);
+ RawConfigUIBean bean = findRawConfigUIBeanByPath(path);
- public void fileUploadListener(UploadEvent event) throws Exception {
- File uploadFile;
- log.error("fileUploadListener called");
- uploadFile = event.getUploadItem().getFile();
- if (uploadFile != null) {
- log.debug("fileUploadListener got file named " +
event.getUploadItem().getFileName());
- log.debug("content type is " +
event.getUploadItem().getContentType());
- if (uploadFile != null) {
- try {
- FileReader fileReader = new FileReader(uploadFile);
- char[] buff = new char[1024];
- StringBuffer stringBuffer = new StringBuffer();
- for (int count = fileReader.read(buff); count != -1; count =
fileReader.read(buff)) {
- stringBuffer.append(buff, 0, count);
- }
- setCurrentContents(stringBuffer.toString());
- } catch (IOException e) {
- log.error("problem reading uploaded file", e);
- }
- }
+ if (bean != null) {
+ bean.setModified(false);
+ bean.setIcon("/images/blank.png");
}
+
+
}
public int getConfigId() {
@@ -363,23 +346,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String getCurrentContents() {
- try {
- if (fileUploader.getFileItem() != null) {
- UploadItem fileItem = fileUploader.getFileItem();
- if (fileItem.isTempFile()) {
- setCurrentContents(FileUtils.readFileToString(fileItem.getFile()));
- }
- else {
- setCurrentContents(new String(fileItem.getData()));
- }
- fileUploader.clear();
- }
-
- return new String(getCurrent().getContents());
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
+ return new String(getCurrent().getContents());
}
public String getCurrentPath() {
@@ -470,10 +437,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return isRawSupported() || (isStructuredAndRawSupported() &&
isRawMode());
}
- void nullify() {
-
- }
-
/**
* Indicates which of the raw configuration files is currently selected.
* @param s
@@ -497,14 +460,21 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
private void markCurrentRawConfigUIBeanModified() {
+ RawConfigUIBean bean = findRawConfigUIBeanByPath(current.getPath());
+ if (bean != null) {
+ bean.setModified(true);
+ }
+ }
+
+ private RawConfigUIBean findRawConfigUIBeanByPath(String path) {
for (RawConfigDirectory dir : rawConfigDirectories) {
for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
if (bean.getPath().equals(current.getPath())) {
- bean.setModified(true);
- return;
+ return bean;
}
}
}
+ return null;
}
public void setCurrentPath(String path) {
@@ -549,7 +519,23 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String completeUpload() {
- return null;
+ try {
+ if (fileUploader.getFileItem() != null) {
+ UploadItem fileItem = fileUploader.getFileItem();
+ if (fileItem.isTempFile()) {
+ setCurrentContents(FileUtils.readFileToString(fileItem.getFile()));
+ }
+ else {
+ setCurrentContents(new String(fileItem.getData()));
+ }
+ fileUploader.clear();
+ }
+
+ return null;
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
void dumpProperties(Configuration conf, Log log) {
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 0514f32..85f9617 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -26,6 +26,7 @@ package org.rhq.enterprise.gui.configuration.resource;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.richfaces.component.html.HtmlPanelMenuItem;
+import javax.faces.component.NamingContainer;
import java.io.File;
public class RawConfigUIBean {
@@ -75,6 +76,10 @@ public class RawConfigUIBean {
return rawConfiguration.getPath();
}
+ public String getPathAsId() {
+ return rawConfiguration.getPath().replace('/',
NamingContainer.SEPARATOR_CHAR);
+ }
+
public String getFileName() {
File file = new File(rawConfiguration.getPath());
return file.getName();
@@ -87,4 +92,8 @@ public class RawConfigUIBean {
return "/images/blank.png";
}
+
+ public void setIcon(String icon) {
+ panelMenuItem.setIcon(icon);
+ }
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index b2fc562..17f968f 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -221,8 +221,7 @@ THIS TEXT WILL BE REMOVED.
expanded="true"
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
<c:forEach
items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem
id="menuItem_#{rawConfigUIBean.rawConfiguration.sha256}"
-
label="#{rawConfigUIBean.fileName}"
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
icon="#{rawConfigUIBean.icon}"
binding="#{rawConfigUIBean.panelMenuItem}"
onclick="cursor_wait();"
@@ -233,7 +232,13 @@ THIS TEXT WILL BE REMOVED.
<h:panelGroup>
<h:outputText
value="#{#rawConfigUIBean.fileName}"/>
<c:if
test="#{rawConfigUIBean.modified}">
- <h:commandButton value="Undo"
styleClass="buttonmed"/>
+ <h:commandButton value="Undo"
styleClass="buttonmed">
+ <a4j:support event="onclick"
+ onsumbit="cursor_wait()"
+ oncomplete="cursor_clear()"
+
action="#{ExistingResourceConfigurationUIBean.undoEdit(rawConfigUIBean.path)}"
+ reRender="fileMenu"/>
+ </h:commandButton>
</c:if>
</h:panelGroup>
</rich:panelMenuItem>
@@ -255,20 +260,29 @@ THIS TEXT WILL BE REMOVED.
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
<a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+ <a href="#"
onclick="#{rich:component('uploadWindow')}.show()">Upload
New</a>
+ <ui:remove>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
</h:commandLink>
+ </ui:remove>
+
<h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
</h:commandLink>
</h:panelGrid>
- <rich:panel style="margin-left:1px; border: none;">
+ <rich:panel id="fileContentsPanel"
style="margin-left:1px; border: none;">
<h:inputTextarea id="fileContents"
style="width:100%"
value="#{ExistingResourceConfigurationUIBean.currentContents}"
- readonly="false"/>
+ readonly="false">
+ <a4j:support event="onchange"
+ reRender="fileMenu"
+ requestDelay="1000"
+
action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
+ </h:inputTextarea>
</rich:panel>
</h:panelGrid>
</h:panelGrid>
@@ -286,41 +300,13 @@ THIS TEXT WILL BE REMOVED.
</rich:tab>
</rich:tabPanel>
+ <ui:include src="upload-modal.xhtml"/>
<ui:include src="view-raw-modal.xhtml"/>
</c:when>
</c:choose>
</h:form>
- <!--
- Here I tried the file upload in a separate form. It has resulted in javascript
errors. The latest error in the
- firefox error console is,
-
- Error: form.dispatchEvent is not a function
- Source File:
http://localhost:7080/a4j/g/3_3_2.SR1org/ajax4jsf/javascript/scripts/form...
- Line: 6
- -->
- <h:form id="uploadForm" enctype="multipart/form-data">
- <rich:panel id="uploadPanel"
rendered="#{ExistingResourceConfigurationUIBean.fileUploadAvailable}">
-
- <input type="hidden" name="currentResourceId"
value="#{ResourceUIBean.id}"/>
-
- <rich:fileUpload id="fileUpload"
- listHeight="50px"
-
fileUploadListener="#{fileUploader.fileUploadListener}"
- addControlLabel="Browse"
- immediateUpload="false"
- allowFlash="auto">
- <f:facet name="label">
- <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"
/>
- </f:facet>
- <a4j:support event="onuploadcomplete"
-
reRender="fileUpload,fileContents,menuItem_#{ExistingResourceConfigurationUIBean.current.sha256}"/>
- </rich:fileUpload>
-
- </rich:panel>
- </h:form>
-
<h:panelGroup layout="block" styleClass="InfoBlock"
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
<b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
new file mode 100644
index 0000000..b5a356c
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <f:subview id="uploadSubview"
rendered="#{ExistingResourceConfigurationUIBean.fileUploadAvailable}">
+
+ <script type="text/javascript">
+ function prepareFormForUpload() {
+ var form = document.getElementById('editResourceConfigurationForm');
+ form.encoding = 'multipart/form-data';
+ }
+ </script>
+
+ <rich:modalPanel id="uploadWindow" width="800"
height="400">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText
value="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/close.png"
styleClass="hidelink" id="hidelink"/>
+ <rich:componentControl for="uploadWindow"
attachTo="hidelink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+
+
+ <rich:panel id="uploadPanel"
rendered="#{ExistingResourceConfigurationUIBean.fileUploadAvailable}">
+
+ <input type="hidden" name="currentResourceId"
value="#{ResourceUIBean.id}"/>
+
+ <rich:fileUpload id="fileUpload"
+ listHeight="50px"
+
fileUploadListener="#{fileUploader.fileUploadListener}"
+ addControlLabel="Browse"
+ immediateUpload="false"
+ allowFlash="auto">
+ <f:facet name="label">
+ <h:outputText value="{_KB}KB from {KB}KB uploaded ---
{mm}:{ss}"/>
+ </f:facet>
+ <a4j:support event="onuploadcomplete"
+
action="#{ExistingResourceConfigurationUIBean.completeUpload}"
+ reRender="fileUpload,fileContents,fileMenu"
+
onsubmit="#{rich:component('uploadWindow')}.hide()"/>
+ </rich:fileUpload>
+
+ </rich:panel>
+ </rich:modalPanel>
+ </f:subview>
+
+</ui:composition>
\ No newline at end of file
commit 4f9777a0ea1cc20a7546fdafc3d05c19dcbd928f
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 21 12:16:04 2010 -0500
added a simple template engine and test for it.
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
new file mode 100644
index 0000000..eef1b8e
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -0,0 +1,24 @@
+package org.rhq.core.template;
+
+import java.util.Map;
+
+public class TemplateEngine {
+ public final Map<String, String> tokens;
+
+ public TemplateEngine(Map<String, String> tokens) {
+ super();
+ this.tokens = tokens;
+ }
+
+ public String replaceTokens(String input){
+
+ for (String token : tokens.keySet()) {
+ //Since . is a special regex character,
+ //replace it with \. before building the larger regex
+ String regex = "<%\\s*" + token.replaceAll("\\.",
"\\\\.") + "\\s*%>";
+ input = input.replaceAll(regex, tokens.get(token) );
+ }
+
+ return input;
+ }
+}
diff --git a/modules/core/util/src/test/java/org/rhq/core/template/TemplateEngineTest.java
b/modules/core/util/src/test/java/org/rhq/core/template/TemplateEngineTest.java
new file mode 100644
index 0000000..61af996
--- /dev/null
+++ b/modules/core/util/src/test/java/org/rhq/core/template/TemplateEngineTest.java
@@ -0,0 +1,62 @@
+package org.rhq.core.template;
+
+import java.util.TreeMap;
+
+import org.testng.annotations.Test;
+
+import junit.framework.TestCase;
+
+@Test
+public class TemplateEngineTest extends TestCase {
+ private static final String IPADDR = "192.168.22.153";
+ private static final String SUCCESSTOKEN1 = "successtoken1";
+ String noTokens = "This string should come through unchanged";
+ String justOneToken = "<%rhq.token1%>";
+ String oneTokenWhiteSpace = "<% rhq.token1 %>";
+ String multipleLogTokens = "This string has <%rhq.token1%>\n" +
"<% rhq.unsettoken %>\n" + "<% nmsqt.token1 %>"
+ + "It also has <%rhq.platform.ethers.eth1.ipaddress %>";
+ String sameTokenTwice = "<%rhq.token1%><%rhq.token1%>";
+
+ TemplateEngine templateEngine;
+ TreeMap<String, String> tokens;
+
+ TreeMap<String, String> getTokens() {
+ if (null == tokens) {
+ tokens = new TreeMap<String, String>();
+ tokens.put("rhq.token1", SUCCESSTOKEN1);
+ tokens.put("rhq.platform.ethers.eth1.ipaddress", IPADDR);
+ }
+ return tokens;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ templateEngine = new TemplateEngine(getTokens());
+ }
+
+ public void testNoTokens() {
+ assertEquals(noTokens, templateEngine.replaceTokens(noTokens));
+ }
+
+ public void testOneToken() {
+ assertEquals(SUCCESSTOKEN1, templateEngine.replaceTokens(justOneToken));
+ }
+
+ public void testOneTokenWhiteSpace() {
+ assertEquals(SUCCESSTOKEN1, templateEngine.replaceTokens(oneTokenWhiteSpace));
+ }
+
+ public void testLongString() {
+ assertTrue(templateEngine.replaceTokens(multipleLogTokens).indexOf(SUCCESSTOKEN1)
> 0);
+ assertTrue(templateEngine.replaceTokens(multipleLogTokens).indexOf(IPADDR) >
0);
+ }
+
+ public void testIgnore() {
+ assertTrue(templateEngine.replaceTokens(multipleLogTokens).indexOf("<%
rhq.unsettoken %>") > 0);
+ assertTrue(templateEngine.replaceTokens(multipleLogTokens).indexOf("<%
nmsqt.token1 %>") > 0);
+ }
+
+ public void testSameTokenTwice() {
+ assertEquals(SUCCESSTOKEN1 + SUCCESSTOKEN1,
templateEngine.replaceTokens(sameTokenTwice));
+ }
+}
commit 5e857f7cc6053d8bbc0fd7e7519b06c69038da77
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 20 13:46:52 2010 -0500
Adding logic to display status/progress bar of file upload
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index ec839a9..b2fc562 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -309,7 +309,11 @@ THIS TEXT WILL BE REMOVED.
listHeight="50px"
fileUploadListener="#{fileUploader.fileUploadListener}"
addControlLabel="Browse"
- immediateUpload="false">
+ immediateUpload="false"
+ allowFlash="auto">
+ <f:facet name="label">
+ <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"
/>
+ </f:facet>
<a4j:support event="onuploadcomplete"
reRender="fileUpload,fileContents,menuItem_#{ExistingResourceConfigurationUIBean.current.sha256}"/>
</rich:fileUpload>
commit 931c34fe16b52a49bdeaf09dc84fdffd8e404461
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 20 13:36:53 2010 -0500
Adding file upload to list of components to rerender after an upload has completed.
Without rerendered, you are unable to upload another file again since we are only
allowing
a single file to be uploaded at a time.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index bf0ac96..ec839a9 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -311,7 +311,7 @@ THIS TEXT WILL BE REMOVED.
addControlLabel="Browse"
immediateUpload="false">
<a4j:support event="onuploadcomplete"
-
reRender="fileContents,menuItem_#{ExistingResourceConfigurationUIBean.current.sha256}"/>
+
reRender="fileUpload,fileContents,menuItem_#{ExistingResourceConfigurationUIBean.current.sha256}"/>
</rich:fileUpload>
</rich:panel>
commit 5e0fbcc30ff8c6e6a382043c2b0de99afbe147cb
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 20 13:11:50 2010 -0500
Fixing navigation rules so that you are redirected to the history page after making a
config update.
Being redirected to the history page is actually the current behavior that I changed
some where
along the way in a recent commit.
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 e53d8a2..9b9767b 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
@@ -18,30 +18,12 @@
*/
package org.rhq.enterprise.gui.configuration.resource;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.event.ValueChangeEvent;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Out;
import org.jetbrains.annotations.Nullable;
-import org.richfaces.event.UploadEvent;
-
-import org.jboss.seam.annotations.Create;
-
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
@@ -49,15 +31,30 @@ 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.enterprise.gui.common.upload.FileUploadUIBean;
import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
+import javax.faces.application.FacesMessage;
+import javax.faces.event.ValueChangeEvent;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
// This class is temporarily decleared in components.xml since it is declared under two
names - ViewUIBean and
// UIBean. This class is undergoing some refactoring and part of that will include
declaring the @Name and @Scope
// annotations again.
@@ -583,11 +580,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return raws;
}
- /**
- *
- */
String selectedPath;
+
private TreeMap<String, RawConfiguration> raws;
+
TreeMap<String, RawConfiguration> modified = new TreeMap<String,
RawConfiguration>();
RawConfiguration current = null;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index ff9c2de..0514f32 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -68,7 +68,7 @@ public class RawConfigUIBean {
public void setModified(boolean modified) {
this.modified = modified;
- panelMenuItem.setIcon(getIcon());
+// panelMenuItem.setIcon(getIcon());
}
public String getPath() {
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
index 1ed069c..85def73 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
@@ -4,28 +4,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
- <!--<navigation-rule>-->
-
<!--<from-view-id>/rhq/resource/configuration/view.xhtml</from-view-id>-->
-
- <!--<navigation-case>-->
-
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}</from-action>-->
- <!--<from-outcome>success</from-outcome>-->
-
<!--<to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>-->
- <!--</navigation-case>-->
-
- <!--<navigation-case>-->
-
<!--<from-action>#{ExistingResourceConfigurationUIBean.switchToraw}</from-action>-->
-
<!--<to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>-->
- <!--</navigation-case>-->
- <!--</navigation-rule>-->
-
- <!--<navigation-rule>-->
- <!--<navigation-case>-->
-
<!--<from-action>#{ExistingResourceConfigurationUIBean.editRawConfiguration}</from-action>-->
-
<!--<to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>-->
- <!--</navigation-case>-->
- <!--</navigation-rule>-->
-
<navigation-rule>
<navigation-case>
<from-action>#{ExistingResourceConfigurationUIBean.editConfiguration}</from-action>
@@ -43,49 +21,21 @@
<from-action>#{ConfigHelperUIBean.accessMap}</from-action>
<to-view-id>/rhq/resource/configuration/view-map.xhtml</to-view-id>
</navigation-case>
-
- <!--<navigation-case>-->
-
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.switchToStructured}</from-action>-->
-
<!--<to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>-->
- <!--<redirect/>-->
- <!--</navigation-case>-->
-
- <!--<navigation-case>-->
-
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.switchToRaw}</from-action>-->
-
<!--<to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>-->
- <!--<!–<redirect/>–>-->
- <!--</navigation-case>-->
-
</navigation-rule>
<navigation-rule>
-
<from-view-id>/rhq/resource/configuration/edit-raw-full.xhtml</from-view-id>
- <navigation-case>
- <from-action>#{RawConfigCollection.update}</from-action>
-
<to-view-id>/rhq/resource/configuration/edit-raw.xhtml?id=#{param.id}</to-view-id>
- </navigation-case>
- </navigation-rule>
-
- <navigation-rule>
-
<from-view-id>/rhq/resource/configuration/edit-raw.xhtml</from-view-id>
-
- <navigation-case>
-
<from-action>#{ExistingResourceConfigurationUIBean.updateRawConfiguration}</from-action>
+ <from-view-id>/rhq/resource/configuration/edit.xhtml</from-view-id>
+
+ <navigation-case>
+
<from-action>#{ExistingResourceConfigurationUIBean.updateConfiguration}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/rhq/resource/configuration/history.xhtml?id=#{param.id}</to-view-id>
<redirect/>
</navigation-case>
-
- </navigation-rule>
-
- <navigation-rule>
-
- <from-view-id>/rhq/resource/configuration/edit.xhtml</from-view-id>
-
- <navigation-case>
-
<from-action>#{ExistingResourceConfigurationUIBean.updateConfiguration}</from-action>
+ <navigation-case>
+
<from-action>#{ExistingResourceConfigurationUIBean.updateRawConfiguration}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/rhq/resource/configuration/history.xhtml?id=#{param.id}</to-view-id>
<redirect/>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index b6a7a26..bf0ac96 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -43,7 +43,7 @@ THIS TEXT WILL BE REMOVED.
onsubmit="prepareInputsForSubmission(this)"
rendered="#{!ViewResourceConfigurationUIBean.updateInProgress}">
- <input type="hidden" name="currentResourceId"
value="#{ResourceUIBean.id}"/>
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
<h:panelGrid columns="2" style="width:100%">
<h:outputText value="#{ResourceUIBean.name}"/>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 41648bf..2e3864e 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -194,18 +194,6 @@ THIS TEXT WILL BE REMOVED.
rendered="#{!ResourceUIBean.permissions.configure}"/>
<h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton id="editRawButton"
- value="Edit"
-
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<rich:panel style="width:100%">
commit 0f028b0b9be6bd58d205b39eea5d80d2f506ebdc
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Jan 20 10:21:52 2010 -0500
removed @Override annotation incorrectly added to interface implmentations
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
index c01828b..55d5751 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentProvider.java
@@ -330,7 +330,7 @@ public class TestContentProvider implements ContentProvider,
PackageSource, Repo
return null;
}
- @Override
+
public SyncProgressWeight getSyncProgressWeight() {
return SyncProgressWeight.DEFAULT_WEIGHTS;
}
diff --git
a/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
b/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
index 8c3f163..1b46cfb 100644
---
a/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
+++
b/modules/enterprise/server/plugins/disk/src/main/java/org/rhq/enterprise/server/plugins/disk/DiskSource.java
@@ -353,7 +353,7 @@ public class DiskSource implements ContentProvider, PackageSource,
RepoSource {
public String resourceTypePluginName;
}
- @Override
+
public SyncProgressWeight getSyncProgressWeight() {
return new SyncProgressWeight(10, 1, 0, 0, 0);
}
diff --git
a/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
b/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
index c65a1b0..ed9d4ee 100644
---
a/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
+++
b/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
@@ -244,7 +244,7 @@ public class JBossSoftwareContentSourceAdapter implements
ContentProvider, Packa
}
}
- @Override
+
public SyncProgressWeight getSyncProgressWeight() {
return SyncProgressWeight.DEFAULT_WEIGHTS;
}
diff --git
a/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
b/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
index 9a6e9c0..38d54c2 100644
---
a/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
+++
b/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/RHNProvider.java
@@ -357,7 +357,7 @@ public class RHNProvider implements ContentProvider, PackageSource,
RepoSource,
return helper.constructKickstartFileUrl(repoName, label, relativeFilename);
}
- @Override
+
public SyncProgressWeight getSyncProgressWeight() {
return new SyncProgressWeight(10, 1, 0, 0, 1);
}
diff --git
a/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
b/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
index 061f860..4cb6de9 100644
---
a/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
+++
b/modules/enterprise/server/plugins/url/src/main/java/org/rhq/enterprise/server/plugins/url/UrlProvider.java
@@ -393,7 +393,7 @@ public class UrlProvider implements ContentProvider, PackageSource {
return null; // the file doesn't match any known types for this content
source
}
- @Override
+
public SyncProgressWeight getSyncProgressWeight() {
return SyncProgressWeight.DEFAULT_WEIGHTS;
}
diff --git
a/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java
b/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java
index f45c0a4..fadb218 100644
---
a/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java
+++
b/modules/enterprise/server/plugins/yum/src/main/java/org/rhq/enterprise/server/plugins/yum/RepoProvider.java
@@ -191,7 +191,6 @@ public class RepoProvider implements ContentProvider, PackageSource {
return path;
}
- @Override
public SyncProgressWeight getSyncProgressWeight() {
return SyncProgressWeight.DEFAULT_WEIGHTS;
}
commit db6156b14aa1dfe107ee866baeb51ad80396bd8b
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 20 08:21:17 2010 -0500
Making edit button on view.xhtml consistent with placement of commit button on
edit.xhtml
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 6539aae..41648bf 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -45,8 +45,16 @@ THIS TEXT WILL BE REMOVED.
<h:form id="viewResourceConfigurationForm">
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
- <h:panelGrid columns="2">
+ <h:panelGrid columns="2" style="width:100%">
<h:outputText value="#{ResourceUIBean.name}"/>
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:commandButton value="Edit"
+
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGroup>
+ </h:panelGrid>
</h:panelGrid>
<c:choose>
@@ -58,17 +66,6 @@ THIS TEXT WILL BE REMOVED.
rendered="#{!ResourceUIBean.permissions.configure}"/>
<h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton value="Edit"
-
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<rich:panel style="width:100%">
@@ -120,6 +117,15 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
+
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:commandButton value="Edit"
+
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGroup>
+ </h:panelGrid>
</rich:tab>
</rich:tabPanel>
<ui:include src="view-raw-modal.xhtml"/>
@@ -131,18 +137,6 @@ THIS TEXT WILL BE REMOVED.
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton value="Edit"
-
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
- title="Edit this Configuration"
- styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
<onc:config
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
@@ -151,6 +145,15 @@ THIS TEXT WILL BE REMOVED.
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
prevalidate="true"/>
+
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:commandButton value="Edit"
+
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGroup>
+ </h:panelGrid>
</rich:tab>
</rich:tabPanel>
</c:when>
@@ -164,16 +167,6 @@ THIS TEXT WILL BE REMOVED.
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
- <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton id="editStructuredButton"
- value="Edit"
-
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
- title="Edit this Configuration"
styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
<onc:config
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
@@ -183,7 +176,16 @@ THIS TEXT WILL BE REMOVED.
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
prevalidate="true"/>
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:commandButton value="Edit"
+
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGroup>
+ </h:panelGrid>
</rich:tab>
+
<rich:tab id="rawTab"
label="Advanced Mode"
onlabelclick="cursor_wait();"
@@ -255,6 +257,15 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
+
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:commandButton value="Edit"
+
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGroup>
+ </h:panelGrid>
</rich:tab>
</rich:tabPanel>
<ui:include src="view-raw-modal.xhtml"/>
commit 31c9810072508710b3ea66dc30c5970f0c53ad7e
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 20 02:04:35 2010 -0500
Adding support in file upload to rerender the current file with the uploaded
contents.
With this commit I have also attempted to update the file menu, showing the current
fle as
modified; The file menu item is getting rendered again, but the icon is not showing
up.
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 23460e6..e53d8a2 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
@@ -21,31 +21,23 @@ package org.rhq.enterprise.gui.configuration.resource;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
import org.jetbrains.annotations.Nullable;
-import org.richfaces.component.UISwitchablePanel;
-import org.richfaces.component.UITabPanel;
import org.richfaces.event.UploadEvent;
import org.jboss.seam.annotations.Create;
@@ -64,6 +56,7 @@ import
org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.richfaces.model.UploadItem;
// This class is temporarily decleared in components.xml since it is declared under two
names - ViewUIBean and
// UIBean. This class is undergoing some refactoring and part of that will include
declaring the @Name and @Scope
@@ -373,7 +366,23 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String getCurrentContents() {
- return new String(getCurrent().getContents());
+ try {
+ if (fileUploader.getFileItem() != null) {
+ UploadItem fileItem = fileUploader.getFileItem();
+ if (fileItem.isTempFile()) {
+ setCurrentContents(FileUtils.readFileToString(fileItem.getFile()));
+ }
+ else {
+ setCurrentContents(new String(fileItem.getData()));
+ }
+ fileUploader.clear();
+ }
+
+ return new String(getCurrent().getContents());
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
public String getCurrentPath() {
@@ -388,7 +397,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
if (modalEditorContents == null) {
modalEditorContents = getCurrentContents();
}
-// return getCurrentContents();
return modalEditorContents;
}
@@ -427,8 +435,8 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
/**
*
* @return the id associated with the resource.
- * The value Cached in order to be available on the upload page,
- * where seeing the resource id conflicts with the rich upload tag.
+ * The value Cached in order to be available on the completeUpload page,
+ * where seeing the resource id conflicts with the rich completeUpload tag.
*/
public int getResourceId() {
if (resourceId == null) {
@@ -481,7 +489,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public void setCurrentContents(String updated) {
-
String original = new String(getCurrent().getContents());
if (!updated.equals(original)) {
current = current.deepCopy(false);
@@ -537,14 +544,14 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
/**
- * This is a no-op, since the upload work was done by upload file
+ * This is a no-op, since the completeUpload work was done by completeUpload file
* But is kept as a target for the "save" icon from the full screen page
*/
public String update() {
return "/rhq/resource/configuration/edit-raw.xhtml?currentResourceId="
+ getResourceId();
}
- public String upload() {
+ public String completeUpload() {
return null;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 588c967..ff9c2de 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -24,6 +24,7 @@
package org.rhq.enterprise.gui.configuration.resource;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.richfaces.component.html.HtmlPanelMenuItem;
import java.io.File;
@@ -35,6 +36,8 @@ public class RawConfigUIBean {
private String modifiedContents;
+ private HtmlPanelMenuItem panelMenuItem;
+
public RawConfiguration getRawConfiguration() {
return rawConfiguration;
}
@@ -43,6 +46,14 @@ public class RawConfigUIBean {
this.rawConfiguration = rawConfiguration;
}
+ public HtmlPanelMenuItem getPanelMenuItem() {
+ return panelMenuItem;
+ }
+
+ public void setPanelMenuItem(HtmlPanelMenuItem panelMenuItem) {
+ this.panelMenuItem = panelMenuItem;
+ }
+
public String getModifiedContents() {
return modifiedContents;
}
@@ -57,6 +68,7 @@ public class RawConfigUIBean {
public void setModified(boolean modified) {
this.modified = modified;
+ panelMenuItem.setIcon(getIcon());
}
public String getPath() {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
index c2825ba..d9e4078 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
@@ -209,7 +209,7 @@
<param-value>false</param-value>
</context-param>
- <!-- Allows upload of files through JSF (i.e. software uploads) -->
+ <!-- Allows completeUpload of files through JSF (i.e. software uploads) -->
<filter>
<filter-name>MultipartFilter</filter-name>
<filter-class>org.rhq.enterprise.gui.common.upload.MultipartFilter</filter-class>
@@ -234,7 +234,7 @@
<param-value>true</param-value>
</init-param>
<init-param>
- <!-- is 250MB the largest package we'll ever want to upload? -->
+ <!-- is 250MB the largest package we'll ever want to completeUpload?
-->
<param-name>maxRequestSize</param-name>
<param-value>250000000</param-value>
</init-param>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 3515bf9..b6a7a26 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -206,7 +206,7 @@ THIS TEXT WILL BE REMOVED.
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<h:panelGrid columns="1">
- <rich:panel style="width:100%">
+ <rich:panel id="fileMenuPanel"
style="width:100%">
<f:facet name="header">Files</f:facet>
@@ -221,8 +221,10 @@ THIS TEXT WILL BE REMOVED.
expanded="true"
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
<c:forEach
items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ <rich:panelMenuItem
id="menuItem_#{rawConfigUIBean.rawConfiguration.sha256}"
+
label="#{rawConfigUIBean.fileName}"
icon="#{rawConfigUIBean.icon}"
+
binding="#{rawConfigUIBean.panelMenuItem}"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
@@ -268,23 +270,6 @@ THIS TEXT WILL BE REMOVED.
value="#{ExistingResourceConfigurationUIBean.currentContents}"
readonly="false"/>
</rich:panel>
- <ui:remove>
- <!--
- Here I tried the file upload in the existing form. It does not
generate any errors in the firefox
- error console, but the upload is not working.
- -->
- <rich:fileUpload id="fileUpload"
-
fileUploadListener="#{ExistingResourceConfigurationUIBean.fileUploadListener}"
- maxFilesQuantity="1"
- noDuplicate="true"
- immediateUpload="true"
- autoclear="false"
- allowFlash="false"
- maxRequestSize="100000">
- <a4j:support event="onuploadcomplete"
- reRender="fileMenu,fileContents"/>
- </rich:fileUpload>
- </ui:remove>
</h:panelGrid>
</h:panelGrid>
@@ -324,8 +309,9 @@ THIS TEXT WILL BE REMOVED.
listHeight="50px"
fileUploadListener="#{fileUploader.fileUploadListener}"
addControlLabel="Browse"
- immediateUpload="true">
- <a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
+ immediateUpload="false">
+ <a4j:support event="onuploadcomplete"
+
reRender="fileContents,menuItem_#{ExistingResourceConfigurationUIBean.current.sha256}"/>
</rich:fileUpload>
</rich:panel>
commit 6abdbe720a94b052b31b2ba19e046ca62fd5b5ac
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 20 00:49:25 2010 -0500
Adding logic to display file upload panel only when on a raw edit page
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 852897a..23460e6 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
@@ -32,6 +32,7 @@ import java.util.Map;
import java.util.TreeMap;
import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletResponse;
@@ -43,6 +44,8 @@ import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jetbrains.annotations.Nullable;
+import org.richfaces.component.UISwitchablePanel;
+import org.richfaces.component.UITabPanel;
import org.richfaces.event.UploadEvent;
import org.jboss.seam.annotations.Create;
@@ -417,7 +420,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public Object[] getPaths() {
-
+
return getRaws().keySet().toArray();
}
@@ -458,6 +461,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return getConfigurationDefinition().getConfigurationFormat() ==
ConfigurationFormat.STRUCTURED_AND_RAW;
}
+ public boolean isFileUploadAvailable() {
+ return isRawSupported() || (isStructuredAndRawSupported() &&
isRawMode());
+ }
+
void nullify() {
}
@@ -538,7 +545,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String upload() {
-// return
"/rhq/resource/configuration/edit-raw.xhtml?currentResourceId=" +
getResourceId();
return null;
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 047bf7f..3515bf9 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -170,7 +170,11 @@ THIS TEXT WILL BE REMOVED.
selectedTab="#{ExistingResourceConfigurationUIBean.selectedTab}"
switchType="ajax"
valueChangeListener="#{ExistingResourceConfigurationUIBean.changeTabs}">
- <rich:tab id="structuredTab" label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <rich:tab id="structuredTab"
+ label="Basic Mode"
+ reRender="uploadForm"
+ onlabelclick="cursor_wait();"
+ oncomplete="cursor_clear();">
<onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
@@ -193,7 +197,11 @@ THIS TEXT WILL BE REMOVED.
styleClass="buttonmed"/>
</h:panelGrid>
</rich:tab>
- <rich:tab id="rawTab" label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <rich:tab id="rawTab"
+ label="Advanced Mode"
+ reRender="uploadForm"
+ onlabelclick="cursor_wait();"
+ oncomplete="cursor_clear();">
<h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
@@ -274,8 +282,7 @@ THIS TEXT WILL BE REMOVED.
allowFlash="false"
maxRequestSize="100000">
<a4j:support event="onuploadcomplete"
- reRender="fileContents"
-
action="#{ExistingResourceConfigurationUIBean.upload}"/>
+ reRender="fileMenu,fileContents"/>
</rich:fileUpload>
</ui:remove>
</h:panelGrid>
@@ -309,13 +316,14 @@ THIS TEXT WILL BE REMOVED.
Line: 6
-->
<h:form id="uploadForm" enctype="multipart/form-data">
- <rich:panel>
+ <rich:panel id="uploadPanel"
rendered="#{ExistingResourceConfigurationUIBean.fileUploadAvailable}">
<input type="hidden" name="currentResourceId"
value="#{ResourceUIBean.id}"/>
<rich:fileUpload id="fileUpload"
- listHeight="100px"
+ listHeight="50px"
fileUploadListener="#{fileUploader.fileUploadListener}"
+ addControlLabel="Browse"
immediateUpload="true">
<a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
</rich:fileUpload>
commit 8402b19db9295fe0906e6b776f479e81f8acf9bd
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 19 22:28:57 2010 -0500
Fixing edit button for structured view so that it sends you to the edit page.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 3161efa..6539aae 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -137,7 +137,7 @@ THIS TEXT WILL BE REMOVED.
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
<h:commandButton value="Edit"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
title="Edit this Configuration"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
commit 04e7165bddf42aba84d7c0950e0477781a0fbe14
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 19 22:26:00 2010 -0500
Fixing icon for unmodified files to be a blank image
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 36b1905..3161efa 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -221,6 +221,7 @@ THIS TEXT WILL BE REMOVED.
selectedChild="#{currentPath}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ icon="/images/blank.png"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
commit 7c2203b4bc066ac1b271b7202bc85494f9e68795
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 19 21:28:43 2010 -0500
A first pass of file upload working directly on edit.xhtml without going to a
different page
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index d74d938..047bf7f 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -43,7 +43,7 @@ THIS TEXT WILL BE REMOVED.
onsubmit="prepareInputsForSubmission(this)"
rendered="#{!ViewResourceConfigurationUIBean.updateInProgress}">
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <input type="hidden" name="currentResourceId"
value="#{ResourceUIBean.id}"/>
<h:panelGrid columns="2" style="width:100%">
<h:outputText value="#{ResourceUIBean.name}"/>
@@ -273,7 +273,9 @@ THIS TEXT WILL BE REMOVED.
autoclear="false"
allowFlash="false"
maxRequestSize="100000">
- <a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
+ <a4j:support event="onuploadcomplete"
+ reRender="fileContents"
+
action="#{ExistingResourceConfigurationUIBean.upload}"/>
</rich:fileUpload>
</ui:remove>
</h:panelGrid>
@@ -298,7 +300,6 @@ THIS TEXT WILL BE REMOVED.
</h:form>
- <ui:remove>
<!--
Here I tried the file upload in a separate form. It has resulted in javascript
errors. The latest error in the
firefox error console is,
@@ -307,11 +308,10 @@ THIS TEXT WILL BE REMOVED.
Source File:
http://localhost:7080/a4j/g/3_3_2.SR1org/ajax4jsf/javascript/scripts/form...
Line: 6
-->
- <h:form id="uploadForm">
+ <h:form id="uploadForm" enctype="multipart/form-data">
<rich:panel>
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <input type="hidden" name="currentResourceId"
value="#{ResourceUIBean.id}"/>
<rich:fileUpload id="fileUpload"
listHeight="100px"
@@ -322,7 +322,6 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:form>
- </ui:remove>
<h:panelGroup layout="block" styleClass="InfoBlock"
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
commit dbcc3f759a998237a577eccd26e1e60b20c459f2
Merge: b689286... 1fc3706...
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 19 20:06:36 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config
commit b6892868e463eca9e6ee120e8e183e94df301a51
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 19 20:04:59 2010 -0500
Checking in some debug code for trying to get file upload working on edit.xhtml
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 d690293..852897a 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
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.configuration.resource;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Collections;
@@ -53,6 +54,7 @@ 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.enterprise.gui.common.upload.FileUploadUIBean;
import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
@@ -77,6 +79,9 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
@Out
private Collection<RawConfigDirectory> rawConfigDirectories;
+ @Out
+ private FileUploadUIBean fileUploader = new FileUploadUIBean();
+
private String modalEditorContents;
public ExistingResourceConfigurationUIBean() {
@@ -532,12 +537,9 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return "/rhq/resource/configuration/edit-raw.xhtml?currentResourceId="
+ getResourceId();
}
- /**
- * This is a no-op, since the upload work was done by upload file
- * But is kept as a target for the "action" value
- */
public String upload() {
- return "/rhq/resource/configuration/edit-raw.xhtml?currentResourceId="
+ getResourceId();
+// return
"/rhq/resource/configuration/edit-raw.xhtml?currentResourceId=" +
getResourceId();
+ return null;
}
void dumpProperties(Configuration conf, Log log) {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
index 8f7cfcc..15424a2 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
@@ -16,8 +16,9 @@
<component class="org.jboss.seam.web.MultipartFilter">
- <property name="createTempFiles">false</property>
+ <property name="createTempFiles">true</property>
<property name="maxRequestSize">1000000</property>
+ <property name="urlPattern">*.xhtml</property>
</component>
<component
class="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
index 0038c7d..c2825ba 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
@@ -5,7 +5,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
- <display-name>RHQ</display-name>
+ <display-name>RHQ_FOO</display-name>
<!--=== Seam ===-->
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
index 7537fbd..946557d 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
@@ -80,7 +80,7 @@ input.button_submit {
</head>
<body>
- <jsp:include page="/rhq/common/ie6/ie6fix.xhtml"/>
+ <%--<jsp:include page="/rhq/common/ie6/ie6fix.xhtml"/>--%>
<div id="PageHeader">
<table width="100%" border="0" cellpadding="20"
cellspacing="0" height="70px">
@@ -145,6 +145,6 @@ input.button_submit {
document.forms["LoginForm"].elements["j_username"].focus();
// -->
</script>
-<jsp:include page="/rhq/common/ie6/ie6loginfix.xhtml" />
+<%--<jsp:include page="/rhq/common/ie6/ie6loginfix.xhtml" />--%>
</body>
</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
index 3bd4af6..c8f6d72 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
@@ -12,7 +12,7 @@
<h:form>
- <ui:include src="/rhq/common/ie6/ie6fix.xhtml" />
+ <ui:remove><ui:include src="/rhq/common/ie6/ie6fix.xhtml"
/></ui:remove>
<f:loadBundle
basename="ApplicationResources"
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 7e54120..d74d938 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -9,6 +9,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
+
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:onc="http://jboss.org/on/component">
@@ -222,7 +223,7 @@ THIS TEXT WILL BE REMOVED.
<h:panelGroup>
<h:outputText
value="#{#rawConfigUIBean.fileName}"/>
<c:if
test="#{rawConfigUIBean.modified}">
- <h:commandButton value="Undo"/>
+ <h:commandButton value="Undo"
styleClass="buttonmed"/>
</c:if>
</h:panelGroup>
</rich:panelMenuItem>
@@ -243,6 +244,7 @@ THIS TEXT WILL BE REMOVED.
startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
<a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
</h:commandLink>
@@ -259,14 +261,20 @@ THIS TEXT WILL BE REMOVED.
readonly="false"/>
</rich:panel>
<ui:remove>
- <h:form id="uploadForm"
enctype="multipart/form-data">
+ <!--
+ Here I tried the file upload in the existing form. It does not
generate any errors in the firefox
+ error console, but the upload is not working.
+ -->
<rich:fileUpload id="fileUpload"
- listHeight="100px"
fileUploadListener="#{ExistingResourceConfigurationUIBean.fileUploadListener}"
- immediateUpload="true">
+ maxFilesQuantity="1"
+ noDuplicate="true"
+ immediateUpload="true"
+ autoclear="false"
+ allowFlash="false"
+ maxRequestSize="100000">
<a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
</rich:fileUpload>
- </h:form>
</ui:remove>
</h:panelGrid>
</h:panelGrid>
@@ -291,14 +299,29 @@ THIS TEXT WILL BE REMOVED.
</h:form>
<ui:remove>
- <rich:panel>
- <rich:fileUpload id="fileUpload"
- listHeight="100px"
-
fileUploadListener="#{ExistingResourceConfigurationUIBean.fileUploadListener}"
- immediateUpload="true">
- <a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
- </rich:fileUpload>
- </rich:panel>
+ <!--
+ Here I tried the file upload in a separate form. It has resulted in javascript
errors. The latest error in the
+ firefox error console is,
+
+ Error: form.dispatchEvent is not a function
+ Source File:
http://localhost:7080/a4j/g/3_3_2.SR1org/ajax4jsf/javascript/scripts/form...
+ Line: 6
+ -->
+ <h:form id="uploadForm">
+ <rich:panel>
+
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <rich:fileUpload id="fileUpload"
+ listHeight="100px"
+
fileUploadListener="#{fileUploader.fileUploadListener}"
+ immediateUpload="true">
+ <a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
+ </rich:fileUpload>
+
+ </rich:panel>
+ </h:form>
</ui:remove>
<h:panelGroup layout="block" styleClass="InfoBlock"
diff --git a/pom.xml b/pom.xml
index 34487d0..134b444 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
<postgresql.version>8.4-701.jdbc3</postgresql.version>
<h2.version>1.1.117</h2.version>
<jtds.version>1.2.2</jtds.version>
- <richfaces.version>3.3.0.GA</richfaces.version>
+ <richfaces.version>3.3.2.SR1</richfaces.version>
<sigar.version>1.6.3.82</sigar.version>
<quartz.version>1.6.5</quartz.version>
<jna.version>3.2.2</jna.version>
commit 1fc37069d1173ca4e6ad4fcf4424ec9377386ebd
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Jan 19 14:40:30 2010 -0500
removed amps version, now just check what facet is supported for configuration.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
index dbf131b..1f8b2b7 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
@@ -23,19 +23,18 @@
package org.rhq.core.pc.configuration;
-import org.apache.maven.artifact.versioning.ComparableVersion;
+
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceFacets;
import org.rhq.core.pc.util.ComponentService;
-
-import static org.rhq.core.domain.configuration.definition.ConfigurationFormat.RAW;
-import static
org.rhq.core.domain.configuration.definition.ConfigurationFormat.STRUCTURED;
+import org.rhq.core.pc.util.FacetLockType;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
public class ConfigManagementFactoryImpl implements ConfigManagementFactory {
- private static final ComparableVersion NON_LEGACY_AMPS_VERSION = new
ComparableVersion("2.1");
-
private ComponentService componentService;
private ConfigurationUtilityService configUtilityService = new
ConfigurationUtilityServiceImpl();
@@ -57,41 +56,30 @@ public class ConfigManagementFactoryImpl implements
ConfigManagementFactory {
}
private ConfigManagement createStrategy(int resourceId) throws
PluginContainerException {
- String ampsVersion = componentService.getAmpsVersion(resourceId);
-
- if (isLegacyVersion(ampsVersion)) {
- return new LegacyConfigManagement();
- }
-
ResourceType resourceType = componentService.getResourceType(resourceId);
-
ConfigurationFormat format =
resourceType.getResourceConfigurationDefinition().getConfigurationFormat();
- switch (format) {
- case RAW: break;
- default: ;
- }
- if (isStructured(resourceType)) {
- return new StructuredConfigManagement();
+ if (null == format) {
+ return new LegacyConfigManagement();
}
- if (isRaw(resourceType)) {
+ switch (format) {
+ case RAW:
return new RawConfigManagement();
+ case STRUCTURED_AND_RAW:
+ return new StructuredAndRawConfigManagement();
+ case STRUCTURED:
+ default:
+ boolean daemonOnly = true;
+ boolean onlyIfStarted = true;
+ ResourceComponent resourceComponent =
componentService.getComponent(resourceId,
+ ResourceComponent .class, FacetLockType.READ,
ConfigManagement.FACET_METHOD_TIMEOUT,
+ daemonOnly, onlyIfStarted);
+ if (resourceComponent instanceof ResourceConfigurationFacet){
+ return new StructuredConfigManagement();
+ }else{
+ return new LegacyConfigManagement();
+ }
}
-
- // else format is both structured and raw
- return new StructuredAndRawConfigManagement();
- }
-
- private boolean isLegacyVersion(String ampsVersion) {
- return new ComparableVersion(ampsVersion).compareTo(NON_LEGACY_AMPS_VERSION) <
0;
- }
-
- private boolean isStructured(ResourceType resourceType) {
- return
resourceType.getResourceConfigurationDefinition().getConfigurationFormat().equals(STRUCTURED);
- }
-
- private boolean isRaw(ResourceType resourceType) {
- return
resourceType.getResourceConfigurationDefinition().getConfigurationFormat().equals(RAW);
}
}
commit f4ab35fae9af81208006801bd706fb04ba0f8286
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 18 22:57:50 2010 -0500
Adding save/cancel buttons to modal editor
Clicking the cancel button simply closes the editor as a client-side operation.
Clicking
the save button closes the editor but also fires an ajax request to the server to
update
the on-page text editor. The modification will result in the file in the file menu
appearing as being updated as well.
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 637ec4c..d690293 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
@@ -77,6 +77,8 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
@Out
private Collection<RawConfigDirectory> rawConfigDirectories;
+ private String modalEditorContents;
+
public ExistingResourceConfigurationUIBean() {
removeSessionScopedBeanIfInView("/rhq/resource/configuration/view.xhtml",
ExistingResourceConfigurationUIBean.class);
@@ -199,6 +201,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return updateConfiguration(false);
}
+ public void saveModalEditorContents() {
+ setCurrentContents(modalEditorContents);
+ }
+
public String updateConfiguration(boolean fromStructured) {
ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
@@ -371,10 +377,15 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String getModalEditorContents() {
- return getCurrentContents();
+ if (modalEditorContents == null) {
+ modalEditorContents = getCurrentContents();
+ }
+// return getCurrentContents();
+ return modalEditorContents;
}
public void setModalEditorContents(String contents) {
+ modalEditorContents = contents;
}
public TreeMap<String, RawConfiguration> getModified() {
@@ -454,6 +465,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
selectedPath = s;
setCurrentPath(selectedPath);
setCurrentContents(getCurrentContents());
+ modalEditorContents = getCurrentContents();
}
public void setCurrentContents(String updated) {
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index c87f4cb..7e54120 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -258,6 +258,16 @@ THIS TEXT WILL BE REMOVED.
value="#{ExistingResourceConfigurationUIBean.currentContents}"
readonly="false"/>
</rich:panel>
+ <ui:remove>
+ <h:form id="uploadForm"
enctype="multipart/form-data">
+ <rich:fileUpload id="fileUpload"
+ listHeight="100px"
+
fileUploadListener="#{ExistingResourceConfigurationUIBean.fileUploadListener}"
+ immediateUpload="true">
+ <a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
+ </rich:fileUpload>
+ </h:form>
+ </ui:remove>
</h:panelGrid>
</h:panelGrid>
@@ -280,6 +290,17 @@ THIS TEXT WILL BE REMOVED.
</h:form>
+ <ui:remove>
+ <rich:panel>
+ <rich:fileUpload id="fileUpload"
+ listHeight="100px"
+
fileUploadListener="#{ExistingResourceConfigurationUIBean.fileUploadListener}"
+ immediateUpload="true">
+ <a4j:support event="onuploadcomplete"
reRender="fileMenu,fileContents"/>
+ </rich:fileUpload>
+ </rich:panel>
+ </ui:remove>
+
<h:panelGroup layout="block" styleClass="InfoBlock"
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
<b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index 8d8b046..25cec92 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -22,13 +22,23 @@
</h:panelGroup>
</f:facet>
<rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
+ <h:inputTextarea id="modalFileContents"
style="width:100%; height:100%; overflow:visible;"
rows="30"
cols="30"
value="#{ExistingResourceConfigurationUIBean.modalEditorContents}"
readonly="false"/>
</rich:panel>
+ <h:panelGrid columns="1" columnClasses="raw-edit-footer"
style="width:100%">
+ <h:panelGroup style="text-align:right">
+ <a4j:commandButton value="Save"
+
action="#{ExistingResourceConfigurationUIBean.saveModalEditorContents}"
+ reRender="fileContents,fileMenu"
+ styleClass="buttonmed"
+
onclick="#{rich:component('modalEditor')}.hide()"/>
+ <a4j:commandButton value="Cancel"
onclick="#{rich:component('modalEditor')}.hide()"
styleClass="buttonmed"/>
+ </h:panelGroup>
+ </h:panelGrid>
</rich:modalPanel>
</f:subview>
commit fd7680ada5b7376fae1b770121510316f724dbb4
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 18 17:23:40 2010 -0500
Modified error message for collected exceptions to match unit test expected value.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 0bda29e..dc3955a 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -377,7 +377,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
if (null == errorMessage){
errorMessage = new StringBuilder();
}
- errorMessage.append("file " +
rawConfiguration.getPath() +" failed validation with " + e.getMessage()+".
" );
+ errorMessage.append("file " +
rawConfiguration.getPath() +" failed validation with " +
e.getMessage()+"." );
}
}
}catch(Throwable t){
commit 2ab5f6f7c086a490ca50bd65058be4f38ee8e55c
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 18 17:17:53 2010 -0500
Somehow, a bad version of the error messaging generted code has not gotten changed.
This attempts to fix it.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index eb08ea3..0bda29e 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -382,7 +382,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
}catch(Throwable t){
errorMessage = new StringBuilder();
- errorMessage.append("configuation validation failed with" +
t.getMessage()+"." );
+ errorMessage.append("configuation validation failed with" +
t.getMessage()+".");
}
if (null != errorMessage){
throw new PluginContainerException(errorMessage.toString());
commit b9aa86fce93f2d1c98d82ded2125f67783ddf95d
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 18 17:10:02 2010 -0500
Adding commit button and msg above text area and moving them to the right side of the
screen.
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 25b7801..637ec4c 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
@@ -138,25 +138,32 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String switchToRaw() {
-// Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
-// EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), true);
Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getConfiguration(), true);
setConfiguration(configuration);
- getModified().clear();
-
for (RawConfiguration raw : configuration.getRawConfigurations()) {
getRaws().put(raw.getPath(), raw);
}
current = null;
setConfiguration(configuration);
-
+ updateModifiedCache();
mode = RAW_MODE;
return null;
}
+ private void updateModifiedCache() {
+ Configuration configuration = getConfiguration();
+
+ for (RawConfiguration updatedRaw : configuration.getRawConfigurations()) {
+ RawConfiguration cachedRaw = modified.get(updatedRaw.getPath());
+ if (cachedRaw != null &&
!updatedRaw.getSha256().equals(cachedRaw.getSha256())) {
+ modified.remove(cachedRaw.getPath());
+ }
+ }
+ }
+
public String switchToStructured() {
Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), false);
@@ -172,6 +179,12 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
current = null;
setConfiguration(configuration);
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ System.out.println(raw.getPath() + " -\n" + (new
String(raw.getContents())) + "\n");
+ }
+
+ updateModifiedCache();
+
mode = STRUCTURED_MODE;
return null;
@@ -418,12 +431,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public boolean isRawSupported() {
-// return getConfigurationFormat().isRawSupported();
- return getConfigurationDefinition().getConfigurationFormat() ==
ConfigurationFormat.RAW;
+ return getConfigurationDefinition().getConfigurationFormat() ==
ConfigurationFormat.RAW;
}
public boolean isStructuredSupported() {
-// return getConfigurationFormat().isStructuredSupported();
return getConfigurationDefinition().getConfigurationFormat() ==
ConfigurationFormat.STRUCTURED;
}
@@ -499,7 +510,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
log.error("Failed to complete download request for " +
getCurrentPath(), e);
throw new RuntimeException(e);
}
-// return "download";
}
/**
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
index d2cd3f7..cb1a71e 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
@@ -12,11 +12,11 @@
<!--</managed-bean> -->
<!-- /rhq/resource/configuration/history.xhtml,
/rhq/resource/configuration/edit.xhtml, and
/rhq/resource/configuration/edit-map.xhtml -->
- <managed-bean>
-
<managed-bean-name>ExistingResourceConfigurationUIBean</managed-bean-name>
-
<managed-bean-class>org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
+ <!--<managed-bean>-->
+
<!--<managed-bean-name>ExistingResourceConfigurationUIBean</managed-bean-name>-->
+
<!--<managed-bean-class>org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean</managed-bean-class>-->
+ <!--<managed-bean-scope>session</managed-bean-scope>-->
+ <!--</managed-bean> -->
<!-- /rhq/resource/configuration/add-new-simple.xhtml -->
<managed-bean>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index d9e5b18..c87f4cb 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -44,8 +44,18 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
- <h:panelGrid columns="2">
+ <h:panelGrid columns="2" style="width:100%">
<h:outputText value="#{ResourceUIBean.name}"/>
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:outputText style="padding-right:10px">n files changed in
this configuration</h:outputText>
+ <h:commandButton value="Commit"
+
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGroup>
+ </h:panelGrid>
</h:panelGrid>
<c:choose>
@@ -116,17 +126,17 @@ THIS TEXT WILL BE REMOVED.
readonly="false"/>
</rich:panel>
</h:panelGrid>
+ </h:panelGrid>
- <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
- <h:panelGrid columns="2">
- <h:outputText>n files changed in this
configuration</h:outputText>
- <h:commandButton value="Commit"
-
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure}"/>
- </h:panelGrid>
- </h:panelGrid>
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:outputText style="padding-right:10px">n files
changed in this configuration</h:outputText>
+ <h:commandButton value="Commit"
+
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGroup>
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
@@ -187,40 +197,40 @@ THIS TEXT WILL BE REMOVED.
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<h:panelGrid columns="1">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
-
-
- <rich:panelMenu id="fileMenu"
- mode="ajax"
- expandMode="client"
-
iconCollapsedGroup="/images/icn_tree_folder.gif"
-
iconExpandedGroup="/images/icn_tree_folder.gif">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
-
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
- <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
- icon="#{rawConfigUIBean.icon}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
-
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
- limitToList="true"
-
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
- <h:panelGroup>
- <h:outputText
value="#{#rawConfigUIBean.fileName}"/>
- <c:if test="#{rawConfigUIBean.modified}">
- <h:commandButton value="Undo"/>
- </c:if>
- </h:panelGroup>
- </rich:panelMenuItem>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+
+
+ <rich:panelMenu id="fileMenu"
+ mode="ajax"
+ expandMode="client"
+
iconCollapsedGroup="/images/icn_tree_folder.gif"
+
iconExpandedGroup="/images/icn_tree_folder.gif">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
+ <c:forEach
items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ icon="#{rawConfigUIBean.icon}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+ limitToList="true"
+
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
+ <h:panelGroup>
+ <h:outputText
value="#{#rawConfigUIBean.fileName}"/>
+ <c:if
test="#{rawConfigUIBean.modified}">
+ <h:commandButton value="Undo"/>
+ </c:if>
+ </h:panelGroup>
+ </rich:panelMenuItem>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
+ </rich:panel>
<rich:panel style="border:none">
<h:graphicImage url="/images/star_on_24.png"/>
<h:outputText value="- Contains uncommitted
changes"/>
@@ -249,17 +259,17 @@ THIS TEXT WILL BE REMOVED.
readonly="false"/>
</rich:panel>
</h:panelGrid>
+ </h:panelGrid>
- <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
- <h:panelGrid columns="2">
- <h:outputText>n files changed in this
configuration</h:outputText>
- <h:commandButton value="Commit"
-
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure}"/>
- </h:panelGrid>
- </h:panelGrid>
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <h:outputText style="padding-right:10px">n files
changed in this configuration</h:outputText>
+ <h:commandButton value="Commit"
+
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGroup>
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 7b34258..36b1905 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -63,7 +63,7 @@ THIS TEXT WILL BE REMOVED.
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
<h:commandButton value="Edit"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
commit 39cbfc6f8090cd0402917509c1aa7c32033c08a3
Merge: 6e642f7... a09d1be...
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 18 16:53:42 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config-confirm
commit 6e642f7fbf773f863bcc5c8b8bb6c37f4de991cc
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 18 16:25:31 2010 -0500
Update unit test.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 8a51f2a..eb08ea3 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -382,7 +382,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
}catch(Throwable t){
errorMessage = new StringBuilder();
- errorMessage.append("configuation validation failed with" +
t.getMessage()+". " );
+ errorMessage.append("configuation validation failed with" +
t.getMessage()+"." );
}
if (null != errorMessage){
throw new PluginContainerException(errorMessage.toString());
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
index 0176ef0..619fe36 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
@@ -71,48 +71,62 @@ public class ConfigurationManagerTest extends ConfigManagementTest {
}
@Test
- public void straegyShouldBeCalledToLoadConfig() throws Exception {
+ public void strategyShouldBeCalledToLoadConfig() throws Exception {
final Configuration expectedConfig = new Configuration();
final ConfigManagement loadConfig = context.mock(ConfigManagement.class);
- context.checking(new Expectations() {{
- atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
will(returnValue(loadConfig));
+ context.checking(new Expectations() {
+ {
+ atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
+ will(returnValue(loadConfig));
- atLeast(1).of(loadConfig).executeLoad(resourceId);
will(returnValue(expectedConfig));
- }});
+ atLeast(1).of(loadConfig).executeLoad(resourceId);
+ will(returnValue(expectedConfig));
+ }
+ });
Configuration actualConfig =
configurationMgr.loadResourceConfiguration(resourceId);
assertNotNull(actualConfig, "Expected a non-null " +
Configuration.class.getSimpleName() + " to be returned.");
}
- @Test(expectedExceptions = {PluginContainerException.class})
+ @Test(expectedExceptions = { PluginContainerException.class })
public void exceptionShouldBeThrownIfConfigIsNull() throws Exception {
final ConfigManagement loadConfig = context.mock(ConfigManagement.class);
- context.checking(new Expectations() {{
- atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
will(returnValue(loadConfig));
+ context.checking(new Expectations() {
+ {
+ atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
+ will(returnValue(loadConfig));
- atLeast(1).of(loadConfig).executeLoad(resourceId); will(returnValue(null));
+ atLeast(1).of(loadConfig).executeLoad(resourceId);
+ will(returnValue(null));
- allowing(componentService).getResourceType(resourceId); will(returnValue(new
ResourceType()));
- }});
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(new ResourceType()));
+ }
+ });
configurationMgr.loadResourceConfiguration(resourceId);
}
- @Test(expectedExceptions = {PluginContainerException.class})
+ @Test(expectedExceptions = { PluginContainerException.class })
public void exceptionShouldBeThrownWhenStrategyThrowsAnException() throws Exception
{
final ConfigManagement loadConfig = context.mock(ConfigManagement.class);
- context.checking(new Expectations() {{
- allowing(componentService).getResourceType(resourceId);
will(returnValue(resourceType));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
- atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
will(returnValue(loadConfig));
+ atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
+ will(returnValue(loadConfig));
- atLeast(1).of(loadConfig).executeLoad(resourceId); will(throwException(new
RuntimeException()));
- }});
+ atLeast(1).of(loadConfig).executeLoad(resourceId);
+ will(throwException(new RuntimeException()));
+ }
+ });
configurationMgr.loadResourceConfiguration(resourceId);
}
@@ -134,22 +148,24 @@ public class ConfigurationManagerTest extends ConfigManagementTest
{
final ResourceConfigurationFacet facet =
context.mock(ResourceConfigurationFacet.class);
- context.checking(new Expectations() {{
- allowing(componentService).getResourceType(resourceId);
will(returnValue(resourceType));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
- atLeast(1).of(componentService).getComponent(resourceId,
-
ResourceConfigurationFacet.class,
- FacetLockType.READ,
-
ConfigManagement.FACET_METHOD_TIMEOUT,
- daemonThread,
- onlyIfStarted);
- will(returnValue(facet));
+ atLeast(1).of(componentService).getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT,
daemonThread, onlyIfStarted);
+ will(returnValue(facet));
- atLeast(1).of(facet).loadRawConfigurations(); will(returnValue(latestRaws));
+ atLeast(1).of(facet).loadRawConfigurations();
+ will(returnValue(latestRaws));
- oneOf(facet).mergeRawConfiguration(config, raw1);
will(returnValue(mergedRaw1));
- oneOf(facet).mergeRawConfiguration(config, raw2);
will(returnValue(mergedRaw2));
- }});
+ oneOf(facet).mergeRawConfiguration(config, raw1);
+ will(returnValue(mergedRaw1));
+ oneOf(facet).mergeRawConfiguration(config, raw2);
+ will(returnValue(mergedRaw2));
+ }
+ });
Configuration mergedConfig = configurationMgr.merge(config, resourceId,
FROM_STRUCTURED);
@@ -171,28 +187,29 @@ public class ConfigurationManagerTest extends ConfigManagementTest
{
final ResourceConfigurationFacet facet =
context.mock(ResourceConfigurationFacet.class);
- context.checking(new Expectations() {{
- allowing(componentService).getResourceType(resourceId);
will(returnValue(resourceType));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
- atLeast(1).of(componentService).getComponent(resourceId,
-
ResourceConfigurationFacet.class,
- FacetLockType.READ,
-
ConfigManagement.FACET_METHOD_TIMEOUT,
- daemonThread,
- onlyIfStarted);
- will(returnValue(facet));
+ atLeast(1).of(componentService).getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT,
daemonThread, onlyIfStarted);
+ will(returnValue(facet));
- atLeast(1).of(facet).loadRawConfigurations(); will(returnValue(latestRaws));
+ atLeast(1).of(facet).loadRawConfigurations();
+ will(returnValue(latestRaws));
- oneOf(facet).mergeRawConfiguration(config, originalRaw);
will(returnValue(null));
- }});
+ oneOf(facet).mergeRawConfiguration(config, originalRaw);
+ will(returnValue(null));
+ }
+ });
Configuration mergedConfig = configurationMgr.merge(config, resourceId,
FROM_STRUCTURED);
Configuration expectedConfig = new Configuration();
expectedConfig.addRawConfiguration(originalRaw);
- assertStructuredMergedIntoRaws(mergedConfig, expectedConfig, "cannot merge
into a null raw.");
+ assertStructuredMergedIntoRaws(mergedConfig, expectedConfig, "cannot merge
into a null raw.");
}
@Test
@@ -204,46 +221,39 @@ public class ConfigurationManagerTest extends ConfigManagementTest
{
final ResourceConfigurationFacet facet =
context.mock(ResourceConfigurationFacet.class);
- context.checking(new Expectations() {{
- allowing(componentService).getResourceType(resourceId);
will(returnValue(resourceType));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
- atLeast(1).of(componentService).getComponent(resourceId,
-
ResourceConfigurationFacet.class,
- FacetLockType.READ,
-
ConfigManagement.FACET_METHOD_TIMEOUT,
- daemonThread,
- onlyIfStarted);
- will(returnValue(facet));
+ atLeast(1).of(componentService).getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT,
daemonThread, onlyIfStarted);
+ will(returnValue(facet));
- atLeast(1).of(facet).loadRawConfigurations(); will(returnValue(null));
- }});
+ atLeast(1).of(facet).loadRawConfigurations();
+ will(returnValue(null));
+ }
+ });
Configuration mergedConfig = configurationMgr.merge(config, resourceId,
FROM_STRUCTURED);
Configuration expectedConfig = new Configuration();
expectedConfig.addRawConfiguration(raw);
- assertStructuredMergedIntoRaws(
- mergedConfig,
- expectedConfig,
- "Expected raw configs should not be modified when the facet does not
return any raw configs."
- );
+ assertStructuredMergedIntoRaws(mergedConfig, expectedConfig,
+ "Expected raw configs should not be modified when the facet does not
return any raw configs.");
}
void assertStructuredMergedIntoRaws(Configuration actual, Configuration expected,
String msg) {
Set<RawConfiguration> actualRaws = actual.getRawConfigurations();
Set<RawConfiguration> expectedRaws = expected.getRawConfigurations();
- assertEquals(
- actualRaws.size(),
- expectedRaws.size(),
- "Merging structured into raws failed, got back the wrong number of raws.
-- " + msg
- );
+ assertEquals(actualRaws.size(), expectedRaws.size(),
+ "Merging structured into raws failed, got back the wrong number of raws.
-- " + msg);
for (RawConfiguration expectedRaw : expectedRaws) {
- assertTrue(
- actualRaws.contains(expectedRaw),
- "Merging structured into raws failed, failed to find to find raw
config [" + expectedRaw + "] -- " + msg
- );
+ assertTrue(actualRaws.contains(expectedRaw),
+ "Merging structured into raws failed, failed to find to find raw
config [" + expectedRaw + "] -- "
+ + msg);
}
}
@@ -265,38 +275,59 @@ public class ConfigurationManagerTest extends ConfigManagementTest
{
final ResourceConfigurationFacet facet =
context.mock(ResourceConfigurationFacet.class);
- context.checking(new Expectations() {{
- allowing(componentService).getResourceType(resourceId);
will(returnValue(resourceType));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
- atLeast(1).of(componentService).getComponent(resourceId,
-
ResourceConfigurationFacet.class,
- FacetLockType.READ,
-
ConfigManagement.FACET_METHOD_TIMEOUT,
- daemonThread,
- onlyIfStarted);
- will(returnValue(facet));
+ atLeast(1).of(componentService).getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT,
daemonThread, onlyIfStarted);
+ will(returnValue(facet));
- atLeast(1).of(facet).loadStructuredConfiguration();
will(returnValue(latestStructured));
+ atLeast(1).of(facet).loadStructuredConfiguration();
+ will(returnValue(latestStructured));
- oneOf(facet).mergeStructuredConfiguration(raw1, config);
- oneOf(facet).mergeStructuredConfiguration(raw2, config);
- }});
+ oneOf(facet).mergeStructuredConfiguration(raw1, config);
+ oneOf(facet).mergeStructuredConfiguration(raw2, config);
+ }
+ });
Configuration mergedConfig = configurationMgr.merge(config, resourceId,
FROM_RAW);
- assertEquals(
- mergedConfig.getAllProperties(),
- latestStructured.getAllProperties(),
- "Failed to merged raw into structured."
- );
+ assertEquals(mergedConfig.getAllProperties(),
latestStructured.getAllProperties(),
+ "Failed to merged raw into structured.");
}
@Test
- public void catchExceptionThrownByFailedValidationOfRawConfigS() throws Exception {
- assertTrue(false);
+ public void catchExceptionThrownByFailedValidationOfRawConfigs() throws Exception {
+
+ Configuration configuration = new Configuration();
+ final RawConfiguration rawConfiguration =
createRawConfiguration("/tmp/foo.txt");
+ configuration.addRawConfiguration(rawConfiguration);
+ final ResourceConfigurationFacet facet =
context.mock(ResourceConfigurationFacet.class);
+
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
+
+ atLeast(1).of(componentService).getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT,
daemonThread, onlyIfStarted);
+ will(returnValue(facet));
+
+ allowing(facet).validateRawConfiguration(rawConfiguration);
+ will(throwException(new IllegalArgumentException("message")));
+
+ }
+ });
+ try {
+ configurationMgr.validate(configuration, resourceId, false);
+ assertTrue(false);
+ } catch (PluginContainerException exception) {
+ assertEquals(exception.getMessage(), "file /tmp/foo.txt failed
validation with message.");
+ }
}
-
-
+
@Test
public void mergingRawsIntoStructuredShouldIgnoreNull() throws Exception {
Configuration config = new Configuration();
@@ -304,27 +335,24 @@ public class ConfigurationManagerTest extends ConfigManagementTest
{
final ResourceConfigurationFacet facet =
context.mock(ResourceConfigurationFacet.class);
- context.checking(new Expectations() {{
- allowing(componentService).getResourceType(resourceId);
will(returnValue(resourceType));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
- atLeast(1).of(componentService).getComponent(resourceId,
-
ResourceConfigurationFacet.class,
- FacetLockType.READ,
-
ConfigManagement.FACET_METHOD_TIMEOUT,
- daemonThread,
- onlyIfStarted);
- will(returnValue(facet));
+ atLeast(1).of(componentService).getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT,
daemonThread, onlyIfStarted);
+ will(returnValue(facet));
- atLeast(1).of(facet).loadStructuredConfiguration(); will(returnValue(null));
- }});
+ atLeast(1).of(facet).loadStructuredConfiguration();
+ will(returnValue(null));
+ }
+ });
Configuration mergedConfig = configurationMgr.merge(config, resourceId,
FROM_RAW);
- assertEquals(
- mergedConfig,
- config,
- "Structured config should not be modified when the facet does not return
a structured config."
- );
+ assertEquals(mergedConfig, config,
+ "Structured config should not be modified when the facet does not return
a structured config.");
}
@Test
@@ -348,16 +376,20 @@ public class ConfigurationManagerTest extends ConfigManagementTest
{
configurationMgr.setConfiguration(containerConfig);
- final UpdateResourceConfigurationRunner updateRunner = new
UpdateResourceConfigurationRunner(configServerService,
- resourceType, configMgmt, request);
+ final UpdateResourceConfigurationRunner updateRunner = new
UpdateResourceConfigurationRunner(
+ configServerService, resourceType, configMgmt, request);
- context.checking(new Expectations() {{
- allowing(componentService).getResourceType(resourceId);
will(returnValue(resourceType));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
- atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
will(returnValue(configMgmt));
+ atLeast(1).of(configMgmtFactory).getStrategy(resourceId);
+ will(returnValue(configMgmt));
-
oneOf(threadPool).submit((Runnable)with(matchingUpdateRunner(updateRunner)));
- }});
+ oneOf(threadPool).submit((Runnable)
with(matchingUpdateRunner(updateRunner)));
+ }
+ });
configurationMgr.updateResourceConfiguration(request);
}
commit e007d081188e8b458300294f4d2a5b8e3ce850ad
Merge: dc91b94... 56e8acf...
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 18 13:02:56 2010 -0500
Cleaned up bad merge.
diff --cc
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
index b76b310,54a7d8d..38a3f59
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
@@@ -44,6 -44,6 +44,5 @@@ public interface ResourceConfigurationF
void validateStructuredConfiguration(Configuration configuration);
- void validateRawConfiguration(RawConfiguration rawConfiguration) throws
IllegalArgumentException;
-
+ void validateRawConfiguration(RawConfiguration rawConfiguration) throws
RuntimeException;
-
}
diff --cc
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 9b3cc55,974055b..8a51f2a
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@@ -368,25 -368,21 +368,25 @@@ public class ConfigurationManager exten
return;
} else {
StringBuilder errorMessage = null;
-
- for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
- try {
- facet.validateRawConfiguration(rawConfiguration);
- } catch (Exception e) {
- if (null == errorMessage){
- errorMessage = new StringBuilder();
++
+ try{
+ for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ if (null == errorMessage){
+ errorMessage = new StringBuilder();
+ }
+ errorMessage.append("file " +
rawConfiguration.getPath() +" failed validation with " + e.getMessage()+".
" );
}
- errorMessage.append("file " + rawConfiguration.getPath()
+" failed validation with " + e.getMessage()+". " );
-
- }
- if (null != errorMessage){
- throw new PluginContainerException(errorMessage.toString());
}
- }
- }
+ }catch(Throwable t){
+ errorMessage = new StringBuilder();
+ errorMessage.append("configuation validation failed with" +
t.getMessage()+". " );
- }
- if (null != errorMessage){
- throw new PluginContainerException(errorMessage.toString());
- }
- }
- }
++ }
++ if (null != errorMessage){
++ throw new PluginContainerException(errorMessage.toString());
++ }
++ }
}
-
+ }
diff --cc
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
index b43a892,b43a892..0176ef0
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
@@@ -292,6 -292,6 +292,12 @@@ public class ConfigurationManagerTest e
}
@Test
++ public void catchExceptionThrownByFailedValidationOfRawConfigS() throws Exception {
++ assertTrue(false);
++ }
++
++
++ @Test
public void mergingRawsIntoStructuredShouldIgnoreNull() throws Exception {
Configuration config = new Configuration();
config.addRawConfiguration(createRawConfiguration("/tmp/foo.txt"));
commit a09d1bea01050e70913796e78518a0cf7464a7c6
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 18 11:10:33 2010 -0500
Refactoring to put config files into multiple directories
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index d82fb5e..2866427 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -15,6 +15,10 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
File rawConfigDir
+ File rawConfigSubdir1
+
+ File rawConfigSubdir2
+
File rawConfig1
File rawConfig2
@@ -29,20 +33,24 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
resourceContext = context
rawConfigDir = new
File("${System.getProperty('java.io.tmpdir')}/raw-config-test")
- rawConfig1 = new File(rawConfigDir, "structured-and-raw-test-1.txt")
- rawConfig2 = new File(rawConfigDir, "structured-and-raw-test-2.txt")
- rawConfig3 = new File(rawConfigDir, "structured-and-raw-test-3.txt")
- rawConfig4 = new File(rawConfigDir, "structured-and-raw-test-4.txt")
+ rawConfigSubdir1 = new File(rawConfigDir, "structured-and-raw-1")
+ rawConfigSubdir2 = new File(rawConfigDir, "structured-and-raw-2")
+
+ rawConfig1 = new File(rawConfigSubdir1, "structured-and-raw-test-1.txt")
+ rawConfig2 = new File(rawConfigSubdir1, "structured-and-raw-test-2.txt")
+ rawConfig3 = new File(rawConfigSubdir2, "structured-and-raw-test-3.txt")
+ rawConfig4 = new File(rawConfigSubdir2, "structured-and-raw-test-4.txt")
- createRawConfigDir()
+ createRawConfigDirs()
createConfigFile(rawConfig1, ["x": "1", "y":
"2", "z": "3"])
createConfigFile(rawConfig2, ["username": "rhqadmin",
"password": "rhqadmin"])
createConfigFile(rawConfig3, ["rhq.server.hostname": "localhost",
"rhq.server.port": "7080"])
createConfigFile(rawConfig4, ["raw.only.x": "foo",
"raw.only.y": "bar"])
}
- def createRawConfigDir() {
- rawConfigDir.mkdirs()
+ def createRawConfigDirs() {
+ rawConfigSubdir1.mkdirs()
+ rawConfigSubdir2.mkdirs()
}
def createConfigFile(File rawConfig, Map properties) {
commit 9a9156058a84bb2babd5f7e7fe60c285c651d39f
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 18 11:01:27 2010 -0500
Adding another config file for StructuredAndRawServer that is managed only via the raw
and not structured
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index 359c615..d82fb5e 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -21,6 +21,8 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
File rawConfig3
+ File rawConfig4
+
def ant = new AntBuilder()
void start(ResourceContext context) {
@@ -30,11 +32,13 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
rawConfig1 = new File(rawConfigDir, "structured-and-raw-test-1.txt")
rawConfig2 = new File(rawConfigDir, "structured-and-raw-test-2.txt")
rawConfig3 = new File(rawConfigDir, "structured-and-raw-test-3.txt")
+ rawConfig4 = new File(rawConfigDir, "structured-and-raw-test-4.txt")
createRawConfigDir()
createConfigFile(rawConfig1, ["x": "1", "y":
"2", "z": "3"])
createConfigFile(rawConfig2, ["username": "rhqadmin",
"password": "rhqadmin"])
createConfigFile(rawConfig3, ["rhq.server.hostname": "localhost",
"rhq.server.port": "7080"])
+ createConfigFile(rawConfig4, ["raw.only.x": "foo",
"raw.only.y": "bar"])
}
def createRawConfigDir() {
@@ -100,11 +104,16 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
rawConfigs.add(new RawConfiguration(path: rawConfig1.absolutePath, contents:
rawConfig1.readBytes()))
rawConfigs.add(new RawConfiguration(path: rawConfig2.absolutePath, contents:
rawConfig2.readBytes()))
rawConfigs.add(new RawConfiguration(path: rawConfig3.absolutePath, contents:
rawConfig3.readBytes()))
+ rawConfigs.add(new RawConfiguration(path: rawConfig4.absolutePath, contents:
rawConfig4.readBytes()))
return rawConfigs
}
RawConfiguration mergeRawConfiguration(Configuration configuration, RawConfiguration
rawConfiguration) {
+ if (rawConfiguration.path == rawConfig4.absolutePath) {
+ return rawConfiguration
+ }
+
def rawPropertiesConfig = loadRawPropertiesConfiguration(rawConfiguration)
def propertyNames = getPropertyNames(rawConfiguration)
@@ -129,6 +138,10 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
}
void mergeStructuredConfiguration(RawConfiguration rawConfiguration, Configuration
configuration) {
+ if (rawConfiguration.path == rawConfig4.absolutePath) {
+ return
+ }
+
def rawPropertiesConfig = loadRawPropertiesConfiguration(rawConfiguration)
def propertyNames = getPropertyNames(rawConfiguration)
commit 996a27d87231385b2a6b113732c8949c1493f153
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 18 10:49:47 2010 -0500
Updating logic so that when you click on the edit button, you go to the edit page but
remain on the same tab
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 ac0b460..25b7801 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
@@ -117,6 +117,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String editConfiguration() {
+ mode = STRUCTURED_MODE;
return SUCCESS_OUTCOME;
}
@@ -128,9 +129,11 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
public void changeTabs(ValueChangeEvent event) {
if (event.getNewValue().equals("rawTab")) {
switchToRaw();
+ mode = RAW_MODE;
}
else if (event.getNewValue().equals("structuredTab")) {
switchToStructured();
+ mode = STRUCTURED_MODE;
}
}
@@ -368,6 +371,22 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return modified;
}
+ public String getSelectedTab() {
+ if (mode == STRUCTURED_MODE) {
+ return "structuredTab";
+ }
+ return "rawTab";
+ }
+
+ public void setSelectedTab(String tab) {
+ if (tab.equals("structuredTab")) {
+ mode = STRUCTURED_MODE;
+ }
+ else {
+ mode = RAW_MODE;
+ }
+ }
+
public Object[] getPaths() {
return getRaws().keySet().toArray();
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
index 39270b7..1ed069c 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
@@ -28,13 +28,13 @@
<navigation-rule>
<navigation-case>
-
<from-action>#{ExistingResourceConfigurationViewUIBean.editConfiguration}</from-action>
+
<from-action>#{ExistingResourceConfigurationUIBean.editConfiguration}</from-action>
<to-view-id>/rhq/resource/configuration/edit.xhtml?id=#{param.id}</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
-
<from-action>#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}</from-action>
+
<from-action>#{ExistingResourceConfigurationUIBean.editRawConfiguration}</from-action>
<to-view-id>/rhq/resource/configuration/edit.xhtml?id=#{param.id}</to-view-id>
<redirect/>
</navigation-case>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 36effa3..d9e5b18 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -156,6 +156,7 @@ THIS TEXT WILL BE REMOVED.
<c:when
test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
<rich:tabPanel id="configTabPanel"
+
selectedTab="#{ExistingResourceConfigurationUIBean.selectedTab}"
switchType="ajax"
valueChangeListener="#{ExistingResourceConfigurationUIBean.changeTabs}">
<rich:tab id="structuredTab" label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 7d3bc58..7b34258 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -157,7 +157,10 @@ THIS TEXT WILL BE REMOVED.
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
<rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
- <rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <rich:tab id="structuredTab"
+ label="Basic Mode"
+ onlabelclick="cursor_wait();"
+ oncomplete="cursor_clear();">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -166,7 +169,7 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton id="editStructuredButton"
value="Edit"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
title="Edit this Configuration"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
@@ -181,7 +184,10 @@ THIS TEXT WILL BE REMOVED.
prevalidate="true"/>
</rich:tab>
- <rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <rich:tab id="rawTab"
+ label="Advanced Mode"
+ onlabelclick="cursor_wait();"
+ oncomplete="cursor_clear();">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -192,7 +198,7 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton id="editRawButton"
value="Edit"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
commit b5c9f6e8fc7f559757456bec29dcfe22893da1da
Merge: 7b13390... dc91b94...
Author: John Sanda <john(a)localhost.localdomain>
Date: Sun Jan 17 21:11:39 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config
commit 7b13390ea02ba3c7c17ab164afe35e84a9257143
Author: John Sanda <john(a)localhost.localdomain>
Date: Sun Jan 17 20:52:56 2010 -0500
Fixing a bug that breaks translating from structured to raw
There has been a lingering bug in the UI bean code that appears to break translating
from
structured to raw. An initial translation from structured to raw works fine. It
happens on
subsequent translations.
The UI bean mantains a cache of modified raw config values. When translating from
structured
to raw, the cache of modified values was not getting updated correctly. It was
retaining
stale values. Then on the raw edit (Advanced) tab, when you select a file for editing
that
has a property that was modified on structured side, the UI bean code first looks in
the cache
of modified values. If the raw config file has a modified value in the cache, that
value is
rendered. The problem though was that the cache had stale values and should have been
getting
flushed when translating from structured to raw the translated values are now newer
than
whats in the cache.
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 3079b5c..bd53936 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
@@ -135,11 +135,15 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String switchToRaw() {
+// Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
+// EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), true);
Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
- EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), true);
+ EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getConfiguration(), true);
setConfiguration(configuration);
+ getModified().clear();
+
for (RawConfiguration raw : configuration.getRawConfigurations()) {
getRaws().put(raw.getPath(), raw);
}
@@ -280,6 +284,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return getConfiguration();
}
+ public void undoEdit() {
+
+ }
+
public String discard() {
nullify();
return "/rhq/resource/configuration/view.xhtml?id=" + getResourceId();
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 9694bab..588c967 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -33,6 +33,8 @@ public class RawConfigUIBean {
private boolean modified;
+ private String modifiedContents;
+
public RawConfiguration getRawConfiguration() {
return rawConfiguration;
}
@@ -41,6 +43,14 @@ public class RawConfigUIBean {
this.rawConfiguration = rawConfiguration;
}
+ public String getModifiedContents() {
+ return modifiedContents;
+ }
+
+ public void setModifiedContents(String contents) {
+ modifiedContents = contents;
+ }
+
public boolean isModified() {
return modified;
}
commit dc91b941881b78569d0553011ddbd27b0cc66863
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Jan 15 16:19:56 2010 -0500
If an excpetion bypassed the catch block of the inner loop, there was no string
builder allocated to build the error message.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index aafea70..9b3cc55 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -380,6 +380,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
}
}catch(Throwable t){
+ errorMessage = new StringBuilder();
errorMessage.append("configuation validation failed with" +
t.getMessage()+". " );
}
if (null != errorMessage){
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
index 23af194..7c750d1 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
@@ -115,7 +115,7 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
void validateRawConfiguration(RawConfiguration rawConfiguration) {
def failValidation =
resourceContext.pluginConfiguration.getSimple("failValidation")
if (failValidation.getBooleanValue()) {
- throw new RuntimeException("Validation failed for
${rawConfiguration.path}");
+ throw new IllegalArgumentException("Validation failed for
${rawConfiguration.path}");
}
}
commit 8a27dcdaaf7767ef8ecc3e31cbb772136f96c667
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Jan 15 15:19:57 2010 -0500
cleaned up exception handling.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index a695616..aafea70 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -359,30 +359,33 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
public void validate(Configuration configuration, int resourceId, boolean
isStructured)
- throws PluginContainerException {
+ throws PluginContainerException {
boolean daemonOnly = true;
boolean onlyIfStarted = true;
ResourceConfigurationFacet facet = componentService.getComponent(resourceId,
ResourceConfigurationFacet.class,
- FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
if (isStructured) {
return;
} else {
StringBuilder errorMessage = null;
-
- for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
- try {
- facet.validateRawConfiguration(rawConfiguration);
- } catch (Throwable e) {
- if (null == errorMessage){
- errorMessage = new StringBuilder();
+ try{
+ for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ if (null == errorMessage){
+ errorMessage = new StringBuilder();
+ }
+ errorMessage.append("file " +
rawConfiguration.getPath() +" failed validation with " + e.getMessage()+".
" );
+ }
+ }
+ }catch(Throwable t){
+ errorMessage.append("configuation validation failed with" +
t.getMessage()+". " );
}
- errorMessage.append("file " + rawConfiguration.getPath()
+" failed validation with " + e.getMessage()+". " );
-
- }
if (null != errorMessage){
throw new PluginContainerException(errorMessage.toString());
}
}
}
}
-}
+
commit d486f956042b24ba69363f97f938b5961513c957
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Jan 15 11:46:54 2010 -0500
changing the exception handling strategy for the validation code on the agent side.
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
index 54a7d8d..b76b310 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
@@ -44,6 +44,6 @@ public interface ResourceConfigurationFacet {
void validateStructuredConfiguration(Configuration configuration);
- void validateRawConfiguration(RawConfiguration rawConfiguration) throws
RuntimeException;
+ void validateRawConfiguration(RawConfiguration rawConfiguration) throws
IllegalArgumentException;
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 974055b..a695616 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -372,7 +372,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
try {
facet.validateRawConfiguration(rawConfiguration);
- } catch (Exception e) {
+ } catch (Throwable e) {
if (null == errorMessage){
errorMessage = new StringBuilder();
}
commit edb2b662b18c00dbcb9aa8315c274131676decae
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 14 21:20:19 2010 -0500
Cleaned up exception handling.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index c0d0dac..974055b 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -85,17 +85,14 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
LoggingThreadFactory threadFactory = new
LoggingThreadFactory(SENDER_THREAD_POOL_NAME, true);
threadPool = new ScheduledThreadPoolExecutor(1, threadFactory);
- ConfigurationCheckExecutor configurationChecker =
- new ConfigurationCheckExecutor(this, getConfigurationServerService(),
- PluginContainer.getInstance().getInventoryManager());
+ ConfigurationCheckExecutor configurationChecker = new
ConfigurationCheckExecutor(this,
+ getConfigurationServerService(),
PluginContainer.getInstance().getInventoryManager());
if (pluginContainerConfiguration.getConfigurationDiscoveryPeriod() > 0
- && pluginContainerConfiguration.isInsideAgent()) {
- threadPool.scheduleAtFixedRate(
- configurationChecker,
-
pluginContainerConfiguration.getConfigurationDiscoveryInitialDelay(),
- pluginContainerConfiguration.getConfigurationDiscoveryPeriod(),
- TimeUnit.SECONDS);
+ && pluginContainerConfiguration.isInsideAgent()) {
+ threadPool.scheduleAtFixedRate(configurationChecker,
pluginContainerConfiguration
+ .getConfigurationDiscoveryInitialDelay(), pluginContainerConfiguration
+ .getConfigurationDiscoveryPeriod(), TimeUnit.SECONDS);
}
}
@@ -154,8 +151,8 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
Callable<ConfigurationUpdateResponse> runner;
- runner = new UpdateResourceConfigurationRunner(configurationServerService,
resourceType,
- configMgmt, request);
+ runner = new UpdateResourceConfigurationRunner(configurationServerService,
resourceType, configMgmt,
+ request);
response = getThreadPool().submit(runner).get();
} catch (Exception e) {
@@ -178,8 +175,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
if (fromStructured) {
mergedStructuredIntoRaws(configuration, facet);
- }
- else {
+ } else {
mergeRawsIntoStructured(configuration, facet);
}
@@ -234,15 +230,13 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
}
- private void updateRawConfig(Configuration configuration, RawConfiguration
originalRaw,
- RawConfiguration mergedRaw) {
+ private void updateRawConfig(Configuration configuration, RawConfiguration
originalRaw, RawConfiguration mergedRaw) {
configuration.removeRawConfiguration(originalRaw);
configuration.addRawConfiguration(mergedRaw);
}
- public Configuration loadResourceConfiguration(int resourceId)
- throws PluginContainerException {
+ public Configuration loadResourceConfiguration(int resourceId) throws
PluginContainerException {
ConfigManagement loadConfig = configMgmtFactory.getStrategy(resourceId);
Configuration configuration = null;
@@ -263,43 +257,43 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
private String createErrorMsg(int resourceId, String msg) throws
PluginContainerException {
ResourceType resourceType = componentService.getResourceType(resourceId);
- return "Plugin Error: Resource Component for [" +
resourceType.getName() + "] Resource with id [" +
- resourceId + "]: " + msg;
+ return "Plugin Error: Resource Component for [" +
resourceType.getName() + "] Resource with id [" + resourceId
+ + "]: " + msg;
}
-// public Configuration loadResourceConfiguration(int resourceId) throws
PluginContainerException {
-// ResourceType resourceType = getResourceType(resourceId);
-// ConfigurationFacet configComponent = getConfigurationFacet(resourceId,
FacetLockType.READ);
-// try {
-// Configuration configuration = configComponent.loadResourceConfiguration();
-// if (configuration == null) {
-// throw new PluginContainerException("Plugin Error: Resource
Component for [" + resourceType.getName()
-// + "] Resource with id [" + resourceId + "]
returned a null Configuration.");
-// }
-//
-// // If the plugin didn't already set the notes field, set it to
something useful.
-// if (configuration.getNotes() == null) {
-// configuration.setNotes("Resource config for " +
resourceType.getName() + " Resource w/ id " + resourceId);
-// }
-//
-// ConfigurationDefinition configurationDefinition =
resourceType.getResourceConfigurationDefinition();
-//
-// // Normalize and validate the config.
-// ConfigurationUtility.normalizeConfiguration(configuration,
configurationDefinition);
-// List<String> errorMessages =
ConfigurationUtility.validateConfiguration(configuration,
-// configurationDefinition);
-// for (String errorMessage : errorMessages) {
-// log.warn("Plugin Error: Invalid " + resourceType.getName() +
" Resource configuration returned by "
-// + resourceType.getPlugin() + " plugin - " +
errorMessage);
-// }
-//
-// return configuration;
-// } catch (Throwable t) {
-// //noinspection ThrowableInstanceNeverThrown
-// throw new PluginContainerException("Cannot load Resource configuration
for [" + resourceId + "]",
-// new WrappedRemotingException(t));
-// }
-// }
+ // public Configuration loadResourceConfiguration(int resourceId) throws
PluginContainerException {
+ // ResourceType resourceType = getResourceType(resourceId);
+ // ConfigurationFacet configComponent = getConfigurationFacet(resourceId,
FacetLockType.READ);
+ // try {
+ // Configuration configuration =
configComponent.loadResourceConfiguration();
+ // if (configuration == null) {
+ // throw new PluginContainerException("Plugin Error: Resource
Component for [" + resourceType.getName()
+ // + "] Resource with id [" + resourceId + "]
returned a null Configuration.");
+ // }
+ //
+ // // If the plugin didn't already set the notes field, set it to
something useful.
+ // if (configuration.getNotes() == null) {
+ // configuration.setNotes("Resource config for " +
resourceType.getName() + " Resource w/ id " + resourceId);
+ // }
+ //
+ // ConfigurationDefinition configurationDefinition =
resourceType.getResourceConfigurationDefinition();
+ //
+ // // Normalize and validate the config.
+ // ConfigurationUtility.normalizeConfiguration(configuration,
configurationDefinition);
+ // List<String> errorMessages =
ConfigurationUtility.validateConfiguration(configuration,
+ // configurationDefinition);
+ // for (String errorMessage : errorMessages) {
+ // log.warn("Plugin Error: Invalid " +
resourceType.getName() + " Resource configuration returned by "
+ // + resourceType.getPlugin() + " plugin - " +
errorMessage);
+ // }
+ //
+ // return configuration;
+ // } catch (Throwable t) {
+ // //noinspection ThrowableInstanceNeverThrown
+ // throw new PluginContainerException("Cannot load Resource
configuration for [" + resourceId + "]",
+ // new WrappedRemotingException(t));
+ // }
+ // }
/**
* Returns a thread pool that this object will use when asychronously executing
configuration operations on a
@@ -333,7 +327,8 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
protected ConfigurationFacet getConfigurationFacet(int resourceId, FacetLockType
lockType)
throws PluginContainerException {
boolean daemonThread = (lockType != FacetLockType.WRITE);
- return ComponentUtil.getComponent(resourceId, ConfigurationFacet.class, lockType,
FACET_METHOD_TIMEOUT, daemonThread, true);
+ return ComponentUtil.getComponent(resourceId, ConfigurationFacet.class, lockType,
FACET_METHOD_TIMEOUT,
+ daemonThread, true);
}
/**
@@ -372,12 +367,21 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
if (isStructured) {
return;
} else {
+ StringBuilder errorMessage = null;
+
for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
try {
facet.validateRawConfiguration(rawConfiguration);
- } catch (IllegalArgumentException e) {
- throw new PluginContainerException(e);
+ } catch (Exception e) {
+ if (null == errorMessage){
+ errorMessage = new StringBuilder();
+ }
+ errorMessage.append("file " + rawConfiguration.getPath()
+" failed validation with " + e.getMessage()+". " );
+
}
+ if (null != errorMessage){
+ throw new PluginContainerException(errorMessage.toString());
+ }
}
}
}
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 2acf803..4248ad6 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
@@ -991,13 +991,12 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
if (isRawSupported(resourceId)){
try{
validateResourceConfiguration(subject, resourceId, newConfiguration,false);
- } catch(RuntimeException e){
+ } catch(PluginContainerException e){
ResourceConfigurationUpdate response = new ResourceConfigurationUpdate(null,
newConfiguration, subject.getName());
response.setErrorMessage(e.getMessage());
+ response.setStatus(ConfigurationUpdateStatus.UNSENT);
return response;
- } catch (PluginContainerException e) {
- return null;
- }
+ }
}
ResourceConfigurationUpdate newUpdate =
commit ade23f1eb6eec8a22c7a846d7c70e22dace2e5f2
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 14 13:56:06 2010 -0500
Validate prior to recording for Update.
diff --git a/.classpath b/.classpath
index c8e2a2d..e6c678b 100644
--- a/.classpath
+++ b/.classpath
@@ -114,7 +114,6 @@
<classpathentry kind="src"
path="modules/plugins/byteman/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/lsof/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/jdbctrace/src/main/java"/>
- <classpathentry kind="src"
path="modules/plugins/antlr-config/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/antlr-config/src/main/antlr3"/>
<classpathentry kind="src"
path="modules/plugins/augeas/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/augeas/src/test/java"/>
@@ -217,9 +216,6 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/net/homeip/yusuke/twitter4j/2.0.9/twitter4j-2.0.9.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/>
<classpathentry exported="true" kind="lib"
path="modules/enterprise/remoting/webservices/target/rhq-remoting-webservices-1.4.0-SNAPSHOT/wsconsume-output"/>
<classpathentry kind="var"
path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
index 8291766..10d36a9 100644
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,4 @@
-#Thu Nov 05 13:19:01 GMT-05:00 2009
+#Thu Jan 14 12:59:22 EST 2010
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
@@ -52,7 +52,7 @@ cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=_RHQ
cleanup_settings_version=2
eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=false
formatter_profile=_RHQ
formatter_settings_version=11
org.eclipse.jdt.ui.exception.name=e
diff --git
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
index 32a3dd4..c5ee507 100644
---
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
+++
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
@@ -98,4 +98,26 @@ public interface ConfigurationAgentService {
*/
Configuration merge(Configuration configuration, int resourceId, boolean
fromStructured)
throws PluginContainerException;
+
+
+ /**
+ * If the <code>fromStructured</code> flag is
<code>true</code>, then the s
+ * Configuration.properties</code>) is merged into the latest raw configura
+ * Configuration object returned will consist of the structured configurati
+ * configurations. If <code>fromStructured</code> is
<code>false</code>, th
+ * Configuration.rawConfigurations</code>) is merged into the latest struct
+ * plugin. The returned Configuration will then consist of the raw configur
+ * configuration.
+ *
+ * @param configuration The Configuration with the changes to be merged
+ * @param resourceId The id of the resource to which the configuration belo
+ * @param A flag that if <code>true</code> indicates the Structured
configu
+ * validates the raw
+ * @return The <strong>merged</strong> configuration, where a merge
consist
+ * followed by the values of the side merging from being applied to the sid
+ * @throws PluginContainerException
+ * @throws PluginContainerException if a runtime or plugin error occurs.
+ */
+ void validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException;
+
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
index f8f01bc..d28327f 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
@@ -30,7 +30,7 @@ package org.rhq.core.domain.configuration;
* @author John Mazzitelli
*/
public enum ConfigurationUpdateStatus {
- INPROGRESS("In Progress"), SUCCESS("Success"),
FAILURE("Failure");
+ INPROGRESS("In Progress"), SUCCESS("Success"),
FAILURE("Failure"),UNSENT("unsent");
private String displayName;
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
index 4a14c67..54a7d8d 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
@@ -44,6 +44,6 @@ public interface ResourceConfigurationFacet {
void validateStructuredConfiguration(Configuration configuration);
- void validateRawConfiguration(RawConfiguration rawConfiguration);
+ void validateRawConfiguration(RawConfiguration rawConfiguration) throws
RuntimeException;
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 5a0e155..c0d0dac 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -362,4 +362,23 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
return null;
}
+
+ public void validate(Configuration configuration, int resourceId, boolean
isStructured)
+ throws PluginContainerException {
+ boolean daemonOnly = true;
+ boolean onlyIfStarted = true;
+ ResourceConfigurationFacet facet = componentService.getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ if (isStructured) {
+ return;
+ } else {
+ for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ throw new PluginContainerException(e);
+ }
+ }
+ }
+ }
}
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 3079b5c..244d19b 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
@@ -199,7 +199,11 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
"Configuration update request with id "
+ updateRequest.getId() + " failed.",
updateRequest.getErrorMessage());
return FAILURE_OUTCOME;
- }
+ case UNSENT:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
"Configuration update was not valid"
+ , updateRequest.getErrorMessage());
+ return FAILURE_OUTCOME;
+ }
} else {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes
were made to the configuration, so "
+ "no update request has been sent to the Agent.");
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 fbae47d..2acf803 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
@@ -988,14 +988,46 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
fromStructured);
}
+ if (isRawSupported(resourceId)){
+ try{
+ validateResourceConfiguration(subject, resourceId, newConfiguration,false);
+ } catch(RuntimeException e){
+ ResourceConfigurationUpdate response = new ResourceConfigurationUpdate(null,
newConfiguration, subject.getName());
+ response.setErrorMessage(e.getMessage());
+ return response;
+ } catch (PluginContainerException e) {
+ return null;
+ }
+ }
+
ResourceConfigurationUpdate newUpdate =
configurationManager.persistNewResourceConfigurationUpdateHistory(subject,
resourceId, configToUpdate,
ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
-
executeResourceConfigurationUpdate(newUpdate, fromStructured);
-
return newUpdate;
}
+ private void validateResourceConfiguration(Subject subject, int resourceId,
Configuration configuration,boolean isStructured) throws PluginContainerException {
+ Resource resource = entityManager.find(Resource.class, resourceId);
+ if (resource == null) {
+ throw new NoResultException("Cannot get live configuration for unknown
resource [" + resourceId + "]");
+ }
+ if (!authorizationManager.canViewResource(subject, resource.getId())) {
+ throw new PermissionException("User [" + subject.getName()
+ + "] does not have permission to view resource configuration for
[" + resource + "]");
+ }
+ Agent agent = resource.getAgent();
+ AgentClient agentClient = this.agentManager.getAgentClient(agent);
+ ConfigurationAgentService configService =
agentClient.getConfigurationAgentService();
+ configService.validate(configuration, resourceId, isStructured);
+ }
+
+ private boolean isRawSupported(int resourceId) {
+ Resource resource = entityManager.find(Resource.class, resourceId);
+ ConfigurationDefinition configDef =
resource.getResourceType().getResourceConfigurationDefinition();
+
+ return (ConfigurationFormat.STRUCTURED_AND_RAW ==
configDef.getConfigurationFormat() || (ConfigurationFormat.RAW ==
configDef.getConfigurationFormat()));
+ }
+
private boolean isStructuredAndRawSupported(int resourceId) {
Resource resource = entityManager.find(Resource.class, resourceId);
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index 77bf269..9281e14 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -1153,5 +1153,8 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test
{
@Asynchronous(guaranteedDelivery = true)
public void synchronizeInventory(ResourceSyncInfo syncInfo) {
}
+ public void validate(Configuration configuration, int resourceId, boolean isStructured)
+ throws PluginContainerException {
+ }
}
-}
\ No newline at end of file
+}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
index 56b6741..2c13eb6 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
@@ -254,4 +254,8 @@ public class TestAgentClient implements AgentClient,
ContentAgentService, Resour
public InputStream getSnapshotReport(int resourceId, String name, String description)
throws Exception {
return null;
}
-}
\ No newline at end of file
+
+ public void validate(Configuration configuration, int resourceId, boolean
isStructured)
+ throws PluginContainerException {
+ }
+}
commit 9f214af77b6bdcf02c0353dd8b6e4e6a24416e06
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 15 00:49:12 2010 -0500
Adding logic to display an 'undo' button next to files in the file menu that
have modifications
The undo button is not yet wired to an action method with this commit.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 2e9b517..36effa3 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -75,7 +75,14 @@ THIS TEXT WILL BE REMOVED.
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu"/>
+
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
+ <h:panelGroup>
+ <h:outputText
value="#{#rawConfigUIBean.fileName}"/>
+ <c:if test="#{rawConfigUIBean.modified}">
+ <h:commandButton value="Undo"/>
+ </c:if>
+ </h:panelGroup>
+ </rich:panelMenuItem>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
@@ -200,7 +207,14 @@ THIS TEXT WILL BE REMOVED.
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
limitToList="true"
-
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu"/>
+
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
+ <h:panelGroup>
+ <h:outputText
value="#{#rawConfigUIBean.fileName}"/>
+ <c:if test="#{rawConfigUIBean.modified}">
+ <h:commandButton value="Undo"/>
+ </c:if>
+ </h:panelGroup>
+ </rich:panelMenuItem>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
commit 2e98f67f8ab7fcec4133cd31853fcdfdc699851b
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 15 00:26:03 2010 -0500
Updating file menu to display icon next to file that has been modified in the file
menu.
Previously one of the default icons was always being displayed next to files in the
file
menu. Now an icon is rendered only when the file has modifications and you switch to
a
different file in the editor.
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 40d5ba1..3079b5c 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
@@ -420,11 +420,23 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
if (!updated.equals(original)) {
current = current.deepCopy(false);
current.setContents(updated.getBytes());
- //TODO update other values like MD5
+
+ markCurrentRawConfigUIBeanModified();
getModified().put(current.getPath(), current);
}
}
+ private void markCurrentRawConfigUIBeanModified() {
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
+ if (bean.getPath().equals(current.getPath())) {
+ bean.setModified(true);
+ return;
+ }
+ }
+ }
+ }
+
public void setCurrentPath(String path) {
RawConfiguration raw = getModified().get(path);
if (null == raw) {
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 21b7d41..9694bab 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -57,4 +57,12 @@ public class RawConfigUIBean {
File file = new File(rawConfiguration.getPath());
return file.getName();
}
+
+ public String getIcon() {
+ if (isModified()) {
+ return "/images/star_on_24.png";
+ }
+
+ return "/images/blank.png";
+ }
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index bf146f8..2e9b517 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -59,12 +59,11 @@ THIS TEXT WILL BE REMOVED.
<rich:panel style="width:100%">
<f:facet name="header">Files</f:facet>
- <rich:panelMenu mode="ajax"
+ <rich:panelMenu id="fileMenu"
+ mode="ajax"
expandMode="client"
iconCollapsedGroup="/images/icn_tree_folder.gif"
-
iconExpandedGroup="/images/icn_tree_folder.gif"
- limitToList="true"
- reRender="fileContents">
+
iconExpandedGroup="/images/icn_tree_folder.gif">
<c:forEach items="#{rawConfigDirectories}"
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
@@ -72,16 +71,20 @@ THIS TEXT WILL BE REMOVED.
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ icon="#{rawConfigUIBean.icon}"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectedFileHeader,modalEditor"/>
+
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
</rich:panelMenu>
</rich:panel>
- * - Contains uncommitted changes
+ <rich:panel style="border:none">
+ <h:graphicImage url="/images/star_on_24.png"/>
+ <h:outputText value="- Contains uncommitted
changes"/>
+ </rich:panel>
</h:panelGrid>
<h:panelGrid columns="1" style="width:100%;">
@@ -180,7 +183,8 @@ THIS TEXT WILL BE REMOVED.
<f:facet name="header">Files</f:facet>
- <rich:panelMenu mode="ajax"
+ <rich:panelMenu id="fileMenu"
+ mode="ajax"
expandMode="client"
iconCollapsedGroup="/images/icn_tree_folder.gif"
iconExpandedGroup="/images/icn_tree_folder.gif">
@@ -191,17 +195,21 @@ THIS TEXT WILL BE REMOVED.
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ icon="#{rawConfigUIBean.icon}"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
limitToList="true"
-
reRender="fileContents,selectedFileHeader,modalEditor"/>
+
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
</rich:panelMenu>
</rich:panel>
- * - Contains uncommitted changes
+ <rich:panel style="border:none">
+ <h:graphicImage url="/images/star_on_24.png"/>
+ <h:outputText value="- Contains uncommitted
changes"/>
+ </rich:panel>
</h:panelGrid>
<h:panelGrid columns="1" style="width:100%;">
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index ce5f228..7d3bc58 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -86,6 +86,7 @@ THIS TEXT WILL BE REMOVED.
selectedChild="#{currentPath}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ icon="/images/blank.png"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
commit 56e8acf16cf81a654a0144a0bb3f520e9541d70d
Merge: 7020f5a... e45b2f8...
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 14 21:26:55 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config-confirm
commit 7020f5a959eb4ba055352a6dbd14382fc5cdabea
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 14 21:20:19 2010 -0500
Cleaned up exception handling.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index c0d0dac..974055b 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -85,17 +85,14 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
LoggingThreadFactory threadFactory = new
LoggingThreadFactory(SENDER_THREAD_POOL_NAME, true);
threadPool = new ScheduledThreadPoolExecutor(1, threadFactory);
- ConfigurationCheckExecutor configurationChecker =
- new ConfigurationCheckExecutor(this, getConfigurationServerService(),
- PluginContainer.getInstance().getInventoryManager());
+ ConfigurationCheckExecutor configurationChecker = new
ConfigurationCheckExecutor(this,
+ getConfigurationServerService(),
PluginContainer.getInstance().getInventoryManager());
if (pluginContainerConfiguration.getConfigurationDiscoveryPeriod() > 0
- && pluginContainerConfiguration.isInsideAgent()) {
- threadPool.scheduleAtFixedRate(
- configurationChecker,
-
pluginContainerConfiguration.getConfigurationDiscoveryInitialDelay(),
- pluginContainerConfiguration.getConfigurationDiscoveryPeriod(),
- TimeUnit.SECONDS);
+ && pluginContainerConfiguration.isInsideAgent()) {
+ threadPool.scheduleAtFixedRate(configurationChecker,
pluginContainerConfiguration
+ .getConfigurationDiscoveryInitialDelay(), pluginContainerConfiguration
+ .getConfigurationDiscoveryPeriod(), TimeUnit.SECONDS);
}
}
@@ -154,8 +151,8 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
Callable<ConfigurationUpdateResponse> runner;
- runner = new UpdateResourceConfigurationRunner(configurationServerService,
resourceType,
- configMgmt, request);
+ runner = new UpdateResourceConfigurationRunner(configurationServerService,
resourceType, configMgmt,
+ request);
response = getThreadPool().submit(runner).get();
} catch (Exception e) {
@@ -178,8 +175,7 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
if (fromStructured) {
mergedStructuredIntoRaws(configuration, facet);
- }
- else {
+ } else {
mergeRawsIntoStructured(configuration, facet);
}
@@ -234,15 +230,13 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
}
}
- private void updateRawConfig(Configuration configuration, RawConfiguration
originalRaw,
- RawConfiguration mergedRaw) {
+ private void updateRawConfig(Configuration configuration, RawConfiguration
originalRaw, RawConfiguration mergedRaw) {
configuration.removeRawConfiguration(originalRaw);
configuration.addRawConfiguration(mergedRaw);
}
- public Configuration loadResourceConfiguration(int resourceId)
- throws PluginContainerException {
+ public Configuration loadResourceConfiguration(int resourceId) throws
PluginContainerException {
ConfigManagement loadConfig = configMgmtFactory.getStrategy(resourceId);
Configuration configuration = null;
@@ -263,43 +257,43 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
private String createErrorMsg(int resourceId, String msg) throws
PluginContainerException {
ResourceType resourceType = componentService.getResourceType(resourceId);
- return "Plugin Error: Resource Component for [" +
resourceType.getName() + "] Resource with id [" +
- resourceId + "]: " + msg;
+ return "Plugin Error: Resource Component for [" +
resourceType.getName() + "] Resource with id [" + resourceId
+ + "]: " + msg;
}
-// public Configuration loadResourceConfiguration(int resourceId) throws
PluginContainerException {
-// ResourceType resourceType = getResourceType(resourceId);
-// ConfigurationFacet configComponent = getConfigurationFacet(resourceId,
FacetLockType.READ);
-// try {
-// Configuration configuration = configComponent.loadResourceConfiguration();
-// if (configuration == null) {
-// throw new PluginContainerException("Plugin Error: Resource
Component for [" + resourceType.getName()
-// + "] Resource with id [" + resourceId + "]
returned a null Configuration.");
-// }
-//
-// // If the plugin didn't already set the notes field, set it to
something useful.
-// if (configuration.getNotes() == null) {
-// configuration.setNotes("Resource config for " +
resourceType.getName() + " Resource w/ id " + resourceId);
-// }
-//
-// ConfigurationDefinition configurationDefinition =
resourceType.getResourceConfigurationDefinition();
-//
-// // Normalize and validate the config.
-// ConfigurationUtility.normalizeConfiguration(configuration,
configurationDefinition);
-// List<String> errorMessages =
ConfigurationUtility.validateConfiguration(configuration,
-// configurationDefinition);
-// for (String errorMessage : errorMessages) {
-// log.warn("Plugin Error: Invalid " + resourceType.getName() +
" Resource configuration returned by "
-// + resourceType.getPlugin() + " plugin - " +
errorMessage);
-// }
-//
-// return configuration;
-// } catch (Throwable t) {
-// //noinspection ThrowableInstanceNeverThrown
-// throw new PluginContainerException("Cannot load Resource configuration
for [" + resourceId + "]",
-// new WrappedRemotingException(t));
-// }
-// }
+ // public Configuration loadResourceConfiguration(int resourceId) throws
PluginContainerException {
+ // ResourceType resourceType = getResourceType(resourceId);
+ // ConfigurationFacet configComponent = getConfigurationFacet(resourceId,
FacetLockType.READ);
+ // try {
+ // Configuration configuration =
configComponent.loadResourceConfiguration();
+ // if (configuration == null) {
+ // throw new PluginContainerException("Plugin Error: Resource
Component for [" + resourceType.getName()
+ // + "] Resource with id [" + resourceId + "]
returned a null Configuration.");
+ // }
+ //
+ // // If the plugin didn't already set the notes field, set it to
something useful.
+ // if (configuration.getNotes() == null) {
+ // configuration.setNotes("Resource config for " +
resourceType.getName() + " Resource w/ id " + resourceId);
+ // }
+ //
+ // ConfigurationDefinition configurationDefinition =
resourceType.getResourceConfigurationDefinition();
+ //
+ // // Normalize and validate the config.
+ // ConfigurationUtility.normalizeConfiguration(configuration,
configurationDefinition);
+ // List<String> errorMessages =
ConfigurationUtility.validateConfiguration(configuration,
+ // configurationDefinition);
+ // for (String errorMessage : errorMessages) {
+ // log.warn("Plugin Error: Invalid " +
resourceType.getName() + " Resource configuration returned by "
+ // + resourceType.getPlugin() + " plugin - " +
errorMessage);
+ // }
+ //
+ // return configuration;
+ // } catch (Throwable t) {
+ // //noinspection ThrowableInstanceNeverThrown
+ // throw new PluginContainerException("Cannot load Resource
configuration for [" + resourceId + "]",
+ // new WrappedRemotingException(t));
+ // }
+ // }
/**
* Returns a thread pool that this object will use when asychronously executing
configuration operations on a
@@ -333,7 +327,8 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
protected ConfigurationFacet getConfigurationFacet(int resourceId, FacetLockType
lockType)
throws PluginContainerException {
boolean daemonThread = (lockType != FacetLockType.WRITE);
- return ComponentUtil.getComponent(resourceId, ConfigurationFacet.class, lockType,
FACET_METHOD_TIMEOUT, daemonThread, true);
+ return ComponentUtil.getComponent(resourceId, ConfigurationFacet.class, lockType,
FACET_METHOD_TIMEOUT,
+ daemonThread, true);
}
/**
@@ -372,12 +367,21 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
if (isStructured) {
return;
} else {
+ StringBuilder errorMessage = null;
+
for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
try {
facet.validateRawConfiguration(rawConfiguration);
- } catch (IllegalArgumentException e) {
- throw new PluginContainerException(e);
+ } catch (Exception e) {
+ if (null == errorMessage){
+ errorMessage = new StringBuilder();
+ }
+ errorMessage.append("file " + rawConfiguration.getPath()
+" failed validation with " + e.getMessage()+". " );
+
}
+ if (null != errorMessage){
+ throw new PluginContainerException(errorMessage.toString());
+ }
}
}
}
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 2acf803..4248ad6 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
@@ -991,13 +991,12 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
if (isRawSupported(resourceId)){
try{
validateResourceConfiguration(subject, resourceId, newConfiguration,false);
- } catch(RuntimeException e){
+ } catch(PluginContainerException e){
ResourceConfigurationUpdate response = new ResourceConfigurationUpdate(null,
newConfiguration, subject.getName());
response.setErrorMessage(e.getMessage());
+ response.setStatus(ConfigurationUpdateStatus.UNSENT);
return response;
- } catch (PluginContainerException e) {
- return null;
- }
+ }
}
ResourceConfigurationUpdate newUpdate =
commit e45b2f8bff457bb665ae6713e93b26f9d326f520
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 14 20:59:18 2010 -0500
Updating modal dialog editor to display the correct header and contents after a file
selection
The modal dialog change has been made only for the edit page so far. On view.xhtml the
modal editor
still does not get updated because it is referencing the wrong backing bean.
Adding folder icon for directories in the file menu.
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 2f48509..40d5ba1 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
@@ -338,6 +338,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return getCurrent().getPath();
}
+ public String getModalEditorHeader() {
+ return getCurrentPath();
+ }
+
public String getModalEditorContents() {
return getCurrentContents();
}
@@ -353,6 +357,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public Object[] getPaths() {
+
return getRaws().keySet().toArray();
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 4ff5b06..bf146f8 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -55,12 +55,14 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <h:panelGrid columns="1">
<rich:panel style="width:100%">
<f:facet name="header">Files</f:facet>
<rich:panelMenu mode="ajax"
expandMode="client"
- iconCollapsedGroup="disc"
+
iconCollapsedGroup="/images/icn_tree_folder.gif"
+
iconExpandedGroup="/images/icn_tree_folder.gif"
limitToList="true"
reRender="fileContents">
<c:forEach items="#{rawConfigDirectories}"
@@ -79,6 +81,8 @@ THIS TEXT WILL BE REMOVED.
</c:forEach>
</rich:panelMenu>
</rich:panel>
+ * - Contains uncommitted changes
+ </h:panelGrid>
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
@@ -116,6 +120,7 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
+ <ui:include src="view-raw-modal.xhtml"/>
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredSupported}">
@@ -170,13 +175,15 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <h:panelGrid columns="1">
<rich:panel style="width:100%">
<f:facet name="header">Files</f:facet>
<rich:panelMenu mode="ajax"
expandMode="client"
- iconCollapsedGroup="disc">
+
iconCollapsedGroup="/images/icn_tree_folder.gif"
+
iconExpandedGroup="/images/icn_tree_folder.gif">
<c:forEach items="#{rawConfigDirectories}"
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
@@ -194,6 +201,8 @@ THIS TEXT WILL BE REMOVED.
</c:forEach>
</rich:panelMenu>
</rich:panel>
+ * - Contains uncommitted changes
+ </h:panelGrid>
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
@@ -229,15 +238,13 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</h:panelGrid>
</h:panelGrid>
-
- <ui:include src="view-raw-modal.xhtml"/>
</rich:tab>
</rich:tabPanel>
+
+ <ui:include src="view-raw-modal.xhtml"/>
</c:when>
</c:choose>
-
-
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index 8aed4f3..8d8b046 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -12,7 +12,7 @@
<rich:modalPanel id="modalEditor" width="800"
height="600">
<f:facet name="header">
<h:panelGroup>
- <h:outputText
value="#{ExistingResourceConfiguratioUIBean.currentPath}"/>
+ <h:outputText
value="#{ExistingResourceConfigurationUIBean.modalEditorHeader}"/>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 8e605da..ce5f228 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -75,7 +75,8 @@ THIS TEXT WILL BE REMOVED.
<f:facet name="header">Files</f:facet>
<rich:panelMenu mode="ajax"
expandMode="client"
- iconCollapsedGroup="disc"
+
iconCollapsedGroup="/images/icn_tree_folder.gif"
+
iconExpandedGroup="/images/icn_tree_folder.gif"
limitToList="true"
reRender="fileContents">
<c:forEach items="#{rawConfigDirectories}"
@@ -120,6 +121,7 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
+ <ui:include src="view-raw-modal.xhtml"/>
</c:when>
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
@@ -201,7 +203,8 @@ THIS TEXT WILL BE REMOVED.
<f:facet name="header">Files</f:facet>
<rich:panelMenu mode="ajax"
expandMode="client"
- iconCollapsedGroup="disc"
+
iconCollapsedGroup="/images/icn_tree_folder.gif"
+
iconExpandedGroup="/images/icn_tree_folder.gif"
limitToList="true"
reRender="fileContents">
<c:forEach items="#{rawConfigDirectories}"
@@ -219,7 +222,7 @@ THIS TEXT WILL BE REMOVED.
</rich:panelMenuGroup>
</c:forEach>
</rich:panelMenu>
- </rich:panel>
+ </rich:panel>
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
@@ -244,15 +247,11 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
-
- <ui:include src="view-raw-modal.xhtml"/>
</rich:tab>
</rich:tabPanel>
+ <ui:include src="view-raw-modal.xhtml"/>
</c:when>
</c:choose>
-
-
-
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
commit 0301452395f085420fd7904cec31e1b7b487e2d6
Merge: 4192ecb... e2f84e3...
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 14 14:39:57 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config-confirm
commit 4192ecb358067c1fd49ba2557b29763ce97ef63f
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 14 13:56:06 2010 -0500
Validate prior to recording for Update.
diff --git a/.classpath b/.classpath
index c8e2a2d..e6c678b 100644
--- a/.classpath
+++ b/.classpath
@@ -114,7 +114,6 @@
<classpathentry kind="src"
path="modules/plugins/byteman/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/lsof/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/jdbctrace/src/main/java"/>
- <classpathentry kind="src"
path="modules/plugins/antlr-config/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/antlr-config/src/main/antlr3"/>
<classpathentry kind="src"
path="modules/plugins/augeas/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/augeas/src/test/java"/>
@@ -217,9 +216,6 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/net/homeip/yusuke/twitter4j/2.0.9/twitter4j-2.0.9.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/>
<classpathentry exported="true" kind="lib"
path="modules/enterprise/remoting/webservices/target/rhq-remoting-webservices-1.4.0-SNAPSHOT/wsconsume-output"/>
<classpathentry kind="var"
path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
index 8291766..10d36a9 100644
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,4 @@
-#Thu Nov 05 13:19:01 GMT-05:00 2009
+#Thu Jan 14 12:59:22 EST 2010
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
@@ -52,7 +52,7 @@ cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=_RHQ
cleanup_settings_version=2
eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=false
formatter_profile=_RHQ
formatter_settings_version=11
org.eclipse.jdt.ui.exception.name=e
diff --git
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
index 32a3dd4..c5ee507 100644
---
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
+++
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
@@ -98,4 +98,26 @@ public interface ConfigurationAgentService {
*/
Configuration merge(Configuration configuration, int resourceId, boolean
fromStructured)
throws PluginContainerException;
+
+
+ /**
+ * If the <code>fromStructured</code> flag is
<code>true</code>, then the s
+ * Configuration.properties</code>) is merged into the latest raw configura
+ * Configuration object returned will consist of the structured configurati
+ * configurations. If <code>fromStructured</code> is
<code>false</code>, th
+ * Configuration.rawConfigurations</code>) is merged into the latest struct
+ * plugin. The returned Configuration will then consist of the raw configur
+ * configuration.
+ *
+ * @param configuration The Configuration with the changes to be merged
+ * @param resourceId The id of the resource to which the configuration belo
+ * @param A flag that if <code>true</code> indicates the Structured
configu
+ * validates the raw
+ * @return The <strong>merged</strong> configuration, where a merge
consist
+ * followed by the values of the side merging from being applied to the sid
+ * @throws PluginContainerException
+ * @throws PluginContainerException if a runtime or plugin error occurs.
+ */
+ void validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException;
+
}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
index f8f01bc..d28327f 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
@@ -30,7 +30,7 @@ package org.rhq.core.domain.configuration;
* @author John Mazzitelli
*/
public enum ConfigurationUpdateStatus {
- INPROGRESS("In Progress"), SUCCESS("Success"),
FAILURE("Failure");
+ INPROGRESS("In Progress"), SUCCESS("Success"),
FAILURE("Failure"),UNSENT("unsent");
private String displayName;
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
index 4a14c67..54a7d8d 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
@@ -44,6 +44,6 @@ public interface ResourceConfigurationFacet {
void validateStructuredConfiguration(Configuration configuration);
- void validateRawConfiguration(RawConfiguration rawConfiguration);
+ void validateRawConfiguration(RawConfiguration rawConfiguration) throws
RuntimeException;
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index 5a0e155..c0d0dac 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -362,4 +362,23 @@ public class ConfigurationManager extends AgentService implements
ContainerServi
return null;
}
+
+ public void validate(Configuration configuration, int resourceId, boolean
isStructured)
+ throws PluginContainerException {
+ boolean daemonOnly = true;
+ boolean onlyIfStarted = true;
+ ResourceConfigurationFacet facet = componentService.getComponent(resourceId,
ResourceConfigurationFacet.class,
+ FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ if (isStructured) {
+ return;
+ } else {
+ for (RawConfiguration rawConfiguration :
configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ throw new PluginContainerException(e);
+ }
+ }
+ }
+ }
}
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 971d581..59b7f68 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
@@ -193,7 +193,11 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
"Configuration update request with id "
+ updateRequest.getId() + " failed.",
updateRequest.getErrorMessage());
return FAILURE_OUTCOME;
- }
+ case UNSENT:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
"Configuration update was not valid"
+ , updateRequest.getErrorMessage());
+ return FAILURE_OUTCOME;
+ }
} else {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes
were made to the configuration, so "
+ "no update request has been sent to the Agent.");
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 fbae47d..2acf803 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
@@ -988,14 +988,46 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
fromStructured);
}
+ if (isRawSupported(resourceId)){
+ try{
+ validateResourceConfiguration(subject, resourceId, newConfiguration,false);
+ } catch(RuntimeException e){
+ ResourceConfigurationUpdate response = new ResourceConfigurationUpdate(null,
newConfiguration, subject.getName());
+ response.setErrorMessage(e.getMessage());
+ return response;
+ } catch (PluginContainerException e) {
+ return null;
+ }
+ }
+
ResourceConfigurationUpdate newUpdate =
configurationManager.persistNewResourceConfigurationUpdateHistory(subject,
resourceId, configToUpdate,
ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
-
executeResourceConfigurationUpdate(newUpdate, fromStructured);
-
return newUpdate;
}
+ private void validateResourceConfiguration(Subject subject, int resourceId,
Configuration configuration,boolean isStructured) throws PluginContainerException {
+ Resource resource = entityManager.find(Resource.class, resourceId);
+ if (resource == null) {
+ throw new NoResultException("Cannot get live configuration for unknown
resource [" + resourceId + "]");
+ }
+ if (!authorizationManager.canViewResource(subject, resource.getId())) {
+ throw new PermissionException("User [" + subject.getName()
+ + "] does not have permission to view resource configuration for
[" + resource + "]");
+ }
+ Agent agent = resource.getAgent();
+ AgentClient agentClient = this.agentManager.getAgentClient(agent);
+ ConfigurationAgentService configService =
agentClient.getConfigurationAgentService();
+ configService.validate(configuration, resourceId, isStructured);
+ }
+
+ private boolean isRawSupported(int resourceId) {
+ Resource resource = entityManager.find(Resource.class, resourceId);
+ ConfigurationDefinition configDef =
resource.getResourceType().getResourceConfigurationDefinition();
+
+ return (ConfigurationFormat.STRUCTURED_AND_RAW ==
configDef.getConfigurationFormat() || (ConfigurationFormat.RAW ==
configDef.getConfigurationFormat()));
+ }
+
private boolean isStructuredAndRawSupported(int resourceId) {
Resource resource = entityManager.find(Resource.class, resourceId);
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index 77bf269..9281e14 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -1153,5 +1153,8 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test
{
@Asynchronous(guaranteedDelivery = true)
public void synchronizeInventory(ResourceSyncInfo syncInfo) {
}
+ public void validate(Configuration configuration, int resourceId, boolean isStructured)
+ throws PluginContainerException {
+ }
}
-}
\ No newline at end of file
+}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
index 56b6741..2c13eb6 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
@@ -254,4 +254,8 @@ public class TestAgentClient implements AgentClient,
ContentAgentService, Resour
public InputStream getSnapshotReport(int resourceId, String name, String description)
throws Exception {
return null;
}
-}
\ No newline at end of file
+
+ public void validate(Configuration configuration, int resourceId, boolean
isStructured)
+ throws PluginContainerException {
+ }
+}
commit e2f84e3cf31ca90530a297222e05591250a98cb7
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 14 10:59:25 2010 -0500
Adding logic to properly initialize the rawConfigDirectories property in the UI
backing bean.
The rawConfigDirectories property is only used for configs that support raw so a check
needed to be
added to only initialize it if raw is supported. Previously we were attempting to
always
initialize it, and when raw was not supported it caused a NPE. When raw is not
supported it
gets initialized to an empty collection since it is annotated with @Out and Seam will
not
allow an @Out to be null.
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 971d581..2f48509 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
@@ -23,6 +23,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -83,7 +84,12 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
@Create
public void begin() {
- initConfigDirectories();
+ if (isRawSupported() || isStructuredAndRawSupported()) {
+ initConfigDirectories();
+ }
+ else {
+ rawConfigDirectories = Collections.EMPTY_LIST;
+ }
}
private void initConfigDirectories() {
commit 04c56bcb72c98e43cd94fbabc790991f7f42a62d
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 14 08:54:48 2010 -0500
Fixing another translation/file selection issue in which modifications were getting
overwritten
A backing bean being property, currentContents was being references in
view-raw-moal.xhtml and it's
older, non-updated value was overwriting the modified value. This was happening
because different
components were referencing the same backing bean property.
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 3a81c03..971d581 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
@@ -332,6 +332,13 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return getCurrent().getPath();
}
+ public String getModalEditorContents() {
+ return getCurrentContents();
+ }
+
+ public void setModalEditorContents(String contents) {
+ }
+
public TreeMap<String, RawConfiguration> getModified() {
if (modified == null) {
modified = new TreeMap<String, RawConfiguration>();
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index ea3fe76..4ff5b06 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -229,12 +229,14 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</h:panelGrid>
</h:panelGrid>
+
+ <ui:include src="view-raw-modal.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
</c:choose>
- <ui:include src="view-raw-modal.xhtml"/>
+
</h:form>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index f0e8b25..8aed4f3 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -26,7 +26,7 @@
style="width:100%; height:100%; overflow:visible;"
rows="30"
cols="30"
-
value="#{ExistingResourceConfigurationUIBean.currentContents}"
+
value="#{ExistingResourceConfigurationUIBean.modalEditorContents}"
readonly="false"/>
</rich:panel>
</rich:modalPanel>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 6e68e0c..8e605da 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -244,12 +244,14 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
+
+ <ui:include src="view-raw-modal.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
</c:choose>
- <ui:include src="view-raw-modal.xhtml"/>
+
</h:form>
commit 56cbca2bb02f3af03c21f65dffcf63feb53522a1
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 14 00:26:46 2010 -0500
Fixing regression that broke translation and changing files from the raw file menu
I introduced a regression earlier today when adding support for the modal file editor
that resulted in
breaking the translation when switching back and forth between the structured and raw
tabs. Selecting
a file in the raw file menu triggers a partial page update. The modal editor is in a
subview on the page and
it was not getting updating during the ajax request. It was holding onto an older
value of the selected
file which in turn was overwriting the corresponding property in the backing bean.
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 a6366a4..3a81c03 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
@@ -120,10 +120,10 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public void changeTabs(ValueChangeEvent event) {
- if (event.getNewValue().equals("Advanced Mode")) {
+ if (event.getNewValue().equals("rawTab")) {
switchToRaw();
}
- else if (event.getNewValue().equals("Basic Mode")) {
+ else if (event.getNewValue().equals("structuredTab")) {
switchToStructured();
}
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 139b5b3..ea3fe76 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -67,13 +67,13 @@ THIS TEXT WILL BE REMOVED.
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
expanded="true"
- selectedChild="#{currentPath}">
+
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
+
reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
@@ -83,8 +83,8 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
<a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
<a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
@@ -140,8 +140,10 @@ THIS TEXT WILL BE REMOVED.
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
- <rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
- <rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <rich:tabPanel id="configTabPanel"
+ switchType="ajax"
+
valueChangeListener="#{ExistingResourceConfigurationUIBean.changeTabs}">
+ <rich:tab id="structuredTab" label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
@@ -164,7 +166,7 @@ THIS TEXT WILL BE REMOVED.
styleClass="buttonmed"/>
</h:panelGrid>
</rich:tab>
- <rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <rich:tab id="rawTab" label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
@@ -174,20 +176,19 @@ THIS TEXT WILL BE REMOVED.
<rich:panelMenu mode="ajax"
expandMode="client"
- iconCollapsedGroup="disc"
- limitToList="true"
- reRender="fileContents">
+ iconCollapsedGroup="disc">
<c:forEach items="#{rawConfigDirectories}"
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
expanded="true"
- selectedChild="#{currentPath}">
+
selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
+ limitToList="true"
+
reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
@@ -197,8 +198,8 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4"
style="width:100%;">
<a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ startText="Loading
#{ExistingResourceConfigurationUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
<a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
@@ -233,33 +234,6 @@ THIS TEXT WILL BE REMOVED.
</c:when>
</c:choose>
- <ui:remove>
- <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
- <h:outputText value=" #{messages.switch2}"/>
- <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchToRaw}">
- <f:param name="conversationId"
value="#{conversation.id}"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- <h:outputText value=" files mode"/>
- </h:commandLink>
- </h:panelGroup>
-
-
- <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
-
- <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
- rendered="#{ExistingResourceConfigurationUIBean.configuration
!= null}">
- <h:commandButton value="SAVE"
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
- title="Click to Save Changes"
styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure}"/>
- <h:commandButton value="RESET" type="reset"
immediate="true"
- title="Click to Reset Fields"
styleClass="buttonmed"/>
- </h:panelGrid>
- </ui:remove>
-
<ui:include src="view-raw-modal.xhtml"/>
</h:form>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index ddbce3b..f0e8b25 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -12,7 +12,7 @@
<rich:modalPanel id="modalEditor" width="800"
height="600">
<f:facet name="header">
<h:panelGroup>
- <h:outputText
value="#{ExistingResourceConfigurationViewUIBean.currentPath}"/>
+ <h:outputText
value="#{ExistingResourceConfiguratioUIBean.currentPath}"/>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 81fdb1b..6e68e0c 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -88,7 +88,7 @@ THIS TEXT WILL BE REMOVED.
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
+
reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
@@ -214,7 +214,7 @@ THIS TEXT WILL BE REMOVED.
onclick="cursor_wait();"
oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
+
reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
commit 25dca64eee9ea55165d31e10539abf3e46751637
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 13 14:08:12 2010 -0500
Adding javascript on edit page to change cursor to wait icon when switching between
tabs
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index d82efd7..139b5b3 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -34,7 +34,7 @@ THIS TEXT WILL BE REMOVED.
}
function open_modal_editor() {
-
+
}
</script>
@@ -52,185 +52,182 @@ THIS TEXT WILL BE REMOVED.
<c:when
test="${ExistingResourceConfigurationUIBean.rawSupported}">
<rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
<rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
-
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
-
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="disc"
- limitToList="true"
- reRender="fileContents">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
- <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
-
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
</c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
- <h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </h:commandLink>
- </h:panelGrid>
+ </rich:panelMenu>
+ </rich:panel>
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
-
value="#{ExistingResourceConfigurationUIBean.currentContents}"
- readonly="false"/>
- </rich:panel>
- </h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
- <h:panelGrid columns="2">
- <h:outputText>n files changed in this
configuration</h:outputText>
- <h:commandButton value="Commit"
-
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure}"/>
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4"
style="width:100%;">
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationUIBean.currentContents}"
+ readonly="false"/>
+ </rich:panel>
+ </h:panelGrid>
+
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGrid columns="2">
+ <h:outputText>n files changed in this
configuration</h:outputText>
+ <h:commandButton value="Commit"
+
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGrid>
+ </h:panelGrid>
</h:panelGrid>
- </h:panelGrid>
- </h:panelGrid>
- </rich:tab>
+ </rich:tab>
</rich:tabPanel>
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredSupported}">
<rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
<rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
-
- <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
- rendered="#{ExistingResourceConfigurationUIBean.configuration
!= null}">
- <h:commandButton value="SAVE"
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
- title="Click to Save Changes"
styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure}"/>
- <h:commandButton value="RESET" type="reset"
immediate="true"
- title="Click to Reset Fields"
styleClass="buttonmed"/>
- </h:panelGrid>
- </rich:tab>
+ <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationUIBean.configuration != null}">
+ <h:commandButton value="SAVE"
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
+ title="Click to Save Changes"
styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ <h:commandButton value="RESET" type="reset"
immediate="true"
+ title="Click to Reset Fields"
styleClass="buttonmed"/>
+ </h:panelGrid>
+ </rich:tab>
</rich:tabPanel>
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
- <h:panelGrid columns="2">
- <h:outputText value="#{ResourceUIBean.name}"/>
- </h:panelGrid>
<rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
- <rich:tab label="Basic Mode">
+ <rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
-
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationUIBean.configuration != null}">
- <h:commandButton value="SAVE"
-
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure}"/>
- <h:commandButton value="RESET"
- type="reset"
- immediate="true"
- title="Click to Reset Fields"
- styleClass="buttonmed"/>
- </h:panelGrid>
+
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationUIBean.configuration != null}">
+ <h:commandButton value="SAVE"
+
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ <h:commandButton value="RESET"
+ type="reset"
+ immediate="true"
+ title="Click to Reset Fields"
+ styleClass="buttonmed"/>
+ </h:panelGrid>
</rich:tab>
- <rich:tab label="Advanced Mode">
+ <rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:panelGrid columns="2"
- styleClass="raw-outer-table"
-
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
-
-
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="disc"
- limitToList="true"
- reRender="fileContents">
- <c:forEach items="#{rawConfigDirectories}"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+
+
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
- <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
-
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
</rich:panel>
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
- <h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </h:commandLink>
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4"
style="width:100%;">
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationUIBean.currentContents}"
+ readonly="false"/>
+ </rich:panel>
</h:panelGrid>
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
-
value="#{ExistingResourceConfigurationUIBean.currentContents}"
- readonly="false"/>
- </rich:panel>
- </h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
- <h:panelGrid columns="2">
- <h:outputText>n files changed in this
configuration</h:outputText>
- <h:commandButton value="Commit"
-
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure}"/>
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGrid columns="2">
+ <h:outputText>n files changed in this
configuration</h:outputText>
+ <h:commandButton value="Commit"
+
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGrid>
</h:panelGrid>
</h:panelGrid>
- </h:panelGrid>
</rich:tab>
</rich:tabPanel>
</c:when>
commit f2216a80c0e71c1ea5adfe95d6e8addc3552b8d8
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 13 13:50:31 2010 -0500
Using tabs on the view/edit pages regardless of the supported config format to be
consistent
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 4ec4a1e..d82efd7 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -44,8 +44,14 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <h:panelGrid columns="2">
+ <h:outputText value="#{ResourceUIBean.name}"/>
+ </h:panelGrid>
+
<c:choose>
<c:when
test="${ExistingResourceConfigurationUIBean.rawSupported}">
+ <rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
+ <rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
@@ -108,9 +114,13 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</h:panelGrid>
</h:panelGrid>
+ </rich:tab>
+ </rich:tabPanel>
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredSupported}">
+ <rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
+ <rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
@@ -125,6 +135,8 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="RESET" type="reset"
immediate="true"
title="Click to Reset Fields"
styleClass="buttonmed"/>
</h:panelGrid>
+ </rich:tab>
+ </rich:tabPanel>
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 37c0100..81fdb1b 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -44,201 +44,213 @@ THIS TEXT WILL BE REMOVED.
<h:form id="viewResourceConfigurationForm">
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <h:panelGrid columns="2">
+ <h:outputText value="#{ResourceUIBean.name}"/>
+ </h:panelGrid>
+
<c:choose>
<c:when
test="${ExistingResourceConfigurationViewUIBean.rawSupported}">
- <h:outputText value=" #{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton value="#{messages.editraw}"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
-
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="disc"
- limitToList="true"
- reRender="fileContents">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
- <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
-
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
- <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </h:commandLink>
+
+ <rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
+ <rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <h:outputText value=" #{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton value="Edit"
+
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
-
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
- readonly="true"/>
- </rich:panel>
- </h:panelGrid>
- </h:panelGrid>
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
+ </rich:panel>
+
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4"
style="width:100%;">
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+ <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
+ readonly="true"/>
+ </rich:panel>
+ </h:panelGrid>
+ </h:panelGrid>
+ </rich:tab>
+ </rich:tabPanel>
</c:when>
+
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
- <h:outputText value=" #{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton value="#{messages.editstructured}"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
- title="Edit this Configuration"
- styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <onc:config
-
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
-
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
- readOnly="true"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
+ <rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
+ <rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
+ <h:outputText value=" #{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton value="Edit"
+
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+ title="Edit this Configuration"
+ styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGrid>
+ <onc:config
+
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
+
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ readOnly="true"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+ </rich:tab>
+ </rich:tabPanel>
</c:when>
+
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
- <h:panelGrid columns="2">
- <h:outputText value="#{ResourceUIBean.name}"/>
- </h:panelGrid>
<rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
<rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <h:outputText value="
#{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2"
styleClass="buttons-table" columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton id="editStructuredButton"
- value="Edit"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
- title="Edit this Configuration"
styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <onc:config
-
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
-
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
- readOnly="true"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
+ <h:outputText value=" #{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton id="editStructuredButton"
+ value="Edit"
+
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+ title="Edit this Configuration"
styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGrid>
+
+ <onc:config
+
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
+
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ readOnly="true"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
</rich:tab>
<rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:outputText value=" #{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton id="editRawButton"
- value="Edit"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
-
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="disc"
- limitToList="true"
- reRender="fileContents">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
- <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
-
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
-
reRender="fileContents,selectFileHeader"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
- <h:commandLink value="Upload New">
- <h:graphicImage value="/images/upload.png"/>
- </h:commandLink>
- <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </h:commandLink>
- </h:panelGrid>
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton id="editRawButton"
+ value="Edit"
+
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure
and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGrid>
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
-
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
- readonly="true"/>
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
</rich:panel>
+
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4"
style="width:100%;">
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+ <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
+ readonly="true"/>
+ </rich:panel>
+ </h:panelGrid>
</h:panelGrid>
- </h:panelGrid>
</rich:tab>
</rich:tabPanel>
</c:when>
</c:choose>
<ui:include src="view-raw-modal.xhtml"/>
-
+
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
commit f53dfc6ad315a723c22ceab61a31dfec92f92dbf
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 13 13:15:01 2010 -0500
Adding initial support for full screen, modal raw config editor
With this commit, we can view a config file in a modal window. Still need to add
functionality for
applying updates from the modal window.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index ec75f22..4ec4a1e 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -32,6 +32,10 @@ THIS TEXT WILL BE REMOVED.
function cursor_clear() {
document.body.style.cursor = 'default';
}
+
+ function open_modal_editor() {
+
+ }
</script>
<h:form id="editResourceConfigurationForm"
@@ -75,7 +79,7 @@ THIS TEXT WILL BE REMOVED.
<a4j:status id="selectedFileHeader"
startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <h:commandLink value="View Full Screen"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
</h:commandLink>
@@ -179,34 +183,14 @@ THIS TEXT WILL BE REMOVED.
</rich:panelMenuGroup>
</c:forEach>
</rich:panelMenu>
-
-
- <ui:remove>
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="disc"
- limitToList="true"
- reRender="fileContents">
- <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
- <c:forEach
items="#{ExistingResourceConfigurationUIBean.configuration.rawConfigurations}"
- var="rawConfig">
- <rich:panelMenuItem label="#{rawConfig.path}"
-
action="#{ExistingResourceConfigurationUIBean.select(rawConfig.path)}"
- styleClass="raw-menu-item"
- tableBorderColor="blue"
-
reRender="fileContents,selectedFileHeader"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </rich:panelMenu>
- </ui:remove>
- </rich:panel>
+ </rich:panel>
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
<a4j:status id="selectedFileHeader"
startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <h:commandLink value="View Full Screen"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
</h:commandLink>
@@ -267,6 +251,8 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</ui:remove>
+ <ui:include src="view-raw-modal.xhtml"/>
+
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
new file mode 100644
index 0000000..ddbce3b
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <f:subview id="subview">
+ <rich:modalPanel id="modalEditor" width="800"
height="600">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText
value="#{ExistingResourceConfigurationViewUIBean.currentPath}"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/close.png"
styleClass="hidelink" id="hidelink"/>
+ <rich:componentControl for="modalEditor"
attachTo="hidelink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%; height:100%; overflow:visible;"
+ rows="30"
+ cols="30"
+
value="#{ExistingResourceConfigurationUIBean.currentContents}"
+ readonly="false"/>
+ </rich:panel>
+ </rich:modalPanel>
+ </f:subview>
+
+</ui:composition>
\ No newline at end of file
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index b9d13b9..37c0100 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -92,7 +92,7 @@ THIS TEXT WILL BE REMOVED.
<a4j:status id="selectedFileHeader"
startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <h:commandLink value="View Full Screen"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
</h:commandLink>
@@ -214,7 +214,7 @@ THIS TEXT WILL BE REMOVED.
<a4j:status id="selectedFileHeader"
startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
- <h:commandLink value="View Full Screen"/>
+ <a href="#"
onclick="#{rich:component('modalEditor')}.show()">View Full
Screen</a>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
</h:commandLink>
@@ -236,6 +236,9 @@ THIS TEXT WILL BE REMOVED.
</rich:tabPanel>
</c:when>
</c:choose>
+
+ <ui:include src="view-raw-modal.xhtml"/>
+
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
commit f5630e163bfea70d1fc5629a67310ab0ccccd689
Merge: f9ce225... 776bbc9...
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 21:54:45 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config
commit f9ce225efdf75887f6a2abb16ab2696e1f569579
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 21:48:34 2010 -0500
Adding javascript and file grouping on the raw view and on the edit pages
The files in the file menu are now grouped by directory in all views where it is
rendered. JavaScript has
been added in places as well to change the cursor style to wait when a new config is
selected and is
loading.
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 027ce1d..a6366a4 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
@@ -59,11 +59,12 @@ import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-/**
- * @author Ian Springer
- */
-@Name(value = "ExistingResourceConfigurationViewUIBean")
-(a)Scope(ScopeType.PAGE)
+// This class is temporarily decleared in components.xml since it is declared under two
names - ViewUIBean and
+// UIBean. This class is undergoing some refactoring and part of that will include
declaring the @Name and @Scope
+// annotations again.
+//
+//@Name(value = "ExistingResourceConfigurationViewUIBean")
+//(a)Scope(ScopeType.PAGE)
public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUIBean {
public static final String MANAGED_BEAN_NAME =
"ExistingResourceConfigurationUIBean";
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
index 64bd31e..8f7cfcc 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
@@ -19,4 +19,13 @@
<property name="createTempFiles">false</property>
<property name="maxRequestSize">1000000</property>
</component>
+
+ <component
class="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"
+ name="ExistingResourceConfigurationViewUIBean"
+ scope="page"/>
+
+ <component
class="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"
+ name="ExistingResourceConfigurationUIBean"
+ scope="session"/>
+
</components>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 02ef0c1..ec75f22 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -24,6 +24,15 @@ THIS TEXT WILL BE REMOVED.
<ui:param name="selectedTabName"
value="Configuration.Current"/>
<ui:define name="content">
+ <script type="text/javascript">
+ function cursor_wait() {
+ document.body.style.cursor = 'wait';
+ }
+
+ function cursor_clear() {
+ document.body.style.cursor = 'default';
+ }
+ </script>
<h:form id="editResourceConfigurationForm"
onsubmit="prepareInputsForSubmission(this)"
@@ -38,29 +47,34 @@ THIS TEXT WILL BE REMOVED.
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<rich:panel style="width:100%">
<f:facet name="header">Files</f:facet>
+
<rich:panelMenu mode="ajax"
expandMode="client"
iconCollapsedGroup="disc"
limitToList="true"
reRender="fileContents">
- <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
- <c:forEach
items="#{ExistingResourceConfigurationUIBean.configuration.rawConfigurations}"
- var="rawConfig">
- <rich:panelMenuItem label="#{rawConfig.path}"
-
action="#{ExistingResourceConfigurationUIBean.select(rawConfig.path)}"
- styleClass="raw-menu-item"
- tableBorderColor="blue"
-
reRender="fileContents,selectedFileHeader"/>
- </c:forEach>
- </rich:panelMenuGroup>
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
</rich:panelMenu>
</rich:panel>
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
<a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
<h:commandLink value="View Full Screen"/>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
@@ -143,6 +157,31 @@ THIS TEXT WILL BE REMOVED.
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<rich:panel style="width:100%">
<f:facet name="header">Files</f:facet>
+
+
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
+
+
+ <ui:remove>
<rich:panelMenu mode="ajax"
expandMode="client"
iconCollapsedGroup="disc"
@@ -159,6 +198,7 @@ THIS TEXT WILL BE REMOVED.
</c:forEach>
</rich:panelMenuGroup>
</rich:panelMenu>
+ </ui:remove>
</rich:panel>
<h:panelGrid columns="1" style="width:100%;">
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 64ea957..b9d13b9 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -28,8 +28,6 @@ THIS TEXT WILL BE REMOVED.
<ui:define name="content">
<script type="text/javascript">
- var curentFile =
-
function cursor_wait() {
document.body.style.cursor = 'wait';
}
@@ -48,13 +46,6 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
<c:choose>
<c:when
test="${ExistingResourceConfigurationViewUIBean.rawSupported}">
- <script>
- window.onbeforeunload = confirmExit;
-
- function confirmExit() {
- }
- </script>
-
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -75,19 +66,25 @@ THIS TEXT WILL BE REMOVED.
<rich:panel style="width:100%">
<f:facet name="header">Files</f:facet>
<rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="disc"
- limitToList="true"
- reRender="fileContents">
- <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
- <c:forEach
items="#{ExistingResourceConfigurationViewUIBean.configuration.rawConfigurations}"
- var="rawConfig">
- <rich:panelMenuItem label="#{rawConfig.path}"
-
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
-
reRender="fileContents,selectedFileHeader"/>
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
</c:forEach>
- </rich:panelMenuGroup>
- </rich:panelMenu>
+ </rich:panelMenu>
</rich:panel>
<h:panelGrid columns="1" style="width:100%;">
@@ -209,17 +206,6 @@ THIS TEXT WILL BE REMOVED.
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
- <ui:remove>
- <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true" selectedChild="#{currentPath}">
- <c:forEach
items="#{ExistingResourceConfigurationViewUIBean.configuration.rawConfigurations}"
- var="rawConfig">
- <rich:panelMenuItem id="raw_#{rawConfig.sha256}"
- label="#{rawConfig.path}"
-
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
-
reRender="fileContents,selectedFileHeader"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </ui:remove>
</rich:panelMenu>
</rich:panel>
commit 10a71f8118aa9cce36351a96dd423966cda88723
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 21:12:34 2010 -0500
Add javascript to change cursor to a wait cursor when changing tabs or when selecting
a new file
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 25b4693..64ea957 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -27,6 +27,18 @@ THIS TEXT WILL BE REMOVED.
<ui:param name="selectedTabName"
value="Configuration.Current"/>
<ui:define name="content">
+ <script type="text/javascript">
+ var curentFile =
+
+ function cursor_wait() {
+ document.body.style.cursor = 'wait';
+ }
+
+ function cursor_clear() {
+ document.body.style.cursor = 'default';
+ }
+ </script>
+
<h:panelGroup layout="block" styleClass="InfoBlock"
rendered="#{ExistingResourceConfigurationViewUIBean.updateInProgress}">
<b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
@@ -133,7 +145,7 @@ THIS TEXT WILL BE REMOVED.
<h:outputText value="#{ResourceUIBean.name}"/>
</h:panelGrid>
<rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
- <rich:tab label="Basic Mode">
+ <rich:tab label="Basic Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:outputText value="
#{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -157,7 +169,7 @@ THIS TEXT WILL BE REMOVED.
prevalidate="true"/>
</rich:tab>
- <rich:tab label="Advanced Mode">
+ <rich:tab label="Advanced Mode"
onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -190,6 +202,8 @@ THIS TEXT WILL BE REMOVED.
selectedChild="#{currentPath}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
<rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
reRender="fileContents,selectFileHeader"/>
</c:forEach>
commit f76599305b5e8ac96fcdd3f23a3ddbcb40527119
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 17:00:28 2010 -0500
Deleting unused file that was accidentally included in a previous commit
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectoryListing.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectoryListing.java
deleted file mode 100644
index 89b2236..0000000
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectoryListing.java
+++ /dev/null
@@ -1,42 +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.enterprise.gui.configuration.resource;
-
-import org.rhq.core.domain.configuration.RawConfiguration;
-
-import java.util.List;
-
-public class RawConfigDirectoryListing {
-
-// private List<>
-
- public void addRawConfiguration(RawConfiguration rawConfig) {
-
- }
-
-// private
-//
-// private List<RawConfiguration> get
-
-}
commit f6924d42284e00d9c3e4a6b59bb0d94e20d6fb54
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 16:57:16 2010 -0500
Adding logic to group files by directory in the file menu
Right now this logic is only in place on the view page. Initial commit for
RawConfigDirectory which is just
a container for raw config files to group them by directory. This is the initial
commit for
RawConfigUIBean as well which provides properties used in the view, like displaying
the short name
of the config file for instance.
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 6576c05..027ce1d 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
@@ -23,19 +23,22 @@ import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import java.util.TreeMap;
import javax.faces.application.FacesMessage;
-import javax.faces.component.html.HtmlPanelGroup;
import javax.faces.event.ValueChangeEvent;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jetbrains.annotations.Nullable;
import org.richfaces.event.UploadEvent;
@@ -69,23 +72,48 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
private boolean mode = STRUCTURED_MODE;
- // =========== actions ===========
+ @Out
+ private Collection<RawConfigDirectory> rawConfigDirectories;
public ExistingResourceConfigurationUIBean() {
removeSessionScopedBeanIfInView("/rhq/resource/configuration/view.xhtml",
ExistingResourceConfigurationUIBean.class);
}
- public String editConfiguration() {
- return SUCCESS_OUTCOME;
+ @Create
+ public void begin() {
+ initConfigDirectories();
}
- public String editRawConfiguration() {
- mode = RAW_MODE;
+ private void initConfigDirectories() {
+ Map<String, RawConfigDirectory> dirs = new HashMap<String,
RawConfigDirectory>();
+
+ for (RawConfiguration rawConfig : getConfiguration().getRawConfigurations()) {
+ String parentDirPath = getParentDir(rawConfig);
+ RawConfigDirectory dir = dirs.get(parentDirPath);
+
+ if (dir == null) {
+ dir = new RawConfigDirectory();
+ dir.setPath(parentDirPath);
+ }
+
+ dir.addRawConfig(rawConfig);
+ dirs.put(parentDirPath, dir);
+ }
+
+ rawConfigDirectories = dirs.values();
+ }
+
+ private String getParentDir(RawConfiguration rawConfig) {
+ File file = new File(rawConfig.getPath());
+ return file.getParentFile().getAbsolutePath();
+ }
+
+ public String editConfiguration() {
return SUCCESS_OUTCOME;
}
- public String editRaw() {
+ public String editRawConfiguration() {
mode = RAW_MODE;
return SUCCESS_OUTCOME;
}
@@ -95,23 +123,44 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
switchToRaw();
}
else if (event.getNewValue().equals("Basic Mode")) {
- switchTostructured();
+ switchToStructured();
}
}
public String switchToRaw() {
-// ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
-// int resourceId = EnterpriseFacesContextUtility.getResource().getId();
-// Configuration configuration =
-//
configurationManager.translateResourceConfiguration(EnterpriseFacesContextUtility.getSubject(),
-// resourceId, getConfiguration(), true);
-//
-// setConfiguration(configuration);
-//
-// mode = RAW_MODE;
-//
-// return null;
- return switchToraw();
+ Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
+ EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), true);
+
+ setConfiguration(configuration);
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ getRaws().put(raw.getPath(), raw);
+ }
+ current = null;
+ setConfiguration(configuration);
+
+ mode = RAW_MODE;
+ return null;
+ }
+
+ public String switchToStructured() {
+ Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
+ EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), false);
+
+ for (Property property : configuration.getAllProperties().values()) {
+ property.setConfiguration(configuration);
+ }
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ getRaws().put(raw.getPath(), raw);
+ setConfiguration(configuration);
+ }
+ current = null;
+ setConfiguration(configuration);
+
+ mode = STRUCTURED_MODE;
+
+ return null;
}
public String updateConfiguration() {
@@ -256,27 +305,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return getConfiguration().getId();
}
- /*
- public Configuration getConfiguration() {
- if (null == configuration) {
-
- Subject subject = EnterpriseFacesContextUtility.getSubject();
- int resourceId = EnterpriseFacesContextUtility.getResource().getId();
- AbstractResourceConfigurationUpdate configurationUpdate =
LookupUtil.getConfigurationManager()
- .getLatestResourceConfigurationUpdate(subject, resourceId);
- Configuration configuration = (configurationUpdate != null) ?
configurationUpdate.getConfiguration() : null;
- if (configuration != null) {
- //ConfigurationMaskingUtility.maskConfiguration(configuration,
getConfigurationDefinition());
- }
-
- return configuration;
-
- }
- return configuration;
-
- }
- */
-
private ConfigurationFormat getConfigurationFormat() {
return getConfigurationDefinition().getConfigurationFormat();
}
@@ -296,9 +324,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String getCurrentContents() {
- String currentContents = new String(getCurrent().getContents());
- return currentContents;
-// return new String(getCurrent().getContents());
+ return new String(getCurrent().getContents());
}
public String getCurrentPath() {
@@ -329,17 +355,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return resourceId;
}
- /**
- * Hack Alert. This bean needs to be initialized on one of the pages that has id or
resourceId set
- * In order to capture the resource. It will then Keep track of that particular
resources until
- * commit is called. Ideally, this should be a conversation scoped bean, but that
has other issues
- *
- */
- @Create
- public void init() {
-
- }
-
public boolean isStructuredMode() {
return mode == STRUCTURED_MODE;
}
@@ -441,57 +456,12 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return "/rhq/resource/configuration/edit-raw.xhtml?currentResourceId="
+ getResourceId();
}
- public String switchToraw() {
- log.error("switch2raw called");
- dumpProperties(getConfiguration(), log);
- Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
- EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), true);
- log.error("switch2raw post merge");
- dumpProperties(getConfiguration(), log);
-
- setConfiguration(configuration);
- for (RawConfiguration raw : configuration.getRawConfigurations()) {
- getRaws().put(raw.getPath(), raw);
- }
- current = null;
- setConfiguration(configuration);
-
- mode = RAW_MODE;
- return null;
- }
-
void dumpProperties(Configuration conf, Log log) {
for (String key : conf.getAllProperties().keySet()) {
log.error("property=" + conf.getAllProperties().get(key));
}
}
- public String switchTostructured() {
- log.error("switch2structured called");
-
- dumpProperties(getConfiguration(), log);
- Configuration configuration =
LookupUtil.getConfigurationManager().translateResourceConfiguration(
- EnterpriseFacesContextUtility.getSubject(), getResourceId(),
getMergedConfiguration(), false);
- log.error("switch2structured post merge");
-
- dumpProperties(configuration, log);
-
- for (Property property : configuration.getAllProperties().values()) {
- property.setConfiguration(configuration);
- }
-
- for (RawConfiguration raw : configuration.getRawConfigurations()) {
- getRaws().put(raw.getPath(), raw);
- setConfiguration(configuration);
- }
- current = null;
- setConfiguration(configuration);
-
- mode = STRUCTURED_MODE;
-
- return null;
- }
-
void populateRaws() {
Collection<RawConfiguration> rawConfigurations =
getConfiguration().getRawConfigurations();
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java
new file mode 100644
index 0000000..fe346dd
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java
@@ -0,0 +1,55 @@
+/*
+ * 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.enterprise.gui.configuration.resource;
+
+import org.rhq.core.domain.configuration.RawConfiguration;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class RawConfigDirectory {
+
+ private String path;
+
+ private List<RawConfigUIBean> rawConfigUIBeans = new
ArrayList<RawConfigUIBean>();
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public List<RawConfigUIBean> getRawConfigUIBeans() {
+ return rawConfigUIBeans;
+ }
+
+ public void addRawConfig(RawConfiguration rawConfig) {
+ RawConfigUIBean bean = new RawConfigUIBean();
+ bean.setRawConfiguration(rawConfig);
+ rawConfigUIBeans.add(bean);
+ }
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectoryListing.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectoryListing.java
new file mode 100644
index 0000000..89b2236
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectoryListing.java
@@ -0,0 +1,42 @@
+/*
+ * 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.enterprise.gui.configuration.resource;
+
+import org.rhq.core.domain.configuration.RawConfiguration;
+
+import java.util.List;
+
+public class RawConfigDirectoryListing {
+
+// private List<>
+
+ public void addRawConfiguration(RawConfiguration rawConfig) {
+
+ }
+
+// private
+//
+// private List<RawConfiguration> get
+
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
new file mode 100644
index 0000000..21b7d41
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -0,0 +1,60 @@
+/*
+ * 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.enterprise.gui.configuration.resource;
+
+import org.rhq.core.domain.configuration.RawConfiguration;
+
+import java.io.File;
+
+public class RawConfigUIBean {
+
+ private RawConfiguration rawConfiguration;
+
+ private boolean modified;
+
+ public RawConfiguration getRawConfiguration() {
+ return rawConfiguration;
+ }
+
+ public void setRawConfiguration(RawConfiguration rawConfiguration) {
+ this.rawConfiguration = rawConfiguration;
+ }
+
+ public boolean isModified() {
+ return modified;
+ }
+
+ public void setModified(boolean modified) {
+ this.modified = modified;
+ }
+
+ public String getPath() {
+ return rawConfiguration.getPath();
+ }
+
+ public String getFileName() {
+ File file = new File(rawConfiguration.getPath());
+ return file.getName();
+ }
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
index 0357e87..39270b7 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
@@ -45,7 +45,7 @@
</navigation-case>
<!--<navigation-case>-->
-
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.switchTostructured}</from-action>-->
+
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.switchToStructured}</from-action>-->
<!--<to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>-->
<!--<redirect/>-->
<!--</navigation-case>-->
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index ca24152..02ef0c1 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -46,12 +46,11 @@ THIS TEXT WILL BE REMOVED.
<rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
<c:forEach
items="#{ExistingResourceConfigurationUIBean.configuration.rawConfigurations}"
var="rawConfig">
- <rich:panelMenuItem
action="#{ExistingResourceConfigurationUIBean.select(rawConfig.path)}"
+ <rich:panelMenuItem label="#{rawConfig.path}"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfig.path)}"
styleClass="raw-menu-item"
tableBorderColor="blue"
-
reRender="fileContents,selectedFileHeader">
- #{rawConfig.path}
- </rich:panelMenuItem>
+
reRender="fileContents,selectedFileHeader"/>
</c:forEach>
</rich:panelMenuGroup>
</rich:panelMenu>
@@ -156,9 +155,7 @@ THIS TEXT WILL BE REMOVED.
action="#{ExistingResourceConfigurationUIBean.select(rawConfig.path)}"
styleClass="raw-menu-item"
tableBorderColor="blue"
-
reRender="fileContents,selectedFileHeader">
- <f:param name="current"
value="#{rawConfig.path}"/>
- </rich:panelMenuItem>
+
reRender="fileContents,selectedFileHeader"/>
</c:forEach>
</rich:panelMenuGroup>
</rich:panelMenu>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index adbe47e..25b4693 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -72,9 +72,7 @@ THIS TEXT WILL BE REMOVED.
var="rawConfig">
<rich:panelMenuItem label="#{rawConfig.path}"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
-
reRender="fileContents,selectedFileHeader">
- <f:param name="current"
value="#{rawConfig.path}"/>
- </rich:panelMenuItem>
+
reRender="fileContents,selectedFileHeader"/>
</c:forEach>
</rich:panelMenuGroup>
</rich:panelMenu>
@@ -103,55 +101,6 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
-
- <ui:remove>
- <table class="summary-props-table" style="">
- <tr>
- <td bgcolor="#a4b2b9" width="25%"
valign="top">Files
- <h:panelGroup id="changedFiles"
layout="vertical">
- <h:form>
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
- <ui:repeat
value="#{ExistingResourceConfigurationViewUIBean.paths}"
var="path">
- <div>
- <h:commandLink
-
action="#{ExistingResourceConfigurationViewUIBean.select(path)}"
- value="#{path}"
- rendered="#{path !=
ExistingResourceConfigurationViewUIBean.current.path}">
- <f:param name="currentPath"
value="#{path}"/>
- </h:commandLink>
- <h:outputText value="#{path}"
- rendered="#{path ==
ExistingResourceConfigurationViewUIBean.current.path}"/>
- </div>
- </ui:repeat>
- </h:form>
- </h:panelGroup>
- <div>______________________________________</div>
- <div>* File contains uncommitted changes.</div>
- </td>
- <td>
- <div>
- Current File:
- <h:outputText
value="#{ExistingResourceConfigurationViewUIBean.current.path}"
- styleClass="outhello"/>
- </div>
- <h:outputLink value="view-raw-full.xhtml"
action="navigateToUpload">
- <img src="/images/viewfullscreen.png"/>
- <h:outputText value=" Full Screen "/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </h:outputLink>
- <s:link
action="#{ExistingResourceConfigurationViewUIBean.download}">
- <img src="/images/download.png"/>
- <h:outputText value=" Download "/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </s:link>
- <div>
- <pre><h:outputText
-
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"/></pre>
- </div>
- </td>
- </tr>
- </table>
- </ui:remove>
</c:when>
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
<h:outputText value=" #{messages.nopermissionedit}"
@@ -234,17 +183,29 @@ THIS TEXT WILL BE REMOVED.
iconCollapsedGroup="disc"
limitToList="true"
reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}"
var="rawConfigUIBean">
+ <rich:panelMenuItem
label="#{rawConfigUIBean.fileName}"
+
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+
reRender="fileContents,selectFileHeader"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ <ui:remove>
<rich:panelMenuGroup label="/tmp/raw-config"
expanded="true" selectedChild="#{currentPath}">
<c:forEach
items="#{ExistingResourceConfigurationViewUIBean.configuration.rawConfigurations}"
var="rawConfig">
<rich:panelMenuItem id="raw_#{rawConfig.sha256}"
label="#{rawConfig.path}"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
-
reRender="fileContents,selectedFileHeader">
- <f:param name="current"
value="#{rawConfig.path}"/>
- </rich:panelMenuItem>
+
reRender="fileContents,selectedFileHeader"/>
</c:forEach>
</rich:panelMenuGroup>
+ </ui:remove>
</rich:panelMenu>
</rich:panel>
commit d089f1c82ea348f8986d75c8d45599ba34121510
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 14:19:43 2010 -0500
Adding tabs to switch between structured and raw on edit.xhtml.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 2e4a3c1..ca24152 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -111,17 +111,12 @@ THIS TEXT WILL BE REMOVED.
</c:when>
<c:when
test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
- <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.structuredMode}">
- <h:outputText value="#{messages.youareviewingstructured}"/>
-
- <h:panelGroup>
- <h:outputText value=" #{messages.switch2}"/>
- <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchToRaw}">
- <h:outputText value=" files mode"/>
- </h:commandLink>
- </h:panelGroup>
-
- <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
+ <h:panelGrid columns="2">
+ <h:outputText value="#{ResourceUIBean.name}"/>
+ </h:panelGrid>
+ <rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
+ <rich:tab label="Basic Mode">
+ <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
@@ -142,18 +137,9 @@ THIS TEXT WILL BE REMOVED.
title="Click to Reset Fields"
styleClass="buttonmed"/>
</h:panelGrid>
- </h:panelGroup>
- <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.rawMode}">
- <h:outputText value="#{messages.youareviewingraw}"/>
-
- <h:panelGroup>
- <h:outputText value=" #{messages.switch2}"/>
- <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchTostructured}">
- <h:outputText value=" #{messages.structured}"/>
- </h:commandLink>
- </h:panelGroup>
-
- <h:panelGrid columns="2"
+ </rich:tab>
+ <rich:tab label="Advanced Mode">
+ <h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<rich:panel style="width:100%">
@@ -212,7 +198,8 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</h:panelGrid>
</h:panelGrid>
- </h:panelGroup>
+ </rich:tab>
+ </rich:tabPanel>
</c:when>
</c:choose>
commit 55407222bc09c9d577d14465d09ec0f09da237e3
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 14:00:55 2010 -0500
Adding tabs to switch back and forth between structured and raw on view.xhtml
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 dbdc167..6576c05 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
@@ -28,6 +28,7 @@ import java.util.TreeMap;
import javax.faces.application.FacesMessage;
import javax.faces.component.html.HtmlPanelGroup;
+import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -89,6 +90,15 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return SUCCESS_OUTCOME;
}
+ public void changeTabs(ValueChangeEvent event) {
+ if (event.getNewValue().equals("Advanced Mode")) {
+ switchToRaw();
+ }
+ else if (event.getNewValue().equals("Basic Mode")) {
+ switchTostructured();
+ }
+ }
+
public String switchToRaw() {
// ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
// int resourceId = EnterpriseFacesContextUtility.getResource().getId();
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index d92e747..adbe47e 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -180,49 +180,36 @@ THIS TEXT WILL BE REMOVED.
</c:when>
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
- <h:panelGroup id="structuredGroup"
rendered="#{ExistingResourceConfigurationViewUIBean.structuredMode}">
- <h:outputText value="#{messages.youareviewingstructured}"/>
- <h:panelGroup>
- <h:outputText value=" #{messages.switch2}"/>
- <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.switchToRaw}">
- <h:outputText value=" files mode"/>
- </h:commandLink>
- </h:panelGroup>
-
- <h:outputText value=" #{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton id="editStructuredButton"
- value="Edit"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
- title="Edit this Configuration"
styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <onc:config
-
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
-
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
- readOnly="true"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
-
- </h:panelGroup>
- <h:panelGroup id="rawGroup"
rendered="#{ExistingResourceConfigurationViewUIBean.rawMode}">
- <h:outputText value="#{messages.youareviewingraw}"/>
-
- <h:panelGroup>
- <h:outputText value=" #{messages.switch2}"/>
- <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.switchTostructured}">
- <h:outputText value=" #{messages.structured}"/>
- </h:commandLink>
- </h:panelGroup>
-
- <h:outputText value=" #{messages.nopermissionedit}"
+ <h:panelGrid columns="2">
+ <h:outputText value="#{ResourceUIBean.name}"/>
+ </h:panelGrid>
+ <rich:tabPanel switchType="ajax"
valueChangeListener="changeTabs">
+ <rich:tab label="Basic Mode">
+ <h:outputText value="
#{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2"
styleClass="buttons-table" columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton id="editStructuredButton"
+ value="Edit"
+
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+ title="Edit this Configuration"
styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGrid>
+
+ <onc:config
+
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
+
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ readOnly="true"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ </rich:tab>
+ <rich:tab label="Advanced Mode">
+ <h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
<h:panelGrid columns="2"
@@ -284,7 +271,8 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
- </h:panelGroup>
+ </rich:tab>
+ </rich:tabPanel>
</c:when>
</c:choose>
</h:form>
commit 5ed1d23e977a743d237216c6db7535cda65a3293
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Jan 12 13:20:45 2010 -0500
Seam-ifying backing bean in order to work around request scope issue with JSF
On view.xhtml, when the user clicks the links to change back and forth between
structured
and raw, it results in a postback with an action method invoked to perform the
translation.
A problem I encountered was that once the view rendered after the postback the backing
bean
which was in request scope was no longer available to the view. Consequetly, clicking
any
commandLink or commandButton did not invoke any of the specified actions. Making the
backing
bean a Seam component with page scope resolved this issue.
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 555bf43..dbdc167 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
@@ -27,11 +27,15 @@ import java.util.Iterator;
import java.util.TreeMap;
import javax.faces.application.FacesMessage;
+import javax.faces.component.html.HtmlPanelGroup;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
import org.jetbrains.annotations.Nullable;
import org.richfaces.event.UploadEvent;
@@ -54,8 +58,8 @@ import org.rhq.enterprise.server.util.LookupUtil;
/**
* @author Ian Springer
*/
-//@ Name(value = "ExistingResourceConfigurationUIBean")
-//@ Scope(ScopeType.PAGE)
+@Name(value = "ExistingResourceConfigurationViewUIBean")
+(a)Scope(ScopeType.PAGE)
public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUIBean {
public static final String MANAGED_BEAN_NAME =
"ExistingResourceConfigurationUIBean";
@@ -76,6 +80,12 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String editRawConfiguration() {
+ mode = RAW_MODE;
+ return SUCCESS_OUTCOME;
+ }
+
+ public String editRaw() {
+ mode = RAW_MODE;
return SUCCESS_OUTCOME;
}
@@ -143,8 +153,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
return SUCCESS_OUTCOME;
}
- // =========== impls of superclass abstract methods ===========
-
protected int getConfigurationDefinitionKey() {
return EnterpriseFacesContextUtility.getResource().getResourceType().getId();
}
@@ -440,7 +448,6 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
mode = RAW_MODE;
return null;
-// return SUCCESS_OUTCOME;
}
void dumpProperties(Configuration conf, Log log) {
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
index 70d3f99..d2cd3f7 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/configuration-beans.xml
@@ -5,11 +5,11 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<!-- /rhq/resource/configuration/view.xhtml,
/rhq/resource/configuration/view-map.xhtml -->
- <managed-bean>
-
<managed-bean-name>ExistingResourceConfigurationViewUIBean</managed-bean-name>
-
<managed-bean-class>org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+ <!--<managed-bean>-->
+
<!--<managed-bean-name>ExistingResourceConfigurationViewUIBean</managed-bean-name>-->
+
<!--<managed-bean-class>org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean</managed-bean-class>-->
+ <!--<managed-bean-scope>request</managed-bean-scope>-->
+ <!--</managed-bean> -->
<!-- /rhq/resource/configuration/history.xhtml,
/rhq/resource/configuration/edit.xhtml, and
/rhq/resource/configuration/edit-map.xhtml -->
<managed-bean>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
index bc26600..0357e87 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
@@ -4,20 +4,27 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
- <navigation-rule>
- <from-view-id>/rhq/resource/configuration/view.xhtml</from-view-id>
-
- <navigation-case>
-
<from-action>#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}</from-action>
- <from-outcome>success</from-outcome>
- <to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>
- </navigation-case>
-
- <navigation-case>
-
<from-action>#{ExistingResourceConfigurationUIBean.switchToraw}</from-action>
- <to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
+ <!--<navigation-rule>-->
+
<!--<from-view-id>/rhq/resource/configuration/view.xhtml</from-view-id>-->
+
+ <!--<navigation-case>-->
+
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}</from-action>-->
+ <!--<from-outcome>success</from-outcome>-->
+
<!--<to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>-->
+ <!--</navigation-case>-->
+
+ <!--<navigation-case>-->
+
<!--<from-action>#{ExistingResourceConfigurationUIBean.switchToraw}</from-action>-->
+
<!--<to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>-->
+ <!--</navigation-case>-->
+ <!--</navigation-rule>-->
+
+ <!--<navigation-rule>-->
+ <!--<navigation-case>-->
+
<!--<from-action>#{ExistingResourceConfigurationUIBean.editRawConfiguration}</from-action>-->
+
<!--<to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>-->
+ <!--</navigation-case>-->
+ <!--</navigation-rule>-->
<navigation-rule>
<navigation-case>
@@ -26,30 +33,28 @@
<redirect/>
</navigation-case>
- <!--
<navigation-case>
<from-action>#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}</from-action>
<to-view-id>/rhq/resource/configuration/edit.xhtml?id=#{param.id}</to-view-id>
<redirect/>
</navigation-case>
- -->
-
+
<navigation-case>
<from-action>#{ConfigHelperUIBean.accessMap}</from-action>
<to-view-id>/rhq/resource/configuration/view-map.xhtml</to-view-id>
</navigation-case>
- <navigation-case>
-
<from-action>#{ExistingResourceConfigurationUIBean.switchTostructured}</from-action>
-
<to-view-id>/rhq/resource/configuration/edit.xhtml?id=#{param.id}</to-view-id>
- <redirect/>
- </navigation-case>
-
- <navigation-case>
-
<from-action>#{ExistingResourceConfigurationUIBean.switchToraw}</from-action>
- <to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>
+ <!--<navigation-case>-->
+
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.switchTostructured}</from-action>-->
+
<!--<to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>-->
<!--<redirect/>-->
- </navigation-case>
+ <!--</navigation-case>-->
+
+ <!--<navigation-case>-->
+
<!--<from-action>#{ExistingResourceConfigurationViewUIBean.switchToRaw}</from-action>-->
+
<!--<to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>-->
+ <!--<!–<redirect/>–>-->
+ <!--</navigation-case>-->
</navigation-rule>
@@ -170,8 +175,7 @@
<navigation-case>
<from-action>#{ConfigHelperUIBean.accessMap}</from-action>
<to-view-id>/rhq/resource/configuration/history-view-map.xhtml</to-view-id>
- </navigation-case>
-
+ </navigation-case>
</navigation-rule>
</faces-config>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 8af5b00..2e4a3c1 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -59,7 +59,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
- <h:outputText id="selectedFileHeader"
value="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
<h:commandLink value="View Full Screen"/>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
@@ -178,7 +180,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
- <h:outputText id="selectedFileHeader"
value="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
<h:commandLink value="View Full Screen"/>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 4154521..d92e747 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -28,24 +28,23 @@ THIS TEXT WILL BE REMOVED.
<ui:define name="content">
<h:panelGroup layout="block" styleClass="InfoBlock"
-
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
+
rendered="#{ExistingResourceConfigurationViewUIBean.updateInProgress}">
<b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
</h:panelGroup>
- <c:choose>
- <c:when
test="${ExistingResourceConfigurationViewUIBean.rawSupported}">
- <script>
- window.onbeforeunload = confirmExit;
+ <h:form id="viewResourceConfigurationForm">
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <c:choose>
+ <c:when
test="${ExistingResourceConfigurationViewUIBean.rawSupported}">
+ <script>
+ window.onbeforeunload = confirmExit;
- function confirmExit() {
- }
- </script>
+ function confirmExit() {
+ }
+ </script>
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:form id="viewResourceConfigurationFormRaw">
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <h:outputText value=" #{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
<h:panelGrid columns="2"
styleClass="buttons-table"
@@ -55,12 +54,8 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="#{messages.editraw}"
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
- </h:form>
-
- <h:form>
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
<h:panelGrid columns="2"
styleClass="raw-outer-table"
@@ -88,8 +83,8 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
<a4j:status id="selectedFileHeader"
- startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
-
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
<h:commandLink value="View Full Screen"/>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
@@ -108,63 +103,59 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
- </h:form>
-
- <ui:remove>
- <table class="summary-props-table" style="">
- <tr>
- <td bgcolor="#a4b2b9" width="25%"
valign="top">Files
- <h:panelGroup id="changedFiles"
layout="vertical">
- <h:form>
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
- <ui:repeat
value="#{ExistingResourceConfigurationViewUIBean.paths}"
var="path">
- <div>
- <h:commandLink
-
action="#{ExistingResourceConfigurationViewUIBean.select(path)}"
- value="#{path}"
- rendered="#{path !=
ExistingResourceConfigurationViewUIBean.current.path}">
- <f:param name="currentPath"
value="#{path}"/>
- </h:commandLink>
- <h:outputText value="#{path}"
- rendered="#{path ==
ExistingResourceConfigurationViewUIBean.current.path}"/>
- </div>
- </ui:repeat>
- </h:form>
- </h:panelGroup>
- <div>______________________________________</div>
- <div>* File contains uncommitted changes.</div>
- </td>
- <td>
- <div>
- Current File:
- <h:outputText
value="#{ExistingResourceConfigurationViewUIBean.current.path}"
- styleClass="outhello"/>
- </div>
- <h:outputLink value="view-raw-full.xhtml"
action="navigateToUpload">
- <img src="/images/viewfullscreen.png"/>
- <h:outputText value=" Full Screen "/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </h:outputLink>
- <s:link
action="#{ExistingResourceConfigurationViewUIBean.download}">
- <img src="/images/download.png"/>
- <h:outputText value=" Download "/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </s:link>
- <div>
+
+ <ui:remove>
+ <table class="summary-props-table" style="">
+ <tr>
+ <td bgcolor="#a4b2b9" width="25%"
valign="top">Files
+ <h:panelGroup id="changedFiles"
layout="vertical">
+ <h:form>
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <ui:repeat
value="#{ExistingResourceConfigurationViewUIBean.paths}"
var="path">
+ <div>
+ <h:commandLink
+
action="#{ExistingResourceConfigurationViewUIBean.select(path)}"
+ value="#{path}"
+ rendered="#{path !=
ExistingResourceConfigurationViewUIBean.current.path}">
+ <f:param name="currentPath"
value="#{path}"/>
+ </h:commandLink>
+ <h:outputText value="#{path}"
+ rendered="#{path ==
ExistingResourceConfigurationViewUIBean.current.path}"/>
+ </div>
+ </ui:repeat>
+ </h:form>
+ </h:panelGroup>
+ <div>______________________________________</div>
+ <div>* File contains uncommitted changes.</div>
+ </td>
+ <td>
+ <div>
+ Current File:
+ <h:outputText
value="#{ExistingResourceConfigurationViewUIBean.current.path}"
+ styleClass="outhello"/>
+ </div>
+ <h:outputLink value="view-raw-full.xhtml"
action="navigateToUpload">
+ <img src="/images/viewfullscreen.png"/>
+ <h:outputText value=" Full Screen "/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:outputLink>
+ <s:link
action="#{ExistingResourceConfigurationViewUIBean.download}">
+ <img src="/images/download.png"/>
+ <h:outputText value=" Download "/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </s:link>
+ <div>
<pre><h:outputText
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"/></pre>
- </div>
- </td>
- </tr>
- </table>
- </ui:remove>
- </c:when>
- <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
- <h:form id="viewResourceConfigurationFormStructured">
- <!-- TODO remove the id version -->
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </ui:remove>
+ </c:when>
+ <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
+ <h:outputText value=" #{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
<h:panelGrid columns="2"
styleClass="buttons-table"
@@ -187,13 +178,9 @@ THIS TEXT WILL BE REMOVED.
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
prevalidate="true"/>
- </h:form>
- </c:when>
- <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
- <h:form id="viewResourceConfigurationFormStructuredAndRaw">
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
-
- <h:panelGroup
rendered="#{ExistingResourceConfigurationViewUIBean.structuredMode}">
+ </c:when>
+ <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
+ <h:panelGroup id="structuredGroup"
rendered="#{ExistingResourceConfigurationViewUIBean.structuredMode}">
<h:outputText value="#{messages.youareviewingstructured}"/>
<h:panelGroup>
<h:outputText value=" #{messages.switch2}"/>
@@ -208,10 +195,11 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
- <h:commandButton value="Edit"
+ <h:commandButton id="editStructuredButton"
+ value="Edit"
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
title="Edit this Configuration"
styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
<onc:config
@@ -224,12 +212,12 @@ THIS TEXT WILL BE REMOVED.
prevalidate="true"/>
</h:panelGroup>
- <h:panelGroup
rendered="#{ExistingResourceConfigurationViewUIBean.rawMode}">
+ <h:panelGroup id="rawGroup"
rendered="#{ExistingResourceConfigurationViewUIBean.rawMode}">
<h:outputText value="#{messages.youareviewingraw}"/>
<h:panelGroup>
<h:outputText value=" #{messages.switch2}"/>
- <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchTostructured}">
+ <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.switchTostructured}">
<h:outputText value=" #{messages.structured}"/>
</h:commandLink>
</h:panelGroup>
@@ -242,10 +230,11 @@ THIS TEXT WILL BE REMOVED.
columnClasses="button-cell"
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
- <h:commandButton value="Edit"
+ <h:commandButton id="editRawButton"
+ value="Edit"
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
<h:panelGrid columns="2"
@@ -295,12 +284,10 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
-
-
</h:panelGroup>
- </h:form>
- </c:when>
- </c:choose>
+ </c:when>
+ </c:choose>
+ </h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
rendered="#{ExistingResourceConfigurationViewUIBean.updateInProgress}">
commit 827523e2a0afc078733b98222cf772cdce8eb94b
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 11 09:38:51 2010 -0500
Adding status msg to show which file is loading.
Also making an initial attempt to tell the panelMenu component which item is selected.
It is
not working as of this commit. The documentation on this is not very clear so I am
uncertain as to whether or not I am specifying the selected menu item incorrectly.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 4eaae7b..4154521 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -87,7 +87,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
- <h:outputText id="selectedFileHeader"
value="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
<h:commandLink value="View Full Screen"/>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
@@ -256,10 +258,11 @@ THIS TEXT WILL BE REMOVED.
iconCollapsedGroup="disc"
limitToList="true"
reRender="fileContents">
- <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
+ <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true" selectedChild="#{currentPath}">
<c:forEach
items="#{ExistingResourceConfigurationViewUIBean.configuration.rawConfigurations}"
var="rawConfig">
- <rich:panelMenuItem label="#{rawConfig.path}"
+ <rich:panelMenuItem id="raw_#{rawConfig.sha256}"
+ label="#{rawConfig.path}"
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
reRender="fileContents,selectedFileHeader">
<f:param name="current"
value="#{rawConfig.path}"/>
@@ -271,8 +274,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
- <h:outputText id="selectedFileHeader"
-
value="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <a4j:status id="selectedFileHeader"
+ startText="Loading
#{ExistingResourceConfigurationViewUIBean.current.path} ..."
+
stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
<h:commandLink value="View Full Screen"/>
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
commit 3d3ce3cadc44a5f10e87684f4803e5d1d20863df
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 11 09:08:32 2010 -0500
Updating controls so that there is only a single 'Edit' button
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index f7f6f7d..4eaae7b 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -206,14 +206,10 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
- <h:commandButton value="#{messages.editstructured}"
+ <h:commandButton value="Edit"
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
title="Edit this Configuration"
styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- <h:commandButton value="#{messages.editraw}"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
</h:panelGrid>
<onc:config
@@ -244,7 +240,7 @@ THIS TEXT WILL BE REMOVED.
columnClasses="button-cell"
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
- <h:commandButton value="#{messages.editraw}"
+ <h:commandButton value="Edit"
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationUIBean.updateInProgress}"/>
commit 159b6e8a62a92c83a165eda57050ee819660fbff
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 11 09:00:11 2010 -0500
Adding support to switch between structured and raw in view mode
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 56afa23..f7f6f7d 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -158,7 +158,6 @@ THIS TEXT WILL BE REMOVED.
</ui:remove>
</c:when>
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
- <h:outputText value="#{messages.youareviewingstructured}"/>
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
<h:form id="viewResourceConfigurationFormStructured">
@@ -189,42 +188,116 @@ THIS TEXT WILL BE REMOVED.
</h:form>
</c:when>
<c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
- <h:outputText value="#{messages.youareviewingstructured}"/>
- <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.rawSupported}">
- <h:outputText value=" #{messages.switch2}"/>
- <h:outputLink value="view-raw.xhtml">
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- <h:outputText value=" #{messages.raw}"/>
- </h:outputLink>
- </h:panelGroup>
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
<h:form id="viewResourceConfigurationFormStructuredAndRaw">
- <!-- TODO remove the id version -->
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <h:panelGroup
rendered="#{ExistingResourceConfigurationViewUIBean.structuredMode}">
+ <h:outputText value="#{messages.youareviewingstructured}"/>
+ <h:panelGroup>
+ <h:outputText value=" #{messages.switch2}"/>
+ <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.switchToRaw}">
+ <h:outputText value=" files mode"/>
+ </h:commandLink>
+ </h:panelGroup>
+
+ <h:outputText value=" #{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton value="#{messages.editstructured}"
+
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+ title="Edit this Configuration"
styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ <h:commandButton value="#{messages.editraw}"
+
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGrid>
- <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+ <onc:config
+
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
+
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ readOnly="true"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ </h:panelGroup>
+ <h:panelGroup
rendered="#{ExistingResourceConfigurationViewUIBean.rawMode}">
+ <h:outputText value="#{messages.youareviewingraw}"/>
+
+ <h:panelGroup>
+ <h:outputText value=" #{messages.switch2}"/>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchTostructured}">
+ <h:outputText value=" #{messages.structured}"/>
+ </h:commandLink>
+ </h:panelGroup>
+
+ <h:outputText value=" #{messages.nopermissionedit}"
+
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton value="#{messages.editraw}"
+
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationUIBean.updateInProgress}"/>
+ </h:panelGrid>
- <h:commandButton value="#{messages.editstructured}"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
- title="Edit this Configuration"
styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- <h:commandButton value="#{messages.editraw}"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
+ <c:forEach
items="#{ExistingResourceConfigurationViewUIBean.configuration.rawConfigurations}"
+ var="rawConfig">
+ <rich:panelMenuItem label="#{rawConfig.path}"
+
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
+
reRender="fileContents,selectedFileHeader">
+ <f:param name="current"
value="#{rawConfig.path}"/>
+ </rich:panelMenuItem>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </rich:panelMenu>
+ </rich:panel>
+
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4" style="width:100%;">
+ <h:outputText id="selectedFileHeader"
+
value="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <h:commandLink value="View Full Screen"/>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+ <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
+ readonly="true"/>
+ </rich:panel>
+ </h:panelGrid>
+ </h:panelGrid>
- <onc:config
-
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
-
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
- readOnly="true"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
+ </h:panelGroup>
</h:form>
</c:when>
</c:choose>
commit b98f1271336983503559f58b2c55cb2899068b42
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Jan 11 08:28:29 2010 -0500
More refactoring to combine the structured and raw ui into edit.xhtml
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 cd9a6ce..555bf43 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
@@ -59,6 +59,11 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUIBean {
public static final String MANAGED_BEAN_NAME =
"ExistingResourceConfigurationUIBean";
+ private static final boolean STRUCTURED_MODE = true;
+ private static final boolean RAW_MODE = false;
+
+ private boolean mode = STRUCTURED_MODE;
+
// =========== actions ===========
public ExistingResourceConfigurationUIBean() {
@@ -75,12 +80,18 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String switchToRaw() {
- ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
- int resourceId = EnterpriseFacesContextUtility.getResource().getId();
-
this.configurationManager.translateResourceConfiguration(EnterpriseFacesContextUtility.getSubject(),
- resourceId, getConfiguration(), true);
-
- return SUCCESS_OUTCOME;
+// ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(),
getConfigurationDefinition());
+// int resourceId = EnterpriseFacesContextUtility.getResource().getId();
+// Configuration configuration =
+//
configurationManager.translateResourceConfiguration(EnterpriseFacesContextUtility.getSubject(),
+// resourceId, getConfiguration(), true);
+//
+// setConfiguration(configuration);
+//
+// mode = RAW_MODE;
+//
+// return null;
+ return switchToraw();
}
public String updateConfiguration() {
@@ -267,7 +278,9 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
public String getCurrentContents() {
- return new String(getCurrent().getContents());
+ String currentContents = new String(getCurrent().getContents());
+ return currentContents;
+// return new String(getCurrent().getContents());
}
public String getCurrentPath() {
@@ -309,6 +322,14 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
}
+ public boolean isStructuredMode() {
+ return mode == STRUCTURED_MODE;
+ }
+
+ public boolean isRawMode() {
+ return mode == RAW_MODE;
+ }
+
public boolean isModified(String path) {
return getModified().keySet().contains(path);
}
@@ -417,7 +438,9 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
current = null;
setConfiguration(configuration);
- return SUCCESS_OUTCOME;
+ mode = RAW_MODE;
+ return null;
+// return SUCCESS_OUTCOME;
}
void dumpProperties(Configuration conf, Log log) {
@@ -447,7 +470,9 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
current = null;
setConfiguration(configuration);
- return SUCCESS_OUTCOME;
+ mode = STRUCTURED_MODE;
+
+ return null;
}
void populateRaws() {
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
index 3c21035..bc26600 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
@@ -4,20 +4,35 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
- <navigation-rule>
+ <navigation-rule>
+ <from-view-id>/rhq/resource/configuration/view.xhtml</from-view-id>
+
+ <navigation-case>
+
<from-action>#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}</from-action>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+
<from-action>#{ExistingResourceConfigurationUIBean.switchToraw}</from-action>
+ <to-view-id>/rhq/resource/configuration/view.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
<navigation-case>
<from-action>#{ExistingResourceConfigurationViewUIBean.editConfiguration}</from-action>
<to-view-id>/rhq/resource/configuration/edit.xhtml?id=#{param.id}</to-view-id>
<redirect/>
</navigation-case>
+ <!--
<navigation-case>
<from-action>#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}</from-action>
-
<to-view-id>/rhq/resource/configuration/edit-raw.xhtml?id=#{param.id}</to-view-id>
+
<to-view-id>/rhq/resource/configuration/edit.xhtml?id=#{param.id}</to-view-id>
<redirect/>
</navigation-case>
+ -->
<navigation-case>
<from-action>#{ConfigHelperUIBean.accessMap}</from-action>
@@ -32,8 +47,8 @@
<navigation-case>
<from-action>#{ExistingResourceConfigurationUIBean.switchToraw}</from-action>
-
<to-view-id>/rhq/resource/configuration/edit-raw.xhtml?id=#{param.id}</to-view-id>
- <redirect/>
+ <to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>
+ <!--<redirect/>-->
</navigation-case>
</navigation-rule>
@@ -71,6 +86,11 @@
<redirect/>
</navigation-case>
+ <navigation-case>
+
<from-action>#{ExistingResourceConfigurationUIBean.switchToraw}</from-action>
+ <to-view-id>/rhq/resource/configuration/edit.xhtml</to-view-id>
+ </navigation-case>
+
<navigation-case>
<from-action>#{ConfigHelperUIBean.accessMap}</from-action>
<to-view-id>/rhq/resource/configuration/edit-map.xhtml</to-view-id>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
b/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
index 3c20d29..cd273fd 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
@@ -1730,6 +1730,14 @@ P.compact {
vertical-align: top;
}
+.rich-pmenu-selected-element {
+ background-color: #D8D8D8;
+}
+
+.raw-edit-footer {
+ text-align: right;
+}
+
/*--- Configuration ---------------------*/
.property-group-header {
padding: 4px;
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 9a8dec6..8af5b00 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -1,64 +1,251 @@
<?xml version="1.0"?>
<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:a4j="http://richfaces.org/a4j"
xmlns:onc="http://jboss.org/on/component">
THIS TEXT WILL BE REMOVED.
<ui:composition template="/rhq/resource/layout/main.xhtml">
- THIS TEXT WILL BE REMOVED AS WELL.
-
- <ui:param name="pageTitle"
value="#{ResourceUIBean.resourceType.name} '#{ResourceUIBean.name}' - Edit
Configuration"/>
-
- <ui:param name="selectedTabName"
value="Configuration.Current"/>
-
- <ui:define name="content">
-
- <h:form id="editResourceConfigurationForm"
onsubmit="prepareInputsForSubmission(this)"
rendered="#{!ViewResourceConfigurationUIBean.updateInProgress}">
-
-
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
-
- <h:outputText value="#{messages.youareviewingstructured}" />
-
- <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.structuredAndRawSupported}"
>
- <h:outputText value=" #{messages.switch2}" />
- <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchToraw}" >
- <f:param name="conversationId"
value="#{conversation.id}"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- <h:outputText value=" files mode"/>
- </h:commandLink>
- </h:panelGroup>
-
- <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
-
- <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
rendered="#{ExistingResourceConfigurationUIBean.configuration != null}">
+ THIS TEXT WILL BE REMOVED AS WELL.
+
+ <ui:param name="pageTitle" value="#{ResourceUIBean.resourceType.name}
'#{ResourceUIBean.name}' - Edit Configuration"/>
+
+ <ui:param name="selectedTabName"
value="Configuration.Current"/>
+
+ <ui:define name="content">
+
+ <h:form id="editResourceConfigurationForm"
+ onsubmit="prepareInputsForSubmission(this)"
+
rendered="#{!ViewResourceConfigurationUIBean.updateInProgress}">
+
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <c:choose>
+ <c:when
test="${ExistingResourceConfigurationUIBean.rawSupported}">
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
+ <c:forEach
items="#{ExistingResourceConfigurationUIBean.configuration.rawConfigurations}"
+ var="rawConfig">
+ <rich:panelMenuItem
action="#{ExistingResourceConfigurationUIBean.select(rawConfig.path)}"
+ styleClass="raw-menu-item"
+ tableBorderColor="blue"
+
reRender="fileContents,selectedFileHeader">
+ #{rawConfig.path}
+ </rich:panelMenuItem>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </rich:panelMenu>
+ </rich:panel>
+
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4" style="width:100%;">
+ <h:outputText id="selectedFileHeader"
value="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ <h:commandLink value="View Full Screen"/>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationUIBean.currentContents}"
+ readonly="false"/>
+ </rich:panel>
+ </h:panelGrid>
+
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGrid columns="2">
+ <h:outputText>n files changed in this
configuration</h:outputText>
+ <h:commandButton value="Commit"
+
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGrid>
+ </h:panelGrid>
+ </h:panelGrid>
+ </c:when>
+
+ <c:when
test="${ExistingResourceConfigurationUIBean.structuredSupported}">
+ <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
+ rendered="#{ExistingResourceConfigurationUIBean.configuration
!= null}">
<h:commandButton value="SAVE"
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
title="Click to Save Changes"
styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure}"
/>
- <h:commandButton value="RESET" type="reset"
immediate="true"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ <h:commandButton value="RESET" type="reset"
immediate="true"
title="Click to Reset Fields"
styleClass="buttonmed"/>
- </h:panelGrid>
-
- </h:form>
-
- <h:panelGroup layout="block" styleClass="InfoBlock"
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
- <b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
- </h:panelGroup>
- </ui:define>
+ </h:panelGrid>
+ </c:when>
+
+ <c:when
test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
+ <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.structuredMode}">
+ <h:outputText value="#{messages.youareviewingstructured}"/>
+
+ <h:panelGroup>
+ <h:outputText value=" #{messages.switch2}"/>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchToRaw}">
+ <h:outputText value=" files mode"/>
+ </h:commandLink>
+ </h:panelGroup>
+
+ <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationUIBean.configuration != null}">
+ <h:commandButton value="SAVE"
+
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ <h:commandButton value="RESET"
+ type="reset"
+ immediate="true"
+ title="Click to Reset Fields"
+ styleClass="buttonmed"/>
+ </h:panelGrid>
+ </h:panelGroup>
+ <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.rawMode}">
+ <h:outputText value="#{messages.youareviewingraw}"/>
+
+ <h:panelGroup>
+ <h:outputText value=" #{messages.switch2}"/>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchTostructured}">
+ <h:outputText value=" #{messages.structured}"/>
+ </h:commandLink>
+ </h:panelGroup>
+
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
+ <c:forEach
items="#{ExistingResourceConfigurationUIBean.configuration.rawConfigurations}"
+ var="rawConfig">
+ <rich:panelMenuItem label="#{rawConfig.path}"
+
action="#{ExistingResourceConfigurationUIBean.select(rawConfig.path)}"
+ styleClass="raw-menu-item"
+ tableBorderColor="blue"
+
reRender="fileContents,selectedFileHeader">
+ <f:param name="current"
value="#{rawConfig.path}"/>
+ </rich:panelMenuItem>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </rich:panelMenu>
+ </rich:panel>
+
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4" style="width:100%;">
+ <h:outputText id="selectedFileHeader"
value="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ <h:commandLink value="View Full Screen"/>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationUIBean.currentContents}"
+ readonly="false"/>
+ </rich:panel>
+ </h:panelGrid>
+
+ <h:panelGrid columns="1" style="width:100%"
columnClasses="raw-edit-footer">
+ <h:panelGrid columns="2">
+ <h:outputText>n files changed in this
configuration</h:outputText>
+ <h:commandButton value="Commit"
+
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGrid>
+ </h:panelGrid>
+ </h:panelGrid>
+ </h:panelGroup>
+ </c:when>
+ </c:choose>
+
+ <ui:remove>
+ <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
+ <h:outputText value=" #{messages.switch2}"/>
+ <h:commandLink
action="#{ExistingResourceConfigurationUIBean.switchToRaw}">
+ <f:param name="conversationId"
value="#{conversation.id}"/>
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <h:outputText value=" files mode"/>
+ </h:commandLink>
+ </h:panelGroup>
+
+
+ <onc:config
configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
+ rendered="#{ExistingResourceConfigurationUIBean.configuration
!= null}">
+ <h:commandButton value="SAVE"
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
+ title="Click to Save Changes"
styleClass="buttonmed"
+
rendered="${ResourceUIBean.permissions.configure}"/>
+ <h:commandButton value="RESET" type="reset"
immediate="true"
+ title="Click to Reset Fields"
styleClass="buttonmed"/>
+ </h:panelGrid>
+ </ui:remove>
+
+ </h:form>
+
+ <h:panelGroup layout="block" styleClass="InfoBlock"
+
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
+ <b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
+ </h:panelGroup>
+ </ui:define>
</ui:composition>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index c6cb972..56afa23 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -41,9 +41,9 @@ THIS TEXT WILL BE REMOVED.
}
</script>
- <h:outputText value="#{messages.youareviewingraw}"/>
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
+
<h:form id="viewResourceConfigurationFormRaw">
<input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
@@ -72,21 +72,19 @@ THIS TEXT WILL BE REMOVED.
iconCollapsedGroup="disc"
limitToList="true"
reRender="fileContents">
- <rich:panelMenuGroup label="/etc/httpd/conf">
- <rich:panelMenuItem>httpd.conf</rich:panelMenuItem>
- <rich:panelMenuItem>php.conf</rich:panelMenuItem>
- </rich:panelMenuGroup>
- <rich:panelMenuGroup label="/tmp/raw-config">
+ <rich:panelMenuGroup label="/tmp/raw-config"
expanded="true">
<c:forEach
items="#{ExistingResourceConfigurationViewUIBean.configuration.rawConfigurations}"
var="rawConfig">
- <rich:panelMenuItem
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
+ <rich:panelMenuItem label="#{rawConfig.path}"
+
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
reRender="fileContents,selectedFileHeader">
- #{rawConfig.path}
+ <f:param name="current"
value="#{rawConfig.path}"/>
</rich:panelMenuItem>
</c:forEach>
</rich:panelMenuGroup>
</rich:panelMenu>
</rich:panel>
+
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
<h:outputText id="selectedFileHeader"
value="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
@@ -94,18 +92,17 @@ THIS TEXT WILL BE REMOVED.
<h:commandLink value="Upload New">
<h:graphicImage value="/images/upload.png"/>
</h:commandLink>
-
-
-
<h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id"
value="#{ResourceUIBean.id}"/>
</h:commandLink>
</h:panelGrid>
+
<rich:panel style="margin-left:1px; border: none;">
<h:inputTextarea id="fileContents"
style="width:100%"
-
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"/>
+
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
+ readonly="true"/>
</rich:panel>
</h:panelGrid>
</h:panelGrid>
commit d7e8d0bd77d9437a86328c0d769a65e1a99e920d
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 8 15:16:17 2010 -0500
Initial commit for raw config ui changes. This is just a protoype.
At this point thing raw config ui is broken as I am trying to learn how to rebuild the
UI
with faclets and richfaces. I have the config files rendering in a rich panel
menu, and
selecting a file in the menu will cause its contents to be displayed in the text
area.
Selecting the file will also cause the path name to change and appear above the
text area
on the upper left. The download functionality has been pushed into a backing bean
method.
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 fd89fab..cd9a6ce 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
@@ -21,11 +21,14 @@ package org.rhq.enterprise.gui.configuration.resource;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.TreeMap;
import javax.faces.application.FacesMessage;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -335,6 +338,7 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
public void select(String s) {
selectedPath = s;
setCurrentPath(selectedPath);
+ setCurrentContents(getCurrentContents());
}
public void setCurrentContents(String updated) {
@@ -362,6 +366,26 @@ public class ExistingResourceConfigurationUIBean extends
AbstractConfigurationUI
getModified().put(raw.getPath(), raw);
}
+ public String download() {
+ try {
+ HttpServletResponse response = FacesContextUtility.getResponse();
+ response.setHeader("Content-Disposition",
"attachment;filename=" + getCurrentPath());
+ OutputStream ostream = response.getOutputStream();
+ ostream.write(getCurrentContents().getBytes());
+ ostream.flush();
+ ostream.close();
+
+ FacesContextUtility.getFacesContext().responseComplete();
+
+ return null;
+ }
+ catch (IOException e) {
+ log.error("Failed to complete download request for " +
getCurrentPath(), e);
+ throw new RuntimeException(e);
+ }
+// return "download";
+ }
+
/**
* This is a no-op, since the upload work was done by upload file
* But is kept as a target for the "save" icon from the full screen page
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
b/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
index d9a8046..3c20d29 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/css/win.css
@@ -1713,6 +1713,23 @@ P.compact {
vertical-align: top;
}
+/**--- Raw Config ---------------------*/
+.raw-outer-table {
+ width: 100%;
+}
+
+.raw-outer-table-left-col {
+ width: 25%;
+ vertical-align: top;
+}
+
+.raw-outer-table-right-col {
+ /*width: 75%;*/
+ margin-left: 10px;
+ margin-right: 10px;
+ vertical-align: top;
+}
+
/*--- Configuration ---------------------*/
.property-group-header {
padding: 4px;
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 8a39f83..c6cb972 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -10,6 +10,8 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:onc="http://jboss.org/on/component"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:a4j="http://richfaces.org/a4j"
xmlns:s="http://jboss.com/products/seam/taglib">
@@ -17,172 +19,226 @@ THIS TEXT WILL BE REMOVED.
<ui:composition template="/rhq/resource/layout/main.xhtml">
- THIS TEXT WILL BE REMOVED AS WELL.
-
- <ui:param name="pageTitle"
- value="#{ResourceUIBean.resourceType.name}
'#{ResourceUIBean.name}' - View Configuration"/>
-
- <ui:param name="selectedTabName"
value="Configuration.Current"/>
-
- <ui:define name="content">
- <h:panelGroup layout="block" styleClass="InfoBlock"
-
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
- <b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
- </h:panelGroup>
-
- <c:choose>
- <c:when
test="${ExistingResourceConfigurationViewUIBean.rawSupported}">
- <script>
- window.onbeforeunload = confirmExit;
-
- function confirmExit() {
- }
- </script>
-
- <h:outputText value="#{messages.youareviewingraw}"/>
- <h:outputText value=" #{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
- <h:form id="viewResourceConfigurationFormRaw">
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
-
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton value="#{messages.editraw}"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw
Configuration Files" styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationUIBean.updateInProgress}"/>
- </h:panelGrid>
- </h:form>
-
- <table class="summary-props-table"
style="">
- <tr>
- <td bgcolor="#a4b2b9" width="25%"
valign="top">Files
- <h:panelGroup id="changedFiles"
layout="vertical">
- <h:form>
- <input type="hidden"
name="id" value="#{ResourceUIBean.id}"/>
- <ui:repeat
value="#{ExistingResourceConfigurationViewUIBean.paths}"
var="path">
- <div>
- <h:commandLink
-
action="#{ExistingResourceConfigurationViewUIBean.select(path)}"
- value="#{path}"
- rendered="#{path !=
ExistingResourceConfigurationViewUIBean.current.path}">
- <f:param
name="currentPath" value="#{path}"/>
- </h:commandLink>
- <h:outputText
value="#{path}"
- rendered="#{path ==
ExistingResourceConfigurationViewUIBean.current.path}"/>
- </div>
- </ui:repeat>
- </h:form>
- </h:panelGroup>
-
<div>______________________________________</div>
- <div>* File contains uncommitted
changes.</div>
- </td>
- <td>
- <div>
- Current File:
- <h:outputText
value="#{ExistingResourceConfigurationViewUIBean.current.path}"
- styleClass="outhello"/>
- </div>
- <h:outputLink value="view-raw-full.xhtml"
action="navigateToUpload">
- <img
src="/images/viewfullscreen.png"/>
- <h:outputText value=" Full Screen
"/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </h:outputLink>
- <s:link
action="#{ExistingResourceConfigurationViewUIBean.download}">
- <img src="/images/download.png"/>
- <h:outputText value=" Download "/>
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- </s:link>
- <div>
+ THIS TEXT WILL BE REMOVED AS WELL.
+
+ <ui:param name="pageTitle"
+ value="#{ResourceUIBean.resourceType.name}
'#{ResourceUIBean.name}' - View Configuration"/>
+
+ <ui:param name="selectedTabName"
value="Configuration.Current"/>
+
+ <ui:define name="content">
+ <h:panelGroup layout="block" styleClass="InfoBlock"
+
rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
+ <b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
+ </h:panelGroup>
+
+ <c:choose>
+ <c:when
test="${ExistingResourceConfigurationViewUIBean.rawSupported}">
+ <script>
+ window.onbeforeunload = confirmExit;
+
+ function confirmExit() {
+ }
+ </script>
+
+ <h:outputText value="#{messages.youareviewingraw}"/>
+ <h:outputText value=" #{messages.nopermissionedit}"
+ rendered="#{!ResourceUIBean.permissions.configure}"/>
+ <h:form id="viewResourceConfigurationFormRaw">
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton value="#{messages.editraw}"
+
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationUIBean.updateInProgress}"/>
+ </h:panelGrid>
+ </h:form>
+
+ <h:form>
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="disc"
+ limitToList="true"
+ reRender="fileContents">
+ <rich:panelMenuGroup label="/etc/httpd/conf">
+ <rich:panelMenuItem>httpd.conf</rich:panelMenuItem>
+ <rich:panelMenuItem>php.conf</rich:panelMenuItem>
+ </rich:panelMenuGroup>
+ <rich:panelMenuGroup label="/tmp/raw-config">
+ <c:forEach
items="#{ExistingResourceConfigurationViewUIBean.configuration.rawConfigurations}"
+ var="rawConfig">
+ <rich:panelMenuItem
action="#{ExistingResourceConfigurationViewUIBean.select(rawConfig.path)}"
+
reRender="fileContents,selectedFileHeader">
+ #{rawConfig.path}
+ </rich:panelMenuItem>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </rich:panelMenu>
+ </rich:panel>
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4" style="width:100%;">
+ <h:outputText id="selectedFileHeader"
value="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ <h:commandLink value="View Full Screen"/>
+ <h:commandLink value="Upload New">
+ <h:graphicImage value="/images/upload.png"/>
+ </h:commandLink>
+
+
+
+ <h:commandLink
action="#{ExistingResourceConfigurationViewUIBean.download}"
value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+ </h:panelGrid>
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"/>
+ </rich:panel>
+ </h:panelGrid>
+ </h:panelGrid>
+ </h:form>
+
+ <ui:remove>
+ <table class="summary-props-table" style="">
+ <tr>
+ <td bgcolor="#a4b2b9" width="25%"
valign="top">Files
+ <h:panelGroup id="changedFiles"
layout="vertical">
+ <h:form>
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+ <ui:repeat
value="#{ExistingResourceConfigurationViewUIBean.paths}"
var="path">
+ <div>
+ <h:commandLink
+
action="#{ExistingResourceConfigurationViewUIBean.select(path)}"
+ value="#{path}"
+ rendered="#{path !=
ExistingResourceConfigurationViewUIBean.current.path}">
+ <f:param name="currentPath"
value="#{path}"/>
+ </h:commandLink>
+ <h:outputText value="#{path}"
+ rendered="#{path ==
ExistingResourceConfigurationViewUIBean.current.path}"/>
+ </div>
+ </ui:repeat>
+ </h:form>
+ </h:panelGroup>
+ <div>______________________________________</div>
+ <div>* File contains uncommitted changes.</div>
+ </td>
+ <td>
+ <div>
+ Current File:
+ <h:outputText
value="#{ExistingResourceConfigurationViewUIBean.current.path}"
+ styleClass="outhello"/>
+ </div>
+ <h:outputLink value="view-raw-full.xhtml"
action="navigateToUpload">
+ <img src="/images/viewfullscreen.png"/>
+ <h:outputText value=" Full Screen "/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </h:outputLink>
+ <s:link
action="#{ExistingResourceConfigurationViewUIBean.download}">
+ <img src="/images/download.png"/>
+ <h:outputText value=" Download "/>
+ <f:param name="id"
value="#{ResourceUIBean.id}"/>
+ </s:link>
+ <div>
<pre><h:outputText
value="#{ExistingResourceConfigurationViewUIBean.currentContents}"/></pre>
- </div>
- </td>
- </tr>
- </table>
- </c:when>
- <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
- <h:outputText
value="#{messages.youareviewingstructured}"/>
- <h:outputText value=" #{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
- <h:form id="viewResourceConfigurationFormStructured">
- <!-- TODO remove the id version -->
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
-
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton value="#{messages.editstructured}"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
- title="Edit this Configuration"
- styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <onc:config
-
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
-
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
- readOnly="true"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
-
- </h:form>
- </c:when>
- <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
- <h:outputText
value="#{messages.youareviewingstructured}"/>
- <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.rawSupported}">
- <h:outputText value=" #{messages.switch2}"/>
- <h:outputLink value="view-raw.xhtml">
- <f:param name="id"
value="#{ResourceUIBean.id}"/>
- <h:outputText value=" #{messages.raw}"/>
- </h:outputLink>
- </h:panelGroup>
- <h:outputText value=" #{messages.nopermissionedit}"
-
rendered="#{!ResourceUIBean.permissions.configure}"/>
- <h:form
id="viewResourceConfigurationFormStructuredAndRaw">
- <!-- TODO remove the id version -->
- <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
-
- <h:panelGrid columns="2"
styleClass="buttons-table" columnClasses="button-cell"
-
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
-
- <h:commandButton value="#{messages.editstructured}"
-
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
- title="Edit this Configuration"
styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- <h:commandButton value="#{messages.editraw}"
-
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw
Configuration Files" styleClass="buttonmed"
-
rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
- </h:panelGrid>
-
- <onc:config
-
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
-
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
-
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
- readOnly="true"
-
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
-
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
- prevalidate="true"/>
-
- </h:form>
- </c:when>
- </c:choose>
-
- <h:panelGroup layout="block" styleClass="InfoBlock"
-
rendered="#{ExistingResourceConfigurationViewUIBean.updateInProgress}">
- <b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
+ </div>
+ </td>
+ </tr>
+ </table>
+ </ui:remove>
+ </c:when>
+ <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
+ <h:outputText value="#{messages.youareviewingstructured}"/>
+ <h:outputText value=" #{messages.nopermissionedit}"
+ rendered="#{!ResourceUIBean.permissions.configure}"/>
+ <h:form id="viewResourceConfigurationFormStructured">
+ <!-- TODO remove the id version -->
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="buttons-table"
+ columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton value="#{messages.editstructured}"
+
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+ title="Edit this Configuration"
+ styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGrid>
+
+ <onc:config
+
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
+
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ readOnly="true"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ </h:form>
+ </c:when>
+ <c:when
test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
+ <h:outputText value="#{messages.youareviewingstructured}"/>
+ <h:panelGroup
rendered="#{ExistingResourceConfigurationUIBean.rawSupported}">
+ <h:outputText value=" #{messages.switch2}"/>
+ <h:outputLink value="view-raw.xhtml">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <h:outputText value=" #{messages.raw}"/>
+ </h:outputLink>
</h:panelGroup>
-
-
- </ui:define>
+ <h:outputText value=" #{messages.nopermissionedit}"
+ rendered="#{!ResourceUIBean.permissions.configure}"/>
+ <h:form id="viewResourceConfigurationFormStructuredAndRaw">
+ <!-- TODO remove the id version -->
+ <input type="hidden" name="id"
value="#{ResourceUIBean.id}"/>
+
+ <h:panelGrid columns="2" styleClass="buttons-table"
columnClasses="button-cell"
+
rendered="#{ExistingResourceConfigurationViewUIBean.configuration != null and
!ExistingResourceConfigurationViewUIBean.updateInProgress}">
+
+ <h:commandButton value="#{messages.editstructured}"
+
action="#{ExistingResourceConfigurationViewUIBean.editConfiguration}"
+ title="Edit this Configuration"
styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ <h:commandButton value="#{messages.editraw}"
+
action="#{ExistingResourceConfigurationViewUIBean.editRawConfiguration}"
+ title="Advanced Mode Edit of Raw Configuration
Files" styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure and
!ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ </h:panelGrid>
+
+ <onc:config
+
configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
+
configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
+
accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ readOnly="true"
+
nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
+
nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ prevalidate="true"/>
+
+ </h:form>
+ </c:when>
+ </c:choose>
+
+ <h:panelGroup layout="block" styleClass="InfoBlock"
+
rendered="#{ExistingResourceConfigurationViewUIBean.updateInProgress}">
+ <b>${msg['note']}</b>
${msg['resource.config.Current.updateInProgress']}
+ </h:panelGroup>
+
+
+ </ui:define>
</ui:composition>
commit 241126f8eaf5dcf04e3d10cb0a80419d6cfcfee7
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Jan 8 15:07:31 2010 -0500
Initial commit for raw config ui changes
At this point thing raw config ui is broken as I am trying to learn how to rebuild the
UI
with faclets and richfaces. I have the config files rendering in a rich panel menu,
and
selecting a file in the menu will cause its contents to be displayed in the text
area.
Selecting the file will also cause the path name to change and appear above the text
area
on the upper left. The download functionality has been pushed into a backing bean
method.
Updating raw-config-test plugin so that RawServer supports multiple raw files now.
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
index e0a5d64..23af194 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
@@ -14,35 +14,50 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
File rawConfigDir
- File rawConfig1
+// File rawConfig1
+// File rawConfig2
+// File rawConfig3
+
+ List rawConfigs = []
def ant = new AntBuilder()
void start(ResourceContext context) {
resourceContext = context;
+ def numberOfConfigFiles = 3
+
ant = new AntBuilder()
rawConfigDir = new
File("${System.getProperty('java.io.tmpdir')}/raw-config-test")
- rawConfig1 = new File(rawConfigDir, "raw-test-1.txt")
+
+ def index = 1
+
+ numberOfConfigFiles.times { rawConfigs << new File(rawConfigDir,
"raw-test-${it + index++}.txt") }
+// rawConfig1 = new File(rawConfigDir, "raw-test-1.txt")
+// rawConfig2 = new File(rawConfigDir, "raw-test-2.txt")
+// rawConfig3 = new File(rawConfigDir, "raw-test-3.txt")
createRawConfigDir()
- createConfigFile()
+
+ index = 1
+ rawConfigs.each { rawConfig -> createConfigFile(rawConfig, index++) }
+// createConfigFile()
}
def createRawConfigDir() {
rawConfigDir.mkdirs()
}
- def createConfigFile() {
- if (rawConfig1.exists()) {
+ def createConfigFile(rawConfig, index) {
+ if (rawConfig.exists()) {
return null
}
- def properties = ["a": 1, "b": 2, "c": "3"]
+ def properties = ["raw${index}.a": 1, "raw${index}.b": 2,
"raw${index}.c": "3"]
- rawConfig1.createNewFile()
- rawConfig1.withWriter { writer ->
+ rawConfig.createNewFile()
+ rawConfig.withWriter { writer ->
properties.each { key, value -> writer.writeLine("${key}=${value}") }
}
}
@@ -59,10 +74,15 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
}
Set<RawConfiguration> loadRawConfigurations() {
- def rawConfigs = new HashSet()
- rawConfigs.add(new RawConfiguration(path: rawConfig1.absolutePath, contents:
rawConfig1.readBytes()))
+ def rawConfigSet = new HashSet()
+ rawConfigs.each { rawConfigSet.add(new RawConfiguration(path: it.absolutePath,
contents: it.readBytes())) }
+
+ return rawConfigSet
- return rawConfigs
+// def rawConfigs = new HashSet()
+// rawConfigs.add(new RawConfiguration(path: rawConfig1.absolutePath, contents:
rawConfig1.readBytes()))
+//
+// return rawConfigs
}
RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
commit 776bbc9717f14c39b2e56aeb38ac0606332f2ecb
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jan 7 12:38:37 2010 -0500
Fixing typo
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index 64e3cb1..c4001c1 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -17,7 +17,7 @@
<plugin-configuration>
<c:group name="Structured">
- <c:simple-property name="faidStructuredValidation"
type="boolean" default="false"/>
+ <c:simple-property name="failStructuredValidation"
type="boolean" default="false"/>
<c:simple-property name="failStructuredUpdate"
type="boolean" default="false"/>
</c:group>
@@ -78,4 +78,4 @@
<c:simple-property name="bam"/>
</resource-configuration>
</server>
-</plugin>
\ No newline at end of file
+</plugin>
commit 500bfae124198c5cee01f6fe9079401e109e0b96
Merge: 2750b5e... b9e3538...
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 7 10:26:48 2010 -0500
Merge branch 'master' into raw-config
Conflicts:
.classpath
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
diff --cc .classpath
index c530af4,a07522a..c8e2a2d
--- a/.classpath
+++ b/.classpath
@@@ -14,7 -16,7 +16,7 @@@
<classpathentry kind="src"
path="modules/plugins/tomcat/src/test/java"/>
<classpathentry kind="src"
path="modules/plugins/jboss-cache/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/jboss-cache-v3/src/main/java"/>
- <classpathentry kind="src"
path="modules/plugins/antlr-config/src/main/java"/>
- <classpathentry kind="src"
path="etc/samples/perspectives/sample-perspective/app/src/main/java"/>
++ <classpathentry excluding="org/rhq/plugins/antlrconfig/"
kind="src" path="modules/plugins/antlr-config/src/main/java"/>
<classpathentry kind="var"
path="M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar"/>
<classpathentry kind="var"
path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar"/>
<classpathentry kind="var"
path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar"/>
@@@ -210,9 -217,10 +217,13 @@@
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/net/homeip/yusuke/twitter4j/2.0.9/twitter4j-2.0.9.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/>
<classpathentry exported="true" kind="lib"
path="modules/enterprise/remoting/webservices/target/rhq-remoting-webservices-1.4.0-SNAPSHOT/wsconsume-output"/>
+ <classpathentry kind="var"
path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
commit 2750b5e564f66c4594d6026942d897303d871c50
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 7 09:20:47 2010 -0500
Adding groups for plugin configuration properties
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index e59d833..64e3cb1 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -16,20 +16,26 @@
description="A fake server component that supports both structured and raw
configuration">
<plugin-configuration>
- <c:simple-property name="faidStructuredValidation"
type="boolean" default="false"/>
- <c:simple-property name="failStructuredUpdate"
type="boolean" default="false"/>
+ <c:group name="Structured">
+ <c:simple-property name="faidStructuredValidation"
type="boolean" default="false"/>
+ <c:simple-property name="failStructuredUpdate"
type="boolean" default="false"/>
+ </c:group>
- <c:simple-property name="failRawValidation" type="boolean"
default="false"/>
- <c:simple-property name="filesToFailValidation"
- description="A comma-delimited list of file names for which
validation will fail. The entire
- path does not need to be specified. Simple matching
will be done starting from
- the end of the path. For a path of /foo/bar.txt,
you could specify bar.txt."/>
+ <c:group name="Raw Validation">
+ <c:simple-property name="failRawValidation" type="boolean"
default="false"/>
+ <c:simple-property name="filesToFailValidation"
+ description="A whitespace-separated list of file names
for which validation will fail. The entire
+ path does not need to be specified. Simple
matching will be done starting from
+ the end of the path. For a path of /foo/bar.txt,
you could specify bar.txt."/>
+ </c:group>
- <c:simple-property name="failRawUpdate" type="boolean"
default="false"/>
- <c:simple-property name="filesToFailUpdate"
- description="A comma-delimited list of file names for which
the update will fail. The entire
- path does not need to be specified. Simple matching
will be done starting from
- the end of the path. For a path of /foo/bar.txt,
you could specify bar.txt."/>
+ <c:group name="Raw Update">
+ <c:simple-property name="failRawUpdate" type="boolean"
default="false"/>
+ <c:simple-property name="filesToFailUpdate"
+ description="A whitespace-separated list of file names
for which the update will fail. The entire
+ path does not need to be specified. Simple
matching will be done starting from
+ the end of the path. For a path of /foo/bar.txt,
you could specify bar.txt."/>
+ </c:group>
</plugin-configuration>
<resource-configuration configurationFormat="both">
commit 9d0ee5cc056c3d555f5c0d2fa684ef760acb857e
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 7 06:40:50 2010 -0500
Removing unused classes and cleaning up imports
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
index 8389c41..dbf131b 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
@@ -23,13 +23,14 @@
package org.rhq.core.pc.configuration;
-import static org.rhq.core.domain.configuration.definition.ConfigurationFormat.*;
-
+import org.apache.maven.artifact.versioning.ComparableVersion;
+import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
-import org.rhq.core.pc.util.ComponentService;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.clientapi.agent.PluginContainerException;
-import org.apache.maven.artifact.versioning.ComparableVersion;
+import org.rhq.core.pc.util.ComponentService;
+
+import static org.rhq.core.domain.configuration.definition.ConfigurationFormat.RAW;
+import static
org.rhq.core.domain.configuration.definition.ConfigurationFormat.STRUCTURED;
public class ConfigManagementFactoryImpl implements ConfigManagementFactory {
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementSupport.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementSupport.java
index 5ab7269..104f41c 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementSupport.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementSupport.java
@@ -23,11 +23,11 @@
package org.rhq.core.pc.configuration;
+import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.pc.util.ComponentService;
import org.rhq.core.pc.util.FacetLockType;
-import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
public abstract class ConfigManagementSupport implements ConfigManagement {
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index b360858..5a0e155 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -22,35 +22,38 @@
*/
package org.rhq.core.pc.configuration;
-import java.util.Set;
-import java.util.Queue;
-import java.util.LinkedList;
-import java.util.concurrent.*;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.artifact.versioning.ComparableVersion;
-
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationAgentService;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ContainerService;
-import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.PluginContainer;
-import org.rhq.core.pc.util.ComponentService;
+import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.agent.AgentService;
+import org.rhq.core.pc.util.ComponentService;
import org.rhq.core.pc.util.ComponentUtil;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
/**
* Manages configuration of all resources across all plugins.
*
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationUtilityServiceImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationUtilityServiceImpl.java
index 771b0b5..2f14f17 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationUtilityServiceImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationUtilityServiceImpl.java
@@ -23,9 +23,9 @@
package org.rhq.core.pc.configuration;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUtility;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.clientapi.agent.configuration.ConfigurationUtility;
import java.util.List;
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
index 98ec1c6..5f6b6ab 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
@@ -28,13 +28,9 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Set;
public class RawConfigManagement extends ConfigManagementSupport {
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateErrorDetail.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateErrorDetail.java
deleted file mode 100644
index 7e8f9ca..0000000
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateErrorDetail.java
+++ /dev/null
@@ -1,57 +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.pc.configuration;
-
-import org.rhq.core.domain.configuration.RawConfiguration;
-
-public class RawUpdateErrorDetail {
-
- private RawConfiguration rawConfig;
-
- private Throwable error;
-
- public RawUpdateErrorDetail() {
- }
-
- public RawUpdateErrorDetail(RawConfiguration rawConfig, Throwable error) {
- this.rawConfig = rawConfig;
- this.error = error;
- }
-
- public RawConfiguration getRawConfiguration() {
- return rawConfig;
- }
-
- public void setRawConfiguration(RawConfiguration rawConfig) {
- this.rawConfig = rawConfig;
- }
-
- public Throwable getError() {
- return error;
- }
-
- public void setError(Throwable error) {
- this.error = error;
- }
-}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateException.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateException.java
deleted file mode 100644
index 22ba9f1..0000000
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateException.java
+++ /dev/null
@@ -1,53 +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.pc.configuration;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class RawUpdateException extends ConfigurationUpdateException {
-
- private List<RawUpdateErrorDetail> details = new
LinkedList<RawUpdateErrorDetail>();
-
- public RawUpdateException(List<RawUpdateErrorDetail> errors) {
- details = errors;
- }
-
- public RawUpdateException(String message, List<RawUpdateErrorDetail> errors) {
- super(message);
- details = errors;
- }
-
- public RawUpdateException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public RawUpdateException(Throwable cause) {
- super(cause);
- }
-
- public List<RawUpdateErrorDetail> getDetails() {
- return details;
- }
-}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
index b0b1728..957c973 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
@@ -23,19 +23,19 @@
package org.rhq.core.pc.configuration;
-import static java.util.Collections.EMPTY_SET;
-
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.util.List;
import java.util.Set;
+import static java.util.Collections.EMPTY_SET;
+
public class StructuredAndRawConfigManagement extends ConfigManagementSupport {
private final Log log = LogFactory.getLog(StructuredAndRawConfigManagement.class);
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
index 85023a4..e2b1bb7 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
@@ -74,7 +74,6 @@ public class StructuredConfigManagement extends ConfigManagementSupport
{
facet.persistStructuredConfiguration(configuration);
}
catch (Throwable t) {
-// throw new StructuredUpdateException(t);
throw new ConfigurationUpdateException(t.getMessage());
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredUpdateException.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredUpdateException.java
deleted file mode 100644
index c0ba380..0000000
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredUpdateException.java
+++ /dev/null
@@ -1,43 +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.pc.configuration;
-
-public class StructuredUpdateException extends ConfigurationUpdateException {
-
- public StructuredUpdateException() {
- super();
- }
-
- public StructuredUpdateException(String message) {
- super(message);
- }
-
- public StructuredUpdateException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public StructuredUpdateException(Throwable cause) {
- super(cause);
- }
-}
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
index 1ad81f6..b9c3415 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
@@ -23,24 +23,25 @@
package org.rhq.core.pc.configuration;
+import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pc.util.ComponentService;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.test.JMockTest;
-
-import static org.rhq.test.AssertUtils.*;
-import static org.testng.Assert.assertEquals;
import org.testng.annotations.BeforeMethod;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
+import static org.rhq.test.AssertUtils.assertCollectionEqualsNoOrder;
+import static org.rhq.test.AssertUtils.assertPropertiesMatch;
+import static org.testng.Assert.assertEquals;
+
public class ConfigManagementTest extends JMockTest {
Random random = new Random();
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
index 6418922..b43a892 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
@@ -23,28 +23,30 @@
package org.rhq.core.pc.configuration;
-import static org.testng.Assert.*;
-
+import org.hamcrest.Matcher;
import org.jmock.Expectations;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.ServerServices;
+import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.test.jmock.PropertyMatcher;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.hamcrest.Matcher;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
public class ConfigurationManagerTest extends ConfigManagementTest {
static final String LEGACY_AMPS_VERSION = "2.0";
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
index e093d68..5db3fd1 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
@@ -23,21 +23,19 @@
package org.rhq.core.pc.configuration;
-import static org.testng.Assert.*;
-import static java.util.Collections.EMPTY_SET;
-
import org.jmock.Expectations;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import static org.testng.Assert.assertNull;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.util.List;
import java.util.Set;
+import static java.util.Collections.EMPTY_SET;
+import static org.testng.Assert.assertNull;
+
public class RawConfigManagementTest extends ConfigManagementTest {
ResourceConfigurationFacet configFacet;
@@ -126,7 +124,6 @@ public class RawConfigManagementTest extends ConfigManagementTest {
rawConfigMgmt.executeUpdate(resourceId, config);
}
-// @Test(expectedExceptions = {RawUpdateException.class})
@Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenValidationFailsForSingleRaw() throws Exception
{
final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
@@ -143,7 +140,6 @@ public class RawConfigManagementTest extends ConfigManagementTest {
rawConfigMgmt.executeUpdate(resourceId, config);
}
-// @Test(expectedExceptions = {RawUpdateException.class})
@Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenUpdateFailsForSingleRaw() throws Exception {
final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
@@ -186,7 +182,6 @@ public class RawConfigManagementTest extends ConfigManagementTest {
rawConfigMgmt.executeUpdate(resourceId, config);
}
-// @Test
@Test(expectedExceptions = {ConfigurationUpdateException.class})
public void secondRawShouldStillGetUpdatedWhenFirstRawFailsValidation() throws
Exception {
final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
@@ -207,30 +202,8 @@ public class RawConfigManagementTest extends ConfigManagementTest {
}});
rawConfigMgmt.executeUpdate(resourceId, config);
-
-// RawUpdateException exception = null;
-//
-// try {
-// rawConfigMgmt.executeUpdate(resourceId, config);
-// }
-// catch (RawUpdateException e) {
-// exception = e;
-// }
-//
-// assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
-// " validation fails");
-//
-// List<RawUpdateErrorDetail> errors = exception.getDetails();
-//
-// assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
-// assertEquals(
-// errors.get(0).getRawConfiguration(),
-// raw1,
-// "Expected to find " + raw1 + " since validation for it
failed"
-// );
}
-// @Test
@Test(expectedExceptions = {ConfigurationUpdateException.class})
public void secondRawShouldStillGetUpdateWhenFirstRawUpdateFails() throws Exception
{
final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
@@ -253,30 +226,8 @@ public class RawConfigManagementTest extends ConfigManagementTest {
}});
rawConfigMgmt.executeUpdate(resourceId, config);
-
-// RawUpdateException exception = null;
-//
-// try {
-// rawConfigMgmt.executeUpdate(resourceId, config);
-// }
-// catch (RawUpdateException e) {
-// exception = e;
-// }
-//
-// assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
-// " update fails");
-//
-// List<RawUpdateErrorDetail> errors = exception.getDetails();
-//
-// assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
-// assertEquals(
-// errors.get(0).getRawConfiguration(),
-// raw1,
-// "Expected to find " + raw1 + " since update for it
failed"
-// );
}
-// @Test
@Test(expectedExceptions = {ConfigurationUpdateException.class})
public void noUpdatesShouldHappenWhenValidationFailsForBothRaws() throws Exception {
final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
@@ -295,33 +246,6 @@ public class RawConfigManagementTest extends ConfigManagementTest {
}});
rawConfigMgmt.executeUpdate(resourceId, config);
-
-// RawUpdateException exception = null;
-//
-// try {
-// rawConfigMgmt.executeUpdate(resourceId, config);
-// }
-// catch (RawUpdateException e) {
-// exception = e;
-// }
-//
-// assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
-// " update fails");
-//
-// List<RawUpdateErrorDetail> errors = exception.getDetails();
-//
-// assertEquals(errors.size(), 2, "Expected to find two errors since
validation failed for both raw config files");
-// assertErrorDetailsContainsRawConfig(errors, raw1);
-// assertErrorDetailsContainsRawConfig(errors, raw2);
- }
-
- private void assertErrorDetailsContainsRawConfig(List<RawUpdateErrorDetail>
errors, RawConfiguration rawConfig) {
- for (RawUpdateErrorDetail detail : errors) {
- if (detail.getRawConfiguration().equals(rawConfig)) {
- return;
- }
- }
- fail("Expected to find " + rawConfig + " in update error
details");
}
private void addDefaultExpectationsForUpdate() throws Exception {
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
index b53fd00..b8903ea 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
@@ -23,22 +23,22 @@
package org.rhq.core.pc.configuration;
-import static org.testng.Assert.*;
-import static java.util.Collections.*;
-
-import org.rhq.core.pc.util.FacetLockType;
-import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.jmock.Expectations;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.util.FacetLockType;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.jmock.Expectations;
import java.util.Set;
+import static java.util.Collections.EMPTY_SET;
+import static org.testng.Assert.assertNull;
+
public class StructuredAndRawConfigManagementTest extends ConfigManagementTest {
ResourceConfigurationFacet configFacet;
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
index 43d5c73..b869569 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
@@ -28,10 +28,11 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import static org.testng.Assert.assertNull;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import static org.testng.Assert.assertNull;
+
public class StructuredConfigManagementTest extends ConfigManagementTest {
ResourceConfigurationFacet configFacet;
@@ -128,7 +129,6 @@ public class StructuredConfigManagementTest extends
ConfigManagementTest {
structuredMgmt.executeUpdate(resourceId, config);
}
-// @Test(expectedExceptions = {StructuredUpdateException.class})
@Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenValidationFails() throws Exception {
final Configuration config = new Configuration();
@@ -142,7 +142,6 @@ public class StructuredConfigManagementTest extends
ConfigManagementTest {
structuredMgmt.executeUpdate(resourceId, config);
}
-// @Test(expectedExceptions = {StructuredUpdateException.class})
@Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenUpdateFails() throws Exception {
final Configuration config = new Configuration();
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
index 7dd18b0..54edf77 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
@@ -33,13 +33,14 @@ import
org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
-import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.FAILURE;
-import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.SUCCESS;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.test.jmock.PropertyMatcher;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.FAILURE;
+import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.SUCCESS;
+
public class UpdateResourceConfigurationRunnerTest extends ConfigManagementTest {
ConfigManagement configMgmt;
commit 6513411790aa5f03ebd26213cda8272d010c1b37
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Jan 7 06:19:40 2010 -0500
Updating/adding validation support for configs that support structured and raw
Updating logic that generates the various ConfigurationUpdateExceptions to just return
the
error message as an unformatted string, not as an xml document. No longer using
StructuredUpdateException or RawUpdateException as they do not seem necessary.
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java
new file mode 100644
index 0000000..fdc3018
--- /dev/null
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java
@@ -0,0 +1,49 @@
+/*
+ * 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.pluginapi.configuration;
+
+
+/**
+ * This exception can be thrown by instances of {@link ResourceConfigurationFacet} to
indicate an update failed. This
+ * exception can be throw by the validateXXX methods to indicate that validation failed
or by the persistXXX method to
+ * indicate that the actual update failed.
+ * <br/><br/>
+ * Any unchecked exception thrown from the validateXXX or from the persistXXX methods
will be treated as an update
+ * failure. When a ResourceConfigurationUpdateException is thrown, only the error
messages associated with it are sent
+ * back to the server whereas with any other exception, the entire stack trace is sent up
to the server. The reason for
+ * this is that with a ResourceConfigurationUpdateException, the plugin container assumes
that the failure has been
+ * handled in some fashion. For instance, catching any exceptions that might thrown from
attempting to apply the update.
+ * Or consider a scenario in which applying the update involves calling out to an
external program. The failed update
+ * might only be reported back with some error code.
+ * <br/><br/>
+ * With any other exception, the plugin container cannot reasonably assume that any
errors were handled and as such
+ * reports the entire stack trace back to the server to provide additional information
for debugging if necessary.
+ */
+public class ResourceConfigurationUpdateException extends RuntimeException {
+
+ public ResourceConfigurationUpdateException(String message) {
+ super(message);
+ }
+
+}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
index 6193fd2..8389c41 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
@@ -25,6 +25,7 @@ package org.rhq.core.pc.configuration;
import static org.rhq.core.domain.configuration.definition.ConfigurationFormat.*;
+import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
import org.rhq.core.pc.util.ComponentService;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.clientapi.agent.PluginContainerException;
@@ -63,6 +64,12 @@ public class ConfigManagementFactoryImpl implements
ConfigManagementFactory {
ResourceType resourceType = componentService.getResourceType(resourceId);
+ ConfigurationFormat format =
resourceType.getResourceConfigurationDefinition().getConfigurationFormat();
+ switch (format) {
+ case RAW: break;
+ default: ;
+ }
+
if (isStructured(resourceType)) {
return new StructuredConfigManagement();
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
index 1a9b21c..98ec1c6 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
@@ -67,7 +67,7 @@ public class RawConfigManagement extends ConfigManagementSupport {
throws PluginContainerException {
ResourceConfigurationFacet facet =
loadResourceConfigFacetWithWriteLock(resourceId);
- List<RawUpdateErrorDetail> errors = new
LinkedList<RawUpdateErrorDetail>();
+ StringBuilder errors = new StringBuilder();
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
try {
@@ -76,12 +76,12 @@ public class RawConfigManagement extends ConfigManagementSupport {
}
catch (Throwable t) {
// TODO Might want to specify in the error detail whether the validate or
update call failed
- errors.add(new RawUpdateErrorDetail(rawConfig, t));
+ errors.append(t.getMessage()).append("\n\n");
}
}
- if (errors.size() > 0) {
- throw new RawUpdateException(errors);
+ if (errors.length() > 0) {
+ throw new ConfigurationUpdateException(errors.toString());
}
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
index 3f976c7..b0b1728 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagement.java
@@ -87,9 +87,28 @@ public class StructuredAndRawConfigManagement extends
ConfigManagementSupport {
public void executeUpdate(int resourceId, Configuration configuration) throws
PluginContainerException {
ResourceConfigurationFacet facet =
loadResourceConfigFacetWithWriteLock(resourceId);
- facet.persistStructuredConfiguration(configuration);
+ StringBuilder errors = new StringBuilder();
+
+ try {
+ facet.validateStructuredConfiguration(configuration);
+ facet.persistStructuredConfiguration(configuration);
+ }
+ catch (Throwable t) {
+ errors.append(t.getMessage());
+ }
+
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
- facet.persistRawConfiguration(rawConfig);
+ try {
+ facet.validateRawConfiguration(rawConfig);
+ facet.persistRawConfiguration(rawConfig);
+ }
+ catch (Throwable t) {
+ errors.append(t.getMessage()).append("\n\n");
+ }
+ }
+
+ if (errors.length() > 0) {
+ throw new ConfigurationUpdateException(errors.toString());
}
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
index 7cd57b7..85023a4 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
@@ -74,7 +74,8 @@ public class StructuredConfigManagement extends ConfigManagementSupport
{
facet.persistStructuredConfiguration(configuration);
}
catch (Throwable t) {
- throw new StructuredUpdateException(t);
+// throw new StructuredUpdateException(t);
+ throw new ConfigurationUpdateException(t.getMessage());
}
}
}
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
index c1ac859..e093d68 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
@@ -126,7 +126,8 @@ public class RawConfigManagementTest extends ConfigManagementTest {
rawConfigMgmt.executeUpdate(resourceId, config);
}
- @Test(expectedExceptions = {RawUpdateException.class})
+// @Test(expectedExceptions = {RawUpdateException.class})
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenValidationFailsForSingleRaw() throws Exception
{
final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
@@ -142,7 +143,8 @@ public class RawConfigManagementTest extends ConfigManagementTest {
rawConfigMgmt.executeUpdate(resourceId, config);
}
- @Test(expectedExceptions = {RawUpdateException.class})
+// @Test(expectedExceptions = {RawUpdateException.class})
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenUpdateFailsForSingleRaw() throws Exception {
final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
@@ -184,7 +186,8 @@ public class RawConfigManagementTest extends ConfigManagementTest {
rawConfigMgmt.executeUpdate(resourceId, config);
}
- @Test
+// @Test
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
public void secondRawShouldStillGetUpdatedWhenFirstRawFailsValidation() throws
Exception {
final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
final RawConfiguration raw2 = createRawConfiguration("/tmp/raw2.txt");
@@ -203,29 +206,32 @@ public class RawConfigManagementTest extends ConfigManagementTest {
oneOf(configFacet).persistRawConfiguration(raw2);
}});
- RawUpdateException exception = null;
-
- try {
- rawConfigMgmt.executeUpdate(resourceId, config);
- }
- catch (RawUpdateException e) {
- exception = e;
- }
-
- assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
- " validation fails");
-
- List<RawUpdateErrorDetail> errors = exception.getDetails();
+ rawConfigMgmt.executeUpdate(resourceId, config);
- assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
- assertEquals(
- errors.get(0).getRawConfiguration(),
- raw1,
- "Expected to find " + raw1 + " since validation for it
failed"
- );
+// RawUpdateException exception = null;
+//
+// try {
+// rawConfigMgmt.executeUpdate(resourceId, config);
+// }
+// catch (RawUpdateException e) {
+// exception = e;
+// }
+//
+// assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
+// " validation fails");
+//
+// List<RawUpdateErrorDetail> errors = exception.getDetails();
+//
+// assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
+// assertEquals(
+// errors.get(0).getRawConfiguration(),
+// raw1,
+// "Expected to find " + raw1 + " since validation for it
failed"
+// );
}
- @Test
+// @Test
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
public void secondRawShouldStillGetUpdateWhenFirstRawUpdateFails() throws Exception
{
final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
final RawConfiguration raw2 = createRawConfiguration("/tmp/raw2.txt");
@@ -246,29 +252,32 @@ public class RawConfigManagementTest extends ConfigManagementTest {
oneOf(configFacet).persistRawConfiguration(raw2);
}});
- RawUpdateException exception = null;
-
- try {
- rawConfigMgmt.executeUpdate(resourceId, config);
- }
- catch (RawUpdateException e) {
- exception = e;
- }
-
- assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
- " update fails");
-
- List<RawUpdateErrorDetail> errors = exception.getDetails();
+ rawConfigMgmt.executeUpdate(resourceId, config);
- assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
- assertEquals(
- errors.get(0).getRawConfiguration(),
- raw1,
- "Expected to find " + raw1 + " since update for it
failed"
- );
+// RawUpdateException exception = null;
+//
+// try {
+// rawConfigMgmt.executeUpdate(resourceId, config);
+// }
+// catch (RawUpdateException e) {
+// exception = e;
+// }
+//
+// assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
+// " update fails");
+//
+// List<RawUpdateErrorDetail> errors = exception.getDetails();
+//
+// assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
+// assertEquals(
+// errors.get(0).getRawConfiguration(),
+// raw1,
+// "Expected to find " + raw1 + " since update for it
failed"
+// );
}
- @Test
+// @Test
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
public void noUpdatesShouldHappenWhenValidationFailsForBothRaws() throws Exception {
final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
final RawConfiguration raw2 = createRawConfiguration("/tmp/raw2.txt");
@@ -285,23 +294,25 @@ public class RawConfigManagementTest extends ConfigManagementTest {
oneOf(configFacet).validateRawConfiguration(raw2); will(throwException(new
RuntimeException()));
}});
- RawUpdateException exception = null;
-
- try {
- rawConfigMgmt.executeUpdate(resourceId, config);
- }
- catch (RawUpdateException e) {
- exception = e;
- }
-
- assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
- " update fails");
-
- List<RawUpdateErrorDetail> errors = exception.getDetails();
+ rawConfigMgmt.executeUpdate(resourceId, config);
- assertEquals(errors.size(), 2, "Expected to find two errors since validation
failed for both raw config files");
- assertErrorDetailsContainsRawConfig(errors, raw1);
- assertErrorDetailsContainsRawConfig(errors, raw2);
+// RawUpdateException exception = null;
+//
+// try {
+// rawConfigMgmt.executeUpdate(resourceId, config);
+// }
+// catch (RawUpdateException e) {
+// exception = e;
+// }
+//
+// assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
+// " update fails");
+//
+// List<RawUpdateErrorDetail> errors = exception.getDetails();
+//
+// assertEquals(errors.size(), 2, "Expected to find two errors since
validation failed for both raw config files");
+// assertErrorDetailsContainsRawConfig(errors, raw1);
+// assertErrorDetailsContainsRawConfig(errors, raw2);
}
private void assertErrorDetailsContainsRawConfig(List<RawUpdateErrorDetail>
errors, RawConfiguration rawConfig) {
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
index b3b5882..b53fd00 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredAndRawConfigManagementTest.java
@@ -189,6 +189,86 @@ public class StructuredAndRawConfigManagementTest extends
ConfigManagementTest {
config.addRawConfiguration(raw1);
config.addRawConfiguration(raw2);
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateStructuredConfiguration(config);
+ oneOf(configFacet).persistStructuredConfiguration(config);
+
+ oneOf(configFacet).validateRawConfiguration(raw1);
+ oneOf(configFacet).persistRawConfiguration(raw1);
+
+ oneOf(configFacet).validateRawConfiguration(raw2);
+ oneOf(configFacet).persistRawConfiguration(raw2);
+ }});
+
+ structuredAndRawConfigManagement.executeUpdate(resourceId, config);
+ }
+
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
+ public void exceptionShouldBeThrownWhenStructuredValidationFails() throws Exception
{
+ final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateStructuredConfiguration(config);
will(throwException(new RuntimeException()));
+
+ oneOf(configFacet).validateRawConfiguration(raw);
+ oneOf(configFacet).persistRawConfiguration(raw);
+ }});
+
+ structuredAndRawConfigManagement.executeUpdate(resourceId, config);
+ }
+
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
+ public void exceptionShouldBeThrownWhenStructuredUpdateFails() throws Exception {
+ final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateStructuredConfiguration(config);
+ oneOf(configFacet).persistStructuredConfiguration(config);
will(throwException(new RuntimeException()));
+
+ oneOf(configFacet).validateRawConfiguration(raw);
+ oneOf(configFacet).persistRawConfiguration(raw);
+ }});
+
+ structuredAndRawConfigManagement.executeUpdate(resourceId, config);
+ }
+
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
+ public void structuredAndSecondRawShouldStillGetUpdatedWhenFirstRawValidationFails()
throws Exception {
+ final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
+ final RawConfiguration raw2 = createRawConfiguration("/tmp/raw2.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw1);
+ config.addRawConfiguration(raw2);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateStructuredConfiguration(config);
+ oneOf(configFacet).persistStructuredConfiguration(config);
+
+ oneOf(configFacet).validateRawConfiguration(raw1); will(throwException(new
RuntimeException()));
+
+ oneOf(configFacet).validateRawConfiguration(raw2);
+ oneOf(configFacet).persistRawConfiguration(raw2);
+ }});
+
+ structuredAndRawConfigManagement.executeUpdate(resourceId, config);
+ }
+
+ private void addDefaultExpectationsForUpdate() throws Exception {
final boolean isDaemonThread = false;
context.checking(new Expectations() {{
@@ -199,13 +279,7 @@ public class StructuredAndRawConfigManagementTest extends
ConfigManagementTest {
isDaemonThread,
onlyIfStarted);
will(returnValue(configFacet));
-
- oneOf(configFacet).persistStructuredConfiguration(config);
- oneOf(configFacet).persistRawConfiguration(raw1);
- oneOf(configFacet).persistRawConfiguration(raw2);
}});
-
- structuredAndRawConfigManagement.executeUpdate(resourceId, config);
}
}
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
index 5260ed5..43d5c73 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
@@ -128,7 +128,8 @@ public class StructuredConfigManagementTest extends
ConfigManagementTest {
structuredMgmt.executeUpdate(resourceId, config);
}
- @Test(expectedExceptions = {StructuredUpdateException.class})
+// @Test(expectedExceptions = {StructuredUpdateException.class})
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenValidationFails() throws Exception {
final Configuration config = new Configuration();
@@ -141,7 +142,8 @@ public class StructuredConfigManagementTest extends
ConfigManagementTest {
structuredMgmt.executeUpdate(resourceId, config);
}
- @Test(expectedExceptions = {StructuredUpdateException.class})
+// @Test(expectedExceptions = {StructuredUpdateException.class})
+ @Test(expectedExceptions = {ConfigurationUpdateException.class})
public void exceptionShouldBeThrownWhenUpdateFails() throws Exception {
final Configuration config = new Configuration();
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
index ea676c4..e0a5d64 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
@@ -76,7 +76,7 @@ class RawServer implements ResourceComponent, ResourceConfigurationFacet
{
}
void persistRawConfiguration(RawConfiguration rawConfiguration) {
- def failValidation =
resourceContext.pluginConfiguration.getSimple("failValidation")
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failUpdate")
if (failValidation.getBooleanValue()) {
throw new RuntimeException("Update failed for
${rawConfiguration.path}");
}
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index 5e19aee..359c615 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -8,10 +8,11 @@ import org.rhq.core.domain.configuration.Configuration
import org.rhq.core.domain.configuration.RawConfiguration
import org.rhq.core.domain.configuration.PropertySimple
import org.apache.commons.configuration.PropertiesConfiguration
-import groovy.util.AntBuilder
class StructuredAndRawServer implements ResourceComponent, ResourceConfigurationFacet {
+ ResourceContext resourceContext
+
File rawConfigDir
File rawConfig1
@@ -23,6 +24,8 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
def ant = new AntBuilder()
void start(ResourceContext context) {
+ resourceContext = context
+
rawConfigDir = new
File("${System.getProperty('java.io.tmpdir')}/raw-config-test")
rawConfig1 = new File(rawConfigDir, "structured-and-raw-test-1.txt")
rawConfig2 = new File(rawConfigDir, "structured-and-raw-test-2.txt")
@@ -148,15 +151,42 @@ class StructuredAndRawServer implements ResourceComponent,
ResourceConfiguration
}
void validateRawConfiguration(RawConfiguration rawConfig) {
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failRawValidation")
+ if (failValidation.getBooleanValue()) {
+ def fileNames =
resourceContext.pluginConfiguration.getSimple("filesToFailValidation").stringValue.split()
+ def match = fileNames.find { rawConfig.path.endsWith(it) }
+
+ if (match) {
+ throw new RuntimeException("Validation failed for ${rawConfig.path}");
+ }
+ }
}
void validateStructuredConfiguration(Configuration config) {
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failStructuredValidation")
+ if (failValidation.getBooleanValue()) {
+ throw new RuntimeException("Validation failed for $configuration");
+ }
}
void persistStructuredConfiguration(Configuration config) {
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failStructuredUpdate")
+ if (failValidation.getBooleanValue()) {
+ throw new RuntimeException("Update failed for $configuration");
+ }
}
void persistRawConfiguration(RawConfiguration rawConfig) {
+ def failUpdate =
resourceContext.pluginConfiguration.getSimple("failRawUpdate")
+ if (failUpdate.getBooleanValue()) {
+ def fileNames =
resourceContext.pluginConfiguration.getSimple("filesToFailUpdate").stringValue.split()
+ def match = fileNames.find { rawConfig.path.endsWith(it) }
+
+ if (match) {
+ throw new RuntimeException("Update failed for ${rawConfig.path}");
+ }
+ }
+
ant.copy(file: rawConfig.path, tofile: "${rawConfig.path}.orig")
ant.delete(file: rawConfig.path)
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
index d92714f..e210d8d 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
@@ -12,6 +12,8 @@ import groovy.util.AntBuilder
class StructuredServer implements ResourceComponent, ResourceConfigurationFacet {
+ ResourceContext resourceContext
+
File configDir
File structuredConfigFile
@@ -19,6 +21,8 @@ class StructuredServer implements ResourceComponent,
ResourceConfigurationFacet
def ant = new AntBuilder()
void start(ResourceContext context) {
+ resourceContext = context
+
configDir = new
File("${System.getProperty('java.io.tmpdir')}/raw-config-test")
structuredConfigFile = new File(configDir, "structured-test-1.txt")
@@ -73,6 +77,11 @@ class StructuredServer implements ResourceComponent,
ResourceConfigurationFacet
}
void persistStructuredConfiguration(Configuration configuration) {
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failUpdate")
+ if (failValidation.getBooleanValue()) {
+ throw new RuntimeException("Validation failed for $configuration");
+ }
+
ant.copy(file: structuredConfigFile.absolutePath, tofile:
"${structuredConfigFile.absolutePath}.orig")
ant.delete(file: structuredConfigFile)
@@ -89,6 +98,10 @@ class StructuredServer implements ResourceComponent,
ResourceConfigurationFacet
}
void validateStructuredConfiguration(Configuration configuration) {
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failValidation")
+ if (failValidation.getBooleanValue()) {
+ throw new RuntimeException("Validation failed for $configuration");
+ }
}
void validateRawConfiguration(RawConfiguration rawConfiguration) {
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index e43262b..e59d833 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -14,6 +14,24 @@
class="StructuredAndRawServer"
discovery="StructuredAndRawDiscoveryComponent"
description="A fake server component that supports both structured and raw
configuration">
+
+ <plugin-configuration>
+ <c:simple-property name="faidStructuredValidation"
type="boolean" default="false"/>
+ <c:simple-property name="failStructuredUpdate"
type="boolean" default="false"/>
+
+ <c:simple-property name="failRawValidation" type="boolean"
default="false"/>
+ <c:simple-property name="filesToFailValidation"
+ description="A comma-delimited list of file names for which
validation will fail. The entire
+ path does not need to be specified. Simple matching
will be done starting from
+ the end of the path. For a path of /foo/bar.txt,
you could specify bar.txt."/>
+
+ <c:simple-property name="failRawUpdate" type="boolean"
default="false"/>
+ <c:simple-property name="filesToFailUpdate"
+ description="A comma-delimited list of file names for which
the update will fail. The entire
+ path does not need to be specified. Simple matching
will be done starting from
+ the end of the path. For a path of /foo/bar.txt,
you could specify bar.txt."/>
+ </plugin-configuration>
+
<resource-configuration configurationFormat="both">
<c:simple-property name="x"/>
<c:simple-property name="y"/>
diff --git
a/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawConfigServerTest.groovy
b/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawConfigServerTest.groovy
deleted file mode 100644
index 52b9b68..0000000
---
a/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawConfigServerTest.groovy
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.rhq.plugins.test.rawconfig
-/**
- * Created by IntelliJ IDEA.
- * User: john
- * Date: Nov 13, 2009
- * Time: 8:26:14 AM
- * To change this template use File | Settings | File Templates.
- */
-
-public class RawConfigServerTest {
-
-}
\ No newline at end of file
diff --git
a/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy
b/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy
index ebb84c2..efaa475 100644
---
a/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy
+++
b/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy
@@ -5,7 +5,7 @@ import org.rhq.core.domain.configuration.RawConfiguration
class RawServerTest {
- @Test
+// @Test
void testPersistRawConfiguration() {
def rawFileName = "raw-test.txt"
def rawFile = new File(confDir, rawFileName)
commit 71f8eebf06f34e3fb3f83270ae41968356555e0f
Merge: e505346... 28dbc2f...
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 6 02:05:32 2010 -0500
Merge branch 'raw-config' of
ssh://git.fedorahosted.org/git/rhq/rhq into
raw-config
commit e50534652de3a0d177ad55a8252ed586d601ae1c
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 6 02:02:30 2010 -0500
[US 7] Adding initial support in test plugin for validation
Validation/update failure can be turned on or off through the resource's
connection
properties. Currently implemented for RawServer.
diff --git
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
index 9acbbd8..ea676c4 100644
---
a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
+++
b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
@@ -10,6 +10,8 @@ import groovy.util.AntBuilder
class RawServer implements ResourceComponent, ResourceConfigurationFacet {
+ ResourceContext resourceContext
+
File rawConfigDir
File rawConfig1
@@ -17,6 +19,8 @@ class RawServer implements ResourceComponent, ResourceConfigurationFacet
{
def ant = new AntBuilder()
void start(ResourceContext context) {
+ resourceContext = context;
+
ant = new AntBuilder()
rawConfigDir = new
File("${System.getProperty('java.io.tmpdir')}/raw-config-test")
@@ -72,6 +76,11 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
}
void persistRawConfiguration(RawConfiguration rawConfiguration) {
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failValidation")
+ if (failValidation.getBooleanValue()) {
+ throw new RuntimeException("Update failed for
${rawConfiguration.path}");
+ }
+
ant.copy(file: rawConfiguration.path, tofile:
"${rawConfiguration.path}.orig")
ant.delete(file: rawConfiguration.path)
@@ -84,6 +93,10 @@ class RawServer implements ResourceComponent,
ResourceConfigurationFacet {
}
void validateRawConfiguration(RawConfiguration rawConfiguration) {
+ def failValidation =
resourceContext.pluginConfiguration.getSimple("failValidation")
+ if (failValidation.getBooleanValue()) {
+ throw new RuntimeException("Validation failed for
${rawConfiguration.path}");
+ }
}
}
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index 897e4f3..e43262b 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -29,6 +29,12 @@
class="RawServer"
discovery="RawDiscoveryComponent"
description="A fake server component that supports raw
configuration">
+
+ <plugin-configuration>
+ <c:simple-property name="failValidation" type="boolean"
default="false"/>
+ <c:simple-property name="failUpdate" type="boolean"
default="false"/>
+ </plugin-configuration>
+
<resource-configuration configurationFormat="raw"/>
</server>
@@ -36,6 +42,12 @@
class="StructuredServer"
discovery="StructuredDiscoveryComponent"
description="A fake server component that supports structured
configuration">
+
+ <plugin-configuration>
+ <c:simple-property name="failValidation" type="boolean"
default="false"/>
+ <c:simple-property name="failUpdate" type="boolean"
default="false"/>
+ </plugin-configuration>
+
<resource-configuration configurationFormat="structured">
<c:simple-property name="foo"/>
<c:simple-property name="bar"/>
commit 1e94edabaa930c09d6bc30ae170d389436dfc102
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Jan 6 01:59:38 2010 -0500
[US 7] Adding initial support for validation of raw config in plugin container
This commit adds initial validation support for raw only and structured only. Still
need
to add support for structured and raw and send back validation errors as an xml
document
that can be easily parsed and displayed in the UI.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
index 5514784..1a9b21c 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawConfigManagement.java
@@ -33,6 +33,8 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Set;
public class RawConfigManagement extends ConfigManagementSupport {
@@ -65,10 +67,21 @@ public class RawConfigManagement extends ConfigManagementSupport {
throws PluginContainerException {
ResourceConfigurationFacet facet =
loadResourceConfigFacetWithWriteLock(resourceId);
+ List<RawUpdateErrorDetail> errors = new
LinkedList<RawUpdateErrorDetail>();
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
- facet.persistRawConfiguration(rawConfig);
+ try {
+ facet.validateRawConfiguration(rawConfig);
+ facet.persistRawConfiguration(rawConfig);
+ }
+ catch (Throwable t) {
+ // TODO Might want to specify in the error detail whether the validate or
update call failed
+ errors.add(new RawUpdateErrorDetail(rawConfig, t));
+ }
}
+ if (errors.size() > 0) {
+ throw new RawUpdateException(errors);
+ }
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateErrorDetail.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateErrorDetail.java
new file mode 100644
index 0000000..7e8f9ca
--- /dev/null
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateErrorDetail.java
@@ -0,0 +1,57 @@
+/*
+ * 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.pc.configuration;
+
+import org.rhq.core.domain.configuration.RawConfiguration;
+
+public class RawUpdateErrorDetail {
+
+ private RawConfiguration rawConfig;
+
+ private Throwable error;
+
+ public RawUpdateErrorDetail() {
+ }
+
+ public RawUpdateErrorDetail(RawConfiguration rawConfig, Throwable error) {
+ this.rawConfig = rawConfig;
+ this.error = error;
+ }
+
+ public RawConfiguration getRawConfiguration() {
+ return rawConfig;
+ }
+
+ public void setRawConfiguration(RawConfiguration rawConfig) {
+ this.rawConfig = rawConfig;
+ }
+
+ public Throwable getError() {
+ return error;
+ }
+
+ public void setError(Throwable error) {
+ this.error = error;
+ }
+}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateException.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateException.java
new file mode 100644
index 0000000..22ba9f1
--- /dev/null
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/RawUpdateException.java
@@ -0,0 +1,53 @@
+/*
+ * 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.pc.configuration;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class RawUpdateException extends ConfigurationUpdateException {
+
+ private List<RawUpdateErrorDetail> details = new
LinkedList<RawUpdateErrorDetail>();
+
+ public RawUpdateException(List<RawUpdateErrorDetail> errors) {
+ details = errors;
+ }
+
+ public RawUpdateException(String message, List<RawUpdateErrorDetail> errors) {
+ super(message);
+ details = errors;
+ }
+
+ public RawUpdateException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public RawUpdateException(Throwable cause) {
+ super(cause);
+ }
+
+ public List<RawUpdateErrorDetail> getDetails() {
+ return details;
+ }
+}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
index f807e72..7cd57b7 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredConfigManagement.java
@@ -68,8 +68,13 @@ public class StructuredConfigManagement extends ConfigManagementSupport
{
}
public void executeUpdate(int resourceId, Configuration configuration) throws
PluginContainerException {
- ResourceConfigurationFacet facet =
loadResourceConfigFacetWithWriteLock(resourceId);
-
- facet.persistStructuredConfiguration(configuration);
+ try {
+ ResourceConfigurationFacet facet =
loadResourceConfigFacetWithWriteLock(resourceId);
+ facet.validateStructuredConfiguration(configuration);
+ facet.persistStructuredConfiguration(configuration);
+ }
+ catch (Throwable t) {
+ throw new StructuredUpdateException(t);
+ }
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredUpdateException.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredUpdateException.java
new file mode 100644
index 0000000..c0ba380
--- /dev/null
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/StructuredUpdateException.java
@@ -0,0 +1,43 @@
+/*
+ * 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.pc.configuration;
+
+public class StructuredUpdateException extends ConfigurationUpdateException {
+
+ public StructuredUpdateException() {
+ super();
+ }
+
+ public StructuredUpdateException(String message) {
+ super(message);
+ }
+
+ public StructuredUpdateException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StructuredUpdateException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
index 8d1ec7a..c1ac859 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/RawConfigManagementTest.java
@@ -23,6 +23,7 @@
package org.rhq.core.pc.configuration;
+import static org.testng.Assert.*;
import static java.util.Collections.EMPTY_SET;
import org.jmock.Expectations;
@@ -34,6 +35,7 @@ import static org.testng.Assert.assertNull;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.List;
import java.util.Set;
public class RawConfigManagementTest extends ConfigManagementTest {
@@ -116,12 +118,48 @@ public class RawConfigManagementTest extends ConfigManagementTest {
addDefaultExpectationsForUpdate();
context.checking(new Expectations() {{
+ oneOf(configFacet).validateRawConfiguration(raw);
+
oneOf(configFacet).persistRawConfiguration(raw);
}});
rawConfigMgmt.executeUpdate(resourceId, config);
}
+ @Test(expectedExceptions = {RawUpdateException.class})
+ public void exceptionShouldBeThrownWhenValidationFailsForSingleRaw() throws Exception
{
+ final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateRawConfiguration(raw); will(throwException(new
RuntimeException()));
+ }});
+
+ rawConfigMgmt.executeUpdate(resourceId, config);
+ }
+
+ @Test(expectedExceptions = {RawUpdateException.class})
+ public void exceptionShouldBeThrownWhenUpdateFailsForSingleRaw() throws Exception {
+ final RawConfiguration raw = createRawConfiguration("/tmp/raw.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateRawConfiguration(raw);
+
+ oneOf(configFacet).persistRawConfiguration(raw); will(throwException(new
RuntimeException()));
+ }});
+
+ rawConfigMgmt.executeUpdate(resourceId, config);
+ }
+
@Test
public void facetShouldBeCalledToUpdateMultipleRaws() throws Exception {
final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
@@ -134,13 +172,147 @@ public class RawConfigManagementTest extends ConfigManagementTest
{
addDefaultExpectationsForUpdate();
context.checking(new Expectations() {{
+ oneOf(configFacet).validateRawConfiguration(raw1);
+
oneOf(configFacet).persistRawConfiguration(raw1);
+
+ oneOf(configFacet).validateRawConfiguration(raw2);
+
oneOf(configFacet).persistRawConfiguration(raw2);
}});
rawConfigMgmt.executeUpdate(resourceId, config);
}
+ @Test
+ public void secondRawShouldStillGetUpdatedWhenFirstRawFailsValidation() throws
Exception {
+ final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
+ final RawConfiguration raw2 = createRawConfiguration("/tmp/raw2.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw1);
+ config.addRawConfiguration(raw2);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateRawConfiguration(raw1); will(throwException(new
RuntimeException()));
+
+ oneOf(configFacet).validateRawConfiguration(raw2);
+
+ oneOf(configFacet).persistRawConfiguration(raw2);
+ }});
+
+ RawUpdateException exception = null;
+
+ try {
+ rawConfigMgmt.executeUpdate(resourceId, config);
+ }
+ catch (RawUpdateException e) {
+ exception = e;
+ }
+
+ assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
+ " validation fails");
+
+ List<RawUpdateErrorDetail> errors = exception.getDetails();
+
+ assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
+ assertEquals(
+ errors.get(0).getRawConfiguration(),
+ raw1,
+ "Expected to find " + raw1 + " since validation for it
failed"
+ );
+ }
+
+ @Test
+ public void secondRawShouldStillGetUpdateWhenFirstRawUpdateFails() throws Exception
{
+ final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
+ final RawConfiguration raw2 = createRawConfiguration("/tmp/raw2.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw1);
+ config.addRawConfiguration(raw2);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateRawConfiguration(raw1);
+
+ oneOf(configFacet).persistRawConfiguration(raw1); will(throwException(new
RuntimeException()));
+
+ oneOf(configFacet).validateRawConfiguration(raw2);
+
+ oneOf(configFacet).persistRawConfiguration(raw2);
+ }});
+
+ RawUpdateException exception = null;
+
+ try {
+ rawConfigMgmt.executeUpdate(resourceId, config);
+ }
+ catch (RawUpdateException e) {
+ exception = e;
+ }
+
+ assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
+ " update fails");
+
+ List<RawUpdateErrorDetail> errors = exception.getDetails();
+
+ assertEquals(errors.size(), 1, "Expected to find only a single error since
only the update of one raw failed");
+ assertEquals(
+ errors.get(0).getRawConfiguration(),
+ raw1,
+ "Expected to find " + raw1 + " since update for it
failed"
+ );
+ }
+
+ @Test
+ public void noUpdatesShouldHappenWhenValidationFailsForBothRaws() throws Exception {
+ final RawConfiguration raw1 = createRawConfiguration("/tmp/raw1.txt");
+ final RawConfiguration raw2 = createRawConfiguration("/tmp/raw2.txt");
+
+ final Configuration config = new Configuration();
+ config.addRawConfiguration(raw1);
+ config.addRawConfiguration(raw2);
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateRawConfiguration(raw1); will(throwException(new
RuntimeException()));
+
+ oneOf(configFacet).validateRawConfiguration(raw2); will(throwException(new
RuntimeException()));
+ }});
+
+ RawUpdateException exception = null;
+
+ try {
+ rawConfigMgmt.executeUpdate(resourceId, config);
+ }
+ catch (RawUpdateException e) {
+ exception = e;
+ }
+
+ assertNotNull(exception, "Expected a " +
RawUpdateException.class.getSimpleName() + " to be thrown when " +
+ " update fails");
+
+ List<RawUpdateErrorDetail> errors = exception.getDetails();
+
+ assertEquals(errors.size(), 2, "Expected to find two errors since validation
failed for both raw config files");
+ assertErrorDetailsContainsRawConfig(errors, raw1);
+ assertErrorDetailsContainsRawConfig(errors, raw2);
+ }
+
+ private void assertErrorDetailsContainsRawConfig(List<RawUpdateErrorDetail>
errors, RawConfiguration rawConfig) {
+ for (RawUpdateErrorDetail detail : errors) {
+ if (detail.getRawConfiguration().equals(rawConfig)) {
+ return;
+ }
+ }
+ fail("Expected to find " + rawConfig + " in update error
details");
+ }
+
private void addDefaultExpectationsForUpdate() throws Exception {
final boolean isDaemonThread = false;
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
index 9b24df7..5260ed5 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/StructuredConfigManagementTest.java
@@ -74,8 +74,6 @@ public class StructuredConfigManagementTest extends ConfigManagementTest
{
@Test
public void nullShouldBeReturnedWhenStructuredIsNull() throws Exception {
- final Configuration config = null;
-
context.checking(new Expectations() {{
atLeast(1).of(componentService).getComponent(resourceId,
ResourceConfigurationFacet.class,
@@ -117,8 +115,48 @@ public class StructuredConfigManagementTest extends
ConfigManagementTest {
@Test
public void facetShouldBeCalledToUpdateStructured() throws Exception {
- final Configuration structuredConfig = new Configuration();
+ final Configuration config = new Configuration();
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateStructuredConfiguration(config);
+
+ oneOf(configFacet).persistStructuredConfiguration(config);
+ }});
+
+ structuredMgmt.executeUpdate(resourceId, config);
+ }
+
+ @Test(expectedExceptions = {StructuredUpdateException.class})
+ public void exceptionShouldBeThrownWhenValidationFails() throws Exception {
+ final Configuration config = new Configuration();
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateStructuredConfiguration(config);
will(throwException(new RuntimeException()));
+ }});
+
+ structuredMgmt.executeUpdate(resourceId, config);
+ }
+
+ @Test(expectedExceptions = {StructuredUpdateException.class})
+ public void exceptionShouldBeThrownWhenUpdateFails() throws Exception {
+ final Configuration config = new Configuration();
+
+ addDefaultExpectationsForUpdate();
+
+ context.checking(new Expectations() {{
+ oneOf(configFacet).validateStructuredConfiguration(config);
+
+ oneOf(configFacet).persistStructuredConfiguration(config);
will(throwException(new RuntimeException()));
+ }});
+ structuredMgmt.executeUpdate(resourceId, config);
+ }
+
+ private void addDefaultExpectationsForUpdate() throws Exception {
final boolean isDaemonThread = false;
context.checking(new Expectations() {{
@@ -129,11 +167,7 @@ public class StructuredConfigManagementTest extends
ConfigManagementTest {
isDaemonThread,
onlyIfStarted);
will(returnValue(configFacet));
-
- oneOf(configFacet).persistStructuredConfiguration(structuredConfig);
}});
-
- structuredMgmt.executeUpdate(resourceId, structuredConfig);
}
}
commit 28dbc2fc74f2b27dd8d829b15a9d463b20077bde
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Jan 5 20:50:04 2010 -0500
minor tweaks for spacing and removing the controls from the xhtml test page.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
index 89e12be..3bcf887 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
@@ -136,6 +136,7 @@ function MultiFileEdit() {
document.write("<tr id='file-row-" + i + "'class='"
+ divclass
+ "'>");
document.write("<td>");
+ document.write("<span style=\"visibility:hidden; \" > XX
</span>");
document.write("<span id='dirty-span-" + i
+ "' style=\"visibility:hidden;\" > * </span>");
document.write("</td><td>");
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
index 4bca60b..1db3aee 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
@@ -22,8 +22,6 @@ THIS TEXT WILL BE REMOVED.
<a href="view-raw-config.xhtml">View</a>
<form id="testForm">
<onc:multifile></onc:multifile>
- <input type="submit" value="Commit"/>
- <input type="reset" onclick="multiFileEdit.resetArchive();"
/>
</form>
</ui:define>
</ui:composition>
commit 00aaa905fd6f524df1e626ca206dbb63571de62b
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Jan 5 20:40:38 2010 -0500
Fixed the Undo button colors and made the entire rendered area into a table, including
the submit and reset buttons.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
index 6de5fe8..89e12be 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
@@ -34,7 +34,6 @@ function MultiFileEdit() {
}
}
}
-
this.setTextAreaValue = function(id) {
if (this.currentIndex % 2 == 0) {
@@ -59,20 +58,15 @@ function MultiFileEdit() {
document.getElementById("reset-span-" + i).style.visibility =
"hidden";
}
}
-
this.resetFile = function(index){
-
if (index >= this.originalCopies.length) return;
if (index < 0 ) return;
var original = this.originalCopies[index];
this.archive[index] = new ArchiveFile(original.path,original.contents);
-
document.getElementById("dirty-span-" + index).style.visibility =
"hidden";
document.getElementById("reset-span-" + index).style.visibility =
"hidden";
-
this.setTextAreaValue(index);
-
}
function askConfirm() {
@@ -80,7 +74,6 @@ function MultiFileEdit() {
}
this.updateArchive = function() {
-
window.onbeforeunload = askConfirm;
this.archive[this.currentIndex].contents = document
.getElementById("testForm").textarea.value;
@@ -89,14 +82,48 @@ function MultiFileEdit() {
document.getElementById("reset-span-" + this.currentIndex).style.visibility =
"visible";
}
+ this.download= function() {
+ var generator = window.open(this.downloadUrl,'');
+ }
+
+ this.upload = function(){
+ alert("upload called");
+ }
+
+ this.commit = function(){
+ alert("commit called");
+ return false;
+ }
+
+ this.drawStyleSheet = function(){
+ document.write("<style type=\"text/css\">");
+ document.write("td.multi-edit-table {");
+ document.write("vertical-align: top;");
+ document.write("valign: top;");
+ document.write("height: = 300;");
+ document.write("}");
+ document.write("tr.EvenRow {")
+ document.write("background-color:#a4b2b9;");
+ document.write("}");
+ document.write("tr.OddRow {");
+ document.write("background-color:grey;");
+ document.write("}");
+ document.write("tr.SelectedRow {");
+ document.write("background-color:white;");
+ document.write("}");
+ document.write("span.reset {");
+ document.write("background-color:grey; color:white; visibility:hidden; ");
+ document.write("}");
+
+ document.write("</style>");
+ }
+
this.generateLinks = function() {
var i = 0;
var style = 0;
var divclass = "";
- document
- .write("<table BORDER=0 RULES=NONE
FRAME=BOX><th><td>Configuration File
Paths</td><td></td></th>");
+ document.write("<table BORDER=0 RULES=NONE
FRAME=BOX><th><td>Configuration File
Paths</td><td></td></th>");
for (i = 0; i < multiFileEdit.archive.length; i++) {
-
if (i == 0) {
divclass = "SelectedRow"
} else if (style != 0) {
@@ -106,49 +133,27 @@ function MultiFileEdit() {
style = 1;
divclass = "EvenRow"
}
-
document.write("<tr id='file-row-" + i + "'class='"
+ divclass
+ "'>");
document.write("<td>");
document.write("<span id='dirty-span-" + i
+ "' style=\"visibility:hidden;\" > * </span>");
document.write("</td><td>");
- document
- .write("<a href=\"#\"
onclick='multiFileEdit.setTextAreaValue("
+ document.write("<a href=\"#\"
onclick='multiFileEdit.setTextAreaValue("
+ i + ")' >" + multiFileEdit.archive[i].path);
document.write("</a>");
-
- document.write(" <span id='reset-span-" + i
- + "' style=\"visibility:hidden;\" >");
- document.write("<a href='#' onclick='
multiFileEdit.resetFile("+i+");' >reset</a> </span>");
-
-
+ document.write("<span class='reset' id='reset-span-" + i +
"' ");
+ document.write(" onmouseup='
multiFileEdit.resetFile("+i+");'>");
+ document.write(" Undo</span>");
document.write("</td></tr>");
}
document.write("</table>");
-
}
this.drawTable = function() {
this.initializeArchive();
+ this.drawStyleSheet();
- document.write("<style type=\"text/css\">");
- document.write("td.multi-edit-table {");
- document.write("vertical-align: top;");
- document.write("valign: top;");
- document.write("height: = 300;");
- document.write("}");
- document.write("tr.EvenRow {")
- document.write("background-color:#a4b2b9;");
- document.write("}");
- document.write("tr.OddRow {");
- document.write("background-color:grey;");
- document.write("}");
- document.write("tr.SelectedRow {");
- document.write("background-color:white;");
- document.write("}");
-
- document.write("</style>");
document
.write("<table class='multi-edit-table' border='0'
cellpadding='0' >");
document.write("<tbody>");
@@ -175,16 +180,29 @@ function MultiFileEdit() {
.write("onkeyup='multiFileEdit.updateArchive();' cols='80'
rows='25'>");
document.write(multiFileEdit.archive[0].contents);
document.write("</textarea>");
-
- document.write("<div>upload New Version</div>");
- document.write("<div>Select A File: <input type='file'
onchange='alert(\"onchange called\");' /> </div>");
-
- document.write("</form>");
+ if (!this.disabled){
+ document.write("<div>upload New Version</div>");
+ document.write("<div>Select A File: <input type='file'
onchange='multiFileEdit.upload();' /> </div>");
+ }
document.write("</td>");
document.write("</tr>");
+
+ document.write("<tr>");
+ document.write("<td>");
+ if (!this.disabled){
+ document.write("<input type='submit' value='commit'
onclick='multiFileEdit.commit();'/>");
+ document.write("<input type='reset'
onclick='multiFileEdit.resetArchive();' />");
+ }
+ document.write("</td>");
+ document.write("<td></td>");
+ document.write("</tr>");
+
document.write("</tbody>");
document.write("</table>");
+
+
+
}
@@ -219,9 +237,6 @@ function MultiFileEdit() {
generator.document.close();
}
- this.download= function() {
- var generator = window.open(this.downloadUrl,'');
- }
}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
index 4acac4b..d860d1a 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
@@ -23,10 +23,8 @@
multiFileEdit.downloadUrl = "download.html";
multiFileEdit.drawTable();
-</script> <input type="submit" /><input type="reset"
- onclick="multiFileEdit.resetArchive();" /></form>
-
-
-
+</script>
+
+</form>
</body>
</html>
\ No newline at end of file
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
index c1084fa..a6d15d3 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
@@ -1,17 +1,31 @@
<html><head><title>Next Page,</title>
</head>
-<body>View Results
+<body>
<a href="edit.html">Edit</a>
-<script language="JavaScript" type="text/javascript"
src="multi-file-edit.js"></script>
+
+<form id="testForm" name="viewTestConfigurationForm"
method="post"
+ action="view.html" enctype="application/x-www-form-urlencoded">
+
+<script language="JavaScript" type="text/javascript"
+ src="../../../../js/multi-file-edit.js"></script>
<form id="testForm" name="viewTestConfigurationForm"
method="post"
action="view.html" enctype="application/x-www-form-urlencoded">
<script type="text/javascript">
-var multiFileEdit = new MultiFileEdit();
-multiFileEdit.disabled=1;
-multiFileEdit.drawTable();
+ var multiFileEdit = new MultiFileEdit();
+ multiFileEdit.disabled=1;
+
+ for (i=0; i < 6 ;i++)
+ {
+ multiFileEdit.addArchive("/tmp/file/"+i,
+ "/tmp/file"+i +" archive = "+ i);
+ }
+ multiFileEdit.downloadUrl = "download.html";
+ multiFileEdit.drawTable();
+
</script>
+
</form>
</html>
commit 251585325bba4f982a779a6c1289bb40eab067f6
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Jan 5 17:19:26 2010 -0500
added reset on file by file basis. Added Renderer and component for MultiFile, and
changed the names in the tag library. The RawConfigRenderer and ConfigUIComponent are
still there, but have no component names or tags
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileRenderer.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileRenderer.java
new file mode 100644
index 0000000..ada4926
--- /dev/null
+++
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileRenderer.java
@@ -0,0 +1,70 @@
+/*
+ * 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.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+/**
+ * A renderer that renders an {@link RawConfigurationComponent} component as XHTML.
+ *
+ * @author Adam Young
+ */
+public class MultiFileRenderer extends Renderer {
+
+ @Override
+ public void decode(FacesContext context, UIComponent component) {
+ super.decode(context, component);
+ }
+
+ @Override
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component) throws
IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer
+ .write("<script language=\"JavaScript\"
type=\"text/javascript\" src=\"/js/multi-file-edit.js\"
></script>\n");
+
+ writer.write("<script type=\"text/javascript\">\n");
+ writer.write("var multiFileEdit = new MultiFileEdit();\n");
+
+ for (int i = 0; i < 6; i++) {
+ writer.write("multiFileEdit.addArchive(\"/tmp/file/" + i +
"\",\"/tmp/file" + i + " archive = " + i
+ + "\");");
+ }
+
+ writer.write("multiFileEdit.downloadUrl =
\"download.jsp\";\n");
+
+ writer.write("multiFileEdit.drawTable();\n");
+ writer.write("</script>\n");
+
+ }
+}
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileUIComponent.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileUIComponent.java
new file mode 100644
index 0000000..07acaab
--- /dev/null
+++
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/MultiFileUIComponent.java
@@ -0,0 +1,38 @@
+/*
+ * 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 javax.faces.component.UIComponentBase;
+
+/**
+ * @author Adam Young
+ */
+public class MultiFileUIComponent extends UIComponentBase {
+
+ private static final String family = "rhq";
+
+ @Override
+ public String getFamily() {
+ return family;
+ }
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
index 8bb4c13..49345f6 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
@@ -10,16 +10,14 @@
</component>
<component>
- <component-type>org.jboss.on.RawConfig</component-type>
-
<component-class>org.rhq.core.gui.configuration.RawConfigUIComponent</component-class>
+ <component-type>org.jboss.on.MultiFile</component-type>
+
<component-class>org.rhq.core.gui.configuration.MultiFileUIComponent</component-class>
</component>
-
-
- <component>
- <component-type>org.rhq.ConfigurationSet</component-type>
-
<component-class>org.rhq.core.gui.configuration.propset.ConfigurationSetComponent</component-class>
- </component>
+ <component>
+ <component-type>org.rhq.ConfigurationSet</component-type>
+
<component-class>org.rhq.core.gui.configuration.propset.ConfigurationSetComponent</component-class>
+ </component>
<render-kit>
<renderer>
@@ -30,10 +28,10 @@
</renderer>
<renderer>
- <description>renderer for Raw Config components</description>
+ <description>renderer for Multi-File Editor</description>
<component-family>rhq</component-family>
- <renderer-type>org.jboss.on.RawConfig</renderer-type>
-
<renderer-class>org.rhq.core.gui.configuration.RawConfigRenderer</renderer-class>
+ <renderer-type>org.jboss.on.MultiFile</renderer-type>
+
<renderer-class>org.rhq.core.gui.configuration.MultiFileRenderer</renderer-class>
</renderer>
</render-kit>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tags/on.component.taglib.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tags/on.component.taglib.xml
index 0870441..1fc9928 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tags/on.component.taglib.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tags/on.component.taglib.xml
@@ -65,10 +65,10 @@
</tag>
<tag>
- <tag-name>rawconfig</tag-name>
+ <tag-name>multifile</tag-name>
<component>
- <component-type>org.jboss.on.RawConfig</component-type>
- <renderer-type>org.jboss.on.RawConfig</renderer-type>
+ <component-type>org.jboss.on.MultiFile</component-type>
+ <renderer-type>org.jboss.on.MultiFile</renderer-type>
</component>
</tag>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
index c474326..6de5fe8 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
@@ -1,103 +1,137 @@
-function ArchiveFile(p,c) {
- this.path = p;
- this.dirty = 0;
- this.contents = c;
+function ArchiveFile(p, c) {
+ this.path = p;
+ this.dirty = 0;
+ this.contents = c;
}
-
-
-
-
/*
* This is a class for editing a collection of files, represented by a map.
- * There is a list of links in the left column, each which represent a file,
- * a textarea input that changes based on which link is selected
+ * There is a list of links in the left column, each which represent a file, a
+ * textarea input that changes based on which link is selected
*/
-function MultiFileEdit(){
+function MultiFileEdit() {
this.currentIndex = 0;
- this.isDirty = 0;
- this.archive = new Array();
- this.disabled=0;
+ this.archive = [];
+ this.originalCopies = [];
+ this.disabled = 0;
+ this.uploadUrl = "upload.html";
+ this.downloadUrl = "#";
- this.initializeArchive = function(){
- var i=0;
- for (i=0; i < 6 ;i++)
- {
- this.archive[i] = new ArchiveFile("/tmp/file/"+i, "/tmp/file/"+i
+" archive = "+ this.archive.length);
+
+ this.addArchive = function(p,c){
+ this.originalCopies.push( new ArchiveFile(p,c));
+ }
+
+ this.initializeArchive = function() {
+ this.archive = [];
+ if ( this.originalCopies.length < 1){
+ this.archive.push(new ArchiveFile("/dev/null","No files
specified"));
+ }else {
+ var i;
+ for (i=0; i < this.originalCopies.length ;i++){
+ var original = this.originalCopies[i];
+ this.archive.push(new ArchiveFile(original.path,original.contents));
+ }
}
}
- this.setTextAreaValue = function(id)
- {
- if (this.currentIndex % 2 == 0){
- document.getElementById("file-row-"+this.currentIndex).className =
"OddRow";
- }else{
- document.getElementById("file-row-"+this.currentIndex).className =
"EvenRow";
+
+ this.setTextAreaValue = function(id) {
+ if (this.currentIndex % 2 == 0) {
+ document.getElementById("file-row-" + this.currentIndex).className =
"OddRow";
+ } else {
+ document.getElementById("file-row-" + this.currentIndex).className =
"EvenRow";
}
-
+
this.currentIndex = id;
document.getElementById("testForm").textarea.value =
multiFileEdit.archive[this.currentIndex].contents;
- document.getElementById("file-row-"+id).className =
"SelectedRow";
+ document.getElementById("file-row-" + id).className =
"SelectedRow";
document.getElementById("testForm").textarea.focus();
document.getElementById("current-path-span").firstChild.data =
multiFileEdit.archive[this.currentIndex].path;
}
-
-
- this.resetArchive = function(){
+
+ this.resetArchive = function() {
this.initializeArchive();
this.setTextAreaValue(0);
- this.isDirty = 0;
- for (i=0; i < this.archive.length ;i++)
- {
- document.getElementById("dirty-span-"+i).style.visibility="hidden";
+ window.onbeforeunload = 0;
+ for (i = 0; i < this.archive.length; i++) {
+ document.getElementById("dirty-span-" + i).style.visibility =
"hidden";
+ document.getElementById("reset-span-" + i).style.visibility =
"hidden";
}
}
- function askConfirm(){
+
+ this.resetFile = function(index){
+
+ if (index >= this.originalCopies.length) return;
+ if (index < 0 ) return;
+ var original = this.originalCopies[index];
+ this.archive[index] = new ArchiveFile(original.path,original.contents);
+
+ document.getElementById("dirty-span-" + index).style.visibility =
"hidden";
+ document.getElementById("reset-span-" + index).style.visibility =
"hidden";
+
+ this.setTextAreaValue(index);
+
+ }
+
+ function askConfirm() {
return "You have unsaved changes.";
}
-
- this.updateArchive = function(){
-
+ this.updateArchive = function() {
+
window.onbeforeunload = askConfirm;
-
- this.isDirty = 1;
- this.archive[this.currentIndex].contents =
document.getElementById("testForm").textarea.value;
+ this.archive[this.currentIndex].contents = document
+ .getElementById("testForm").textarea.value;
this.archive[this.currentIndex].dirty = 1;
- document.getElementById("dirty-span-"+this.currentIndex).style.visibility="visible";
- }
+ document.getElementById("dirty-span-" + this.currentIndex).style.visibility =
"visible";
+ document.getElementById("reset-span-" + this.currentIndex).style.visibility =
"visible";
+ }
- this.generateLinks = function(){
- var i=0;
- var style =0;
+ this.generateLinks = function() {
+ var i = 0;
+ var style = 0;
var divclass = "";
- document.write("<table BORDER=0 RULES=NONE
FRAME=BOX><th><td>Configuration File
Paths</td><td></td></th>");
- for (i=0; i < multiFileEdit.archive.length ;i++){
-
- if (i == 0){
- divclass="SelectedRow"
- }else if (style != 0){
+ document
+ .write("<table BORDER=0 RULES=NONE
FRAME=BOX><th><td>Configuration File
Paths</td><td></td></th>");
+ for (i = 0; i < multiFileEdit.archive.length; i++) {
+
+ if (i == 0) {
+ divclass = "SelectedRow"
+ } else if (style != 0) {
style = 0;
- divclass="OddRow"
- }else{
+ divclass = "OddRow"
+ } else {
style = 1;
- divclass="EvenRow"
+ divclass = "EvenRow"
}
-
- document.write("<tr id='file-row-"+i+"'class='"+
divclass +"'>");
+
+ document.write("<tr id='file-row-" + i + "'class='"
+ divclass
+ + "'>");
document.write("<td>");
- document.write("<span id='dirty-span-"+i+"'
style=\"visibility:hidden;\" > * </span>");
+ document.write("<span id='dirty-span-" + i
+ + "' style=\"visibility:hidden;\" > * </span>");
document.write("</td><td>");
- document.write("<a href=\"#\"
onclick='multiFileEdit.setTextAreaValue("+i+")' >"+
multiFileEdit.archive[i].path);
- document.write("</a>");
+ document
+ .write("<a href=\"#\"
onclick='multiFileEdit.setTextAreaValue("
+ + i + ")' >" + multiFileEdit.archive[i].path);
+ document.write("</a>");
+
+ document.write(" <span id='reset-span-" + i
+ + "' style=\"visibility:hidden;\" >");
+ document.write("<a href='#' onclick='
multiFileEdit.resetFile("+i+");' >reset</a> </span>");
+
+
document.write("</td></tr>");
}
- document.write("</table>");
-
+ document.write("</table>");
+
}
- this.drawTable = function(){
+ this.drawTable = function() {
+ this.initializeArchive();
+
document.write("<style type=\"text/css\">");
document.write("td.multi-edit-table {");
document.write("vertical-align: top;");
@@ -113,76 +147,86 @@ function MultiFileEdit(){
document.write("tr.SelectedRow {");
document.write("background-color:white;");
document.write("}");
-
-
+
document.write("</style>");
- document.write("<table class='multi-edit-table' border='0'
cellpadding='0' >");
+ document
+ .write("<table class='multi-edit-table' border='0'
cellpadding='0' >");
document.write("<tbody>");
document.write("<tr>");
document.write("<td class='multi-edit-table'
bgcolor='#a4b2b9'>");
this.generateLinks();
document.write("</td>");
document.write("<td>");
- document.write("<div><span id='current-path-span'>Current File
Name Goes here</span> ..................");
- document.write("<a href=\"#\"><img
src='/images/download.png'/> Download</a>");
- document.write("<a href=\"#\" ");
- document.write("onclick=\"multiFileEdit.fullscreen()\"> ");
+ document.write("<div><span id='current-path-span'>");
+ document.write(multiFileEdit.archive[this.currentIndex].path);
+ document.write("</span> ..................");
+ document.write("<a href='#'");
+ document.write("onclick=\"multiFileEdit.download()\"> ");
+ document.write("<img src='/images/download.png'/>
Download</a>");
+ document.write("<a href='#' ");
+ document.write("onclick=\"multiFileEdit.fullscreen()\"> ");
document.write("<img src='/images/viewfullscreen.png'/> Full
Screen</a>")
document.write("</div>");
- document.write("<textarea id='textarea' ");
- if (this.disabled){
+ document.write("<textarea id='textarea' ");
+ if (this.disabled) {
document.write("disabled ");
}
- document.write("onkeyup='multiFileEdit.updateArchive();' cols='80'
rows='40'>");
+ document
+ .write("onkeyup='multiFileEdit.updateArchive();' cols='80'
rows='25'>");
document.write(multiFileEdit.archive[0].contents);
document.write("</textarea>");
document.write("<div>upload New Version</div>");
- document.write("<div>Select A File: <input type='file'/>
</div>");
+ document.write("<div>Select A File: <input type='file'
onchange='alert(\"onchange called\");' /> </div>");
+
+ document.write("</form>");
+
document.write("</td>");
document.write("</tr>");
document.write("</tbody>");
- document.write("</table>");
-
- }
-
- this.fullscreen= function()
- {
-
- var generator=window.open('','full
screen','width=1024,height=768,left=0,top=100,screenX=0,screenY=0');
-
generator.document.write('<html><head><title>Popup</title>');
- generator.document.write('<link rel="stylesheet"
href="style.css">');
- generator.document.write('<script language="JavaScript"
type="text/javascript"
src="/js/multi-file-edit.js"></script>');
- generator.document.write('</head><body>');
- generator.document.write("<form
id='full-screen-edit-form'>");
- generator.document.write("<div><span
id='current-path-span'>"
+multiFileEdit.archive[this.currentIndex].path+"</span> ");
- generator.document.write("<a href=\"javascript:self.close();\"
>Close</a>..................");
- generator.document.write("</div>");
- generator.document.write("<textarea id='textarea'
onkeyup='update_parent();' ");
- if (this.disabled){
- generator.document.write("disabled ");
- }
- generator.document.write("cols='200' rows='45'>");
- generator.document.write(multiFileEdit.archive[this.currentIndex].contents);
- generator.document.write("</textarea>");
- generator.document.write("</form>");
- generator.document.write('</body></html>');
-
-
generator.document.getElementById("full-screen-edit-form").textarea.focus();
-
- generator.document.close();
-
+ document.write("</table>");
}
-
- this.initializeArchive();
-}
+ this.fullscreen = function() {
+
+ var generator = window.open('', 'full screen',
+ 'width=1024,height=768,left=0,top=100,screenX=0,screenY=0');
+ generator.document.write('<html><head><title>Popup</title>');
+ generator.document.write('<link rel="stylesheet"
href="style.css">');
+ generator.document
+ .write('<script language="JavaScript"
type="text/javascript"
src="/js/multi-file-edit.js"></script>');
+ generator.document.write('</head><body>');
+ generator.document.write("<form id='full-screen-edit-form'>");
+ generator.document.write("<div><span
id='current-path-span'>"
+ + multiFileEdit.archive[this.currentIndex].path + "</span> ");
+ generator.document
+ .write("<a href=\"javascript:self.close();\"
>Close</a>..................");
+ generator.document.write("</div>");
+ generator.document
+ .write("<textarea id='textarea' onkeyup='update_parent();'
");
+ if (this.disabled) {
+ generator.document.write("disabled ");
+ }
+ generator.document.write("cols='200' rows='45'>");
+ generator.document
+ .write(multiFileEdit.archive[this.currentIndex].contents);
+ generator.document.write("</textarea>");
+ generator.document.write("</form>");
+ generator.document.write('</body></html>');
+ generator.document.getElementById("full-screen-edit-form").textarea
+ .focus();
+ generator.document.close();
+ }
-function update_parent(){
- opener.document.getElementById("testForm").textarea.value =
document.getElementById("full-screen-edit-form").textarea.value;
- opener.multiFileEdit.updateArchive()
+ this.download= function() {
+ var generator = window.open(this.downloadUrl,'');
+ }
+
}
-
-
+function update_parent() {
+ opener.document.getElementById("testForm").textarea.value = document
+ .getElementById("full-screen-edit-form").textarea.value;
+ opener.multiFileEdit.updateArchive()
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
index b0ccb55..4bca60b 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
@@ -17,24 +17,15 @@ THIS TEXT WILL BE REMOVED.
THIS TEXT WILL BE REMOVED AS WELL.
- <ui:param name="pageTitle" value="View Test
Configuration"/>
-
+ <ui:param name="pageTitle" value=" Raw Edit Configuration
Test"/>
<ui:define name="body">
- <a href="view-raw-config.xhtml">View</a>
- <script language="JavaScript" type="text/javascript"
src="/js/multi-file-edit.js"></script>
-
-
- <form id="testForm">
- <script type="text/javascript">
- var multiFileEdit = new MultiFileEdit();
- multiFileEdit.drawTable();
- </script>
- <input type="submit" />
- <input type="reset" onclick="multiFileEdit.resetArchive();"
/>
- </form>
-
+ <a href="view-raw-config.xhtml">View</a>
+ <form id="testForm">
+ <onc:multifile></onc:multifile>
+ <input type="submit" value="Commit"/>
+ <input type="reset" onclick="multiFileEdit.resetArchive();"
/>
+ </form>
</ui:define>
-
</ui:composition>
THIS TEXT WILL BE REMOVED AS WELL.
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
index 4b41986..4acac4b 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
@@ -8,15 +8,23 @@
<a href="view.html">View</a>
-<script language="JavaScript" type="text/javascript"
src="../../../../js/multi-file-edit.js"></script>
+<script language="JavaScript" type="text/javascript"
+ src="../../../../js/multi-file-edit.js"></script>
<form id="testForm" name="viewTestConfigurationForm"
method="post"
action="view.html" enctype="application/x-www-form-urlencoded">
<script type="text/javascript">
var multiFileEdit = new MultiFileEdit();
+ for (i=0; i < 6 ;i++)
+ {
+ multiFileEdit.addArchive("/tmp/file/"+i,
+ "/tmp/file"+i +" archive = "+ i);
+ }
+ multiFileEdit.downloadUrl = "download.html";
multiFileEdit.drawTable();
-</script>
-<input type="submit" /><input type="reset"
onclick="multiFileEdit.resetArchive();" /></form>
+
+</script> <input type="submit" /><input type="reset"
+ onclick="multiFileEdit.resetArchive();" /></form>
commit 5a1348549eb334763745e05fbcc2e26a03a80ee4
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 4 20:17:08 2010 -0500
an intermediate checkin of some half completed custom tag for the raw config work.
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigRenderer.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigRenderer.java
new file mode 100644
index 0000000..823d693
--- /dev/null
+++
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigRenderer.java
@@ -0,0 +1,58 @@
+/*
+ * 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.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+/**
+ * A renderer that renders an {@link RawConfigurationComponent} component as XHTML.
+ *
+ * @author Adam Young
+ */
+public class RawConfigRenderer extends Renderer {
+
+ @Override
+ public void decode(FacesContext context, UIComponent component) {
+ // TODO Auto-generated method stub
+ super.decode(context, component);
+ }
+
+ @Override
+ public boolean getRendersChildren() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component) throws
IOException {
+ // TODO Auto-generated method stub
+ component.encodeBegin(context);
+
+ super.encodeBegin(context, component);
+ }
+
+}
diff --git
a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigUIComponent.java
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigUIComponent.java
new file mode 100644
index 0000000..3694f09
--- /dev/null
+++
b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/RawConfigUIComponent.java
@@ -0,0 +1,143 @@
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Vector;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIPanel;
+import javax.faces.component.UIParameter;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlInputTextarea;
+import javax.faces.component.html.HtmlPanelGrid;
+import javax.faces.context.FacesContext;
+
+import org.rhq.core.gui.util.FacesComponentIdFactory;
+import org.rhq.core.gui.util.FacesComponentUtility;
+
+/**
+
+ * @author Adam Young
+ */
+public class RawConfigUIComponent extends UIComponentBase {
+ private static final String family = "rhq";
+ private static final CharSequence TABLE_STYLE = "<style
type=\"text/css\">" + "td.raw-config-table {"
+ + "vertical-align: top;" + "valign: top;" + "}" +
"</style>";
+ private FacesComponentIdFactory idFactory;
+ private HtmlInputTextarea inputTextarea;
+ private ArrayList<String> configPathList;
+ public HtmlCommandLink saveLink;
+ private Vector<HtmlCommandLink> pathCommandLinks;
+ private ArrayList<UIParameter> readOnlyParms;
+ private boolean readOnly;
+
+ @Override
+ public String getFamily() {
+ return family;
+ }
+
+ private void buildChildren() {
+
+ if (getChildCount() > 0) {
+ return;
+ }
+
+ FacesComponentUtility.addVerbatimText(this, TABLE_STYLE);
+
+ UIPanel rawPanel = FacesComponentUtility.addBlockPanel(this, idFactory,
"");
+
+ HtmlPanelGrid grid = FacesComponentUtility.addPanelGrid(rawPanel, idFactory, 2,
"summary-props-table");
+ grid.setParent(this);
+
+ grid.setColumnClasses("raw-config-table");
+
+ HtmlPanelGrid panelLeft = FacesComponentUtility.addPanelGrid(grid, idFactory, 1,
"summary-props-table");
+ panelLeft.setBgcolor("#a4b2b9");
+
+ FacesComponentUtility.addOutputText(panelLeft, idFactory, "Raw
Configurations Paths", "");
+
+ int rawCount = 0;
+
+ configPathList = new ArrayList<String>();
+ Collections.sort(configPathList);
+ String oldDirname = "";
+
+ pathCommandLinks = new Vector<HtmlCommandLink>();
+ for (String s : configPathList) {
+
+ String dirname = s.substring(0, s.lastIndexOf("/") + 1);
+ String basename = s.substring(s.lastIndexOf("/") + 1, s.length());
+ if (!dirname.equals(oldDirname)) {
+ FacesComponentUtility.addOutputText(panelLeft, idFactory, dirname,
"");
+ oldDirname = dirname;
+ }
+ UIPanel nextPath = FacesComponentUtility.addBlockPanel(panelLeft, idFactory,
"");
+ HtmlCommandLink link = FacesComponentUtility.addCommandLink(nextPath,
idFactory);
+ FacesComponentUtility.addOutputText(link, idFactory, "",
"");
+ FacesComponentUtility.addOutputText(link, idFactory, basename,
"");
+ FacesComponentUtility.addParameter(link, idFactory, "path", s);
+ FacesComponentUtility.addParameter(link, idFactory, "whichRaw",
Integer.toString(rawCount++));
+ FacesComponentUtility.addParameter(link, idFactory, "showRaw",
Boolean.TRUE.toString());
+ readOnlyParms.add(FacesComponentUtility.addParameter(link, idFactory,
"readOnly", Boolean
+ .toString(readOnly)));
+
+ pathCommandLinks.add(link);
+ }
+
+ UIPanel panelRight = FacesComponentUtility.addBlockPanel(grid, idFactory,
"summary-props-table");
+ UIPanel editPanel = FacesComponentUtility.addBlockPanel(panelRight, idFactory,
"summary-props-table");
+ this.inputTextarea = createConfigTextArea(readOnly);
+ editPanel.getChildren().add(this.inputTextarea);
+ inputTextarea.setParent(editPanel);
+
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context) throws IOException {
+ // TODO Auto-generated method stub
+ buildChildren();
+
+ }
+
+ public ArrayList<String> getConfigPathList() {
+ return configPathList;
+ }
+
+ public void setConfigPathList(ArrayList<String> configPathList) {
+ this.configPathList = configPathList;
+ }
+
+ private HtmlInputTextarea createConfigTextArea(boolean readOnly) {
+ HtmlInputTextarea inputTextarea = new HtmlInputTextarea();
+ inputTextarea.setId("rawconfigtextarea");
+ inputTextarea.setCols(80);
+ inputTextarea.setRows(40);
+ inputTextarea.setReadonly(readOnly);
+
+ return inputTextarea;
+ }
+
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/ViewRawTestConfigurationUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/ViewRawTestConfigurationUIBean.java
new file mode 100644
index 0000000..b2b6900
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/test/ViewRawTestConfigurationUIBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.configuration.test;
+
+import org.rhq.enterprise.gui.common.Outcomes;
+
+/**
+ * @author Adam Young
+ */
+public class ViewRawTestConfigurationUIBean extends AbstractTestConfigurationUIBean {
+ public static final String MANAGED_BEAN_NAME =
ViewRawTestConfigurationUIBean.class.getSimpleName();
+
+ public String editConfiguration() {
+ return Outcomes.SUCCESS;
+ }
+}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
index 1f7918f..8bb4c13 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-components/configuration-components.xml
@@ -9,6 +9,13 @@
<component-class>org.rhq.core.gui.configuration.ConfigUIComponent</component-class>
</component>
+ <component>
+ <component-type>org.jboss.on.RawConfig</component-type>
+
<component-class>org.rhq.core.gui.configuration.RawConfigUIComponent</component-class>
+ </component>
+
+
+
<component>
<component-type>org.rhq.ConfigurationSet</component-type>
<component-class>org.rhq.core.gui.configuration.propset.ConfigurationSetComponent</component-class>
@@ -21,6 +28,14 @@
<renderer-type>org.jboss.on.Config</renderer-type>
<renderer-class>org.rhq.core.gui.configuration.ConfigRenderer</renderer-class>
</renderer>
+
+ <renderer>
+ <description>renderer for Raw Config components</description>
+ <component-family>rhq</component-family>
+ <renderer-type>org.jboss.on.RawConfig</renderer-type>
+
<renderer-class>org.rhq.core.gui.configuration.RawConfigRenderer</renderer-class>
+ </renderer>
+
</render-kit>
<component>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/test-beans.xml
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/test-beans.xml
index 3ec6058..daec506 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/test-beans.xml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/test-beans.xml
@@ -11,6 +11,14 @@
</managed-bean>
<managed-bean>
+ <managed-bean-name>ViewRawTestConfigurationUIBean</managed-bean-name>
+
<managed-bean-class>org.rhq.enterprise.gui.configuration.test.ViewRawTestConfigurationUIBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+
+
+ <managed-bean>
<managed-bean-name>EditTestConfigurationUIBean</managed-bean-name>
<managed-bean-class>org.rhq.enterprise.gui.configuration.test.EditTestConfigurationUIBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
new file mode 100644
index 0000000..4b41986
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/edit.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<title>Test multi-edit control</title>
+</head>
+
+
+<body>
+
+<a href="view.html">View</a>
+
+<script language="JavaScript" type="text/javascript"
src="../../../../js/multi-file-edit.js"></script>
+
+<form id="testForm" name="viewTestConfigurationForm"
method="post"
+ action="view.html" enctype="application/x-www-form-urlencoded">
+<script type="text/javascript">
+ var multiFileEdit = new MultiFileEdit();
+ multiFileEdit.drawTable();
+</script>
+<input type="submit" /><input type="reset"
onclick="multiFileEdit.resetArchive();" /></form>
+
+
+
+</body>
+</html>
\ No newline at end of file
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
new file mode 100644
index 0000000..c1084fa
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/view.html
@@ -0,0 +1,18 @@
+<html><head><title>Next Page,</title>
+</head>
+<body>View Results
+
+<a href="edit.html">Edit</a>
+<script language="JavaScript" type="text/javascript"
src="multi-file-edit.js"></script>
+
+<form id="testForm" name="viewTestConfigurationForm"
method="post"
+ action="view.html" enctype="application/x-www-form-urlencoded">
+<script type="text/javascript">
+var multiFileEdit = new MultiFileEdit();
+multiFileEdit.disabled=1;
+multiFileEdit.drawTable();
+</script>
+</form>
+
+</html>
+</body>
commit 038e268f4eb32afa9dcf3f60092bf75beaa67f30
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Jan 4 20:12:48 2010 -0500
Made necessary changes so the javscript multi-file-edit works inside a webapp.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
index f06e7e5..c474326 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
@@ -4,6 +4,10 @@ function ArchiveFile(p,c) {
this.contents = c;
}
+
+
+
+
/*
* This is a class for editing a collection of files, represented by a map.
* There is a list of links in the left column, each which represent a file,
@@ -29,7 +33,6 @@ function MultiFileEdit(){
document.getElementById("file-row-"+this.currentIndex).className =
"OddRow";
}else{
document.getElementById("file-row-"+this.currentIndex).className =
"EvenRow";
-
}
this.currentIndex = id;
@@ -60,7 +63,7 @@ function MultiFileEdit(){
window.onbeforeunload = askConfirm;
this.isDirty = 1;
- this.archive[this.currentIndex].contents = textarea.value ;
+ this.archive[this.currentIndex].contents =
document.getElementById("testForm").textarea.value;
this.archive[this.currentIndex].dirty = 1;
document.getElementById("dirty-span-"+this.currentIndex).style.visibility="visible";
}
@@ -124,13 +127,13 @@ function MultiFileEdit(){
document.write("<a href=\"#\"><img
src='/images/download.png'/> Download</a>");
document.write("<a href=\"#\" ");
document.write("onclick=\"multiFileEdit.fullscreen()\"> ");
- document.write("<img src='/images/fullscreen.png'/> Full
Screen</a>")
+ document.write("<img src='/images/viewfullscreen.png'/> Full
Screen</a>")
document.write("</div>");
document.write("<textarea id='textarea' ");
if (this.disabled){
document.write("disabled ");
}
- document.write("onkeyup='multiFileEdit.updateArchive()' cols='80'
rows='40'>");
+ document.write("onkeyup='multiFileEdit.updateArchive();' cols='80'
rows='40'>");
document.write(multiFileEdit.archive[0].contents);
document.write("</textarea>");
@@ -145,16 +148,15 @@ function MultiFileEdit(){
this.fullscreen= function()
{
-
var generator=window.open('','full
screen','width=1024,height=768,left=0,top=100,screenX=0,screenY=0');
generator.document.write('<html><head><title>Popup</title>');
generator.document.write('<link rel="stylesheet"
href="style.css">');
- generator.document.write('<script language="JavaScript"
type="text/javascript"
src="multi-file-edit.js"></script>');
+ generator.document.write('<script language="JavaScript"
type="text/javascript"
src="/js/multi-file-edit.js"></script>');
generator.document.write('</head><body>');
generator.document.write("<form
id='full-screen-edit-form'>");
generator.document.write("<div><span
id='current-path-span'>"
+multiFileEdit.archive[this.currentIndex].path+"</span> ");
- generator.document.write("<a
href=\"javascript:self.close();\">Close</a>..................");
+ generator.document.write("<a href=\"javascript:self.close();\"
>Close</a>..................");
generator.document.write("</div>");
generator.document.write("<textarea id='textarea'
onkeyup='update_parent();' ");
if (this.disabled){
@@ -181,3 +183,6 @@ function update_parent(){
opener.document.getElementById("testForm").textarea.value =
document.getElementById("full-screen-edit-form").textarea.value;
opener.multiFileEdit.updateArchive()
}
+
+
+
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
index ac8521a..b0ccb55 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
@@ -24,23 +24,13 @@ THIS TEXT WILL BE REMOVED.
<script language="JavaScript" type="text/javascript"
src="/js/multi-file-edit.js"></script>
- <h:messages showSummary="true"
- showDetail="true"
- errorClass="ErrorBlock"
- warnClass="ErrorBlock"
- infoClass="ConfirmationBlock"
- globalOnly="true"
- layout="table"
- width="100%"/>
<form id="testForm">
<script type="text/javascript">
var multiFileEdit = new MultiFileEdit();
multiFileEdit.drawTable();
- multiFileEdit.setTextAreaValue(0);
</script>
<input type="submit" />
<input type="reset" onclick="multiFileEdit.resetArchive();"
/>
- <a href="next-page.html" onclick="checkDirty()">Go to next
Page</a>
</form>
</ui:define>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
index fa8b2b3..238ccb4 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
@@ -38,7 +38,6 @@ THIS TEXT WILL BE REMOVED.
var multiFileEdit = new MultiFileEdit();
multiFileEdit.disabled=1;
multiFileEdit.drawTable();
- multiFileEdit.setTextAreaValue(0);
</script>
<input type="submit" />
<input type="reset" onclick="multiFileEdit.resetArchive();"
/>
commit a28c91ba90b5d5caddc3a13baf06beb15def7718
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Dec 23 20:03:26 2009 -0500
Use of visibility attribute to hide/show asterix
Modified icon paths so that they show in webapp
Initialized document in fullscreen view
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
index fee0065..f06e7e5 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
@@ -46,7 +46,7 @@ function MultiFileEdit(){
this.isDirty = 0;
for (i=0; i < this.archive.length ;i++)
{
- document.getElementById("dirty-span-"+i).firstChild.data = "O ";
+ document.getElementById("dirty-span-"+i).style.visibility="hidden";
}
}
@@ -62,14 +62,14 @@ function MultiFileEdit(){
this.isDirty = 1;
this.archive[this.currentIndex].contents = textarea.value ;
this.archive[this.currentIndex].dirty = 1;
- document.getElementById("dirty-span-"+this.currentIndex).firstChild.data =
"X ";
+ document.getElementById("dirty-span-"+this.currentIndex).style.visibility="visible";
}
this.generateLinks = function(){
var i=0;
var style =0;
var divclass = "";
- document.write("<table><th><td>Configuration File
Paths</td><td></td></th>");
+ document.write("<table BORDER=0 RULES=NONE
FRAME=BOX><th><td>Configuration File
Paths</td><td></td></th>");
for (i=0; i < multiFileEdit.archive.length ;i++){
if (i == 0){
@@ -84,7 +84,7 @@ function MultiFileEdit(){
document.write("<tr id='file-row-"+i+"'class='"+
divclass +"'>");
document.write("<td>");
- document.write("<span id='dirty-span-"+i+"'>O
</span>");
+ document.write("<span id='dirty-span-"+i+"'
style=\"visibility:hidden;\" > * </span>");
document.write("</td><td>");
document.write("<a href=\"#\"
onclick='multiFileEdit.setTextAreaValue("+i+")' >"+
multiFileEdit.archive[i].path);
document.write("</a>");
@@ -111,6 +111,7 @@ function MultiFileEdit(){
document.write("background-color:white;");
document.write("}");
+
document.write("</style>");
document.write("<table class='multi-edit-table' border='0'
cellpadding='0' >");
document.write("<tbody>");
@@ -120,10 +121,10 @@ function MultiFileEdit(){
document.write("</td>");
document.write("<td>");
document.write("<div><span id='current-path-span'>Current File
Name Goes here</span> ..................");
- document.write("<a href=\"#\"><img
src='images/download.png'/> Download</a>");
+ document.write("<a href=\"#\"><img
src='/images/download.png'/> Download</a>");
document.write("<a href=\"#\" ");
document.write("onclick=\"multiFileEdit.fullscreen()\"> ");
- document.write("<img src='images/fullscreen.png'/> Full
Screen</a>")
+ document.write("<img src='/images/fullscreen.png'/> Full
Screen</a>")
document.write("</div>");
document.write("<textarea id='textarea' ");
if (this.disabled){
@@ -143,36 +144,32 @@ function MultiFileEdit(){
}
this.fullscreen= function()
- {
+ {
+
+
var generator=window.open('','full
screen','width=1024,height=768,left=0,top=100,screenX=0,screenY=0');
generator.document.write('<html><head><title>Popup</title>');
- generator.document.write('<link rel="stylesheet"
href="style.css">');
-
+ generator.document.write('<link rel="stylesheet"
href="style.css">');
generator.document.write('<script language="JavaScript"
type="text/javascript"
src="multi-file-edit.js"></script>');
-
- generator.document.write('</head><body>');
-
+ generator.document.write('</head><body>');
generator.document.write("<form
id='full-screen-edit-form'>");
- generator.document.write("<div><span
id='current-path-span'>Current File Name Goes here</span> ");
+ generator.document.write("<div><span
id='current-path-span'>"
+multiFileEdit.archive[this.currentIndex].path+"</span> ");
generator.document.write("<a
href=\"javascript:self.close();\">Close</a>..................");
generator.document.write("</div>");
generator.document.write("<textarea id='textarea'
onkeyup='update_parent();' ");
-
if (this.disabled){
generator.document.write("disabled ");
- }
-
+ }
generator.document.write("cols='200' rows='45'>");
+ generator.document.write(multiFileEdit.archive[this.currentIndex].contents);
generator.document.write("</textarea>");
- generator.document.write("</form>");
-
+ generator.document.write("</form>");
generator.document.write('</body></html>');
- generator.document.getElementById("current-path-span").firstChild.data =
multiFileEdit.archive[this.currentIndex].path;
- generator.document.getElementById("full-screen-edit-form").textarea.value =
multiFileEdit.archive[this.currentIndex].contents;
generator.document.getElementById("full-screen-edit-form").textarea.focus();
-
+
generator.document.close();
+
}
commit 4b1bece8d110645b65381629180c7a2429b80e03
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Dec 23 15:22:54 2009 -0500
Classpath changes, mostly for sources.
diff --git a/.classpath b/.classpath
index 5166ebf..c530af4 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src"
path="modules/common/jboss-as/src/main/java"/>
+ <classpathentry kind="src"
path="modules/test-utils/src/main/java"/>
<classpathentry kind="src"
path="modules/common/jboss-as/src/test/java"/>
<classpathentry kind="src"
path="modules/plugins/jboss-as/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/jboss-as/src/test/java"/>
@@ -13,7 +14,7 @@
<classpathentry kind="src"
path="modules/plugins/tomcat/src/test/java"/>
<classpathentry kind="src"
path="modules/plugins/jboss-cache/src/main/java"/>
<classpathentry kind="src"
path="modules/plugins/jboss-cache-v3/src/main/java"/>
- <classpathentry excluding="org/rhq/plugins/antlrconfig/"
kind="src" path="modules/plugins/antlr-config/src/main/java"/>
+ <classpathentry kind="src"
path="modules/plugins/antlr-config/src/main/java"/>
<classpathentry kind="var"
path="M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar"/>
<classpathentry kind="var"
path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar"/>
<classpathentry kind="var"
path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar"/>
@@ -110,7 +111,6 @@
<classpathentry kind="src"
path="modules/plugins/antlr-config/src/main/antlr3"/>
<classpathentry kind="src"
path="modules/plugins/antlr-config/target/generated-sources/antlr3"/>
<classpathentry kind="src"
path="modules/plugins/augeas/src/main/java"/>
- <classpathentry kind="src"
path="modules/plugins/augeas/src/test/java"/>
<classpathentry kind="src"
path="modules/helpers/rtfilter/src/main/java"/>
<classpathentry kind="src"
path="modules/helpers/pluginAnnotations/src/main/java"/>
<classpathentry kind="src"
path="modules/helpers/pluginGen/src/main/java"/>
@@ -211,5 +211,8 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/net/homeip/yusuke/twitter4j/2.0.9/twitter4j-2.0.9.jar"/>
<classpathentry exported="true" kind="lib"
path="modules/enterprise/remoting/webservices/target/rhq-remoting-webservices-1.4.0-SNAPSHOT/wsconsume-output"/>
+ <classpathentry kind="var"
path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
commit bc566390a996f9839387290cb4b58153176c76cb
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Dec 23 15:22:32 2009 -0500
Added a javascript based proof of concept for raw config UI and two test pages to
view.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
new file mode 100644
index 0000000..fee0065
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/multi-file-edit.js
@@ -0,0 +1,186 @@
+function ArchiveFile(p,c) {
+ this.path = p;
+ this.dirty = 0;
+ this.contents = c;
+}
+
+/*
+ * This is a class for editing a collection of files, represented by a map.
+ * There is a list of links in the left column, each which represent a file,
+ * a textarea input that changes based on which link is selected
+ */
+function MultiFileEdit(){
+ this.currentIndex = 0;
+ this.isDirty = 0;
+ this.archive = new Array();
+ this.disabled=0;
+
+ this.initializeArchive = function(){
+ var i=0;
+ for (i=0; i < 6 ;i++)
+ {
+ this.archive[i] = new ArchiveFile("/tmp/file/"+i, "/tmp/file/"+i
+" archive = "+ this.archive.length);
+ }
+ }
+
+ this.setTextAreaValue = function(id)
+ {
+ if (this.currentIndex % 2 == 0){
+ document.getElementById("file-row-"+this.currentIndex).className =
"OddRow";
+ }else{
+ document.getElementById("file-row-"+this.currentIndex).className =
"EvenRow";
+
+ }
+
+ this.currentIndex = id;
+ document.getElementById("testForm").textarea.value =
multiFileEdit.archive[this.currentIndex].contents;
+ document.getElementById("file-row-"+id).className =
"SelectedRow";
+ document.getElementById("testForm").textarea.focus();
+ document.getElementById("current-path-span").firstChild.data =
multiFileEdit.archive[this.currentIndex].path;
+ }
+
+
+ this.resetArchive = function(){
+ this.initializeArchive();
+ this.setTextAreaValue(0);
+ this.isDirty = 0;
+ for (i=0; i < this.archive.length ;i++)
+ {
+ document.getElementById("dirty-span-"+i).firstChild.data = "O ";
+ }
+ }
+
+ function askConfirm(){
+ return "You have unsaved changes.";
+ }
+
+
+ this.updateArchive = function(){
+
+ window.onbeforeunload = askConfirm;
+
+ this.isDirty = 1;
+ this.archive[this.currentIndex].contents = textarea.value ;
+ this.archive[this.currentIndex].dirty = 1;
+ document.getElementById("dirty-span-"+this.currentIndex).firstChild.data =
"X ";
+ }
+
+ this.generateLinks = function(){
+ var i=0;
+ var style =0;
+ var divclass = "";
+ document.write("<table><th><td>Configuration File
Paths</td><td></td></th>");
+ for (i=0; i < multiFileEdit.archive.length ;i++){
+
+ if (i == 0){
+ divclass="SelectedRow"
+ }else if (style != 0){
+ style = 0;
+ divclass="OddRow"
+ }else{
+ style = 1;
+ divclass="EvenRow"
+ }
+
+ document.write("<tr id='file-row-"+i+"'class='"+
divclass +"'>");
+ document.write("<td>");
+ document.write("<span id='dirty-span-"+i+"'>O
</span>");
+ document.write("</td><td>");
+ document.write("<a href=\"#\"
onclick='multiFileEdit.setTextAreaValue("+i+")' >"+
multiFileEdit.archive[i].path);
+ document.write("</a>");
+ document.write("</td></tr>");
+ }
+ document.write("</table>");
+
+ }
+
+ this.drawTable = function(){
+ document.write("<style type=\"text/css\">");
+ document.write("td.multi-edit-table {");
+ document.write("vertical-align: top;");
+ document.write("valign: top;");
+ document.write("height: = 300;");
+ document.write("}");
+ document.write("tr.EvenRow {")
+ document.write("background-color:#a4b2b9;");
+ document.write("}");
+ document.write("tr.OddRow {");
+ document.write("background-color:grey;");
+ document.write("}");
+ document.write("tr.SelectedRow {");
+ document.write("background-color:white;");
+ document.write("}");
+
+ document.write("</style>");
+ document.write("<table class='multi-edit-table' border='0'
cellpadding='0' >");
+ document.write("<tbody>");
+ document.write("<tr>");
+ document.write("<td class='multi-edit-table'
bgcolor='#a4b2b9'>");
+ this.generateLinks();
+ document.write("</td>");
+ document.write("<td>");
+ document.write("<div><span id='current-path-span'>Current File
Name Goes here</span> ..................");
+ document.write("<a href=\"#\"><img
src='images/download.png'/> Download</a>");
+ document.write("<a href=\"#\" ");
+ document.write("onclick=\"multiFileEdit.fullscreen()\"> ");
+ document.write("<img src='images/fullscreen.png'/> Full
Screen</a>")
+ document.write("</div>");
+ document.write("<textarea id='textarea' ");
+ if (this.disabled){
+ document.write("disabled ");
+ }
+ document.write("onkeyup='multiFileEdit.updateArchive()' cols='80'
rows='40'>");
+ document.write(multiFileEdit.archive[0].contents);
+ document.write("</textarea>");
+
+ document.write("<div>upload New Version</div>");
+ document.write("<div>Select A File: <input type='file'/>
</div>");
+ document.write("</td>");
+ document.write("</tr>");
+ document.write("</tbody>");
+ document.write("</table>");
+
+ }
+
+ this.fullscreen= function()
+ {
+ var generator=window.open('','full
screen','width=1024,height=768,left=0,top=100,screenX=0,screenY=0');
+
generator.document.write('<html><head><title>Popup</title>');
+ generator.document.write('<link rel="stylesheet"
href="style.css">');
+
+ generator.document.write('<script language="JavaScript"
type="text/javascript"
src="multi-file-edit.js"></script>');
+
+ generator.document.write('</head><body>');
+
+ generator.document.write("<form
id='full-screen-edit-form'>");
+ generator.document.write("<div><span
id='current-path-span'>Current File Name Goes here</span> ");
+ generator.document.write("<a
href=\"javascript:self.close();\">Close</a>..................");
+ generator.document.write("</div>");
+ generator.document.write("<textarea id='textarea'
onkeyup='update_parent();' ");
+
+ if (this.disabled){
+ generator.document.write("disabled ");
+ }
+
+ generator.document.write("cols='200' rows='45'>");
+ generator.document.write("</textarea>");
+ generator.document.write("</form>");
+
+ generator.document.write('</body></html>');
+
+ generator.document.getElementById("current-path-span").firstChild.data =
multiFileEdit.archive[this.currentIndex].path;
+ generator.document.getElementById("full-screen-edit-form").textarea.value =
multiFileEdit.archive[this.currentIndex].contents;
+
generator.document.getElementById("full-screen-edit-form").textarea.focus();
+
+ generator.document.close();
+
+ }
+
+ this.initializeArchive();
+}
+
+
+function update_parent(){
+ opener.document.getElementById("testForm").textarea.value =
document.getElementById("full-screen-edit-form").textarea.value;
+ opener.multiFileEdit.updateArchive()
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
new file mode 100644
index 0000000..ac8521a
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/edit-raw-config.xhtml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+
xmlns:onc="http://jboss.org/on/component">
+
+THIS TEXT WILL BE REMOVED.
+
+<ui:composition template="/rhq/layout/main.xhtml">
+
+ THIS TEXT WILL BE REMOVED AS WELL.
+
+ <ui:param name="pageTitle" value="View Test
Configuration"/>
+
+ <ui:define name="body">
+ <a href="view-raw-config.xhtml">View</a>
+ <script language="JavaScript" type="text/javascript"
src="/js/multi-file-edit.js"></script>
+
+
+ <h:messages showSummary="true"
+ showDetail="true"
+ errorClass="ErrorBlock"
+ warnClass="ErrorBlock"
+ infoClass="ConfirmationBlock"
+ globalOnly="true"
+ layout="table"
+ width="100%"/>
+ <form id="testForm">
+ <script type="text/javascript">
+ var multiFileEdit = new MultiFileEdit();
+ multiFileEdit.drawTable();
+ multiFileEdit.setTextAreaValue(0);
+ </script>
+ <input type="submit" />
+ <input type="reset" onclick="multiFileEdit.resetArchive();"
/>
+ <a href="next-page.html" onclick="checkDirty()">Go to next
Page</a>
+ </form>
+
+ </ui:define>
+
+</ui:composition>
+
+THIS TEXT WILL BE REMOVED AS WELL.
+
+</html>
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
new file mode 100644
index 0000000..fa8b2b3
--- /dev/null
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/view-raw-config.xhtml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+
xmlns:onc="http://jboss.org/on/component">
+
+THIS TEXT WILL BE REMOVED.
+
+<ui:composition template="/rhq/layout/main.xhtml">
+
+ THIS TEXT WILL BE REMOVED AS WELL.
+
+ <ui:param name="pageTitle" value="View Test
Configuration"/>
+
+ <ui:define name="body">
+
+ <script language="JavaScript" type="text/javascript"
src="/js/multi-file-edit.js"></script>
+
+ <h:messages showSummary="true"
+ showDetail="true"
+ errorClass="ErrorBlock"
+ warnClass="ErrorBlock"
+ infoClass="ConfirmationBlock"
+ globalOnly="true"
+ layout="table"
+ width="100%"/>
+ <a href="edit-raw-config.xhtml">Edit</a>
+
+ <form id="testForm">
+ <script type="text/javascript">
+ var multiFileEdit = new MultiFileEdit();
+ multiFileEdit.disabled=1;
+ multiFileEdit.drawTable();
+ multiFileEdit.setTextAreaValue(0);
+ </script>
+ <input type="submit" />
+ <input type="reset" onclick="multiFileEdit.resetArchive();"
/>
+ </form>
+
+ </ui:define>
+
+</ui:composition>
+
+THIS TEXT WILL BE REMOVED AS WELL.
+
+</html>
commit b5fa8688432aaefa4509a9ca55acc7d4ac4dca7d
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Dec 23 15:19:22 2009 -0500
removed Overload tags. The functionas are defined in an interface, thus these are
not properly overloads, but rather implementations. Eclipse complained.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 88858cf..0a39438 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -287,7 +287,6 @@ public class WebservicesManagerBean implements WebservicesRemote {
return repoManager.findPackageVersionsInRepoByCriteria(subject, criteria);
}
- @Override
public int synchronizeRepos(Subject subject, Integer[] repoIds) {
return repoManager.synchronizeRepos(subject, repoIds);
}
@@ -372,8 +371,8 @@ public class WebservicesManagerBean implements WebservicesRemote {
}
public ResourceConfigurationUpdate updateStructuredOrRawConfiguration(Subject
subject, int resourceId,
- Configuration newConfiguration, boolean fromStructured)
- throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException {
+ Configuration newConfiguration, boolean fromStructured) throws
ResourceNotFoundException,
+ ConfigurationUpdateStillInProgressException {
return configurationManager.updateStructuredOrRawConfiguration(subject,
resourceId, newConfiguration,
fromStructured);
}
commit 274b4f5769bf16369eff507fcbdcfaae945d937d
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Dec 23 15:12:34 2009 -0500
removed Overload tags. The functionas are defined in an interface, thus these are
not properly overloads, but rather implementations. Eclipse complained.
diff --git
a/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/ApacheXmlRpcExecutor.java
b/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/ApacheXmlRpcExecutor.java
index f3c75e2..004608a 100644
---
a/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/ApacheXmlRpcExecutor.java
+++
b/modules/enterprise/server/plugins/rhnhosted/src/main/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/ApacheXmlRpcExecutor.java
@@ -32,12 +32,10 @@ public class ApacheXmlRpcExecutor implements XmlRpcExecutor {
this.client = clientIn;
}
- @Override
public Object execute(String methodName, Object[] params) throws XmlRpcException {
return client.execute(methodName, params);
}
- @Override
public Object execute(String pMethodName, List pParams) throws XmlRpcException {
return client.execute(pMethodName, pParams);
}
diff --git
a/modules/enterprise/server/plugins/rhnhosted/src/test/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/MockRhnXmlRpcExecutor.java
b/modules/enterprise/server/plugins/rhnhosted/src/test/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/MockRhnXmlRpcExecutor.java
index bcdfe41..c4cf6c7 100644
---
a/modules/enterprise/server/plugins/rhnhosted/src/test/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/MockRhnXmlRpcExecutor.java
+++
b/modules/enterprise/server/plugins/rhnhosted/src/test/java/org/rhq/enterprise/server/plugins/rhnhosted/xmlrpc/MockRhnXmlRpcExecutor.java
@@ -70,7 +70,6 @@ public class MockRhnXmlRpcExecutor implements XmlRpcExecutor {
/* (non-Javadoc)
* @see
org.rhq.enterprise.server.plugins.rhnhosted.xmlrpc.XmlRpcExecutor#execute(java.lang.String,
java.lang.Object[])
*/
- @Override
public Object execute(String methodName, Object[] params) throws XmlRpcException {
//for (Object object : params) {
// System.out.println("parm: " + object);
@@ -242,7 +241,6 @@ public class MockRhnXmlRpcExecutor implements XmlRpcExecutor {
}
- @Override
public Object execute(String pMethodName, List pParams) throws XmlRpcException {
return execute(pMethodName, pParams.toArray());
}