Package org.jboss.as.controller.transform

Examples of org.jboss.as.controller.transform.TransformersSubRegistration


* @author Brian Stansberry (c) 2012 Red Hat Inc.
*/
class SocketBindingGroupTransformers {

    static void registerTransformers120(TransformersSubRegistration parent) {
        TransformersSubRegistration reg = parent.registerSubResource(SocketBindingGroupResourceDefinition.PATH, ResourceTransformer.DEFAULT);
        SocketBindingTransformers.registerTransformers(reg);
    }
View Full Code Here


                    context.getLogger().logAttributeWarning(address, ControllerMessages.MESSAGES.attributesAreNotUnderstoodAndMustBeIgnored(), attributes);
                }
            }
        });

        TransformersSubRegistration jsfSubsystem = parent.registerSubResource(PathElement.pathElement(SUBSYSTEM, JSF_SUBSYSTEM));
        jsfSubsystem.registerOperationTransformer(ADD, new OperationTransformer() {

            @Override
            public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) throws OperationFailedException {
                if (operation.hasDefined(SLOT_ATTRIBUTE_NAME)) {
                    ModelNode slot = operation.get(SLOT_ATTRIBUTE_NAME);
                    if (!SLOT_DEFAULT_VALUE.equals(slot.asString())) {
                        return new TransformedOperation(operation,
                                new RejectionWithFailurePolicy(MESSAGES.invalidJSFSlotValue(slot.asString())),
                                OperationResultTransformer.ORIGINAL_RESULT);
                    }
                }
                Set<String> attributes = new HashSet<String>();
                for (Property prop : operation.asPropertyList()) {
                    attributes.add(prop.getName());
                }
                attributes.remove(SLOT_ATTRIBUTE_NAME);
                if (!attributes.isEmpty()) {
                    return new TransformedOperation(operation,
                            new RejectionWithFailurePolicy(MESSAGES.unknownAttributesFromSubsystemVersion(ADD,
                                    JSF_SUBSYSTEM,
                                    context.getTarget().getSubsystemVersion(JSF_SUBSYSTEM),
                                    attributes)),
                            OperationResultTransformer.ORIGINAL_RESULT);
                }
                return DISCARD.transformOperation(context, address, operation);
            }
        });

        jsfSubsystem.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, new OperationTransformer() {
            @Override
            public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) throws OperationFailedException {
                final String name = operation.require(NAME).asString();
                final ModelNode value = operation.get(ModelDescriptionConstants.VALUE);
                if (SLOT_ATTRIBUTE_NAME.equals(name)) {
                    if (value.isDefined() && value.equals(SLOT_DEFAULT_VALUE)) {
                        return DISCARD.transformOperation(context, address, operation);
                    } else {
                        return new TransformedOperation(operation,
                                new RejectionWithFailurePolicy(MESSAGES.invalidJSFSlotValue(value.asString())),
                                OperationResultTransformer.ORIGINAL_RESULT);
                    }
                }
                // reject the operation for any other attribute
                return new TransformedOperation(operation,
                        new RejectionWithFailurePolicy(MESSAGES.unknownAttributesFromSubsystemVersion(ADD,
                                JSF_SUBSYSTEM,
                                context.getTarget().getSubsystemVersion(JSF_SUBSYSTEM),
                                Arrays.asList(name))),
                        OperationResultTransformer.ORIGINAL_RESULT);
            }
        });
        jsfSubsystem.registerOperationTransformer(UNDEFINE_ATTRIBUTE_OPERATION, new OperationTransformer() {
            @Override
            public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) throws OperationFailedException {
                String attributeName = operation.require(NAME).asString();
                if (!SLOT_ATTRIBUTE_NAME.equals(attributeName)) {
                    return DEFAULT.transformOperation(context, address, operation);
View Full Code Here

                            attributeValue.set(attributeValue.asBoolean());
                        }
                    }
                }, ServerGroupResourceDefinition.MANAGEMENT_SUBSYSTEM_ENDPOINT)
                .end();
        TransformersSubRegistration serverGroup = TransformationDescription.Tools.register(builder.build(), parent);

        DeploymentTransformers.registerTransformers120(serverGroup);

        SystemPropertyTransformers.registerTransformers120(serverGroup);
        JvmTransformers.registerTransformers120(serverGroup);
View Full Code Here

        fieldCheckers.put(AbstractSocketBindingResourceDefinition.CLIENT_MAPPING_DESTINATION_PORT.getName(), AttributeTransformationRequirementChecker.SIMPLE_EXPRESSIONS);

        AttributeTransformationRequirementChecker elementChecker = new AttributeTransformationRequirementChecker.ObjectFieldsAttributeTransformationRequirementChecker(fieldCheckers);
        AttributeTransformationRequirementChecker attrChecker = new AttributeTransformationRequirementChecker.ListAttributeTransformationRequirementChecker(elementChecker);
        RejectExpressionValuesTransformer rejectExpression = new RejectExpressionValuesTransformer(SocketBindingResourceDefinition.CLIENT_MAPPINGS.getName(), attrChecker);
        TransformersSubRegistration reg = parent.registerSubResource(SocketBindingResourceDefinition.PATH, (ResourceTransformer) rejectExpression);

        reg.registerOperationTransformer(ADD, rejectExpression);
        reg.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectExpression.getWriteAttributeTransformer());

        return reg;
    }
View Full Code Here

* @author <a href="http://jmesnil.net">Jeff Mesnil</a> (c) 2012 Red Hat, inc
*/
class JvmTransformers {

    static void registerTransformers120(TransformersSubRegistration parent) {
        TransformersSubRegistration reg = parent.registerSubResource(JvmResourceDefinition.GLOBAL.getPathElement(), ResourceTransformer.DEFAULT);

        RejectExpressionValuesTransformer rejectExpression = new RejectExpressionValuesTransformer(AGENT_PATH, HEAP_SIZE, JAVA_HOME, MAX_HEAP_SIZE,
                PERMGEN_SIZE, MAX_PERMGEN_SIZE,
                STACK_SIZE, OPTIONS, ENVIRONMENT_VARIABLES, ENV_CLASSPATH_IGNORED, AGENT_LIB, JAVA_AGENT);

        reg.registerOperationTransformer(ADD, rejectExpression);
        reg.registerOperationTransformer(WRITE_ATTRIBUTE_OPERATION, rejectExpression.getWriteAttributeTransformer());
    }
View Full Code Here

        subsystem.registerXMLElementWriter(NamingSubsystem13Parser.INSTANCE);

        if (context.isRegisterTransformers()) {
            // register 1.1.0 transformer
            final TransformersSubRegistration transformersSubRegistration110 = subsystem.registerModelTransformers(VERSION_1_1_0, ResourceTransformer.DEFAULT);
            transformersSubRegistration110.registerSubResource(NamingSubsystemModel.BINDING_PATH,new Naming11Transformer());
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.transform.TransformersSubRegistration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.