Skip to content

Commit

Permalink
WFLY-19304: fix schema and model, bump
Browse files Browse the repository at this point in the history
  • Loading branch information
michpetrov committed Jul 11, 2024
1 parent 76fa512 commit 53fa6b5
Show file tree
Hide file tree
Showing 47 changed files with 2,024 additions and 926 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import org.jboss.as.controller.SimpleOperationDefinitionBuilder;
import org.jboss.as.controller.access.constraint.SensitivityClassification;
import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition;
import org.jboss.as.controller.client.helpers.MeasurementUnit;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.descriptions.NonResolvingResourceDescriptionResolver;
import org.jboss.as.controller.operations.validation.EnumValidator;
import org.jboss.as.controller.operations.validation.StringLengthValidator;
import org.jboss.as.controller.registry.AttributeAccess;
import org.jboss.as.controller.security.CredentialReference;
Expand All @@ -39,6 +41,7 @@
import org.jboss.jca.common.api.metadata.ds.DsPool;
import org.jboss.jca.common.api.metadata.ds.Statement;
import org.jboss.jca.common.api.metadata.ds.TimeOut;
import org.jboss.jca.common.api.metadata.ds.TransactionIsolation;
import org.jboss.jca.common.api.metadata.ds.Validation;
import org.jboss.jca.common.api.metadata.ds.XaDataSource;

Expand Down Expand Up @@ -431,7 +434,8 @@ public class Constants {
static SimpleAttributeDefinition TRACK_STATEMENTS = new SimpleAttributeDefinitionBuilder(TRACKSTATEMENTS_NAME, ModelType.STRING, true)
.setAllowExpression(true)
.setXmlName(Statement.Tag.TRACK_STATEMENTS.getLocalName())
.setDefaultValue(new ModelNode(Defaults.TRACK_STATEMENTS.name()))
.setDefaultValue(new ModelNode(Defaults.TRACK_STATEMENTS.toString()))
.setValidator(EnumValidator.create(Statement.TrackStatementsEnum.class))
.setRestartAllServices()
.build();

Expand All @@ -444,6 +448,7 @@ public class Constants {

static SimpleAttributeDefinition ALLOCATION_RETRY_WAIT_MILLIS = new SimpleAttributeDefinitionBuilder(ALLOCATION_RETRY_WAIT_MILLIS_NAME, ModelType.LONG, true)
.setXmlName(TimeOut.Tag.ALLOCATION_RETRY_WAIT_MILLIS.getLocalName())
.setMeasurementUnit(MeasurementUnit.MILLISECONDS)
.setAllowExpression(true)
.setRestartAllServices()
.build();
Expand Down Expand Up @@ -472,6 +477,7 @@ public class Constants {

static SimpleAttributeDefinition QUERY_TIMEOUT = new SimpleAttributeDefinitionBuilder(QUERYTIMEOUT_NAME, ModelType.LONG, true)
.setXmlName(TimeOut.Tag.QUERY_TIMEOUT.getLocalName())
.setMeasurementUnit(MeasurementUnit.SECONDS)
.setAllowExpression(true)
.setRestartAllServices()
.build();
Expand All @@ -492,6 +498,9 @@ public class Constants {
static SimpleAttributeDefinition TRANSACTION_ISOLATION = new SimpleAttributeDefinitionBuilder(TRANSACTION_ISOLATION_NAME, ModelType.STRING, true)
.setXmlName(DataSource.Tag.TRANSACTION_ISOLATION.getLocalName())
.setAllowExpression(true)
.setAllowedValues(TransactionIsolation.TRANSACTION_NONE.name(), TransactionIsolation.TRANSACTION_READ_COMMITTED.name(),
TransactionIsolation.TRANSACTION_READ_UNCOMMITTED.name(), TransactionIsolation.TRANSACTION_REPEATABLE_READ.name(),
TransactionIsolation.TRANSACTION_SERIALIZABLE.name())
.setRestartAllServices()
.build();

Expand Down Expand Up @@ -623,6 +632,7 @@ public class Constants {

static SimpleAttributeDefinition XA_RESOURCE_TIMEOUT = new SimpleAttributeDefinitionBuilder(XA_RESOURCE_TIMEOUT_NAME, ModelType.INT, true)
.setXmlName(TimeOut.Tag.XA_RESOURCE_TIMEOUT.getLocalName())
.setMeasurementUnit(MeasurementUnit.SECONDS)
.setAllowExpression(true)
.setRestartAllServices()
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public class DataSourcesExtension implements Extension {
public static final String SUBSYSTEM_NAME = Constants.DATASOURCES;
private static final String RESOURCE_NAME = DataSourcesExtension.class.getPackage().getName() + ".LocalDescriptions";

static final ModelVersion CURRENT_MODEL_VERSION = ModelVersion.create(6, 0, 0);
static final ModelVersion CURRENT_MODEL_VERSION = ModelVersion.create(7, 2, 0);

static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) {
StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME);
Expand Down Expand Up @@ -187,6 +187,7 @@ public void initializeParsers(final ExtensionParsingContext context) {
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_6_0.getUriString(), DataSourceSubsystemParser::new);
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_7_0.getUriString(), DataSourceSubsystemParser::new);
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_7_1.getUriString(), DataSourceSubsystemParser::new);
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_7_2.getUriString(), DataSourceSubsystemParser::new);
}

public static final class DataSourceSubsystemParser implements XMLStreamConstants, XMLElementReader<List<ModelNode>>,
Expand Down Expand Up @@ -282,22 +283,14 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod

}
XA_DATASOURCE_CLASS.marshallAsElement(dataSourceNode, writer);

}
DATASOURCE_DRIVER.marshallAsElement(dataSourceNode, writer);

