use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class LegacyConfigAdjuster640 method removeBV.
/**
* WildFly 9 and later broke BV out from the ee subsystem, allowing it to be removed. If a later
* DC/standalone server sees ee with a legacy xsd, it adds BV into the config, thus assuring that
* a migrated config does not, perhaps not noticeably, lose existing behavior. But a 6.x slave
* will not recognize the BV extension/subsystem, so it needs to be removed.
*/
private void removeBV(DomainClient client, PathAddress profileAddress, List<ModelNode> ops) throws IOException, MgmtOperationException {
PathAddress bv = profileAddress.append(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "bean-validation"));
ops.add(Util.createRemoveOperation(bv));
// If no other profiles still use this extension, we can remove it
String ourProfile = profileAddress.getLastElement().getValue();
ModelNode read = Util.createEmptyOperation("read-children-names", PathAddress.EMPTY_ADDRESS);
read.get("child-type").set("profile");
for (ModelNode profileMN : DomainTestUtils.executeForResult(read, client).asList()) {
String profile = profileMN.asString();
if (!ourProfile.equals(profile)) {
read = Util.createEmptyOperation("read-children-names", PathAddress.pathAddress("profile", profile));
read.get("child-type").set("subsystem");
for (ModelNode sub : DomainTestUtils.executeForResult(read, client).asList()) {
if ("bean-validation".equals(sub.asString())) {
// this profile still has a subsystem; don't remove extension yet
return;
}
}
}
}
// If we got here, no profile has the bv subsystem so we can remove the extension
ops.add(Util.createRemoveOperation(PathAddress.pathAddress("extension", "org.wildfly.extension.bean-validation")));
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class DomainAdjuster700 method adjustUndertow.
private void adjustUndertow(PathAddress undertow, List<ModelNode> ops) {
// EAP 7.0 and earlier required explicit SSL configuration. Wildfly 10.1 added support
// for SSL by default, which automatically generates certs.
// This could be removed if all hosts were configured to contain a security domain with SSL
// enabled.
final PathAddress httpsListener = undertow.append("server", "default-server").append("https-listener", "https");
ops.add(Util.getEmptyOperation(ModelDescriptionConstants.REMOVE, httpsListener.toModelNode()));
//This enables jndi, ejb and tx over http and did not exist in EAP 7.0
PathAddress httpInvoker = undertow.append("server", "default-server").append("host", "default-host").append("setting", "http-invoker");
ops.add(Util.getEmptyOperation(ModelDescriptionConstants.REMOVE, httpInvoker.toModelNode()));
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class SimpleMixedDomainTest method profileCloneEap6x.
private void profileCloneEap6x() throws Exception {
//EAP 6 does not have the clone operation
//For an EAP 7 slave we will need another test since EAP 7 allows the clone operation.
// However EAP 7 will need to take into account the ignore-unused-configuration
// setting which does not exist in 6.x
final DomainClient masterClient = support.getDomainMasterLifecycleUtil().createDomainClient();
final DomainClient slaveClient = support.getDomainSlaveLifecycleUtil().createDomainClient();
try {
final PathAddress newProfileAddress = PathAddress.pathAddress(PROFILE, "new-profile");
//Create a new profile (so that we can ignore it on the host later)
DomainTestUtils.executeForResult(Util.createAddOperation(newProfileAddress), masterClient);
//Attempt to clone it. It should fail since the transformers reject it.
final ModelNode clone = Util.createEmptyOperation(CLONE, newProfileAddress);
clone.get(TO_PROFILE).set("cloned");
DomainTestUtils.executeForFailure(clone, masterClient);
//Ignore the new profile on the slave and reload
final PathAddress ignoredResourceAddress = PathAddress.pathAddress(HOST, "slave").append(CORE_SERVICE, IGNORED_RESOURCES).append(IGNORED_RESOURCE_TYPE, PROFILE);
final ModelNode ignoreNewProfile = Util.createAddOperation(ignoredResourceAddress);
ignoreNewProfile.get(NAMES).add("new-profile");
DomainTestUtils.executeForResult(ignoreNewProfile, slaveClient);
//Reload slave so ignore takes effect
reloadHost(support.getDomainSlaveLifecycleUtil(), "slave");
//Clone should work now that the new profile is ignored
DomainTestUtils.executeForResult(clone, masterClient);
//Adding a subsystem to the cloned profile should fail since the profile does not exist on the slave
DomainTestUtils.executeForFailure(Util.createAddOperation(PathAddress.pathAddress(PROFILE, "cloned").append(SUBSYSTEM, "jmx")), masterClient);
//Reload slave
reloadHost(support.getDomainSlaveLifecycleUtil(), "slave");
//Reloading should have brought over the cloned profile, so adding a subsystem should now work
DomainTestUtils.executeForResult(Util.createAddOperation(PathAddress.pathAddress(PROFILE, "cloned").append(SUBSYSTEM, "jmx")), masterClient);
} finally {
IoUtils.safeClose(slaveClient);
IoUtils.safeClose(masterClient);
}
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class SimpleMixedDomainTest method createProtocolPutPropertyOperation.
private static ModelNode createProtocolPutPropertyOperation(String stackName, String protocolName, String propertyName, String propertyValue) {
PathAddress address = PathAddress.pathAddress(PathElement.pathElement(PROFILE, ACTIVE_PROFILE)).append(JGroupsSubsystemResourceDefinition.PATH).append(StackResourceDefinition.pathElement(stackName)).append(ProtocolResourceDefinition.pathElement(protocolName));
ModelNode operation = Util.createOperation(MapOperations.MAP_PUT_DEFINITION, address);
operation.get(ModelDescriptionConstants.NAME).set("properties");
operation.get("key").set(propertyName);
operation.get(ModelDescriptionConstants.VALUE).set(propertyValue);
return operation;
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class ServerManager method addSecurityRealm.
private void addSecurityRealm(ModelNode steps, String keyStoreFile, String password) {
final PathAddress realmAddr = PathAddress.pathAddress().append(CORE_SERVICE, MANAGEMENT).append(SECURITY_REALM, "ssl-realm");
ModelNode op = Util.createAddOperation(realmAddr);
steps.add(op);
// /core-service=management/security-realm=JBossTest/server-identity=ssl:add(keystore-path=server.keystore, keystore-password=123456)
final ModelNode sslModuleNode = Util.createAddOperation(realmAddr.append(SERVER_IDENTITY, SSL));
sslModuleNode.get("keystore-path").set(keyStoreFile);
sslModuleNode.get(Constants.KEYSTORE_PASSWORD).set(password);
sslModuleNode.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true);
steps.add(sslModuleNode);
}
Aggregations