* @throws Exception
*/
public static void createObfuscationVault(ModelControllerClient mcc, HashMap<String, String> serverProperties)
throws Exception {
final VaultJBossASClient client = new VaultJBossASClient(mcc);
if (!client.isVault()) {
ModelNode request = client.createNewVaultRequest(PropertyObfuscationVault.class.getName());
ModelNode results = client.execute(request);
if (!VaultJBossASClient.isSuccess(results)) {
String vaultClass = client.getVaultClass();
if (PropertyObfuscationVault.class.getName().equals(vaultClass)) {
LOG.info("RHQ Vault already configured, vault detected on the second read attempt");
} else {
throw new FailureException(results, "Failed to create the RHQ vault");
}
} else {
LOG.info("RHQ Vault created");
}
} else {
String vaultClass = client.getVaultClass();
if (PropertyObfuscationVault.class.getName().equals(vaultClass)) {
LOG.info("RHQ vault already configured, skipping the creation process");
} else {
throw new FailureException("Failed to create the RHQ vault; a different vault is already configured");
}