Java Code Examples for org.jboss.as.controller.persistence.SubsystemMarshallingContext#startSubsystemElement()

The following examples show how to use org.jboss.as.controller.persistence.SubsystemMarshallingContext#startSubsystemElement() . 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: CamelSubsystemWriter.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
    ModelNode node = context.getModelNode();

    if (node.hasDefined(ModelConstants.CONTEXT)) {
        ModelNode properties = node.get(ModelConstants.CONTEXT);
        for (String key : new TreeSet<String>(properties.keys())) {
            String val = properties.get(key).get(ModelConstants.VALUE).asString();
            writer.writeStartElement(Element.CAMEL_CONTEXT.getLocalName());
            writer.writeAttribute(Attribute.ID.getLocalName(), key);
            writer.writeCharacters(val);
            writer.writeEndElement();
        }
    }

    writer.writeEndElement();
}
 
Example 2
Source File: BpmPlatformParser1_1.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
  context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);

  writeProcessEnginesContent(writer, context);
  writeJobExecutorContent(writer, context);

  // end subsystem
  writer.writeEndElement();
}
 
Example 3
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(KeycloakExtension.NAMESPACE, false);
    writeRealms(writer, context);
    writeSecureDeployments(writer, context);
    writeSecureServers(writer, context);
    writer.writeEndElement();
}
 
Example 4
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(KeycloakSamlExtension.CURRENT_NAMESPACE, false);
    writeSecureDeployment(writer, context.getModelNode());
    writer.writeEndElement();
}
 
Example 5
Source File: ThreadsParser.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context)
        throws XMLStreamException {
    context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
    ModelNode node = context.getModelNode();
    writeThreadsElement(writer, node);
    writer.writeEndElement();
}
 
Example 6
Source File: GmlcSubsystemParser.java    From gmlc with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
  context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);

  final ModelNode node = context.getModelNode();
  final ModelNode mbean = node.get(GmlcMbeanDefinition.MBEAN);

  for (Property mbeanProp : mbean.asPropertyList()) {
    writer.writeStartElement(GmlcMbeanDefinition.MBEAN);

    final ModelNode mbeanEntry = mbeanProp.getValue();

    GmlcMbeanDefinition.NAME_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
    GmlcMbeanDefinition.TYPE_ATTR.marshallAsAttribute(mbeanEntry, true, writer);

    final ModelNode property = mbeanEntry.get(GmlcMbeanPropertyDefinition.PROPERTY);
    if (property != null && property.isDefined()) {
      for (Property propertyProp : property.asPropertyList()) {
        writer.writeStartElement(GmlcMbeanPropertyDefinition.PROPERTY);

        final ModelNode propertyEntry = propertyProp.getValue();

        GmlcMbeanPropertyDefinition.NAME_ATTR.marshallAsAttribute(propertyEntry, true, writer);
        GmlcMbeanPropertyDefinition.TYPE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
        GmlcMbeanPropertyDefinition.VALUE_ATTR.marshallAsAttribute(propertyEntry, true, writer);

        writer.writeEndElement();
      }
    }

    writer.writeEndElement();
  }

  writer.writeEndElement();
}
 
Example 7
Source File: DeploymentScannerParser_1_1.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@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);
        }
        writer.writeEndElement();
    }
}
 
Example 8
Source File: LoggingSubsystemWriter.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);

    ModelNode model = context.getModelNode();

    // Marshall attributes
    for (AttributeDefinition attribute : LoggingResourceDefinition.ATTRIBUTES) {
        attribute.marshallAsElement(model, false, writer);
    }

    writeContent(writer, model);

    if (model.hasDefined(LOGGING_PROFILE)) {
        final List<Property> profiles = model.get(LOGGING_PROFILE).asPropertyList();
        if (!profiles.isEmpty()) {
            writer.writeStartElement(LOGGING_PROFILES);
            for (Property profile : profiles) {
                final String name = profile.getName();
                writer.writeStartElement(LOGGING_PROFILE);
                writer.writeAttribute(Attribute.NAME.getLocalName(), name);
                writeContent(writer, profile.getValue());
                writer.writeEndElement();
            }
            writer.writeEndElement();
        }
    }
    writer.writeEndElement();
}
 
Example 9
Source File: OrderedChildResourceExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context)
        throws XMLStreamException {
    context.startSubsystemElement(OrderedChildResourceExtension.NAMESPACE, false);
    final ModelNode node = context.getModelNode();
    if (node.hasDefined("child")) {
        for (Property prop : node.get("child").asPropertyList()) {
            writer.writeStartElement("child");
            writer.writeAttribute("name", prop.getName());
            writer.writeEndElement();
        }
    }
    writer.writeEndElement();
}
 
