本文整理汇总了Java中org.jboss.staxmapper.XMLExtendedStreamWriter.writeAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java XMLExtendedStreamWriter.writeAttribute方法的具体用法?Java XMLExtendedStreamWriter.writeAttribute怎么用?Java XMLExtendedStreamWriter.writeAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.staxmapper.XMLExtendedStreamWriter
的用法示例。
在下文中一共展示了XMLExtendedStreamWriter.writeAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeSources
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeSources(XMLExtendedStreamWriter writer, ModelNode sources) throws XMLStreamException {
for(String sourcePath : sources.keys()) {
ModelNode source = sources.get(sourcePath);
writer.writeStartElement(Constants.SOURCE);
writer.writeAttribute(Constants.PATH, sourcePath);
writer.writeAttribute(Constants.TYPE, source.get(Constants.TYPE).asString());
if(source.hasDefined(Constants.ENABLED) && !source.get(Constants.ENABLED).asBoolean()) {
writer.writeAttribute(Constants.ENABLED, "false");
}
ModelNode metrics = source.get(Constants.METRIC);
writeMetrics(writer, metrics);
writer.writeEndElement();
}
}
示例2: writeProfile
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeProfile(final XMLExtendedStreamWriter writer, final String profileName, final ModelNode profileNode, final ModelMarshallingContext context) throws XMLStreamException {
writer.writeStartElement(Element.PROFILE.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), profileName);
ProfileResourceDefinition.INCLUDES.getMarshaller().marshallAsAttribute(ProfileResourceDefinition.INCLUDES, profileNode, false, writer);
if (profileNode.hasDefined(SUBSYSTEM)) {
final Set<String> subsystemNames = profileNode.get(SUBSYSTEM).keys();
if (subsystemNames.size() > 0) {
String defaultNamespace = writer.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
for (String subsystemName : subsystemNames) {
try {
ModelNode subsystem = profileNode.get(SUBSYSTEM, subsystemName);
XMLElementWriter<SubsystemMarshallingContext> subsystemWriter = context.getSubsystemWriter(subsystemName);
if (subsystemWriter != null) { // FIXME -- remove when extensions are doing the registration
subsystemWriter.writeContent(writer, new SubsystemMarshallingContext(subsystem, writer));
}
} finally {
writer.setDefaultNamespace(defaultNamespace);
}
}
}
}
writer.writeEndElement();
}
示例3: writeAuditLogger
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeAuditLogger(XMLExtendedStreamWriter writer, ModelNode auditLog, String element) throws XMLStreamException {
if (auditLog.hasDefined(element) && auditLog.get(element).hasDefined(ModelDescriptionConstants.AUDIT_LOG)){
ModelNode config = auditLog.get(element, ModelDescriptionConstants.AUDIT_LOG);
writer.writeStartElement(element);
AuditLogLoggerResourceDefinition.LOG_BOOT.marshallAsAttribute(config, writer);
AuditLogLoggerResourceDefinition.LOG_READ_ONLY.marshallAsAttribute(config, writer);
AuditLogLoggerResourceDefinition.ENABLED.marshallAsAttribute(config, writer);
if (config.hasDefined(ModelDescriptionConstants.HANDLER) && config.get(ModelDescriptionConstants.HANDLER).keys().size() > 0) {
writer.writeStartElement(Element.HANDLERS.getLocalName());
for (String name : config.get(ModelDescriptionConstants.HANDLER).keys()) {
writer.writeStartElement(Element.HANDLER.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), name);
writer.writeEndElement();
}
writer.writeEndElement();
}
writer.writeEndElement();
}
}
示例4: writePlugIn_Authentication
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writePlugIn_Authentication(XMLExtendedStreamWriter writer, ModelNode plugIn) throws XMLStreamException {
writer.writeStartElement(Element.PLUG_IN.getLocalName());
AbstractPlugInAuthResourceDefinition.NAME.marshallAsAttribute(plugIn, writer);
PlugInAuthenticationResourceDefinition.MECHANISM.marshallAsAttribute(plugIn, writer);
if (plugIn.hasDefined(PROPERTY)) {
writer.writeStartElement(PROPERTIES);
ModelNode properties = plugIn.get(PROPERTY);
for (String current : properties.keys()) {
writer.writeEmptyElement(PROPERTY);
writer.writeAttribute(Attribute.NAME.getLocalName(), current);
PropertyResourceDefinition.VALUE.marshallAsAttribute(properties.get(current), writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
}
示例5: writeConnector
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeConnector(final XMLExtendedStreamWriter writer, final ModelNode node, final String name) throws XMLStreamException {
writer.writeStartElement(Element.CONNECTOR.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), name);
ConnectorResource.SOCKET_BINDING.marshallAsAttribute(node, writer);
ConnectorResource.SSL_CONTEXT.marshallAsAttribute(node, writer);
if (node.hasDefined(SECURITY_REALM)) {
writer.writeAttribute(Attribute.SECURITY_REALM.getLocalName(), node.require(SECURITY_REALM).asString());
}
ConnectorCommon.SERVER_NAME.marshallAsAttribute(node, writer);
ConnectorCommon.SASL_PROTOCOL.marshallAsAttribute(node, writer);
ConnectorResource.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(node, writer);
ConnectorResource.AUTHENTICATION_PROVIDER.marshallAsElement(node, writer);
if (node.hasDefined(PROPERTY)) {
writeProperties(writer, node.get(PROPERTY));
}
if (node.hasDefined(SECURITY) && node.get(SECURITY).hasDefined(SASL)) {
writeSasl(writer, node.get(SECURITY, SASL));
}
writer.writeEndElement();
}
示例6: writeIgnoredResources
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeIgnoredResources(XMLExtendedStreamWriter writer, ModelNode ignoredTypes) throws XMLStreamException {
for (String ignoredName : ignoredTypes.keys()) {
ModelNode ignored = ignoredTypes.get(ignoredName);
ModelNode names = ignored.hasDefined(NAMES) ? ignored.get(NAMES) : null;
boolean hasNames = names != null && names.asInt() > 0;
if (hasNames) {
writer.writeStartElement(Element.IGNORED_RESOURCE.getLocalName());
} else {
writer.writeEmptyElement(Element.IGNORED_RESOURCE.getLocalName());
}
writer.writeAttribute(Attribute.TYPE.getLocalName(), ignoredName);
IgnoredDomainTypeResourceDefinition.WILDCARD.marshallAsAttribute(ignored, writer);
if (hasNames) {
for (ModelNode name : names.asList()) {
writer.writeEmptyElement(Element.INSTANCE.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), name.asString());
}
writer.writeEndElement();
}
}
}
示例7: writeBoundedQueueThreadPool
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
public void writeBoundedQueueThreadPool(final XMLExtendedStreamWriter writer, final Property property, final String elementName,
final boolean includeName, final boolean blocking)
throws XMLStreamException {
writer.writeStartElement(elementName);
ModelNode node = property.getValue();
if (includeName) {
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
}
PoolAttributeDefinitions.ALLOW_CORE_TIMEOUT.marshallAsAttribute(node, writer);
writeCountElement(PoolAttributeDefinitions.CORE_THREADS, node, writer);
writeCountElement(PoolAttributeDefinitions.QUEUE_LENGTH, node, writer);
writeCountElement(PoolAttributeDefinitions.MAX_THREADS, node, writer);
writeTime(writer, node, Element.KEEPALIVE_TIME);
writeRef(writer, node, Element.THREAD_FACTORY, THREAD_FACTORY);
if (!blocking) {
writeRef(writer, node, Element.HANDOFF_EXECUTOR, HANDOFF_EXECUTOR);
}
writer.writeEndElement();
}
示例8: writeLocalOutboundConnection
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeLocalOutboundConnection(final XMLExtendedStreamWriter writer, final String connectionName, final ModelNode model) throws XMLStreamException {
// <local-outbound-connection>
writer.writeStartElement(Element.LOCAL_OUTBOUND_CONNECTION.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), connectionName);
final String outboundSocketRef = model.get(OUTBOUND_SOCKET_BINDING_REF).asString();
writer.writeAttribute(Attribute.OUTBOUND_SOCKET_BINDING_REF.getLocalName(), outboundSocketRef);
// write the connection-creation-options if any
if (model.hasDefined(PROPERTY)) {
writeProperties(writer, model.get(PROPERTY));
}
// </local-outbound-connection>
writer.writeEndElement();
}
示例9: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context)
throws XMLStreamException {
ModelNode node = context.getModelNode();
// <subsystem>
context.startSubsystemElement(NestSubsystemExtension.NAMESPACE, false);
writer.writeAttribute(NEST_ENABLED_ATTR, node.get(NEST_ENABLED_ATTR).asString());
// our config elements
writeElement(writer, node, NEST_NAME_ELEMENT);
// <custom-configuration>
writer.writeStartElement(CUSTOM_CONFIG_ELEMENT);
ModelNode configNode = node.get(CUSTOM_CONFIG_ELEMENT);
if (configNode != null && configNode.isDefined()) {
for (Property property : configNode.asPropertyList()) {
// <propery>
writer.writeStartElement(PROPERTY_ELEMENT);
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
writer.writeAttribute(Attribute.VALUE.getLocalName(), property.getValue().asString());
// </property>
writer.writeEndElement();
}
}
// </custom-configuration>
writer.writeEndElement();
// </subsystem>
writer.writeEndElement();
}
示例10: writeRemoteOutboundConnection
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeRemoteOutboundConnection(final XMLExtendedStreamWriter writer, final String connectionName, final ModelNode model) throws XMLStreamException {
// <remote-outbound-connection>
writer.writeStartElement(Element.REMOTE_OUTBOUND_CONNECTION.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), connectionName);
final String outboundSocketRef = model.get(OUTBOUND_SOCKET_BINDING_REF).asString();
writer.writeAttribute(Attribute.OUTBOUND_SOCKET_BINDING_REF.getLocalName(), outboundSocketRef);
if (model.hasDefined(CommonAttributes.USERNAME)) {
writer.writeAttribute(Attribute.USERNAME.getLocalName(), model.require(CommonAttributes.USERNAME).asString());
}
if (model.hasDefined(CommonAttributes.SECURITY_REALM)) {
writer.writeAttribute(Attribute.SECURITY_REALM.getLocalName(), model.require(SECURITY_REALM).asString());
}
if (model.hasDefined(CommonAttributes.PROTOCOL)) {
writer.writeAttribute(Attribute.PROTOCOL.getLocalName(), model.require(PROTOCOL).asString());
}
if (model.hasDefined(CommonAttributes.AUTHENTICATION_CONTEXT)) {
writer.writeAttribute(Attribute.AUTHENTICATION_CONTEXT.getLocalName(), model.require(AUTHENTICATION_CONTEXT).asString());
}
// write the connection-creation-options if any
if (model.hasDefined(PROPERTY)) {
writeProperties(writer, model.get(PROPERTY));
}
// </remote-outbound-connection>
writer.writeEndElement();
}
示例11: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
/**
* {@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();
}
}
示例12: writeHostScopedRoles
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeHostScopedRoles(XMLExtendedStreamWriter writer, ModelNode scopedRoles) throws XMLStreamException {
writer.writeStartElement(Element.HOST_SCOPED_ROLES.getLocalName());
for (Property property : scopedRoles.asPropertyList()) {
writer.writeStartElement(Element.ROLE.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
ModelNode value = property.getValue();
HostScopedRolesResourceDefinition.BASE_ROLE.marshallAsAttribute(value, writer);
HostScopedRolesResourceDefinition.HOSTS.marshallAsElement(value, writer);
writer.writeEndElement();
}
writer.writeEndElement();
}
示例13: writeAsynchHandler
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeAsynchHandler(final XMLExtendedStreamWriter writer, final ModelNode model, final String name) throws XMLStreamException {
writer.writeStartElement(Element.ASYNC_HANDLER.getLocalName());
writer.writeAttribute(HANDLER_NAME.getXmlName(), name);
ENABLED.marshallAsAttribute(model, false, writer);
LEVEL.marshallAsElement(model, writer);
FILTER_SPEC.marshallAsElement(model, writer);
FORMATTER.marshallAsElement(model, writer);
QUEUE_LENGTH.marshallAsElement(model, writer);
OVERFLOW_ACTION.marshallAsElement(model, writer);
SUBHANDLERS.marshallAsElement(model, writer);
writer.writeEndElement();
}
示例14: writeContent
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
/**
* {@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();
}
}
示例15: writeHostExcludes
import org.jboss.staxmapper.XMLExtendedStreamWriter; //导入方法依赖的package包/类
private void writeHostExcludes(XMLExtendedStreamWriter writer, ModelNode modelNode) throws XMLStreamException {
writer.writeStartElement(Element.HOST_EXCLUDES.getLocalName());
for (String exclude : modelNode.keys()) {
writer.writeStartElement(Element.HOST_EXCLUDE.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), exclude);
ModelNode excludeNode = modelNode.get(exclude);
HostExcludeResourceDefinition.ACTIVE_SERVER_GROUPS.getMarshaller()
.marshall(HostExcludeResourceDefinition.ACTIVE_SERVER_GROUPS, excludeNode, false, writer);
HostExcludeResourceDefinition.ACTIVE_SOCKET_BINDING_GROUPS.getMarshaller()
.marshall(HostExcludeResourceDefinition.ACTIVE_SOCKET_BINDING_GROUPS, excludeNode, false, writer);
if (HostExcludeResourceDefinition.HOST_RELEASE.isMarshallable(excludeNode)) {
writer.writeEmptyElement(Element.HOST_RELEASE.getLocalName());
HostExcludeResourceDefinition.HOST_RELEASE.marshallAsAttribute(excludeNode, writer);
} else {
writer.writeStartElement(Element.HOST_API_VERSION.getLocalName());
HostExcludeResourceDefinition.MANAGEMENT_MAJOR_VERSION.marshallAsAttribute(excludeNode, writer);
HostExcludeResourceDefinition.MANAGEMENT_MINOR_VERSION.marshallAsAttribute(excludeNode, writer);
HostExcludeResourceDefinition.MANAGEMENT_MICRO_VERSION.marshallAsAttribute(excludeNode, writer);
writer.writeEndElement();
}
if (HostExcludeResourceDefinition.EXCLUDED_EXTENSIONS.isMarshallable(excludeNode)) {
writer.writeStartElement(Element.EXCLUDED_EXTENSIONS.getLocalName());
for (ModelNode ext : excludeNode.get(HostExcludeResourceDefinition.EXCLUDED_EXTENSIONS.getName()).asList()) {
if (ext.isDefined()) {
writer.writeEmptyElement(Element.EXTENSION.getLocalName());
writer.writeAttribute(Attribute.MODULE.getLocalName(), ext.asString());
}
}
writer.writeEndElement();
}
writer.writeEndElement();
}
writer.writeEndElement();
}