private static void writeAttribute(XMLExtendedStreamWriter writer, ModelNode model, AttributeDefinition attribute) throws XMLStreamException { attribute.getAttributeMarshaller().marshallAsAttribute(attribute, model, true, writer); } }
private static void writeElement(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsElement(attribute.getDefinition(), model, true, writer); } }
@Override public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (resourceModel.isDefined()) { writer.writeEmptyElement(EJB3SubsystemXMLElement.MODULE.getLocalName()); for (SimpleAttributeDefinition valueType : VALUE_TYPE_FIELDS) { valueType.getAttributeMarshaller().marshall(valueType, resourceModel, true, writer); } } } };
public void marshall(final AttributeDefinition attribute,final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (isMarshallableAsElement()){ marshallAsElement(attribute,resourceModel, marshallDefault, writer); }else{ marshallAsAttribute(attribute, resourceModel, marshallDefault, writer); } }
void writeKeys(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException { if (!model.isDefined()) { return; } boolean contains = false; for (Property key : model.asPropertyList()) { if (!contains) { writer.writeStartElement(Constants.XML.KEYS); contains = true; } writer.writeStartElement(Constants.XML.KEY); ModelNode keyAttributes = key.getValue(); for (SimpleAttributeDefinition attr : KeyDefinition.ATTRIBUTES) { attr.getAttributeMarshaller().marshallAsAttribute(attr, keyAttributes, false, writer); } for (SimpleAttributeDefinition attr : KeyDefinition.ELEMENTS) { attr.getAttributeMarshaller().marshallAsElement(attr, keyAttributes, false, writer); } writeKeyStore(writer, keyAttributes.get(Constants.Model.KEY_STORE)); writer.writeEndElement(); } if (contains) { writer.writeEndElement(); } }
@Override public void marshallAsElement(ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (attributeMarshaller.isMarshallable(this,resourceModel,marshallDefault)){ attributeMarshaller.marshallAsElement(this, resourceModel, marshallDefault, writer); } }
/** * 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 marshallDefault {@code true} if the value should be marshalled even if it matches the default value * @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 boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (getMarshaller().isMarshallableAsElement()) { getMarshaller().marshallAsElement(this, resourceModel, marshallDefault, writer); } else { throw ControllerLogger.ROOT_LOGGER.couldNotMarshalAttributeAsElement(getName()); } }
if (marshaller.isMarshallable(ad, model, marshallDefaultValues)) { if (!started && group != null) { if (elementAds != null) { marshaller.marshall(ad, model, marshallDefaultValues, writer);
/** * Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML. * <p> * This is the same as {@code isMarshallable(resourceModel, true)}. * </p> * @param attribute - attribute for which marshaling is being done * @param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}. * @return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link AttributeDefinition#getName()} () name}. */ public boolean isMarshallable(final AttributeDefinition attribute,final ModelNode resourceModel) { return isMarshallable(attribute,resourceModel, true); }
public void marshall(final AttributeDefinition attribute,final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (isMarshallableAsElement()){ marshallAsElement(attribute,resourceModel, marshallDefault, writer); }else{ marshallAsAttribute(attribute, resourceModel, marshallDefault, writer); } }
void writeKeys(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException { if (!model.isDefined()) { return; } boolean contains = false; for (Property key : model.asPropertyList()) { if (!contains) { writer.writeStartElement(Constants.XML.KEYS); contains = true; } writer.writeStartElement(Constants.XML.KEY); ModelNode keyAttributes = key.getValue(); for (SimpleAttributeDefinition attr : KeyDefinition.ATTRIBUTES) { attr.getAttributeMarshaller().marshallAsAttribute(attr, keyAttributes, false, writer); } for (SimpleAttributeDefinition attr : KeyDefinition.ELEMENTS) { attr.getAttributeMarshaller().marshallAsElement(attr, keyAttributes, false, writer); } writeKeyStore(writer, keyAttributes.get(Constants.Model.KEY_STORE)); writer.writeEndElement(); } if (contains) { writer.writeEndElement(); } }
@Override public void marshallAsElement(ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (attributeMarshaller.isMarshallable(this,resourceModel,marshallDefault)){ attributeMarshaller.marshallAsElement(this, resourceModel, marshallDefault, writer); } }
/** * 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 marshallDefault {@code true} if the value should be marshalled even if it matches the default value * @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 boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (getMarshaller().isMarshallableAsElement()) { getMarshaller().marshallAsElement(this, resourceModel, marshallDefault, writer); } else { throw ControllerLogger.ROOT_LOGGER.couldNotMarshalAttributeAsElement(getName()); } }
if (marshaller.isMarshallable(ad, model, marshallDefaultValues)) { if (!started && group != null) { if (elementAds != null) { marshaller.marshall(ad, model, marshallDefaultValues, writer);
/** * Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML. * * @param resourceModel the model, a non-null node of {@link ModelType#OBJECT}. * @param marshallDefault {@code true} if the value should be marshalled even if it matches the default value * * @return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link #getName()} () name} * and {@code marshallDefault} is {@code true} or that value differs from this attribute's {@link #getDefaultValue() default value}. */ public boolean isMarshallable(final ModelNode resourceModel, final boolean marshallDefault) { return attributeMarshaller.isMarshallable(this, resourceModel, marshallDefault); }
private static void writeAttribute(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsAttribute(attribute.getDefinition(), model, true, writer); }
private static void writeElement(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsElement(attribute.getDefinition(), model, true, writer); }
@Override public void marshallAsElement(ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (getMarshaller().isMarshallable(this,resourceModel,marshallDefault)){ getMarshaller().marshallAsElement(this, resourceModel, marshallDefault, writer); } }
@Override public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (resourceModel.isDefined()) { writer.writeEmptyElement(Element.MODULE.getLocalName()); for (SimpleAttributeDefinition valueType : VALUE_TYPE_FIELDS) { valueType.getAttributeMarshaller().marshall(valueType, resourceModel, true, writer); } } } };
/** * Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML. * <p> * This is the same as {@code isMarshallable(resourceModel, true)}. * </p> * @param attribute - attribute for which marshaling is being done * @param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}. * @return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link AttributeDefinition#getName()} () name}. */ public boolean isMarshallable(final AttributeDefinition attribute,final ModelNode resourceModel) { return isMarshallable(attribute,resourceModel, true); }