当前位置: 首页>>代码示例>>Java>>正文


Java ParseUtils.duplicateNamedElement方法代码示例

本文整理汇总了Java中org.jboss.as.controller.parsing.ParseUtils.duplicateNamedElement方法的典型用法代码示例。如果您正苦于以下问题:Java ParseUtils.duplicateNamedElement方法的具体用法?Java ParseUtils.duplicateNamedElement怎么用?Java ParseUtils.duplicateNamedElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.as.controller.parsing.ParseUtils的用法示例。


在下文中一共展示了ParseUtils.duplicateNamedElement方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readElement

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException {
    ParseUtils.requireNoAttributes(reader);
    list.add(createAddOperation());

    boolean gotConnector = false;

    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        final String element = reader.getLocalName();
        switch (element) {
            case CommonAttributes.JMX_CONNECTOR: {
                if (gotConnector) {
                    throw ParseUtils.duplicateNamedElement(reader, CommonAttributes.JMX_CONNECTOR);
                }
                parseConnector(reader);
                gotConnector = true;
                break;
            }
            default: {
                throw ParseUtils.unexpectedElement(reader);
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:28,代码来源:JMXExtension.java

示例2: parseHeap

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseHeap(final XMLExtendedStreamReader reader, ModelNode addOp)
        throws XMLStreamException {
    // Handle attributes
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw ParseUtils.unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case SIZE: {
                    if (checkParseAndSetParameter(JvmAttributes.HEAP_SIZE, value, addOp, reader)) {
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    break;
                }
                case MAX_SIZE: {
                    if (checkParseAndSetParameter(JvmAttributes.MAX_HEAP_SIZE, value, addOp, reader)) {
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    break;
                }
                default:
                    throw ParseUtils.unexpectedAttribute(reader, i);
            }
        }
    }

    // Handle elements
    requireNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:33,代码来源:JvmXml.java

示例3: parsePermgen

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parsePermgen(final XMLExtendedStreamReader reader, ModelNode addOp)
        throws XMLStreamException {

    // Handle attributes
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw ParseUtils.unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case SIZE: {
                    if (checkParseAndSetParameter(JvmAttributes.PERMGEN_SIZE, value, addOp, reader)) {
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    break;
                }
                case MAX_SIZE: {
                    if (checkParseAndSetParameter(JvmAttributes.MAX_PERMGEN_SIZE, value, addOp, reader)) {
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    break;
                }
                default:
                    throw ParseUtils.unexpectedAttribute(reader, i);
            }
        }
    }

    // Handle elements
    requireNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:34,代码来源:JvmXml.java

示例4: parseStack

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseStack(final XMLExtendedStreamReader reader, ModelNode addOp)
        throws XMLStreamException {

    // Handle attributes
    boolean sizeSet = false;
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw ParseUtils.unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case SIZE: {
                    sizeSet = true;
                    if (checkParseAndSetParameter(JvmAttributes.STACK_SIZE, value, addOp, reader)){
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());

                    }
                    break;
                }
                default:
                    throw ParseUtils.unexpectedAttribute(reader, i);
            }
        }
    }
    if (!sizeSet) {
        throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.SIZE));
    }
    // Handle elements
    requireNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:33,代码来源:JvmXml.java

示例5: parseAgentLib

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseAgentLib(final XMLExtendedStreamReader reader, ModelNode addOp)
        throws XMLStreamException {

    // Handle attributes
    boolean valueSet = false;
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw ParseUtils.unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case VALUE: {
                    if (checkParseAndSetParameter(JvmAttributes.AGENT_LIB, value, addOp, reader)){
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    valueSet = true;
                    break;
                }
                default:
                    throw ParseUtils.unexpectedAttribute(reader, i);
            }
        }
    }
    if (!valueSet) {
        throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.VALUE));
    }
    // Handle elements
    requireNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:32,代码来源:JvmXml.java

示例6: parseAgentPath

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseAgentPath(final XMLExtendedStreamReader reader, ModelNode addOp)
        throws XMLStreamException {

    // Handle attributes
    boolean valueSet = false;
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw ParseUtils.unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case VALUE: {
                    if (checkParseAndSetParameter(JvmAttributes.AGENT_PATH, value, addOp, reader)){
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    valueSet = true;
                    break;
                }
                default:
                    throw ParseUtils.unexpectedAttribute(reader, i);
            }
        }
    }
    if (!valueSet) {
        throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.VALUE));
    }
    // Handle elements
    requireNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:32,代码来源:JvmXml.java

示例7: parseLaunchCommand

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseLaunchCommand(final XMLExtendedStreamReader reader, ModelNode addOp)
        throws XMLStreamException {

    // Handle attributes
    boolean valueSet = false;
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw ParseUtils.unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case PREFIX: {
                    if (checkParseAndSetParameter(JvmAttributes.LAUNCH_COMMAND, value, addOp, reader)) {
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    valueSet = true;
                    break;
                }
                default:
                    throw ParseUtils.unexpectedAttribute(reader, i);
            }
        }
    }
    if (!valueSet) {
        throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.PREFIX));
    }
    // Handle elements
    requireNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:32,代码来源:JvmXml.java

