Java Code Examples for org.jboss.as.controller.parsing.Namespace#domainValues()

The following examples show how to use org.jboss.as.controller.parsing.Namespace#domainValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigurationPersisterFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister(final ConfigurationFile file, ExecutorService executorService, ExtensionRegistry extensionRegistry, final HostControllerEnvironment environment) {
    DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry);

    boolean suppressLoad = false;
    ConfigurationFile.InteractionPolicy policy = file.getInteractionPolicy();
    final boolean isReloaded = environment.getRunningModeControl().isReloaded();

    if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW && (file.getBootFile().exists() && file.getBootFile().length() != 0))) {
        throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteDomainXmlWithEmpty(file.getBootFile().getName());
    }

    if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD)) {
        suppressLoad = true;
    }

    BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "domain"), domainXml, domainXml, suppressLoad);
    for (Namespace namespace : Namespace.domainValues()) {
        if (!namespace.equals(Namespace.CURRENT)) {
            persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "domain"), domainXml);
        }
    }
    extensionRegistry.setWriterRegistry(persister);
    return persister;
}
 
Example 2
Source File: HostXml_5.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {
    final ModelNode address = new ModelNode().setEmptyList();
    if (Element.forName(reader.getLocalName()) != Element.HOST) {
        throw unexpectedElement(reader);
    }

    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readHostElement(reader, address, operationList);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 3
Source File: HostXml_6.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {
    final ModelNode address = new ModelNode().setEmptyList();
    if (Element.forName(reader.getLocalName()) != Element.HOST) {
        throw unexpectedElement(reader);
    }

    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readHostElement(reader, address, operationList);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 4
Source File: HostXml_10.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {
    final ModelNode address = new ModelNode().setEmptyList();
    if (Element.forName(reader.getLocalName()) != Element.HOST) {
        throw unexpectedElement(reader);
    }

    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readHostElement(reader, address, operationList);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 5
Source File: HostXml_Legacy.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {
    final ModelNode address = new ModelNode().setEmptyList();
    if (Element.forName(reader.getLocalName()) != Element.HOST) {
        throw unexpectedElement(reader);
    }
    Namespace readerNS = Namespace.forUri(reader.getNamespaceURI());
    if (readerNS == DOMAIN_1_0) {
        readHostElement_1_0(reader, address, operationList);

    } else if (readerNS.getMajorVersion() == 1 || readerNS.getMajorVersion() == 2) {
        readHostElement_1_1(readerNS, reader, address, operationList);

    } else {
        // Instead of having to list the remaining versions we just check it is actually a valid version.
        for (Namespace current : Namespace.domainValues()) {
            if (readerNS.equals(current)) {
                readHostElement_3_0(readerNS, reader, address, operationList);
                return;
            }
        }
        throw unexpectedElement(reader);
    }
}
 
Example 6
Source File: DomainXml_5.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
    if (Element.forName(reader.getLocalName()) != Element.DOMAIN) {
        throw unexpectedElement(reader);
    }
    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readDomainElement(reader, new ModelNode(), nodes);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 7
Source File: StandaloneXml_9.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {

    long start = System.currentTimeMillis();
    final ModelNode address = new ModelNode().setEmptyList();

    if (Element.forName(reader.getLocalName()) != Element.SERVER) {
        throw unexpectedElement(reader);
    }

    boolean validNamespace = false;
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            validNamespace = true;
            readServerElement(reader, address, operationList);
            break;
        }
    }
    if (validNamespace == false) {
        throw unexpectedElement(reader);
    }

    if (ServerLogger.ROOT_LOGGER.isDebugEnabled()) {
        long elapsed = System.currentTimeMillis() - start;
        ServerLogger.ROOT_LOGGER.debugf("Parsed standalone configuration in [%d] ms", elapsed);
    }
}
 
Example 8
Source File: DomainXml_14.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
    if (Element.forName(reader.getLocalName()) != Element.DOMAIN) {
        throw unexpectedElement(reader);
    }
    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readDomainElement(reader, new ModelNode(), nodes);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 9
Source File: DomainXml_13.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
    if (Element.forName(reader.getLocalName()) != Element.DOMAIN) {
        throw unexpectedElement(reader);
    }
    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readDomainElement(reader, new ModelNode(), nodes);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 10
Source File: StandaloneXml_8.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {

    long start = System.currentTimeMillis();
    final ModelNode address = new ModelNode().setEmptyList();

    if (Element.forName(reader.getLocalName()) != Element.SERVER) {
        throw unexpectedElement(reader);
    }

    boolean validNamespace = false;
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            validNamespace = true;
            readServerElement(reader, address, operationList);
            break;
        }
    }
    if (validNamespace == false) {
        throw unexpectedElement(reader);
    }

    if (ServerLogger.ROOT_LOGGER.isDebugEnabled()) {
        long elapsed = System.currentTimeMillis() - start;
        ServerLogger.ROOT_LOGGER.debugf("Parsed standalone configuration in [%d] ms", elapsed);
    }
}
 
