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


Java XMLExtendedStreamWriter.writeEmptyElement方法代码示例

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


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

示例1: writePlugIn_Authentication

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writePlugIn_Authentication(XMLExtendedStreamWriter writer, ModelNode plugIn) throws XMLStreamException {
    writer.writeStartElement(Element.PLUG_IN.getLocalName());
    AbstractPlugInAuthResourceDefinition.NAME.marshallAsAttribute(plugIn, writer);
    PlugInAuthenticationResourceDefinition.MECHANISM.marshallAsAttribute(plugIn, writer);
    if (plugIn.hasDefined(PROPERTY)) {
        writer.writeStartElement(PROPERTIES);
        ModelNode properties = plugIn.get(PROPERTY);
        for (String current : properties.keys()) {
            writer.writeEmptyElement(PROPERTY);
            writer.writeAttribute(Attribute.NAME.getLocalName(), current);
            PropertyResourceDefinition.VALUE.marshallAsAttribute(properties.get(current), writer);
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:ManagementXml_5.java

示例2: writeNativeManagementProtocol

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException {

    writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName());
    NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer);

    if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) {
        writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName());
        NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer);
    }

    writer.writeEndElement();

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

示例3: writeIgnoredResources

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeIgnoredResources(XMLExtendedStreamWriter writer, ModelNode ignoredTypes) throws XMLStreamException {
    for (String ignoredName : ignoredTypes.keys()) {

        ModelNode ignored = ignoredTypes.get(ignoredName);

        ModelNode names = ignored.hasDefined(NAMES) ? ignored.get(NAMES) : null;
        boolean hasNames = names != null && names.asInt() > 0;
        if (hasNames) {
            writer.writeStartElement(Element.IGNORED_RESOURCE.getLocalName());
        } else {
            writer.writeEmptyElement(Element.IGNORED_RESOURCE.getLocalName());
        }

        writer.writeAttribute(Attribute.TYPE.getLocalName(), ignoredName);
        IgnoredDomainTypeResourceDefinition.WILDCARD.marshallAsAttribute(ignored, writer);

        if (hasNames) {
            for (ModelNode name : names.asList()) {
                writer.writeEmptyElement(Element.INSTANCE.getLocalName());
                writer.writeAttribute(Attribute.NAME.getLocalName(), name.asString());
            }
            writer.writeEndElement();
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:HostXml_6.java

示例4: writeNativeManagementProtocol

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException {

    writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName());
    NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer);

    writer.writeEmptyElement(Element.SOCKET.getLocalName());
    NativeManagementResourceDefinition.INTERFACE.marshallAsAttribute(protocol, writer);
    NativeManagementResourceDefinition.NATIVE_PORT.marshallAsAttribute(protocol, writer);

    writer.writeEndElement();

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

示例5: writeContent

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(XMLExtendedStreamWriter writer, ModelMarshallingContext context) throws XMLStreamException {

    String defaultNamespace = writer.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
    try {
        ModelNode subsystems = context.getModelNode().get(SUBSYSTEM);
        if (subsystems.has(mainSubsystemName)) {
            ModelNode subsystem = subsystems.get(mainSubsystemName);
            //We might have been removed
            XMLElementWriter<SubsystemMarshallingContext> subsystemWriter = context.getSubsystemWriter(mainSubsystemName);
            if (subsystemWriter != null) {
                subsystemWriter.writeContent(writer, new SubsystemMarshallingContext(subsystem, writer));
            }
        }else{
            writer.writeEmptyElement(Element.SUBSYSTEM.getLocalName());
        }
    }catch (Throwable t){
        Assert.fail("could not marshal subsystem xml: "+t.getMessage()+":\n"+ Arrays.toString(t.getStackTrace()).replaceAll(", ","\n"));
    } finally {
        writer.setDefaultNamespace(defaultNamespace);
    }
    writer.writeEndDocument();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:TestParser.java

示例6: startSubsystemElement

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void startSubsystemElement(XMLExtendedStreamWriter writer, String namespaceURI, boolean empty) throws XMLStreamException {
    if (writer.getNamespaceContext().getPrefix(namespaceURI) == null) {
        // Unknown namespace; it becomes default
        writer.setDefaultNamespace(namespaceURI);
        if (empty) {
            writer.writeEmptyElement(Element.SUBSYSTEM.getLocalName());
        } else {
            writer.writeStartElement(Element.SUBSYSTEM.getLocalName());
        }
        writer.writeNamespace(null, namespaceURI);
    } else {
        if (empty) {
            writer.writeEmptyElement(namespaceURI, Element.SUBSYSTEM.getLocalName());
        } else {
            writer.writeStartElement(namespaceURI, Element.SUBSYSTEM.getLocalName());
        }
    }

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:PersistentResourceXMLDescription.java

示例7: writePlugIns

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writePlugIns(XMLExtendedStreamWriter writer, ModelNode plugIns) throws XMLStreamException {
    writer.writeStartElement(Element.PLUG_INS.getLocalName());
    for (String variable : plugIns.keys()) {
        writer.writeEmptyElement(Element.PLUG_IN.getLocalName());
        writer.writeAttribute(Attribute.MODULE.getLocalName(), variable);
    }
    writer.writeEndElement();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:9,代码来源:ManagementXml_5.java

示例8: writeHttpManagementProtocol

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public boolean writeHttpManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException {

    writer.writeStartElement(Element.HTTP_INTERFACE.getLocalName());
    HttpManagementResourceDefinition.HTTP_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer);

    boolean consoleEnabled = protocol.get(ModelDescriptionConstants.CONSOLE_ENABLED).asBoolean(true);
    if (!consoleEnabled) {
        HttpManagementResourceDefinition.CONSOLE_ENABLED.marshallAsAttribute(protocol, writer);
    }

    HttpManagementResourceDefinition.ALLOWED_ORIGINS.getMarshaller().marshallAsAttribute(
            HttpManagementResourceDefinition.ALLOWED_ORIGINS, protocol, true, writer);

    if (HttpManagementResourceDefinition.HTTP_UPGRADE.isMarshallable(protocol)) {
        writer.writeEmptyElement(Element.HTTP_UPGRADE.getLocalName());
        HttpManagementResourceDefinition.ENABLED.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer);
        HttpManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer);
    }

    if (HttpManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)
            || HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.isMarshallable(protocol)) {
        writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName());
        HttpManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer);
        HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.marshallAsAttribute(protocol, writer);
    }

    writer.writeEndElement();

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

