Skip to content

Commit

Permalink
[WFLY-6891] Add version 3 of the IIOP subsystem schema and model.
Browse files Browse the repository at this point in the history
  • Loading branch information
darranl committed Aug 3, 2016
1 parent b77e0ed commit 416eb66
Show file tree
Hide file tree
Showing 12 changed files with 493 additions and 17 deletions.
Expand Up @@ -72,7 +72,8 @@ public class IIOPExtension implements Extension {

private static final String RESOURCE_NAME = IIOPExtension.class.getPackage().getName() + ".LocalDescriptions";

private static final ModelVersion CURRENT_MODEL_VERSION = ModelVersion.create(1, 0, 0);
static final ModelVersion VERSION_1 = ModelVersion.create(1);
private static final ModelVersion CURRENT_MODEL_VERSION = ModelVersion.create(3);

static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) {
StringBuilder prefix = new StringBuilder(IIOPExtension.SUBSYSTEM_NAME);
Expand All @@ -88,11 +89,16 @@ public void initialize(ExtensionContext context) {
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
final ManagementResourceRegistration subsystemRegistration = subsystem.registerSubsystemModel(IIOPRootDefinition.INSTANCE);
subsystemRegistration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
subsystem.registerXMLElementWriter(IIOPSubsystemParser.INSTANCE);
subsystem.registerXMLElementWriter(IIOPSubsystemParser_3.INSTANCE);

if (context.isRegisterTransformers()) {
IIOPRootDefinition.registerTransformers(subsystem);
}
}

@Override
public void initializeParsers(ExtensionParsingContext context) {
context.setSubsystemXmlMapping(SUBSYSTEM_NAME,Namespace.IIOP_OPENJDK_1_0.getUriString(), IIOPSubsystemParser.INSTANCE);
context.setSubsystemXmlMapping(SUBSYSTEM_NAME,Namespace.IIOP_OPENJDK_1_0.getUriString(), IIOPSubsystemParser_1.INSTANCE);
context.setSubsystemXmlMapping(SUBSYSTEM_NAME,Namespace.IIOP_OPENJDK_3_0.getUriString(), IIOPSubsystemParser_3.INSTANCE);
}
}
Expand Up @@ -22,6 +22,7 @@

package org.wildfly.iiop.openjdk;

import static org.wildfly.iiop.openjdk.IIOPExtension.VERSION_1;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -32,12 +33,16 @@
import org.jboss.as.controller.PropertiesAttributeDefinition;
import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.access.constraint.SensitivityClassification;
import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition;
import org.jboss.as.controller.operations.validation.EnumValidator;
import org.jboss.as.controller.operations.validation.IntRangeValidator;
import org.jboss.as.controller.operations.validation.ParameterValidator;
import org.jboss.as.controller.registry.AttributeAccess;
import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
import org.jboss.as.controller.transform.description.TransformationDescription;
import org.jboss.as.controller.transform.description.TransformationDescriptionBuilder;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;

Expand Down Expand Up @@ -356,6 +361,16 @@ public Collection<AttributeDefinition> getAttributes() {
return ALL_ATTRIBUTES;
}

static void registerTransformers(SubsystemRegistration subsystemRegistration) {
registerTransformers_1_0_0(subsystemRegistration);
}

private static void registerTransformers_1_0_0(SubsystemRegistration subsystemRegistration) {
final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();

TransformationDescription.Tools.register(builder.build(), subsystemRegistration, VERSION_1);
}

private enum AuthMethodValues {

NONE("none"), USERNAME_PASSWORD("username_password");
Expand Down
@@ -0,0 +1,88 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
/ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.wildfly.iiop.openjdk;

import static org.jboss.as.controller.PersistentResourceXMLDescription.builder;

import java.util.List;

import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;

import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PersistentResourceXMLDescription;
import org.jboss.as.controller.persistence.SubsystemMarshallingContext;
import org.jboss.dmr.ModelNode;
import org.jboss.staxmapper.XMLElementReader;
import org.jboss.staxmapper.XMLElementWriter;
import org.jboss.staxmapper.XMLExtendedStreamReader;
import org.jboss.staxmapper.XMLExtendedStreamWriter;

/**
* <p>
* This class implements a parser for the IIOP subsystem.
* </p>
*
* @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
* @author <a href="mailto:tadamski@redhat.com">Tomasz Adamski</a>
*/
public class IIOPSubsystemParser_1 implements XMLStreamConstants, XMLElementReader<List<ModelNode>>,
XMLElementWriter<SubsystemMarshallingContext> {

static final IIOPSubsystemParser_1 INSTANCE = new IIOPSubsystemParser_1();
private static final PersistentResourceXMLDescription xmlDescription;

static {
xmlDescription = builder(IIOPRootDefinition.INSTANCE)
.setMarshallDefaultValues(true)
.addAttributes(IIOPRootDefinition.ALL_ATTRIBUTES.toArray(new AttributeDefinition[0]))
.build();
}

/**
* <p>
* Private constructor required by the {@code Singleton} pattern.
* </p>
*/
private IIOPSubsystemParser_1() {
}

/**
* {@inheritDoc}
*/
@Override
public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException {
xmlDescription.parse(reader, PathAddress.EMPTY_ADDRESS, list);
}



/**
* {@inheritDoc}
*/
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
throw new UnsupportedOperationException();
}
}
Expand Up @@ -47,10 +47,10 @@
* @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
* @author <a href="mailto:tadamski@redhat.com">Tomasz Adamski</a>
*/
public class IIOPSubsystemParser implements XMLStreamConstants, XMLElementReader<List<ModelNode>>,
public class IIOPSubsystemParser_3 implements XMLStreamConstants, XMLElementReader<List<ModelNode>>,
XMLElementWriter<SubsystemMarshallingContext> {

static final IIOPSubsystemParser INSTANCE = new IIOPSubsystemParser();
static final IIOPSubsystemParser_3 INSTANCE = new IIOPSubsystemParser_3();
private static final PersistentResourceXMLDescription xmlDescription;

static {
Expand All @@ -65,7 +65,7 @@ public class IIOPSubsystemParser implements XMLStreamConstants, XMLElementReader
* Private constructor required by the {@code Singleton} pattern.
* </p>
*/
private IIOPSubsystemParser() {
private IIOPSubsystemParser_3() {
}

/**
Expand Down
Expand Up @@ -31,9 +31,11 @@

enum Namespace {

UNKNOWN(null), IIOP_OPENJDK_1_0("urn:jboss:domain:iiop-openjdk:1.0");
UNKNOWN(null),
IIOP_OPENJDK_1_0("urn:jboss:domain:iiop-openjdk:1.0"),
IIOP_OPENJDK_3_0("urn:jboss:domain:iiop-openjdk:3.0");

static final Namespace CURRENT = IIOP_OPENJDK_1_0;
static final Namespace CURRENT = IIOP_OPENJDK_3_0;

private final String namespaceURI;

Expand Down

0 comments on commit 416eb66

Please sign in to comment.