use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class IIOPRootDefinition method registerTransformers_1_0_0.
private static void registerTransformers_1_0_0(SubsystemRegistration subsystemRegistration) {
final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();
TransformationDescription.Tools.register(builder.build(), subsystemRegistration, VERSION_1);
}
use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class CustomStoreResourceDefinition method buildTransformation.
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = InfinispanModel.VERSION_4_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, LEGACY_PATH) : parent.addChildResource(PATH);
if (InfinispanModel.VERSION_3_0_0.requiresTransformation(version)) {
builder.addOperationTransformationOverride(ModelDescriptionConstants.ADD).setCustomOperationTransformer(new SimpleOperationTransformer(new LegacyPropertyAddOperationTransformer())).inheritResourceAttributeDefinitions();
builder.setCustomResourceTransformer(new LegacyPropertyResourceTransformer());
}
StoreResourceDefinition.buildTransformation(version, builder);
}
use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class BackupsResourceDefinition method buildTransformation.
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
PathAddressTransformer addressTransformer = new PathAddressTransformer() {
@Override
public PathAddress transform(PathElement current, Builder builder) {
return builder.next();
}
};
ResourceTransformationDescriptionBuilder builder = InfinispanModel.VERSION_4_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, addressTransformer) : parent.addChildResource(PATH);
BackupResourceDefinition.buildTransformation(version, builder);
}
use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class BinaryKeyedJDBCStoreResourceDefinition method buildTransformation.
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = InfinispanModel.VERSION_4_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, LEGACY_PATH) : parent.addChildResource(PATH);
if (InfinispanModel.VERSION_4_0_0.requiresTransformation(version)) {
builder.setCustomResourceTransformer(new ResourceTransformer() {
@Override
public void transformResource(ResourceTransformationContext context, PathAddress address, Resource resource) throws OperationFailedException {
final ModelNode model = resource.getModel();
final ModelNode binaryTableModel = Resource.Tools.readModel(resource.removeChild(BinaryTableResourceDefinition.PATH));
if (binaryTableModel != null && binaryTableModel.isDefined()) {
model.get(DeprecatedAttribute.TABLE.getName()).set(binaryTableModel);
}
final ModelNode properties = model.remove(StoreResourceDefinition.Attribute.PROPERTIES.getName());
final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource);
LegacyPropertyResourceTransformer.transformPropertiesToChildrenResources(properties, address, childContext);
context.processChildren(resource);
}
});
}
BinaryTableResourceDefinition.buildTransformation(version, builder);
JDBCStoreResourceDefinition.buildTransformation(version, builder);
}
use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.
the class CacheContainerResourceDefinition method buildTransformation.
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = parent.addChildResource(WILDCARD_PATH);
if (InfinispanModel.VERSION_4_0_0.requiresTransformation(version)) {
builder.discardChildResource(NoTransportResourceDefinition.PATH);
EnumSet.allOf(ThreadPoolResourceDefinition.class).forEach(pool -> builder.addChildResource(pool.getPathElement(), pool.getDiscardPolicy()));
EnumSet.allOf(ScheduledThreadPoolResourceDefinition.class).forEach(pool -> builder.addChildResource(pool.getPathElement(), pool.getDiscardPolicy()));
} else {
NoTransportResourceDefinition.buildTransformation(version, builder);
EnumSet.allOf(ThreadPoolResourceDefinition.class).forEach(pool -> pool.buildTransformation(version, parent));
EnumSet.allOf(ScheduledThreadPoolResourceDefinition.class).forEach(pool -> pool.buildTransformation(version, parent));
}
if (InfinispanModel.VERSION_3_0_0.requiresTransformation(version)) {
OperationTransformer addAliasTransformer = new OperationTransformer() {
@Override
public ModelNode transformOperation(ModelNode operation) {
String attributeName = Operations.getAttributeName(operation);
if (Attribute.ALIASES.getName().equals(attributeName)) {
ModelNode value = Operations.getAttributeValue(operation);
PathAddress address = Operations.getPathAddress(operation);
ModelNode transformedOperation = Util.createOperation(ALIAS_ADD, address);
transformedOperation.get(ALIAS.getName()).set(value);
return transformedOperation;
}
return operation;
}
};
builder.addRawOperationTransformationOverride(ListOperations.LIST_ADD_DEFINITION.getName(), new SimpleOperationTransformer(addAliasTransformer));
OperationTransformer removeAliasTransformer = new OperationTransformer() {
@Override
public ModelNode transformOperation(ModelNode operation) {
String attributeName = Operations.getAttributeName(operation);
if (Attribute.ALIASES.getName().equals(attributeName)) {
ModelNode value = Operations.getAttributeValue(operation);
PathAddress address = Operations.getPathAddress(operation);
ModelNode transformedOperation = Util.createOperation(ALIAS_REMOVE, address);
transformedOperation.get(ALIAS.getName()).set(value);
return transformedOperation;
}
return operation;
}
};
builder.addRawOperationTransformationOverride(ListOperations.LIST_REMOVE_DEFINITION.getName(), new SimpleOperationTransformer(removeAliasTransformer));
}
if (InfinispanModel.VERSION_1_5_0.requiresTransformation(version)) {
builder.getAttributeBuilder().setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(false, false, new ModelNode(true)), Attribute.STATISTICS_ENABLED.getDefinition()).addRejectCheck(RejectAttributeChecker.UNDEFINED, Attribute.STATISTICS_ENABLED.getDefinition()).addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, Attribute.STATISTICS_ENABLED.getDefinition()).addRejectCheck(new RejectAttributeChecker.SimpleRejectAttributeChecker(new ModelNode(false)), Attribute.STATISTICS_ENABLED.getDefinition());
}
JGroupsTransportResourceDefinition.buildTransformation(version, builder);
DistributedCacheResourceDefinition.buildTransformation(version, builder);
ReplicatedCacheResourceDefinition.buildTransformation(version, builder);
InvalidationCacheResourceDefinition.buildTransformation(version, builder);
LocalCacheResourceDefinition.buildTransformation(version, builder);
}
Aggregations