@Override public void transformResource(ResourceTransformationContext context, PathAddress address, Resource resource) throws OperationFailedException { ModelNode model = resource.getModel(); if (model.hasDefined(SLOT_ATTRIBUTE_NAME)) { ModelNode slot = model.get(SLOT_ATTRIBUTE_NAME); if (!SLOT_DEFAULT_VALUE.equals(slot.asString())) { context.getLogger().logAttributeWarning(address, MESSAGES.invalidJSFSlotValue(slot.asString()), SLOT_ATTRIBUTE_NAME); } } Set<String> attributes = new HashSet<String>(); for (Property prop : resource.getModel().asPropertyList()) { attributes.add(prop.getName()); } attributes.remove(SLOT_ATTRIBUTE_NAME); if (!attributes.isEmpty()) { context.getLogger().logAttributeWarning(address, ControllerMessages.MESSAGES.attributesAreNotUnderstoodAndMustBeIgnored(), attributes); } } });
@Override public Resource transformResource(final ResourceTransformationContext context, Resource resource) throws OperationFailedException { final ResourceTransformer transformer = target.resolveTransformer(PathAddress.EMPTY_ADDRESS); if (transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } transformer.transformResource(context, PathAddress.EMPTY_ADDRESS, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@Override public Resource transformResource(final ResourceTransformationContext context, Resource resource) throws OperationFailedException { final ResourceTransformer transformer = target.resolveTransformer(context, PathAddress.EMPTY_ADDRESS); if (transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } transformer.transformResource(context, PathAddress.EMPTY_ADDRESS, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@Override public Resource transformResource(final ResourceTransformationContext context, Resource resource) throws OperationFailedException { final ResourceTransformer transformer = target.resolveTransformer(context, PathAddress.EMPTY_ADDRESS); if (transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } transformer.transformResource(context, PathAddress.EMPTY_ADDRESS, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@Override public Resource transformResource(final ResourceTransformationContext context, Resource resource) throws OperationFailedException { final ResourceTransformer transformer = target.resolveTransformer(context, PathAddress.EMPTY_ADDRESS); if (transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } transformer.transformResource(context, PathAddress.EMPTY_ADDRESS, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@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); }
@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); }
public Resource transformResource(final OperationContext operationContext, PathAddress original, Resource resource) throws OperationFailedException { final ResourceTransformer transformer = target.resolveTransformer(original); if(transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } // Transform the path address final PathAddress transformed = transformAddress(original, target); final ResourceTransformationContext context = ResourceTransformationContextImpl.create(operationContext, target, transformed, original); transformer.transformResource(context, transformed, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@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); }
public Resource transformResource(final OperationContext operationContext, PathAddress original, Resource resource, boolean skipRuntimeIgnoreCheck) throws OperationFailedException { // Transform the path address final PathAddress transformed = transformAddress(original, target); final ResourceTransformationContext context = ResourceTransformationContextImpl.create(operationContext, target, transformed, original, skipRuntimeIgnoreCheck); final ResourceTransformer transformer = target.resolveTransformer(context, original); if(transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } transformer.transformResource(context, transformed, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@Override public Resource transformRootResource(TransformationInputs transformationInputs, Resource resource, ResourceIgnoredTransformationRegistry ignoredTransformationRegistry) throws OperationFailedException { // Transform the path address final PathAddress original = PathAddress.EMPTY_ADDRESS; final PathAddress transformed = transformAddress(original, target); final ResourceTransformationContext context = ResourceTransformationContextImpl.create(transformationInputs, target, transformed, original, ignoredTransformationRegistry); final ResourceTransformer transformer = target.resolveTransformer(context, original); if(transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } transformer.transformResource(context, transformed, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@Override public Resource transformRootResource(TransformationInputs transformationInputs, Resource resource, ResourceIgnoredTransformationRegistry ignoredTransformationRegistry) throws OperationFailedException { // Transform the path address final PathAddress original = PathAddress.EMPTY_ADDRESS; final PathAddress transformed = transformAddress(original, target); final ResourceTransformationContext context = ResourceTransformationContextImpl.create(transformationInputs, target, transformed, original, ignoredTransformationRegistry); final ResourceTransformer transformer = target.resolveTransformer(context, original); if(transformer == null) { ControllerLogger.ROOT_LOGGER.tracef("resource %s does not need transformation", resource); return resource; } transformer.transformResource(context, transformed, resource); context.getLogger().flushLogQueue(); return context.getTransformedRoot(); }
@Override public void transformResource(final ResourceTransformationContext context, final PathAddress address, final Resource resource) throws OperationFailedException { // Check the model final ModelNode model = resource.getModel(); final Set<String> attributes = checkModel(model, context); if (attributes.size() > 0) { if (context.getTarget().isIgnoredResourceListAvailableAtRegistration()) { // Slave is 7.2.x or higher and we know this resource is not ignored List<String> msg = Collections.singletonList(context.getLogger().getAttributeWarning(address, null, ControllerLogger.ROOT_LOGGER.attributesDontSupportExpressions(), attributes)); final TransformationTarget tgt = context.getTarget(); final String legacyHostName = tgt.getHostName(); final ModelVersion coreVersion = tgt.getVersion(); final String subsystemName = findSubsystemName(address); final ModelVersion usedVersion = subsystemName == null ? coreVersion : tgt.getSubsystemVersion(subsystemName); // Target is 7.2.x or higher so we should throw an error if (subsystemName != null) { throw ControllerLogger.ROOT_LOGGER.rejectAttributesSubsystemModelResourceTransformer(address, legacyHostName, subsystemName, usedVersion, msg); } throw ControllerLogger.ROOT_LOGGER.rejectAttributesCoreModelResourceTransformer(address, legacyHostName, usedVersion, msg); } else { // 7.1.x slave; resource *may* be ignored so we can't fail; just log context.getLogger().logAttributeWarning(address, ControllerLogger.ROOT_LOGGER.attributesDontSupportExpressions(), attributes); } } final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource); childContext.processChildren(resource); }
@Override public void transformResource(final ResourceTransformationContext context, final PathAddress address, final Resource resource) throws OperationFailedException { // Check the model final ModelNode model = resource.getModel(); final Set<String> attributes = checkModel(model, context); if (attributes.size() > 0) { if (context.getTarget().isIgnoredResourceListAvailableAtRegistration()) { // Slave is 7.2.x or higher and we know this resource is not ignored List<String> msg = Collections.singletonList(context.getLogger().getAttributeWarning(address, null, ControllerLogger.ROOT_LOGGER.attributesDontSupportExpressions(), attributes)); final TransformationTarget tgt = context.getTarget(); final String legacyHostName = tgt.getHostName(); final ModelVersion coreVersion = tgt.getVersion(); final String subsystemName = findSubsystemName(address); final ModelVersion usedVersion = subsystemName == null ? coreVersion : tgt.getSubsystemVersion(subsystemName); // Target is 7.2.x or higher so we should throw an error if (subsystemName != null) { throw ControllerLogger.ROOT_LOGGER.rejectAttributesSubsystemModelResourceTransformer(address, legacyHostName, subsystemName, usedVersion, msg); } throw ControllerLogger.ROOT_LOGGER.rejectAttributesCoreModelResourceTransformer(address, legacyHostName, usedVersion, msg); } else { // 7.1.x slave; resource *may* be ignored so we can't fail; just log context.getLogger().logAttributeWarning(address, ControllerLogger.ROOT_LOGGER.attributesDontSupportExpressions(), attributes); } } final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource); childContext.processChildren(resource); }
@Override public void transformResource(final ResourceTransformationContext context, final PathAddress address, final Resource resource) throws OperationFailedException { // Check the model final ModelNode model = resource.getModel(); final Set<String> attributes = checkModel(model, context); if (attributes.size() > 0) { if (context.getTarget().isIgnoredResourceListAvailableAtRegistration()) { // Slave is 7.2.x or higher and we know this resource is not ignored List<String> msg = Collections.singletonList(context.getLogger().getAttributeWarning(address, null, MESSAGES.attributesDontSupportExpressions(), attributes)); final TransformationTarget tgt = context.getTarget(); final String legacyHostName = tgt.getHostName(); final ModelVersion coreVersion = tgt.getVersion(); final String subsystemName = findSubsystemName(address); final ModelVersion usedVersion = subsystemName == null ? coreVersion : tgt.getSubsystemVersion(subsystemName); // Target is 7.2.x or higher so we should throw an error if (subsystemName != null) { throw ControllerMessages.MESSAGES.rejectAttributesSubsystemModelResourceTransformer(address, legacyHostName, subsystemName, usedVersion, msg); } throw ControllerMessages.MESSAGES.rejectAttributesCoreModelResourceTransformer(address, legacyHostName, usedVersion, msg); } else { // 7.1.x slave; resource *may* be ignored so we can't fail; just log context.getLogger().logAttributeWarning(address, MESSAGES.attributesDontSupportExpressions(), attributes); } } final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource); childContext.processChildren(resource); }
@Override public void transformResource(final ResourceTransformationContext context, final PathAddress address, final Resource resource) throws OperationFailedException { // Check the model final ModelNode model = resource.getModel(); final Set<String> attributes = checkModel(model, context); if (attributes.size() > 0) { if (context.getTarget().isIgnoredResourceListAvailableAtRegistration()) { // Slave is 7.2.x or higher and we know this resource is not ignored List<String> msg = Collections.singletonList(context.getLogger().getAttributeWarning(address, null, MESSAGES.attributesDontSupportExpressions(), attributes)); final TransformationTarget tgt = context.getTarget(); final String legacyHostName = tgt.getHostName(); final ModelVersion coreVersion = tgt.getVersion(); final String subsystemName = findSubsystemName(address); final ModelVersion usedVersion = subsystemName == null ? coreVersion : tgt.getSubsystemVersion(subsystemName); // Target is 7.2.x or higher so we should throw an error if (subsystemName != null) { throw ControllerMessages.MESSAGES.rejectAttributesSubsystemModelResourceTransformer(address, legacyHostName, subsystemName, usedVersion, msg); } throw ControllerMessages.MESSAGES.rejectAttributesCoreModelResourceTransformer(address, legacyHostName, usedVersion, msg); } else { // 7.1.x slave; resource *may* be ignored so we can't fail; just log context.getLogger().logAttributeWarning(address, MESSAGES.attributesDontSupportExpressions(), attributes); } } final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource); childContext.processChildren(resource); }