Skip to content

Commit

Permalink
Merge pull request #14059 from soul2zimate/WFLY-14388
Browse files Browse the repository at this point in the history
WFLY-14388 resolve expression for transaction-support attribute in r-a subsystem.
  • Loading branch information
bstansberry committed Mar 8, 2021
2 parents 8709d49 + f3fb8c4 commit d4f421c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected void parseConnectionDefinitions_3_0(final XMLExtendedStreamReader read
break;
}
case TIMEOUT: {
parseTimeOut(reader, isXa, connectionDefinitionNode);
parseTimeOut(reader, connectionDefinitionNode);
break;
}
case VALIDATION: {
Expand Down Expand Up @@ -426,7 +426,7 @@ protected void parseConnectionDefinitions_4_0(final XMLExtendedStreamReader read
break;
}
case TIMEOUT: {
parseTimeOut(reader, isXa, connectionDefinitionNode);
parseTimeOut(reader, connectionDefinitionNode);
break;
}
case VALIDATION: {
Expand Down Expand Up @@ -610,7 +610,7 @@ protected void parseConnectionDefinitions_5_0(final XMLExtendedStreamReader read
break;
}
case TIMEOUT: {
parseTimeOut(reader, isXa, connectionDefinitionNode);
parseTimeOut(reader, connectionDefinitionNode);
break;
}
case VALIDATION: {
Expand Down Expand Up @@ -765,7 +765,7 @@ protected void parseConnectionDefinitions_1_0(final XMLExtendedStreamReader read
break;
}
case TIMEOUT: {
parseTimeOut(reader, isXa, connectionDefinitionNode);
parseTimeOut(reader, connectionDefinitionNode);
break;
}
case VALIDATION: {
Expand Down Expand Up @@ -859,7 +859,7 @@ private void parseValidation(XMLExtendedStreamReader reader, ModelNode node) thr
throw ParseUtils.unexpectedEndElement(reader);
}

private void parseTimeOut(XMLExtendedStreamReader reader, Boolean isXa, ModelNode node) throws XMLStreamException,
private void parseTimeOut(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException,
ParserException, ValidateException {

while (reader.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ public static ModifiableResourceAdapter buildResourceAdaptersObject(final String
Map<String, String> configProperties = new HashMap<>(0);
List<ConnectionDefinition> connectionDefinitions = new ArrayList<>(0);
List<AdminObject> adminObjects = new ArrayList<>(0);
String transactionSupportResolved = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, TRANSACTION_SUPPORT);
TransactionSupportEnum transactionSupport = operation.hasDefined(TRANSACTION_SUPPORT.getName()) ? TransactionSupportEnum
.valueOf(operation.get(TRANSACTION_SUPPORT.getName()).asString()) : null;
.valueOf(ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, TRANSACTION_SUPPORT)) : null;
String bootstrapContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, BOOTSTRAP_CONTEXT);
List<String> beanValidationGroups = BEANVALIDATION_GROUPS.unwrap(context, operation);
boolean wmSecurity = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, operation, WM_SECURITY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ private void parseResourceAdapter(final XMLExtendedStreamReader reader, final Li
}
String value = rawElementText(reader);
TRANSACTION_SUPPORT.parseAndSetParameter(value, operation, reader);
isXa = value != null && TransactionSupportEnum.valueOf(value) == TransactionSupportEnum.XATransaction;
ModelNode transactionSupport = TRANSACTION_SUPPORT.parse(value, reader);
// so we need to know the transaction support level to give a chance to throw XMLStreamException for
// unexpectedElement when parsing connection-definitions in CommonIronJacamarParser ?
String transactionSupportResolved = transactionSupport.resolve().asString();
isXa = value != null && TransactionSupportEnum.valueOf(transactionSupportResolved) == TransactionSupportEnum.XATransaction;
txSupportMatched = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private void writeRaElement(XMLExtendedStreamWriter streamWriter, ModelNode ra,
TRANSACTION_SUPPORT.marshallAsElement(ra, streamWriter);
writeNewConfigProperties(streamWriter, ra);
TransactionSupportEnum transactionSupport = ra.hasDefined(TRANSACTION_SUPPORT.getName()) ? TransactionSupportEnum
.valueOf(ra.get(TRANSACTION_SUPPORT.getName()).asString()) : null;
.valueOf(ra.get(TRANSACTION_SUPPORT.getName()).resolve().asString()) : null;
boolean isXa = false;
if (transactionSupport == TransactionSupportEnum.XATransaction) {
isXa = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<bean-validation-group>${test.expr:group}</bean-validation-group>
</bean-validation-groups>
<!--Optional:-->
<transaction-support>XATransaction</transaction-support>
<transaction-support>${test.expr:XATransaction}</transaction-support>
<!--Zero or more repetitions:-->
<config-property name="config1">value</config-property>
<!--Optional:-->
Expand Down

This file was deleted.

0 comments on commit d4f421c

Please sign in to comment.