org.jboss.as.controller.parsing.Namespace.forUri()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(13.4k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.jboss.as.controller.parsing.Namespace.forUri()方法的一些代码示例,展示了Namespace.forUri()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.forUri()方法的具体详情如下:
包路径:org.jboss.as.controller.parsing.Namespace
类名称:Namespace
方法名:forUri

Namespace.forUri介绍

暂无

代码示例

代码示例来源:origin: org.wildfly.core/wildfly-controller

/**
 * Require that the namespace of the current element matches the required namespace.
 *
 * @param reader the reader
 * @param requiredNs the namespace required
 * @throws XMLStreamException if the current namespace does not match the required namespace
 */
public static void requireNamespace(final XMLExtendedStreamReader reader, final Namespace requiredNs) throws XMLStreamException {
  Namespace actualNs = Namespace.forUri(reader.getNamespaceURI());
  if (actualNs != requiredNs) {
    throw unexpectedElement(reader);
  }
}

代码示例来源:origin: wildfly/wildfly-core

/**
 * Require that the namespace of the current element matches the required namespace.
 *
 * @param reader the reader
 * @param requiredNs the namespace required
 * @throws XMLStreamException if the current namespace does not match the required namespace
 */
public static void requireNamespace(final XMLExtendedStreamReader reader, final Namespace requiredNs) throws XMLStreamException {
  Namespace actualNs = Namespace.forUri(reader.getNamespaceURI());
  if (actualNs != requiredNs) {
    throw unexpectedElement(reader);
  }
}

代码示例来源:origin: org.jboss.as/jboss-as-controller

/**
 * Require that the namespace of the current element matches the required namespace.
 *
 * @param reader the reader
 * @param requiredNs the namespace required
 * @throws XMLStreamException if the current namespace does not match the required namespace
 */
public static void requireNamespace(final XMLExtendedStreamReader reader, final Namespace requiredNs) throws XMLStreamException {
  Namespace actualNs = Namespace.forUri(reader.getNamespaceURI());
  if (actualNs != requiredNs) {
    throw unexpectedElement(reader);
  }
}

代码示例来源:origin: org.wildfly/wildfly-controller

/**
 * Require that the namespace of the current element matches the required namespace.
 *
 * @param reader the reader
 * @param requiredNs the namespace required
 * @throws XMLStreamException if the current namespace does not match the required namespace
 */
public static void requireNamespace(final XMLExtendedStreamReader reader, final Namespace requiredNs) throws XMLStreamException {
  Namespace actualNs = Namespace.forUri(reader.getNamespaceURI());
  if (actualNs != requiredNs) {
    throw unexpectedElement(reader);
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-controller

/**
 * A variation of nextElement that verifies the nextElement is not in a different namespace.
 *
 * @param reader the XmlExtendedReader to read from.
 * @param expectedNamespace the namespace expected.
 * @return the element or null if the end is reached
 * @throws XMLStreamException if the namespace is wrong or there is a problem accessing the reader
 */
public static Element nextElement(XMLExtendedStreamReader reader, Namespace expectedNamespace) throws XMLStreamException {
  Element element = nextElement(reader);
  if (element == null) {
    return element;
  } else if (element != Element.UNKNOWN
      && expectedNamespace.equals(Namespace.forUri(reader.getNamespaceURI()))) {
    return element;
  }
  throw unexpectedElement(reader);
}

代码示例来源:origin: org.wildfly/wildfly-controller

/**
 * A variation of nextElement that verifies the nextElement is not in a different namespace.
 *
 * @param reader the XmlExtendedReader to read from.
 * @param expectedNamespace the namespace expected.
 * @return the element or null if the end is reached
 * @throws XMLStreamException if the namespace is wrong or there is a problem accessing the reader
 */
public static Element nextElement(XMLExtendedStreamReader reader, Namespace expectedNamespace) throws XMLStreamException {
  Element element = nextElement(reader);
  if (element == null) {
    return element;
  } else if (element != Element.UNKNOWN
      && expectedNamespace.equals(Namespace.forUri(reader.getNamespaceURI()))) {
    return element;
  }
  throw unexpectedElement(reader);
}

代码示例来源:origin: org.jboss.as/jboss-as-controller

/**
 * A variation of nextElement that verifies the nextElement is not in a different namespace.
 *
 * @param reader the XmlExtendedReader to read from.
 * @param expectedNamespace the namespace expected.
 * @return the element or null if the end is reached
 * @throws XMLStreamException if the namespace is wrong or there is a problem accessing the reader
 */
public static Element nextElement(XMLExtendedStreamReader reader, Namespace expectedNamespace) throws XMLStreamException {
  Element element = nextElement(reader);
  if (element == null) {
    return element;
  } else if (element != Element.UNKNOWN
      && expectedNamespace.equals(Namespace.forUri(reader.getNamespaceURI()))) {
    return element;
  }
  throw unexpectedElement(reader);
}

代码示例来源:origin: wildfly/wildfly-core

/**
 * A variation of nextElement that verifies the nextElement is not in a different namespace.
 *
 * @param reader the XmlExtendedReader to read from.
 * @param expectedNamespace the namespace expected.
 * @return the element or null if the end is reached
 * @throws XMLStreamException if the namespace is wrong or there is a problem accessing the reader
 */
public static Element nextElement(XMLExtendedStreamReader reader, Namespace expectedNamespace) throws XMLStreamException {
  Element element = nextElement(reader);
  if (element == null) {
    return element;
  } else if (element != Element.UNKNOWN
      && expectedNamespace.equals(Namespace.forUri(reader.getNamespaceURI()))) {
    return element;
  }
  throw unexpectedElement(reader);
}

代码示例来源:origin: org.jboss.as/jboss-as-host-controller

@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(), readerNS, nodes);
      break;
    }
    case DOMAIN_1_1:
    case DOMAIN_1_2:
      readDomainElement1_1(reader, new ModelNode(), readerNS, nodes);
      break;
    case DOMAIN_1_3:
      readDomainElement1_3(reader, new ModelNode(), readerNS, nodes);
      break;
    case DOMAIN_1_4: {
      readDomainElement1_4(reader, new ModelNode(), readerNS, nodes);
      break;
    }
    default: {
      throw unexpectedElement(reader);
    }
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-subsystem-test-framework

final Map<String, List<ModelNode>> profileOps = new LinkedHashMap<String, List<ModelNode>>();
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
  if (Namespace.forUri(reader.getNamespaceURI()) != Namespace.UNKNOWN) {
    throw unexpectedElement(reader);

代码示例来源:origin: org.jboss.as/jboss-as-appclient

public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
    throws XMLStreamException {
  final ModelNode address = new ModelNode().setEmptyList();
  if (Element.forName(reader.getLocalName()) != Element.SERVER) {
    throw unexpectedElement(reader);
  }
  Namespace readerNS = Namespace.forUri(reader.getNamespaceURI());
  switch (readerNS) {
    case DOMAIN_1_0: {
      readServerElement_1_0(reader, address, operationList);
      break;
    }
    case DOMAIN_1_1:
    case DOMAIN_1_2:
    case DOMAIN_1_3:
    case DOMAIN_1_4:{
      readServerElement_1_1(readerNS, reader, address, operationList);
      break;
    }
    default: {
     throw unexpectedElement(reader);
    }
  }
}

代码示例来源:origin: org.jboss.as/jboss-as-host-controller

@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());
  switch (readerNS) {
    case DOMAIN_1_0: {
      readHostElement_1_0(reader, address, operationList);
      break;
    }
    case DOMAIN_1_1:
    case DOMAIN_1_2:
    case DOMAIN_1_3:
    case DOMAIN_1_4:{
      readHostElement_1_1(readerNS, reader, address, operationList);
      break;
    }
    default: {
      throw unexpectedElement(reader);
    }
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-host-controller

private void readDomainElementAttributes_1_0(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException {
  final int count = reader.getAttributeCount();
  for (int i = 0; i < count; i++) {
    switch (Namespace.forUri(reader.getAttributeNamespace(i))) {
      case XML_SCHEMA_INSTANCE: {
        switch (Attribute.forName(reader.getAttributeLocalName(i))) {
          case SCHEMA_LOCATION: {
            parseSchemaLocations(reader, address, list, i);
            break;
          }
          case NO_NAMESPACE_SCHEMA_LOCATION: {
            // todo, jeez
            break;
          }
          default: {
            throw unexpectedAttribute(reader, i);
          }
        }
        break;
      }
      default:
        throw unexpectedAttribute(reader, i);
    }
  }
}

代码示例来源:origin: org.jboss.as/jboss-as-host-controller

protected void readDomainElementAttributes_1_0(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException {
  final int count = reader.getAttributeCount();
  for (int i = 0; i < count; i++) {
    switch (Namespace.forUri(reader.getAttributeNamespace(i))) {
      case XML_SCHEMA_INSTANCE: {
        switch (Attribute.forName(reader.getAttributeLocalName(i))) {
          case SCHEMA_LOCATION: {
            parseSchemaLocations(reader, address, list, i);
            break;
          }
          case NO_NAMESPACE_SCHEMA_LOCATION: {
            // todo, jeez
            break;
          }
          default: {
            throw unexpectedAttribute(reader, i);
          }
        }
        break;
      }
      default:
        throw unexpectedAttribute(reader, i);
    }
  }
}

代码示例来源:origin: wildfly/wildfly-core

private void readDomainElementAttributes_1_0(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException {
  final int count = reader.getAttributeCount();
  for (int i = 0; i < count; i++) {
    switch (Namespace.forUri(reader.getAttributeNamespace(i))) {
      case XML_SCHEMA_INSTANCE: {
        switch (Attribute.forName(reader.getAttributeLocalName(i))) {
          case SCHEMA_LOCATION: {
            parseSchemaLocations(reader, address, list, i);
            break;
          }
          case NO_NAMESPACE_SCHEMA_LOCATION: {
            // todo, jeez
            break;
          }
          default: {
            throw unexpectedAttribute(reader, i);
          }
        }
        break;
      }
      default:
        throw unexpectedAttribute(reader, i);
    }
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-host-controller

@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);
  }
}

代码示例来源:origin: wildfly/wildfly-core

@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);
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-server

@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
    throws XMLStreamException {
  Namespace readerNS = Namespace.forUri(reader.getNamespaceURI());
  switch (readerNS.getMajorVersion()) {
    case 1:

代码示例来源:origin: org.wildfly.core/wildfly-host-controller

@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> nodes) throws XMLStreamException {
  Namespace readerNS = Namespace.forUri(reader.getNamespaceURI());
  switch (readerNS.getMajorVersion()) {
    case 1:
    case 2:
    case 3:
      new DomainXml_Legacy(extensionXml, extensionRegistry, readerNS).readElement(reader, nodes);
      break;
    case 4:
      new DomainXml_4(extensionXml, extensionRegistry, readerNS).readElement(reader, nodes);
      break;
    case 5:
      new DomainXml_5(extensionXml, extensionRegistry, readerNS).readElement(reader, nodes);
      break;
    case 6:
      new DomainXml_6(extensionXml, extensionRegistry, readerNS).readElement(reader, nodes);
      break;
    case 7:
      new DomainXml_7(extensionXml, extensionRegistry, readerNS).readElement(reader, nodes);
      break;
    case 8:
      new DomainXml_8(extensionXml, extensionRegistry, readerNS).readElement(reader, nodes);
      break;
    default:
      new DomainXml_9(extensionXml, extensionRegistry, readerNS).readElement(reader, nodes);
      break;
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-host-controller

@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList)
    throws XMLStreamException {
  Namespace readerNS = Namespace.forUri(reader.getNamespaceURI());
  switch (readerNS.getMajorVersion()) {
    case 1:
    case 2:
    case 3:
      new HostXml_Legacy(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, readerNS).readElement(reader, operationList);
      break;
    case 4:
      new HostXml_4(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, readerNS).readElement(reader, operationList);
      break;
    case 5:
      new HostXml_5(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, readerNS).readElement(reader, operationList);
      break;
    case 6:
      new HostXml_6(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, readerNS).readElement(reader, operationList);
      break;
    case 7:
      new HostXml_7(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, readerNS).readElement(reader, operationList);
      break;
    case 8:
      new HostXml_8(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, readerNS).readElement(reader, operationList);
      break;
    default:
      new HostXml_9(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, readerNS).readElement(reader, operationList);
      break;
  }
}

相关文章