本文整理汇总了Java中org.jboss.staxmapper.XMLExtendedStreamWriter.writeEndDocument方法的典型用法代码示例。如果您正苦于以下问题:Java XMLExtendedStreamWriter.writeEndDocument方法的具体用法?Java XMLExtendedStreamWriter.writeEndDocument怎么用?Java XMLExtendedStreamWriter.writeEndDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.staxmapper.XMLExtendedStreamWriter
的用法示例。
在下文中一共展示了XMLExtendedStreamWriter.writeEndDocument方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(XMLExtendedStreamWriter writer, ModelMarshallingContext context) throws XMLStreamException {
String defaultNamespace = writer.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
try {
ModelNode subsystems = context.getModelNode().get(SUBSYSTEM);
if (subsystems.has(mainSubsystemName)) {
ModelNode subsystem = subsystems.get(mainSubsystemName);
//We might have been removed
XMLElementWriter<SubsystemMarshallingContext> subsystemWriter = context.getSubsystemWriter(mainSubsystemName);
if (subsystemWriter != null) {
subsystemWriter.writeContent(writer, new SubsystemMarshallingContext(subsystem, writer));
}
}else{
writer.writeEmptyElement(Element.SUBSYSTEM.getLocalName());
}
}catch (Throwable t){
Assert.fail("could not marshal subsystem xml: "+t.getMessage()+":\n"+ Arrays.toString(t.getStackTrace()).replaceAll(", ","\n"));
} finally {
writer.setDefaultNamespace(defaultNamespace);
}
writer.writeEndDocument();
}
示例2: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(XMLExtendedStreamWriter streamWriter, ServerProvisioningDescription description) throws XMLStreamException {
// build node tree
final ElementNode rootElementNode = new ElementNode(null, Element.SERVER_PROVISIONING.getLocalName(), ServerProvisioningDescriptionModelParser11.NAMESPACE_1_1);
if (description.isCopyModuleArtifacts()) {
rootElementNode.addAttribute(Attribute.COPY_MODULE_ARTIFACTS.getLocalName(), new AttributeValue(Boolean.TRUE.toString()));
}
if (description.isExtractSchemas()) {
rootElementNode.addAttribute(Attribute.EXTRACT_SCHEMAS.getLocalName(), new AttributeValue(Boolean.TRUE.toString()));
rootElementNode.addAttribute(Attribute.EXTRACT_SCHEMAS_GROUPS.getLocalName(), new AttributeValue(description.getExtractSchemasGroupsAsString()));
}
processFeaturePacks(description.getFeaturePacks(), rootElementNode);
processVersionOverrides(description.getVersionOverrides(), rootElementNode);
CopyArtifactsXMLWriter10.INSTANCE.write(description.getCopyArtifacts(), rootElementNode);
// write the xml
streamWriter.writeStartDocument();
rootElementNode.marshall(streamWriter);
streamWriter.writeEndDocument();
}
示例3: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(XMLExtendedStreamWriter streamWriter, MigrationData description) throws XMLStreamException {
// build node tree
final ElementNode rootElementNode = new ElementNode(null, "server-migration-report", "urn:jboss:server-migration:1.0");
processMigrationData(description, rootElementNode);
// write the xml
streamWriter.writeStartDocument();
rootElementNode.marshall(streamWriter);
streamWriter.writeEndDocument();
}
示例4: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final Patch patch) throws XMLStreamException {
// Get started ...
writer.writeStartDocument();
writer.writeStartElement(Element.PATCH.name);
writer.writeDefaultNamespace(PatchXml.Namespace.PATCH_1_2.getNamespace());
writePatch(writer, patch);
// Done
writer.writeEndElement();
writer.writeEndDocument();
}
示例5: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final RollbackPatch rollbackPatch) throws XMLStreamException {
// Get started ...
writer.writeStartDocument();
writer.writeStartElement(Element.PATCH.name);
writer.writeDefaultNamespace(PatchXml.Namespace.ROLLBACK_1_2.getNamespace());
writePatch(writer, rollbackPatch);
writeInstallation(writer, rollbackPatch.getIdentityState());
// Done
writer.writeEndElement();
writer.writeEndDocument();
}
示例6: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
void writeContent(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) throws XMLStreamException {
ModelNode modelNode = context.getModelNode();
writer.writeStartDocument();
writer.writeStartElement(Element.DOMAIN.getLocalName());
writer.writeDefaultNamespace(CURRENT.getUriString());
writeNamespaces(writer, modelNode);
writeSchemaLocation(writer, modelNode);
DomainRootDefinition.NAME.marshallAsAttribute(modelNode, false, writer);
if (modelNode.hasDefined(DOMAIN_ORGANIZATION)) {
DomainRootDefinition.ORGANIZATION_IDENTIFIER.marshallAsAttribute(modelNode, writer);
}
if (modelNode.hasDefined(EXTENSION)) {
extensionXml.writeExtensions(writer, modelNode.get(EXTENSION));
}
if (modelNode.hasDefined(SYSTEM_PROPERTY)) {
writeProperties(writer, modelNode.get(SYSTEM_PROPERTY), Element.SYSTEM_PROPERTIES, false);
}
if (modelNode.hasDefined(PATH)) {
writePaths(writer, modelNode.get(PATH), true);
}
if (modelNode.hasDefined(CORE_SERVICE) && modelNode.get(CORE_SERVICE).hasDefined(MANAGEMENT)) {
// We use CURRENT here as we only support writing the most recent.
ManagementXml managementXml = ManagementXml.newInstance(CURRENT, this, true);
managementXml.writeManagement(writer, modelNode.get(CORE_SERVICE, MANAGEMENT), true);
}
if (modelNode.hasDefined(PROFILE)) {
writer.writeStartElement(Element.PROFILES.getLocalName());
ModelNode profiles = modelNode.get(PROFILE);
for (final String profile : profiles.keys()) {
writeProfile(writer, profile, profiles.get(profile), context);
}
writer.writeEndElement();
}
if (modelNode.hasDefined(INTERFACE)) {
writeInterfaces(writer, modelNode.get(INTERFACE));
}
if (modelNode.hasDefined(SOCKET_BINDING_GROUP)) {
writer.writeStartElement(Element.SOCKET_BINDING_GROUPS.getLocalName());
ModelNode sbgs = modelNode.get(SOCKET_BINDING_GROUP);
for (final String sbg : sbgs.keys()) {
writeSocketBindingGroup(writer, sbgs.get(sbg), sbg);
}
writer.writeEndElement();
}
if (modelNode.hasDefined(DEPLOYMENT)) {
writeDomainDeployments(writer, modelNode.get(DEPLOYMENT));
}
if (modelNode.hasDefined(DEPLOYMENT_OVERLAY)) {
writeDeploymentOverlays(writer, modelNode.get(DEPLOYMENT_OVERLAY));
}
if (modelNode.hasDefined(SERVER_GROUP)) {
writer.writeStartElement(Element.SERVER_GROUPS.getLocalName());
ModelNode sgs = modelNode.get(SERVER_GROUP);
for (final String sg : sgs.keys()) {
writeServerGroup(writer, sg, sgs.get(sg));
}
writer.writeEndElement();
}
if (modelNode.hasDefined(HOST_EXCLUDE)) {
writeHostExcludes(writer, modelNode.get(HOST_EXCLUDE));
}
if (modelNode.hasDefined(MANAGEMENT_CLIENT_CONTENT)) {
writeManagementClientContent(writer, modelNode.get(MANAGEMENT_CLIENT_CONTENT));
}
writer.writeEndElement();
writer.writeEndDocument();
}
示例7: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
void writeContent(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context)
throws XMLStreamException {
ModelNode modelNode = context.getModelNode();
writer.writeStartDocument();
writer.writeStartElement(Element.SERVER.getLocalName());
if (modelNode.hasDefined(NAME)) {
ServerRootResourceDefinition.NAME.marshallAsAttribute(modelNode, false, writer);
}
if (modelNode.hasDefined(ORGANIZATION_IDENTIFIER.getName())) {
ServerRootResourceDefinition.ORGANIZATION_IDENTIFIER.marshallAsAttribute(modelNode, false, writer);
}
writer.writeDefaultNamespace(CURRENT.getUriString());
writeNamespaces(writer, modelNode);
writeSchemaLocation(writer, modelNode);
if (modelNode.hasDefined(EXTENSION)) {
extensionHandler.writeExtensions(writer, modelNode.get(EXTENSION));
}
if (modelNode.hasDefined(SYSTEM_PROPERTY)) {
writeProperties(writer, modelNode.get(SYSTEM_PROPERTY), Element.SYSTEM_PROPERTIES, true);
}
if (modelNode.hasDefined(PATH)) {
writePaths(writer, modelNode.get(PATH), false);
}
if (modelNode.hasDefined(CORE_SERVICE) && modelNode.get(CORE_SERVICE).hasDefined(VAULT)) {
writeVault(writer, modelNode.get(CORE_SERVICE, VAULT));
}
if (modelNode.hasDefined(CORE_SERVICE)) {
ManagementXml managementXml = ManagementXml.newInstance(CURRENT, this, false);
managementXml.writeManagement(writer, modelNode.get(CORE_SERVICE, MANAGEMENT), true);
}
writeServerProfile(writer, context);
if (modelNode.hasDefined(INTERFACE)) {
writeInterfaces(writer, modelNode.get(INTERFACE));
}
if (modelNode.hasDefined(SOCKET_BINDING_GROUP)) {
Set<String> groups = modelNode.get(SOCKET_BINDING_GROUP).keys();
if (groups.size() > 1) {
throw ControllerLogger.ROOT_LOGGER.multipleModelNodes(SOCKET_BINDING_GROUP);
}
for (String group : groups) {
writeSocketBindingGroup(writer, modelNode.get(SOCKET_BINDING_GROUP, group), group);
}
}
if (modelNode.hasDefined(DEPLOYMENT)) {
writeServerDeployments(writer, modelNode.get(DEPLOYMENT));
WriteUtils.writeNewLine(writer);
}
if (modelNode.hasDefined(DEPLOYMENT_OVERLAY)) {
writeDeploymentOverlays(writer, modelNode.get(DEPLOYMENT_OVERLAY));
WriteUtils.writeNewLine(writer);
}
writer.writeEndElement();
writer.writeEndDocument();
}
示例8: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(XMLExtendedStreamWriter writer, ModuleConfig value) throws XMLStreamException {
writer.writeStartDocument();
writer.writeStartElement(MODULE);
writer.writeDefaultNamespace(MODULE_NS);
if(moduleName == null) {
throw new XMLStreamException("Module name is missing.");
}
writer.writeAttribute(NAME, moduleName);
if (slotName != null) {
writer.writeAttribute(SLOT, slotName);
}
if(properties != null) {
writeNewLine(writer);
writer.writeStartElement(PROPERTIES);
for(Map.Entry<String, String> entry: properties.entrySet()) {
writer.writeStartElement(PROPERTY);
writer.writeAttribute(NAME, entry.getKey());
writer.writeAttribute(VALUE, entry.getValue());
writer.writeEndElement();
}
writer.writeEndElement();
}
if(mainClass != null) {
writeNewLine(writer);
writer.writeStartElement(MAIN_CLASS);
writer.writeAttribute(NAME, mainClass);
writer.writeEndElement();
}
if(resources != null) {
writeNewLine(writer);
writer.writeStartElement(RESOURCES);
for(Resource res : resources) {
res.writeContent(writer, res);
}
writer.writeEndElement();
}
if(dependencies != null) {
writeNewLine(writer);
writer.writeStartElement(DEPENDENCIES);
for(Dependency dep : dependencies) {
dep.writeContent(writer, dep);
}
writer.writeEndElement();
}
writeNewLine(writer);
writer.writeEndElement();
writer.writeEndDocument();
}