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 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);
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class XTSExtension method registerTransformers1x.
private void registerTransformers1x(SubsystemRegistration subsystem) {
ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();
builder.getAttributeBuilder().setDiscard(new DiscardAttributeChecker.DefaultDiscardAttributeChecker() {
@Override
protected boolean isValueDiscardable(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) {
return attributeValue.isDefined() && attributeValue.equals(XTSSubsystemDefinition.HOST_NAME.getDefaultValue());
}
}, XTSSubsystemDefinition.HOST_NAME).setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(false)), XTSSubsystemDefinition.DEFAULT_CONTEXT_PROPAGATION).addRejectCheck(RejectAttributeChecker.DEFINED, XTSSubsystemDefinition.HOST_NAME, XTSSubsystemDefinition.DEFAULT_CONTEXT_PROPAGATION).end();
TransformationDescription.Tools.register(builder.build(), subsystem, ModelVersion.create(1, 1, 0));
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class WeldExtension method registerTransformers.
private void registerTransformers(SubsystemRegistration subsystem) {
ModelVersion version1_0_0 = ModelVersion.create(1, 0, 0);
ModelVersion version3_0_0 = ModelVersion.create(3, 0, 0);
ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(subsystem.getSubsystemVersion());
// Differences between the current version and 3.0.0
ResourceTransformationDescriptionBuilder builder300 = chainedBuilder.createBuilder(subsystem.getSubsystemVersion(), version3_0_0);
builder300.getAttributeBuilder().setDiscard(DiscardAttributeChecker.UNDEFINED, WeldResourceDefinition.THREAD_POOL_SIZE_ATTRIBUTE).addRejectCheck(RejectAttributeChecker.DEFINED, WeldResourceDefinition.THREAD_POOL_SIZE_ATTRIBUTE).end();
// Differences between 3.0.0 and 1.0.0
ResourceTransformationDescriptionBuilder builder100 = chainedBuilder.createBuilder(version3_0_0, version1_0_0);
builder100.getAttributeBuilder().setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(false, false, new ModelNode(true)), WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE, WeldResourceDefinition.REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE).addRejectCheck(new RejectAttributeChecker.DefaultRejectAttributeChecker() {
@Override
public String getRejectionLogMessage(Map<String, ModelNode> attributes) {
return WeldLogger.ROOT_LOGGER.rejectAttributesMustBeTrue(attributes.keySet());
}
@Override
protected boolean rejectAttribute(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) {
// This will not get called if it was discarded, so reject if it is undefined (default==false) or if defined and != 'true'
return !attributeValue.isDefined() || !attributeValue.asString().equals("true");
}
}, WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE, WeldResourceDefinition.REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE).setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(false)), WeldResourceDefinition.DEVELOPMENT_MODE_ATTRIBUTE).addRejectCheck(RejectAttributeChecker.DEFINED, WeldResourceDefinition.DEVELOPMENT_MODE_ATTRIBUTE).end();
chainedBuilder.buildAndRegister(subsystem, new ModelVersion[] { version1_0_0, version3_0_0 });
}
Aggregations