Package org.jboss.dmr

Examples of org.jboss.dmr.Property


        }

        private void parseProperties(XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException {
            while (reader.nextTag() != END_ELEMENT) {
                reader.require(START_ELEMENT, Namespace.REMOTING_1_0.getUriString(), Element.PROPERTY.getLocalName());
                final Property property = readProperty(reader);
                ModelNode propertyOp = new ModelNode();
                propertyOp.get(OP).set(ADD);
                propertyOp.get(OP_ADDR).set(address).add(PROPERTY, property.getName());
                propertyOp.get(VALUE).set(property.getValue());
                list.add(propertyOp);
            }
        }
View Full Code Here


    }

    private void parseProperties(XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException {
        while (reader.nextTag() != END_ELEMENT) {
            reader.require(START_ELEMENT, Namespace.CURRENT.getUriString(), Element.PROPERTY.getLocalName());
            final Property property = readProperty(reader);
            ModelNode propertyOp = new ModelNode();
            propertyOp.get(OP).set(ADD);
            propertyOp.get(OP_ADDR).set(address).add(PROPERTY, property.getName());
            propertyOp.get(VALUE).set(property.getValue());
            list.add(propertyOp);
        }
    }
View Full Code Here

    protected void writeSchemaLocation(final XMLExtendedStreamWriter writer, final ModelNode modelNode) throws XMLStreamException {
        final StringBuilder b = new StringBuilder();
        final Iterator<ModelNode> iterator = modelNode.get(SCHEMA_LOCATIONS).asList().iterator();
        while (iterator.hasNext()) {
            final ModelNode location = iterator.next();
            final Property property = location.asProperty();
            b.append(property.getName()).append(' ').append(property.getValue().asString());
            if (iterator.hasNext()) {
                b.append(' ');
            }
        }
        if (b.length() > 0) {
View Full Code Here

            }
        }
    }

    private void writePropertyInterfaceCriteria(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
        Property property = node.asProperty();
        Element element = Element.forName(property.getName());
        writer.writeStartElement(element.getLocalName());
        switch (element) {
            case ANY:
                writeInterfaceCriteria(writer, property.getValue().asList());
                break;
            case NOT:
                writeInterfaceCriteria(writer, property.getValue().asList());
                break;
            case INET_ADDRESS:
                writeAttribute(writer, Attribute.VALUE, property.getValue().asString());
                break;
            case NIC:
                writeAttribute(writer, Attribute.NAME, property.getValue().asString());
                break;
            case NIC_MATCH:
                writeAttribute(writer, Attribute.PATTERN, property.getValue().asString());
                break;
            case SUBNET_MATCH:
                writeAttribute(writer, Attribute.VALUE, property.getValue().asString());
                break;
            default:
                throw new RuntimeException("Unknown property in interface criteria list: " + property);
        }
        writer.writeEndElement();
View Full Code Here

                throw new ParsingException("Unknown simple interface criteria type " + node.asString());
        }
    }

    private static InterfaceCriteria parsePropertyCriteria(ModelNode node) {
        Property prop = node.asProperty();
        String propName = prop.getName();
        final Element element = Element.forName(propName);
        switch (element) {
            case ANY: {
                return parseCompoundCriteria(prop.getValue(), true);
            }
            case NOT: {
                return parseCompoundCriteria(prop.getValue(), true);
            }
            case INET_ADDRESS: {
                checkStringType(prop.getValue(), element.getLocalName());
                return new InetAddressMatchInterfaceCriteria(prop.getValue().asString());
            }
            case LOOPBACK_ADDRESS: {
                checkStringType(prop.getValue(), element.getLocalName());
                return new LoopbackAddressInterfaceCriteria(prop.getValue().asString());
            }
            case NIC: {
                checkStringType(prop.getValue(), element.getLocalName());
                return new NicInterfaceCriteria(prop.getValue().asString());
            }
            case NIC_MATCH: {
                checkStringType(prop.getValue(), element.getLocalName());
                try {
                    Pattern pattern = Pattern.compile(prop.getValue().asString());
                    return new NicMatchInterfaceCriteria(pattern);
                } catch (PatternSyntaxException e) {
                    throw new ParsingException(String.format("Invalid pattern %s for interface criteria %s", prop.getValue().asString(), element.getLocalName()));
                }
            }
            case SUBNET_MATCH: {
                String value;
                String[] split = null;
                try {
                    value = prop.getValue().asString();
                    split = value.split("/");
                    if (split.length != 2) {
                        throw new ParsingException(String.format("Invalid 'value' %s -- must be of the form address/mask", value));
                    }
                    // todo - possible DNS hit here
View Full Code Here

            // Following bit is crap TODO; uncomment above and delete below
            // when bug is fixed
            final List<Property> props = new ArrayList<Property>();
            String key = null;
            for (ModelNode element : node.asList()) {
                Property prop = null;
                if (element.getType() == ModelType.PROPERTY || element.getType() == ModelType.OBJECT) {
                    prop = element.asProperty();
                }
                else if (key == null) {
                    key = element.asString();
                }
                else {
                    prop = new Property(key, element);
                }
                if (prop != null) {
                    props.add(prop);
                    key = null;
                }

            }
            if (props.size() == 0) {
                return EMPTY_ADDRESS;
            } else {
                pathMap = new LinkedHashMap<String, PathElement>();
                for (final Property prop : props) {
                    final String name = prop.getName();
                    if (pathMap.put(name, new PathElement(name, prop.getValue().asString())) != null) {
                        throw duplicateElement(name);
                    }
                }
            }
        } else {
View Full Code Here

                compare(list1.get(i), list2.get(i));
                stack.get().pop();
            }

        } else if (node1.getType() == ModelType.PROPERTY) {
            Property prop1 = node1.asProperty();
            Property prop2 = node2.asProperty();
            Assert.assertEquals(prop1 + "\n" + prop2, prop1.getName(), prop2.getName());
            stack.get().push(prop1.getName() + "/");
            compare(prop1.getValue(), prop2.getValue());
            stack.get().pop();

        } else {
            try {
                Assert.assertEquals(getCompareStackAsString() +
View Full Code Here

            securityPropertiesList = operation.get(SECURITY_PROPERTIES).asList();
            subModel.get(SECURITY_PROPERTIES).set(securityPropertiesList);
            // parse the List of security properties
            securityProperties = new Properties();
            for (ModelNode node : securityPropertiesList) {
                Property prop = node.asProperty();
                securityProperties.setProperty(prop.getName(), prop.getValue().asString());
            }
        }

        if (operation.hasDefined(AUTHENTICATION_MANAGER_CLASS_NAME)) {
            authenticationManagerClassName = operation.get(AUTHENTICATION_MANAGER_CLASS_NAME).asString();
View Full Code Here

            ModelNode vaultNode = operation;
            vaultClass = vaultNode.get(Constants.CODE).asString();
            List<ModelNode> vaultOptionList = vaultNode.get(Constants.VAULT_OPTION).asList();
            if (vaultOptionList != null) {
                for (ModelNode vaultOptionNode : vaultOptionList) {
                    Property vaultProp = vaultOptionNode.asProperty();
                    vaultOptions.put(vaultProp.getName(), vaultProp.getValue().asString());
                }
            }

            // add security vault service
            if (vaultClass != null || vaultOptions.isEmpty() == false) {
View Full Code Here

        String type = null;
        if (dynamicLoadProvider.isDefined()) {
            List<Property> list = operation.asPropertyList();
            Iterator<Property> it = list.iterator();
            while (it.hasNext()) {
                Property prop = it.next();
                if (prop.getName().equals("type")) {
                    type = prop.getValue().asString();
                    break;
                }
            }
            if (type != null) {
                removeMetric(dynamicLoadProvider, type);
View Full Code Here

TOP

Related Classes of org.jboss.dmr.Property

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.