use of org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder in project wildfly by wildfly.
the class IIOPExtension method registerTransformers.
protected static void registerTransformers(final SubsystemRegistration subsystem) {
ChainedTransformationDescriptionBuilder chained = ResourceTransformationDescriptionBuilder.Factory.createChainedSubystemInstance(CURRENT_MODEL_VERSION);
ResourceTransformationDescriptionBuilder builder = chained.createBuilder(CURRENT_MODEL_VERSION, VERSION_1);
builder.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, IIOPRootDefinition.SERVER_SSL_CONTEXT).addRejectCheck(RejectAttributeChecker.DEFINED, IIOPRootDefinition.CLIENT_SSL_CONTEXT).addRejectCheck(RejectAttributeChecker.DEFINED, IIOPRootDefinition.AUTHENTICATION_CONTEXT).addRejectCheck(new RejectAttributeChecker.DefaultRejectAttributeChecker() {
@Override
protected boolean rejectAttribute(PathAddress pathAddress, String s, ModelNode attributeValue, TransformationContext transformationContext) {
return attributeValue.asString().equals("true");
}
@Override
public String getRejectionLogMessage(Map<String, ModelNode> map) {
return IIOPLogger.ROOT_LOGGER.serverRequiresSslNotSupportedInPreviousVersions();
}
}, IIOPRootDefinition.SERVER_REQUIRES_SSL).addRejectCheck(new RejectAttributeChecker.DefaultRejectAttributeChecker() {
@Override
protected boolean rejectAttribute(PathAddress pathAddress, String s, ModelNode attributeValue, TransformationContext transformationContext) {
return attributeValue.asString().equalsIgnoreCase(Constants.ELYTRON);
}
@Override
public String getRejectionLogMessage(Map<String, ModelNode> map) {
return IIOPLogger.ROOT_LOGGER.elytronInitializerNotSupportedInPreviousVersions();
}
}, IIOPRootDefinition.SECURITY).setValueConverter(new AttributeConverter() {
@Override
public void convertOperationParameter(PathAddress pathAddress, String s, ModelNode attributeValue, ModelNode operation, TransformationContext transformationContext) {
convert(attributeValue);
}
@Override
public void convertResourceAttribute(PathAddress pathAddress, String s, ModelNode attributeValue, TransformationContext transformationContext) {
convert(attributeValue);
}
private void convert(ModelNode attributeValue) {
final boolean clientRequiresSsl = attributeValue.asBoolean();
if (clientRequiresSsl) {
attributeValue.set(SSLConfigValue.MUTUALAUTH.toString());
} else {
attributeValue.set(SSLConfigValue.NONE.toString());
}
}
}, IIOPRootDefinition.CLIENT_REQUIRES_SSL);
chained.buildAndRegister(subsystem, new ModelVersion[] { VERSION_1 });
}
use of org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder in project wildfly by wildfly.
the class TransactionExtension method registerTransformers.
// Transformation
/**
* Register the transformers for older model versions.
*
* @param subsystem the subsystems registration
*/
private void registerTransformers(SubsystemRegistration subsystem) {
ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(subsystem.getSubsystemVersion());
/*final ModelVersion v2_0_0 = ModelVersion.create(2, 0, 0);
ResourceTransformationDescriptionBuilder builder_2_0 = chainedBuilder.createBuilder(subsystem.getSubsystemVersion(), v2_0_0);
//Versions < 3.0.0 is not able to handle commit-markable-resource
builder_2_0.rejectChildResource(CMResourceResourceDefinition.PATH_CM_RESOURCE);
builder_2_0.getAttributeBuilder()
.addRename(TransactionSubsystemRootResourceDefinition.USE_JOURNAL_STORE, CommonAttributes.USE_HORNETQ_STORE)
.addRename(TransactionSubsystemRootResourceDefinition.JOURNAL_STORE_ENABLE_ASYNC_IO, CommonAttributes.HORNETQ_STORE_ENABLE_ASYNC_IO);*/
// 2.0.0 --> 1.5.0
ResourceTransformationDescriptionBuilder builderEap64 = chainedBuilder.createBuilder(subsystem.getSubsystemVersion(), MODEL_VERSION_EAP64);
builderEap64.getAttributeBuilder().addRename(TransactionSubsystemRootResourceDefinition.USE_JOURNAL_STORE, CommonAttributes.USE_HORNETQ_STORE).addRename(TransactionSubsystemRootResourceDefinition.JOURNAL_STORE_ENABLE_ASYNC_IO, CommonAttributes.HORNETQ_STORE_ENABLE_ASYNC_IO).addRename(TransactionSubsystemRootResourceDefinition.STATISTICS_ENABLED, CommonAttributes.ENABLE_STATISTICS);
// 1.5.0 --> 1.4.0
ResourceTransformationDescriptionBuilder builderEap63 = chainedBuilder.createBuilder(MODEL_VERSION_EAP64, MODEL_VERSION_EAP63);
builderEap63.rejectChildResource(CMResourceResourceDefinition.PATH_CM_RESOURCE);
//1.4.0 --> 1.3.0
ResourceTransformationDescriptionBuilder builderEap62 = chainedBuilder.createBuilder(MODEL_VERSION_EAP63, MODEL_VERSION_EAP62);
chainedBuilder.buildAndRegister(subsystem, new ModelVersion[] { MODEL_VERSION_EAP62, MODEL_VERSION_EAP63, MODEL_VERSION_EAP64 });
}
use of org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder 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.ChainedTransformationDescriptionBuilder in project wildfly by wildfly.
the class MicroProfileHealthTransformers method registerTransformers.
@Override
public void registerTransformers(SubsystemTransformerRegistration registration) {
ChainedTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(registration.getCurrentSubsystemVersion());
registerTransformers_WildFly_24(builder.createBuilder(MicroProfileHealthExtension.VERSION_3_0_0, MicroProfileHealthExtension.VERSION_2_0_0));
registerTransformers_WildFly_17(builder.createBuilder(MicroProfileHealthExtension.VERSION_2_0_0, MicroProfileHealthExtension.VERSION_1_0_0));
builder.buildAndRegister(registration, new ModelVersion[] { MicroProfileHealthExtension.VERSION_2_0_0, MicroProfileHealthExtension.VERSION_1_0_0 });
}
use of org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder in project wildfly by wildfly.
the class XTSSubsystemTransformers method registerTransformers.
@Override
public void registerTransformers(SubsystemTransformerRegistration subsystem) {
ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(XTSExtension.CURRENT_MODEL_VERSION);
// 3.0.0 --> 2.0.0
ResourceTransformationDescriptionBuilder builderEap72 = chainedBuilder.createBuilder(XTSExtension.CURRENT_MODEL_VERSION, MODEL_VERSION_EAP71);
builderEap72.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, XTSSubsystemDefinition.ASYNC_REGISTRATION).setDiscard(DiscardAttributeChecker.DEFAULT_VALUE, XTSSubsystemDefinition.ASYNC_REGISTRATION).end();
// 2.0.0 --> 1.0.0
ResourceTransformationDescriptionBuilder builderEap70 = chainedBuilder.createBuilder(MODEL_VERSION_EAP71, MODEL_VERSION_EAP64);
builderEap70.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, XTSSubsystemDefinition.HOST_NAME, XTSSubsystemDefinition.DEFAULT_CONTEXT_PROPAGATION).setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(ModelNode.FALSE), XTSSubsystemDefinition.DEFAULT_CONTEXT_PROPAGATION).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).end();
chainedBuilder.buildAndRegister(subsystem, new ModelVersion[] { MODEL_VERSION_EAP64, MODEL_VERSION_EAP71 // current is 3.0.0
});
}
Aggregations