コード例 #1
0
 @Override
 public void writeContent(XMLExtendedStreamWriter writer, ModelMarshallingContext context)
     throws XMLStreamException {
   String defaultNamespace =
       writer.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
   try {
     ModelNode subsystem = context.getModelNode().get(SUBSYSTEM, mainSubsystemName);
     XMLElementWriter<SubsystemMarshallingContext> subsystemWriter =
         context.getSubsystemWriter(mainSubsystemName);
     if (subsystemWriter != null) {
       subsystemWriter.writeContent(writer, new SubsystemMarshallingContext(subsystem, writer));
     }
   } finally {
     writer.setDefaultNamespace(defaultNamespace);
   }
   writer.writeEndDocument();
 }
コード例 #2
0
ファイル: DomainXml.java プロジェクト: rodzyn0688/jboss-as
  private void writeProfile(
      final XMLExtendedStreamWriter writer,
      final String profileName,
      final ModelNode profileNode,
      final ModelMarshallingContext context)
      throws XMLStreamException {

    writer.writeStartElement(Element.PROFILE.getLocalName());
    writer.writeAttribute(Attribute.NAME.getLocalName(), profileName);

    if (profileNode.hasDefined(INCLUDES)) {
      for (final ModelNode include : profileNode.get(INCLUDES).asList()) {
        writer.writeEmptyElement(INCLUDE);
        writer.writeAttribute(PROFILE, include.asString());
      }
    }
    if (profileNode.hasDefined(SUBSYSTEM)) {
      final Set<String> subsystemNames = profileNode.get(SUBSYSTEM).keys();
      if (subsystemNames.size() > 0) {
        String defaultNamespace =
            writer.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
        for (String subsystemName : subsystemNames) {
          try {
            ModelNode subsystem = profileNode.get(SUBSYSTEM, subsystemName);
            XMLElementWriter<SubsystemMarshallingContext> subsystemWriter =
                context.getSubsystemWriter(subsystemName);
            if (subsystemWriter
                != null) { // FIXME -- remove when extensions are doing the registration
              subsystemWriter.writeContent(
                  writer, new SubsystemMarshallingContext(subsystem, writer));
            }
          } finally {
            writer.setDefaultNamespace(defaultNamespace);
          }
        }
      }
    }
    writer.writeEndElement();
  }
コード例 #3
0
ファイル: TestParser.java プロジェクト: nandhraj/jboss-as
  @Override
  public void writeContent(XMLExtendedStreamWriter writer, ModelMarshallingContext context)
      throws XMLStreamException {

    String defaultNamespace =
        writer.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
    try {
      ModelNode subsystem = context.getModelNode().get(SUBSYSTEM, mainSubsystemName);
      if (subsystem.isDefined()) {
        // We might have been removed
        XMLElementWriter<SubsystemMarshallingContext> subsystemWriter =
            context.getSubsystemWriter(mainSubsystemName);
        if (subsystemWriter != null) {
          subsystemWriter.writeContent(writer, new SubsystemMarshallingContext(subsystem, writer));
        }
      }
    } catch (Throwable t) {
      Assert.fail("could not marshal subsystem xml " + t);
    } finally {
      writer.setDefaultNamespace(defaultNamespace);
    }
    writer.writeEndDocument();
  }