示例9: writeContent

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(XMLExtendedStreamWriter writer, BundledPatch bundledPatch) throws XMLStreamException {

    writer.writeStartElement(Element.PATCHES.name);
    writer.writeDefaultNamespace(PatchXml.Namespace.PATCH_BUNDLE_1_0.getNamespace());

    for (final BundledPatch.BundledPatchEntry entry : bundledPatch.getPatches()) {
        writer.writeEmptyElement(Element.PATCH_ELEMENT.name);
        writer.writeAttribute(Attribute.ID.name, entry.getPatchId());
        writer.writeAttribute(Attribute.PATH.name, entry.getPatchPath());
    }

    writer.writeEndElement();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:15,代码来源:PatchBundleXml_1_0.java

示例10: writeOutboundConnections

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeOutboundConnections(XMLExtendedStreamWriter writer, ModelNode management) throws XMLStreamException {

        writer.writeStartElement(Element.OUTBOUND_CONNECTIONS.getLocalName());

        ModelNode ldapConns = management.get(LDAP_CONNECTION);
        for (String variable : ldapConns.keys()) {
            ModelNode connection = ldapConns.get(variable);
            writer.writeStartElement(Element.LDAP.getLocalName());
            writer.writeAttribute(Attribute.NAME.getLocalName(), variable);
            LdapConnectionResourceDefinition.URL.marshallAsAttribute(connection, writer);
            LdapConnectionResourceDefinition.SEARCH_DN.marshallAsAttribute(connection, writer);
            LdapConnectionResourceDefinition.SEARCH_CREDENTIAL.marshallAsAttribute(connection, writer);
            LdapConnectionResourceDefinition.SECURITY_REALM.marshallAsAttribute(connection, writer);
            LdapConnectionResourceDefinition.INITIAL_CONTEXT_FACTORY.marshallAsAttribute(connection, writer);
            LdapConnectionResourceDefinition.REFERRALS.marshallAsAttribute(connection, writer);
            LdapConnectionResourceDefinition.HANDLES_REFERRALS_FOR.getMarshaller()
                    .marshallAsAttribute(LdapConnectionResourceDefinition.HANDLES_REFERRALS_FOR, connection, true, writer);
            LdapConnectionResourceDefinition.ALWAYS_SEND_CLIENT_CERT.marshallAsAttribute(connection, writer);
            if(connection.hasDefined(LdapConnectionResourceDefinition.SEARCH_CREDENTIAL_REFERENCE.getName())) {
                LdapConnectionResourceDefinition.SEARCH_CREDENTIAL_REFERENCE.marshallAsElement(connection, writer);
            }

            if (connection.hasDefined(PROPERTY)) {
                ModelNode properties = connection.get(PROPERTY);
                Set<String> propertySet = properties.keys();
                if (propertySet.size() > 0) {
                    writer.writeStartElement(PROPERTIES);
                    for (String current : propertySet) {
                        writer.writeEmptyElement(PROPERTY);
                        writer.writeAttribute(Attribute.NAME.getLocalName(), current);
                        LdapConnectionPropertyResourceDefinition.VALUE.marshallAsAttribute(properties.get(current), writer);
                    }
                    writer.writeEndElement();
                }
            }
            writer.writeEndElement();
        }
        writer.writeEndElement();
    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:40,代码来源:ManagementXml_5.java

示例11: writeDomainController

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeDomainController(final XMLExtendedStreamWriter writer, final ModelNode modelNode, ModelNode ignoredResources,
                                   ModelNode discoveryOptions) throws XMLStreamException {
    writer.writeStartElement(Element.DOMAIN_CONTROLLER.getLocalName());
    if (modelNode.hasDefined(LOCAL)) {
        if (discoveryOptions != null) {
            writer.writeStartElement(Element.LOCAL.getLocalName());
            writeDiscoveryOptions(writer, discoveryOptions);
            writer.writeEndElement();
        } else {
            writer.writeEmptyElement(Element.LOCAL.getLocalName());
        }
    } else if (modelNode.hasDefined(REMOTE)) {
        writer.writeStartElement(Element.REMOTE.getLocalName());
        final ModelNode remote = modelNode.get(REMOTE);
        RemoteDomainControllerAddHandler.PROTOCOL.marshallAsAttribute(remote, writer);
        RemoteDomainControllerAddHandler.HOST.marshallAsAttribute(remote, writer);
        RemoteDomainControllerAddHandler.PORT.marshallAsAttribute(remote, writer);
        RemoteDomainControllerAddHandler.AUTHENTICATION_CONTEXT.marshallAsAttribute(remote, writer);
        RemoteDomainControllerAddHandler.SECURITY_REALM.marshallAsAttribute(remote, writer);
        RemoteDomainControllerAddHandler.USERNAME.marshallAsAttribute(remote, writer);
        RemoteDomainControllerAddHandler.IGNORE_UNUSED_CONFIG.marshallAsAttribute(remote, writer);
        RemoteDomainControllerAddHandler.ADMIN_ONLY_POLICY.marshallAsAttribute(remote, writer);

        if (ignoredResources != null) {
            writeIgnoredResources(writer, ignoredResources);
        }
        if (discoveryOptions != null) {
            writeDiscoveryOptions(writer, discoveryOptions);
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:34,代码来源:HostXml_6.java

示例12: writeHttpManagementProtocol

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public boolean writeHttpManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException {

    writer.writeStartElement(Element.HTTP_INTERFACE.getLocalName());
    HttpManagementResourceDefinition.HTTP_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.CONSOLE_ENABLED.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.ALLOWED_ORIGINS.getMarshaller().marshallAsAttribute(
            HttpManagementResourceDefinition.ALLOWED_ORIGINS, protocol, true, writer);
    HttpManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer);

    if (HttpManagementResourceDefinition.HTTP_UPGRADE.isMarshallable(protocol)) {
        writer.writeEmptyElement(Element.HTTP_UPGRADE.getLocalName());
        HttpManagementResourceDefinition.ENABLED.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer);
        HttpManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer);
    }

    writer.writeEmptyElement(Element.SOCKET.getLocalName());
    HttpManagementResourceDefinition.INTERFACE.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.HTTP_PORT.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.HTTPS_PORT.marshallAsAttribute(protocol, writer);
    HttpManagementResourceDefinition.SECURE_INTERFACE.marshallAsAttribute(protocol, writer);

    writer.writeEndElement();

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

示例13: writeManagementClientContent

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeManagementClientContent(XMLExtendedStreamWriter writer, ModelNode modelNode) throws XMLStreamException {
    boolean hasRolloutPlans = modelNode.hasDefined(ROLLOUT_PLANS) && modelNode.get(ROLLOUT_PLANS).hasDefined(HASH);
    boolean mustWrite = hasRolloutPlans; // || other elements we may add later
    if (mustWrite) {
        writer.writeStartElement(Element.MANAGEMENT_CLIENT_CONTENT.getLocalName());
        if (hasRolloutPlans) {
            writer.writeEmptyElement(Element.ROLLOUT_PLANS.getLocalName());
            writer.writeAttribute(Attribute.SHA1.getLocalName(), HashUtil.bytesToHexString(modelNode.get(ROLLOUT_PLANS).get(HASH).asBytes()));
        }
        writer.writeEndElement();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:DomainXml_6.java

示例14: writeEndpointIfAttributesSet

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeEndpointIfAttributesSet(final XMLExtendedStreamWriter writer, final ModelNode model) throws XMLStreamException {
    boolean defined = false;
    for (String adName : RemotingEndpointResource.ATTRIBUTES.keySet()) {
        if (model.hasDefined(adName)) {
            defined = true;
            break;
        }
    }
    if (defined) {
        writer.writeEmptyElement(RemotingEndpointResource.ENDPOINT_PATH.getValue());
        for (AttributeDefinition ad : RemotingEndpointResource.ATTRIBUTES.values()) {
            ad.getMarshaller().marshallAsAttribute(ad, model, true, writer);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:16,代码来源:RemotingSubsystemXMLPersister.java

示例15: writeContent

import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
    ModelNode scanners = context.getModelNode();
    for (final Property list : scanners.asPropertyList()) {

        final ModelNode node = list.getValue();

        for (final Property scanner : node.asPropertyList()) {

            final String scannerName = scanner.getName();
            final ModelNode configuration = scanner.getValue();

            writer.writeEmptyElement(DEPLOYMENT_SCANNER);

            if (!DeploymentScannerExtension.DEFAULT_SCANNER_NAME.equals(scannerName)) {
                writer.writeAttribute(NAME, scannerName);
            }

            DeploymentScannerDefinition.PATH.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.RELATIVE_TO.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.SCAN_ENABLED.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.SCAN_INTERVAL.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.AUTO_DEPLOY_ZIPPED.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.AUTO_DEPLOY_EXPLODED.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.AUTO_DEPLOY_XML.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.DEPLOYMENT_TIMEOUT.marshallAsAttribute(configuration, writer);
            DeploymentScannerDefinition.RUNTIME_FAILURE_CAUSES_ROLLBACK.marshallAsAttribute(configuration, writer);
        }
        writer.writeEndElement();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:36,代码来源:DeploymentScannerParser_2_0.java


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