* @param subsystem the subsystems registration
*/
static void registerTransformers(final SubsystemRegistration subsystem) {
final ModelVersion version = ModelVersion.create(1, 3);
final ResourceTransformationDescriptionBuilder subsystemBuilder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();
final ResourceTransformationDescriptionBuilder cacheContainerBuilder = subsystemBuilder.addChildResource(CacheContainerResource.CONTAINER_PATH)
.getAttributeBuilder()
.addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, InfinispanRejectedExpressions_1_3.REJECT_CONTAINER_ATTRIBUTES)
.end();
cacheContainerBuilder.addChildResource(TransportResource.TRANSPORT_PATH)
.getAttributeBuilder()
.addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, InfinispanRejectedExpressions_1_3.REJECT_TRANSPORT_ATTRIBUTES)
.end();
final ResourceTransformationDescriptionBuilder distributedCacheBuilder = cacheContainerBuilder.addChildResource(DistributedCacheResource.DISTRIBUTED_CACHE_PATH)
.getAttributeBuilder()
.addRejectCheck(
RejectAttributeChecker.SIMPLE_EXPRESSIONS,
ClusteredCacheResource.ASYNC_MARSHALLING, ClusteredCacheResource.BATCHING, ClusteredCacheResource.INDEXING, ClusteredCacheResource.JNDI_NAME, ClusteredCacheResource.MODE,
ClusteredCacheResource.CACHE_MODULE, ClusteredCacheResource.QUEUE_FLUSH_INTERVAL, ClusteredCacheResource.QUEUE_SIZE,
ClusteredCacheResource.REMOTE_TIMEOUT, ClusteredCacheResource.START,
DistributedCacheResource.L1_LIFESPAN, DistributedCacheResource.OWNERS, DistributedCacheResource.VIRTUAL_NODES, DistributedCacheResource.SEGMENTS)
//discard indexing-properties if undefined, and reject it if not set
.setDiscard(DiscardAttributeChecker.UNDEFINED, CacheResource.INDEXING_PROPERTIES)
.addRejectCheck(RejectAttributeChecker.DEFINED, CacheResource.INDEXING_PROPERTIES)
//Convert segments to virtual-nodes if it is set
.setDiscard(DiscardAttributeChecker.UNDEFINED, DistributedCacheResource.SEGMENTS)
.setValueConverter(new AttributeConverter.DefaultAttributeConverter() {
@Override
protected void convertAttribute(PathAddress address, String attributeName, ModelNode attributeValue,
TransformationContext context) {
if (attributeValue.isDefined()) {
attributeValue.set(SegmentsAndVirtualNodeConverter.segmentsToVirtualNodes(attributeValue.asString()));
}
}
}, DistributedCacheResource.SEGMENTS)
.addRename(DistributedCacheResource.SEGMENTS, DistributedCacheResource.VIRTUAL_NODES.getName())
.end();
registerCacheResourceChildren(distributedCacheBuilder, true);
final ResourceTransformationDescriptionBuilder invalidationCacheBuilder = cacheContainerBuilder.addChildResource(InvalidationCacheResource.INVALIDATION_CACHE_PATH)
.getAttributeBuilder()
.addRejectCheck(
RejectAttributeChecker.SIMPLE_EXPRESSIONS,
ClusteredCacheResource.ASYNC_MARSHALLING, ClusteredCacheResource.BATCHING, ClusteredCacheResource.INDEXING, ClusteredCacheResource.JNDI_NAME, ClusteredCacheResource.MODE,
ClusteredCacheResource.CACHE_MODULE, ClusteredCacheResource.QUEUE_FLUSH_INTERVAL, ClusteredCacheResource.QUEUE_SIZE, ClusteredCacheResource.REMOTE_TIMEOUT,
ClusteredCacheResource.START)
//discard indexing-properties if undefined, and reject it if not set
.setDiscard(DiscardAttributeChecker.UNDEFINED, CacheResource.INDEXING_PROPERTIES)
.addRejectCheck(RejectAttributeChecker.DEFINED, CacheResource.INDEXING_PROPERTIES)
.end();
registerCacheResourceChildren(invalidationCacheBuilder, false);
final ResourceTransformationDescriptionBuilder localCacheBuilder = cacheContainerBuilder.addChildResource(LocalCacheResource.LOCAL_CACHE_PATH)
.getAttributeBuilder()
.addRejectCheck(
RejectAttributeChecker.SIMPLE_EXPRESSIONS,
ClusteredCacheResource.BATCHING, ClusteredCacheResource.INDEXING, ClusteredCacheResource.JNDI_NAME,
ClusteredCacheResource.CACHE_MODULE, ClusteredCacheResource.START)
//discard indexing-properties if undefined, and reject it if not set
.setDiscard(DiscardAttributeChecker.UNDEFINED, CacheResource.INDEXING_PROPERTIES)
.addRejectCheck(RejectAttributeChecker.DEFINED, CacheResource.INDEXING_PROPERTIES)
.end();
registerCacheResourceChildren(localCacheBuilder, false);
final ResourceTransformationDescriptionBuilder replicatedCacheBuilder = cacheContainerBuilder.addChildResource(ReplicatedCacheResource.REPLICATED_CACHE_PATH)
.getAttributeBuilder()
.addRejectCheck(
RejectAttributeChecker.SIMPLE_EXPRESSIONS,
ClusteredCacheResource.ASYNC_MARSHALLING, ClusteredCacheResource.BATCHING, ClusteredCacheResource.INDEXING, ClusteredCacheResource.JNDI_NAME, ClusteredCacheResource.MODE,
ClusteredCacheResource.CACHE_MODULE, ClusteredCacheResource.QUEUE_FLUSH_INTERVAL, ClusteredCacheResource.QUEUE_SIZE, ClusteredCacheResource.REMOTE_TIMEOUT,