コード例 #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
ファイル: 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();
  }
コード例 #3
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();
  }
コード例 #4
0
ファイル: DomainXml.java プロジェクト: rodzyn0688/jboss-as
  @Override
  public void writeContent(
      final XMLExtendedStreamWriter writer, final ModelMarshallingContext context)
      throws XMLStreamException {
    ModelNode modelNode = context.getModelNode();

    writer.writeStartDocument();
    writer.writeStartElement(Element.DOMAIN.getLocalName());

    writer.writeDefaultNamespace(Namespace.CURRENT.getUriString());
    writeNamespaces(writer, modelNode);
    writeSchemaLocation(writer, modelNode);

    DomainAttributes.NAME.marshallAsAttribute(modelNode, false, writer);

    writeNewLine(writer);

    if (modelNode.hasDefined(EXTENSION)) {
      extensionXml.writeExtensions(writer, modelNode.get(EXTENSION));
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(SYSTEM_PROPERTY)) {
      writeProperties(writer, modelNode.get(SYSTEM_PROPERTY), Element.SYSTEM_PROPERTIES, false);
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(PATH)) {
      writePaths(writer, modelNode.get(PATH));
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(PROFILE)) {
      writer.writeStartElement(Element.PROFILES.getLocalName());
      for (final Property profile : modelNode.get(PROFILE).asPropertyList()) {
        writeProfile(writer, profile.getName(), profile.getValue(), context);
      }
      writer.writeEndElement();
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(INTERFACE)) {
      writeInterfaces(writer, modelNode.get(INTERFACE));
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(SOCKET_BINDING_GROUP)) {
      writer.writeStartElement(Element.SOCKET_BINDING_GROUPS.getLocalName());
      for (final Property property : modelNode.get(SOCKET_BINDING_GROUP).asPropertyList()) {
        writeSocketBindingGroup(writer, property.getValue(), false);
      }
      writer.writeEndElement();
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(DEPLOYMENT)) {
      writeDomainDeployments(writer, modelNode.get(DEPLOYMENT));
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(SERVER_GROUP)) {
      writer.writeStartElement(Element.SERVER_GROUPS.getLocalName());
      for (final Property property : modelNode.get(SERVER_GROUP).asPropertyList()) {
        writeServerGroup(writer, property.getName(), property.getValue());
      }
      writer.writeEndElement();
      writeNewLine(writer);
    }
    if (modelNode.hasDefined(MANAGEMENT_CLIENT_CONTENT)) {
      writeManagementClientContent(writer, modelNode.get(MANAGEMENT_CLIENT_CONTENT));
      writeNewLine(writer);
    }

    writer.writeEndElement();
    writeNewLine(writer);
    writer.writeEndDocument();
  }