Created
June 30, 2014 20:37
-
-
Save pferraro/8cb65102365ed7452cb0 to your computer and use it in GitHub Desktop.
CacheResourceDefinition.buildTransformation(...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (InfinispanModel.VERSION_3_0_0.requiresTransformation(version)) { | |
AttributeConverter batchingConverter = new AttributeConverter() { | |
@Override | |
public void convertOperationParameter(PathAddress address, String name, ModelNode value, ModelNode operation, TransformationContext context) { | |
} | |
@Override | |
public void convertResourceAttribute(PathAddress address, String name, ModelNode value, TransformationContext context) { | |
ModelNode cache = context.readResourceFromRoot(address).getModel(); | |
if (cache.hasDefined(TransactionResourceDefinition.PATH.getKey())) { | |
ModelNode transaction = cache.get(TransactionResourceDefinition.PATH.getKeyValuePair()); | |
if (transaction.isDefined() && transaction.hasDefined(TransactionResourceDefinition.MODE.getName())) { | |
TransactionMode mode = TransactionMode.valueOf(transaction.get(TransactionResourceDefinition.MODE.getName()).asString()); | |
if (mode == TransactionMode.BATCH) { | |
value.set(true); | |
} | |
} | |
} | |
} | |
}; | |
builder.getAttributeBuilder() | |
.setValueConverter(batchingConverter, BATCHING); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment