Package org.jboss.dmr

Examples of org.jboss.dmr.ModelType


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

    @Override
    public ModelNode getModelDescription(Locale locale) {
        ModelType valueType = null;
        DescriptionProvider delegate = new DefaultOperationDescriptionProvider(OPERATION_NAME,
                HostRootDescription.getResourceDescriptionResolver("host"), 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


            return null;
        }
    }

    public static TypeConverter getConverter(ModelNode typeNode, ModelNode valueTypeNode) {
        ModelType modelType = getType(typeNode);
        if (modelType == null) {
            return new ComplexTypeConverter(typeNode);
        }
        switch (modelType) {
        case BIG_DECIMAL:
View Full Code Here

        final ModelType valueType;
        OpenType<?> openType;

        ObjectTypeConverter(ModelNode valueTypeNode) {
            this.valueTypeNode = nullNodeAsUndefined(valueTypeNode);
            ModelType valueType = getType(valueTypeNode);
            this.valueType = valueType == ModelType.UNDEFINED ? null : valueType;
        }
View Full Code Here


        ModelNode typeNode = currentDescription.hasDefined(TYPE) ? currentDescription.get(TYPE) : null;
        ModelNode valueTypeNode = currentDescription.hasDefined(VALUE_TYPE) ? currentDescription.get(VALUE_TYPE) : null;

        ModelType type;
        try {
            type = typeNode.asType();
        } catch (Exception e) {
            errors.add(validationElement.createValidationFailure("Invalid type " + currentDescription.asString()));
            return;
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

            Map<String, ModelNode> attributes = new HashMap<String, ModelNode>();
            for (StatisticsPlugin plugin : plugins) {
                for (String name : plugin.getNames()) {
                    ModelNode node = new ModelNode();
                    node.get(DESCRIPTION).set(plugin.getDescription(name));
                    ModelType modelType = ModelType.STRING;
                    if (plugin.getType(name) == int.class) {
                        modelType = ModelType.INT;
                    }
                    if (plugin.getType(name) == long.class) {
                        modelType = ModelType.LONG;
View Full Code Here

    private void validatePool(ModelNode address, ModelNode resourceDescription, ModelNode resource) {

        for (AttributeDefinition attr : POOL_ATTRIBUTES) {
            final String name = attr.getName();
            final ModelType expectedType = attr.getType();
            assertTrue(resourceDescription.get(ATTRIBUTES, name).isDefined());
            assertEquals(ModelType.STRING, resourceDescription.get(ATTRIBUTES, name, DESCRIPTION).getType());
            assertEquals(expectedType, resourceDescription.get(ATTRIBUTES, name, TYPE).asType());

            assertTrue(name + " is not defined", resource.get(name).isDefined());
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,
                HostRootDescription.getResourceDescriptionResolver("host"), 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

                final Map<String, CommandArgument> argMap = new HashMap<String, CommandArgument>(propList.size());
                for(int i = 0; i < propList.size(); ++i) {
                    final Property prop = propList.get(i);
                    final ModelNode propDescr = prop.getValue();
                    if(propDescr.has(Util.ACCESS_TYPE) && Util.READ_WRITE.equals(propDescr.get(Util.ACCESS_TYPE).asString())) {
                        ModelType type = null;
                        CommandLineCompleter valueCompleter = null;
                        ArgumentValueConverter valueConverter = null;
                        if(propConverters != null) {
                            valueConverter = propConverters.get(prop.getName());
                        }
                        if(valueCompleters != null) {
                            valueCompleter = valueCompleters.get(prop.getName());
                        }
                        if(valueConverter == null) {
                            valueConverter = ArgumentValueConverter.DEFAULT;
                            if(propDescr.has(Util.TYPE)) {
                                type = propDescr.get(Util.TYPE).asType();
                                if(ModelType.BOOLEAN == type) {
                                    if(valueCompleter == null) {
                                        valueCompleter = SimpleTabCompleter.BOOLEAN;
                                    }
                                } else if(prop.getName().endsWith("properties")) { // TODO this is bad but can't rely on proper descriptions
                                    valueConverter = ArgumentValueConverter.PROPERTIES;
                                } else if(ModelType.LIST == type) {
                                    if(propDescr.hasDefined(Util.VALUE_TYPE) && propDescr.get(Util.VALUE_TYPE).asType() == ModelType.PROPERTY) {
                                        valueConverter = ArgumentValueConverter.PROPERTIES;
                                    } else {
                                        valueConverter = ArgumentValueConverter.LIST;
                                    }
                                } else if(ModelType.OBJECT == type) {
                                    valueConverter = ArgumentValueConverter.OBJECT;
                                }
                            }
                        }
                        final CommandArgument arg = new ArgumentWithValue(GenericTypeOperationHandler.this, valueCompleter, valueConverter, "--" + prop.getName());
                        argMap.put(arg.getFullName(), arg);
                    }
                }
                nodeProps = argMap;
                nodeProps.put(this.headers.getFullName(), this.headers);
            }
            return nodeProps;
        } else {
            // list operation properties
            if(propsByOp == null) {
                propsByOp = new HashMap<String, Map<String, CommandArgument>>();
            }
            Map<String, CommandArgument> opProps = propsByOp.get(op);
            if(opProps == null) {
                final ModelNode descr;
                try {
                    descr = getOperationDescription(ctx, op);
                } catch (CommandFormatException e1) {
                    return Collections.emptyMap();
                }

                opProps = new HashMap<String,CommandArgument>();
                opProps.put(this.headers.getFullName(), this.headers);
                if(descr != null && descr.has(Util.REQUEST_PROPERTIES)) {
                    final List<Property> propList = descr.get(Util.REQUEST_PROPERTIES).asPropertyList();
                    opProps = new HashMap<String,CommandArgument>(propList.size());
                    for (Property prop : propList) {
                        final ModelNode propDescr = prop.getValue();
                        ModelType type = null;
                        CommandLineCompleter valueCompleter = null;
                        ArgumentValueConverter valueConverter = null;
                        if(propConverters != null) {
                            valueConverter = propConverters.get(prop.getName());
                        }
View Full Code Here

            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

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.