/** * <p> * Iterates through the specified attribute definitions and checks if any of the attributes can be written to XML * by verifying if the attribute has been defined in the supplied node. * </p> * * @param node the {@code ModelNode} that contains the configuration attributes. * @param attributeDefinitions the {@code AttributeDefinition}s of the attributes that might be writable. * @return {@code true} if the node has defined any of the attributes; {@code false} otherwise. */ private boolean isWritable(ModelNode node, List<SimpleAttributeDefinition> attributeDefinitions) { boolean isWritable = false; for (SimpleAttributeDefinition attributeDefinition : attributeDefinitions) { if (attributeDefinition.isMarshallable(node)) { isWritable = true; break; } } return isWritable; }
private void writeArchiveValidation(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(ARCHIVE_VALIDATION)) { ModelNode node = parentNode.get(ARCHIVE_VALIDATION).get(ARCHIVE_VALIDATION); if (ArchiveValidationParameters.ARCHIVE_VALIDATION_ENABLED.getAttribute().isMarshallable(node) || ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_ERROR.getAttribute().isMarshallable(node) || ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_WARN.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.ARCHIVE_VALIDATION.getLocalName()); ArchiveValidationParameters.ARCHIVE_VALIDATION_ENABLED.getAttribute().marshallAsAttribute(node, writer); ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_ERROR.getAttribute().marshallAsAttribute(node, writer); ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_WARN.getAttribute().marshallAsAttribute(node, writer); } } }
private void writeBeanValidation(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(BEAN_VALIDATION)) { ModelNode node = parentNode.get(BEAN_VALIDATION).get(BEAN_VALIDATION); if (JcaBeanValidationDefinition.BeanValidationParameters.BEAN_VALIDATION_ENABLED.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.BEAN_VALIDATION.getLocalName()); JcaBeanValidationDefinition.BeanValidationParameters.BEAN_VALIDATION_ENABLED.getAttribute().marshallAsAttribute(node, writer); } } }
private void writeTracer(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(TRACER)) { ModelNode node = parentNode.get(TRACER).get(TRACER); if (TracerDefinition.TracerParameters.TRACER_ENABLED.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.TRACER.getLocalName()); TracerDefinition.TracerParameters.TRACER_ENABLED.getAttribute().marshallAsAttribute(node, writer); } } }
private void writeBootstrapContexts(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(BOOTSTRAP_CONTEXT) && parentNode.get(BOOTSTRAP_CONTEXT).asList().size() != 0) { boolean started = false; ModelNode contexts = parentNode.get(BOOTSTRAP_CONTEXT); for (String name : contexts.keys()) { ModelNode context = contexts.get(name); if (!context.get(JcaBootstrapContextDefinition.BootstrapCtxParameters.NAME.getAttribute().getName()).asString().equals(DEFAULT_NAME) && (JcaBootstrapContextDefinition.BootstrapCtxParameters.NAME.getAttribute().isMarshallable(context) || JcaBootstrapContextDefinition.BootstrapCtxParameters.WORKMANAGER.getAttribute().isMarshallable(context))) { if (!started) { writer.writeStartElement(Element.BOOTSTRAP_CONTEXTS.getLocalName()); started = true; } writer.writeStartElement(Element.BOOTSTRAP_CONTEXT.getLocalName()); JcaBootstrapContextDefinition.BootstrapCtxParameters.NAME.getAttribute().marshallAsAttribute(context, writer); JcaBootstrapContextDefinition.BootstrapCtxParameters.WORKMANAGER.getAttribute().marshallAsAttribute(context, writer); writer.writeEndElement(); } } if (started) { writer.writeEndElement(); } } }
if (SecuritySubsystemRootResourceDefinition.DEEP_COPY_SUBJECT_MODE.isMarshallable(node) || SecuritySubsystemRootResourceDefinition.INITIALIZE_JACC.isMarshallable(node)) { writer.writeEmptyElement(Element.SECURITY_MANAGEMENT.getLocalName()); if (SecuritySubsystemRootResourceDefinition.DEEP_COPY_SUBJECT_MODE.isMarshallable(node)) { SecuritySubsystemRootResourceDefinition.DEEP_COPY_SUBJECT_MODE.marshallAsAttribute(node, writer); if (SecuritySubsystemRootResourceDefinition.INITIALIZE_JACC.isMarshallable(node)) { SecuritySubsystemRootResourceDefinition.INITIALIZE_JACC.marshallAsAttribute(node, writer);
if (TransactionSubsystemRootResourceDefinition.BINDING.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.STATUS_BINDING.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.RECOVERY_LISTENER.isMarshallable(node)) { writer.writeStartElement(Element.RECOVERY_ENVIRONMENT.getLocalName()); TransactionSubsystemRootResourceDefinition.BINDING.marshallAsAttribute(node, writer); if (TransactionSubsystemRootResourceDefinition.STATISTICS_ENABLED.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.ENABLE_TSM_STATUS.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.DEFAULT_TIMEOUT.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.MAXIMUM_TIMEOUT.isMarshallable(node)) { if (TransactionSubsystemRootResourceDefinition.OBJECT_STORE_RELATIVE_TO.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.OBJECT_STORE_PATH.isMarshallable(node)) { writer.writeStartElement(Element.OBJECT_STORE.getLocalName()); TransactionSubsystemRootResourceDefinition.OBJECT_STORE_PATH.marshallAsAttribute(node, writer); writer.writeStartElement(Element.JDBC_STORE.getLocalName()); TransactionSubsystemRootResourceDefinition.JDBC_STORE_DATASOURCE.marshallAsAttribute(node, writer); if (TransactionSubsystemRootResourceDefinition.JDBC_ACTION_STORE_TABLE_PREFIX.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.JDBC_ACTION_STORE_DROP_TABLE.isMarshallable(node)) { writer.writeEmptyElement(Element.JDBC_ACTION_STORE.getLocalName()); TransactionSubsystemRootResourceDefinition.JDBC_ACTION_STORE_TABLE_PREFIX.marshallAsAttribute(node, writer); TransactionSubsystemRootResourceDefinition.JDBC_ACTION_STORE_DROP_TABLE.marshallAsAttribute(node, writer); if (TransactionSubsystemRootResourceDefinition.JDBC_COMMUNICATION_STORE_TABLE_PREFIX.isMarshallable(node) || TransactionSubsystemRootResourceDefinition.JDBC_COMMUNICATION_STORE_DROP_TABLE.isMarshallable(node)) { writer.writeEmptyElement(Element.JDBC_COMMUNICATION_STORE.getLocalName()); TransactionSubsystemRootResourceDefinition.JDBC_COMMUNICATION_STORE_TABLE_PREFIX.marshallAsAttribute(node, writer); TransactionSubsystemRootResourceDefinition.JDBC_COMMUNICATION_STORE_DROP_TABLE.marshallAsAttribute(node, writer);
boolean poolRequired = INITIAL_POOL_SIZE.isMarshallable(dataSourceNode) || MIN_POOL_SIZE.isMarshallable(dataSourceNode) || MAX_POOL_SIZE.isMarshallable(dataSourceNode) || POOL_PREFILL.isMarshallable(dataSourceNode) || POOL_FAIR.isMarshallable(dataSourceNode) || POOL_USE_STRICT_MIN.isMarshallable(dataSourceNode) || POOL_FLUSH_STRATEGY.isMarshallable(dataSourceNode) || ALLOW_MULTIPLE_USERS.isMarshallable(dataSourceNode) || CONNECTION_LISTENER_CLASS.isMarshallable(dataSourceNode) || CONNECTION_LISTENER_PROPERTIES.isMarshallable(dataSourceNode); if (isXADataSource) { poolRequired = poolRequired || SAME_RM_OVERRIDE.isMarshallable(dataSourceNode) || INTERLEAVING.isMarshallable(dataSourceNode) || NO_TX_SEPARATE_POOL.isMarshallable(dataSourceNode) || PAD_XID.isMarshallable(dataSourceNode) || WRAP_XA_RESOURCE.isMarshallable(dataSourceNode); final boolean capacityRequired = CAPACITY_INCREMENTER_CLASS.isMarshallable(dataSourceNode) || CAPACITY_INCREMENTER_PROPERTIES.isMarshallable(dataSourceNode) || CAPACITY_DECREMENTER_CLASS.isMarshallable(dataSourceNode) || CAPACITY_DECREMENTER_PROPERTIES.isMarshallable(dataSourceNode); poolRequired = poolRequired || capacityRequired; boolean securityRequired = USERNAME.isMarshallable(dataSourceNode) || PASSWORD.isMarshallable(dataSourceNode) || CREDENTIAL_REFERENCE.isMarshallable(dataSourceNode) || SECURITY_DOMAIN.isMarshallable(dataSourceNode) || ELYTRON_ENABLED.isMarshallable(dataSourceNode) ||
boolean poolRequired = INITIAL_POOL_SIZE.isMarshallable(conDef) || MAX_POOL_SIZE.isMarshallable(conDef) || MIN_POOL_SIZE.isMarshallable(conDef) || POOL_USE_STRICT_MIN.isMarshallable(conDef) || POOL_PREFILL.isMarshallable(conDef) || POOL_FAIR.isMarshallable(conDef) || POOL_FLUSH_STRATEGY.isMarshallable(conDef); final boolean capacityRequired = CAPACITY_INCREMENTER_CLASS.isMarshallable(conDef) || CAPACITY_INCREMENTER_PROPERTIES.isMarshallable(conDef) || CAPACITY_DECREMENTER_CLASS.isMarshallable(conDef) || CAPACITY_DECREMENTER_PROPERTIES.isMarshallable(conDef); poolRequired = poolRequired || capacityRequired;
private void writeTimerService(final XMLExtendedStreamWriter writer, final ModelNode timerServiceModel) throws XMLStreamException { TimerServiceResourceDefinition.THREAD_POOL_NAME.marshallAsAttribute(timerServiceModel, writer); // <data-store> if (TimerServiceResourceDefinition.PATH.isMarshallable(timerServiceModel) || TimerServiceResourceDefinition.RELATIVE_TO.isMarshallable(timerServiceModel)) { writer.writeEmptyElement(EJB3SubsystemXMLElement.DATA_STORE.getLocalName()); TimerServiceResourceDefinition.PATH.marshallAsAttribute(timerServiceModel, writer); TimerServiceResourceDefinition.RELATIVE_TO.marshallAsAttribute(timerServiceModel, writer); } }
private void writeArchiveValidation(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(ARCHIVE_VALIDATION)) { ModelNode node = parentNode.get(ARCHIVE_VALIDATION).get(ARCHIVE_VALIDATION); if (ArchiveValidationParameters.ARCHIVE_VALIDATION_ENABLED.getAttribute().isMarshallable(node) || ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_ERROR.getAttribute().isMarshallable(node) || ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_WARN.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.ARCHIVE_VALIDATION.getLocalName()); ArchiveValidationParameters.ARCHIVE_VALIDATION_ENABLED.getAttribute().marshallAsAttribute(node, writer); ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_ERROR.getAttribute().marshallAsAttribute(node, writer); ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_WARN.getAttribute().marshallAsAttribute(node, writer); } } }
private void writeArchiveValidation(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(ARCHIVE_VALIDATION)) { ModelNode node = parentNode.get(ARCHIVE_VALIDATION).get(ARCHIVE_VALIDATION); if (ArchiveValidationParameters.ARCHIVE_VALIDATION_ENABLED.getAttribute().isMarshallable(node) || ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_ERROR.getAttribute().isMarshallable(node) || ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_WARN.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.ARCHIVE_VALIDATION.getLocalName()); ArchiveValidationParameters.ARCHIVE_VALIDATION_ENABLED.getAttribute().marshallAsAttribute(node, writer); ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_ERROR.getAttribute().marshallAsAttribute(node, writer); ArchiveValidationParameters.ARCHIVE_VALIDATION_FAIL_ON_WARN.getAttribute().marshallAsAttribute(node, writer); } } }
private void writeTracer(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(TRACER)) { ModelNode node = parentNode.get(TRACER).get(TRACER); if (TracerDefinition.TracerParameters.TRACER_ENABLED.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.TRACER.getLocalName()); TracerDefinition.TracerParameters.TRACER_ENABLED.getAttribute().marshallAsAttribute(node, writer); } } }
private void writeBeanValidation(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(BEAN_VALIDATION)) { ModelNode node = parentNode.get(BEAN_VALIDATION).get(BEAN_VALIDATION); if (JcaBeanValidationDefinition.BeanValidationParameters.BEAN_VALIDATION_ENABLED.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.BEAN_VALIDATION.getLocalName()); JcaBeanValidationDefinition.BeanValidationParameters.BEAN_VALIDATION_ENABLED.getAttribute().marshallAsAttribute(node, writer); } } }
private void writeBeanValidation(XMLExtendedStreamWriter writer, ModelNode parentNode) throws XMLStreamException { if (parentNode.hasDefined(BEAN_VALIDATION)) { ModelNode node = parentNode.get(BEAN_VALIDATION).get(BEAN_VALIDATION); if (JcaBeanValidationDefinition.BeanValidationParameters.BEAN_VALIDATION_ENABLED.getAttribute().isMarshallable(node)) { writer.writeEmptyElement(Element.BEAN_VALIDATION.getLocalName()); JcaBeanValidationDefinition.BeanValidationParameters.BEAN_VALIDATION_ENABLED.getAttribute().marshallAsAttribute(node, writer); } } }
@Override public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName()); NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) { writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); } writer.writeEndElement(); return true; }
@Override public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName()); NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) { writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); } writer.writeEndElement(); return true; }
@Override public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName()); NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) { writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); } writer.writeEndElement(); return true; }
@Override public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName()); NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) { writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); } writer.writeEndElement(); return true; }
@Override public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName()); NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SECURITY_REALM.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) { writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); } writer.writeEndElement(); return true; }