Skip to content

Commit

Permalink
Merge pull request #5090 from fjuma/WFCORE-5900
Browse files Browse the repository at this point in the history
[WFCORE-5900] Add version 16 of the WildFly Elytron model and schema
  • Loading branch information
yersan committed Jul 29, 2022
2 parents 0225cc7 + 194fad9 commit 0d4ac7e
Show file tree
Hide file tree
Showing 42 changed files with 6,872 additions and 39 deletions.
2 changes: 1 addition & 1 deletion elytron/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
<exclude>jacc-with-providers.xml</exclude>
<exclude>legacy*.xml</exclude>
</excludes>
<systemId>src/main/resources/schema/wildfly-elytron_15_1.xsd</systemId>
<systemId>src/main/resources/schema/wildfly-elytron_16_0.xsd</systemId>
</validationSet>
<validationSet>
<dir>src/main/resources/subsystem-templates</dir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ public class ElytronExtension implements Extension {
static final String NAMESPACE_14_0 = "urn:wildfly:elytron:14.0";
static final String NAMESPACE_15_0 = "urn:wildfly:elytron:15.0";
static final String NAMESPACE_15_1 = "urn:wildfly:elytron:15.1";
static final String NAMESPACE_16_0 = "urn:wildfly:elytron:16.0";

static final String CURRENT_NAMESPACE = NAMESPACE_15_1;
static final String CURRENT_NAMESPACE = NAMESPACE_16_0;

/**
* The name of our subsystem within the model.
Expand Down Expand Up @@ -100,8 +101,9 @@ public class ElytronExtension implements Extension {
static final ModelVersion ELYTRON_14_0_0 = ModelVersion.create(14);
static final ModelVersion ELYTRON_15_0_0 = ModelVersion.create(15);
static final ModelVersion ELYTRON_15_1_0 = ModelVersion.create(15, 1);
static final ModelVersion ELYTRON_16_0_0 = ModelVersion.create(16);

private static final ModelVersion ELYTRON_CURRENT = ELYTRON_15_1_0;
private static final ModelVersion ELYTRON_CURRENT = ELYTRON_16_0_0;

static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";

Expand Down Expand Up @@ -149,6 +151,7 @@ public void initializeParsers(ExtensionParsingContext context) {
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, NAMESPACE_14_0, () -> new ElytronSubsystemParser14_0());
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, NAMESPACE_15_0, () -> new ElytronSubsystemParser15_0());
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, NAMESPACE_15_1, () -> new ElytronSubsystemParser15_1());
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, NAMESPACE_16_0, () -> new ElytronSubsystemParser16_0());
}

@Override
Expand All @@ -161,7 +164,7 @@ public void initialize(ExtensionContext context) {
AtomicReference<ExpressionResolverExtension> resolverRef = new AtomicReference<>();
final ManagementResourceRegistration registration = subsystemRegistration.registerSubsystemModel(new ElytronDefinition(resolverRef));
registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
subsystemRegistration.registerXMLElementWriter(() -> new ElytronSubsystemParser15_1());
subsystemRegistration.registerXMLElementWriter(() -> new ElytronSubsystemParser16_0());

context.registerExpressionResolverExtension(resolverRef::get, ExpressionResolverResourceDefinition.INITIAL_PATTERN, false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.wildfly.extension.elytron;

/**
* The subsystem parser, which uses stax to read and write to and from xml.
*
* @author <a href="mailto:fjuma@redhat.com">Farah Juma</a>
*/
public class ElytronSubsystemParser16_0 extends ElytronSubsystemParser15_1 {

@Override
String getNameSpace() {
return ElytronExtension.NAMESPACE_16_0;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import static org.wildfly.extension.elytron.ElytronExtension.ELYTRON_14_0_0;
import static org.wildfly.extension.elytron.ElytronExtension.ELYTRON_15_0_0;
import static org.wildfly.extension.elytron.ElytronExtension.ELYTRON_15_1_0;
import static org.wildfly.extension.elytron.ElytronExtension.ELYTRON_16_0_0;
import static org.wildfly.extension.elytron.ElytronExtension.ELYTRON_1_2_0;
import static org.wildfly.extension.elytron.ElytronExtension.ELYTRON_2_0_0;
import static org.wildfly.extension.elytron.ElytronExtension.ELYTRON_3_0_0;
Expand Down Expand Up @@ -101,6 +102,8 @@ public String getSubsystemName() {
public void registerTransformers(SubsystemTransformerRegistration registration) {
ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(registration.getCurrentSubsystemVersion());

// 16.0.0 (WildFly 27) to 15.1.0 (WildFly 26.1)
from16(chainedBuilder);
// 15.1.0 (WildFly 26.1) to 15.0.0 (WildFly 26)
from15_1(chainedBuilder);
// 15.0.0 (WildFly 26) to 14.0.0 (WildFly 25)
Expand Down Expand Up @@ -132,10 +135,14 @@ public void registerTransformers(SubsystemTransformerRegistration registration)
// 2.0.0 (WildFly 12) to 1.2.0, (WildFly 11 and EAP 7.1.0)
from2(chainedBuilder);

chainedBuilder.buildAndRegister(registration, new ModelVersion[] { ELYTRON_15_0_0, ELYTRON_14_0_0, ELYTRON_13_0_0, ELYTRON_12_0_0, ELYTRON_11_0_0, ELYTRON_10_0_0, ELYTRON_9_0_0,
chainedBuilder.buildAndRegister(registration, new ModelVersion[] { ELYTRON_15_1_0, ELYTRON_15_0_0, ELYTRON_14_0_0, ELYTRON_13_0_0, ELYTRON_12_0_0, ELYTRON_11_0_0, ELYTRON_10_0_0, ELYTRON_9_0_0,
ELYTRON_8_0_0, ELYTRON_7_0_0, ELYTRON_6_0_0, ELYTRON_5_0_0, ELYTRON_4_0_0, ELYTRON_3_0_0, ELYTRON_2_0_0, ELYTRON_1_2_0 });
}

private static void from16(ChainedTransformationDescriptionBuilder chainedBuilder) {
ResourceTransformationDescriptionBuilder builder = chainedBuilder.createBuilder(ELYTRON_16_0_0, ELYTRON_15_1_0);
}

private static void from15_1(ChainedTransformationDescriptionBuilder chainedBuilder) {
ResourceTransformationDescriptionBuilder builder = chainedBuilder.createBuilder(ELYTRON_15_1_0, ELYTRON_15_0_0);

Expand Down

0 comments on commit 0d4ac7e

Please sign in to comment.