if (isXADataSource) {
URL_DELIMITER.marshallAsElement(dataSourceNode, writer);
URL_PROPERTY.marshallAsElement(dataSourceNode, writer);
URL_SELECTOR_STRATEGY_CLASS_NAME.marshallAsElement(dataSourceNode, writer);
}
DATASOURCE_DRIVER.marshallAsElement(dataSourceNode, writer);
URL_DELIMITER.marshallAsElement(dataSourceNode, writer);
URL_SELECTOR_STRATEGY_CLASS_NAME.marshallAsElement(dataSourceNode, writer);
NEW_CONNECTION_SQL.marshallAsElement(dataSourceNode, writer);
TRANSACTION_ISOLATION.marshallAsElement(dataSourceNode, writer);

if (!isXADataSource) {
URL_DELIMITER.marshallAsElement(dataSourceNode, writer);
URL_SELECTOR_STRATEGY_CLASS_NAME.marshallAsElement(dataSourceNode, writer);
}
boolean poolRequired = INITIAL_POOL_SIZE.isMarshallable(dataSourceNode) ||
MIN_POOL_SIZE.isMarshallable(dataSourceNode) ||
MAX_POOL_SIZE.isMarshallable(dataSourceNode) ||
Expand Down Expand Up @@ -379,40 +372,6 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod
}
writer.writeEndElement();
}
boolean securityRequired = USERNAME.isMarshallable(dataSourceNode) ||
PASSWORD.isMarshallable(dataSourceNode) ||
CREDENTIAL_REFERENCE.isMarshallable(dataSourceNode) ||
SECURITY_DOMAIN.isMarshallable(dataSourceNode) ||
ELYTRON_ENABLED.isMarshallable(dataSourceNode) ||
REAUTH_PLUGIN_CLASSNAME.isMarshallable(dataSourceNode) ||
REAUTHPLUGIN_PROPERTIES.isMarshallable(dataSourceNode);
if (securityRequired) {
writer.writeStartElement(DataSource.Tag.SECURITY.getLocalName());
USERNAME.marshallAsAttribute(dataSourceNode, writer);
PASSWORD.marshallAsAttribute(dataSourceNode, writer);
SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer);
CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer);
ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer);
AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer);

