Last active
December 11, 2015 23:39
-
-
Save ctomc/4678429 to your computer and use it in GitHub Desktop.
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
static void registerTransformers(final TransformersSubRegistration registration, final TransformersSubRegistration loggingProfileReg, | |
final PathElement handlerPath, final AttributeDefinition[] additionalAttributes, final String... additionalOperations) { | |
final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createInstance(handlerPath) | |
.addRawOperationTransformationOverride(ADD, LoggingOperationTransformer.INSTANCE) | |
.addRawOperationTransformationOverride(WRITE_ATTRIBUTE_OPERATION, LoggingOperationTransformer.INSTANCE) | |
.addRawOperationTransformationOverride(UPDATE_OPERATION_NAME, LoggingOperationTransformer.INSTANCE) | |
.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, DEFAULT_ATTRIBUTES) | |
.addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, LEGACY_ATTRIBUTES) | |
.addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, additionalAttributes).end() | |
.setCustomResourceTransformer(new LoggingResourceTransformer(NAME, FILTER_SPEC, ENABLED)); | |
for (String operationName : additionalOperations) { | |
builder.addOperationTransformationOverride(operationName); | |
.setCustomOperationTransformer(LoggingOperationTransformer.INSTANCE) | |
.inheritResourceAttributeDefinitions().end(); | |
} | |
TransformationDescription.Tools.register(builder.build(), registration); | |
// Ignore logging profiles | |
loggingProfileReg.registerSubResource(handlerPath, true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment