Package org.jboss.dmr

Examples of org.jboss.dmr.ModelType


            final ModelNode typeNode = describedProperties.get(paramName).get(TYPE);
            if (!typeNode.isDefined()) {
                throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionNoParamTypeInDescription(paramName, getPathAddress(operation), description));
                return;
            }
            final ModelType modelType;
            try {
                modelType = Enum.valueOf(ModelType.class, typeNode.asString());
            } catch (Exception e) {
                throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionInvalidParamTypeInDescription(paramName, getPathAddress(operation), description));
                return;
View Full Code Here


    }

    private void checkList(final ModelNode operation, final String paramName, final ModelType modelType, final ModelNode describedProperty, final ModelNode value) {
        if (describedProperty.get(TYPE).asType() == ModelType.LIST) {
            if (describedProperty.hasDefined(VALUE_TYPE) && describedProperty.get(VALUE_TYPE).getType() == ModelType.TYPE) {
                ModelType elementType = describedProperty.get(VALUE_TYPE).asType();
                for (ModelNode element : value.asList()) {
                    try {
                        checkType(elementType, element);
                    } catch (IllegalArgumentException e) {
                        throw MESSAGES.validationFailedInvalidElementType(paramName, elementType, formatOperationForMessage(operation));
View Full Code Here

    }

    @Override
    public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException {
        super.validateParameter(parameterName, value);
        ModelType type = value.getType();
        if (type == ModelType.STRING || type == ModelType.EXPRESSION) {
            String tuString = value.resolve().asString(); // Sorry, no support for resolving against vault!
            E enumValue;
            try {
                enumValue = Enum.valueOf(enumType, tuString.toUpperCase(Locale.ENGLISH));
View Full Code Here

        "storage" => "configuration",
        "restart-required" => "no-services"
    },
    */
    public static SimpleAttributeDefinitionBuilder create(final String name, final ModelNode node) {
        ModelType type = node.get(ModelDescriptionConstants.TYPE).asType();
        boolean nillable = node.get(ModelDescriptionConstants.NILLABLE).asBoolean(true);
        boolean expressionAllowed = node.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false);
        ModelNode defaultValue = node.get(ModelDescriptionConstants.DEFAULT);
        return SimpleAttributeDefinitionBuilder.create(name, type, nillable)
                .setDefaultValue(defaultValue)
View Full Code Here

        context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
    }

    @Override
    public ModelNode getModelDescription(Locale locale) {
        ModelType valueType = null;
        DescriptionProvider delegate = new DefaultOperationDescriptionProvider(OPERATION_NAME,
                DomainRootDescription.getResourceDescriptionResolver("domain"), ModelType.STRING, valueType, ResolveExpressionHandler.EXPRESSION);
        ModelNode result = delegate.getModelDescription(locale);
        result.get(ModelDescriptionConstants.REPLY_PROPERTIES, ModelDescriptionConstants.NILLABLE).set(true);
        return result;
View Full Code Here

    @Override
    public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
        super.registerAttributes(resourceRegistration);

        for(final String statisticName: statistics.getNames()) {
            final ModelType modelType = getModelType(statistics.getType(statisticName));
            final SimpleAttributeDefinitionBuilder simpleAttributeDefinitionBuilder =
                    new SimpleAttributeDefinitionBuilder(statisticName, modelType, true)
                            .setXmlName(statisticName)
                            .setAllowExpression(true)
                            .setFlags(AttributeAccess.Flag.STORAGE_RUNTIME);
View Full Code Here

    @Override
    public void registerOperations(ManagementResourceRegistration resourceRegistration) {
        super.registerOperations(resourceRegistration);

        for(final String statisticName: statistics.getNames()) {
            final ModelType modelType = getModelType(statistics.getType(statisticName));
            if(statistics.isOperation(statisticName)) {
                AttributeDefinition attributeDefinition =
                        new SimpleAttributeDefinitionBuilder(statisticName, modelType, true)
                                .setXmlName(statisticName)
                                .setAllowExpression(true)
View Full Code Here

                    logHandling("Skipping conflicted attribute " + attrName + " at " + address.toModelNode().asString());
                    continue;
                }
            }
            ModelNode attrValue = resource.get(attrName);
            ModelType attrType = attrValue.getType();
            if (attrDesc.get(EXPRESSIONS_ALLOWED).asBoolean(false)) {

                // If it's defined and not an expression, use the current value to create an expression
                if (attrType != ModelType.UNDEFINED && attrType != ModelType.EXPRESSION) {
                    // Deal with complex types specially
View Full Code Here

        } else {
            boolean hasExpression = false;
            ModelNode updated = new ModelNode();
            ModelNode expected = new ModelNode();
            for (ModelNode item : attrValue.asList()) {
                ModelType itemType = item.getType();
                if (itemType == ModelType.PROPERTY) {
                    Property prop = item.asProperty();
                    ModelNode propVal = prop.getValue();
                    ModelType propValType = propVal.getType();
                    if (propVal.isDefined() && propValType != ModelType.EXPRESSION) {
                        // Convert property value to expression
                        if (propValType == ModelType.STRING) {
                            checkForUnconvertedExpression(address, attrName, propVal);
                        }
View Full Code Here

                continue;
            }
            boolean timeunit = timeAttr && "unit".equals(fieldName);
            ModelNode fieldDesc = fieldProp.getValue();
            ModelNode fieldValue = item.get(fieldName);
            ModelType valueType = fieldValue.getType();
            if (valueType == ModelType.UNDEFINED
                    || valueType == ModelType.EXPRESSION
                    || COMPLEX_TYPES.contains(valueType) // too complex
                    || !fieldDesc.get(EXPRESSIONS_ALLOWED).asBoolean(false)) {
                updatedItem.get(fieldName).set(fieldValue);
View Full Code Here

TOP

Related Classes of org.jboss.dmr.ModelType

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.