use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class UndertowRootDefinition method registerTransformers_EAP_7_0_0.
private static void registerTransformers_EAP_7_0_0(SubsystemRegistration subsystemRegistration) {
final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();
// Version 4.0.0 adds the new SSL_CONTEXT attribute, however it is mutually exclusive to the SECURITY_REALM attribute, both of which can
// now be set to 'undefined' so instead of rejecting a defined SSL_CONTEXT, reject an undefined SECURITY_REALM as that covers the
// two new combinations.
builder.addChildResource(UndertowExtension.HTTPS_LISTENER_PATH).getAttributeBuilder().addRejectCheck(RejectAttributeChecker.UNDEFINED, Constants.SECURITY_REALM).setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(false)), HttpListenerResourceDefinition.REQUIRE_HOST_HTTP11.getName()).addRejectCheck(RejectAttributeChecker.DEFINED, HttpListenerResourceDefinition.REQUIRE_HOST_HTTP11.getName()).end();
builder.addChildResource(UndertowExtension.HTTP_LISTENER_PATH).getAttributeBuilder().setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(false)), HttpListenerResourceDefinition.REQUIRE_HOST_HTTP11.getName()).addRejectCheck(RejectAttributeChecker.DEFINED, HttpListenerResourceDefinition.REQUIRE_HOST_HTTP11.getName()).end();
builder.addChildResource(UndertowExtension.SERVER_PATH).addChildResource(UndertowExtension.HOST_PATH).rejectChildResource(UndertowExtension.PATH_HTTP_INVOKER);
builder.addChildResource(UndertowExtension.PATH_SERVLET_CONTAINER).getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, Constants.DISABLE_FILE_WATCH_SERVICE).end().addChildResource(UndertowExtension.PATH_WEBSOCKETS).getAttributeBuilder().setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(false)), Constants.PER_MESSAGE_DEFLATE).addRejectCheck(RejectAttributeChecker.DEFINED, Constants.PER_MESSAGE_DEFLATE, Constants.DEFLATER_LEVEL).end();
builder.addChildResource(UndertowExtension.PATH_FILTERS).addChildResource(PathElement.pathElement(Constants.MOD_CLUSTER)).getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, Constants.SSL_CONTEXT).setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(1)), Constants.MAX_RETRIES).addRejectCheck(RejectAttributeChecker.DEFINED, Constants.MAX_RETRIES).addRejectCheck(RejectAttributeChecker.UNDEFINED, Constants.ADVERTISE_SOCKET_BINDING).setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(FailoverStrategy.LOAD_BALANCED.name())), Constants.FAILOVER_STRATEGY).addRejectCheck(RejectAttributeChecker.DEFINED, Constants.FAILOVER_STRATEGY).end();
builder.addChildResource(UndertowExtension.PATH_HANDLERS).addChildResource(PathElement.pathElement(Constants.REVERSE_PROXY)).getAttributeBuilder().setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(1)), Constants.MAX_RETRIES).addRejectCheck(RejectAttributeChecker.DEFINED, Constants.MAX_RETRIES).end().addChildResource(PathElement.pathElement(Constants.HOST)).getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, Constants.SSL_CONTEXT).end();
builder.discardChildResource(PathElement.pathElement(Constants.APPLICATION_SECURITY_DOMAIN));
TransformationDescription.Tools.register(builder.build(), subsystemRegistration, UndertowExtension.MODEL_VERSION_EAP7_0_0);
}
use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class WSExtension method registerTransformers1_2_0.
private void registerTransformers1_2_0(SubsystemRegistration registration) {
ModelVersion version = ModelVersion.create(1, 2, 0);
ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();
builder.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, Attributes.STATISTICS_ENABLED);
builder.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, Attributes.WSDL_URI_SCHEME);
builder.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, Attributes.WSDL_PATH_REWRITE_RULE);
TransformationDescription.Tools.register(builder.build(), registration, version);
}
use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder 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.transform.description.ResourceTransformationDescriptionBuilder 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 });
}
use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class RemoteSiteResourceDefinition method buildTransformation.
@SuppressWarnings("deprecation")
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = parent.addChildResource(WILDCARD_PATH);
if (JGroupsModel.VERSION_3_0_0.requiresTransformation(version)) {
AttributeConverter converter = new AttributeConverter() {
@Override
public void convertOperationParameter(PathAddress address, String name, ModelNode value, ModelNode operation, TransformationContext context) {
// Nothing to convert
}
@Override
public void convertResourceAttribute(PathAddress address, String name, ModelNode value, TransformationContext context) {
ModelNode remoteSite = context.readResourceFromRoot(address).getModel();
String channelName = remoteSite.get(Attribute.CHANNEL.getName()).asString();
if (DeprecatedAttribute.STACK.getName().equals(name)) {
PathAddress subsystemAddress = address.subAddress(0, address.size() - 3);
PathAddress channelAddress = subsystemAddress.append(ChannelResourceDefinition.pathElement(channelName));
ModelNode channel = context.readResourceFromRoot(channelAddress).getModel();
if (channel.hasDefined(ChannelResourceDefinition.Attribute.STACK.getName())) {
value.set(channel.get(ChannelResourceDefinition.Attribute.STACK.getName()).asString());
} else {
ModelNode subsystem = context.readResourceFromRoot(subsystemAddress).getModel();
value.set(subsystem.get(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_STACK.getName()).asString());
}
} else if (DeprecatedAttribute.CLUSTER.getName().equals(name)) {
value.set(channelName);
} else {
throw new IllegalStateException();
}
}
};
builder.getAttributeBuilder().setValueConverter(converter, DeprecatedAttribute.STACK.getDefinition(), DeprecatedAttribute.CLUSTER.getDefinition()).setDiscard(DiscardAttributeChecker.ALWAYS, Attribute.CHANNEL.getDefinition()).end();
}
}
Aggregations