}
/** {@inheritDoc} */
@Override
public void marshallAsXml(final ModelNode model, final OutputStream output) throws ConfigurationPersistenceException {
final XMLMapper mapper = XMLMapper.Factory.create();
try {
XMLStreamWriter streamWriter = null;
try {
streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(output);
ModelMarshallingContext extensibleModel = new ModelMarshallingContext() {
@Override
public ModelNode getModelNode() {
return model;
}
@Override
public XMLElementWriter<SubsystemMarshallingContext> getSubsystemWriter(String extensionName) {
synchronized (subsystemWriters) {
return subsystemWriters.get(extensionName);
}
}
@Override
public XMLElementWriter<SubsystemMarshallingContext> getSubsystemDeploymentWriter(String extensionName) {
synchronized (subsystemDeploymentWriters) {
return subsystemDeploymentWriters.get(extensionName);
}
}
};
mapper.deparseDocument(rootDeparser, extensibleModel, streamWriter);
streamWriter.close();
} finally {
safeClose(streamWriter);
}
} catch (Exception e) {