Example 11
Source File: Bootstrap.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Get the factory for the configuration persister to use.
 *
 * @return the configuration persister factory
 */
public synchronized ConfigurationPersisterFactory getConfigurationPersisterFactory() {
    if (configurationPersisterFactory == null) {
        configurationPersisterFactory = new ConfigurationPersisterFactory() {
            @Override
            public ExtensibleConfigurationPersister createConfigurationPersister(ServerEnvironment serverEnvironment, ExecutorService executorService) {
                ConfigurationFile configurationFile = serverEnvironment.getServerConfigurationFile();
                if (runningModeControl.isReloaded()) {
                    configurationFile.resetBootFile(runningModeControl.isUseCurrentConfig(), runningModeControl.getAndClearNewBootFileName());
                }
                QName rootElement = new QName(Namespace.CURRENT.getUriString(), "server");
                StandaloneXml parser = new StandaloneXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
                XmlConfigurationPersister persister;
                if (configurationFile.useGit()) {
                    persister = new GitConfigurationPersister(serverEnvironment.getGitRepository(), configurationFile, rootElement, parser, parser,
                            runningModeControl.isReloaded());
                } else {
                    persister = new BackupXmlConfigurationPersister(configurationFile, rootElement, parser, parser,
                            runningModeControl.isReloaded(), serverEnvironment.getLaunchType() == ServerEnvironment.LaunchType.EMBEDDED);
                }
                for (Namespace namespace : Namespace.domainValues()) {
                    if (!namespace.equals(Namespace.CURRENT)) {
                        persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "server"), parser);
                    }
                }
                extensionRegistry.setWriterRegistry(persister);
                return persister;
            }
        };
    }
    return configurationPersisterFactory;
}
 
Example 12
Source File: StandaloneXml_6.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {

    long start = System.currentTimeMillis();
    final ModelNode address = new ModelNode().setEmptyList();

    if (Element.forName(reader.getLocalName()) != Element.SERVER) {
        throw unexpectedElement(reader);
    }

    boolean validNamespace = false;
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            validNamespace = true;
            readServerElement(reader, address, operationList);
            break;
        }
    }
    if (validNamespace == false) {
        throw unexpectedElement(reader);
    }

    if (ServerLogger.ROOT_LOGGER.isDebugEnabled()) {
        long elapsed = System.currentTimeMillis() - start;
        ServerLogger.ROOT_LOGGER.debugf("Parsed standalone configuration in [%d] ms", elapsed);
    }
}
 
Example 13
Source File: DomainXml_10.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
    if (Element.forName(reader.getLocalName()) != Element.DOMAIN) {
        throw unexpectedElement(reader);
    }
    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readDomainElement(reader, new ModelNode(), nodes);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 14
Source File: DomainXml_Legacy.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
    if (Element.forName(reader.getLocalName()) != Element.DOMAIN) {
        throw unexpectedElement(reader);
    }
    Namespace readerNS = Namespace.forUri(reader.getNamespaceURI());
    switch (readerNS) {
        case DOMAIN_1_0: {
            readDomainElement1_0(reader, new ModelNode(), nodes);
            break;
        }
        case DOMAIN_1_1:
        case DOMAIN_1_2:
            readDomainElement1_1(reader, new ModelNode(), nodes);
            break;
        case DOMAIN_1_3:
            readDomainElement1_3(reader, new ModelNode(), nodes);
            break;
        case DOMAIN_1_4:
            readDomainElement1_4(reader, new ModelNode(), nodes);
            break;
        default:
            // Instead of having to list the remaining versions we just check it is actually a valid version.
            for (Namespace current : Namespace.domainValues()) {
                if (readerNS.equals(current)) {
                    readDomainElement2_0(reader, new ModelNode(), nodes);
                    return;
                }
            }
            throw unexpectedElement(reader);
    }
}
 
