Java Code Examples for org.jboss.as.controller.persistence.SubsystemMarshallingContext#getModelNode()
The following examples show how to use
org.jboss.as.controller.persistence.SubsystemMarshallingContext#getModelNode() .
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 |
@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: BpmPlatformParser.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected void writeJobExecutorContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException { ModelNode node = context.getModelNode(); ModelNode jobExecutorNode = node.get(Element.JOB_EXECUTOR.getLocalName()); if (jobExecutorNode.isDefined()) { writer.writeStartElement(Element.JOB_EXECUTOR.getLocalName()); for (Property property : jobExecutorNode.asPropertyList()) { ModelNode propertyValue = property.getValue(); for (AttributeDefinition jobExecutorAttribute : SubsystemAttributeDefinitons.JOB_EXECUTOR_ATTRIBUTES) { if (jobExecutorAttribute.equals(SubsystemAttributeDefinitons.NAME)) { ((SimpleAttributeDefinition) jobExecutorAttribute).marshallAsAttribute(propertyValue, writer); } else { jobExecutorAttribute.marshallAsElement(propertyValue, writer); } } writeJobAcquisitionsContent(writer, context, propertyValue); } // end job-executor writer.writeEndElement(); } }
Example 3
Source File: BpmPlatformParser1_1.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected void writeJobExecutorContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException { ModelNode node = context.getModelNode(); ModelNode jobExecutorNode = node.get(Element.JOB_EXECUTOR.getLocalName()); if (jobExecutorNode.isDefined()) { writer.writeStartElement(Element.JOB_EXECUTOR.getLocalName()); for (Property property : jobExecutorNode.asPropertyList()) { ModelNode propertyValue = property.getValue(); for (AttributeDefinition jobExecutorAttribute : SubsystemAttributeDefinitons.JOB_EXECUTOR_ATTRIBUTES) { if (jobExecutorAttribute.equals(SubsystemAttributeDefinitons.NAME)) { ((SimpleAttributeDefinition) jobExecutorAttribute).marshallAsAttribute(propertyValue, writer); } else { jobExecutorAttribute.marshallAsElement(propertyValue, writer); } } writeJobAcquisitionsContent(writer, context, propertyValue); } // end job-executor writer.writeEndElement(); } }
Example 4
Source File: GmlcSubsystemParser.java From gmlc with GNU Affero General Public License v3.0 | 5 votes |
/** * {@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 5
Source File: OrderedChildResourceExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@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 6
Source File: LoggingSubsystemWriter.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@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 7
Source File: DeploymentScannerParser_1_1.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@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: DeploymentScannerParser_2_0.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@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); DeploymentScannerDefinition.RUNTIME_FAILURE_CAUSES_ROLLBACK.marshallAsAttribute(configuration, writer); } writer.writeEndElement(); } }
Example 9
Source File: ThreadsParser.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@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 10
Source File: BpmPlatformParser.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void writeProcessEnginesContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException { writer.writeStartElement(Element.PROCESS_ENGINES.getLocalName()); ModelNode node = context.getModelNode(); ModelNode processEngineConfigurations = node.get(Element.PROCESS_ENGINES.getLocalName()); if (processEngineConfigurations.isDefined()) { for (Property property : processEngineConfigurations.asPropertyList()) { // write each child element to xml writer.writeStartElement(Element.PROCESS_ENGINE.getLocalName()); ModelNode propertyValue = property.getValue(); for (AttributeDefinition processEngineAttribute : SubsystemAttributeDefinitons.PROCESS_ENGINE_ATTRIBUTES) { if (processEngineAttribute.equals(SubsystemAttributeDefinitons.NAME) || processEngineAttribute.equals(SubsystemAttributeDefinitons.DEFAULT)) { ((SimpleAttributeDefinition) processEngineAttribute).marshallAsAttribute(propertyValue, writer); } else { processEngineAttribute.marshallAsElement(propertyValue, writer); } } writer.writeEndElement(); } } // end process-engines writer.writeEndElement(); }
Example 11
Source File: BpmPlatformParser1_1.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void writeProcessEnginesContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException { writer.writeStartElement(Element.PROCESS_ENGINES.getLocalName()); ModelNode node = context.getModelNode(); ModelNode processEngineConfigurations = node.get(Element.PROCESS_ENGINES.getLocalName()); if (processEngineConfigurations.isDefined()) { for (Property property : processEngineConfigurations.asPropertyList()) { // write each child element to xml writer.writeStartElement(Element.PROCESS_ENGINE.getLocalName()); ModelNode propertyValue = property.getValue(); for (AttributeDefinition processEngineAttribute : SubsystemAttributeDefinitons.PROCESS_ENGINE_ATTRIBUTES) { if (processEngineAttribute.equals(SubsystemAttributeDefinitons.NAME) || processEngineAttribute.equals(SubsystemAttributeDefinitons.DEFAULT)) { ((SimpleAttributeDefinition) processEngineAttribute).marshallAsAttribute(propertyValue, writer); } else { processEngineAttribute.marshallAsElement(propertyValue, writer); } } writer.writeEndElement(); } } // end process-engines writer.writeEndElement(); }
Example 12
Source File: JMXExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
/** * {@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 13
Source File: DeploymentScannerParser_1_0.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
/** {@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()) { writer.writeEmptyElement(CommonAttributes.DEPLOYMENT_SCANNER); writer.writeAttribute(CommonAttributes.NAME, scanner.getName()); ModelNode configuration = scanner.getValue(); if (configuration.hasDefined(PATH)) { writer.writeAttribute(PATH, configuration.get(PATH) .asString()); } if (configuration.hasDefined(CommonAttributes.SCAN_ENABLED)) { writer.writeAttribute(CommonAttributes.SCAN_ENABLED, configuration.get(CommonAttributes.SCAN_ENABLED).asString()); } if (configuration.hasDefined(CommonAttributes.SCAN_INTERVAL)) { writer.writeAttribute(CommonAttributes.SCAN_INTERVAL, configuration.get(CommonAttributes.SCAN_INTERVAL).asString()); } if (configuration.hasDefined(CommonAttributes.RELATIVE_TO)) { writer.writeAttribute(CommonAttributes.RELATIVE_TO, configuration.get(CommonAttributes.RELATIVE_TO).asString()); } if (configuration.hasDefined(CommonAttributes.AUTO_DEPLOY_ZIPPED)) { if (!configuration.get(CommonAttributes.AUTO_DEPLOY_ZIPPED).asBoolean()) { writer.writeAttribute(CommonAttributes.AUTO_DEPLOY_ZIPPED, Boolean.FALSE.toString()); } } if (configuration.hasDefined(CommonAttributes.AUTO_DEPLOY_EXPLODED)) { if (configuration.get(CommonAttributes.AUTO_DEPLOY_EXPLODED).asBoolean()) { writer.writeAttribute(CommonAttributes.AUTO_DEPLOY_EXPLODED, Boolean.TRUE.toString()); } } if (configuration.hasDefined(CommonAttributes.DEPLOYMENT_TIMEOUT)) { writer.writeAttribute(CommonAttributes.DEPLOYMENT_TIMEOUT, configuration.get(CommonAttributes.DEPLOYMENT_TIMEOUT).asString()); } } writer.writeEndElement(); } }