in software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/jboss/JBoss7SshDriver.java [172:225]
public void customize() {
// Check that a password was set for the management user
Preconditions.checkState(Strings.isNonBlank(getManagementUsername()), "User for management realm required");
String managementPassword = getManagementPassword();
if (Strings.isBlank(managementPassword)) {
LOG.debug(this+" has no password specified for "+JBoss7Server.MANAGEMENT_PASSWORD.getName()+"; using a random string");
entity.config().set(JBoss7Server.MANAGEMENT_PASSWORD, Identifiers.makeRandomPassword(8));
}
String hashedPassword = hashPassword(getManagementUsername(), getManagementPassword(), MANAGEMENT_REALM);
// Check that ports are all configured
Map<String,Integer> ports = MutableMap.<String,Integer>builder()
.put("managementHttpPort", getManagementHttpPort())
.put("managementHttpsPort", getManagementHttpsPort())
.put("managementNativePort", getManagementNativePort())
.build();
if (isProtocolEnabled("HTTP")) {
ports.put("httpPort", getHttpPort());
}
if (isProtocolEnabled("HTTPS")) {
ports.put("httpsPort", getHttpsPort());
}
Networking.checkPortsValid(ports);
// Check hostname is defined
String hostname = entity.getAttribute(SoftwareProcess.HOSTNAME);
Preconditions.checkNotNull(hostname, "AS 7 entity must set hostname otherwise server will only be visible on localhost");
// Copy the install files to the run-dir and add the management user
newScript(CUSTOMIZING)
// don't set vars yet -- it resolves dependencies (e.g. DB) which we don't want until we start
.environmentVariablesReset()
.body.append(
format("cp -r %s/%s . || exit $!", getExpandedInstallDir(), SERVER_TYPE),
format("echo -e '\n%s=%s' >> %s/%s/configuration/mgmt-users.properties",
getManagementUsername(), hashedPassword, getRunDir(), SERVER_TYPE)
)
.execute();
// Copy the keystore across, if there is one
if (isProtocolEnabled("HTTPS")) {
String keystoreUrl = Preconditions.checkNotNull(getSslKeystoreUrl(), "keystore URL must be specified if using HTTPS for "+entity);
String destinationSslKeystoreFile = getSslKeystoreFile();
InputStream keystoreStream = resource.getResourceFromUrl(keystoreUrl);
getMachine().copyTo(keystoreStream, destinationSslKeystoreFile);
}
// Copy the configuration file across
String destinationConfigFile = Os.mergePathsUnix(getRunDir(), SERVER_TYPE, "configuration", CONFIG_FILE);
copyTemplate(getTemplateConfigurationUrl(), destinationConfigFile);
// Copy the initial wars to the deploys directory
getEntity().deployInitialWars();
}