示例8: parseJavaagent

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseJavaagent(final XMLExtendedStreamReader reader, ModelNode addOp)
        throws XMLStreamException {

    // Handle attributes
    boolean valueSet = false;
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final String value = reader.getAttributeValue(i);
        if (!isNoNamespaceAttribute(reader, i)) {
            throw ParseUtils.unexpectedAttribute(reader, i);
        } else {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case VALUE: {
                    if (checkParseAndSetParameter(JvmAttributes.JAVA_AGENT, value, addOp, reader)) {
                        throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
                    }
                    valueSet = true;
                    break;
                }
                default:
                    throw ParseUtils.unexpectedAttribute(reader, i);
            }
        }
    }
    if (!valueSet) {
        throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.VALUE));
    }
    // Handle elements
    requireNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:32,代码来源:JvmXml.java

示例9: parseStaticDiscoveryOption

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
protected void parseStaticDiscoveryOption(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> staticDiscoveryOptionNames) throws XMLStreamException {

        // OP_ADDR will be set after parsing the NAME attribute
        final ModelNode staticDiscoveryOptionAddress = address.clone();
        staticDiscoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
        final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
        list.add(addOp);

        // Handle attributes
        final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.HOST, Attribute.PORT);
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {
            requireNoNamespaceAttribute(reader, i);
            final String value = reader.getAttributeValue(i);
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            required.remove(attribute);
            switch (attribute) {
                case NAME: {
                    if (!staticDiscoveryOptionNames.add(value)) {
                        throw ParseUtils.duplicateNamedElement(reader, value);
                    }
                    addOp.get(OP_ADDR).set(staticDiscoveryOptionAddress).add(STATIC_DISCOVERY, value);
                    break;
                }
                case HOST: {
                    StaticDiscoveryResourceDefinition.HOST.parseAndSetParameter(value, addOp, reader);
                    break;
                }
                case PROTOCOL: {
                    StaticDiscoveryResourceDefinition.PROTOCOL.parseAndSetParameter(value, addOp, reader);
                    break;
                }
                case PORT: {
                    StaticDiscoveryResourceDefinition.PORT.parseAndSetParameter(value, addOp, reader);
                    break;
                }
                default:
                    throw unexpectedAttribute(reader, i);
            }
        }

        if (required.size() > 0) {
            throw missingRequired(reader, required);
        }

        requireNoContent(reader);
    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:48,代码来源:HostXml_6.java

示例10: parseDiscoveryOptionAttributes

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private ModelNode parseDiscoveryOptionAttributes(final XMLExtendedStreamReader reader, final ModelNode address,
                                                 final List<ModelNode> list, final Set<String> discoveryOptionNames) throws XMLStreamException {

    // OP_ADDR will be set after parsing the NAME attribute
    final ModelNode discoveryOptionAddress = address.clone();
    discoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
    final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
    list.add(addOp);

    final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.CODE);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        requireNoNamespaceAttribute(reader, i);
        final String value = reader.getAttributeValue(i);
        final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME: {
                if (!discoveryOptionNames.add(value)) {
                    throw ParseUtils.duplicateNamedElement(reader, value);
                }
                addOp.get(OP_ADDR).set(discoveryOptionAddress).add(DISCOVERY_OPTION, value);
                break;
            }
            case CODE: {
                DiscoveryOptionResourceDefinition.CODE.parseAndSetParameter(value, addOp, reader);
                break;
            }
            case MODULE: {
                DiscoveryOptionResourceDefinition.MODULE.parseAndSetParameter(value, addOp, reader);
                break;
            }
            default:
                throw unexpectedAttribute(reader, i);
        }
    }

    if (required.size() > 0) {
        throw missingRequired(reader, required);
    }

    return addOp;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:44,代码来源:HostXml_6.java

示例11: parseStaticDiscoveryOption

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private void parseStaticDiscoveryOption(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> staticDiscoveryOptionNames) throws XMLStreamException {

        // OP_ADDR will be set after parsing the NAME attribute
        final ModelNode staticDiscoveryOptionAddress = address.clone();
        staticDiscoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
        final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
        list.add(addOp);

        // Handle attributes
        final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.HOST, Attribute.PORT);
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {
            requireNoNamespaceAttribute(reader, i);
            final String value = reader.getAttributeValue(i);
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            required.remove(attribute);
            switch (attribute) {
                case NAME: {
                    if (!staticDiscoveryOptionNames.add(value)) {
                        throw ParseUtils.duplicateNamedElement(reader, value);
                    }
                    addOp.get(OP_ADDR).set(staticDiscoveryOptionAddress).add(STATIC_DISCOVERY, value);
                    break;
                }
                case HOST: {
                    StaticDiscoveryResourceDefinition.HOST.parseAndSetParameter(value, addOp, reader);
                    break;
                }
                case PROTOCOL: {
                    StaticDiscoveryResourceDefinition.PROTOCOL.parseAndSetParameter(value, addOp, reader);
                    break;
                }
                case PORT: {
                    StaticDiscoveryResourceDefinition.PORT.parseAndSetParameter(value, addOp, reader);
                    break;
                }
                default:
                    throw unexpectedAttribute(reader, i);
            }
        }

        if (required.size() > 0) {
            throw missingRequired(reader, required);
        }

        requireNoContent(reader);
    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:48,代码来源:HostXml_5.java

