modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java | 71 +++++- modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java | 14 + modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java | 28 ++ modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java | 15 + modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 52 ++++ modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java | 116 +++++----- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java | 2 7 files changed, 228 insertions(+), 70 deletions(-)
New commits: commit 45a58220880d1a0b4749af319d8065936f734a57 Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 21 17:36:27 2012 -0500
can't just reload at the end, need to restart - our Mbeans don't go away on just a reload, so we must restart
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index 4b5e4b8..4ff3e4c 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -569,9 +569,9 @@ public class InstallerServiceImpl implements InstallerService { // create a keystore whose cert has a CN of this server's public endpoint address ServerInstallUtil.setupWebConnectors(mcc, appServerConfigDir, serverProperties);
- // now reload out of admin mode to pick up the changes + // now restart - don't just reload, some of our stuff won't restart properly if we just reload coreClient = new CoreJBossASClient(mcc); - coreClient.reload(false); + coreClient.restart(); } finally { safeClose(mcc); }
commit 3d9d1ece7431fe738e08655edbe46649be9559c5 Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 21 17:04:03 2012 -0500
add code to update SecureIdentity security domain credentials add code to remove web connector skip adding default mgmt user if it already exists add installer --reconfig feature to update AS7 settings based on new rhq-server.properties settings
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java index 0b4597c..e101de3 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java @@ -106,6 +106,53 @@ public class SecurityDomainJBossASClient extends JBossASClient { }
/** + * Given the name of an existing security domain that uses the SecureIdentity authentication method, + * this updates that domain with the new credentials. Use this to change credentials if you don't + * want to use expressions as the username or password entry (in some cases you can't, see the JIRA + * https://issues.jboss.org/browse/AS7-5177 for more info). + * + * @param securityDomainName the name of the security domain whose credentials are to change + * @param username the new username to be associated with the security domain + * @param password the new value of the password to store in the configuration (e.g. the obfuscated password itself) + * + * @throws Exception if failed to update security domain + */ + public void updateSecureIdentitySecurityDomainCredentials(String securityDomainName, String username, + String password) throws Exception { + + Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName, + AUTHENTICATION, CLASSIC); + + ModelNode loginModule = new ModelNode(); + loginModule.get(CODE).set("SecureIdentity"); + loginModule.get(FLAG).set("required"); + ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS); + moduleOptions.setEmptyList(); + // TODO: we really want to use addExpression (e.g. ${rhq.server.database.user-name}) + // for username and password so rhq-server.properties can be used to set these. + // However, AS7.1 doesn't support this yet - see https://issues.jboss.org/browse/AS7-5177 + moduleOptions.add(USERNAME, username); + moduleOptions.add(PASSWORD, password); + + // login modules attribute must be a list - we only have one item in it, the loginModule + ModelNode loginModuleList = new ModelNode(); + loginModuleList.setEmptyList(); + loginModuleList.add(loginModule); + + final ModelNode op = createRequest(WRITE_ATTRIBUTE, addr); + op.get(NAME).set(LOGIN_MODULES); + op.get(VALUE).set(loginModuleList); + + ModelNode results = execute(op); + if (!isSuccess(results)) { + throw new FailureException(results, "Failed to update credentials for security domain [" + + securityDomainName + "]"); + } + + return; + } + + /** * Create a new security domain using the database server authentication method. * This is used when you want to directly authenticate against a db entry. * diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java index f1d030d..b67c376 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java @@ -85,6 +85,20 @@ public class WebJBossASClient extends JBossASClient { }
/** + * Removes the given web connector. + * + * @param doomedConnectorName the name of the web connector to remove. + * @throws Exception + */ + public void removeConnector(String doomedConnectorName) throws Exception { + final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, doomedConnectorName); + if (isConnector(doomedConnectorName)) { + remove(address); + } + return; + } + + /** * Add a new web connector, which may be a secure SSL connector (HTTPS) or not (HTTP). * * @param name diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index 0c8876b..6d0c159 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -47,7 +47,7 @@ public class Installer { private InstallerConfiguration installerConfig;
private enum WhatToDo { - DISPLAY_USAGE, DO_NOTHING, TEST, SETUPDB, LIST_SERVERS, INSTALL + DISPLAY_USAGE, DO_NOTHING, RECONFIGURE, TEST, SETUPDB, LIST_SERVERS, INSTALL }
public static void main(String[] args) { @@ -109,6 +109,18 @@ public class Installer { } continue; } + case RECONFIGURE: { + try { + final InstallerService installerService = new InstallerServiceImpl(installerConfig); + final HashMap<String, String> serverProperties = installerService.getServerProperties(); + installerService.reconfigure(serverProperties); + LOG.info("Reconfiguration is complete."); + } catch (Exception e) { + LOG.error(ThrowableUtil.getAllMessages(e)); + System.exit(EXIT_CODE_INSTALLATION_ERROR); + } + continue; + } case INSTALL: { try { final InstallerService installerService = new InstallerServiceImpl(installerConfig); @@ -145,24 +157,27 @@ public class Installer { usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n"); usage.append("\t--listservers, -l: show list of known installed servers (install not performed)").append("\n"); usage.append("\t--setupdb, -b: only perform database schema creation or update").append("\n"); + usage.append("\t--reconfig, -r: resets some configuration settings in an installed server").append("\n"); usage.append("\t--dbpassword, -d: encodes a DB password for rhq-server.properties (install not performed)") .append("\n"); LOG.info(usage); }
private WhatToDo[] processArguments(String[] args) throws Exception { - String sopts = "-:HD:h:p:d:blt"; + String sopts = "-:HD:h:p:d:blrt"; LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'), new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'), new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'), new LongOpt("dbpassword", LongOpt.REQUIRED_ARGUMENT, null, 'd'), new LongOpt("setupdb", LongOpt.NO_ARGUMENT, null, 'b'), new LongOpt("listservers", LongOpt.NO_ARGUMENT, null, 'l'), + new LongOpt("reconfig", LongOpt.NO_ARGUMENT, null, 'r'), new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false; boolean listservers = false; boolean setupdb = false; + boolean reconfig = false; String dbpassword = null;
Getopt getopt = new Getopt("installer", args, sopts, lopts); @@ -243,6 +258,11 @@ public class Installer { break; // don't return, we need to allow more args to be processed, like -p or -h }
+ case 'r': { + reconfig = true; + break; // don't return, we need to allow more args to be processed, like -p or -h + } + case 't': { test = true; break; // don't return, we need to allow more args to be processed, like -p or -h @@ -257,6 +277,10 @@ public class Installer { return new WhatToDo[] { WhatToDo.DO_NOTHING }; }
+ if (reconfig) { + return new WhatToDo[] { WhatToDo.RECONFIGURE }; + } + if (test || setupdb || listservers) { ArrayList<WhatToDo> whatToDo = new ArrayList<WhatToDo>(); if (test) { diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java index 6eff4b7..9ee3c27 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java @@ -121,6 +121,21 @@ public interface InstallerService { String existingSchemaOption) throws Exception;
/** + * This will take server properties and reconfigure an already-installed server + * with those values if the settings were previously hardcoded to old values (as opposed to being + * set to expressions that allow them to be overridden with system property settings). + * Note that is function is here only to workaround various bugs in AS7 + * that force us to not be able to use expressions in certain app server subsystem attribute + * settings - see https://issues.jboss.org/browse/AS7-6120. Once this issues are fixed, this + * method will go away. + * + * @param serverProperties the new server properties + * @throws Exception + */ + @Deprecated + void reconfigure(HashMap<String, String> serverProperties) throws Exception; + + /** * Returns a list of all registered servers in the database. * * @param connectionUrl diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index bff75f0..4b5e4b8 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -249,7 +249,10 @@ public class InstallerServiceImpl implements InstallerService { ServerInstallUtil.configureDeploymentScanner(mcc);
// create a keystore whose cert has a CN of this server's public endpoint address - ServerInstallUtil.prepareWebConnectors(mcc, serverDetails, appServerConfigDir, serverProperties); + File keystoreFile = ServerInstallUtil.createKeystore(serverDetails, appServerConfigDir); + + // make sure all necessary web connectors are configured + ServerInstallUtil.setupWebConnectors(mcc, appServerConfigDir, serverProperties); } finally { safeClose(mcc); } @@ -529,6 +532,51 @@ public class InstallerServiceImpl implements InstallerService { return map; }
+ // This is here only to help users workaround https://issues.jboss.org/browse/AS7-6120. + // It will go away once all the issues with expression support in AS7 are fixed. + // Notice in this method we only reconfigure some things - only the subsystems/services + // that didn't support expressions in their attributes are reconfigured here since it + // is those whose values are hardcoded and we must alter to pick up changes to + // rhq-server.properties. All other services can pick up the property value changes + // make to rhq-server.properties on restart (since rhq-server.properties are system + // properties set in the AS7 instance via -P option to AS7). + @Override + public void reconfigure(HashMap<String, String> serverProperties) throws Exception { + + // make sure we can connect using our configuration + testModelControllerClient(serverProperties); + + String appServerConfigDir = getAppServerConfigDir(); + ModelControllerClient mcc = null; + + try { + // first, put the server in admin-only mode so we can start changing things around + mcc = getModelControllerClient(); + CoreJBossASClient coreClient = new CoreJBossASClient(mcc); + coreClient.reload(true); + + // not sure if we have to, but see if we need to wait for the reload to finish + testModelControllerClient(30); + + mcc = getModelControllerClient(); // get a new controller + + // create the security domain needed by the datasources + ServerInstallUtil.createDatasourceSecurityDomain(mcc, serverProperties); + + // setup the email service + ServerInstallUtil.setupMailService(mcc, serverProperties); + + // create a keystore whose cert has a CN of this server's public endpoint address + ServerInstallUtil.setupWebConnectors(mcc, appServerConfigDir, serverProperties); + + // now reload out of admin mode to pick up the changes + coreClient = new CoreJBossASClient(mcc); + coreClient.reload(false); + } finally { + safeClose(mcc); + } + } + /** * Makes sure the data is at least in the correct format (booleans are true/false, integers are valid numbers). * diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java index 85dedf9..baa81da 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java @@ -64,6 +64,7 @@ import org.rhq.core.db.DbUtil; import org.rhq.core.db.OracleDatabaseType; import org.rhq.core.db.PostgresqlDatabaseType; import org.rhq.core.db.setup.DBSetup; +import org.rhq.core.util.PropertiesFileUpdate; import org.rhq.core.util.exception.ThrowableUtil; import org.rhq.core.util.stream.StreamUtil; import org.rhq.enterprise.communications.util.SecurityUtil; @@ -142,6 +143,7 @@ public class ServerInstallUtil { private static final String JMS_DRIFT_FILE_QUEUE = "DriftFileQueue"; private static final String RHQ_CACHE_CONTAINER = "rhq"; private static final String RHQ_CACHE = "rhqCache"; + private static final String RHQ_MGMT_USER = "rhqadmin";
/** * Configure the deployment scanner to get ready to deploy the application. @@ -245,10 +247,12 @@ public class ServerInstallUtil { final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc); final String securityDomain = RHQ_DS_SECURITY_DOMAIN; if (!client.isSecurityDomain(securityDomain)) { - client.createNewSecureIdentitySecurityDomainRequest(securityDomain, dbUsername, obfuscatedPassword); + client.createNewSecureIdentitySecurityDomain(securityDomain, dbUsername, obfuscatedPassword); LOG.info("Security domain [" + securityDomain + "] created"); } else { LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request"); + client.updateSecureIdentitySecurityDomainCredentials(securityDomain, dbUsername, obfuscatedPassword); + LOG.info("Credentials have been updated for security domain [" + securityDomain + "]"); } }
@@ -318,6 +322,7 @@ public class ServerInstallUtil { LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request"); }
+ return; }
/** @@ -333,7 +338,8 @@ public class ServerInstallUtil { final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc); final String securityDomain = RHQ_REST_SECURITY_DOMAIN; if (!client.isSecurityDomain(securityDomain)) { - client.createNewDatabaseServerSecurityDomainRequest(securityDomain, "java:jboss/datasources/RHQDS", + String dsJndiName = "java:jboss/datasources/" + RHQ_DATASOURCE_NAME_XA; + client.createNewDatabaseServerSecurityDomain(securityDomain, dsJndiName, "SELECT PASSWORD FROM RHQ_PRINCIPAL WHERE principal=?", "SELECT 'all', 'Roles' FROM RHQ_PRINCIPAL WHERE principal=?", null, null); LOG.info("Security domain [" + securityDomain + "] created"); @@ -1170,16 +1176,12 @@ public class ServerInstallUtil { * Ensures our web connectors are configured properly. * * @param mcc the AS client - * @param serverDetails details of the server being installed * @param configDirStr location of a configuration directory where the keystore is to be stored * @param serverProperties the full set of server properties * @throws Exception */ - public static void prepareWebConnectors(ModelControllerClient mcc, ServerDetails serverDetails, String configDirStr, - HashMap<String, String> serverProperties) throws Exception { - - // first create our keystore - File keystoreFile = createKeystore(serverDetails, configDirStr); + public static void setupWebConnectors(ModelControllerClient mcc, String configDirStr, + HashMap<String, String> serverProperties) throws Exception {
// out of box, we always get a non-secure connector (called "http")... final String connectorName = "http"; @@ -1190,46 +1192,45 @@ public class ServerInstallUtil {
WebJBossASClient client = new WebJBossASClient(mcc);
- if (!client.isConnector(sslConnectorName)) { - LOG.info("Creating https connector..."); - - SSLConfiguration ssl = new SSLConfiguration(); - - // truststore - ssl.setCaCertificateFile(getAbsoluteFileLocation("rhq.server.tomcat.security.truststore.file", - serverProperties, configDirStr)); // this cannot be an expression - AS7 doesn't support that now - ssl.setCaCertificationPassword(buildExpression("rhq.server.tomcat.security.truststore.password", - serverProperties, false)); - ssl.setTruststoreType(buildExpression("rhq.server.tomcat.security.truststore.type", serverProperties, false)); - - // keystore - ssl.setCertificateKeyFile(getAbsoluteFileLocation("rhq.server.tomcat.security.keystore.file", - serverProperties, configDirStr)); // this cannot be an expression - AS7 doesn't support that now - ssl.setPassword(buildExpression("rhq.server.tomcat.security.keystore.password", serverProperties, false)); - ssl.setKeyAlias(buildExpression("rhq.server.tomcat.security.keystore.alias", serverProperties, false)); - ssl.setKeystoreType(buildExpression("rhq.server.tomcat.security.keystore.type", serverProperties, false)); - - // SSL protocol config - ssl.setProtocol(buildExpression("rhq.server.tomcat.security.secure-socket-protocol", serverProperties, - false)); - ssl.setVerifyClient(buildExpression("rhq.server.tomcat.security.client-auth-mode", serverProperties, - false)); - - // note: there doesn't appear to be a way for AS7 to support algorithm, like SunX509 or IbmX509 - // so I think it just uses the JVM's default. This means "rhq.server.tomcat.security.algorithm" is unused - - ConnectorConfiguration connector = new ConnectorConfiguration(); - connector.setMaxConnections(buildExpression("rhq.server.startup.web.max-connections", serverProperties, - false)); - connector.setScheme("https"); - connector.setSocketBinding("https"); - connector.setSslConfiguration(ssl); - - // create it now - client.addConnector("https", connector); - - LOG.info("https connector created."); - } + // because some of the connector attributes do not (yet) support expressions, let's remove any existing + // connector we may have created before and create it again with our current attribute values. + client.removeConnector(sslConnectorName); + + LOG.info("Creating https connector..."); + + SSLConfiguration ssl = new SSLConfiguration(); + + // truststore + ssl.setCaCertificateFile(getAbsoluteFileLocation("rhq.server.tomcat.security.truststore.file", + serverProperties, configDirStr)); // this cannot be an expression - AS7 doesn't support that now + ssl.setCaCertificationPassword(buildExpression("rhq.server.tomcat.security.truststore.password", + serverProperties, false)); + ssl.setTruststoreType(buildExpression("rhq.server.tomcat.security.truststore.type", serverProperties, false)); + + // keystore + ssl.setCertificateKeyFile(getAbsoluteFileLocation("rhq.server.tomcat.security.keystore.file", serverProperties, + configDirStr)); // this cannot be an expression - AS7 doesn't support that now + ssl.setPassword(buildExpression("rhq.server.tomcat.security.keystore.password", serverProperties, false)); + ssl.setKeyAlias(buildExpression("rhq.server.tomcat.security.keystore.alias", serverProperties, false)); + ssl.setKeystoreType(buildExpression("rhq.server.tomcat.security.keystore.type", serverProperties, false)); + + // SSL protocol config + ssl.setProtocol(buildExpression("rhq.server.tomcat.security.secure-socket-protocol", serverProperties, false)); + ssl.setVerifyClient(buildExpression("rhq.server.tomcat.security.client-auth-mode", serverProperties, false)); + + // note: there doesn't appear to be a way for AS7 to support algorithm, like SunX509 or IbmX509 + // so I think it just uses the JVM's default. This means "rhq.server.tomcat.security.algorithm" is unused + + ConnectorConfiguration connector = new ConnectorConfiguration(); + connector.setMaxConnections(buildExpression("rhq.server.startup.web.max-connections", serverProperties, false)); + connector.setScheme("https"); + connector.setSocketBinding("https"); + connector.setSslConfiguration(ssl); + + // create it now + client.addConnector("https", connector); + + LOG.info("https connector created.");
if (client.isConnector(connectorName)) { client.changeConnector(connectorName, "redirect-port", @@ -1310,7 +1311,7 @@ public class ServerInstallUtil { * @param configDirStr location of a configuration directory where the keystore is to be stored * @return where the keystore file should be created (if an error occurs, this file won't exist) */ - private static File createKeystore(ServerDetails serverDetails, String configDirStr) { + public static File createKeystore(ServerDetails serverDetails, String configDirStr) { File confDir = new File(configDirStr); File keystore = new File(confDir, "rhq.keystore"); File keystoreBackup = new File(confDir, "rhq.keystore.backup"); @@ -1361,20 +1362,31 @@ public class ServerInstallUtil {
// Add the default admin user, or if for some reason this file does not exist, just log the issue if (mgmtUsers.exists()) { + try { + PropertiesFileUpdate mgmtUsersPropFile = new PropertiesFileUpdate(mgmtUsers.getAbsolutePath()); + Properties existingUsers = mgmtUsersPropFile.loadExistingProperties(); + if (existingUsers.containsKey(RHQ_MGMT_USER)) { + LOG.info("There is already a mgmt user named [" + RHQ_MGMT_USER + "], will not create another"); + return; + } + } catch (Exception e) { + LOG.warn("Cannot determine if mgmt user exists in [" + mgmtUsers + "]; will try to create it anyway", e); + } + FileOutputStream fos = null;
try { fos = new FileOutputStream(mgmtUsers, true); - fos.write("\nrhqadmin=35c160c1f841a889d4cda53f0bfc94b6\n".getBytes()); + fos.write(("\n" + RHQ_MGMT_USER + "=35c160c1f841a889d4cda53f0bfc94b6\n").getBytes());
} catch (Exception e) { - LOG.warn("Could not create default management user in file: [" + mgmtUsers.getPath() + "] : ", e); + LOG.warn("Could not create default management user in file: [" + mgmtUsers + "] : ", e);
} finally { StreamUtil.safeClose(fos); } } else { - LOG.warn("Could not create default management user. Could not find file: [" + mgmtUsers.getPath() + "]"); + LOG.warn("Could not create default management user. Could not find file: [" + mgmtUsers + "]"); } }
commit 97919b228645970a82f44a4e3dd6951843911900 Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 21 16:57:33 2012 -0500
rename the methods by removing "Request" - these don't create the requests, they actually do the thing itself. JBossASClient and its subclasses have createXYZRequest static methods, but they only create the ModelNode requests, but they don't submit them for execution. That's the difference - if you see a method called "createXYZRequest", it returns a ModelNode for the caller to manipulate and later submit for execution. If the method does the execution itself, don't append "Request" to its name to avoid confusion.
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java index 48aede8..0b4597c 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java @@ -66,9 +66,8 @@ public class SecurityDomainJBossASClient extends JBossASClient { }
/** - * Convenience method that builds a request which can create a new security-domain - * using the SecureIdentity authentication method. This is used when you want - * to obfuscate a database password in the configuration. + * Create a new security domain using the SecureIdentity authentication method. + * This is used when you want to obfuscate a database password in the configuration. * * @param securityDomainName the name of the new security domain * @param username the username associated with the security domain @@ -76,7 +75,7 @@ public class SecurityDomainJBossASClient extends JBossASClient { * * @throws Exception if failed to create security domain */ - public void createNewSecureIdentitySecurityDomainRequest(String securityDomainName, String username, String password) + public void createNewSecureIdentitySecurityDomain(String securityDomainName, String username, String password) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName); @@ -107,9 +106,8 @@ public class SecurityDomainJBossASClient extends JBossASClient { }
/** - * Convenience method that builds a request which can create a new security domain - * using the database server authentication method. This is used when you want to directly - * authenticate against a db entry. + * Create a new security domain using the database server authentication method. + * This is used when you want to directly authenticate against a db entry. * * @param securityDomainName the name of the new security domain * @param dsJndiName the jndi name for the datasource to query against @@ -119,7 +117,7 @@ public class SecurityDomainJBossASClient extends JBossASClient { * @param hashEncoding if null defaults to "base64" * @throws Exception if failed to create security domain */ - public void createNewDatabaseServerSecurityDomainRequest(String securityDomainName, String dsJndiName, + public void createNewDatabaseServerSecurityDomain(String securityDomainName, String dsJndiName, String principalsQuery, String rolesQuery, String hashAlgorithm, String hashEncoding) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName); @@ -156,7 +154,7 @@ public class SecurityDomainJBossASClient extends JBossASClient { * @param securityDomainName the name of the new security domain * @throws Exception if failed to remove the security domain */ - public void removeSecurityDomainRequest(String securityDomainName) throws Exception { + public void removeSecurityDomain(String securityDomainName) throws Exception {
// If not there just return if (!isSecurityDomain(securityDomainName)) { @@ -175,19 +173,19 @@ public class SecurityDomainJBossASClient extends JBossASClient { }
/** - * Convenience method that builds a request to create a new security domain including one or - * more login modules. The security domain will be replaced if it exists. + * Creates a new security domain including one or more login modules. + * The security domain will be replaced if it exists. * * @param securityDomainName the name of the new security domain * @param loginModules an array of login modules to place in the security domain. They are ordered top-down in the * same index order of the array. * @throws Exception if failed to create security domain */ - public void createNewSecurityDomainRequest(String securityDomainName, LoginModuleRequest... loginModules) + public void createNewSecurityDomain(String securityDomainName, LoginModuleRequest... loginModules) throws Exception {
if (isSecurityDomain(securityDomainName)) { - removeSecurityDomainRequest(securityDomainName); + removeSecurityDomain(securityDomainName); }
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java index 582de5e..2d6c35d 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java @@ -167,7 +167,7 @@ public class CustomJaasDeploymentService implements CustomJaasDeploymentServiceM loginModules.add(ldapLoginModule); }
- client.createNewSecurityDomainRequest(RHQ_USER_SECURITY_DOMAIN, + client.createNewSecurityDomain(RHQ_USER_SECURITY_DOMAIN, loginModules.toArray(new LoginModuleRequest[loginModules.size()])); log.info("Security domain [" + RHQ_USER_SECURITY_DOMAIN + "] created with login modules " + loginModules);
commit e70c5793b4a4c6ed4ab1bf29a62ece1da80cd1b3 Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 21 14:07:35 2012 -0500
trivial change to comment (this line of code doesn't deploy the ear)
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index 7006601..bff75f0 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -254,7 +254,7 @@ public class InstallerServiceImpl implements InstallerService { safeClose(mcc); }
- // now create our deployment services and our main EAR + // now create our deployment services deployServices(serverProperties);
// deploy the main EAR app startup module extension
rhq-commits@lists.fedorahosted.org