protected OperationTransformer createTransformer(final AttributeTransformationDescriptionBuilderRegistry resourceRegistry) { final AttributeTransformationDescriptionBuilderRegistry registry = resultingRegistry(resourceRegistry); final Map<String, AttributeTransformationDescription> descriptions = registry.buildAttributes(); if(WRITE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom write-attribute operation final TransformationRule first = new OperationTransformationRules.WriteAttributeRule(descriptions); return createTransformer(first); } else if(UNDEFINE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom undefine-attribute operation final TransformationRule first = new OperationTransformationRules.UndefineAttributeRule(descriptions); return createTransformer(first); } else { final AttributeTransformationRule first = new AttributeTransformationRule(descriptions); return createTransformer(first); } }
@Override void transformResource(final Resource resource, final PathAddress address, final ChainedResourceContext context) throws OperationFailedException { final ModelNode model = resource.getModel(); RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, null); doTransform(address, model, null, context, rejectedAttributes); if (rejectedAttributes.hasRejections()) { rejectedAttributes.errorOrWarnOnResourceTransformation(); } context.invokeNext(resource); }
protected OperationTransformer createTransformer(final AttributeTransformationDescriptionBuilderRegistry resourceRegistry) { final AttributeTransformationDescriptionBuilderRegistry registry = resultingRegistry(resourceRegistry); final Map<String, AttributeTransformationDescription> descriptions = registry.buildAttributes(); if(WRITE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom write-attribute operation final TransformationRule first = new OperationTransformationRules.WriteAttributeRule(descriptions); return createTransformer(first); } else if(UNDEFINE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom undefine-attribute operation final TransformationRule first = new OperationTransformationRules.UndefineAttributeRule(descriptions); return createTransformer(first); } else { final AttributeTransformationRule first = new AttributeTransformationRule(descriptions); return createTransformer(first); } }
@Override void transformResource(final Resource resource, final PathAddress address, final ChainedResourceContext context) throws OperationFailedException { final ModelNode model = resource.getModel(); RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, null); doTransform(address, model, null, context, rejectedAttributes); if (rejectedAttributes.hasRejections()) { rejectedAttributes.errorOrWarnOnResourceTransformation(); } context.invokeNext(resource); }
protected OperationTransformer createTransformer(final AttributeTransformationDescriptionBuilderRegistry resourceRegistry) { final AttributeTransformationDescriptionBuilderRegistry registry = resultingRegistry(resourceRegistry); final Map<String, AttributeTransformationDescription> descriptions = registry.buildAttributes(); if(WRITE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom write-attribute operation final TransformationRule first = new OperationTransformationRules.WriteAttributeRule(descriptions); return createTransformer(first); } else if(UNDEFINE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom undefine-attribute operation final TransformationRule first = new OperationTransformationRules.UndefineAttributeRule(descriptions); return createTransformer(first); } else { final AttributeTransformationRule first = new AttributeTransformationRule(descriptions); return createTransformer(first); } }
@Override void transformResource(final Resource resource, final PathAddress address, final ChainedResourceContext context) throws OperationFailedException { final ModelNode model = resource.getModel(); RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, null); doTransform(address, model, null, context, rejectedAttributes); if (rejectedAttributes.hasRejections()) { rejectedAttributes.errorOrWarnOnResourceTransformation(); } context.invokeNext(resource); }
final TransformationRule first = new AttributeTransformationRule(attributeTransformations); first.transformOperation(operation, address, context);
@Override void transformResource(final Resource resource, final PathAddress address, final ChainedResourceContext context) throws OperationFailedException { final ModelNode model = resource.getModel(); RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, null); doTransform(address, model, null, context, rejectedAttributes); if (rejectedAttributes.hasRejections()) { rejectedAttributes.errorOrWarnOnResourceTransformation(); } context.invokeNext(resource); }
protected OperationTransformer createTransformer(final AttributeTransformationDescriptionBuilderRegistry resourceRegistry) { final AttributeTransformationDescriptionBuilderRegistry registry = resultingRegistry(resourceRegistry); final Map<String, AttributeTransformationDescription> descriptions = registry.buildAttributes(); if(WRITE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom write-attribute operation final TransformationRule first = new OperationTransformationRules.WriteAttributeRule(descriptions); return createTransformer(first); } else if(UNDEFINE_ATTRIBUTE_OPERATION.equals(operationName)) { // Custom undefine-attribute operation final TransformationRule first = new OperationTransformationRules.UndefineAttributeRule(descriptions); return createTransformer(first); } else { final AttributeTransformationRule first = new AttributeTransformationRule(descriptions); return createTransformer(first); } }
@Override void transformOperation(final ModelNode operation, PathAddress address, ChainedOperationContext context) throws OperationFailedException { final ModelNode transformed = operation.clone(); final RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, operation); doTransform(address, transformed, operation, context, rejectedAttributes); final OperationRejectionPolicy policy; if (!rejectedAttributes.hasRejections()) { policy = OperationTransformer.DEFAULT_REJECTION_POLICY; } else { policy = new OperationRejectionPolicy() { @Override public boolean rejectOperation(ModelNode preparedResult) { return true; } @Override public String getFailureDescription() { return rejectedAttributes.getOperationRejectDescription(); } }; } context.invokeNext(new OperationTransformer.TransformedOperation(transformed, policy, OperationResultTransformer.ORIGINAL_RESULT)); }
final TransformationRule first = new AttributeTransformationRule(attributeTransformations); first.transformOperation(operation, address, context);
final RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, operation); doTransform(address, transformed, operation, context, rejectedAttributes);
final TransformationRule first = new AttributeTransformationRule(attributeTransformations); first.transformOperation(operation, address, context);
final RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, operation); doTransform(address, transformed, operation, context, rejectedAttributes);
final TransformationRule first = new AttributeTransformationRule(attributeTransformations); first.transformOperation(operation, address, context);
final RejectedAttributesLogContext rejectedAttributes = new RejectedAttributesLogContext(context, address, operation); doTransform(address, transformed, operation, context, rejectedAttributes);
@Override public void transformResource(final ResourceTransformationContext ctx, final PathAddress address, final Resource original) throws OperationFailedException { final ModelNode originalModel = TransformationRule.cloneAndProtect(original.getModel()); // See whether the model can be discarded switch (discardPolicy) { case DISCARD_AND_WARN: case REJECT_AND_WARN: ctx.getLogger().logRejectedResourceWarning(address, null); return; case SILENT: ResourceTransformer.DISCARD.transformResource(ctx, address, original); return; } final Iterator<TransformationRule> iterator = rules.iterator(); final TransformationRule.ChainedResourceContext context = new TransformationRule.ChainedResourceContext(ctx) { @Override void invokeNext(final Resource resource) throws OperationFailedException { if(iterator.hasNext()) { final TransformationRule next = iterator.next(); next.transformResource(resource, address, this); } else { resourceTransformer.transformResource(ctx, address, resource); } } }; // Kick off the chain final TransformationRule rule = new AttributeTransformationRule(attributeTransformations); rule.transformResource(original, address, context); }
@Override public void transformResource(final ResourceTransformationContext ctx, final PathAddress address, final Resource original) throws OperationFailedException { final ModelNode originalModel = TransformationRule.cloneAndProtect(original.getModel()); // See whether the model can be discarded switch (discardPolicy) { case DISCARD_AND_WARN: case REJECT_AND_WARN: ctx.getLogger().logRejectedResourceWarning(address, null); return; case SILENT: ResourceTransformer.DISCARD.transformResource(ctx, address, original); return; } final Iterator<TransformationRule> iterator = rules.iterator(); final TransformationRule.ChainedResourceContext context = new TransformationRule.ChainedResourceContext(ctx) { @Override void invokeNext(final Resource resource) throws OperationFailedException { if(iterator.hasNext()) { final TransformationRule next = iterator.next(); next.transformResource(resource, address, this); } else { resourceTransformer.transformResource(ctx, address, resource); } } }; // Kick off the chain final TransformationRule rule = new AttributeTransformationRule(attributeTransformations); rule.transformResource(original, address, context); }
@Override public void transformResource(final ResourceTransformationContext ctx, final PathAddress address, final Resource original) throws OperationFailedException { final DiscardPolicy discardPolicy = determineDiscardPolicy(ctx, address); switch (discardPolicy) { case REJECT_AND_WARN: ctx.getLogger().logRejectedResourceWarning(address, null); return; case DISCARD_AND_WARN: // don't return yet, just log a warning first and then discard ctx.getLogger().logDiscardedResourceWarning(address, ctx.getTarget().getHostName()); case SILENT: ResourceTransformer.DISCARD.transformResource(ctx, address, original); return; } final Iterator<TransformationRule> iterator = rules.iterator(); final TransformationRule.ChainedResourceContext context = new TransformationRule.ChainedResourceContext(ctx) { @Override void invokeNext(final Resource resource) throws OperationFailedException { if(iterator.hasNext()) { final TransformationRule next = iterator.next(); next.transformResource(resource, address, this); } else { resourceTransformer.transformResource(ctx, address, resource); } } }; // Kick off the chain final TransformationRule rule = new AttributeTransformationRule(attributeTransformations); rule.transformResource(original, address, context); }
@Override public void transformResource(final ResourceTransformationContext ctx, final PathAddress address, final Resource original) throws OperationFailedException { final DiscardPolicy discardPolicy = determineDiscardPolicy(ctx, address); switch (discardPolicy) { case REJECT_AND_WARN: ctx.getLogger().logRejectedResourceWarning(address, null); return; case DISCARD_AND_WARN: // don't return yet, just log a warning first and then discard ctx.getLogger().logDiscardedResourceWarning(address, ctx.getTarget().getHostName()); case SILENT: ResourceTransformer.DISCARD.transformResource(ctx, address, original); return; } final Iterator<TransformationRule> iterator = rules.iterator(); final TransformationRule.ChainedResourceContext context = new TransformationRule.ChainedResourceContext(ctx) { @Override void invokeNext(final Resource resource) throws OperationFailedException { if(iterator.hasNext()) { final TransformationRule next = iterator.next(); next.transformResource(resource, address, this); } else { resourceTransformer.transformResource(ctx, address, resource); } } }; // Kick off the chain final TransformationRule rule = new AttributeTransformationRule(attributeTransformations); rule.transformResource(original, address, context); }