private void writeProfiles(final XMLExtendedStreamWriter writer, final ModelNode model) throws XMLStreamException { final List<Property> profiles = model.get(REMOTING_PROFILE).asPropertyList(); for (final Property property : profiles) { writer.writeStartElement(PROFILE); writer.writeAttribute(EJB3SubsystemXMLAttribute.NAME.getLocalName(), property.getName()); final ModelNode profileNode = property.getValue(); RemotingProfileResourceDefinition.EXCLUDE_LOCAL_RECEIVER.marshallAsAttribute(profileNode, writer); RemotingProfileResourceDefinition.LOCAL_RECEIVER_PASS_BY_VALUE.marshallAsAttribute(profileNode, writer); if(profileNode.hasDefined(REMOTING_EJB_RECEIVER)){ writeRemotingEjbReceivers(writer, profileNode); } StaticEJBDiscoveryDefinition.INSTANCE.marshallAsElement(profileNode, writer); writer.writeEndElement(); } }
/** * {@inheritDoc} */ @Override public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException { context.startSubsystemElement(Namespace.CURRENT.getUriString(), false); ModelNode eeSubSystem = context.getModelNode(); GlobalModulesDefinition.INSTANCE.marshallAsElement(eeSubSystem, writer); EeSubsystemRootResource.EAR_SUBDEPLOYMENTS_ISOLATED.marshallAsElement(eeSubSystem, writer); EeSubsystemRootResource.SPEC_DESCRIPTOR_PROPERTY_REPLACEMENT.marshallAsElement(eeSubSystem, writer); EeSubsystemRootResource.JBOSS_DESCRIPTOR_PROPERTY_REPLACEMENT.marshallAsElement(eeSubSystem, writer); EeSubsystemRootResource.ANNOTATION_PROPERTY_REPLACEMENT.marshallAsElement(eeSubSystem, writer); writeConcurrentElement(writer,eeSubSystem); writeDefaultBindingsElement(writer,eeSubSystem); writer.writeEndElement(); }
((SimpleAttributeDefinition) JcaDistributedWorkManagerDefinition.DWmParameters.NAME.getAttribute()).marshallAsAttribute(workManager, writer); JcaDistributedWorkManagerDefinition.DWmParameters.ELYTRON_ENABLED.getAttribute().marshallAsElement(workManager, writer);
@Override public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (attribute instanceof ObjectListAttributeDefinition) { attribute = getValueType(attribute, ObjectListAttributeDefinition.class); } if (!(attribute instanceof ObjectTypeAttributeDefinition)) { throw new XMLStreamException( String.format("Attribute of class %s is expected, but %s received", "ObjectTypeAttributeDefinition", attribute.getClass().getSimpleName()) ); } AttributeDefinition[] valueTypes; valueTypes = CustomMarshaller.getValueTypes(attribute, ObjectTypeAttributeDefinition.class); writer.writeStartElement(attribute.getXmlName()); for (AttributeDefinition valueType : valueTypes) { valueType.marshallAsElement(resourceModel, marshallDefault, writer); } writer.writeEndElement(); }
@Override public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (attribute instanceof ObjectListAttributeDefinition) { attribute = getValueType(attribute, ObjectListAttributeDefinition.class); } if (!(attribute instanceof ObjectTypeAttributeDefinition)) { throw new XMLStreamException( String.format("Attribute of class %s is expected, but %s received", "ObjectTypeAttributeDefinition", attribute.getClass().getSimpleName()) ); } AttributeDefinition[] valueTypes; valueTypes = CustomMarshaller.getValueTypes(attribute, ObjectTypeAttributeDefinition.class); writer.writeStartElement(attribute.getXmlName()); for (AttributeDefinition valueType : valueTypes) { valueType.marshallAsElement(resourceModel, marshallDefault, writer); } writer.writeEndElement(); }
@Override public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (attribute instanceof ObjectListAttributeDefinition) { attribute = getValueType(attribute, ObjectListAttributeDefinition.class); } if (!(attribute instanceof ObjectTypeAttributeDefinition)) { throw new XMLStreamException( String.format("Attribute of class %s is expected, but %s received", "ObjectTypeAttributeDefinition", attribute.getClass().getSimpleName()) ); } AttributeDefinition[] valueTypes; valueTypes = CustomMarshaller.getValueTypes(attribute, ObjectTypeAttributeDefinition.class); writer.writeStartElement(attribute.getXmlName()); for (AttributeDefinition valueType : valueTypes) { valueType.marshallAsElement(resourceModel, marshallDefault, writer); } writer.writeEndElement(); }
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(); } }
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(); } }
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(); }
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(); } }
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(); }
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(); }
protected void writeJobAcquisitionsContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context, ModelNode parentNode) throws XMLStreamException { writer.writeStartElement(Element.JOB_AQUISITIONS.getLocalName()); ModelNode jobAcquisitionConfigurations = parentNode.get(Element.JOB_AQUISITIONS.getLocalName()); if (jobAcquisitionConfigurations.isDefined()) { for (Property property : jobAcquisitionConfigurations.asPropertyList()) { // write each child element to xml writer.writeStartElement(Element.JOB_AQUISITION.getLocalName()); for (AttributeDefinition jobAcquisitionAttribute : SubsystemAttributeDefinitons.JOB_ACQUISITION_ATTRIBUTES) { if (jobAcquisitionAttribute.equals(SubsystemAttributeDefinitons.NAME)) { ((SimpleAttributeDefinition) jobAcquisitionAttribute).marshallAsAttribute(property.getValue(), writer); } else { jobAcquisitionAttribute.marshallAsElement(property.getValue(), writer); } } writer.writeEndElement(); } } // end job-acquisitions writer.writeEndElement(); } }
protected void writeJobAcquisitionsContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context, ModelNode parentNode) throws XMLStreamException { writer.writeStartElement(Element.JOB_AQUISITIONS.getLocalName()); ModelNode jobAcquisitionConfigurations = parentNode.get(Element.JOB_AQUISITIONS.getLocalName()); if (jobAcquisitionConfigurations.isDefined()) { for (Property property : jobAcquisitionConfigurations.asPropertyList()) { // write each child element to xml writer.writeStartElement(Element.JOB_AQUISITION.getLocalName()); for (AttributeDefinition jobAcquisitionAttribute : SubsystemAttributeDefinitons.JOB_ACQUISITION_ATTRIBUTES) { if (jobAcquisitionAttribute.equals(SubsystemAttributeDefinitons.NAME)) { ((SimpleAttributeDefinition) jobAcquisitionAttribute).marshallAsAttribute(property.getValue(), writer); } else { jobAcquisitionAttribute.marshallAsElement(property.getValue(), writer); } } writer.writeEndElement(); } } // end job-acquisitions writer.writeEndElement(); } }
protected void writeJobAcquisitionsContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context, ModelNode parentNode) throws XMLStreamException { writer.writeStartElement(Element.JOB_AQUISITIONS.getLocalName()); ModelNode jobAcquisitionConfigurations = parentNode.get(Element.JOB_AQUISITIONS.getLocalName()); if (jobAcquisitionConfigurations.isDefined()) { for (Property property : jobAcquisitionConfigurations.asPropertyList()) { // write each child element to xml writer.writeStartElement(Element.JOB_AQUISITION.getLocalName()); for (AttributeDefinition jobAcquisitionAttribute : SubsystemAttributeDefinitons.JOB_ACQUISITION_ATTRIBUTES) { if (jobAcquisitionAttribute.equals(SubsystemAttributeDefinitons.NAME)) { ((SimpleAttributeDefinition) jobAcquisitionAttribute).marshallAsAttribute(property.getValue(), writer); } else { jobAcquisitionAttribute.marshallAsElement(property.getValue(), writer); } } writer.writeEndElement(); } } // end job-acquisitions writer.writeEndElement(); }
/** * Marshalls the value from the given {@code resourceModel} as an xml element, if it * {@link #isMarshallable(org.jboss.dmr.ModelNode, boolean) is marshallable}. * * @param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}. * @param writer stream writer to use for writing the attribute * @throws javax.xml.stream.XMLStreamException if thrown by {@code writer} */ public void marshallAsElement(final ModelNode resourceModel, final XMLStreamWriter writer) throws XMLStreamException { marshallAsElement(resourceModel, true, writer); }
/** * Marshalls the value from the given {@code resourceModel} as an xml attribute, if it * {@link #isMarshallable(org.jboss.dmr.ModelNode, boolean) is marshallable}. * * @param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}. * @param writer stream writer to use for writing the attribute * @throws javax.xml.stream.XMLStreamException if thrown by {@code writer} */ public void marshallAsElement(final ModelNode resourceModel, final XMLStreamWriter writer) throws XMLStreamException{ marshallAsElement(resourceModel,true,writer); }
@Override public void addReport(ModelNode report) throws OperationFailedException { if (record && streamWriter != null) { try { attributeDefinition.marshallAsElement(report, true, streamWriter); } catch (XMLStreamException ex) { throw ControllerLogger.MGMT_OP_LOGGER.failedToBuildReport(ex); } } }
@Override public void addReport(ModelNode report) throws OperationFailedException { if (record && streamWriter != null) { try { attributeDefinition.marshallAsElement(report, true, streamWriter); } catch (XMLStreamException ex) { throw ControllerLogger.MGMT_OP_LOGGER.failedToBuildReport(ex); } } }
@Override public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (resourceModel.hasDefined(attribute.getName())) { writer.writeStartElement(attribute.getXmlName()); for (ModelNode handler : resourceModel.get(attribute.getName()).asList()) { valueType.marshallAsElement(handler, writer); } writer.writeEndElement(); } } };