示例12: parseDiscoveryOptionAttributes

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private ModelNode parseDiscoveryOptionAttributes(final XMLExtendedStreamReader reader, final ModelNode address,
        final List<ModelNode> list, final Set<String> discoveryOptionNames) throws XMLStreamException {

    // OP_ADDR will be set after parsing the NAME attribute
    final ModelNode discoveryOptionAddress = address.clone();
    discoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
    final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
    list.add(addOp);

    final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.CODE);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        requireNoNamespaceAttribute(reader, i);
        final String value = reader.getAttributeValue(i);
        final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME: {
                if (!discoveryOptionNames.add(value)) {
                    throw ParseUtils.duplicateNamedElement(reader, value);
                }
                addOp.get(OP_ADDR).set(discoveryOptionAddress).add(DISCOVERY_OPTION, value);
                break;
            }
            case CODE: {
                DiscoveryOptionResourceDefinition.CODE.parseAndSetParameter(value, addOp, reader);
                break;
            }
            case MODULE: {
                DiscoveryOptionResourceDefinition.MODULE.parseAndSetParameter(value, addOp, reader);
                break;
            }
            default:
                throw unexpectedAttribute(reader, i);
        }
    }

    if (required.size() > 0) {
        throw missingRequired(reader, required);
    }

    return addOp;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:44,代码来源:HostXml_5.java

示例13: parseStaticDiscoveryOption

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private void parseStaticDiscoveryOption(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> staticDiscoveryOptionNames) throws XMLStreamException {

        // OP_ADDR will be set after parsing the NAME attribute
        final ModelNode staticDiscoveryOptionAddress = address.clone();
        staticDiscoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
        final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
        list.add(addOp);

        // Handle attributes
        final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.HOST, Attribute.PORT);
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {
            requireNoNamespaceAttribute(reader, i);
            final String value = reader.getAttributeValue(i);
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            required.remove(attribute);
            switch (attribute) {
            case NAME: {
                if (!staticDiscoveryOptionNames.add(value)) {
                    throw ParseUtils.duplicateNamedElement(reader, value);
                }
                addOp.get(OP_ADDR).set(staticDiscoveryOptionAddress).add(STATIC_DISCOVERY, value);
                break;
            }
            case HOST: {
                StaticDiscoveryResourceDefinition.HOST.parseAndSetParameter(value, addOp, reader);
                break;
            }
            case PROTOCOL: {
                if(namespace.getMajorVersion() > 2) {
                    StaticDiscoveryResourceDefinition.PROTOCOL.parseAndSetParameter(value, addOp, reader);
                } else {
                    throw unexpectedAttribute(reader, i);
                }
                break;
            }
            case PORT: {
                StaticDiscoveryResourceDefinition.PORT.parseAndSetParameter(value, addOp, reader);
                break;
            }
            default:
                throw unexpectedAttribute(reader, i);
            }
        }

        if (required.size() > 0) {
            throw missingRequired(reader, required);
        }

        requireNoContent(reader);
    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:52,代码来源:HostXml_Legacy.java

示例14: readElement

import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
@Override
public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException {

    final PathAddress address = PathAddress.pathAddress(SUBSYSTEM, RemotingExtension.SUBSYSTEM_NAME);
    final ModelNode subsystem = Util.createAddOperation(address);
    list.add(subsystem);

    requireAttributes(reader);
    boolean foundEndpoint = false;
    // Handle elements
    boolean doneWorkerThreadPool = false;
    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        final Element element = Element.forName(reader.getLocalName());
        switch (element) {
            case WORKER_THREAD_POOL:
                if (doneWorkerThreadPool) {
                    throw ParseUtils.duplicateNamedElement(reader, Element.WORKER_THREAD_POOL.getLocalName());
                }
                if (foundEndpoint) {
                    throw workerThreadPoolEndpointChoiceRequired(reader);
                }
                doneWorkerThreadPool = true;
                parseWorkerThreadPool(reader, subsystem);
                break;
            case ENDPOINT:
                if (doneWorkerThreadPool) {
                    throw workerThreadPoolEndpointChoiceRequired(reader);
                }
                parseEndpoint(reader, subsystem);
                foundEndpoint = true;
                break;
            case CONNECTOR: {
                // Add connector updates
                parseConnector(reader, address.toModelNode(), list);
                break;
            }
            case HTTP_CONNECTOR: {
                // Add http connector updates
                parseHttpConnector(reader, address.toModelNode(), list);
                break;
            }
            case OUTBOUND_CONNECTIONS: {
                // parse the outbound-connections
                this.parseOutboundConnections(reader, address.toModelNode(), list);
                break;
            }
            default: {
                throw unexpectedElement(reader);
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:53,代码来源:RemotingSubsystem20Parser.java


注:本文中的org.jboss.as.controller.parsing.ParseUtils.duplicateNamedElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。