Example 10
Source File: JMXExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    Namespace schemaVer = Namespace.CURRENT;
    final ModelNode node = context.getModelNode();

    context.startSubsystemElement(schemaVer.getUriString(), false);
    if (node.hasDefined(CommonAttributes.EXPOSE_MODEL)) {
        ModelNode showModel = node.get(CommonAttributes.EXPOSE_MODEL);
        if (showModel.hasDefined(CommonAttributes.RESOLVED)) {
            writer.writeEmptyElement(CommonAttributes.EXPOSE_RESOLVED_MODEL);
            ExposeModelResourceResolved.DOMAIN_NAME.marshallAsAttribute(showModel.get(CommonAttributes.RESOLVED), false, writer);
            ExposeModelResourceResolved.PROPER_PROPERTY_FORMAT.marshallAsAttribute(showModel.get(CommonAttributes.RESOLVED), false, writer);
        }
        if (showModel.hasDefined(CommonAttributes.EXPRESSION)) {
            writer.writeEmptyElement(CommonAttributes.EXPOSE_EXPRESSION_MODEL);
            ExposeModelResourceExpression.DOMAIN_NAME.marshallAsAttribute(showModel.get(CommonAttributes.EXPRESSION), false, writer);
        }
    }
    if (node.hasDefined(CommonAttributes.REMOTING_CONNECTOR)) {
        writer.writeStartElement(CommonAttributes.REMOTING_CONNECTOR);
        final ModelNode resourceModel = node.get(CommonAttributes.REMOTING_CONNECTOR).get(CommonAttributes.JMX);
        RemotingConnectorResource.USE_MANAGEMENT_ENDPOINT.marshallAsAttribute(resourceModel, writer);
        writer.writeEndElement();
    }

    if (node.hasDefined(JmxAuditLoggerResourceDefinition.PATH_ELEMENT.getKey()) &&
            node.get(JmxAuditLoggerResourceDefinition.PATH_ELEMENT.getKey()).hasDefined(JmxAuditLoggerResourceDefinition.PATH_ELEMENT.getValue())) {
        ModelNode auditLog = node.get(JmxAuditLoggerResourceDefinition.PATH_ELEMENT.getKey(), JmxAuditLoggerResourceDefinition.PATH_ELEMENT.getValue());
        writer.writeStartElement(CommonAttributes.AUDIT_LOG);
        JmxAuditLoggerResourceDefinition.LOG_BOOT.marshallAsAttribute(auditLog, writer);
        JmxAuditLoggerResourceDefinition.LOG_READ_ONLY.marshallAsAttribute(auditLog, writer);
        JmxAuditLoggerResourceDefinition.ENABLED.marshallAsAttribute(auditLog, writer);

        if (auditLog.hasDefined(HANDLER) && auditLog.get(HANDLER).keys().size() > 0) {
            writer.writeStartElement(CommonAttributes.HANDLERS);
            for (String key : auditLog.get(HANDLER).keys()) {
                writer.writeEmptyElement(CommonAttributes.HANDLER);
                writer.writeAttribute(CommonAttributes.NAME, key);
            }
            writer.writeEndElement();
        }

        writer.writeEndElement();
    }
    if (node.hasDefined(JMXSubsystemRootResource.CORE_MBEAN_SENSITIVITY.getName())) {
        writer.writeStartElement(CommonAttributes.SENSITIVITY);
        JMXSubsystemRootResource.CORE_MBEAN_SENSITIVITY.marshallAsAttribute(node, writer);
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
 
Example 11
Source File: SubsystemInitialization.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter streamWriter, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(namespace, false);
    streamWriter.writeEndElement();
}
 
Example 12
Source File: ValidateSubsystemExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(ValidateSubsystemExtension.NAMESPACE, false);
    writer.writeEndElement();
}
 
Example 13
Source File: TestVaultParser.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter streamWriter,
        SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(NAMESPACE, true);
}
 
Example 14
Source File: NewExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter streamWriter, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(namespace, false);
    streamWriter.writeEndElement();
}
 
Example 15
Source File: MainSubsystemExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(MainSubsystemExtension.NAMESPACE, false);
    writer.writeEndElement();
}
 
Example 16
Source File: DependencySubsystemExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(DependencySubsystemExtension.NAMESPACE, false);
    writer.writeEndElement();
}
 
Example 17
Source File: CliExtCommandsParser.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter streamWriter,
        SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(NAMESPACE, true);
}
 
Example 18
Source File: SimpleSubsystemExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(SimpleSubsystemExtension.NAMESPACE, false);
    writer.writeEndElement();
}
 
Example 19
Source File: EmptySubsystemParser.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void writeContent(XMLExtendedStreamWriter streamWriter, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(namespace, false);
    streamWriter.writeEndElement();
}
 
Example 20
Source File: BpmPlatformParser.java    From camunda-bpm-platform with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {

  context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
  
  writeProcessEnginesContent(writer, context);
  
  writeJobExecutorContent(writer, context);
  
  // end subsystem
  writer.writeEndElement();
}