[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/plugins
by snegrea
modules/plugins/jboss-as-7/pom.xml | 16 ++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebservicesComponent.java | 55 ----------
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 14 +-
3 files changed, 21 insertions(+), 64 deletions(-)
New commits:
commit 3bcc16878f52292ed2f254fdedee3c76c4180393
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 30 16:05:08 2012 -0500
[BZ 835710] Removed WebservicesComoponent class and moved the two resources using it to the generic BaseComponent.
(cherry picked from commit 2d2ae3923fdaa1d94561f3995b4e59521e9267db)
Conflicts:
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebservicesComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebservicesComponent.java
deleted file mode 100644
index 0dea886..0000000
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/WebservicesComponent.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.rhq.modules.plugins.jbossas7;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-import org.rhq.core.pluginapi.operation.OperationFacet;
-import org.rhq.core.pluginapi.operation.OperationResult;
-import org.rhq.modules.plugins.jbossas7.json.Operation;
-import org.rhq.modules.plugins.jbossas7.json.Result;
-
-/**
- * Support for Webservices subsystem.
- *
- * @author Simeon Pinder
- */
-public class WebservicesComponent extends BaseComponent implements OperationFacet, ConfigurationFacet {
-
- @Override
- public Configuration loadResourceConfiguration() throws Exception {
- Configuration config = super.loadResourceConfiguration();
-
- return config;
- }
-
- @Override
- public void updateResourceConfiguration(ConfigurationUpdateReport report) {
-
- super.updateResourceConfiguration(report);
- }
-
- @Override
- public OperationResult invokeOperation(String name, Configuration parameters) throws Exception {
- Operation op = new Operation(name, getAddress());
- OperationResult operationResult = new OperationResult();
- Result result = null;
-
- if ("list-proxies".equals(name)) {
-
- } else {
- /*
- * This is a catch all for operations that are not explicitly treated above.
- */
- result = getASConnection().execute(op);
- if (result.isSuccess()) {
- operationResult.setSimpleResult("Success");
- }
- }
-
- if (!result.isSuccess()) {
- operationResult.setErrorMessage(result.getFailureDescription());
- }
-
- return operationResult;
- }
-}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index fc0e403..f42b583 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1732,7 +1732,7 @@
<service name="Webservices (Managed Server)"
discovery="SubsystemDiscovery"
- class="WebservicesComponent"
+ class="BaseComponent"
singleton="true">
<plugin-configuration>
@@ -3215,7 +3215,7 @@
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="login-modules" />
</plugin-configuration>
-
+
&loginModuleResourceConfig;
<service name="Module Options (Classic - Managed Server)" discovery="ModuleOptionsDiscoveryComponent"
@@ -6049,7 +6049,7 @@
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="login-modules" />
</plugin-configuration>
-
+
&loginModuleResourceConfig;
<service name="Module Options (Classic - Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
@@ -8125,9 +8125,9 @@
</service>
<service name="Webservices"
- discovery="SubsystemDiscovery"
- class="WebservicesComponent"
- singleton="true">
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ singleton="true">
<runs-inside>
<parent-resource-type name="Profile" plugin="&pluginName;"/>
@@ -10604,7 +10604,7 @@
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="policy-modules" />
</plugin-configuration>
-
+
&flagModuleResourceConfig;
<service name="Module Options (Authorization)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
commit 582c54732e53131b4c05cb495a45299e98467162
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 30 16:03:14 2012 -0500
delete the itest AS7 home dir before, as well as after, the itests run
(cherry picked from commit 1fb0b4a36e7c66607dea51cc539511352702ed3f)
Conflicts:
modules/plugins/jboss-as-7/pom.xml
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 557a6d8..547dece 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -306,9 +306,9 @@
<get src="${as7.url}" dest="${as7.zipfile}"
usetimestamp="true" verbose="true"/>
<unzip src="${as7.zipfile}" dest="${java.io.tmpdir}"/>
+ <delete dir="${jboss7.home}" verbose="true"/>
<move file="${java.io.tmpdir}/jboss-eap-6.0"
- tofile="${java.io.tmpdir}/jboss-as-${as7.version}" failonerror="false"
- overwrite="false"/>
+ tofile="${jboss7.home}" failonerror="false"/>
<chmod perm="u+rx">
<fileset dir="${jboss7.home}/bin" includes="*.sh"/>
@@ -325,6 +325,18 @@
</target>
</configuration>
</execution>
+ <execution>
+ <id>delete</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <delete dir="${jboss7.home}" verbose="true"/>
+ </target>
+ </configuration>
+ </execution>
</executions>
</plugin>
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 4 commits - .classpath modules/plugins
by Simeon Pinder
.classpath | 2
modules/plugins/jboss-as-7/pom.xml | 84
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsComponent.java | 867 +++++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsDiscoveryComponent.java | 188 +
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 1505 +++++-----
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java | 8
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java | 525 +++
7 files changed, 2411 insertions(+), 768 deletions(-)
New commits:
commit cf0a92a0aa3fa0e994f32d1f8d6e7d78a36a1fc4
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Jun 22 08:46:14 2012 -0400
[BZ 826542] add a few tests to exercise crud of Security Domain and some of Module Option framework.
- only added one of this type as discovery needs to complete in between creates and slows down process significantly.
- we need to come up with another way of prepopulating the other SecurityDomain types before full discovery.
(cherry picked from commit 7b77b38e5bdaa2b87f05be70bea8c1cdb08d14d8)
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
deleted file mode 100644
index e80ddec..0000000
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
+++ /dev/null
@@ -1,319 +0,0 @@
-///*
-// * RHQ Management Platform
-// * Copyright (C) 2005-2011 Red Hat, Inc.
-// * All rights reserved.
-// *
-// * This program is free software; you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License 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.modules.plugins.jbossas7;
-//
-//import java.io.IOException;
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.LinkedHashMap;
-//import java.util.List;
-//
-//import org.codehaus.jackson.JsonGenerationException;
-//import org.codehaus.jackson.JsonNode;
-//import org.codehaus.jackson.JsonProcessingException;
-//import org.codehaus.jackson.map.JsonMappingException;
-//import org.codehaus.jackson.map.ObjectMapper;
-//import org.codehaus.jackson.map.SerializationConfig;
-//import org.testng.annotations.BeforeSuite;
-//import org.testng.annotations.Test;
-//
-//import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.ModuleOptionType;
-//import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.Value;
-//import org.rhq.modules.plugins.jbossas7.json.Address;
-//import org.rhq.modules.plugins.jbossas7.json.Operation;
-//import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
-//import org.rhq.modules.plugins.jbossas7.json.Remove;
-//import org.rhq.modules.plugins.jbossas7.json.Result;
-//import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
-//
-///**
-// * Test exercising the subsystem=security/SecurityDomain/[Authentication, Authorization, Mapping, Audit, Acl,
-// * Identity-Trust]
-// * @author Simeon Pinder
-// */
-//@Test(groups = "unit")
-//public class SecurityModuleOptionsTest extends AbstractConfigurationHandlingTest {
-//
-// private static String user = "rhqadmin";
-// private static String pass = "as7";
-// private static String host = "localhost";
-// private static ASConnection con = null;
-// private static ObjectMapper mapper = null;
-// private ModuleOptionsComponent moc = null;
-//
-// //Define some shared and reusable content
-// static HashMap<String, String> jsonMap = new HashMap<String, String>();
-// static {
-// jsonMap
-// .put(
-// "login-modules",
-// "[{\"flag\":\"required\", \"code\":\"Ldap\", \"module-options\":{\"bindDn\":\"uid=ldapSecureUser,ou=People,dc=redat,dc=com\", \"bindPw\":\"test126\", \"allowEmptyPasswords\":\"true\"}}]");
-// // "[{\"flag\":\"required\", \"code\":\"Ldap\"}]");
-// jsonMap
-// .put(
-// "policy-modules",
-// "[{\"flag\":\"requisite\", \"code\":\"LdapExtended\", \"module-options\":{\"policy\":\"module\", \"policy1\":\"module1\"}}]");
-// jsonMap
-// .put("mapping-modules",
-// "[{\"code\":\"Test\", \"type\":\"attribute\", \"module-options\":{\"mapping\":\"module\", \"mapping1\":\"module1\"}}]");
-// jsonMap.put("provider-modules",
-// "[{\"code\":\"Providers\", \"module-options\":{\"provider\":\"module\", \"provider1\":\"module1\"}}]");
-// }
-//
-// @BeforeSuite
-// private void initializeConnectionDetails() {
-// con = new ASConnection(host, 9990, user, pass);
-// mapper = new ObjectMapper();
-// mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
-//
-// moc = new ModuleOptionsComponent();
-// }
-//
-// public static void main(String[] args) {
-// SecurityModuleOptionsTest test = new SecurityModuleOptionsTest();
-// try {
-// test.initializeConnectionDetails();
-// test.testPopulateModuleOptionsAndTypes();
-// } catch (Exception e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-//
-// }
-//
-// /**The test reads the existing property values, deserializes them and writes the same
-// * contents back out to a running instance for all known ModuleOptionTypes.
-// *
-// * @throws Exception
-// */
-// public void testPopulateModuleOptionsAndTypes() throws Exception {
-//
-// //as7 node details.
-// String securityDomainId = "testDomain";
-// //TODO: spinder 6-6-12: this cannot run as a standalone itest until JIRA https://issues.jboss.org/browse/AS7-4951
-// // is addressed as there is no way to automate setup of the information being tested.
-// String address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
-// boolean verboseOutput = true;
-// boolean executeOperation = true;
-// for (ModuleOptionType t : ModuleOptionType.values()) {
-// String attribute = t.getAttribute();
-// if (verboseOutput) {
-// System.out.println("======= Running with ModuleOptionType:" + t + " attribute:" + attribute + ":");
-// }
-// if (attribute.equals("policy-modules")) {
-// address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
-// } else if (attribute.equals("acl-modules")) {
-// address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
-// } else if (attribute.equals("mapping-modules")) {
-// address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
-// } else if (attribute.equals("trust-modules")) {
-// address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
-// } else if (attribute.equals("provider-modules")) {
-// address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
-// } else if (attribute.equals("login-modules")) {
-// address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
-// } else {
-// assert false : "An unknown attribute '" + attribute
-// + "' was found. Is there a new type to be supported?";
-// }
-//
-// //test operation- read property always available.
-// Operation op = null;
-//
-// //read the login-modules attribute
-// op = new ReadAttribute(new Address(address), attribute);
-// Result result = exerciseOperation(op, true, verboseOutput);
-// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
-// + result.getFailureDescription();
-// //extract current results
-// Object rawResult = result.getResult();
-// assert rawResult != null : "Read of attribute'" + attribute + "' from address '" + address
-// + "' has returned no value. Are those values in the model?";
-//
-// List<Value> list2 = new ArrayList<Value>();
-// //populate the Value component complete with module Options.
-// list2 = moc.populateSecurityDomainModuleOptions(result,
-// ModuleOptionsComponent.loadModuleOptionType(attribute));
-// if (verboseOutput) {
-// if (rawResult != null) {
-// System.out.println("Raw Result is:" + rawResult + " and of type:" + rawResult.getClass());
-// } else {
-// System.out.println("Read of attribute'" + attribute + "' from address '" + address
-// + "' has returned no value. Are those values in the model?");
-// }
-// }
-// //write the login-modules attribute
-// op = new WriteAttribute(new Address(address));
-// op.addAdditionalProperty("name", attribute);//attribute to execute on
-// op.addAdditionalProperty("value", list2);
-//
-// //Now test the operation
-// result = exerciseOperation(op, executeOperation, verboseOutput);
-// assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
-// + "' failed to write the resource.." + result.getFailureDescription();
-//
-// //read the login-modules attribute
-// op = new ReadAttribute(new Address(address), attribute);
-// result = exerciseOperation(op, true, verboseOutput);
-// assert (result.isSuccess() == true) : "The operation '" + op + "' failed to read the resource."
-// + result.getFailureDescription();
-// }
-// if (verboseOutput) {
-// System.out.println("Successfully detected,read and wrote out attribute values for:");
-// for (ModuleOptionType type : ModuleOptionType.values()) {
-// System.out.println("\n" + type.ordinal() + " " + type.name());
-// }
-// }
-// }
-//
-// /**Attempts to create a new Authentication node(authentication=classic) with a
-// * 'login-modules' attribute complete with 'code':'Ldap' and 'flag':'required'
-// * and some sample 'module-options' values.
-// *
-// */
-// @Test(enabled = true)
-// public void testCreateSecurityDomainChildLoginModules() {
-// boolean execute = true;
-// boolean verboseOutput = false;
-// String address = "subsystem=security,security-domain=testDomain3,authentication=classic";
-// String attribute = ModuleOptionType.Authentication.getAttribute();
-//
-// //test operation- read property always available.
-// Operation op = null;
-//
-// //read the login-modules attribute
-// op = new ReadAttribute(new Address(address), attribute);
-// Result result = exerciseOperation(op, execute, verboseOutput);
-// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
-// + result.getFailureDescription();
-//
-// //extract current results
-// Object rawResult = result.getResult();
-//
-// //#### Have to create new content for the new node.
-// List<Value> moduleTypeValue = new ArrayList<Value>();
-// try {
-// // loading 'login-module'
-// JsonNode node = mapper.readTree(jsonMap.get(attribute));
-// result.setResult(mapper.treeToValue(node, Object.class));
-// } catch (JsonProcessingException e) {
-// e.printStackTrace();
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-//
-// //populate the Value component complete with module Options.
-// moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
-// ModuleOptionsComponent.loadModuleOptionType(attribute));
-//
-// //add the login-modules attribute
-// op = ModuleOptionsComponent
-// .createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
-//
-// result = exerciseOperation(op, execute, verboseOutput);
-// assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
-// + "' failed to write the resource.." + result.getFailureDescription();
-//
-// //read the login-modules attribute
-// op = new ReadAttribute(new Address(address), attribute);
-// result = exerciseOperation(op, execute, verboseOutput);
-// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
-// + result.getFailureDescription();
-//
-// //exercise values retrieved from read
-// List<Value> serverResponse = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
-// ModuleOptionsComponent.loadModuleOptionType(attribute));
-// Value serverState = serverResponse.get(0);
-// assert serverState.getFlag().equals("required") : "Incorrect state retrieved for 'flag'. Expected 'required'.";
-// assert serverState.getCode().equals("Ldap") : "Incorrect state retrieved for 'code'. Expected 'Ldap'.";
-// LinkedHashMap<String, Object> options = serverState.getOptions();
-// assert options.size() == 3 : "Invalid number of module options returned. Expected 3.";
-// int found = 0;
-// for (String key : options.keySet()) {
-// if (key.equals("bindPw")) {
-// assert "test126".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
-// found++;
-// } else if (key.equals("bindDn")) {
-// assert "uid=ldapSecureUser,ou=People,dc=redat,dc=com".equals(options.get(key)) : "Module option value not correct for key '"
-// + key + "'.";
-// found++;
-// } else if (key.equals("allowEmptyPasswords")) {
-// assert "true".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
-// found++;
-// }
-// }
-// assert found == 3 : "All module options were not loaded.";
-//
-// //remove the original node to reset for next run.
-// op = new Remove(new Address(address));
-// result = exerciseOperation(op, execute, verboseOutput);
-// assert result.isSuccess() == true : "The operation '" + op + "' failed to remove the resource."
-// + result.getFailureDescription();
-// }
-//
-// /** For each operation
-// * - will write verbose json and operation details to system.out if verboseOutput = true;
-// * - will execute the operation against running server if execute = true.
-// *
-// * @param op
-// * @param execute
-// * @param verboseOutput
-// * @return
-// */
-// public static Result exerciseOperation(Operation op, boolean execute, boolean verboseOutput) {
-// //display operation as AS7 plugin will build it
-// if (verboseOutput) {
-// System.out.println("\tOperation is:" + op);
-// }
-//
-// String jsonToSend = "";
-// try {
-// // jsonToSend = mapper.writeValueAsString(op);
-// jsonToSend = mapper.defaultPrettyPrintingWriter().writeValueAsString(op);
-// } catch (JsonGenerationException e) {
-// e.printStackTrace();
-// } catch (JsonMappingException e) {
-// e.printStackTrace();
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-// //As generated by jackson mapper
-// if (verboseOutput) {
-// System.out.println("@@@@ OUTBOUND JSON#\n" + jsonToSend + "#");
-// }
-//
-// //Execute the operation
-// Result result = new Result();
-// if (execute) {
-// result = con.execute(op);
-// } else {
-// if (verboseOutput) {
-// System.out.println("**** NOTE: Execution disabled . NOT exercising write-attribute operation. **** ");
-// }
-// }
-// if (verboseOutput) {
-// //result wrapper details
-// System.out.println("\tResult:" + result);
-// //detailed results
-// System.out.println("\tValue:" + result.getResult());
-// System.out.println("-----------------------------------------------------\n");
-// }
-// return result;
-// }
-//}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java
new file mode 100644
index 0000000..7f9464a
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java
@@ -0,0 +1,525 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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.modules.plugins.jbossas7.itest.standalone;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Set;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.agent.inventory.CreateResourceRequest;
+import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
+import org.rhq.core.clientapi.agent.inventory.DeleteResourceRequest;
+import org.rhq.core.clientapi.agent.inventory.DeleteResourceResponse;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.DeleteResourceStatus;
+import org.rhq.core.domain.resource.InventoryStatus;
+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.inventory.InventoryManager;
+import org.rhq.modules.plugins.jbossas7.ASConnection;
+import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent;
+import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
+import org.rhq.test.arquillian.RunDiscovery;
+
+/**
+ * Test exercising the subsystem=security/SecurityDomain/[Authentication(Classic|Jaspi),
+ * Authorization, Mapping, Audit, Acl,
+ * Identity-Trust]
+ * @author Simeon Pinder
+ */
+@Test(groups = { "integration", "pc", "standalone" }, singleThreaded = true)
+public class SecurityModuleOptionsTest extends AbstractJBossAS7PluginTest {
+
+ private static String user = "rhqadmin";
+ private static String pass = "as7";
+ private static String host = "localhost";
+ private static ASConnection con = null;
+ private static ObjectMapper mapper = null;
+ private ModuleOptionsComponent moc = null;
+
+ private static String TEST_DOMAIN = "testDomain";
+ private static Resource securityResource = null;
+ private static String SECURITY_RESOURCE_TYPE = "Security";
+ private static String SECURITY_RESOURCE_KEY = "subsystem=security";
+ private static String SECURITY_DOMAIN_RESOURCE_TYPE = "Security Domain";
+ private static String SECURITY_DOMAIN_RESOURCE_KEY = "security-domain";
+ private static String AUTH_CLASSIC_RESOURCE_TYPE = "Authentication (Classic)";
+ private static String AUTH_CLASSIC_RESOURCE_KEY = "authentication=classic";
+
+ protected static final String DC_HOST = System.getProperty("jboss.domain.bindAddress");
+ protected static final int DC_HTTP_PORT = Integer.valueOf(System.getProperty("jboss.domain.httpManagementPort"));
+ protected static final String DC_USER = AbstractJBossAS7PluginTest.MANAGEMENT_USERNAME;
+ protected static final String DC_PASS = AbstractJBossAS7PluginTest.MANAGEMENT_PASSWORD;
+
+ ASConnection getASConnection() {
+ ASConnection connection = new ASConnection(DC_HOST, DC_HTTP_PORT, DC_USER, DC_PASS);
+ return connection;
+ }
+
+ public static final ResourceType RESOURCE_TYPE = new ResourceType(SECURITY_RESOURCE_TYPE, PLUGIN_NAME,
+ ResourceCategory.SERVICE, null);
+ private static final String RESOURCE_KEY = SECURITY_RESOURCE_KEY;
+
+ //Define some shared and reusable content
+ static HashMap<String, String> jsonMap = new HashMap<String, String>();
+ static {
+ jsonMap
+ .put(
+ "login-modules",
+ "[{\"flag\":\"required\", \"code\":\"Ldap\", \"module-options\":{\"bindDn\":\"uid=ldapSecureUser,ou=People,dc=redat,dc=com\", \"bindPw\":\"test126\", \"allowEmptyPasswords\":\"true\"}}]");
+ jsonMap
+ .put(
+ "policy-modules",
+ "[{\"flag\":\"requisite\", \"code\":\"LdapExtended\", \"module-options\":{\"policy\":\"module\", \"policy1\":\"module1\"}}]");
+ jsonMap
+ .put("mapping-modules",
+ "[{\"code\":\"Test\", \"type\":\"attribute\", \"module-options\":{\"mapping\":\"module\", \"mapping1\":\"module1\"}}]");
+ jsonMap.put("provider-modules",
+ "[{\"code\":\"Providers\", \"module-options\":{\"provider\":\"module\", \"provider1\":\"module1\"}}]");
+ }
+
+ @Test(priority = 10, groups = "discovery")
+ @RunDiscovery(discoverServices = true, discoverServers = true)
+ public void initialDiscovery() throws Exception {
+ Resource platform = this.pluginContainer.getInventoryManager().getPlatform();
+ assertNotNull(platform);
+ assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ Thread.sleep(20 * 1000L); // delay so that PC gets a chance to scan for resources
+ }
+
+ @Test(priority = 12)
+ public void testCreateSecurityDomain() throws Exception {
+ //get the root security resource
+ securityResource = getResource();
+
+ //plugin config
+ Configuration createPlugConfig = new Configuration();
+ createPlugConfig.put(new PropertySimple("path", SECURITY_DOMAIN_RESOURCE_KEY += "=" + TEST_DOMAIN));
+
+ //resource config
+ Configuration createResConfig = new Configuration();
+ createResConfig.put(new PropertySimple("name", TEST_DOMAIN));
+
+ CreateResourceRequest request = new CreateResourceRequest();
+ request.setParentResourceId(securityResource.getId());
+ request.setPluginConfiguration(createPlugConfig);
+ request.setPluginName(PLUGIN_NAME);
+ request.setResourceConfiguration(createResConfig);
+ request.setResourceName(TEST_DOMAIN);
+ request.setResourceTypeName(SECURITY_DOMAIN_RESOURCE_TYPE);
+
+ CreateResourceResponse response = pluginContainer.getResourceFactoryManager().executeCreateResourceImmediately(
+ request);
+
+ assert response.getStatus() == CreateResourceStatus.SUCCESS : "The Security Domain creation failed with an error mesasge: "
+ + response.getErrorMessage();
+ }
+
+ @Test(priority = 13)
+ public void testAuthenticationClassic() throws Exception {
+ //get the root security resource
+ securityResource = getResource();
+
+ //find TEST_DOMAIN 'security-domain'
+ Resource securityDomain = null;
+ Set<Resource> childResources = securityResource.getChildResources();
+ for (Resource r : childResources) {
+ if (r.getName().indexOf(TEST_DOMAIN) > -1) {
+ securityDomain = r;
+ }
+ }
+
+ //plugin config
+ Configuration createPlugConfig = new Configuration();
+ createPlugConfig.put(new PropertySimple("path", AUTH_CLASSIC_RESOURCE_KEY));
+
+ //resource config
+ Configuration createResConfig = new Configuration();
+ createResConfig.put(new PropertySimple("code", "Ldap"));
+ createResConfig.put(new PropertySimple("flag", "requisite"));
+
+ CreateResourceRequest request = new CreateResourceRequest();
+ request.setParentResourceId(securityDomain.getId());
+ request.setPluginConfiguration(createPlugConfig);
+ request.setPluginName(PLUGIN_NAME);
+ request.setResourceConfiguration(createResConfig);
+ request.setResourceName("Test - notUsed.");
+
+ request.setResourceTypeName(AUTH_CLASSIC_RESOURCE_TYPE);
+
+ CreateResourceResponse response = pluginContainer.getResourceFactoryManager().executeCreateResourceImmediately(
+ request);
+
+ assert response.getStatus() == CreateResourceStatus.SUCCESS : "The 'Authentication (Classic)' node creation failed with an error mesasge: "
+ + response.getErrorMessage();
+ }
+
+ @Test(priority = 14)
+ public void testDeleteSecurityDomain() throws Exception {
+ //get the root security resource
+ securityResource = getResource();
+ Resource found = null;
+ Set<Resource> childResources = securityResource.getChildResources();
+ for (Resource r : childResources) {
+ if (r.getName().indexOf(TEST_DOMAIN) > -1) {
+ found = r;
+ }
+ }
+
+ //plugin config
+ Configuration deletePlugConfig = new Configuration();
+ deletePlugConfig.put(new PropertySimple("path", SECURITY_DOMAIN_RESOURCE_KEY += "=" + TEST_DOMAIN));
+
+ //resource config
+ Configuration deleteResConfig = new Configuration();
+ deleteResConfig.put(new PropertySimple("name", TEST_DOMAIN));
+
+ DeleteResourceRequest request = new DeleteResourceRequest();
+ if (found != null) {
+ request.setResourceId(found.getId());
+ }
+ DeleteResourceResponse response = pluginContainer.getResourceFactoryManager().executeDeleteResourceImmediately(
+ request);
+
+ assert response.getStatus() == DeleteResourceStatus.SUCCESS : "The Security Domain deletion failed with an error mesasge: "
+ + response.getErrorMessage();
+ }
+
+ private Resource getResource() {
+
+ InventoryManager im = pluginContainer.getInventoryManager();
+ Resource platform = im.getPlatform();
+ Resource server = getResourceByTypeAndKey(platform, StandaloneServerComponentTest.RESOURCE_TYPE,
+ StandaloneServerComponentTest.RESOURCE_KEY);
+ Resource bindings = getResourceByTypeAndKey(server, RESOURCE_TYPE, RESOURCE_KEY);
+ return bindings;
+ }
+
+ private Resource getResource(Resource parentResource, String pluginDescriptorTypeName, String resourceKey) {
+ Resource resource = null;
+ if (((parentResource != null) & (pluginDescriptorTypeName != null) & (resourceKey != null))
+ & (((!pluginDescriptorTypeName.isEmpty()) & (!resourceKey.isEmpty())))) {
+ ResourceType resourceType = buildResourceType(pluginDescriptorTypeName);
+ resource = getResourceByTypeAndKey(parentResource, resourceType, resourceKey);
+ }
+ return resource;
+ }
+
+ private ResourceType buildResourceType(String pluginTypeName) {
+ ResourceType created = null;
+ if ((pluginTypeName != null) && (!pluginTypeName.isEmpty())) {
+ created = new ResourceType(pluginTypeName, PLUGIN_NAME, ResourceCategory.SERVICE, null);
+ }
+ return created;
+ }
+
+ //##################################################################
+ // /**The test reads the existing property values, deserializes them and writes the same
+ // * contents back out to a running instance for all known ModuleOptionTypes.
+ // *
+ // * @throws Exception
+ // */
+ // public void testPopulateModuleOptionsAndTypes() throws Exception {
+ //
+ // //as7 node details.
+ // String securityDomainId = "testDomain";
+ // //TODO: spinder 6-6-12: this cannot run as a standalone itest until JIRA https://issues.jboss.org/browse/AS7-4951
+ // // is addressed as there is no way to automate setup of the information being tested.
+ // String address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+ // boolean verboseOutput = true;
+ // boolean executeOperation = true;
+ // for (ModuleOptionType t : ModuleOptionType.values()) {
+ // String attribute = t.getAttribute();
+ // if (verboseOutput) {
+ // System.out.println("======= Running with ModuleOptionType:" + t + " attribute:" + attribute + ":");
+ // }
+ // if (attribute.equals("policy-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
+ // } else if (attribute.equals("acl-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
+ // } else if (attribute.equals("mapping-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
+ // } else if (attribute.equals("trust-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
+ // } else if (attribute.equals("provider-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
+ // } else if (attribute.equals("login-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+ // } else {
+ // assert false : "An unknown attribute '" + attribute
+ // + "' was found. Is there a new type to be supported?";
+ // }
+ //
+ // //test operation- read property always available.
+ // Operation op = null;
+ //
+ // //read the login-modules attribute
+ // op = new ReadAttribute(new Address(address), attribute);
+ // Result result = exerciseOperation(op, true, verboseOutput);
+ // assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+ // + result.getFailureDescription();
+ // //extract current results
+ // Object rawResult = result.getResult();
+ // assert rawResult != null : "Read of attribute'" + attribute + "' from address '" + address
+ // + "' has returned no value. Are those values in the model?";
+ //
+ // List<Value> list2 = new ArrayList<Value>();
+ // //populate the Value component complete with module Options.
+ // list2 = moc.populateSecurityDomainModuleOptions(result,
+ // ModuleOptionsComponent.loadModuleOptionType(attribute));
+ // if (verboseOutput) {
+ // if (rawResult != null) {
+ // System.out.println("Raw Result is:" + rawResult + " and of type:" + rawResult.getClass());
+ // } else {
+ // System.out.println("Read of attribute'" + attribute + "' from address '" + address
+ // + "' has returned no value. Are those values in the model?");
+ // }
+ // }
+ // //write the login-modules attribute
+ // op = new WriteAttribute(new Address(address));
+ // op.addAdditionalProperty("name", attribute);//attribute to execute on
+ // op.addAdditionalProperty("value", list2);
+ //
+ // //Now test the operation
+ // result = exerciseOperation(op, executeOperation, verboseOutput);
+ // assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+ // + "' failed to write the resource.." + result.getFailureDescription();
+ //
+ // //read the login-modules attribute
+ // op = new ReadAttribute(new Address(address), attribute);
+ // result = exerciseOperation(op, true, verboseOutput);
+ // assert (result.isSuccess() == true) : "The operation '" + op + "' failed to read the resource."
+ // + result.getFailureDescription();
+ // }
+ // if (verboseOutput) {
+ // System.out.println("Successfully detected,read and wrote out attribute values for:");
+ // for (ModuleOptionType type : ModuleOptionType.values()) {
+ // System.out.println("\n" + type.ordinal() + " " + type.name());
+ // }
+ // }
+ // }
+ //
+ // /**Attempts to create a new Authentication node(authentication=classic) with a
+ // * 'login-modules' attribute complete with 'code':'Ldap' and 'flag':'required'
+ // * and some sample 'module-options' values.
+ // *
+ // */
+ // @Test(enabled = true)
+ // public void testCreateSecurityDomainChildLoginModules() {
+ // boolean execute = true;
+ // boolean verboseOutput = false;
+ // String address = "subsystem=security,security-domain=testDomain3,authentication=classic";
+ // String attribute = ModuleOptionType.Authentication.getAttribute();
+ //
+ // //test operation- read property always available.
+ // Operation op = null;
+ //
+ // //read the login-modules attribute
+ // op = new ReadAttribute(new Address(address), attribute);
+ // Result result = exerciseOperation(op, execute, verboseOutput);
+ // assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+ // + result.getFailureDescription();
+ //
+ // //extract current results
+ // Object rawResult = result.getResult();
+ //
+ // //#### Have to create new content for the new node.
+ // List<Value> moduleTypeValue = new ArrayList<Value>();
+ // try {
+ // // loading 'login-module'
+ // JsonNode node = mapper.readTree(jsonMap.get(attribute));
+ // result.setResult(mapper.treeToValue(node, Object.class));
+ // } catch (JsonProcessingException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ //
+ // //populate the Value component complete with module Options.
+ // moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ // ModuleOptionsComponent.loadModuleOptionType(attribute));
+ //
+ // //add the login-modules attribute
+ // op = ModuleOptionsComponent
+ // .createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
+ //
+ // result = exerciseOperation(op, execute, verboseOutput);
+ // assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+ // + "' failed to write the resource.." + result.getFailureDescription();
+ //
+ // //read the login-modules attribute
+ // op = new ReadAttribute(new Address(address), attribute);
+ // result = exerciseOperation(op, execute, verboseOutput);
+ // assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+ // + result.getFailureDescription();
+ //
+ // //exercise values retrieved from read
+ // List<Value> serverResponse = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ // ModuleOptionsComponent.loadModuleOptionType(attribute));
+ // Value serverState = serverResponse.get(0);
+ // assert serverState.getFlag().equals("required") : "Incorrect state retrieved for 'flag'. Expected 'required'.";
+ // assert serverState.getCode().equals("Ldap") : "Incorrect state retrieved for 'code'. Expected 'Ldap'.";
+ // LinkedHashMap<String, Object> options = serverState.getOptions();
+ // assert options.size() == 3 : "Invalid number of module options returned. Expected 3.";
+ // int found = 0;
+ // for (String key : options.keySet()) {
+ // if (key.equals("bindPw")) {
+ // assert "test126".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+ // found++;
+ // } else if (key.equals("bindDn")) {
+ // assert "uid=ldapSecureUser,ou=People,dc=redat,dc=com".equals(options.get(key)) : "Module option value not correct for key '"
+ // + key + "'.";
+ // found++;
+ // } else if (key.equals("allowEmptyPasswords")) {
+ // assert "true".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+ // found++;
+ // }
+ // }
+ // assert found == 3 : "All module options were not loaded.";
+ //
+ // //remove the original node to reset for next run.
+ // op = new Remove(new Address(address));
+ // result = exerciseOperation(op, execute, verboseOutput);
+ // assert result.isSuccess() == true : "The operation '" + op + "' failed to remove the resource."
+ // + result.getFailureDescription();
+ // }
+ //
+ // /** For each operation
+ // * - will write verbose json and operation details to system.out if verboseOutput = true;
+ // * - will execute the operation against running server if execute = true.
+ // *
+ // * @param op
+ // * @param execute
+ // * @param verboseOutput
+ // * @return
+ // */
+ // public static Result exerciseOperation(Operation op, boolean execute, boolean verboseOutput) {
+ // //display operation as AS7 plugin will build it
+ // if (verboseOutput) {
+ // System.out.println("\tOperation is:" + op);
+ // }
+ //
+ // String jsonToSend = "";
+ // try {
+ // jsonToSend = mapper.defaultPrettyPrintingWriter().writeValueAsString(op);
+ // } catch (JsonGenerationException e) {
+ // e.printStackTrace();
+ // } catch (JsonMappingException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // //As generated by jackson mapper
+ // if (verboseOutput) {
+ // System.out.println("@@@@ OUTBOUND JSON#\n" + jsonToSend + "#");
+ // }
+ //
+ // //Execute the operation
+ // Result result = new Result();
+ // if (execute) {
+ // result = con.execute(op);
+ // } else {
+ // if (verboseOutput) {
+ // System.out.println("**** NOTE: Execution disabled . NOT exercising write-attribute operation. **** ");
+ // }
+ // }
+ // if (verboseOutput) {
+ // //result wrapper details
+ // System.out.println("\tResult:" + result);
+ // //detailed results
+ // System.out.println("\tValue:" + result.getResult());
+ // System.out.println("-----------------------------------------------------\n");
+ // }
+ // return result;
+ // }
+ //
+ // @Test(priority = 10, groups = "discovery")
+ // public void initialSetup() throws Exception {
+ // String securityDomainId = TEST_DOMAIN + "1";
+ // Result result = null;
+ // Operation op = null;
+ //
+ // //create the initial securityDomain
+ // op = new Operation("add", new Address("subsystem=security,security-domain=" + securityDomainId));
+ // ASConnection connection = getASConnection();
+ // con = connection;
+ // mapper = new ObjectMapper();
+ // mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
+ //
+ // moc = new ModuleOptionsComponent();
+ // result = connection.execute(op);
+ // System.out.println("#### Op is:" + op);
+ // System.out.println("#### Result is:" + result);
+ //
+ // //iterate over jsonMap
+ // for (String key : jsonMap.keySet()) {
+ // String attribute = key;
+ // String address = "";
+ // if (attribute.equals("policy-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
+ // } else if (attribute.equals("acl-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
+ // } else if (attribute.equals("mapping-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
+ // } else if (attribute.equals("trust-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
+ // } else if (attribute.equals("provider-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
+ // } else if (attribute.equals("login-modules")) {
+ // address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+ // } else {
+ // assert false : "An unknown attribute '" + attribute
+ // + "' was found. Is there a new type to be supported?";
+ // }
+ // //#### Have to create new content for the new node.
+ // List<Value> moduleTypeValue = new ArrayList<Value>();
+ //
+ // try {
+ // // loading 'login-module'
+ // JsonNode node = mapper.readTree(jsonMap.get(attribute));
+ // result.setResult(mapper.treeToValue(node, Object.class));
+ // } catch (JsonProcessingException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ //
+ // //populate the Value component complete with module Options.
+ // moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ // ModuleOptionsComponent.loadModuleOptionType(attribute));
+ //
+ // //add the login-modules attribute
+ // op = ModuleOptionsComponent.createAddModuleOptionTypeOperation(new Address(address), attribute,
+ // moduleTypeValue);
+ //
+ // result = exerciseOperation(op, true, true);
+ // assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+ // + "' failed to write the resource.." + result.getFailureDescription();
+ // }
+ // }
+}
commit ab6c8f0f8f72d6b590aec1e532cae9e15d185ec0
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Jun 20 08:56:40 2012 -0400
[BZ 826542] disable incorrect unit tests. More work necessary to get this to pass with Arquillian properly.
(cherry picked from commit 51d5d2537e1dc159f7c1a71302be9f810ba63613)
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
index 49d8040..e80ddec 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
@@ -1,319 +1,319 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License 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.modules.plugins.jbossas7;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.Test;
-
-import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.ModuleOptionType;
-import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.Value;
-import org.rhq.modules.plugins.jbossas7.json.Address;
-import org.rhq.modules.plugins.jbossas7.json.Operation;
-import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
-import org.rhq.modules.plugins.jbossas7.json.Remove;
-import org.rhq.modules.plugins.jbossas7.json.Result;
-import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
-
-/**
- * Test exercising the subsystem=security/SecurityDomain/[Authentication, Authorization, Mapping, Audit, Acl,
- * Identity-Trust]
- * @author Simeon Pinder
- */
-@Test(groups = "unit")
-public class SecurityModuleOptionsTest extends AbstractConfigurationHandlingTest {
-
- private static String user = "rhqadmin";
- private static String pass = "as7";
- private static String host = "localhost";
- private static ASConnection con = null;
- private static ObjectMapper mapper = null;
- private ModuleOptionsComponent moc = null;
-
- //Define some shared and reusable content
- static HashMap<String, String> jsonMap = new HashMap<String, String>();
- static {
- jsonMap
- .put(
- "login-modules",
- "[{\"flag\":\"required\", \"code\":\"Ldap\", \"module-options\":{\"bindDn\":\"uid=ldapSecureUser,ou=People,dc=redat,dc=com\", \"bindPw\":\"test126\", \"allowEmptyPasswords\":\"true\"}}]");
- // "[{\"flag\":\"required\", \"code\":\"Ldap\"}]");
- jsonMap
- .put(
- "policy-modules",
- "[{\"flag\":\"requisite\", \"code\":\"LdapExtended\", \"module-options\":{\"policy\":\"module\", \"policy1\":\"module1\"}}]");
- jsonMap
- .put("mapping-modules",
- "[{\"code\":\"Test\", \"type\":\"attribute\", \"module-options\":{\"mapping\":\"module\", \"mapping1\":\"module1\"}}]");
- jsonMap.put("provider-modules",
- "[{\"code\":\"Providers\", \"module-options\":{\"provider\":\"module\", \"provider1\":\"module1\"}}]");
- }
-
- @BeforeSuite
- private void initializeConnectionDetails() {
- con = new ASConnection(host, 9990, user, pass);
- mapper = new ObjectMapper();
- mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
-
- moc = new ModuleOptionsComponent();
- }
-
- public static void main(String[] args) {
- SecurityModuleOptionsTest test = new SecurityModuleOptionsTest();
- try {
- test.initializeConnectionDetails();
- test.testPopulateModuleOptionsAndTypes();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- /**The test reads the existing property values, deserializes them and writes the same
- * contents back out to a running instance for all known ModuleOptionTypes.
- *
- * @throws Exception
- */
- public void testPopulateModuleOptionsAndTypes() throws Exception {
-
- //as7 node details.
- String securityDomainId = "testDomain";
- //TODO: spinder 6-6-12: this cannot run as a standalone itest until JIRA https://issues.jboss.org/browse/AS7-4951
- // is addressed as there is no way to automate setup of the information being tested.
- String address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
- boolean verboseOutput = true;
- boolean executeOperation = true;
- for (ModuleOptionType t : ModuleOptionType.values()) {
- String attribute = t.getAttribute();
- if (verboseOutput) {
- System.out.println("======= Running with ModuleOptionType:" + t + " attribute:" + attribute + ":");
- }
- if (attribute.equals("policy-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
- } else if (attribute.equals("acl-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
- } else if (attribute.equals("mapping-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
- } else if (attribute.equals("trust-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
- } else if (attribute.equals("provider-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
- } else if (attribute.equals("login-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
- } else {
- assert false : "An unknown attribute '" + attribute
- + "' was found. Is there a new type to be supported?";
- }
-
- //test operation- read property always available.
- Operation op = null;
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- Result result = exerciseOperation(op, true, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
- //extract current results
- Object rawResult = result.getResult();
- assert rawResult != null : "Read of attribute'" + attribute + "' from address '" + address
- + "' has returned no value. Are those values in the model?";
-
- List<Value> list2 = new ArrayList<Value>();
- //populate the Value component complete with module Options.
- list2 = moc.populateSecurityDomainModuleOptions(result,
- ModuleOptionsComponent.loadModuleOptionType(attribute));
- if (verboseOutput) {
- if (rawResult != null) {
- System.out.println("Raw Result is:" + rawResult + " and of type:" + rawResult.getClass());
- } else {
- System.out.println("Read of attribute'" + attribute + "' from address '" + address
- + "' has returned no value. Are those values in the model?");
- }
- }
- //write the login-modules attribute
- op = new WriteAttribute(new Address(address));
- op.addAdditionalProperty("name", attribute);//attribute to execute on
- op.addAdditionalProperty("value", list2);
-
- //Now test the operation
- result = exerciseOperation(op, executeOperation, verboseOutput);
- assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
- + "' failed to write the resource.." + result.getFailureDescription();
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- result = exerciseOperation(op, true, verboseOutput);
- assert (result.isSuccess() == true) : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
- }
- if (verboseOutput) {
- System.out.println("Successfully detected,read and wrote out attribute values for:");
- for (ModuleOptionType type : ModuleOptionType.values()) {
- System.out.println("\n" + type.ordinal() + " " + type.name());
- }
- }
- }
-
- /**Attempts to create a new Authentication node(authentication=classic) with a
- * 'login-modules' attribute complete with 'code':'Ldap' and 'flag':'required'
- * and some sample 'module-options' values.
- *
- */
- @Test(enabled = true)
- public void testCreateSecurityDomainChildLoginModules() {
- boolean execute = true;
- boolean verboseOutput = false;
- String address = "subsystem=security,security-domain=testDomain3,authentication=classic";
- String attribute = ModuleOptionType.Authentication.getAttribute();
-
- //test operation- read property always available.
- Operation op = null;
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- Result result = exerciseOperation(op, execute, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
-
- //extract current results
- Object rawResult = result.getResult();
-
- //#### Have to create new content for the new node.
- List<Value> moduleTypeValue = new ArrayList<Value>();
- try {
- // loading 'login-module'
- JsonNode node = mapper.readTree(jsonMap.get(attribute));
- result.setResult(mapper.treeToValue(node, Object.class));
- } catch (JsonProcessingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- //populate the Value component complete with module Options.
- moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
- ModuleOptionsComponent.loadModuleOptionType(attribute));
-
- //add the login-modules attribute
- op = ModuleOptionsComponent
- .createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
-
- result = exerciseOperation(op, execute, verboseOutput);
- assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
- + "' failed to write the resource.." + result.getFailureDescription();
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- result = exerciseOperation(op, execute, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
-
- //exercise values retrieved from read
- List<Value> serverResponse = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
- ModuleOptionsComponent.loadModuleOptionType(attribute));
- Value serverState = serverResponse.get(0);
- assert serverState.getFlag().equals("required") : "Incorrect state retrieved for 'flag'. Expected 'required'.";
- assert serverState.getCode().equals("Ldap") : "Incorrect state retrieved for 'code'. Expected 'Ldap'.";
- LinkedHashMap<String, Object> options = serverState.getOptions();
- assert options.size() == 3 : "Invalid number of module options returned. Expected 3.";
- int found = 0;
- for (String key : options.keySet()) {
- if (key.equals("bindPw")) {
- assert "test126".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
- found++;
- } else if (key.equals("bindDn")) {
- assert "uid=ldapSecureUser,ou=People,dc=redat,dc=com".equals(options.get(key)) : "Module option value not correct for key '"
- + key + "'.";
- found++;
- } else if (key.equals("allowEmptyPasswords")) {
- assert "true".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
- found++;
- }
- }
- assert found == 3 : "All module options were not loaded.";
-
- //remove the original node to reset for next run.
- op = new Remove(new Address(address));
- result = exerciseOperation(op, execute, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to remove the resource."
- + result.getFailureDescription();
- }
-
- /** For each operation
- * - will write verbose json and operation details to system.out if verboseOutput = true;
- * - will execute the operation against running server if execute = true.
- *
- * @param op
- * @param execute
- * @param verboseOutput
- * @return
- */
- public static Result exerciseOperation(Operation op, boolean execute, boolean verboseOutput) {
- //display operation as AS7 plugin will build it
- if (verboseOutput) {
- System.out.println("\tOperation is:" + op);
- }
-
- String jsonToSend = "";
- try {
- // jsonToSend = mapper.writeValueAsString(op);
- jsonToSend = mapper.defaultPrettyPrintingWriter().writeValueAsString(op);
- } catch (JsonGenerationException e) {
- e.printStackTrace();
- } catch (JsonMappingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- //As generated by jackson mapper
- if (verboseOutput) {
- System.out.println("@@@@ OUTBOUND JSON#\n" + jsonToSend + "#");
- }
-
- //Execute the operation
- Result result = new Result();
- if (execute) {
- result = con.execute(op);
- } else {
- if (verboseOutput) {
- System.out.println("**** NOTE: Execution disabled . NOT exercising write-attribute operation. **** ");
- }
- }
- if (verboseOutput) {
- //result wrapper details
- System.out.println("\tResult:" + result);
- //detailed results
- System.out.println("\tValue:" + result.getResult());
- System.out.println("-----------------------------------------------------\n");
- }
- return result;
- }
-}
+///*
+// * RHQ Management Platform
+// * Copyright (C) 2005-2011 Red Hat, Inc.
+// * All rights reserved.
+// *
+// * This program is free software; you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License 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.modules.plugins.jbossas7;
+//
+//import java.io.IOException;
+//import java.util.ArrayList;
+//import java.util.HashMap;
+//import java.util.LinkedHashMap;
+//import java.util.List;
+//
+//import org.codehaus.jackson.JsonGenerationException;
+//import org.codehaus.jackson.JsonNode;
+//import org.codehaus.jackson.JsonProcessingException;
+//import org.codehaus.jackson.map.JsonMappingException;
+//import org.codehaus.jackson.map.ObjectMapper;
+//import org.codehaus.jackson.map.SerializationConfig;
+//import org.testng.annotations.BeforeSuite;
+//import org.testng.annotations.Test;
+//
+//import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.ModuleOptionType;
+//import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.Value;
+//import org.rhq.modules.plugins.jbossas7.json.Address;
+//import org.rhq.modules.plugins.jbossas7.json.Operation;
+//import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
+//import org.rhq.modules.plugins.jbossas7.json.Remove;
+//import org.rhq.modules.plugins.jbossas7.json.Result;
+//import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
+//
+///**
+// * Test exercising the subsystem=security/SecurityDomain/[Authentication, Authorization, Mapping, Audit, Acl,
+// * Identity-Trust]
+// * @author Simeon Pinder
+// */
+//@Test(groups = "unit")
+//public class SecurityModuleOptionsTest extends AbstractConfigurationHandlingTest {
+//
+// private static String user = "rhqadmin";
+// private static String pass = "as7";
+// private static String host = "localhost";
+// private static ASConnection con = null;
+// private static ObjectMapper mapper = null;
+// private ModuleOptionsComponent moc = null;
+//
+// //Define some shared and reusable content
+// static HashMap<String, String> jsonMap = new HashMap<String, String>();
+// static {
+// jsonMap
+// .put(
+// "login-modules",
+// "[{\"flag\":\"required\", \"code\":\"Ldap\", \"module-options\":{\"bindDn\":\"uid=ldapSecureUser,ou=People,dc=redat,dc=com\", \"bindPw\":\"test126\", \"allowEmptyPasswords\":\"true\"}}]");
+// // "[{\"flag\":\"required\", \"code\":\"Ldap\"}]");
+// jsonMap
+// .put(
+// "policy-modules",
+// "[{\"flag\":\"requisite\", \"code\":\"LdapExtended\", \"module-options\":{\"policy\":\"module\", \"policy1\":\"module1\"}}]");
+// jsonMap
+// .put("mapping-modules",
+// "[{\"code\":\"Test\", \"type\":\"attribute\", \"module-options\":{\"mapping\":\"module\", \"mapping1\":\"module1\"}}]");
+// jsonMap.put("provider-modules",
+// "[{\"code\":\"Providers\", \"module-options\":{\"provider\":\"module\", \"provider1\":\"module1\"}}]");
+// }
+//
+// @BeforeSuite
+// private void initializeConnectionDetails() {
+// con = new ASConnection(host, 9990, user, pass);
+// mapper = new ObjectMapper();
+// mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
+//
+// moc = new ModuleOptionsComponent();
+// }
+//
+// public static void main(String[] args) {
+// SecurityModuleOptionsTest test = new SecurityModuleOptionsTest();
+// try {
+// test.initializeConnectionDetails();
+// test.testPopulateModuleOptionsAndTypes();
+// } catch (Exception e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+//
+// }
+//
+// /**The test reads the existing property values, deserializes them and writes the same
+// * contents back out to a running instance for all known ModuleOptionTypes.
+// *
+// * @throws Exception
+// */
+// public void testPopulateModuleOptionsAndTypes() throws Exception {
+//
+// //as7 node details.
+// String securityDomainId = "testDomain";
+// //TODO: spinder 6-6-12: this cannot run as a standalone itest until JIRA https://issues.jboss.org/browse/AS7-4951
+// // is addressed as there is no way to automate setup of the information being tested.
+// String address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+// boolean verboseOutput = true;
+// boolean executeOperation = true;
+// for (ModuleOptionType t : ModuleOptionType.values()) {
+// String attribute = t.getAttribute();
+// if (verboseOutput) {
+// System.out.println("======= Running with ModuleOptionType:" + t + " attribute:" + attribute + ":");
+// }
+// if (attribute.equals("policy-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
+// } else if (attribute.equals("acl-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
+// } else if (attribute.equals("mapping-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
+// } else if (attribute.equals("trust-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
+// } else if (attribute.equals("provider-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
+// } else if (attribute.equals("login-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+// } else {
+// assert false : "An unknown attribute '" + attribute
+// + "' was found. Is there a new type to be supported?";
+// }
+//
+// //test operation- read property always available.
+// Operation op = null;
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// Result result = exerciseOperation(op, true, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+// //extract current results
+// Object rawResult = result.getResult();
+// assert rawResult != null : "Read of attribute'" + attribute + "' from address '" + address
+// + "' has returned no value. Are those values in the model?";
+//
+// List<Value> list2 = new ArrayList<Value>();
+// //populate the Value component complete with module Options.
+// list2 = moc.populateSecurityDomainModuleOptions(result,
+// ModuleOptionsComponent.loadModuleOptionType(attribute));
+// if (verboseOutput) {
+// if (rawResult != null) {
+// System.out.println("Raw Result is:" + rawResult + " and of type:" + rawResult.getClass());
+// } else {
+// System.out.println("Read of attribute'" + attribute + "' from address '" + address
+// + "' has returned no value. Are those values in the model?");
+// }
+// }
+// //write the login-modules attribute
+// op = new WriteAttribute(new Address(address));
+// op.addAdditionalProperty("name", attribute);//attribute to execute on
+// op.addAdditionalProperty("value", list2);
+//
+// //Now test the operation
+// result = exerciseOperation(op, executeOperation, verboseOutput);
+// assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+// + "' failed to write the resource.." + result.getFailureDescription();
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// result = exerciseOperation(op, true, verboseOutput);
+// assert (result.isSuccess() == true) : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+// }
+// if (verboseOutput) {
+// System.out.println("Successfully detected,read and wrote out attribute values for:");
+// for (ModuleOptionType type : ModuleOptionType.values()) {
+// System.out.println("\n" + type.ordinal() + " " + type.name());
+// }
+// }
+// }
+//
+// /**Attempts to create a new Authentication node(authentication=classic) with a
+// * 'login-modules' attribute complete with 'code':'Ldap' and 'flag':'required'
+// * and some sample 'module-options' values.
+// *
+// */
+// @Test(enabled = true)
+// public void testCreateSecurityDomainChildLoginModules() {
+// boolean execute = true;
+// boolean verboseOutput = false;
+// String address = "subsystem=security,security-domain=testDomain3,authentication=classic";
+// String attribute = ModuleOptionType.Authentication.getAttribute();
+//
+// //test operation- read property always available.
+// Operation op = null;
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// Result result = exerciseOperation(op, execute, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+//
+// //extract current results
+// Object rawResult = result.getResult();
+//
+// //#### Have to create new content for the new node.
+// List<Value> moduleTypeValue = new ArrayList<Value>();
+// try {
+// // loading 'login-module'
+// JsonNode node = mapper.readTree(jsonMap.get(attribute));
+// result.setResult(mapper.treeToValue(node, Object.class));
+// } catch (JsonProcessingException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+//
+// //populate the Value component complete with module Options.
+// moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+// ModuleOptionsComponent.loadModuleOptionType(attribute));
+//
+// //add the login-modules attribute
+// op = ModuleOptionsComponent
+// .createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
+//
+// result = exerciseOperation(op, execute, verboseOutput);
+// assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+// + "' failed to write the resource.." + result.getFailureDescription();
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// result = exerciseOperation(op, execute, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+//
+// //exercise values retrieved from read
+// List<Value> serverResponse = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+// ModuleOptionsComponent.loadModuleOptionType(attribute));
+// Value serverState = serverResponse.get(0);
+// assert serverState.getFlag().equals("required") : "Incorrect state retrieved for 'flag'. Expected 'required'.";
+// assert serverState.getCode().equals("Ldap") : "Incorrect state retrieved for 'code'. Expected 'Ldap'.";
+// LinkedHashMap<String, Object> options = serverState.getOptions();
+// assert options.size() == 3 : "Invalid number of module options returned. Expected 3.";
+// int found = 0;
+// for (String key : options.keySet()) {
+// if (key.equals("bindPw")) {
+// assert "test126".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+// found++;
+// } else if (key.equals("bindDn")) {
+// assert "uid=ldapSecureUser,ou=People,dc=redat,dc=com".equals(options.get(key)) : "Module option value not correct for key '"
+// + key + "'.";
+// found++;
+// } else if (key.equals("allowEmptyPasswords")) {
+// assert "true".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+// found++;
+// }
+// }
+// assert found == 3 : "All module options were not loaded.";
+//
+// //remove the original node to reset for next run.
+// op = new Remove(new Address(address));
+// result = exerciseOperation(op, execute, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to remove the resource."
+// + result.getFailureDescription();
+// }
+//
+// /** For each operation
+// * - will write verbose json and operation details to system.out if verboseOutput = true;
+// * - will execute the operation against running server if execute = true.
+// *
+// * @param op
+// * @param execute
+// * @param verboseOutput
+// * @return
+// */
+// public static Result exerciseOperation(Operation op, boolean execute, boolean verboseOutput) {
+// //display operation as AS7 plugin will build it
+// if (verboseOutput) {
+// System.out.println("\tOperation is:" + op);
+// }
+//
+// String jsonToSend = "";
+// try {
+// // jsonToSend = mapper.writeValueAsString(op);
+// jsonToSend = mapper.defaultPrettyPrintingWriter().writeValueAsString(op);
+// } catch (JsonGenerationException e) {
+// e.printStackTrace();
+// } catch (JsonMappingException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// //As generated by jackson mapper
+// if (verboseOutput) {
+// System.out.println("@@@@ OUTBOUND JSON#\n" + jsonToSend + "#");
+// }
+//
+// //Execute the operation
+// Result result = new Result();
+// if (execute) {
+// result = con.execute(op);
+// } else {
+// if (verboseOutput) {
+// System.out.println("**** NOTE: Execution disabled . NOT exercising write-attribute operation. **** ");
+// }
+// }
+// if (verboseOutput) {
+// //result wrapper details
+// System.out.println("\tResult:" + result);
+// //detailed results
+// System.out.println("\tValue:" + result.getResult());
+// System.out.println("-----------------------------------------------------\n");
+// }
+// return result;
+// }
+//}
commit 5b156665a93a9d93c4d5970d6509fae2c0318e12
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Jul 30 16:09:37 2012 -0400
add support for EAP 6.0.0 (GA) and remove support for all the EAP 6.0 ER's
(cherry picked from commit 3b1e22ae89819d89a64c7d319099f53df85bfca3)
Conflicts:
modules/plugins/jboss-as-7/pom.xml
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 8b4a086..557a6d8 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -240,92 +240,12 @@
</profile>
<profile>
- <id>eap600Beta1.itest.setup</id>
+ <id>eap600.itest.setup</id>
<activation>
<property>
<name>as7.version</name>
- <value>6.0.0.Beta1</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER4.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER4</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER5.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER5</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER6.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER6</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER8.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER8</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600CR1.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.CR1</value>
+ <value>6.0.0</value>
</property>
</activation>
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
index a1e26e2..f6f1502 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
@@ -61,13 +61,7 @@ public abstract class AbstractServerComponentTest extends AbstractJBossAS7Plugin
private static final Map<String, String> EAP6_VERSION_TO_AS7_VERSION_MAP = new HashMap<String, String>();
static {
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.Beta1", "7.1.0.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER4", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER5", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER6", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER7", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER8", "7.1.2.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.CR1", "7.1.2.Final-redhat-1");
+ EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0", "7.1.2.Final-redhat-1");
}
private static final String RELEASE_VERSION_TRAIT_NAME = "_skm:release-version";
commit 0fefd32fa64cc752582121c3cceb63f60715b75a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Jul 30 16:01:59 2012 -0400
[BZ 826542] Adding support for security-domain child nodes (authentication=classic,authentication=jaspi,audit=classic,audit=classic,acl=classic,authorization=classic,identity-trust=classic,mapping=classic]. -Explicitly allows the creation of and update of N ModuleOptionType instances and support of N module options for each type instance.
(cherry picked from commit 2918e9c7df1d792b2b91f2e412ef7d2187cd55d4)
Conflicts:
.classpath
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
diff --git a/.classpath b/.classpath
index 75c4a8a..409beca 100644
--- a/.classpath
+++ b/.classpath
@@ -153,7 +153,7 @@
<classpathentry kind="src" path="modules/helpers/pluginAnnotations/src/main/java"/>
<classpathentry kind="src" path="modules/helpers/pluginGen/src/main/java"/>
<classpathentry kind="src" path="modules/helpers/perftest-support/src/main/java"/>
- <classpathentry kind="src" path="modules/helpers/rtfilter/src/main/java"/>
+ <classpathentry kind="src" path="modules/helpers/rtfilter/src/main/java"/>
<classpathentry kind="src" path="modules/core/plugin-container-itest/src/test/java"/>
<classpathentry kind="src" path="modules/core/plugin-test-util/src/main/java"/>
<classpathentry kind="src" path="modules/core/arquillian-integration/container/src/test/java"/>
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsComponent.java
new file mode 100644
index 0000000..d486542
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsComponent.java
@@ -0,0 +1,867 @@
+package org.rhq.modules.plugins.jbossas7;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.modules.plugins.jbossas7.json.Address;
+import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
+import org.rhq.modules.plugins.jbossas7.json.ReadChildrenNames;
+import org.rhq.modules.plugins.jbossas7.json.Result;
+import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
+
+/**
+ * Component class for Module Options. Necessary because Module Options are child
+ * attributes of another as7 node attribute and cannot be created/updated without
+ * rewriting the parent attribute as well. The following as7 node snippets shows how the
+ * 'login-modules' attribute contains both simple and complex child attributes. The complex
+ * 'module-options' child attribute values can be numerous and can/may need to be modifiable
+ * independently.
+ * Read:
+ * [standalone@localhost:9999 authentication=classic] :read-attribute(name=login-modules)
+ {
+ "outcome" => "success",
+ "result" => [{
+ "code" => "Ldap",
+ "flag" => "requisite",
+ "module-options" => [("bindDn"=>"uid=ldapUser,ou=People,dc=redat,dc=com")]
+ }]
+ }
+ * Write back:
+ [standalone@localhost:9999 authentication=classic]
+ :write-attribute(name=login-modules,
+ value=[{"code"=>"Ldap","flag"=>"required",
+ "module-options"=>[("bindDn"=>"uid=ldapSecureUser,ou=People,dc=redat,dc=com")]}])
+ {
+ "outcome" => "success",
+ "response-headers" => {
+ "operation-requires-reload" => true,
+ "process-state" => "reload-required"
+ }
+ }
+ *
+ * @author Simeon Pinder
+ */
+public class ModuleOptionsComponent extends BaseComponent implements ConfigurationFacet, DeleteResourceFacet,
+ CreateChildResourceFacet {
+
+ //shared identifier for module-options attribute reused by all nodes with Module Options
+ private static String moduleOptionsNode = ",module-options";
+
+ //Module Option type attribute identifiers
+ private static String loginModules = "login-modules";//Authentication (Classic,-Managed Server,-Profile)
+ private static String aclModules = "acl-modules";//Acl
+ private static String providerModules = "provider-modules";//Audit
+ private static String policyModules = "policy-modules";//Authorization
+ private static String trustModules = "trust-modules";//IdentityTrust
+ private static String mappingModules = "mapping-modules";//Mapping
+ private static String authModules = "auth-modules";//Authentication (Jaspi,-Managed Server,-Profile)
+
+ //Enumerates list of AS7 types that support module options.
+ public enum ModuleOptionType {
+ Acl(aclModules), Audit(providerModules), Authentication(loginModules), AuthenticationJaspi(authModules), Authorization(
+ policyModules), IdentityTrust(
+ trustModules), Mapping(mappingModules);
+ private String attribute = "";
+
+ //stores mapping of as7 attribute name to module option type mapping Ex. login-modules -> Authentication Module Option Type.
+ public static HashMap<String, ModuleOptionType> typeMap = new HashMap<String, ModuleOptionType>();
+ static {//populate all module option type mappings
+ for (ModuleOptionType type : ModuleOptionType.values()) {
+ typeMap.put(type.getAttribute(), type);
+ }
+ }
+ //Stores mapping of as7 attribute name to more user friendly Module option type
+ public static Map<String, String> readableNameMap = new HashMap<String, String>();
+ static {
+ readableNameMap.put(aclModules, "ACL Modules");
+ readableNameMap.put(providerModules, "Provider Modules");
+ readableNameMap.put(loginModules, "Login Modules");//Authentication=classic
+ readableNameMap.put(authModules, "Auth Modules");//Authentication=jaspi
+ readableNameMap.put(policyModules, "Policy Modules");
+ readableNameMap.put(trustModules, "Trust Modules");
+ readableNameMap.put(mappingModules, "Mapping Modules");
+ }
+
+ public String getAttribute() {
+ return attribute;
+ }
+
+ private ModuleOptionType(String attribute) {
+ this.attribute = attribute;
+ }
+ }
+
+ //Strings unique to nodes
+ private static String AUTH_CLASSIC_NODE = "Authentication (Classic";
+ private static String AUTH_JASPI_NODE = "Authentication (Jaspi";
+ private static String ACL_NODE = "ACL";
+ private static String AUDIT_NODE = "Audit";
+ private static String AUTHORIZATION_NODE = "Authorization";
+ private static String TRUST_NODE = "Identity Trust";
+ private static String MAPPING_NODE = "Mapping";
+ private static String[] supportedModuleOptionTypeNodes = { AUTH_CLASSIC_NODE, AUTH_JASPI_NODE, ACL_NODE,
+ AUDIT_NODE, AUTHORIZATION_NODE, TRUST_NODE, MAPPING_NODE };
+
+ //define operation/type mappings where specific plugin descriptor nodes map to specific
+ // as7 node names.
+ public static HashMap<String, String> attributeMap = new HashMap<String, String>();
+ static {
+ attributeMap.put(AUTH_CLASSIC_NODE + ")", loginModules);
+ attributeMap.put(AUTH_CLASSIC_NODE + " - Managed Server)", loginModules);
+ attributeMap.put(AUTH_CLASSIC_NODE + " - Profile)", loginModules);
+ attributeMap.put(AUTH_JASPI_NODE + ")", authModules);
+ attributeMap.put(AUTH_JASPI_NODE + " - Managed Server)", authModules);
+ attributeMap.put(AUTH_JASPI_NODE + " - Profile)", authModules);
+ attributeMap.put(ACL_NODE, aclModules);
+ attributeMap.put(ACL_NODE + " (Managed Server)", aclModules);
+ attributeMap.put(ACL_NODE + " (Profile)", aclModules);
+ attributeMap.put(AUDIT_NODE, providerModules);
+ attributeMap.put(AUDIT_NODE + " (Managed Server)", providerModules);
+ attributeMap.put(AUDIT_NODE + " (Profile)", providerModules);
+ attributeMap.put(AUTHORIZATION_NODE, policyModules);
+ attributeMap.put(AUTHORIZATION_NODE + " (Managed Server)", policyModules);
+ attributeMap.put(AUTHORIZATION_NODE + " (Profile)", policyModules);
+ attributeMap.put(TRUST_NODE, trustModules);
+ attributeMap.put(TRUST_NODE + " (Managed Server)", trustModules);
+ attributeMap.put(TRUST_NODE + " (Profile)", trustModules);
+ attributeMap.put(MAPPING_NODE, mappingModules);
+ attributeMap.put(MAPPING_NODE + " (Managed Server)", mappingModules);
+ attributeMap.put(MAPPING_NODE + " (Profile)", mappingModules);
+ }
+
+ public static HashMap<String, String> newChildTypeMap = new HashMap<String, String>();
+ static {
+ newChildTypeMap.put(loginModules, "authentication=classic");
+ newChildTypeMap.put(authModules, "authentication=jaspi");
+ newChildTypeMap.put(aclModules, "acl=classic");
+ newChildTypeMap.put(providerModules, "audit=classic");
+ newChildTypeMap.put(policyModules, "authorization=classic");
+ newChildTypeMap.put(trustModules, "identity-trust=classic");
+ newChildTypeMap.put(mappingModules, "mapping=classic");
+ }
+
+ @Override
+ public CreateResourceReport createResource(CreateResourceReport report) {
+
+ if (report.getPackageDetails() != null) { // Content deployment
+ return deployContent(report);
+ } else {
+ ASConnection connection = getASConnection();
+
+ // Check for the Highlander principle
+ boolean isSingleton = report.getResourceType().isSingleton();
+ if (isSingleton) {
+ // check if there is already a child with the desired type is present
+ Configuration pluginConfig = report.getPluginConfiguration();
+ PropertySimple pathProperty = pluginConfig.getSimple("path");
+ if (path == null || path.isEmpty()) {
+ report.setErrorMessage("No path property found in plugin configuration");
+ report.setStatus(CreateResourceStatus.INVALID_CONFIGURATION);
+ return report;
+ }
+
+ ReadChildrenNames op = new ReadChildrenNames(address, pathProperty.getStringValue());
+ Result res = connection.execute(op);
+ if (res.isSuccess()) {
+ List<String> entries = (List<String>) res.getResult();
+ if (!entries.isEmpty()) {
+ report.setErrorMessage("Resource is a singleton, but there are already children " + entries
+ + " please remove them and retry");
+ report.setStatus(CreateResourceStatus.FAILURE);
+ return report;
+ }
+ }
+ }
+
+ //determine type then attribute
+ ResourceType resourceType = report.getResourceType();
+ String attribute = attributeMap.get(resourceType.getName());
+ //determine new child name from attribute
+ String newChild = newChildTypeMap.get(attribute);
+
+ //get resourceConfig
+ Configuration configuration = report.getResourceConfiguration();
+
+ if(attribute!=null){//create executed from SecurityDomain level
+
+ //retrieve the values passed in via config
+ Value loaded = loadCodeFlagType(configuration, attribute, null);
+
+ //populate the ModuleOptionType from the Configuration
+ List<Value> newAttributeState = new ArrayList<Value>();
+ newAttributeState.add(loaded);
+
+ //build the operation
+ //update the address to point to the new child being created
+ Address newChildLocation = new Address(path + "," + newChild);
+ Operation op = createAddModuleOptionTypeOperation(newChildLocation, attribute, newAttributeState);
+
+ Result result = connection.execute(op);
+ if (result.isSuccess()) {
+ report.setStatus(CreateResourceStatus.SUCCESS);
+ report.setResourceKey(newChildLocation.getPath());
+ report.setResourceName(report.getResourceType().getName());
+ } else {
+ report.setStatus(CreateResourceStatus.FAILURE);
+ report.setErrorMessage(result.getFailureDescription());
+ }
+ }else{//Create executed from the 'Login Modules/Provider Modules/etc. level.
+ //retrieve the parent type to lookup attribute to write to
+ ResourceType parentType = (ResourceType) resourceType.getParentResourceTypes().toArray()[0];
+ attribute = attributeMap.get(parentType.getName());
+
+ //retrieve existing attribute definition
+ //get the current attribute value
+ ReadAttribute op = new ReadAttribute(address, attribute);
+ Result result = getASConnection().execute(op);
+ if (result.isSuccess()) {
+ //populate attribute values
+ List<Value> currentAttributeState = new ArrayList<Value>();
+ currentAttributeState = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+ //populate new Module type data
+ //retrieve the values passed in via config
+ Value loaded = loadCodeFlagType(configuration, attribute, null);
+
+ //append new type information
+ currentAttributeState.add(loaded);
+ //write values back out.
+ Operation write = new WriteAttribute(address);
+ write.addAdditionalProperty("name", attribute);//attribute to execute on
+
+ //now complete the write operation by updating the value
+ write.addAdditionalProperty("value", (Object) currentAttributeState);
+ result = connection.execute(write);
+ if (result.isSuccess()) {
+ report.setStatus(CreateResourceStatus.SUCCESS);
+ //Ex. subsystem=security,security-domain=createOne,authentication=classic,login-modules:0
+ report.setResourceKey(path + "," + attribute + ":" + (currentAttributeState.size() - 1));
+ //Ex. Login Modules 0
+ report.setResourceName(ModuleOptionType.readableNameMap.get(attribute) + " "
+ + (currentAttributeState.size() - 1));
+ } else {
+ report.setStatus(CreateResourceStatus.FAILURE);
+ report.setErrorMessage(result.getFailureDescription());
+ }
+ }
+ }
+ return report;
+ }
+ }
+
+ @Override
+ public Configuration loadResourceConfiguration() throws Exception {
+ Configuration configuration = new Configuration();
+
+ //determine the component
+ ResourceType resourceType = context.getResourceType();
+ Set<ResourceType> nodeParentTypes = context.getResourceType().getParentResourceTypes();
+ ResourceType parentType = (ResourceType) nodeParentTypes.toArray()[0];
+ ResourceType grandParentType = (ResourceType) parentType.getParentResourceTypes().toArray()[0];
+
+ //For each Module Option type, like Authentication (Classic) and the immediate
+ // child node of each, the configuration is shared as it is in the AS7 node as well.
+ if (isSupportedModuleOptionTypeOrImmediateChildOf(parentType, resourceType)) {//Classic, Managed, Profile
+ boolean currentNodeIsModuleType = false;
+ //if the current resourceType is included in the attributeMap then it is an actual Module Option Type.
+ if (ModuleOptionsComponent.attributeMap.get(resourceType.getName()) != null) {
+ currentNodeIsModuleType = true;
+ }
+ //get type and lookup supported node and type
+ //retrieve the parent resource
+ String attribute = ModuleOptionsComponent.attributeMap.get(parentType.getName());
+ if (currentNodeIsModuleType) {//if is an actual Module Option Type then update attribute retrieved.
+ attribute = ModuleOptionsComponent.attributeMap.get(resourceType.getName());
+ }
+
+ //get the current attribute value
+ ReadAttribute op = new ReadAttribute(address, attribute);
+ Result result = getASConnection().execute(op);
+ if (result.isSuccess()) {
+ //populate attribute values
+ List<Value> currentAttributeState = new ArrayList<Value>();
+ currentAttributeState = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+ if (currentNodeIsModuleType) {//grab first available module type
+ Value loaded = currentAttributeState.get(0);
+ //populate configuration
+ populateCodeFlagType(configuration, attribute, loaded);
+ } else {//Need to locate specific module type
+ //locate specific node and populate the config
+ //Ex."login-modules:";
+ String moduleTypeIdentifier = attribute + ":";
+ int index = path.indexOf(moduleTypeIdentifier);
+ String loginModuleIndex = path.substring(index + moduleTypeIdentifier.length());
+ int lmi = Integer.valueOf(loginModuleIndex);//Ex 0,1,30
+ if (currentAttributeState.size() > lmi) {//then retrieve.
+ Value loaded = currentAttributeState.get(lmi);
+ //populate configuration
+ populateCodeFlagType(configuration, attribute, loaded);
+ }
+ }
+ }
+ //read attribute
+ return configuration;
+ }
+ //Module Options child, Ex. 'Login Modules (Classic', ..-Managed, .. - Profile
+ else if (supportsLoginModuleOptionType(grandParentType)) {
+ //get type and lookup supported node and type
+ String attribute = ModuleOptionsComponent.attributeMap.get(grandParentType.getName());
+
+ //get the current attribute value
+ ReadAttribute op = new ReadAttribute(address, attribute);
+ Result result = getASConnection().execute(op);
+ if (result.isSuccess()) {
+ //populate attribute values
+ List<Value> currentAttributeState = new ArrayList<Value>();
+ currentAttributeState = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+
+ //locate specific node and populate the config
+ //Ex."login-modules:";
+ String moduleTypeIdentifier = attribute + ":";
+ int index = path.indexOf(moduleTypeIdentifier);
+ String loginModuleIndex = path.substring(index + moduleTypeIdentifier.length());
+ String[] split = loginModuleIndex.split(",");
+ int lmi = Integer.valueOf(split[0]);//Ex 0,1,30
+ if (lmi < currentAttributeState.size()) {//then proceed
+ Value loaded = currentAttributeState.get(lmi);
+ //populate configuration: module-options
+ LinkedHashMap<String, Object> currentModuleOptions = loaded.getOptions();
+
+ //This must match exactly the mapping identifier from descriptor, otherwise loadResource fails silently.
+ String id = "Module Options";
+ PropertyMap map = new PropertyMap(id);
+ for (String key : currentModuleOptions.keySet()) {
+ PropertySimple option = new PropertySimple(key, currentModuleOptions.get(key));
+ map.put(option);
+ }
+ if (!currentModuleOptions.isEmpty()) {//check that keyset is non empty before adding to config.
+ configuration.put(map);
+ }
+ }
+ }
+ return configuration;
+ } else {//otherwise default subsystem discovery behavior.
+ ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+ ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(configDef, getASConnection(), address,
+ includeRuntime);
+ configuration = delegate.loadResourceConfiguration();
+
+ // Read server state
+ ReadAttribute op = new ReadAttribute(getAddress(), "name");
+ executeAndGenerateServerUpdateIfNecessary(configuration, op);
+ return configuration;
+ }
+ }
+
+ /** Looks up whether the current node supports the Module Options.
+ *
+ * @param grandParentType
+ * @return
+ */
+ private boolean supportsLoginModuleOptionType(ResourceType grandParentType) {
+ boolean supportModuleOptionTypes = false;
+ if (grandParentType != null) {
+ for (String moduleOptionType : supportedModuleOptionTypeNodes) {
+ if (grandParentType.getName().indexOf(moduleOptionType) > -1) {
+ supportModuleOptionTypes = true;
+ }
+ }
+ }
+ return supportModuleOptionTypes;
+ }
+
+ /**Iterates through the list of supported Module Option Type nodes
+ * to determine if the current node is i)supported Module option node or
+ * ii)the immediated child of a supported Module option node.
+ *
+ * @param parentType
+ * @param resourceType
+ * @return
+ */
+ private boolean isSupportedModuleOptionTypeOrImmediateChildOf(ResourceType parentType, ResourceType resourceType) {
+ boolean loadThisConfiguration = false;
+ if ((parentType != null) && (resourceType != null)) {
+ for (String moduleOptionType : attributeMap.keySet()) {
+ if ((parentType.getName().equals(moduleOptionType))
+ || (resourceType.getName().equals(moduleOptionType))) {
+ loadThisConfiguration = true;
+ }
+ }
+
+ }
+ return loadThisConfiguration;
+ }
+
+ /** Handles the different types of configuration population based on the attribute value passed in.
+ *
+ * @param configuration
+ * @param attribute
+ * @param loaded
+ */
+ private void populateCodeFlagType(Configuration configuration, String attribute, Value loaded) {
+ if (attribute.equals(providerModules)) {//audit=classic. Ex. only code
+ PropertySimple currentValue = new PropertySimple("code", loaded.getCode());
+ configuration.put(currentValue);
+ } else if (attribute.equals(mappingModules)) {//mapping=classic. Ex. code type
+ PropertySimple currentValue = new PropertySimple("code", loaded.getCode());
+ PropertySimple currentValue2 = new PropertySimple("type", loaded.getType());
+ configuration.put(currentValue);
+ configuration.put(currentValue2);
+ } else {//code flag
+ PropertySimple currentValue = new PropertySimple("code", loaded.getCode());
+ PropertySimple currentValue2 = new PropertySimple("flag", loaded.getFlag());
+ configuration.put(currentValue);
+ configuration.put(currentValue2);
+ }
+ }
+
+ /** Populates the Value instance passed in or returns new Value instance with values loaded.
+ *
+ * @param configuration
+ * @param attribute
+ * @param loaded
+ * @return
+ */
+ private Value loadCodeFlagType(Configuration configuration, String attribute, Value loaded) {
+ //if required data is not present then return null.
+ if ((configuration == null) || attribute == null) {
+ return null;
+ }
+ if (loaded == null) {// initialize if null
+ loaded = new Value();
+ }
+ if (attribute.equals(providerModules)) {//audit=classic. Ex. only code
+ String code = configuration.getSimpleValue("code");
+ loaded.setCode(code);
+ } else if (attribute.equals(mappingModules)) {//mapping=classic. Ex. code type
+ String code = configuration.getSimpleValue("code");
+ String type = configuration.getSimpleValue("type");
+ loaded.setCode(code);
+ loaded.setType(type);
+ } else {//code flag
+ String code = configuration.getSimpleValue("code");
+ String flag = configuration.getSimpleValue("flag");
+ loaded.setCode(code);
+ loaded.setFlag(flag);
+ }
+ return loaded;
+ }
+
+ @Override
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ //determine the component
+ ResourceType resourceType = context.getResourceType();
+ ConfigurationDefinition configDef = resourceType.getPluginConfigurationDefinition();
+ Set<ResourceType> nodeParentTypes = context.getResourceType().getParentResourceTypes();
+ ResourceType parentType = (ResourceType) nodeParentTypes.toArray()[0];
+ ResourceType grandParentType = (ResourceType) parentType.getParentResourceTypes().toArray()[0];
+ ///if child of SecurityDomain then
+ if (isSupportedModuleOptionTypeOrImmediateChildOf(parentType, resourceType)) {
+ boolean currentNodeIsModuleType = false;
+ if (ModuleOptionsComponent.attributeMap.get(resourceType.getName()) != null) {
+ currentNodeIsModuleType = true;
+ }
+ //get type and lookup supported node and type
+ //retreive the parent resource
+ String attribute = ModuleOptionsComponent.attributeMap.get(parentType.getName());
+ if (currentNodeIsModuleType) {
+ attribute = ModuleOptionsComponent.attributeMap.get(resourceType.getName());
+ }
+
+ //get the current attribute value. Will write module types back out exactly as read in with these new updates
+ ReadAttribute op = new ReadAttribute(address, attribute);
+ Result result = getASConnection().execute(op);
+ if (result.isSuccess()) {
+ List<String> entries = (List<String>) result.getResult();
+
+ //populate attribute values
+ List<Value> currentAttributeState = new ArrayList<Value>();
+ currentAttributeState = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+
+ //retrieve current config changes
+ Configuration conf = report.getConfiguration();
+
+ if (currentNodeIsModuleType) {//grab first available module type
+ Value loaded = currentAttributeState.get(0);
+ //iterate over properties and update values appropriately
+ for (String pKey : conf.getSimpleProperties().keySet()) {
+ if (pKey.equals("flag")) {
+ loaded.setFlag(conf.getSimpleProperties().get(pKey).getStringValue());
+ } else if (pKey.equals("code")) {
+ loaded.setCode(conf.getSimpleProperties().get(pKey).getStringValue());
+ } else if (pKey.equals("type")) {
+ loaded.setType(conf.getSimpleProperties().get(pKey).getStringValue());
+ }
+ }
+ Operation write = new WriteAttribute(address);
+ write.addAdditionalProperty("name", attribute);//attribute to execute on
+
+ //now complete the write operation by updating the value
+ write.addAdditionalProperty("value", (Object) currentAttributeState);
+ executeWriteAndGenerateAs7ServerUpdate(report, conf, write);
+ } else {//Need to locate specific module type
+
+ //locate specific node and populate the config
+ String loginModuleIdentifier = attribute + ":";
+ int index = path.indexOf(loginModuleIdentifier);
+ String loginModuleIndex = path.substring(index + loginModuleIdentifier.length());
+ int lmi = Integer.valueOf(loginModuleIndex);//Ex 0,1,30
+ Value valueObject = currentAttributeState.get(lmi);
+
+ //iterate over properties and update values appropriately
+ for (String pKey : conf.getSimpleProperties().keySet()) {
+ if (pKey.equals("flag")) {
+ valueObject.setFlag(conf.getSimpleProperties().get(pKey).getStringValue());
+ } else if (pKey.equals("code")) {
+ valueObject.setCode(conf.getSimpleProperties().get(pKey).getStringValue());
+ } else if (pKey.equals("type")) {
+ valueObject.setType(conf.getSimpleProperties().get(pKey).getStringValue());
+ }
+ }
+ Operation write = new WriteAttribute(address);
+ write.addAdditionalProperty("name", attribute);//attribute to execute on
+
+ //now complete the write operation by updating the value
+ write.addAdditionalProperty("value", (Object) currentAttributeState);
+ executeWriteAndGenerateAs7ServerUpdate(report, conf, write);
+ }
+ }
+ } else if (supportsLoginModuleOptionType(grandParentType)) {//Module Options child.
+ //get type and lookup supported node and type
+ String attribute = ModuleOptionsComponent.attributeMap.get(grandParentType.getName());
+
+ //get the current attribute value. Will write module types back out exactly as read in with these new updates
+ ReadAttribute op = new ReadAttribute(address, attribute);
+ Result result = getASConnection().execute(op);
+ if (result.isSuccess()) {
+
+ //populate attribute values
+ List<Value> currentAttributeState = new ArrayList<Value>();
+ currentAttributeState = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+
+ //locate specific node and populate the config
+ String loginModuleIdentifier = attribute + ":";
+ int index = path.indexOf(loginModuleIdentifier);
+ String loginModuleIndex = path.substring(index + loginModuleIdentifier.length());
+ String[] split = loginModuleIndex.split(",");
+ int lmi = Integer.valueOf(split[0]);//Ex 0,1,30
+ Value valueObject = currentAttributeState.get(lmi);
+
+ //retrieve current config changes
+ Configuration conf = report.getConfiguration();
+ //list current conf stated being defined.
+ String mapKey = (String) conf.getMap().keySet().toArray()[0];
+ PropertyMap mapType = (PropertyMap) conf.getMap().get(mapKey);
+ //insert update logic.
+ //set this new state passed in as state of the attribute.
+ LinkedHashMap<String, Object> currentOptions = new LinkedHashMap<String, Object>();
+ for (String propertyKey : mapType.getMap().keySet()) {
+ currentOptions.put(propertyKey, ((PropertySimple) mapType.get(propertyKey)).getStringValue());
+ }
+
+ //make these settings the new state for this part of the attribute.
+ valueObject.setOptions(currentOptions);
+ currentAttributeState.set(lmi, valueObject);
+
+ Operation write = new WriteAttribute(address);
+ write.addAdditionalProperty("name", attribute);//attribute to execute on
+
+ //now complete the write operation by updating the value
+ write.addAdditionalProperty("value", (Object) currentAttributeState);
+ executeWriteAndGenerateAs7ServerUpdate(report, conf, write);
+ }
+ } else {
+ ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
+ delegate.updateResourceConfiguration(report);
+ }
+
+ }
+
+ /**Executes boilerplate finish for write operation.
+ *
+ * @param report
+ * @param conf
+ * @param write
+ */
+ private void executeWriteAndGenerateAs7ServerUpdate(ConfigurationUpdateReport report, Configuration conf,
+ Operation write) {
+ Result result;
+ result = getASConnection().execute(write);
+ if (!result.isSuccess()) {
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ report.setErrorMessage(result.getFailureDescription());
+ } else {
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ // signal "need reload"
+ if (result.isReloadRequired()) {
+ PropertySimple oobMessage = new PropertySimple("__OOB",
+ "The server needs a reload for the latest changes to come effective.");
+ conf.put(oobMessage);
+ }
+ if (result.isRestartRequired()) {
+ PropertySimple oobMessage = new PropertySimple("__OOB",
+ "The server needs a restart for the latest changes to come effective.");
+ conf.put(oobMessage);
+ }
+ }
+ }
+
+ /**Executes boilerplate finish for read operation.
+ *
+ * @param report
+ * @param conf
+ * @param write
+ */
+ private void executeAndGenerateServerUpdateIfNecessary(Configuration configuration, ReadAttribute op) {
+ Result res = getASConnection().execute(op);
+ if (res.isReloadRequired()) {
+ PropertySimple oobMessage = new PropertySimple("__OOB",
+ "The server needs a reload for the latest changes to come effective.");
+ configuration.put(oobMessage);
+ }
+ if (res.isRestartRequired()) {
+ PropertySimple oobMessage = new PropertySimple("__OOB",
+ "The server needs a restart for the latest changes to come effective.");
+ configuration.put(oobMessage);
+ }
+ }
+
+ /** Locates the write ModuleOptionType mapped to the AS7Node attribute passed in.
+ * Ex. 'login-modules' -> Authentication (Classic * type. One of three types.
+ *
+ * @param attribute
+ * @return
+ */
+ public static ModuleOptionType loadModuleOptionType(String attribute) {
+ ModuleOptionType located = ModuleOptionType.typeMap.get(attribute);
+ if (located == null) {
+ throw new IllegalArgumentException("Unknown node '" + attribute
+ + "' entered for which no valid ModuleOptionType could be found.");
+ }
+ return located;
+ }
+
+ /** Takes the result passed in(successful readAttribute for ModuleOptionType) and
+ * parses the json to populate a json object of type List<Value> with the
+ * results.
+ * Handles inconsistencies in model representation for login-modules vs.
+ * the other supported ModuleOptionTypes.
+ *
+ * @param result json.Result type from successful read of attribute.
+ * @param type ModuleOptionType
+ * @return List<Value> type populated with moduleOption details.
+ */
+ public static List<Value> populateSecurityDomainModuleOptions(Result result, ModuleOptionType type) {
+ //initialize empty
+ List<Value> populated = new ArrayList<Value>();
+ //input validation
+ if ((result != null) && (result.isSuccess())) {
+
+ //parse json and populate the object.
+ Object rawResult = result.getResult();
+
+ if (rawResult instanceof ArrayList) {
+ //iterate over the module option type passed in.
+ ArrayList moduleOptionTypeChildrenList = (ArrayList) rawResult;
+ for (int i = 0; i < moduleOptionTypeChildrenList.size(); i++) {
+ Value value = new Value();
+ //stores current <module-options> defined.
+ LinkedHashMap<String, Object> optionsMap = new LinkedHashMap<String, Object>();
+ Object entryCheck = ((ArrayList) rawResult).get(i);
+
+ if (entryCheck instanceof HashMap) {
+
+ //this is the root attribute map for all children of the specific custom Security Domain
+ //type attributes.
+ Map<String, Object> attributeMap = (HashMap<String, Object>) entryCheck;
+ for (String key : attributeMap.keySet()) {
+
+ //peek at contents to exclude empty values.
+ String extracted = String.valueOf(attributeMap.get(key));
+ if (!extracted.trim().isEmpty()) {
+ if (key.equals("flag")) {
+ value.setFlag(extracted);
+ } else if (key.equals("code")) {
+ value.setCode(extracted);
+ } else if (key.equals("type")) {
+ value.setType(extracted);
+ } else if (key.equals("module-options")) {
+ //Need to support both Map and List types here because of inconsistent representations.
+ Object optionEntity = attributeMap.get(key);
+ if (optionEntity instanceof HashMap) {
+ Map<String, Object> entryList = (HashMap<String, Object>) optionEntity;
+ for (String oKey : entryList.keySet()) {
+ //get key and value and populate ModuleEntries found.
+ optionsMap.put(oKey, String.valueOf(entryList.get(oKey)));
+ }
+ } else if (optionEntity instanceof ArrayList) {
+ Object listEntryCheck = ((ArrayList) optionEntity).get(0);
+ if (listEntryCheck instanceof HashMap) {
+ ArrayList list = (ArrayList) optionEntity;
+ for (Object listEntry : list) {//iterate over each instance to get all values.
+ Map<String, Object> entryList = (HashMap<String, Object>) listEntry;
+ for (String oKey : entryList.keySet()) {
+ //get key and value and populate ModuleEntries found.
+ optionsMap.put(oKey, String.valueOf(entryList.get(oKey)));
+ }
+ }
+ }
+ }//end of if/else
+ }
+ }//end of empty value check
+ }
+ }//end of HashMap for SecurityDomain child check
+ value.setOptions(optionsMap);
+ populated.add(value);
+ }//end of moduleOptionType iteration
+ }
+ }
+
+ return populated;
+ }
+
+ @JsonSerialize(include = Inclusion.NON_NULL)
+ public static class Value {
+ // no args for jackson.
+ public Value() {
+ };
+
+ /** Three possible flags can be set. c-> code f->flag t->type
+ * Acl c f
+ * Authentication c f
+ * Authentication(Jaspi)c f
+ * Authorization c f
+ * Identity Trust c f
+ * Mapping c t
+ * Audit c
+ *
+ * @param code
+ * @param flag
+ * @param type
+ */
+ public Value(String code, String flag, String type) {
+ setCode(code);
+ if ((flag != null) && (!flag.trim().isEmpty())) {
+ setFlag(flag);
+ }
+ if ((type != null) && (!type.trim().isEmpty())) {
+ setType(type);
+ }
+ }
+
+ //default to empty string for case where specific attribute is not used.
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ private String flag;
+ private String code;
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ private String type;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getFlag() {
+ return flag;
+ }
+
+ public void setFlag(String flag) {
+ this.flag = flag;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ //overrides the type name for serialization/deserialization.
+ @JsonProperty(value = "module-options")
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ private LinkedHashMap<String, Object> options = null;
+
+ @JsonProperty(value = "module-options")
+ public LinkedHashMap<String, Object> getOptions() {
+ if (options == null) {
+ options = new LinkedHashMap<String, Object>();
+ }
+ return options;
+ }
+
+ @JsonProperty(value = "module-options")
+ public void setOptions(LinkedHashMap<String, Object> options) {
+ this.options = options;
+ }
+
+ @Override
+ public String toString() {
+ String serialized = "";
+ serialized += "code=" + getCode() + ", ";
+ if (getFlag() != null) {
+ serialized += "flag=" + getFlag() + ", ";
+ } else if (getType() != null) {
+ serialized += "type=" + getType() + ", ";
+ }
+ String options = "module-options=";
+ if (getOptions().isEmpty()) {
+ options += " {}";
+ } else {
+ options += " {";
+ for (String key : getOptions().keySet()) {
+ options += key + "=\"" + getOptions().get(key) + "\",";
+ }
+ options = options.substring(0, options.length() - 1);
+ options += "} ";
+ }
+ serialized += options;
+ return serialized;
+ }
+ }
+
+ /** Handles the creation of
+ *
+ * @param address
+ * @param attribute
+ * @param moduleTypeValue
+ * @return
+ */
+ public static Operation createAddModuleOptionTypeOperation(Address address, String attribute,
+ List<Value> moduleTypeValue) {
+ Operation add = null;
+ if ((address != null) & (attribute != null) & (moduleTypeValue != null)) {
+ add = new Operation("add", address);
+ add.addAdditionalProperty(attribute, moduleTypeValue);
+ }
+ return add;
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsDiscoveryComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsDiscoveryComponent.java
new file mode 100644
index 0000000..619d7d5
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ModuleOptionsDiscoveryComponent.java
@@ -0,0 +1,188 @@
+package org.rhq.modules.plugins.jbossas7;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.Value;
+import org.rhq.modules.plugins.jbossas7.json.Address;
+import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
+import org.rhq.modules.plugins.jbossas7.json.ReadChildrenNames;
+import org.rhq.modules.plugins.jbossas7.json.ReadResource;
+import org.rhq.modules.plugins.jbossas7.json.Result;
+
+/**
+ * Discovery class for Module Options nodes.
+ *
+ * @author Simeon Pinder
+ */
+public class ModuleOptionsDiscoveryComponent implements ResourceDiscoveryComponent<BaseComponent<?>> {
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ @Override
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<BaseComponent<?>> context)
+ throws InvalidPluginConfigurationException, Exception {
+
+ Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
+
+ BaseComponent parentComponent = context.getParentResourceComponent();
+ ASConnection connection = parentComponent.getASConnection();
+
+ Configuration config = context.getDefaultPluginConfiguration();
+ String confPath = config.getSimpleValue("path", "");
+ if (confPath == null || confPath.isEmpty()) {
+ log.error("Path plugin config is null for ResourceType [" + context.getResourceType().getName() + "].");
+ return details;
+ }
+
+ //locate parent component identifier via path
+ Configuration configParent = parentComponent.pluginConfiguration;
+ String parentConfPath = configParent.getSimpleValue("path", "");
+
+ //create relevant path and address details.
+ String path = confPath;//Ex. subsystem=security
+ //processing to retrieve parent for profile/domain mode.
+ if ((parentConfPath != null) && (!parentConfPath.isEmpty())) {
+ path = parentConfPath + "," + confPath;//Ex. profile=standalone-ha,subsystem=security
+ }
+
+ String name = "";//name=security
+ Address address = new Address(path);
+
+ //process the specific nodes
+ //Then we need to find out which of subchildren of ModOpsComponent is used i)security-domain=*
+ //ii)[Authentication*,etc] or iii)[ModOptions]
+
+ //path should already be right
+ if (path.endsWith("security-domain")) {//individual security domain entries
+ //ex. path => /subsystem=security/security-domain=(entry name)
+ //find all children and iterate over and update name appropriately
+ Address typeAddress = new Address(path);
+ String childType = "security-domain";
+ Result result = connection.execute(new ReadChildrenNames(typeAddress, childType));
+
+ if (result.isSuccess()) {
+
+ @SuppressWarnings("unchecked")
+ List<String> children = (List<String>) result.getResult();
+ for (String child : children) {
+ //update the components for discovery
+ name = child;//ex. basic, databaseDomain
+ String currentChildPath = path + //ex. /subsystem=security,security-domain=jboss-web
+ "=" + child;
+ address = new Address(currentChildPath);
+ addDiscoveredResource(context, details, connection, currentChildPath, name, address);
+ }
+ }
+ } else if (ifResourceIsSupportedModuleType(path)) {//is ModOptions map child
+ //ex. path => /subsystem=security/security-domain=(entry name)/authentication=classic/login-modules
+ //Ex. String attribute = "login-modules";
+ String attribute = lookupAttributeType(path);
+ //query all the module-options defined and discover them here
+ //Ex. String typeAddress = "subsystem=security,security-domain=testDomain2,authentication=classic";
+ String typeAddress = parentConfPath;
+ ReadAttribute readModuleOptionType = new ReadAttribute(new Address(typeAddress), attribute);
+ Result result = connection.execute(readModuleOptionType);
+ if (result.isSuccess()) {
+ List<Value> loadedLoginModuleTypes = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+ int moduleIndex = 0;
+ for (Value loginModule : loadedLoginModuleTypes) {
+ //Ex. name = "Login Module " + moduleIndex;
+ name = ModuleOptionsComponent.ModuleOptionType.readableNameMap.get(attribute) + " " + moduleIndex;
+ //Ex. subsystem=security,security-domain=testDomain2,authentication=classic,login-modules:0
+ String currentPath = path + ":" + moduleIndex++;
+ //add the discovered resource
+ addDiscoveredResource(context, details, connection, currentPath, name, address);
+ }
+ }
+ } else if (path.endsWith("module-options")) {//is ModOptions map child
+ //ex. path => /subsystem=security/security-domain=(entry name)/acl=classic/login-modules*module-options
+ //update name appropriately
+ name = "Module Options";
+ //add the discovered resource
+ addDiscoveredResource(context, details, connection, path, name, address);
+ } else {//[Authentication*,etc] children aka all others.
+ //ex. path => /subsystem=security/security-domain=(entry name)/authentication=classic
+ //update name appropriately
+ name = context.getResourceType().getName();//Authentication (Classic). Singletons.
+ //add the discovered resource
+ addDiscoveredResource(context, details, connection, path, name, address);
+ }
+ return details;
+ }
+
+ private String lookupAttributeType(String path) {
+ String attribute = null;
+ if ((path != null) && (!path.trim().isEmpty())) {
+ //Ex. subsystem=security,security-domain=testDomain2,authentication=classic,login-modules
+ String[] segments = path.split(",");
+ //contents of last segment should be the 'attribute' value of one of the ModuleOptionTypes
+ if (segments.length > 1) {
+ String last = segments[segments.length - 1];
+ if (ModuleOptionsComponent.ModuleOptionType.typeMap.keySet().contains(last)) {
+ attribute = last;
+ }
+ }
+ }
+ return attribute;
+ }
+
+ private boolean ifResourceIsSupportedModuleType(String path) {
+ boolean resourceIsSupported =false;
+ if ((path != null) && (!path.trim().isEmpty())) {
+ //Ex. subsystem=security,security-domain=testDomain2,authentication=classic,login-modules
+ String[] segments = path.split(",");
+ //contents of last segment should be the 'attribute' value of one of the ModuleOptionTypes
+ if (segments.length > 1) {
+ String last = segments[segments.length - 1];
+ if (ModuleOptionsComponent.ModuleOptionType.typeMap.keySet().contains(last)) {
+ resourceIsSupported = true;
+ }
+ }
+ }
+ return resourceIsSupported;
+ }
+
+ /** Adds discovered resource.
+ *
+ * @param context
+ * @param details
+ * @param connection
+ * @param path
+ * @param name
+ * @param address
+ */
+ private void addDiscoveredResource(ResourceDiscoveryContext context, Set<DiscoveredResourceDetails> details,
+ ASConnection connection, String path, String name, Address address) {
+ //ping the resource to determine if it's enabled and available.
+ ReadResource op = new ReadResource(address);
+ Result result = connection.execute(op);
+ if (result.isSuccess()) {
+
+ //include the config entry for the discovered node.
+ Configuration config2 = context.getDefaultPluginConfiguration();
+ //add path component to config as well.
+ PropertySimple pathProp = new PropertySimple("path", path);
+ config2.put(pathProp);
+
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), // DataType
+ path, // Key
+ name, // Name
+ null, // Version
+ context.getResourceType().getDescription(), // Description
+ config2, null);
+ details.add(detail);
+ }
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index fc1e9f7..fc0e403 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -769,7 +769,63 @@
</resource-configuration>
'>
+=======
+ <!ENTITY loginModuleResourceConfig '
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="true"
+ description="Class name of the module to be instantiated.">
+ <c:property-options>
+ <c:option value="AdvancedADLdap" />
+ <c:option value="AdvancedLdap" />
+ <c:option value="Certificate" />
+ <c:option value="CertificateRoles" />
+ <c:option value="CertificateUsers" />
+ <c:option value="Client" />
+ <c:option value="ConfigureIdentity" />
+ <c:option value="Database" />
+ <c:option value="DatabaseCertificate" />
+ <c:option value="DatabaseUsers" />
+ <c:option value="Identity" />
+ <c:option value="Kerberos" />
+ <c:option value="Ldap" />
+ <c:option value="LdapExtended" />
+ <c:option value="LdapUsers" />
+ <c:option value="PropertiesUsers" />
+ <c:option value="RoleMapping" />
+ <c:option value="RunAs" />
+ <c:option value="Simple" />
+ <c:option value="SimpleUsers" />
+ <c:option value="SPNEGOUsers" />
+ <c:option value="UsersRoles" />
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
+ <c:property-options>
+ <c:option value="optional"/>
+ <c:option value="required"/>
+ <c:option value="requisite"/>
+ <c:option value="sufficient"/>
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+'>
+
+ <!ENTITY flagModuleResourceConfig '
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
+ <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
+ <c:property-options>
+ <c:option value="optional"/>
+ <c:option value="required"/>
+ <c:option value="requisite"/>
+ <c:option value="sufficient"/>
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+'>
+
]>
+
<plugin name="&pluginName;"
displayName="JBoss Application Server 7.x"
description="provides monitoring and management of JBossAS 7.x"
@@ -3080,272 +3136,306 @@
</c:simple-property>
</resource-configuration>
- <service name="ACL (Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true">
+ <service name="ACL (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="acl=classic"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="acl=classic" />
+ </plugin-configuration>
- <resource-configuration>
- <c:list-property name="acl-modules" required="false" description="List of acl modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="true" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="true" description="Name of JBoss Module where the acl provider module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ &flagModuleResourceConfig;
+ <service name="Acl Modules (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
- <service name="Audit (Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true">
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="acl-modules" />
+ </plugin-configuration>
+ &flagModuleResourceConfig;
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="audit=classic"/>
- </plugin-configuration>
+ <service name="Module Options (Acl - Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
- <resource-configuration>
- <c:list-property name="provider-modules" required="false" description="List of provider modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true" description="Class name of the module to be instantiated."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
- <service name="Authentication (Classic - Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true">
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Acl - Managed Server) -->
+ </service><!-- End of Acl Modules (Managed Server) -->
+ </service>
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authentication=classic"/>
- </plugin-configuration>
+ <service name="Audit (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
- <resource-configuration>
- <c:list-property name="login-modules" required="false" description="List of authentication modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true"
- description="Class name of the module to be instantiated.">
- <c:property-options>
- <c:option value="AdvancedADLdap" />
- <c:option value="AdvancedLdap" />
- <c:option value="Certificate" />
- <c:option value="CertificateRoles" />
- <c:option value="Client" />
- <c:option value="Database" />
- <c:option value="DatabaseCertificate" />
- <c:option value="DatabaseUsers" />
- <c:option value="Identity" />
- <c:option value="Kerberos" />
- <c:option value="Ldap" />
- <c:option value="LdapExtended" />
- <c:option value="RoleMapping" />
- <c:option value="Simple" />
- <c:option value="SPNEGOUsers" />
- <c:option value="UserRoles" />
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="flag" required="true" type="string" readOnly="true" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="true" description="Name of JBoss Module where the login module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="audit=classic" />
+ </plugin-configuration>
- <service name="Authentication (Jaspi - Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true">
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ </resource-configuration>
+ <service name="Provider Modules (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authentication=jaspi"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="provider-modules" />
+ </plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ </resource-configuration>
- <resource-configuration>
- <c:list-property name="auth-modules" required="true" description="List of authentication modules to be used." >
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="true" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="true" description="Name of JBoss Module where the auth module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- <c:simple-property name="login-module-stack-ref" required="false" type="string" readOnly="true" description="Reference to a login module stack name previously configured in the same security domain."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
+ <service name="Module Options (Provider Modules - Managed Server)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
- <service name="Login Module Stack (Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent">
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="login-module-stack"/>
- </plugin-configuration>
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Provider Modules - Managed Server) -->
+ </service><!-- End of Provider Modules - Managed Server -->
+ </service>
- <resource-configuration>
- <c:list-property name="login-modules" required="true" description="List of authentication modules" >
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="true" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="true" description="Name of JBoss Module where the login module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
- </service>
+ <service name="Authentication (Classic - Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
- <service name="Authorization (Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true">
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authentication=classic" />
+ </plugin-configuration>
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authorization=classic"/>
- </plugin-configuration>
+ <service name="Login Modules (Classic - Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
- <resource-configuration>
- <c:list-property name="policy-modules" required="false" description="List of authorization modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="true" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="true" description="Name of JBoss Module where the policy module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="login-modules" />
+ </plugin-configuration>
+
+ &loginModuleResourceConfig;
- <service name="Identity Trust (Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true">
+ <service name="Module Options (Classic - Managed Server)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="identity-trust=classic"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
- <resource-configuration>
- <c:list-property name="trust-modules" required="false" description="List of trust modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="true" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="true" description="Name of JBoss Module where the identity trust module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options -->
+ </service><!-- End of Login Modules (Classic - Managed Server) -->
+ </service><!-- End of Authentication (Classic - Managed Server) -->
- <service name="JSSE (Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent">
+ <service name="Authentication (Jaspi - Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="jsse"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authentication=jaspi" />
+ </plugin-configuration>
- <resource-configuration>
- <c:simple-property name="cipher-suites" required="false" type="string" readOnly="true" description="Comma separated list of cipher suites to enable on SSLSockets."/>
- <c:simple-property name="client-alias" required="false" type="string" readOnly="true" description="Preferred alias to use when the KeyManager chooses the client alias."/>
- <c:simple-property name="client-auth" required="false" type="boolean" readOnly="true" description="Boolean attribute to indicate if client's certificates should also be authenticated on the server side."/>
- <c:map-property name="key-manager" required="false" description="JSEE Key Manager factory">
- <c:simple-property name="algorithm" required="false" type="string" readOnly="true" description="Algorithm to use when creating the KeyManagerFactory."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="true" description="Provider class name to use when creating the KeyManagerFactory."/>
- </c:map-property>
- <c:map-property name="keystore" required="false" description="Configures a JSSE key store">
- <c:simple-property name="password" required="false" type="string" readOnly="true" description="Sets the password of the keystore. Either this or 'truststore-password' must be present otherwise the security domain will be useless."/>
- <c:simple-property name="type" required="false" type="string" readOnly="true" description="Type of the keystore. If not set, type defaults to 'JKS'."/>
- <c:simple-property name="url" required="false" type="string" readOnly="true" description="URL of the keystore."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="true" description="Provider class name to use when creating the KeyStore."/>
- <c:simple-property name="provider-argument" required="false" type="string" readOnly="true" description="String argument to pass to the keystore Provider constructor when instantiating it."/>
- </c:map-property>
- <c:simple-property name="protocols" required="false" type="string" readOnly="true" description="Comma separated list of protocols to enable on SSLSockets."/>
- <c:simple-property name="server-alias" required="false" type="string" readOnly="true" description="Preferred alias to use when the KeyManager chooses the server alias."/>
- <c:simple-property name="service-auth-token" required="false" type="string" readOnly="true" description="Token to retrieve PrivateKeys from the KeyStore."/>
- <c:map-property name="trust-manager" required="false" description="JSEE Trust Manager factory">
- <c:simple-property name="algorithm" required="false" type="string" readOnly="true" description="Algorithm to use when creating the TrustManagerFactory."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="true" description="Provider class name to use when creating the TrustManagerFactory."/>
- </c:map-property>
- <c:map-property name="truststore" required="false" description="Configures a JSSE trust store">
- <c:simple-property name="password" required="false" type="string" readOnly="true" description="Sets the password of the truststore. Either this or 'keystore-password' must be present otherwise the security domain will be useless."/>
- <c:simple-property name="type" required="false" type="string" readOnly="true" description="Type of the truststore. If not set, type defaults to 'JKS'."/>
- <c:simple-property name="url" required="false" type="string" readOnly="true" description="URL of the truststore."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="true" description="Provider class name to use when creating the truststore."/>
- <c:simple-property name="provider-argument" required="false" type="string" readOnly="true" description="String argument to pass to the truststore Provider constructor when instantiating it."/>
- </c:map-property>
- </resource-configuration>
- </service>
+ &loginModuleResourceConfig;
- <service name="Mapping (Managed Server)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true">
+ <service name="Login Module Stack (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="mapping=classic"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="login-module-stack" />
+ </plugin-configuration>
- <resource-configuration>
- <c:list-property name="mapping-modules" required="false" description="List of modules that map principal, role, and credential information">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true" description="Class name of the module to be instantiated."/>
- <c:simple-property name="type" required="true" type="string" readOnly="true" description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential.."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="true" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ &loginModuleResourceConfig;
+
+ <service name="Module Options (Login Module Stack (Managed Server))" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options -->
+
+ </service>
+ </service>
+
+ <service name="Authorization (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authorization=classic" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+
+ <service name="Authorization Modules (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="policy-modules" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+
+ <service name="Module Options (Authorization - Managed Server)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Authorization - Managed Server) -->
+ </service><!-- End of Authorization Modules (Managed Server) -->
+ </service>
+
+ <service name="Identity Trust (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="identity-trust=classic" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+ <service name="Identity Trust Modules (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="trust-modules" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+
+ <service name="Module Options (Identity Trust - Managed Server)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Identity Trust - Managed Server) -->
+ </service><!-- End of Identity Trust Modules (Managed Server) -->
+ </service>
+
+ <service name="JSSE (Managed Server)" discovery="SubsystemDiscovery" class="BaseComponent">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="jsse" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="cipher-suites" required="false" type="string" readOnly="true"
+ description="Comma separated list of cipher suites to enable on SSLSockets." />
+ <c:simple-property name="client-alias" required="false" type="string" readOnly="true"
+ description="Preferred alias to use when the KeyManager chooses the client alias." />
+ <c:simple-property name="client-auth" required="false" type="boolean" readOnly="true"
+ description="Boolean attribute to indicate if client's certificates should also be authenticated on the server side." />
+ <c:map-property name="key-manager" required="false" description="JSEE Key Manager factory">
+ <c:simple-property name="algorithm" required="false" type="string" readOnly="true"
+ description="Algorithm to use when creating the KeyManagerFactory." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="true"
+ description="Provider class name to use when creating the KeyManagerFactory." />
+ </c:map-property>
+ <c:map-property name="keystore" required="false" description="Configures a JSSE key store">
+ <c:simple-property name="password" required="false" type="string" readOnly="true"
+ description="Sets the password of the keystore. Either this or 'truststore-password' must be present otherwise the security domain will be useless." />
+ <c:simple-property name="type" required="false" type="string" readOnly="true"
+ description="Type of the keystore. If not set, type defaults to 'JKS'." />
+ <c:simple-property name="url" required="false" type="string" readOnly="true" description="URL of the keystore." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="true"
+ description="Provider class name to use when creating the KeyStore." />
+ <c:simple-property name="provider-argument" required="false" type="string" readOnly="true"
+ description="String argument to pass to the keystore Provider constructor when instantiating it." />
+ </c:map-property>
+ <c:simple-property name="protocols" required="false" type="string" readOnly="true"
+ description="Comma separated list of protocols to enable on SSLSockets." />
+ <c:simple-property name="server-alias" required="false" type="string" readOnly="true"
+ description="Preferred alias to use when the KeyManager chooses the server alias." />
+ <c:simple-property name="service-auth-token" required="false" type="string" readOnly="true"
+ description="Token to retrieve PrivateKeys from the KeyStore." />
+ <c:map-property name="trust-manager" required="false" description="JSEE Trust Manager factory">
+ <c:simple-property name="algorithm" required="false" type="string" readOnly="true"
+ description="Algorithm to use when creating the TrustManagerFactory." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="true"
+ description="Provider class name to use when creating the TrustManagerFactory." />
+ </c:map-property>
+ <c:map-property name="truststore" required="false" description="Configures a JSSE trust store">
+ <c:simple-property name="password" required="false" type="string" readOnly="true"
+ description="Sets the password of the truststore. Either this or 'keystore-password' must be present otherwise the security domain will be useless." />
+ <c:simple-property name="type" required="false" type="string" readOnly="true"
+ description="Type of the truststore. If not set, type defaults to 'JKS'." />
+ <c:simple-property name="url" required="false" type="string" readOnly="true" description="URL of the truststore." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="true"
+ description="Provider class name to use when creating the truststore." />
+ <c:simple-property name="provider-argument" required="false" type="string" readOnly="true"
+ description="String argument to pass to the truststore Provider constructor when instantiating it." />
+ </c:map-property>
+ </resource-configuration>
+ </service>
+
+ <service name="Mapping (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="mapping=classic" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ <c:simple-property name="type" required="true" type="string" readOnly="false"
+ description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential..">
+ <c:property-options>
+ <c:option value="attribute" />
+ <c:option value="credential" />
+ <c:option value="principal" />
+ <c:option value="role" />
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+ <service name="Mapping Modules (Managed Server)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="mapping-modules" />
+ </plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ <c:simple-property name="type" required="true" type="string" readOnly="false"
+ description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential..">
+ <c:property-options>
+ <c:option value="attribute" />
+ <c:option value="credential" />
+ <c:option value="principal" />
+ <c:option value="role" />
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+
+ <service name="Module Options (Mapping - Managed Server)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Mapping - Managed Server) -->
+ </service><!-- End of Mapping Modules (Managed Server) -->
+ </service>
</service>
<service name="Vault (Managed Server)"
@@ -5848,8 +5938,8 @@
</service>
<service name="Security (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
+ discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent"
description="The configuration of the security subsystem."
singleton="true">
@@ -5862,8 +5952,8 @@
</resource-configuration>
<service name="Security Domain (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
+ discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent"
createDeletePolicy="both">
<plugin-configuration>
@@ -5879,281 +5969,305 @@
</c:simple-property>
</resource-configuration>
- <service name="ACL (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="ACL (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="acl=classic"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="acl=classic" />
+ </plugin-configuration>
- <resource-configuration>
- <c:list-property name="acl-modules" required="false" description="List of acl modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the acl provider module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ &flagModuleResourceConfig;
+ <service name="Acl Modules (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
- <service name="Audit (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="acl-modules" />
+ </plugin-configuration>
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="audit=classic"/>
- </plugin-configuration>
+ &flagModuleResourceConfig;
- <resource-configuration>
- <c:list-property name="provider-modules" required="false" description="List of provider modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <service name="Module Options (Acl - Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
- <service name="Authentication (Classic - Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authentication=classic"/>
- </plugin-configuration>
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Acl - Profile) -->
+ </service><!-- End of Acl Modules (Profile) -->
+ </service>
- <resource-configuration>
- <c:list-property name="login-modules" required="false" description="List of authentication modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true"
- description="Class name of the module to be instantiated.">
- <c:property-options>
- <c:option value="AdvancedADLdap" />
- <c:option value="AdvancedLdap" />
- <c:option value="Certificate" />
- <c:option value="CertificateRoles" />
- <c:option value="Client" />
- <c:option value="Database" />
- <c:option value="DatabaseCertificate" />
- <c:option value="DatabaseUsers" />
- <c:option value="Identity" />
- <c:option value="Kerberos" />
- <c:option value="Ldap" />
- <c:option value="LdapExtended" />
- <c:option value="RoleMapping" />
- <c:option value="Simple" />
- <c:option value="SPNEGOUsers" />
- <c:option value="UserRoles" />
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the login module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <service name="Audit (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
- <service name="Authentication (Jaspi - Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="audit=classic" />
+ </plugin-configuration>
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authentication=jaspi"/>
- </plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ </resource-configuration>
+ <service name="Provider Modules (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
- <resource-configuration>
- <c:list-property name="auth-modules" required="true" description="List of authentication modules to be used." >
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the auth module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- <c:simple-property name="login-module-stack-ref" required="false" type="string" readOnly="false" description="Reference to a login module stack name previously configured in the same security domain."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="provider-modules" />
+ </plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ </resource-configuration>
- <service name="Login Module Stack (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- createDeletePolicy="both">
+ <service name="Module Options (Provider Modules - Profile)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="login-module-stack"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
- <resource-configuration>
- <c:list-property name="login-modules" required="true" description="List of authentication modules" >
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the login module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
- </service>
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Provider Modules - Profile) -->
+ </service><!-- End of Provider Modules (Profile) -->
+ </service>
- <service name="Authorization (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="Authentication (Classic - Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authorization=classic"/>
- </plugin-configuration>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authentication=classic" />
+ </plugin-configuration>
- <resource-configuration>
- <c:list-property name="policy-modules" required="false" description="List of authorization modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the policy module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <service name="Login Modules (Classic - Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
- <service name="Identity Trust (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="login-modules" />
+ </plugin-configuration>
+
+ &loginModuleResourceConfig;
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="identity-trust=classic"/>
- </plugin-configuration>
+ <service name="Module Options (Classic - Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
- <resource-configuration>
- <c:list-property name="trust-modules" required="false" description="List of trust modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the identity trust module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
- <service name="JSSE (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- createDeletePolicy="both">
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options -->
+ </service><!-- End of Module Options -->
+ </service><!-- End of Authentication (Classic) -->
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="jsse"/>
- </plugin-configuration>
+ <service name="Authentication (Jaspi - Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
- <resource-configuration>
- <c:simple-property name="cipher-suites" required="false" type="string" readOnly="false" description="Comma separated list of cipher suites to enable on SSLSockets."/>
- <c:simple-property name="client-alias" required="false" type="string" readOnly="false" description="Preferred alias to use when the KeyManager chooses the client alias."/>
- <c:simple-property name="client-auth" required="false" type="boolean" readOnly="false" description="Boolean attribute to indicate if client's certificates should also be authenticated on the server side."/>
- <c:map-property name="key-manager" required="false" description="JSEE Key Manager factory">
- <c:simple-property name="algorithm" required="false" type="string" readOnly="false" description="Algorithm to use when creating the KeyManagerFactory."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="false" description="Provider class name to use when creating the KeyManagerFactory."/>
- </c:map-property>
- <c:map-property name="keystore" required="false" description="Configures a JSSE key store">
- <c:simple-property name="password" required="false" type="string" readOnly="false" description="Sets the password of the keystore. Either this or 'truststore-password' must be present otherwise the security domain will be useless."/>
- <c:simple-property name="type" required="false" type="string" readOnly="false" description="Type of the keystore. If not set, type defaults to 'JKS'."/>
- <c:simple-property name="url" required="false" type="string" readOnly="false" description="URL of the keystore."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="false" description="Provider class name to use when creating the KeyStore."/>
- <c:simple-property name="provider-argument" required="false" type="string" readOnly="false" description="String argument to pass to the keystore Provider constructor when instantiating it."/>
- </c:map-property>
- <c:simple-property name="protocols" required="false" type="string" readOnly="false" description="Comma separated list of protocols to enable on SSLSockets."/>
- <c:simple-property name="server-alias" required="false" type="string" readOnly="false" description="Preferred alias to use when the KeyManager chooses the server alias."/>
- <c:simple-property name="service-auth-token" required="false" type="string" readOnly="false" description="Token to retrieve PrivateKeys from the KeyStore."/>
- <c:map-property name="trust-manager" required="false" description="JSEE Trust Manager factory">
- <c:simple-property name="algorithm" required="false" type="string" readOnly="false" description="Algorithm to use when creating the TrustManagerFactory."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="false" description="Provider class name to use when creating the TrustManagerFactory."/>
- </c:map-property>
- <c:map-property name="truststore" required="false" description="Configures a JSSE trust store">
- <c:simple-property name="password" required="false" type="string" readOnly="false" description="Sets the password of the truststore. Either this or 'keystore-password' must be present otherwise the security domain will be useless."/>
- <c:simple-property name="type" required="false" type="string" readOnly="false" description="Type of the truststore. If not set, type defaults to 'JKS'."/>
- <c:simple-property name="url" required="false" type="string" readOnly="false" description="URL of the truststore."/>
- <c:simple-property name="provider" required="false" type="string" readOnly="false" description="Provider class name to use when creating the truststore."/>
- <c:simple-property name="provider-argument" required="false" type="string" readOnly="false" description="String argument to pass to the truststore Provider constructor when instantiating it."/>
- </c:map-property>
- </resource-configuration>
- </service>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authentication=jaspi" />
+ </plugin-configuration>
- <service name="Mapping (Profile)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ &loginModuleResourceConfig;
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="mapping=classic"/>
- </plugin-configuration>
+ <service name="Login Module Stack (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
- <resource-configuration>
- <c:list-property name="mapping-modules" required="false" description="List of modules that map principal, role, and credential information">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="type" required="true" type="string" readOnly="false" description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential.."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="login-module-stack" />
+ </plugin-configuration>
+
+ &loginModuleResourceConfig;
+
+ <service name="Module Options (Login Module Stack (Profile))" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options -->
+
+ </service>
+ </service>
+
+ <service name="Authorization (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authorization=classic" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+ <service name="Authorization Modules (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="policy-modules" />
+ </plugin-configuration>
+ &flagModuleResourceConfig;
+
+ <service name="Module Options (Authorization - Profile)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Authorization - Profile) -->
+ </service><!-- End of Authorization Modules (Profile) -->
+ </service>
+
+ <service name="Identity Trust (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="identity-trust=classic" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+ <service name="Identity Trust Modules (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="trust-modules" />
+ </plugin-configuration>
+ &flagModuleResourceConfig;
+
+ <service name="Module Options (Identity Trust - Profile)" discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent" singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Identity Trust - Profile) -->
+ </service><!-- End of Identity Trust Modules (Profile) -->
+ </service>
+
+ <service name="JSSE (Profile)" discovery="SubsystemDiscovery" class="BaseComponent" createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="jsse" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="cipher-suites" required="false" type="string" readOnly="false"
+ description="Comma separated list of cipher suites to enable on SSLSockets." />
+ <c:simple-property name="client-alias" required="false" type="string" readOnly="false"
+ description="Preferred alias to use when the KeyManager chooses the client alias." />
+ <c:simple-property name="client-auth" required="false" type="boolean" readOnly="false"
+ description="Boolean attribute to indicate if client's certificates should also be authenticated on the server side." />
+ <c:map-property name="key-manager" required="false" description="JSEE Key Manager factory">
+ <c:simple-property name="algorithm" required="false" type="string" readOnly="false"
+ description="Algorithm to use when creating the KeyManagerFactory." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="false"
+ description="Provider class name to use when creating the KeyManagerFactory." />
+ </c:map-property>
+ <c:map-property name="keystore" required="false" description="Configures a JSSE key store">
+ <c:simple-property name="password" required="false" type="string" readOnly="false"
+ description="Sets the password of the keystore. Either this or 'truststore-password' must be present otherwise the security domain will be useless." />
+ <c:simple-property name="type" required="false" type="string" readOnly="false"
+ description="Type of the keystore. If not set, type defaults to 'JKS'." />
+ <c:simple-property name="url" required="false" type="string" readOnly="false" description="URL of the keystore." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="false"
+ description="Provider class name to use when creating the KeyStore." />
+ <c:simple-property name="provider-argument" required="false" type="string" readOnly="false"
+ description="String argument to pass to the keystore Provider constructor when instantiating it." />
+ </c:map-property>
+ <c:simple-property name="protocols" required="false" type="string" readOnly="false"
+ description="Comma separated list of protocols to enable on SSLSockets." />
+ <c:simple-property name="server-alias" required="false" type="string" readOnly="false"
+ description="Preferred alias to use when the KeyManager chooses the server alias." />
+ <c:simple-property name="service-auth-token" required="false" type="string" readOnly="false"
+ description="Token to retrieve PrivateKeys from the KeyStore." />
+ <c:map-property name="trust-manager" required="false" description="JSEE Trust Manager factory">
+ <c:simple-property name="algorithm" required="false" type="string" readOnly="false"
+ description="Algorithm to use when creating the TrustManagerFactory." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="false"
+ description="Provider class name to use when creating the TrustManagerFactory." />
+ </c:map-property>
+ <c:map-property name="truststore" required="false" description="Configures a JSSE trust store">
+ <c:simple-property name="password" required="false" type="string" readOnly="false"
+ description="Sets the password of the truststore. Either this or 'keystore-password' must be present otherwise the security domain will be useless." />
+ <c:simple-property name="type" required="false" type="string" readOnly="false"
+ description="Type of the truststore. If not set, type defaults to 'JKS'." />
+ <c:simple-property name="url" required="false" type="string" readOnly="false" description="URL of the truststore." />
+ <c:simple-property name="provider" required="false" type="string" readOnly="false"
+ description="Provider class name to use when creating the truststore." />
+ <c:simple-property name="provider-argument" required="false" type="string" readOnly="false"
+ description="String argument to pass to the truststore Provider constructor when instantiating it." />
+ </c:map-property>
+ </resource-configuration>
+ </service>
+
+ <service name="Mapping (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="mapping=classic" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ <c:simple-property name="type" required="true" type="string" readOnly="false"
+ description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential..">
+ <c:property-options>
+ <c:option value="attribute" />
+ <c:option value="credential" />
+ <c:option value="principal" />
+ <c:option value="role" />
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+ <service name="Mapping Modules (Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="mapping-modules" />
+ </plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ <c:simple-property name="type" required="true" type="string" readOnly="false"
+ description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential..">
+ <c:property-options>
+ <c:option value="attribute" />
+ <c:option value="credential" />
+ <c:option value="principal" />
+ <c:option value="role" />
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+
+ <service name="Module Options (Mapping - Profile)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:map-property name="Module Options" required="false" />
+ </resource-configuration>
+ </service><!-- End of Module Options (Mapping - Profile) -->
+ </service><!-- End of Mapping Modules (Managed Server) -->
+ </service>
</service>
<service name="Vault (Profile)"
@@ -6596,6 +6710,27 @@
<c:simple-property name="routing-name" required="false" type="string" readOnly="false" description="Routing name of the divert"/>
<c:simple-property name="transformer-class-name" required="false" type="string" readOnly="false" description="The name of a class used to transform the message's body or properties before it is diverted."/>
</resource-configuration>
+
+ <service name="Module Option"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ createDeletePolicy="both"
+ description="The module options to be used."
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="module-options"/>
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:list-property name="Modules Options" required="false" description="List of module options.">
+ <c:map-property name="*" required="false">
+ <c:simple-property name="name"/>
+ <c:simple-property name="value"/>
+ </c:map-property>
+ </c:list-property>
+ </resource-configuration>
+ </service>
</service>
<service name="Queue (Profile)"
@@ -10294,8 +10429,8 @@
</resource-configuration>
<service name="Security Domain"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
+ discovery="ModuleOptionsDiscoveryComponent"
+ class="ModuleOptionsComponent"
createDeletePolicy="both">
<plugin-configuration>
@@ -10323,219 +10458,200 @@
</c:simple-property>
</resource-configuration>
- <service name="ACL"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="ACL" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent" singleton="true"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="acl=classic" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+ <service name="Acl Modules" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="acl-modules" />
+ </plugin-configuration>
+ &flagModuleResourceConfig;
+
+ <service name="Module Options (Acl)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="acl=classic"/>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
</plugin-configuration>
<resource-configuration>
- <c:list-property name="acl-modules" required="false" description="List of acl modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the acl provider module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
+ <c:map-property name="Module Options" required="false" />
</resource-configuration>
- </service>
+ </service><!-- End of Module Options (Acl) -->
+ </service><!-- End of Acl Modules -->
+ </service>
- <service name="Audit"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="Audit" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent" singleton="true"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="audit=classic" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ </resource-configuration>
+ <service name="Provider Modules" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="provider-modules" />
+ </plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ </resource-configuration>
+
+ <service name="Module Options (Provider Modules)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="audit=classic"/>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
</plugin-configuration>
<resource-configuration>
- <c:list-property name="provider-modules" required="false" description="List of provider modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
+ <c:map-property name="Module Options" required="false" />
</resource-configuration>
- </service>
+ </service><!-- End of Module Options (Provider Modules) -->
+ </service><!-- End of Provider Modules -->
+ </service>
- <service name="Authentication (Classic)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="Authentication (Classic)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authentication=classic" />
+ </plugin-configuration>
+
+ &loginModuleResourceConfig;
+
+ <service name="Login Modules (Classic)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="login-modules" />
+ </plugin-configuration>
+
+ &loginModuleResourceConfig;
+
+ <service name="Module Options (Classic)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authentication=classic"/>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
</plugin-configuration>
<resource-configuration>
- <c:list-property name="login-modules" required="false" description="List of authentication modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="true"
- description="Class name of the module to be instantiated.">
- <c:property-options>
- <c:option value="AdvancedADLdap" />
- <c:option value="AdvancedLdap" />
- <c:option value="Certificate" />
- <c:option value="CertificateRoles" />
- <c:option value="Client" />
- <c:option value="Database" />
- <c:option value="DatabaseCertificate" />
- <c:option value="DatabaseUsers" />
- <c:option value="Identity" />
- <c:option value="Kerberos" />
- <c:option value="Ldap" />
- <c:option value="LdapExtended" />
- <c:option value="RoleMapping" />
- <c:option value="Simple" />
- <c:option value="SPNEGOUsers" />
- <c:option value="UserRoles" />
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the login module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
+ <c:map-property name="Module Options" required="false" />
</resource-configuration>
- </service>
+ </service><!-- End of Module Options -->
+ </service><!-- End of Login Modules (Classic) -->
+ </service><!-- End of Authentication (Classic) -->
- <service name="Authentication (Jaspi)"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="Authentication (Jaspi)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authentication=jaspi" />
+ </plugin-configuration>
+
+ &loginModuleResourceConfig;
+
+ <service name="Login Module Stack" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="login-module-stack" />
+ </plugin-configuration>
+
+ &loginModuleResourceConfig;
+
+ <service name="Module Options (Login Module Stack)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authentication=jaspi"/>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
</plugin-configuration>
<resource-configuration>
- <c:list-property name="auth-modules" required="true" description="List of authentication modules to be used." >
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the auth module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- <c:simple-property name="login-module-stack-ref" required="false" type="string" readOnly="false" description="Reference to a login module stack name previously configured in the same security domain."/>
- </c:map-property>
- </c:list-property>
+ <c:map-property name="Module Options" required="false" />
</resource-configuration>
+ </service><!-- End of Module Options -->
- <service name="Login Module Stack"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- createDeletePolicy="both">
+ </service>
+ </service>
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="login-module-stack"/>
- </plugin-configuration>
+ <service name="Authorization" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
- <resource-configuration>
- <c:list-property name="login-modules" required="true" description="List of authentication modules" >
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the login module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
- </resource-configuration>
- </service>
- </service>
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="authorization=classic" />
+ </plugin-configuration>
- <service name="Authorization"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ &flagModuleResourceConfig;
+
+ <service name="Authorization Modules" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="policy-modules" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+
+ <service name="Module Options (Authorization)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="authorization=classic"/>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
</plugin-configuration>
<resource-configuration>
- <c:list-property name="policy-modules" required="false" description="List of authorization modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the policy module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
+ <c:map-property name="Module Options" required="false" />
</resource-configuration>
- </service>
+ </service><!-- End of Module Options (Authorization) -->
+ </service><!-- End of Authorization Modules -->
+ </service>
- <service name="Identity Trust"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="Identity Trust" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true" createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="identity-trust=classic" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+
+ <service name="Identity Trust Modules" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="trust-modules" />
+ </plugin-configuration>
+
+ &flagModuleResourceConfig;
+
+ <service name="Module Options (Identity Trust)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="identity-trust=classic"/>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
</plugin-configuration>
<resource-configuration>
- <c:list-property name="trust-modules" required="false" description="List of trust modules">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="flag" required="true" type="string" readOnly="false" description="The flag controls how the module participates in the overall procedure. Allowed values are requisite, required, sufficient or optional.">
- <c:property-options>
- <c:option value="sufficient"/>
- <c:option value="requisite"/>
- <c:option value="optional"/>
- <c:option value="required"/>
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="Name of JBoss Module where the identity trust module code is located."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
+ <c:map-property name="Module Options" required="false" />
</resource-configuration>
- </service>
+ </service><!-- End of Module Options (Identity Trust) -->
+ </service><!-- End of Identity Trust Modules -->
+ </service>
<service name="JSSE"
discovery="SubsystemDiscovery"
@@ -10578,26 +10694,59 @@
</resource-configuration>
</service>
- <service name="Mapping"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- createDeletePolicy="both">
+ <service name="Mapping" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent" singleton="true"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="mapping=classic" />
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ <c:simple-property name="type" required="true" type="string" readOnly="false"
+ description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential..">
+ <c:property-options>
+ <c:option value="attribute" />
+ <c:option value="credential" />
+ <c:option value="principal" />
+ <c:option value="role" />
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+ <service name="Mapping Modules" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ createDeletePolicy="both">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="mapping-modules" />
+ </plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="code" required="true" type="string" readOnly="false"
+ description="Class name of the module to be instantiated." />
+ <c:simple-property name="type" required="true" type="string" readOnly="false"
+ description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential..">
+ <c:property-options>
+ <c:option value="attribute" />
+ <c:option value="credential" />
+ <c:option value="principal" />
+ <c:option value="role" />
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+
+ <service name="Module Options (Mapping)" discovery="ModuleOptionsDiscoveryComponent" class="ModuleOptionsComponent"
+ singleton="true">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="mapping=classic"/>
+ <c:simple-property name="path" readOnly="true" default="module-options" />
</plugin-configuration>
<resource-configuration>
- <c:list-property name="mapping-modules" required="false" description="List of modules that map principal, role, and credential information">
- <c:map-property name="*" required="false">
- <c:simple-property name="code" required="true" type="string" readOnly="false" description="Class name of the module to be instantiated."/>
- <c:simple-property name="type" required="true" type="string" readOnly="false" description="Type of mapping this module performs. Allowed values are principal, role, attribute or credential.."/>
- <c:simple-property name="module-options" required="false" type="string" readOnly="false" description="List of module options containing a name/value pair."/>
- </c:map-property>
- </c:list-property>
+ <c:map-property name="Module Options" required="false" />
</resource-configuration>
- </service>
+ </service><!-- End of Module Options (Mapping) -->
+ </service><!-- End of Mapping Modules -->
+ </service>
</service>
<service name="Vault"
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
new file mode 100644
index 0000000..49d8040
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
@@ -0,0 +1,319 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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.modules.plugins.jbossas7;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.ModuleOptionType;
+import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.Value;
+import org.rhq.modules.plugins.jbossas7.json.Address;
+import org.rhq.modules.plugins.jbossas7.json.Operation;
+import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
+import org.rhq.modules.plugins.jbossas7.json.Remove;
+import org.rhq.modules.plugins.jbossas7.json.Result;
+import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
+
+/**
+ * Test exercising the subsystem=security/SecurityDomain/[Authentication, Authorization, Mapping, Audit, Acl,
+ * Identity-Trust]
+ * @author Simeon Pinder
+ */
+@Test(groups = "unit")
+public class SecurityModuleOptionsTest extends AbstractConfigurationHandlingTest {
+
+ private static String user = "rhqadmin";
+ private static String pass = "as7";
+ private static String host = "localhost";
+ private static ASConnection con = null;
+ private static ObjectMapper mapper = null;
+ private ModuleOptionsComponent moc = null;
+
+ //Define some shared and reusable content
+ static HashMap<String, String> jsonMap = new HashMap<String, String>();
+ static {
+ jsonMap
+ .put(
+ "login-modules",
+ "[{\"flag\":\"required\", \"code\":\"Ldap\", \"module-options\":{\"bindDn\":\"uid=ldapSecureUser,ou=People,dc=redat,dc=com\", \"bindPw\":\"test126\", \"allowEmptyPasswords\":\"true\"}}]");
+ // "[{\"flag\":\"required\", \"code\":\"Ldap\"}]");
+ jsonMap
+ .put(
+ "policy-modules",
+ "[{\"flag\":\"requisite\", \"code\":\"LdapExtended\", \"module-options\":{\"policy\":\"module\", \"policy1\":\"module1\"}}]");
+ jsonMap
+ .put("mapping-modules",
+ "[{\"code\":\"Test\", \"type\":\"attribute\", \"module-options\":{\"mapping\":\"module\", \"mapping1\":\"module1\"}}]");
+ jsonMap.put("provider-modules",
+ "[{\"code\":\"Providers\", \"module-options\":{\"provider\":\"module\", \"provider1\":\"module1\"}}]");
+ }
+
+ @BeforeSuite
+ private void initializeConnectionDetails() {
+ con = new ASConnection(host, 9990, user, pass);
+ mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
+
+ moc = new ModuleOptionsComponent();
+ }
+
+ public static void main(String[] args) {
+ SecurityModuleOptionsTest test = new SecurityModuleOptionsTest();
+ try {
+ test.initializeConnectionDetails();
+ test.testPopulateModuleOptionsAndTypes();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ /**The test reads the existing property values, deserializes them and writes the same
+ * contents back out to a running instance for all known ModuleOptionTypes.
+ *
+ * @throws Exception
+ */
+ public void testPopulateModuleOptionsAndTypes() throws Exception {
+
+ //as7 node details.
+ String securityDomainId = "testDomain";
+ //TODO: spinder 6-6-12: this cannot run as a standalone itest until JIRA https://issues.jboss.org/browse/AS7-4951
+ // is addressed as there is no way to automate setup of the information being tested.
+ String address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+ boolean verboseOutput = true;
+ boolean executeOperation = true;
+ for (ModuleOptionType t : ModuleOptionType.values()) {
+ String attribute = t.getAttribute();
+ if (verboseOutput) {
+ System.out.println("======= Running with ModuleOptionType:" + t + " attribute:" + attribute + ":");
+ }
+ if (attribute.equals("policy-modules")) {
+ address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
+ } else if (attribute.equals("acl-modules")) {
+ address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
+ } else if (attribute.equals("mapping-modules")) {
+ address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
+ } else if (attribute.equals("trust-modules")) {
+ address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
+ } else if (attribute.equals("provider-modules")) {
+ address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
+ } else if (attribute.equals("login-modules")) {
+ address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+ } else {
+ assert false : "An unknown attribute '" + attribute
+ + "' was found. Is there a new type to be supported?";
+ }
+
+ //test operation- read property always available.
+ Operation op = null;
+
+ //read the login-modules attribute
+ op = new ReadAttribute(new Address(address), attribute);
+ Result result = exerciseOperation(op, true, verboseOutput);
+ assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+ + result.getFailureDescription();
+ //extract current results
+ Object rawResult = result.getResult();
+ assert rawResult != null : "Read of attribute'" + attribute + "' from address '" + address
+ + "' has returned no value. Are those values in the model?";
+
+ List<Value> list2 = new ArrayList<Value>();
+ //populate the Value component complete with module Options.
+ list2 = moc.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+ if (verboseOutput) {
+ if (rawResult != null) {
+ System.out.println("Raw Result is:" + rawResult + " and of type:" + rawResult.getClass());
+ } else {
+ System.out.println("Read of attribute'" + attribute + "' from address '" + address
+ + "' has returned no value. Are those values in the model?");
+ }
+ }
+ //write the login-modules attribute
+ op = new WriteAttribute(new Address(address));
+ op.addAdditionalProperty("name", attribute);//attribute to execute on
+ op.addAdditionalProperty("value", list2);
+
+ //Now test the operation
+ result = exerciseOperation(op, executeOperation, verboseOutput);
+ assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+ + "' failed to write the resource.." + result.getFailureDescription();
+
+ //read the login-modules attribute
+ op = new ReadAttribute(new Address(address), attribute);
+ result = exerciseOperation(op, true, verboseOutput);
+ assert (result.isSuccess() == true) : "The operation '" + op + "' failed to read the resource."
+ + result.getFailureDescription();
+ }
+ if (verboseOutput) {
+ System.out.println("Successfully detected,read and wrote out attribute values for:");
+ for (ModuleOptionType type : ModuleOptionType.values()) {
+ System.out.println("\n" + type.ordinal() + " " + type.name());
+ }
+ }
+ }
+
+ /**Attempts to create a new Authentication node(authentication=classic) with a
+ * 'login-modules' attribute complete with 'code':'Ldap' and 'flag':'required'
+ * and some sample 'module-options' values.
+ *
+ */
+ @Test(enabled = true)
+ public void testCreateSecurityDomainChildLoginModules() {
+ boolean execute = true;
+ boolean verboseOutput = false;
+ String address = "subsystem=security,security-domain=testDomain3,authentication=classic";
+ String attribute = ModuleOptionType.Authentication.getAttribute();
+
+ //test operation- read property always available.
+ Operation op = null;
+
+ //read the login-modules attribute
+ op = new ReadAttribute(new Address(address), attribute);
+ Result result = exerciseOperation(op, execute, verboseOutput);
+ assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+ + result.getFailureDescription();
+
+ //extract current results
+ Object rawResult = result.getResult();
+
+ //#### Have to create new content for the new node.
+ List<Value> moduleTypeValue = new ArrayList<Value>();
+ try {
+ // loading 'login-module'
+ JsonNode node = mapper.readTree(jsonMap.get(attribute));
+ result.setResult(mapper.treeToValue(node, Object.class));
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ //populate the Value component complete with module Options.
+ moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+
+ //add the login-modules attribute
+ op = ModuleOptionsComponent
+ .createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
+
+ result = exerciseOperation(op, execute, verboseOutput);
+ assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+ + "' failed to write the resource.." + result.getFailureDescription();
+
+ //read the login-modules attribute
+ op = new ReadAttribute(new Address(address), attribute);
+ result = exerciseOperation(op, execute, verboseOutput);
+ assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+ + result.getFailureDescription();
+
+ //exercise values retrieved from read
+ List<Value> serverResponse = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+ ModuleOptionsComponent.loadModuleOptionType(attribute));
+ Value serverState = serverResponse.get(0);
+ assert serverState.getFlag().equals("required") : "Incorrect state retrieved for 'flag'. Expected 'required'.";
+ assert serverState.getCode().equals("Ldap") : "Incorrect state retrieved for 'code'. Expected 'Ldap'.";
+ LinkedHashMap<String, Object> options = serverState.getOptions();
+ assert options.size() == 3 : "Invalid number of module options returned. Expected 3.";
+ int found = 0;
+ for (String key : options.keySet()) {
+ if (key.equals("bindPw")) {
+ assert "test126".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+ found++;
+ } else if (key.equals("bindDn")) {
+ assert "uid=ldapSecureUser,ou=People,dc=redat,dc=com".equals(options.get(key)) : "Module option value not correct for key '"
+ + key + "'.";
+ found++;
+ } else if (key.equals("allowEmptyPasswords")) {
+ assert "true".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+ found++;
+ }
+ }
+ assert found == 3 : "All module options were not loaded.";
+
+ //remove the original node to reset for next run.
+ op = new Remove(new Address(address));
+ result = exerciseOperation(op, execute, verboseOutput);
+ assert result.isSuccess() == true : "The operation '" + op + "' failed to remove the resource."
+ + result.getFailureDescription();
+ }
+
+ /** For each operation
+ * - will write verbose json and operation details to system.out if verboseOutput = true;
+ * - will execute the operation against running server if execute = true.
+ *
+ * @param op
+ * @param execute
+ * @param verboseOutput
+ * @return
+ */
+ public static Result exerciseOperation(Operation op, boolean execute, boolean verboseOutput) {
+ //display operation as AS7 plugin will build it
+ if (verboseOutput) {
+ System.out.println("\tOperation is:" + op);
+ }
+
+ String jsonToSend = "";
+ try {
+ // jsonToSend = mapper.writeValueAsString(op);
+ jsonToSend = mapper.defaultPrettyPrintingWriter().writeValueAsString(op);
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ //As generated by jackson mapper
+ if (verboseOutput) {
+ System.out.println("@@@@ OUTBOUND JSON#\n" + jsonToSend + "#");
+ }
+
+ //Execute the operation
+ Result result = new Result();
+ if (execute) {
+ result = con.execute(op);
+ } else {
+ if (verboseOutput) {
+ System.out.println("**** NOTE: Execution disabled . NOT exercising write-attribute operation. **** ");
+ }
+ }
+ if (verboseOutput) {
+ //result wrapper details
+ System.out.println("\tResult:" + result);
+ //detailed results
+ System.out.println("\tValue:" + result.getResult());
+ System.out.println("-----------------------------------------------------\n");
+ }
+ return result;
+ }
+}
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - modules/enterprise
by Heiko W. Rupp
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 679c8d573f29b10d15a519d58b22a065951b3663
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jul 30 11:40:08 2012 -0400
BZ 844407 - Eliminate call to isLast() which is problematic on Oracle (cherry picked from commit bbf48d7, BZ 834820)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java
index bcc5db2..0d35eee 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java
@@ -608,8 +608,13 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
PrintWriter pw = new PrintWriter(outputStream);
if (mediaType.equals(MediaType.APPLICATION_JSON_TYPE)) {
+ boolean needsComma = false;
pw.println("[");
while (rs.next()) {
+ if (needsComma) {
+ pw.print(",\n");
+ }
+ needsComma = true;
pw.print("{");
pw.print("\"scheduleId\":");
pw.print(scheduleId);
@@ -620,8 +625,6 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
pw.print("\"value\":");
pw.print(rs.getDouble(2));
pw.print("}");
- if (!rs.isLast())
- pw.print(",\n");
}
pw.println("]");
}
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - modules/core
by snegrea
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/ServerServicesSetup.java | 52 +++
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAnnotatedMethodExecutor.java | 172 ++++++++++
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAroundDiscoveryExecutor.java | 142 --------
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/RhqAgentPluginContainerExtension.java | 1
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/ServerServicesPreparator.java | 59 +++
5 files changed, 289 insertions(+), 137 deletions(-)
New commits:
commit 6f21d695a10b03c7310360e3902f6d5713555248
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 30 09:32:38 2012 -0500
[BZ 816593][BZ 816587] - Adding unit tests for content retrieval and detection
in standalone server.
!!Just a test framework improvement needed for later patches!!
(cherry picked from commit 7b9476c940c210207378d01f96bbf2b27a858d5c)
Conflicts:
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
diff --git a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/ServerServicesSetup.java b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/ServerServicesSetup.java
new file mode 100644
index 0000000..b7a37dc
--- /dev/null
+++ b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/ServerServicesSetup.java
@@ -0,0 +1,52 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.test.arquillian;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Methods annotated with this annotation will have a chance to interact with
+ * the configured server services implementation right after it has been instantiated,
+ * before it is passed to the plugin container's configuration.
+ *
+ * @author Lukas Krejci
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.METHOD)
+public @interface ServerServicesSetup {
+
+ /**
+ * This list of test methods the method annotated with this annotation applies to.
+ * <p>
+ * By default the {@code @ServerServicesSetup} method applies to all test methods.
+ */
+ String[] testMethods() default {};
+
+ /**
+ * If order of the {@code @ServerServicesSetup} methods is significant, you can order them
+ * by using this parameter.
+ * <p>
+ * Zero or negative value means no significant order required.
+ */
+ int order() default 0;
+}
diff --git a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAnnotatedMethodExecutor.java b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAnnotatedMethodExecutor.java
new file mode 100644
index 0000000..30adcaf
--- /dev/null
+++ b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAnnotatedMethodExecutor.java
@@ -0,0 +1,172 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.test.arquillian.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.arquillian.test.spi.TestClass;
+import org.jboss.arquillian.test.spi.event.suite.TestEvent;
+
+import org.rhq.core.pc.PluginContainer;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public abstract class AbstractAnnotatedMethodExecutor<T extends Annotation> {
+
+ protected static class ApplicableTestMethodsAndOrder {
+ private String[] applicableTestMethodNames;
+ private int order;
+
+ public ApplicableTestMethodsAndOrder(String[] applicableTestMethodNames, int order) {
+ this.applicableTestMethodNames = applicableTestMethodNames;
+ this.order = order;
+ }
+
+ public String[] getApplicableTestMethodNames() {
+ return applicableTestMethodNames;
+ }
+
+ public int getOrder() {
+ return order;
+ }
+ }
+
+ private static class AnnotatedMethod {
+ private Method testMethod;
+ private ApplicableTestMethodsAndOrder methodsAndOrder;
+
+ public AnnotatedMethod(Method testMethod, ApplicableTestMethodsAndOrder methodsAndOrder) {
+ this.testMethod = testMethod;
+ this.methodsAndOrder = methodsAndOrder;
+ }
+
+ public Method getTestMethod() {
+ return testMethod;
+ }
+
+ public ApplicableTestMethodsAndOrder getApplicablTestMethodsAndOrder() {
+ return methodsAndOrder;
+ }
+ }
+
+ private Class<T> annotationClass;
+
+ protected AbstractAnnotatedMethodExecutor(Class<T> annotationClass) {
+ this.annotationClass = annotationClass;
+ }
+
+ protected abstract ApplicableTestMethodsAndOrder getApplicableTestMethodsAndOrder(T annotation);
+
+ private static final Comparator<AnnotatedMethod> ORDERING = new Comparator<AnnotatedMethod>() {
+
+ @Override
+ public int compare(AnnotatedMethod m1, AnnotatedMethod m2) {
+
+ int o1 = m1.getApplicablTestMethodsAndOrder().getOrder();
+ int o2 = m2.getApplicablTestMethodsAndOrder().getOrder();
+
+ if (o1 > 0) {
+ if (o2 > 0) {
+ return o1 - o2;
+ } else {
+ //explicitly ordered stuff always precedes the unordered
+ return -1;
+ }
+ } else {
+ //explicitly ordered stuff always precedes the unordered
+ return o2 > 0 ? 1 : 0;
+ }
+ }
+ };
+
+ protected abstract boolean isApplicableToTest(TestEvent testEvent);
+
+ protected void process(PluginContainer pluginContainer, TestEvent testEvent) {
+ if (isApplicableToTest(testEvent)) {
+ doProcess(testEvent);
+ }
+ }
+
+ private void doProcess(TestEvent event) {
+ Object testCase = event.getTestInstance();
+ TestClass testClass = event.getTestClass();
+ String testMethodName = event.getTestMethod().getName();
+
+ for (Method m : filterAndOrderMethods(testMethodName, testClass.getMethods(annotationClass))) {
+ try {
+ m.invoke(testCase, (Object[]) null);
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to execute @" + annotationClass.getSimpleName()
+ + " method [" + m + "] - cause: " + e, e);
+ }
+ }
+ }
+
+ private List<Method> filterAndOrderMethods(String targetTestMethodName, Method[] methods) {
+ List<AnnotatedMethod> ordered = new ArrayList<AnnotatedMethod>(methods.length);
+
+ for (int i = 0; i < methods.length; ++i) {
+ T annotation = methods[i].getAnnotation(annotationClass);
+ ApplicableTestMethodsAndOrder o = getApplicableTestMethodsAndOrder(annotation);
+
+ AnnotatedMethod m = new AnnotatedMethod(methods[i], o);
+
+ ordered.add(m);
+ }
+
+ Iterator<AnnotatedMethod> it = ordered.iterator();
+
+ //filter
+ while (it.hasNext()) {
+ AnnotatedMethod m = it.next();
+
+ String[] applicableTestMethodNames = m.getApplicablTestMethodsAndOrder().getApplicableTestMethodNames();
+
+ if (applicableTestMethodNames.length > 0
+ && !Arrays.asList(applicableTestMethodNames).contains(targetTestMethodName)) {
+
+ it.remove();
+ }
+ }
+
+ //order
+ Collections.sort(ordered, ORDERING);
+
+ //convert to List<Method>
+
+ List<Method> ret = new ArrayList<Method>(ordered.size());
+
+ for(AnnotatedMethod m : ordered) {
+ ret.add(m.getTestMethod());
+ }
+
+ return ret;
+ }
+}
diff --git a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAroundDiscoveryExecutor.java b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAroundDiscoveryExecutor.java
index 2b57e80..78954c8 100644
--- a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAroundDiscoveryExecutor.java
+++ b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/AbstractAroundDiscoveryExecutor.java
@@ -20,18 +20,9 @@
package org.rhq.test.arquillian.impl;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.arquillian.test.spi.event.suite.TestEvent;
-import org.rhq.core.pc.PluginContainer;
import org.rhq.test.arquillian.RunDiscovery;
/**
@@ -39,138 +30,15 @@ import org.rhq.test.arquillian.RunDiscovery;
*
* @author Lukas Krejci
*/
-public abstract class AbstractAroundDiscoveryExecutor<T extends Annotation> {
+public abstract class AbstractAroundDiscoveryExecutor<T extends Annotation> extends AbstractAnnotatedMethodExecutor<T> {
- protected static class ApplicableTestMethodsAndOrder {
- private String[] applicableTestMethodNames;
- private int order;
-
- public ApplicableTestMethodsAndOrder(String[] applicableTestMethodNames, int order) {
- this.applicableTestMethodNames = applicableTestMethodNames;
- this.order = order;
- }
-
- public String[] getApplicableTestMethodNames() {
- return applicableTestMethodNames;
- }
-
- public int getOrder() {
- return order;
- }
- }
-
- private static class AnnotatedMethod {
- private Method testMethod;
- private ApplicableTestMethodsAndOrder methodsAndOrder;
-
- public AnnotatedMethod(Method testMethod, ApplicableTestMethodsAndOrder methodsAndOrder) {
- this.testMethod = testMethod;
- this.methodsAndOrder = methodsAndOrder;
- }
-
- public Method getTestMethod() {
- return testMethod;
- }
-
- public ApplicableTestMethodsAndOrder getApplicablTestMethodsAndOrder() {
- return methodsAndOrder;
- }
- }
-
- private Class<T> annotationClass;
-
protected AbstractAroundDiscoveryExecutor(Class<T> annotationClass) {
- this.annotationClass = annotationClass;
- }
-
- protected abstract ApplicableTestMethodsAndOrder getApplicableTestMethodsAndOrder(T annotation);
-
- private static final Comparator<AnnotatedMethod> ORDERING = new Comparator<AnnotatedMethod>() {
-
- @Override
- public int compare(AnnotatedMethod m1, AnnotatedMethod m2) {
-
- int o1 = m1.getApplicablTestMethodsAndOrder().getOrder();
- int o2 = m2.getApplicablTestMethodsAndOrder().getOrder();
-
- if (o1 > 0) {
- if (o2 > 0) {
- return o1 - o2;
- } else {
- //explicitly ordered stuff always precedes the unordered
- return -1;
- }
- } else {
- //explicitly ordered stuff always precedes the unordered
- return o2 > 0 ? 1 : 0;
- }
- }
- };
-
- protected void process(PluginContainer pluginContainer, TestEvent testEvent) {
- if (isRunningDiscovery(testEvent)) {
- doProcess(testEvent);
- }
- }
-
- private void doProcess(TestEvent event) {
- Object testCase = event.getTestInstance();
- TestClass testClass = event.getTestClass();
- String testMethodName = event.getTestMethod().getName();
-
- for (Method m : filterAndOrderMethods(testMethodName, testClass.getMethods(annotationClass))) {
- try {
- m.invoke(testCase, (Object[]) null);
- } catch (Exception e) {
- throw new IllegalStateException("Failed to execute @" + annotationClass.getSimpleName()
- + " method [" + m + "] - cause: " + e, e);
- }
- }
+ super(annotationClass);
}
- private boolean isRunningDiscovery(TestEvent event) {
- RunDiscovery runDiscovery = RunDiscoveryExecutor.getRunDiscoveryForTest(event);
+ @Override
+ protected boolean isApplicableToTest(TestEvent testEvent) {
+ RunDiscovery runDiscovery = RunDiscoveryExecutor.getRunDiscoveryForTest(testEvent);
return runDiscovery != null && (runDiscovery.discoverServers() || runDiscovery.discoverServices());
}
-
- private List<Method> filterAndOrderMethods(String targetTestMethodName, Method[] beforeDiscoveryMethods) {
- List<AnnotatedMethod> ordered = new ArrayList<AbstractAroundDiscoveryExecutor.AnnotatedMethod>(beforeDiscoveryMethods.length);
-
- for (int i = 0; i < beforeDiscoveryMethods.length; ++i) {
- T annotation = beforeDiscoveryMethods[i].getAnnotation(annotationClass);
- ApplicableTestMethodsAndOrder o = getApplicableTestMethodsAndOrder(annotation);
-
- AnnotatedMethod m = new AnnotatedMethod(beforeDiscoveryMethods[i], o);
-
- ordered.add(m);
- }
-
- Iterator<AnnotatedMethod> it = ordered.iterator();
-
- //filter
- while (it.hasNext()) {
- AnnotatedMethod m = it.next();
-
- String[] applicableTestMethodNames = m.getApplicablTestMethodsAndOrder().getApplicableTestMethodNames();
-
- if (applicableTestMethodNames.length > 0
- && !Arrays.asList(applicableTestMethodNames).contains(targetTestMethodName)) {
-
- it.remove();
- }
- }
-
- //order
- Collections.sort(ordered, ORDERING);
-
- //convert to List<Method>
-
- List<Method> ret = new ArrayList<Method>(ordered.size());
-
- for(AnnotatedMethod m : ordered) {
- ret.add(m.getTestMethod());
- }
-
- return ret;
- }
}
diff --git a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/RhqAgentPluginContainerExtension.java b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/RhqAgentPluginContainerExtension.java
index 0b9c7fa..c5f23c9 100644
--- a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/RhqAgentPluginContainerExtension.java
+++ b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/RhqAgentPluginContainerExtension.java
@@ -58,6 +58,7 @@ public class RhqAgentPluginContainerExtension implements LoadableExtension {
.service(PostPrepareEnricher.class, DiscoveryResultsTestEnricher.class)
.service(PluginContainerOperation.class, RunDiscoveryExecutor.class)
.service(PluginContainerPreparator.class, BeforeDiscoveryPreparator.class)
+ .service(PluginContainerPreparator.class, ServerServicesPreparator.class)
.service(PluginContainerOperationRemedy.class, AfterDiscoveryRemedy.class);
}
}
diff --git a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/ServerServicesPreparator.java b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/ServerServicesPreparator.java
new file mode 100644
index 0000000..9ff0d5b
--- /dev/null
+++ b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/ServerServicesPreparator.java
@@ -0,0 +1,59 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.test.arquillian.impl;
+
+import org.jboss.arquillian.test.spi.event.suite.TestEvent;
+
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.test.arquillian.ServerServicesSetup;
+import org.rhq.test.arquillian.spi.PluginContainerPreparator;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public class ServerServicesPreparator extends AbstractAnnotatedMethodExecutor<ServerServicesSetup> implements PluginContainerPreparator {
+
+ /**
+ * @param annotationClass
+ */
+ public ServerServicesPreparator() {
+ super(ServerServicesSetup.class);
+ }
+
+ @Override
+ public void prepare(PluginContainer pluginContainer, TestEvent testEvent) {
+ process(pluginContainer, testEvent);
+ }
+
+ @Override
+ protected ApplicableTestMethodsAndOrder
+ getApplicableTestMethodsAndOrder(ServerServicesSetup annotation) {
+
+ return new ApplicableTestMethodsAndOrder(annotation.testMethods(), annotation.order());
+ }
+
+ @Override
+ protected boolean isApplicableToTest(TestEvent testEvent) {
+ return true;
+ }
+
+}
11 years, 9 months
[rhq] modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 264bf23cb169b7c2fe73f1756138914752f4f2ee
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jul 30 10:23:35 2012 -0400
BZ 844217 - Use the correct name for the deployments directory (for bundles).
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
index a756dea..9d93300 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
@@ -87,7 +87,7 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
// Set deployment directory, which only exists for standalone servers
String baseDir = pluginConfig.getSimpleValue("baseDir");
if (baseDir != null) {
- File deployDir = new File(baseDir, "deployment");
+ File deployDir = new File(baseDir, "deployments");
pluginConfig.put(new PropertySimple("deployDir", deployDir.getPath()));
}
11 years, 9 months
[rhq] 3 commits - etc/standalone-pc modules/core modules/enterprise
by Heiko W. Rupp
etc/standalone-pc/README.txt | 3
etc/standalone-pc/standalone.bat | 9 -
etc/standalone-pc/standalone.sh | 12 --
modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java | 57 ++++++----
modules/enterprise/agent/src/etc/plugin-validator.sh | 7 +
modules/enterprise/agent/src/etc/standalone-pc.bat | 9 +
modules/enterprise/agent/src/etc/standalone-pc.sh | 12 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java | 2
8 files changed, 71 insertions(+), 40 deletions(-)
New commits:
commit c1d8f3211ece139eb08cb3f2ee22747a78f9d821
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Jul 27 11:24:55 2012 -0400
Allow to run the plugin validator standalone. If done so, also print warnings and errors to stdout/stderr.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java
index da50213..73da44f 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java
@@ -54,15 +54,19 @@ import org.rhq.core.pluginapi.plugin.PluginLifecycleListener;
public class PluginValidator {
private static final Log LOG = LogFactory.getLog(PluginValidator.class);
private static final String PLUGIN_DESCRIPTOR_PATH = "META-INF/rhq-plugin.xml";
+ static boolean interactive = false;
/**
* If no args are passed in, the current thread's classloader will be used to find the plugins to validate.
* If one or more argument strings are provided, they will be assumed to be paths to the plugin jars to validate
* (in which case the thread's classloader will be ignored and not searched for plugins).
*
+ * If one argument is '-i'. Warnings and Errors will also be printed to stdout and stderr, which helps developers
+ * to find issues when they run the Plugin validator as a standalone tool.
+ *
* The last line this will output will be "!OK!" and exit with an exit code of 0 if everything is OK.
* The last line this will output will be "!FAILURE!" and exit with an exit code of 1 if one or more plugins failed validation.
- *
+ *
* @param args 0 or more plugin jar file paths
*/
public static void main(String[] args) {
@@ -72,6 +76,11 @@ public class PluginValidator {
if (args.length > 0) {
finder = new SimplePluginFinder();
for (String arg : args) {
+ if (arg.equals("-i")) {
+ interactive = true;
+ continue;
+ }
+
URL jarUrl = new File(arg).toURI().toURL();
finder.addUrl(jarUrl);
LOG.info("Plugin jar: " + jarUrl);
@@ -109,7 +118,7 @@ public class PluginValidator {
boolean sizesMatch = (manager.getPlugins().size() == finder.findPlugins().size());
if (!sizesMatch) {
success = false;
- LOG.error("Only [" + manager.getPlugins().size() + "] out of [" + finder.findPlugins().size()
+ errorLog("Only [" + manager.getPlugins().size() + "] out of [" + finder.findPlugins().size()
+ "] plugin descriptors are valid.");
} else {
LOG.info("All [" + finder.findPlugins().size() + "] plugin descriptors are valid.");
@@ -147,47 +156,47 @@ public class PluginValidator {
String componentClass = metadataManager.getComponentClass(resourceType);
if (componentClass == null) {
success = false;
- LOG.error("Missing component class in resource type [" + resourceType.getName() + "] from plugin ["
+ errorLog("Missing component class in resource type [" + resourceType.getName() + "] from plugin ["
+ resourceType.getPlugin() + "]");
} else {
try {
Class componentClazz = Class.forName(componentClass, false, pluginEnvironment.getPluginClassLoader());
if (!ResourceComponent.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin() + "] does not implement "
+ ResourceComponent.class);
}
if (!resourceType.getMetricDefinitions().isEmpty()
&& !MeasurementFacet.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin()
+ "] does not support the measurement collection facet but defines metrics.");
}
if (!resourceType.getOperationDefinitions().isEmpty()
&& !OperationFacet.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin()
+ "] does not support the operations facet but defines operations.");
}
if (resourceType.getBundleType() != null && !BundleFacet.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin()
+ "] does not support the bundle facet but defines a bundle type.");
}
if (!resourceType.getPackageTypes().isEmpty() && !ContentFacet.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin()
+ "] does not support the content management facet but defines package types.");
}
if (resourceType.getResourceConfigurationDefinition() != null
&& !ConfigurationFacet.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin()
+ "] does not support the configuration facet but defines resource configuration.");
}
@@ -200,19 +209,19 @@ public class PluginValidator {
}
if (hasCreatableChild && !CreateChildResourceFacet.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin()
+ "] does not support the child creation facet but has metadata saying it can.");
}
if (resourceType.isDeletable() && !DeleteResourceFacet.class.isAssignableFrom(componentClazz)) {
success = false;
- LOG.error("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ errorLog("Component class [" + componentClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin()
+ "] does not support delete resource facet but has metadata saying it can delete children.");
}
} catch (Exception e) {
success = false;
- LOG.error("Cannot find component class [" + componentClass + "] for resource type ["
+ errorLog("Cannot find component class [" + componentClass + "] for resource type ["
+ resourceType.getName() + "] from plugin [" + resourceType.getPlugin() + "].");
}
}
@@ -228,18 +237,18 @@ public class PluginValidator {
Class discoveryClazz = Class.forName(discoveryClass, false, pluginEnvironment.getPluginClassLoader());
if (!ResourceDiscoveryComponent.class.isAssignableFrom(discoveryClazz)) {
success = false;
- LOG.error("Discovery class [" + discoveryClass + "] for resource type [" + resourceType.getName()
+ errorLog("Discovery class [" + discoveryClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin() + "] does not implement "
+ ResourceDiscoveryComponent.class);
}
if (resourceType.isSupportsManualAdd() && !ManualAddFacet.class.isAssignableFrom(discoveryClazz)) {
- LOG.warn("Discovery class [" + discoveryClass + "] for resource type [" + resourceType.getName()
+ warnLog("Discovery class [" + discoveryClass + "] for resource type [" + resourceType.getName()
+ "] from plugin [" + resourceType.getPlugin() + "] does not implement " + ManualAddFacet.class
+ " - implementing manual-add in discoverResources() is deprecated.");
}
} catch (Exception e) {
success = false;
- LOG.error("Cannot find discovery class [" + discoveryClass + "] for resource type ["
+ errorLog("Cannot find discovery class [" + discoveryClass + "] for resource type ["
+ resourceType.getName() + "] from plugin [" + resourceType.getPlugin() + "].");
}
}
@@ -255,12 +264,12 @@ public class PluginValidator {
Class overseerClazz = Class.forName(overseerClass, false, pluginEnvironment.getPluginClassLoader());
if (!PluginLifecycleListener.class.isAssignableFrom(overseerClazz)) {
success = false;
- LOG.error("Plugin Lifecycle Listener class [" + overseerClass + "] for plugin ["
+ errorLog("Plugin Lifecycle Listener class [" + overseerClass + "] for plugin ["
+ resourceType.getPlugin() + "] does not implement " + PluginLifecycleListener.class);
}
} catch (Exception e) {
success = false;
- LOG.error("Cannot find Plugin Lifecycle Listener class [" + overseerClass + "] for plugin ["
+ errorLog("Cannot find Plugin Lifecycle Listener class [" + overseerClass + "] for plugin ["
+ resourceType.getPlugin() + "].");
}
}
@@ -279,10 +288,22 @@ public class PluginValidator {
pluginFinder.addUrl(jarUrl);
LOG.info("Found plugin jar: " + jarUrl);
} else {
- LOG.warn("Found a plugin descriptor outside of a jar, skipping: " + descriptorUrl);
+ warnLog("Found a plugin descriptor outside of a jar, skipping: " + descriptorUrl);
}
}
return pluginFinder;
}
+
+ private static void errorLog(String errorMessage) {
+ LOG.error(errorMessage);
+ if (interactive)
+ System.err.println(errorMessage);
+ }
+
+ private static void warnLog(String warningMessage) {
+ LOG.warn(warningMessage);
+ if (interactive)
+ System.out.println(warningMessage);
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/agent/src/etc/plugin-validator.sh b/modules/enterprise/agent/src/etc/plugin-validator.sh
new file mode 100755
index 0000000..803ff6c
--- /dev/null
+++ b/modules/enterprise/agent/src/etc/plugin-validator.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+for i in lib/*.jar
+do
+ CP=$CP:$i
+done
+java -cp $CP org.rhq.core.pc.plugin.PluginValidator -i $*
commit 3fd82d43b6e74a1fe9c6a7a4e9c017f4882b725d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jul 25 09:39:09 2012 -0400
Put the standalone container start scripts directly in the agent distro, to make it easier to use them for developers.
diff --git a/etc/standalone-pc/README.txt b/etc/standalone-pc/README.txt
index b940187..c71fda7 100644
--- a/etc/standalone-pc/README.txt
+++ b/etc/standalone-pc/README.txt
@@ -8,6 +8,9 @@ alternatively copy an existing agent directory
Copy the standalone.(sh|bat) script to this agent directory in bin/ next to the
existing rhq-agent.(sh|bat) scripts
+AS OF RHQ 4.5 the scripts are already installed as standalone-pc.(sh|bat) in the
+bin/ directory of the agent.
+
If you have no plugins in the plugin/ directory, then copy at least the rhq-platform-*.jar
to plugins/ (e.g. from the rhq.ear/rhq-ownloads/rhq-plugins) directory of the server.
diff --git a/etc/standalone-pc/standalone.bat b/etc/standalone-pc/standalone.bat
deleted file mode 100644
index c8da8a3..0000000
--- a/etc/standalone-pc/standalone.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@echo off
-
-rem uncomment below if you want to enable JPDA debugging
-rem set RHQ_AGENT_ADDITIONAL_JAVA_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n
-
-setlocal
-set RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
-call rhq-agent.bat %*
-endlocal
diff --git a/etc/standalone-pc/standalone.sh b/etc/standalone-pc/standalone.sh
deleted file mode 100755
index d8ffef6..0000000
--- a/etc/standalone-pc/standalone.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-_DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"`
-RHQ_AGENT_BIN_DIR_PATH=`dirname "$_DOLLARZERO"`
-RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
-export RHQ_AGENT_MAINCLASS
-
-# uncomment below if you want to enable JPDA debugging
-#RHQ_AGENT_ADDITIONAL_JAVA_OPTS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n"
-#export RHQ_AGENT_ADDITIONAL_JAVA_OPTS
-
-$RHQ_AGENT_BIN_DIR_PATH/rhq-agent.sh $*
diff --git a/modules/enterprise/agent/src/etc/standalone-pc.bat b/modules/enterprise/agent/src/etc/standalone-pc.bat
new file mode 100644
index 0000000..c8da8a3
--- /dev/null
+++ b/modules/enterprise/agent/src/etc/standalone-pc.bat
@@ -0,0 +1,9 @@
+@echo off
+
+rem uncomment below if you want to enable JPDA debugging
+rem set RHQ_AGENT_ADDITIONAL_JAVA_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n
+
+setlocal
+set RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
+call rhq-agent.bat %*
+endlocal
diff --git a/modules/enterprise/agent/src/etc/standalone-pc.sh b/modules/enterprise/agent/src/etc/standalone-pc.sh
new file mode 100755
index 0000000..d8ffef6
--- /dev/null
+++ b/modules/enterprise/agent/src/etc/standalone-pc.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+_DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"`
+RHQ_AGENT_BIN_DIR_PATH=`dirname "$_DOLLARZERO"`
+RHQ_AGENT_MAINCLASS=org.rhq.core.pc.StandaloneContainer
+export RHQ_AGENT_MAINCLASS
+
+# uncomment below if you want to enable JPDA debugging
+#RHQ_AGENT_ADDITIONAL_JAVA_OPTS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n"
+#export RHQ_AGENT_ADDITIONAL_JAVA_OPTS
+
+$RHQ_AGENT_BIN_DIR_PATH/rhq-agent.sh $*
commit 7da515fa212ddf4903984c1b24092523fc4136a0
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jul 25 09:23:49 2012 -0400
Fix a small typo.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java
index c032481..5ee68f4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java
@@ -58,7 +58,7 @@ public interface AlertHandlerLocal {
@GZIP
@GET
@Path("/")
- @ApiOperation(value = "List all alerts", multiValueResponse = true, responseClass = "List<AlertRest")
+ @ApiOperation(value = "List all alerts", multiValueResponse = true, responseClass = "List<AlertRest>")
Response listAlerts(
@ApiParam(value = "Page number", defaultValue = "0") @QueryParam("page") int page,
@ApiParam(value = "Limit to priority", allowableValues = "High, Medium, Low, All") @DefaultValue("All") @QueryParam("prio") String prio,
11 years, 9 months
[rhq] modules/core modules/enterprise
by Simeon Pinder
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java | 163 +++++++---
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java | 2
modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java | 13
3 files changed, 133 insertions(+), 45 deletions(-)
New commits:
commit 0170a5ac909fd4120fd88f9d01fb039851289261
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sat Jul 21 15:46:03 2012 -0400
[BZ 840512] Fix for issue with Obfuscated properties affecting CSP credentials.
- Removed earlier workaround for failed deobfuscation
- Reimplement Obfuscation without symmetric Hibernate annotations
- Now PostLoad is only used to deobfuscate for in memory use of Obfuscated properties.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java
index 779b795..07b3467 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java
@@ -26,10 +26,6 @@ import java.io.ObjectOutputStream;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.PostLoad;
-import javax.persistence.PostPersist;
-import javax.persistence.PostUpdate;
-import javax.persistence.PrePersist;
-import javax.persistence.PreUpdate;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@@ -43,6 +39,9 @@ import org.rhq.core.util.obfuscation.Obfuscator;
* This is a specialization of {@link PropertySimple} that provides password obfuscation
* methods.
*
+ * In memory, the value is always kept in clear text. It is only at persisting or
+ * serialization time that the value is stored in its obfuscated form.
+ *
* @author Lukas Krejci
*/
@DiscriminatorValue("obfuscated")
@@ -51,10 +50,15 @@ import org.rhq.core.util.obfuscation.Obfuscator;
@XmlRootElement
public class ObfuscatedPropertySimple extends PropertySimple {
+ //note that while there were changes since RHQ 4.4.0.GA (or JON 3.1.0.GA) version of this class
+ //the serialization has NOT changed. The over-the-wire format of this class remained the same.
+ //Hence, serializationVersionUID is still at 1.
private static final long serialVersionUID = 1L;
private static final Log LOG = LogFactory.getLog(ObfuscatedPropertySimple.class);
+ private transient String clearTextValue;
+
public ObfuscatedPropertySimple() {
}
@@ -74,6 +78,16 @@ public class ObfuscatedPropertySimple extends PropertySimple {
*/
protected ObfuscatedPropertySimple(PropertySimple original, boolean keepId) {
super(original, keepId);
+ setValue(original.getStringValue());
+ }
+
+ /**
+ * @param original
+ * @param keepId
+ */
+ protected ObfuscatedPropertySimple(ObfuscatedPropertySimple original, boolean keepId) {
+ super(original, keepId);
+ this.clearTextValue = original.clearTextValue;
}
/**
@@ -81,7 +95,8 @@ public class ObfuscatedPropertySimple extends PropertySimple {
* @param value
*/
public ObfuscatedPropertySimple(String name, Object value) {
- super(name, value);
+ super(name, null);
+ setValue(value);
}
@Override
@@ -89,50 +104,132 @@ public class ObfuscatedPropertySimple extends PropertySimple {
return new ObfuscatedPropertySimple(this, keepId);
}
+ @PostLoad
+ protected void initClearTextValue() {
+ clearTextValue = deobfuscate(getObfuscatedStringValue());
+ }
+
/**
- * We deobfuscate right after the entity has been loaded from the database or right
- * after we persist or update the value.
- *
- * Because we change the value before persist or update, we have to swap the value back
- * as soon as those DB changes are done, so that we only use the raw value in memory.
+ * @return the value as being stored in the database
*/
- @PostLoad
- @PostPersist
- @PostUpdate
- protected void deobfuscate() {
- String value = getStringValue();
- if (value != null) {
- try {
- setStringValue(Obfuscator.decode(getStringValue()));
- } catch (Exception e) {
- LOG.error("Failed to deobfuscate property value: [" + value + "]", e);
- }
+ public String getObfuscatedStringValue() {
+ return super.getStringValue();
+ }
+
+ /**
+ * The value of this property as string. Note that this is always in "clear text". I.e. the value
+ * you get from this method is NOT obfuscated (but it gets stored in the database obfuscated).
+ */
+ @Override
+ public String getStringValue() {
+ return clearTextValue;
+ }
+
+ /**
+ * Sets the value of this property. You should pass the "clear text" value - the obfuscation of
+ * the value in the database is done for you behind the scenes.
+ */
+ @Override
+ public void setValue(Object value) {
+ //just use the logic in the superclass to set the value
+ super.setValue(value);
+ //and obtain the result
+ this.clearTextValue = super.getStringValue();
+
+ //now set the underlying value to the obfuscated one
+ super.setValue(obfuscate(clearTextValue));
+
+ //now we have the clear text string representation of the value in "clearTextValue",
+ //the stringValue in the superclass contains the corresponding obfuscated string.
+ }
+
+
+ @Override
+ public Boolean getBooleanValue() {
+ String val = getStringValue();
+ return val == null ? null : Boolean.valueOf(val);
+ }
+
+ @Override
+ public Long getLongValue() {
+ String val = getStringValue();
+ return val == null ? null : Long.valueOf(val);
+ }
+
+ @Override
+ public Integer getIntegerValue() {
+ String val = getStringValue();
+ return val == null ? null : Integer.valueOf(val);
+ }
+
+ @Override
+ public Float getFloatValue() {
+ String val = getStringValue();
+ return val == null ? null : Float.valueOf(val);
+ }
+
+ @Override
+ public Double getDoubleValue() {
+ String val = getStringValue();
+ return val == null ? null : Double.valueOf(val);
+ }
+
+ @Override
+ public boolean isMasked() {
+ return MASKED_VALUE.equals(getStringValue());
+ }
+
+ @Override
+ public void mask() {
+ if (getStringValue() != null) {
+ setValue(MASKED_VALUE);
+ }
+ }
+
+ protected String deobfuscate(String value) {
+ try {
+ return value == null ? null : Obfuscator.decode(value);
+ } catch (NumberFormatException nfe) {//detect unobfuscated properties from before patch
+ //Assuming that this was in incorrect state from BZ840512
+ //logging that we found an unobfuscated value and if it's not part of patch/upgrade contact administrator
+ LOG.error("Failed to deobfuscate property value: [" + value + "]. If this is not part of a patch/upgrade "
+ + "then you should contact System Administrator to have the property details reset.");
+ //Returning plain value to prevent Content Source load failure. On save should be correctly obfuscated
+ return value;
+ } catch (Exception e) {
+ LOG.error("Failed to deobfuscate property value: [" + value + "]", e);
+ throw new IllegalArgumentException("Failed to deobfuscate property value: [" + value + "]", e);
}
}
/**
* Obfuscate the value right before it gets pushed down to the database.
*/
- @PrePersist
- @PreUpdate
- protected void obfuscate() {
- String value = getStringValue();
- if (value != null) {
- try {
- setStringValue(Obfuscator.encode(value));
- } catch (Exception e) {
- LOG.error("Failed to obfuscate property value: [" + value + "]", e);
- }
+ protected String obfuscate(String value) {
+ try {
+ return value == null ? null : Obfuscator.encode(value);
+ } catch (Exception e) {
+ LOG.error("Failed to obfuscate property value: [" + value + "]", e);
+ throw new IllegalArgumentException("Failed to obfuscate property value: [" + value + "]", e);
}
}
+ /**
+ * Overriden to not leak the unobfuscated value in the toString() method, output of which
+ * might end up in logs, etc.
+ */
+ @Override
+ protected void appendToStringInternals(StringBuilder str) {
+ str.append(", obfuscated-value=").append(getObfuscatedStringValue());
+ str.append(", override=").append(getOverride());
+ };
+
private void writeObject(ObjectOutputStream str) throws IOException {
- obfuscate();
str.defaultWriteObject();
}
private void readObject(ObjectInputStream str) throws IOException, ClassNotFoundException {
str.defaultReadObject();
- deobfuscate();
+ initClearTextValue();
}
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
index 8edc331..dd7aebd 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java
@@ -55,7 +55,7 @@ public class PropertySimple extends Property implements Serializable {
* clients from being able to view the current value of PASSWORD properties. The value is made obscure enough to
* make the chances of it being the same as the property's unmasked value next to nil.
*/
- private static final String MASKED_VALUE = "_._._[MaSKeD]_._._";
+ public static final String MASKED_VALUE = "_._._[MaSKeD]_._._";
@Column(name = "string_value", length = MAX_VALUE_LENGTH)
private String stringValue;
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 4b3516a..4061980 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
@@ -21,6 +21,8 @@ package org.rhq.enterprise.server.plugins.jboss.software;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import churchillobjects.rss4j.RssDocument;
@@ -38,7 +40,6 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.util.obfuscation.Obfuscator;
import org.rhq.enterprise.server.plugin.pc.content.ContentProvider;
import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails;
import org.rhq.enterprise.server.plugin.pc.content.PackageSource;
@@ -221,16 +222,6 @@ public class JBossSoftwareContentSourceAdapter implements ContentProvider, Packa
int status = client.executeMethod(method);
- //BZ840512: check for issue deobfuscating the password:
- if (status == 401 || status == 403) {
- password = Obfuscator.decode(password);//in case de/unobfuscation failed.
- UsernamePasswordCredentials upc = new UsernamePasswordCredentials(username, password);
- client.getState().setCredentials("users", method.getHostConfiguration().getHost(), upc);
- log.warn("You have either input bad Content Source credentials or"
- + " there is a problem retrieving obfuscated passwords. Retrying...");
- status = client.executeMethod(method);
- }
-
//Check to see if redirection has occurred
String currentUrl = method.getURI().getURI();
//if redirection has occurred, reconnect with correct address.
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 3 commits - modules/plugins
by snegrea
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java | 16 +
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 100 +++++++---
2 files changed, 90 insertions(+), 26 deletions(-)
New commits:
commit 3e354dccd5859417ce58fb4b2f010e12bd1daad4
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:56:31 2012 -0500
[BZ 833187] Updates to support nullable lists. If a nullable list is empty then send back to the AS7 the null value instead of an empty list.
(cherry picked from commit 755964e1ac732505f8ef2261e9ed601205679f29)
Conflicts:
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
index d6d7329..366f840 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
@@ -520,6 +520,18 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet {
PropertyDefinition memberDef = propertyDefinition.getMemberDefinition();
List<Property> embeddedProps = property.getList();
+
+
+ String propertyName = property.getName();
+
+ if (propertyName.endsWith(":nullable")) {
+ propertyName = propertyName.substring(0, propertyName.indexOf(":nullable"));
+
+ if (embeddedProps.isEmpty()) {
+ return new SimpleEntry<String, List<Object>>(propertyName, null);
+ }
+ }
+
List<Object> values = new ArrayList<Object>();
for (Property inner : embeddedProps) {
if (memberDef instanceof PropertyDefinitionSimple) {
@@ -539,9 +551,9 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet {
}
}
- String name = stripNumberIdentifier(property.getName());
+ propertyName = stripNumberIdentifier(property.getName());
- return new SimpleEntry<String, List<Object>>(name, values);
+ return new SimpleEntry<String, List<Object>>(propertyName, values);
}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index d5b2fb0..fc1e9f7 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -3623,7 +3623,7 @@
<c:simple-property name="persist-delivery-count-before-delivery" required="false" type="boolean" readOnly="true" defaultValue="false" description="Whether the delivery count is persisted before delivery. False means that this only happens after a message has been cancelled. The default value is false."/>
<c:simple-property name="persist-id-cache" required="false" type="boolean" readOnly="true" defaultValue="true" description="Whether IDs are persisted to the journal. The default value is true."/>
<c:simple-property name="persistence-enabled" required="false" type="boolean" readOnly="true" defaultValue="true" description="Whether the server will use the file based journal for persistence. The default value is true."/>
- <c:list-property name="remoting-interceptors" required="false" readOnly="true" description="The list of interceptor classes used by this server." >
+ <c:list-property name="remoting-interceptors:nullable" required="false" readOnly="true" description="The list of interceptor classes used by this server." >
<c:simple-property name="remoting-interceptors" readOnly="true"/>
</c:list-property>
<c:simple-property name="run-sync-speed-test" required="false" type="boolean" readOnly="true" defaultValue="false" description="Whether on startup to perform a diagnostic test on how fast your disk can sync. Useful when determining performance issues. The default value is false."/>
@@ -4589,7 +4589,7 @@
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="true" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="true" defaultValue="500" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 500."/>
<c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="true" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
- <c:list-property name="static-connectors" required="false" readOnly="true" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
+ <c:list-property name="static-connectors:nullable" required="false" readOnly="true" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
<c:simple-property name="static-connectors" readOnly="true"/>
</c:list-property>
<c:simple-property name="use-duplicate-detection" required="false" type="boolean" readOnly="true" defaultValue="true" description="Whether the bridge will automatically insert a duplicate id property into each message that it forwards. The default value is true."/>
@@ -4712,7 +4712,7 @@
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="true" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="true" defaultValue="2000" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 2000."/>
<c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="true" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
- <c:list-property name="static-connectors" required="false" description="A list of names of statically defined connectors used by this bridge. Must be undefined (null) if 'discovery-group-name' is defined." >
+ <c:list-property name="static-connectors:nullable" required="false" description="A list of names of statically defined connectors used by this bridge. Must be undefined (null) if 'discovery-group-name' is defined." >
<c:simple-property name="static-connectors" />
</c:list-property>
<c:simple-property name="transformer-class-name" required="false" type="string" readOnly="true" description="The name of a user-defined class which implements the org.hornetq.core.server.cluster.Transformer interface."/>
@@ -6238,7 +6238,7 @@
<c:simple-property name="persist-delivery-count-before-delivery" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether the delivery count is persisted before delivery. False means that this only happens after a message has been cancelled. The default value is false."/>
<c:simple-property name="persist-id-cache" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether IDs are persisted to the journal. The default value is true."/>
<c:simple-property name="persistence-enabled" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the server will use the file based journal for persistence. The default value is true."/>
- <c:list-property name="remoting-interceptors" required="false" description="The list of interceptor classes used by this server." >
+ <c:list-property name="remoting-interceptors:nullable" required="false" description="The list of interceptor classes used by this server." >
<c:simple-property name="remoting-interceptors" />
</c:list-property>
<c:simple-property name="run-sync-speed-test" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether on startup to perform a diagnostic test on how fast your disk can sync. Useful when determining performance issues. The default value is false."/>
@@ -6674,7 +6674,7 @@
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="false" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="false" defaultValue="500" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 500."/>
<c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
- <c:list-property name="static-connectors" required="false" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
+ <c:list-property name="static-connectors:nullable" required="false" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
<c:simple-property name="static-connectors" />
</c:list-property>
<c:simple-property name="use-duplicate-detection" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the bridge will automatically insert a duplicate id property into each message that it forwards. The default value is true."/>
@@ -6763,7 +6763,7 @@
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="false" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="false" defaultValue="2000" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 2000."/>
<c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
- <c:list-property name="static-connectors" required="false" description="A list of names of statically defined connectors used by this bridge. Must be undefined (null) if 'discovery-group-name' is defined." >
+ <c:list-property name="static-connectors:nullable" required="false" description="A list of names of statically defined connectors used by this bridge. Must be undefined (null) if 'discovery-group-name' is defined." >
<c:simple-property name="static-connectors" />
</c:list-property>
<c:simple-property name="transformer-class-name" required="false" type="string" readOnly="false" description="The name of a user-defined class which implements the org.hornetq.core.server.cluster.Transformer interface."/>
@@ -9173,8 +9173,8 @@
<c:simple-property name="persist-delivery-count-before-delivery" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether the delivery count is persisted before delivery. False means that this only happens after a message has been cancelled. The default value is false."/>
<c:simple-property name="persist-id-cache" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether IDs are persisted to the journal. The default value is true."/>
<c:simple-property name="persistence-enabled" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the server will use the file based journal for persistence. The default value is true."/>
- <c:list-property name="remoting-interceptors" required="false" description="The list of interceptor classes used by this server." >
- <c:simple-property name="remoting-interceptors" />
+ <c:list-property name="remoting-interceptors:nullable" required="false" description="The list of interceptor classes used by this server.">
+ <c:simple-property name="remoting-interceptors"/>
</c:list-property>
<c:simple-property name="run-sync-speed-test" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether on startup to perform a diagnostic test on how fast your disk can sync. Useful when determining performance issues. The default value is false."/>
<c:simple-property name="scheduled-thread-pool-max-size:expr" displayName="Scheduled Thread Pool Max Size" required="false" type="string" readOnly="false" defaultValue="5" description="The number of threads that the main scheduled thread pool has. The default value is 5."/>
@@ -11746,8 +11746,8 @@
<c:simple-property name="persist-delivery-count-before-delivery" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether the delivery count is persisted before delivery. False means that this only happens after a message has been cancelled. The default value is false."/>
<c:simple-property name="persist-id-cache" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether IDs are persisted to the journal. The default value is true."/>
<c:simple-property name="persistence-enabled" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the server will use the file based journal for persistence. The default value is true."/>
- <c:list-property name="remoting-interceptors" required="false" description="The list of interceptor classes used by this server." >
- <c:simple-property name="remoting-interceptors" />
+ <c:list-property name="remoting-interceptors:nullable" required="false" description="The list of interceptor classes used by this server.">
+ <c:simple-property name="remoting-interceptors"/>
</c:list-property>
<c:simple-property name="run-sync-speed-test" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether on startup to perform a diagnostic test on how fast your disk can sync. Useful when determining performance issues. The default value is false."/>
<c:simple-property name="scheduled-thread-pool-max-size:expr" displayName="Scheduled Thread Pool Max Size" required="false" type="string" readOnly="false" defaultValue="5" description="The number of threads that the main scheduled thread pool has. The default value is 5."/>
@@ -12713,8 +12713,8 @@
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="false" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="false" defaultValue="500" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 500."/>
<c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
- <c:list-property name="static-connectors" required="false" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
- <c:simple-property name="static-connectors" />
+ <c:list-property name="static-connectors:nullable" required="false" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined.">
+ <c:simple-property name="static-connectors"/>
</c:list-property>
<c:simple-property name="use-duplicate-detection" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the bridge will automatically insert a duplicate id property into each message that it forwards. The default value is true."/>
</resource-configuration>
@@ -12836,8 +12836,8 @@
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="false" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="false" defaultValue="2000" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 2000."/>
<c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
- <c:list-property name="static-connectors" required="false" description="A list of names of statically defined connectors used by this bridge. Must be undefined (null) if 'discovery-group-name' is defined." >
- <c:simple-property name="static-connectors" />
+ <c:list-property name="static-connectors:nullable" required="false" description="A list of names of statically defined connectors used by this bridge. Must be undefined (null) if 'discovery-group-name' is defined.">
+ <c:simple-property name="static-connectors"/>
</c:list-property>
<c:simple-property name="transformer-class-name" required="false" type="string" readOnly="false" description="The name of a user-defined class which implements the org.hornetq.core.server.cluster.Transformer interface."/>
<c:simple-property name="use-duplicate-detection" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the bridge will automatically insert a duplicate id property into each message that it forwards. The default value is true."/>
commit dfe34c316ec0ca2b1fa159e57fb78102afe2c996
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:54:09 2012 -0500
[BZ 833089] Remove more unneeded properties from Local Cache resource.
(cherry picked from commit c7dd1545b7a5264274a9f97289ee62c8dec76eee)
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 3e5ec38..d5b2fb0 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1988,29 +1988,22 @@
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="start" required="false" type="string" readOnly="false" default="LAZY" description="The cache start mode, which can be EAGER (immediate start) or LAZY (on-demand start).">
+ <c:simple-property name="start" required="false" type="string" readOnly="true" default="LAZY" description="The cache start mode, which can be EAGER (immediate start) or LAZY (on-demand start).">
<c:property-options>
<c:option value="LAZY"/>
<c:option value="EAGER"/>
</c:property-options>
</c:simple-property>
- <c:simple-property name="batching" required="false" type="boolean" readOnly="false" default="false" description="If enabled, the invocation batching API will be made available for this cache."/>
- <c:simple-property name="indexing" required="false" type="string" readOnly="false" default="NONE" description="If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or are removed.">
+ <c:simple-property name="batching" required="false" type="boolean" readOnly="true" default="false" description="If enabled, the invocation batching API will be made available for this cache."/>
+ <c:simple-property name="indexing" required="false" type="string" readOnly="true" default="NONE" description="If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or are removed.">
<c:property-options>
<c:option value="NONE"/>
<c:option value="LOCAL"/>
<c:option value="ALL"/>
</c:property-options>
</c:simple-property>
- <c:simple-property name="jndi-name" required="false" type="string" readOnly="false" description="The jndi-name to which to bind this cache instance."/>
- <c:simple-property name="queue-size" required="false" type="integer" readOnly="false" default="0" description="In ASYNC mode, this attribute can be used to trigger flushing of the queue when it reaches a specific threshold."/>
- <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="false" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
- <c:simple-property name="remote-timeout" required="false" type="long" readOnly="false" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
- <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="false" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
- <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="false" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in 'distributed' caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
- <c:simple-property name="module" required="false" type="string" readOnly="false" description="The module whose class loader should be used when building this cache's configuration."/>
- <c:simple-property name="owners" required="false" type="integer" readOnly="false" defaultValue="2" description="Number of cluster-wide replicas for each cache entry. The default value is 2."/>
- <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="false" defaultValue="1" description="Controls the number of virtual nodes per 'real' node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
+ <c:simple-property name="jndi-name" required="false" type="string" readOnly="true" description="The jndi-name to which to bind this cache instance."/>
+ <c:simple-property name="module" required="false" type="string" readOnly="true" description="The module whose class loader should be used when building this cache's configuration."/>
</resource-configuration>
</service>
@@ -11234,14 +11227,7 @@
</c:property-options>
</c:simple-property>
<c:simple-property name="jndi-name" required="false" type="string" readOnly="false" description="The jndi-name to which to bind this cache instance."/>
- <c:simple-property name="queue-size" required="false" type="integer" readOnly="false" default="0" description="In ASYNC mode, this attribute can be used to trigger flushing of the queue when it reaches a specific threshold."/>
- <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="false" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
- <c:simple-property name="remote-timeout" required="false" type="long" readOnly="false" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
- <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="false" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
- <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="false" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in 'distributed' caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
<c:simple-property name="module" required="false" type="string" readOnly="false" description="The module whose class loader should be used when building this cache's configuration."/>
- <c:simple-property name="owners" required="false" type="integer" readOnly="false" defaultValue="2" description="Number of cluster-wide replicas for each cache entry. The default value is 2."/>
- <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="false" defaultValue="1" description="Controls the number of virtual nodes per 'real' node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
</resource-configuration>
</service>
commit cc94cce68c9f5aba9e8ccff0e8acdc29df8f0c55
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:53:28 2012 -0500
[BZ 833089] Created a separate Local Cache resource descriptor with properties only applicable to this resource type.
(cherry picked from commit b2f94df78ce141bed4167ed833547c37b8b89598)
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 4a72a63..3e5ec38 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1924,7 +1924,7 @@
class="TemplatedComponent">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="distributed-cache|local-cache|invalidation-cache|replicated-cache"/>
+ <c:simple-property name="path" readOnly="true" default="distributed-cache|invalidation-cache|replicated-cache"/>
</plugin-configuration>
<resource-configuration>
@@ -1960,15 +1960,11 @@
<c:simple-property name="__type" displayName="Type of cache" required="true" readOnly="true" default="local-cache" description="Type of cache">
<c:property-options>
- <c:option value="local-cache"/>
<c:option value="invalidation-cache"/>
<c:option value="distributed-cache"/>
<c:option value="replicated-cache"/>
</c:property-options>
</c:simple-property>
- <c:template name="Local Cache" description="Local Cache">
- <c:simple-property name="__type" readOnly="true" default="local-cache"/>
- </c:template>
<c:template name="Invalidation Cache" description="Invalidation Cache">
<c:simple-property name="__type" readOnly="true" default="invalidation-cache"/>
</c:template>
@@ -1981,6 +1977,43 @@
</resource-configuration>
</service>
+ <service name="Local Cache (Managed Server)"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ createDeletePolicy="both"
+ creationDataType="configuration">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="local-cache"/>
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="start" required="false" type="string" readOnly="false" default="LAZY" description="The cache start mode, which can be EAGER (immediate start) or LAZY (on-demand start).">
+ <c:property-options>
+ <c:option value="LAZY"/>
+ <c:option value="EAGER"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="batching" required="false" type="boolean" readOnly="false" default="false" description="If enabled, the invocation batching API will be made available for this cache."/>
+ <c:simple-property name="indexing" required="false" type="string" readOnly="false" default="NONE" description="If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or are removed.">
+ <c:property-options>
+ <c:option value="NONE"/>
+ <c:option value="LOCAL"/>
+ <c:option value="ALL"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="jndi-name" required="false" type="string" readOnly="false" description="The jndi-name to which to bind this cache instance."/>
+ <c:simple-property name="queue-size" required="false" type="integer" readOnly="false" default="0" description="In ASYNC mode, this attribute can be used to trigger flushing of the queue when it reaches a specific threshold."/>
+ <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="false" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
+ <c:simple-property name="remote-timeout" required="false" type="long" readOnly="false" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
+ <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="false" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
+ <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="false" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in 'distributed' caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
+ <c:simple-property name="module" required="false" type="string" readOnly="false" description="The module whose class loader should be used when building this cache's configuration."/>
+ <c:simple-property name="owners" required="false" type="integer" readOnly="false" defaultValue="2" description="Number of cluster-wide replicas for each cache entry. The default value is 2."/>
+ <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="false" defaultValue="1" description="Controls the number of virtual nodes per 'real' node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
+ </resource-configuration>
+ </service>
+
<service name="Transport (Managed Server)"
discovery="SubsystemDiscovery"
class="BaseComponent"
@@ -11122,7 +11155,7 @@
creationDataType="configuration">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="distributed-cache|local-cache|invalidation-cache|replicated-cache"/>
+ <c:simple-property name="path" readOnly="true" default="distributed-cache|invalidation-cache|replicated-cache"/>
</plugin-configuration>
<resource-configuration>
@@ -11158,15 +11191,11 @@
<c:simple-property name="__type" displayName="Type of cache" required="true" readOnly="true" default="local-cache" description="Type of cache">
<c:property-options>
- <c:option value="local-cache"/>
<c:option value="invalidation-cache"/>
<c:option value="distributed-cache"/>
<c:option value="replicated-cache"/>
</c:property-options>
</c:simple-property>
- <c:template name="Local Cache" description="Local Cache">
- <c:simple-property name="__type" readOnly="true" default="local-cache"/>
- </c:template>
<c:template name="Invalidation Cache" description="Invalidation Cache">
<c:simple-property name="__type" readOnly="true" default="invalidation-cache"/>
</c:template>
@@ -11179,6 +11208,43 @@
</resource-configuration>
</service>
+ <service name="Local Cache"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ createDeletePolicy="both"
+ creationDataType="configuration">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="local-cache"/>
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="start" required="false" type="string" readOnly="false" default="LAZY" description="The cache start mode, which can be EAGER (immediate start) or LAZY (on-demand start).">
+ <c:property-options>
+ <c:option value="LAZY"/>
+ <c:option value="EAGER"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="batching" required="false" type="boolean" readOnly="false" default="false" description="If enabled, the invocation batching API will be made available for this cache."/>
+ <c:simple-property name="indexing" required="false" type="string" readOnly="false" default="NONE" description="If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or are removed.">
+ <c:property-options>
+ <c:option value="NONE"/>
+ <c:option value="LOCAL"/>
+ <c:option value="ALL"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="jndi-name" required="false" type="string" readOnly="false" description="The jndi-name to which to bind this cache instance."/>
+ <c:simple-property name="queue-size" required="false" type="integer" readOnly="false" default="0" description="In ASYNC mode, this attribute can be used to trigger flushing of the queue when it reaches a specific threshold."/>
+ <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="false" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
+ <c:simple-property name="remote-timeout" required="false" type="long" readOnly="false" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
+ <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="false" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
+ <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="false" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in 'distributed' caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
+ <c:simple-property name="module" required="false" type="string" readOnly="false" description="The module whose class loader should be used when building this cache's configuration."/>
+ <c:simple-property name="owners" required="false" type="integer" readOnly="false" defaultValue="2" description="Number of cluster-wide replicas for each cache entry. The default value is 2."/>
+ <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="false" defaultValue="1" description="Controls the number of virtual nodes per 'real' node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
+ </resource-configuration>
+ </service>
+
<service name="Transport"
discovery="SubsystemDiscovery"
class="BaseComponent"
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/plugins
by snegrea
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 92 +++++++++-
1 file changed, 91 insertions(+), 1 deletion(-)
New commits:
commit 2ecd109038d93f9e7ea53177ee0f91f6ea8ada32
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:41:18 2012 -0500
[BZ 831757] Mark memory-pool-names list property as read-only.
(cherry picked from commit f2ad6f8e10a004d3eae44fd762e118a65bd3ea47)
Conflicts:
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 0ee756b..4a72a63 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -7000,7 +7000,7 @@
<metric property="valid" dataType="trait" description="Whether this this memory manager is valid in the Java virtual machine."/>
<resource-configuration>
- <c:list-property name="memory-pool-names" required="true" description="The name of memory pools that this garbage collector manages." >
+ <c:list-property name="memory-pool-names" required="true" readOnly="true" description="The name of memory pools that this garbage collector manages.">
<c:simple-property name="memory-pool-names" readOnly="true"/>
</c:list-property>
</resource-configuration>
commit b023517cdbf8f9e353c0b78a4d8bd5eba22495b6
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:39:56 2012 -0500
[BZ 812755] Added memory pool and garbage collector sub-resources to JVM information.
(cherry picked from commit 871d5d0a46030cba09d051a06cbc94d6ff08eeba)
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 733b484..0ee756b 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -6974,8 +6974,98 @@
</resource-configuration>
</service>
- </service>
+ <service name="Garbage Collector"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ description="Parent resource for the resources providing the management interface for the garbage collection of the Java virtual machine."
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="type=garbage-collector"/>
+ </plugin-configuration>
+
+ <service name="Garbage Collector Resource"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ description="The management interface for one of the garbage collectors in the Java virtual machine.">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="name"/>
+ <c:simple-property name="includeRuntime" readOnly="true" default="true"/>
+ </plugin-configuration>
+ <metric property="collection-count" description="The total number of collections that have occurred."/>
+ <metric property="collection-time" description="The approximate accumulated collection elapsed time in milliseconds."/>
+ <metric property="name" dataType="trait" description="The name representing this garbage collector"/>
+ <metric property="valid" dataType="trait" description="Whether this this memory manager is valid in the Java virtual machine."/>
+
+ <resource-configuration>
+ <c:list-property name="memory-pool-names" required="true" description="The name of memory pools that this garbage collector manages." >
+ <c:simple-property name="memory-pool-names" readOnly="true"/>
+ </c:list-property>
+ </resource-configuration>
+ </service>
+ </service>
+
+ <service name="Memory Pool"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ description="Parent resource for the resources providing the management interface for the Java virtual machine's memory pools."
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="type=memory-pool"/>
+ </plugin-configuration>
+
+ <service name="Memory Pool Resource"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ description="The management interface for a memory pool. A memory pool represents the memory resource managed by the Java virtual machine and is managed by one or more memory managers.">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="name"/>
+ <c:simple-property name="includeRuntime" readOnly="true" default="true"/>
+ </plugin-configuration>
+
+ <operation name="subsystem:reset-peak-usage" displayName="Reset Peak Usage" description="Resets the peak memory usage statistic of this memory pool to the current memory usage.">
+ <results>
+ <c:simple-property name="operationResult" description="Resets the peak memory usage statistic of this memory pool to the current memory usage." />
+ </results>
+ </operation>
+
+ <metric property="collection-usage:init" displayName="Collection Usage - Init" description="The amount of memory in bytes that the Java virtual machine initially requests from the operating system for memory management."/>
+ <metric property="collection-usage:used" displayName="Collection Usage - Used" description="The amount of used memory in bytes."/>
+ <metric property="collection-usage:committed" displayName="Collection Usage - Committed" description="The amount of memory in bytes that is committed for the Java virtual machine to use."/>
+ <metric property="collection-usage:max" displayName="Collection Usage - Max" description="The maximum amount of memory in bytes that can be used for memory management."/>
+ <metric property="collection-usage-threshold-count" description="The number of times that the Java virtual machine has detected that the memory usage has reached or exceeded the collection usage threshold. A memory pool may not support a collection usage threshold. If 'collection-usage-threshold-supported', is 'false' trying to read this attribute via the 'read-attribute' operation will result in failure, and the value of this attribute in the result of a 'read-resource' operation will be 'undefined'."/>
+ <metric property="collection-usage-threshold-exceeded" description="Whether the memory usage of this memory pool after the most recent collection on which the Java virtual machine has expended effort has reached or exceeded its collection usage threshold. A memory pool may not support a collection usage threshold. If 'collection-usage-threshold-supported', is 'false' trying to read this attribute via the 'read-attribute' operation will result in failure, and the value of this attribute in the result of a 'read-resource' operation will be 'undefined'."/>
+ <metric property="collection-usage-threshold-supported" dataType="trait" description="Whether this memory pool supports a collection usage threshold."/>
+ <metric property="name" dataType="trait" description="The name representing this memory pool."/>
+ <metric property="peak-usage:init" displayName="Peak Usage - Init" description="The amount of memory in bytes that the Java virtual machine initially requests from the operating system for memory management."/>
+ <metric property="peak-usage:used" displayName="Peak Usage - Used" description="The amount of used memory in bytes."/>
+ <metric property="peak-usage:committed" displayName="Peak Usage - Committed" description="The amount of memory in bytes that is committed for the Java virtual machine to use."/>
+ <metric property="peak-usage:max" displayName="Peak Usage - Max" description="The maximum amount of memory in bytes that can be used for memory management."/>
+ <metric property="type" dataType="trait" description="The type of this memory pool."/>
+ <metric property="usage:init" displayName="Usage - Init" description="The amount of memory in bytes that the Java virtual machine initially requests from the operating system for memory management."/>
+ <metric property="usage:used" displayName="Usage - Used" description="The amount of used memory in bytes."/>
+ <metric property="usage:committed" displayName="Usage - Committed" description="The amount of memory in bytes that is committed for the Java virtual machine to use."/>
+ <metric property="usage:max" displayName="Usage - Max" description="The maximum amount of memory in bytes that can be used for memory management."/>
+ <metric property="usage-threshold-count" description="The number of times that the memory usage has crossed the usage threshold. A memory pool may not support a usage threshold. If 'usage-threshold-supported', is 'false' trying to read this attribute via the 'read-attribute' operation will result in failure, and the value of this attribute in the result of a 'read-resource' operation will be 'undefined'."/>
+ <metric property="usage-threshold-exceeded" description="Whether the memory usage of this memory pool reaches or exceeds its usage threshold value. A memory pool may not support a usage threshold. If 'usage-threshold-supported', is 'false' trying to read this attribute via the 'read-attribute' operation will result in failure, and the value of this attribute in the result of a 'read-resource' operation will be 'undefined'."/>
+ <metric property="usage-threshold-supported" dataType="trait" description="Whether this memory pool supports usage threshold."/>
+ <metric property="valid" dataType="trait" description="Whether this memory pool is valid in the Java virtual machine. A memory pool becomes invalid once the Java virtual machine removes it from the memory system."/>
+
+ <resource-configuration>
+ <c:simple-property name="collection-usage-threshold" required="false" type="long" readOnly="false" description="The collection usage threshold value of this memory pool in bytes. A memory pool may not support a collection usage threshold. If 'collection-usage-threshold-supported', is 'false' trying to read this attribute via the 'read-attribute' operation will result in failure, and the value of this attribute in the result of a 'read-resource' operation will be 'undefined'."/>
+ <c:list-property name="memory-manager-names" required="true" readOnly="true" description="The names of the memory managers that manage this memory pool." >
+ <c:simple-property name="memory-manager-names" readOnly="true"/>
+ </c:list-property>
+ <c:simple-property name="usage-threshold" required="false" type="long" readOnly="false" description="The usage threshold value of this memory pool in bytes. A memory pool may not support a usage threshold. If 'usage-threshold-supported', is 'false' trying to read this attribute via the 'read-attribute' operation will result in failure, and the value of this attribute in the result of a 'read-resource' operation will be 'undefined'."/>
+ </resource-configuration>
+ </service>
+ </service>
+
+ </service>
<service name="JBossWeb"
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/plugins
by snegrea
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 2 +-
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 3ea3c75618f4b1944ffd07a853b1df41b391642d
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:16:07 2012 -0500
[BZ 831377] Updated the plugin descriptor to allow decimal numbers for retry-interval-multiplier of a HornetQ cluster connection because AS7 allows it.
(cherry picked from commit 2b7e819927ec18f13bd75c49246c1f837fa96aeb)
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index cf9a937..733b484 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -4562,7 +4562,7 @@
<c:simple-property name="min-large-message-size" required="false" type="integer" readOnly="true" defaultValue="102400" description="The minimum size (in bytes) for a message before it is considered as a large message. The default value is 102400."/>
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="true" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="true" defaultValue="500" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 500."/>
- <c:simple-property name="retry-interval-multiplier" required="false" type="long" readOnly="true" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
+ <c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="true" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
<c:list-property name="static-connectors" required="false" readOnly="true" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
<c:simple-property name="static-connectors" readOnly="true"/>
</c:list-property>
@@ -6647,7 +6647,7 @@
<c:simple-property name="min-large-message-size" required="false" type="integer" readOnly="false" defaultValue="102400" description="The minimum size (in bytes) for a message before it is considered as a large message. The default value is 102400."/>
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="false" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="false" defaultValue="500" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 500."/>
- <c:simple-property name="retry-interval-multiplier" required="false" type="long" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
+ <c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
<c:list-property name="static-connectors" required="false" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
<c:simple-property name="static-connectors" />
</c:list-property>
@@ -12570,7 +12570,7 @@
<c:simple-property name="min-large-message-size" required="false" type="integer" readOnly="false" defaultValue="102400" description="The minimum size (in bytes) for a message before it is considered as a large message. The default value is 102400."/>
<c:simple-property name="reconnect-attempts" required="false" type="integer" readOnly="false" defaultValue="-1" description="The total number of reconnect attempts the bridge will make before giving up and shutting down. A value of -1 signifies an unlimited number of attempts. The default value is -1."/>
<c:simple-property name="retry-interval" required="false" type="long" readOnly="false" defaultValue="500" description="The period in milliseconds between subsequent reconnection attempts, if the connection to the target server has failed. The default value is 500."/>
- <c:simple-property name="retry-interval-multiplier" required="false" type="long" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
+ <c:simple-property name="retry-interval-multiplier" required="false" type="double" readOnly="false" defaultValue="1.0" description="A multiplier to apply to the time since the last retry to compute the time to the next retry. This allows you to implement an exponential backoff between retry attempts. The default value is 1.0."/>
<c:list-property name="static-connectors" required="false" description="The statically defined list of connectors to which this cluster connection will make connections. Must be undefined (null) if 'discovery-group-name' is defined." >
<c:simple-property name="static-connectors" />
</c:list-property>
commit a851500532e8e3b2559ebaffe515e7b68ab57e88
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:11:00 2012 -0500
[BZ 831369] Use :whoami to retrieve server state because it does not require any parameters and is present on all resources. This will avoid warnings printed by using :read-attribute.
(cherry picked from commit 9f4bbacfa3212f412db718311ad7c2bd0343cc2f)
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index 638dd1c..633e0a8 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -277,7 +277,7 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
Configuration configuration = delegate.loadResourceConfiguration();
// Read server state
- ReadAttribute op = new ReadAttribute(getAddress(), "name");
+ Operation op = new Operation("whoami", getAddress());
Result res = getASConnection().execute(op);
if (res.isReloadRequired()) {
PropertySimple oobMessage = new PropertySimple("__OOB","The server needs a reload for the latest changes to come effective.");
11 years, 9 months