Example 15
Source File: StandaloneXml_5.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {

    long start = System.currentTimeMillis();
    final ModelNode address = new ModelNode().setEmptyList();

    if (Element.forName(reader.getLocalName()) != Element.SERVER) {
        throw unexpectedElement(reader);
    }

    boolean validNamespace = false;
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            validNamespace = true;
            readServerElement(reader, address, operationList);
            break;
        }
    }
    if (validNamespace == false) {
        throw unexpectedElement(reader);
    }

    if (ServerLogger.ROOT_LOGGER.isDebugEnabled()) {
        long elapsed = System.currentTimeMillis() - start;
        ServerLogger.ROOT_LOGGER.debugf("Parsed standalone configuration in [%d] ms", elapsed);
    }
}
 
Example 16
Source File: ConfigurationPersisterFactory.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static ExtensibleConfigurationPersister createRemoteBackupDomainXmlConfigurationPersister(final File configDir, ExecutorService executorService, ExtensionRegistry extensionRegistry) {
    DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
    File bootFile = new File(configDir, CACHED_DOMAIN_XML_BOOTFILE);
    File file = new File(configDir, CACHED_DOMAIN_XML);
    BackupRemoteDomainXmlPersister persister = new BackupRemoteDomainXmlPersister(file, bootFile, new QName(Namespace.CURRENT.getUriString(), "domain"), domainXml, domainXml);
    for (Namespace namespace : Namespace.domainValues()) {
        if (!namespace.equals(Namespace.CURRENT)) {
            persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "domain"), domainXml);
        }
    }
    extensionRegistry.setWriterRegistry(persister);
    return persister;
}
 
Example 17
Source File: DomainXml_11.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
    if (Element.forName(reader.getLocalName()) != Element.DOMAIN) {
        throw unexpectedElement(reader);
    }
    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readDomainElement(reader, new ModelNode(), nodes);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 18
Source File: DomainXml_8.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
    if (Element.forName(reader.getLocalName()) != Element.DOMAIN) {
        throw unexpectedElement(reader);
    }
    // Instead of having to list the remaining versions we just check it is actually a valid version.
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            readDomainElement(reader, new ModelNode(), nodes);
            return;
        }
    }
    throw unexpectedElement(reader);
}
 
Example 19
Source File: StandaloneXml_11.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {

    long start = System.currentTimeMillis();
    final ModelNode address = new ModelNode().setEmptyList();

    if (Element.forName(reader.getLocalName()) != Element.SERVER) {
        throw unexpectedElement(reader);
    }

    boolean validNamespace = false;
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            validNamespace = true;
            readServerElement(reader, address, operationList);
            break;
        }
    }
    if (validNamespace == false) {
        throw unexpectedElement(reader);
    }

    if (ServerLogger.ROOT_LOGGER.isDebugEnabled()) {
        long elapsed = System.currentTimeMillis() - start;
        ServerLogger.ROOT_LOGGER.debugf("Parsed standalone configuration in [%d] ms", elapsed);
    }
}
 
Example 20
Source File: StandaloneXml_12.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
        throws XMLStreamException {

    long start = System.currentTimeMillis();
    final ModelNode address = new ModelNode().setEmptyList();

    if (Element.forName(reader.getLocalName()) != Element.SERVER) {
        throw unexpectedElement(reader);
    }

    boolean validNamespace = false;
    for (Namespace current : Namespace.domainValues()) {
        if (namespace.equals(current)) {
            validNamespace = true;
            readServerElement(reader, address, operationList);
            break;
        }
    }
    if (validNamespace == false) {
        throw unexpectedElement(reader);
    }

    if (ServerLogger.ROOT_LOGGER.isDebugEnabled()) {
        long elapsed = System.currentTimeMillis() - start;
        ServerLogger.ROOT_LOGGER.debugf("Parsed standalone configuration in [%d] ms", elapsed);
    }
}