if (dataSourceNode.hasDefined(REAUTH_PLUGIN_CLASSNAME.getName())) {
writer.writeStartElement(DsSecurity.Tag.REAUTH_PLUGIN.getLocalName());
writer.writeAttribute(
org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
dataSourceNode.get(REAUTH_PLUGIN_CLASSNAME.getName()).asString());

if (dataSourceNode.hasDefined(REAUTHPLUGIN_PROPERTIES.getName())) {
for (Property connectionProperty : dataSourceNode.get(REAUTHPLUGIN_PROPERTIES.getName()).asPropertyList()) {
writeProperty(writer, dataSourceNode, connectionProperty.getName(), connectionProperty
.getValue().asString(),
org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY
.getLocalName());
}
}
writer.writeEndElement();
}
writer.writeEndElement();
}

boolean recoveryRequired = RECOVERY_USERNAME.isMarshallable(dataSourceNode) ||
RECOVERY_PASSWORD.isMarshallable(dataSourceNode) ||
Expand All @@ -429,10 +388,10 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod
writer.writeStartElement(Recovery.Tag.RECOVER_CREDENTIAL.getLocalName());
RECOVERY_USERNAME.marshallAsAttribute(dataSourceNode, writer);
RECOVERY_PASSWORD.marshallAsAttribute(dataSourceNode, writer);
RECOVERY_ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer);
RECOVERY_AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer);
RECOVERY_SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer);
RECOVERY_CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer);
RECOVERY_ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer);
writer.writeEndElement();
}
if (hasAnyOf(dataSourceNode, RECOVER_PLUGIN_CLASSNAME)) {
Expand All @@ -454,6 +413,41 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod
writer.writeEndElement();
}

boolean securityRequired = USERNAME.isMarshallable(dataSourceNode) ||
PASSWORD.isMarshallable(dataSourceNode) ||
CREDENTIAL_REFERENCE.isMarshallable(dataSourceNode) ||
SECURITY_DOMAIN.isMarshallable(dataSourceNode) ||
ELYTRON_ENABLED.isMarshallable(dataSourceNode) ||
REAUTH_PLUGIN_CLASSNAME.isMarshallable(dataSourceNode) ||
REAUTHPLUGIN_PROPERTIES.isMarshallable(dataSourceNode);
if (securityRequired) {
writer.writeStartElement(DataSource.Tag.SECURITY.getLocalName());
USERNAME.marshallAsAttribute(dataSourceNode, writer);
PASSWORD.marshallAsAttribute(dataSourceNode, writer);
SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer);
AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer);
CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer);
ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer);

if (dataSourceNode.hasDefined(REAUTH_PLUGIN_CLASSNAME.getName())) {
writer.writeStartElement(DsSecurity.Tag.REAUTH_PLUGIN.getLocalName());
writer.writeAttribute(
org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
dataSourceNode.get(REAUTH_PLUGIN_CLASSNAME.getName()).asString());

if (dataSourceNode.hasDefined(REAUTHPLUGIN_PROPERTIES.getName())) {
for (Property connectionProperty : dataSourceNode.get(REAUTHPLUGIN_PROPERTIES.getName()).asPropertyList()) {
writeProperty(writer, dataSourceNode, connectionProperty.getName(), connectionProperty
.getValue().asString(),
org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY
.getLocalName());
}
}
writer.writeEndElement();
}
writer.writeEndElement();
}

boolean validationRequired = VALID_CONNECTION_CHECKER_CLASSNAME.isMarshallable(dataSourceNode) ||
VALID_CONNECTION_CHECKER_MODULE.isMarshallable(dataSourceNode) ||
VALID_CONNECTION_CHECKER_PROPERTIES.isMarshallable(dataSourceNode) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ public enum Namespace {

DATASOURCES_7_0("urn:jboss:domain:datasources:7.0"),

DATASOURCES_7_1("urn:jboss:domain:datasources:7.1");
DATASOURCES_7_1("urn:jboss:domain:datasources:7.1"),

DATASOURCES_7_2("urn:jboss:domain:datasources:7.2");

/**
* The current namespace version.
*/
public static final Namespace CURRENT = DATASOURCES_7_1;
public static final Namespace CURRENT = DATASOURCES_7_2;

private final String name;

Expand Down
Loading

0 comments on commit 53fa6b5

Please sign in to comment.