Skip to content

Commit

Permalink
WFLY-1077 IIOP subsystem: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tadamski committed Dec 3, 2014
1 parent 11ebe70 commit 8ebc4a0
Show file tree
Hide file tree
Showing 17 changed files with 84 additions and 113 deletions.
Expand Up @@ -37,19 +37,36 @@ public class AttributeConstants {
private AttributeConstants() {
}

static final ModelNode DEFAULT_DISABLED_PROPERTY = new ModelNode().set("off");
static final ModelNode FALSE_PROPERTY = new ModelNode().set("false");

static final ModelNode DEFAULT_ENABLED_PROPERTY = new ModelNode().set("on");
static final ModelNode TRUE_PROPERTY = new ModelNode().set("true");

static final ModelNode NONE_PROPERTY = new ModelNode().set("none");

static final ParameterValidator SSL_CONFIG_VALIDATOR =
new EnumValidator<SSLConfigValue>(SSLConfigValue.class, true, false);

static final ParameterValidator ON_OFF_VALIDATOR = new EnumValidator<TransactionsAllowedValues>(
TransactionsAllowedValues.class, true, false, TransactionsAllowedValues.ON, TransactionsAllowedValues.OFF);
static final ParameterValidator TRUE_FALSE_VALIDATOR = new EnumValidator<TrueFalse>(
TrueFalse.class, true, false, TrueFalse.TRUE, TrueFalse.FALSE);

static final SensitivityClassification IIOP_SECURITY =
new SensitivityClassification(IIOPExtension.SUBSYSTEM_NAME, "iiop-security", false, false, true);

static final SensitiveTargetAccessConstraintDefinition IIOP_SECURITY_DEF = new SensitiveTargetAccessConstraintDefinition(
IIOP_SECURITY);

private static enum TrueFalse {
TRUE("true"), FALSE("false");

private String value;

private TrueFalse(String value) {
this.value = value;
}

@Override
public String toString() {
return this.value;
}
}
}
Expand Up @@ -59,8 +59,11 @@ private Constants() {
public static final String NAMING = "naming";
public static final String NAMING_EXPORT_CORBALOC = "export-corbaloc";
public static final String NAMING_ROOT_CONTEXT = "root-context";
public static final String NONE = "none";
public static final String IDENTITY = "identity";
public static final String SECURITY = "security";
public static final String SPEC = "spec";
public static final String FULL = "full";
public static final String SECURITY_SUPPORT_SSL = "support-ssl";
public static final String SECURITY_SECURITY_DOMAIN = "security-domain";
public static final String SECURITY_ADD_COMP_VIA_INTERCEPTOR = "add-component-via-interceptor";
Expand Down
Expand Up @@ -302,15 +302,14 @@ private void setupInitializers(Properties props) {
String installSecurity = (String) props.remove(Constants.ORB_INIT_SECURITY);
if (installSecurity.equalsIgnoreCase(Constants.CLIENT)) {
orbInitializers.addAll(Arrays.asList(IIOPInitializer.SECURITY_CLIENT.getInitializerClasses()));
} else if (installSecurity.equalsIgnoreCase(Constants.IDENTITY)
|| installSecurity.equalsIgnoreCase("on")) {
} else if (installSecurity.equalsIgnoreCase(Constants.IDENTITY)) {
orbInitializers.addAll(Arrays.asList(IIOPInitializer.SECURITY_IDENTITY.getInitializerClasses()));
}

String installTransaction = (String) props.remove(Constants.ORB_INIT_TRANSACTIONS);
if (installTransaction.equalsIgnoreCase("on")) {
if (installTransaction.equalsIgnoreCase(Constants.FULL)) {
orbInitializers.addAll(Arrays.asList(IIOPInitializer.TRANSACTIONS.getInitializerClasses()));
} else if (installTransaction.equalsIgnoreCase("spec")) {
} else if (installTransaction.equalsIgnoreCase(Constants.SPEC)) {
orbInitializers.addAll(Arrays.asList(IIOPInitializer.SPEC_TRANSACTIONS.getInitializerClasses()));
}

Expand Down

This file was deleted.

Expand Up @@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.List;

import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.PersistentResourceDefinition;
import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
Expand All @@ -42,14 +43,14 @@ public class InitializersDefinition extends PersistentResourceDefinition {

protected static final AttributeDefinition SECURITY = new SimpleAttributeDefinitionBuilder(
Constants.ORB_INIT_SECURITY, ModelType.STRING, true)
.setDefaultValue(AttributeConstants.DEFAULT_DISABLED_PROPERTY)
.setDefaultValue(AttributeConstants.NONE_PROPERTY)
.setValidator(new EnumValidator<SecurityAllowedValues>(SecurityAllowedValues.class, true, false))
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES).setAllowExpression(true)
.addAccessConstraint(AttributeConstants.IIOP_SECURITY_DEF).build();

protected static final AttributeDefinition TRANSACTIONS = new SimpleAttributeDefinitionBuilder(
Constants.ORB_INIT_TRANSACTIONS, ModelType.STRING, true)
.setDefaultValue(AttributeConstants.DEFAULT_DISABLED_PROPERTY)
.setDefaultValue(AttributeConstants.NONE_PROPERTY)
.setValidator(new EnumValidator<TransactionsAllowedValues>(TransactionsAllowedValues.class, true, false))
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES).setAllowExpression(true).build();

Expand All @@ -60,7 +61,7 @@ public class InitializersDefinition extends PersistentResourceDefinition {

private InitializersDefinition() {
super(IIOPExtension.PATH_INITIALIZERS, IIOPExtension.getResourceDescriptionResolver(Constants.ORB, Constants.ORB_INIT),
new InitializersAdd(ATTRIBUTES), ReloadRequiredRemoveStepHandler.INSTANCE);
new AbstractAddStepHandler(ATTRIBUTES), ReloadRequiredRemoveStepHandler.INSTANCE);
}

@Override
Expand Down
Expand Up @@ -48,7 +48,7 @@ public class NamingDefinition extends PersistentResourceDefinition {

protected static final AttributeDefinition EXPORT_CORBALOC = new SimpleAttributeDefinitionBuilder(
Constants.NAMING_EXPORT_CORBALOC, ModelType.STRING, true)
.setDefaultValue(AttributeConstants.DEFAULT_ENABLED_PROPERTY).setValidator(AttributeConstants.ON_OFF_VALIDATOR)
.setDefaultValue(AttributeConstants.TRUE_PROPERTY).setValidator(AttributeConstants.TRUE_FALSE_VALIDATOR)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES).setAllowExpression(true).build();

private static final List<AttributeDefinition> ATTRIBUTES = Collections.unmodifiableList(Arrays.asList(
Expand Down
Expand Up @@ -32,10 +32,8 @@
enum SecurityAllowedValues {

IDENTITY("identity"),
//legacy alias for 'identity'
ON("on"),
OFF("off"),
CLIENT("client");
CLIENT("client"),
NONE("none");

private String name;

Expand Down
Expand Up @@ -44,8 +44,8 @@ public class SecurityDefinition extends PersistentResourceDefinition {

public static final AttributeDefinition SUPPORT_SSL = new SimpleAttributeDefinitionBuilder(
Constants.SECURITY_SUPPORT_SSL, ModelType.STRING, true)
.setDefaultValue(AttributeConstants.DEFAULT_DISABLED_PROPERTY)
.setValidator(AttributeConstants.ON_OFF_VALIDATOR)
.setDefaultValue(AttributeConstants.FALSE_PROPERTY)
.setValidator(AttributeConstants.TRUE_FALSE_VALIDATOR)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setAllowExpression(true)
.addAccessConstraint(AttributeConstants.IIOP_SECURITY_DEF)
Expand All @@ -60,8 +60,8 @@ public class SecurityDefinition extends PersistentResourceDefinition {

public static final AttributeDefinition ADD_COMPONENT_INTERCEPTOR = new SimpleAttributeDefinitionBuilder(
Constants.SECURITY_ADD_COMP_VIA_INTERCEPTOR, ModelType.STRING, true)
.setDefaultValue(AttributeConstants.DEFAULT_ENABLED_PROPERTY)
.setValidator(AttributeConstants.ON_OFF_VALIDATOR)
.setDefaultValue(AttributeConstants.TRUE_PROPERTY)
.setValidator(AttributeConstants.TRUE_FALSE_VALIDATOR)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setAllowExpression(true)
.addAccessConstraint(AttributeConstants.IIOP_SECURITY_DEF)
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
enum TransactionsAllowedValues {

ON("on"), OFF("off"), SPEC("spec");
FULL("full"), NONE("none"), SPEC("spec");

private String name;

Expand Down
@@ -1,25 +1,28 @@
package org.wildfly.iiop.openjdk.naming;

/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, 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.
* Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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 code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* 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.
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

import org.omg.CORBA.UserException;
Expand Down
Expand Up @@ -99,23 +99,23 @@
The orbInitializersConfigType specifies the attributes used to configure the ORB initializers.
* security: indicates whether the security (SAS and CSIv2) initializers should be installed. There are three possibilities:
client - The client interceptor will be installed. Remote calls from this server will propagate
by sending the current username and password
identity - The server will just send the current username. The recieving server must trust this
server.
off - Security interceptors are not installed
client - The client interceptor will be installed. Remote calls from this server will propagate
by sending the current username and password
none - Security interceptors are not installed
* transactions: indicates which transaction initializers should be installed. There are three possibilities:
on - This requires JTS to be enabled in the transactions subsystem config, and will enable full transaction
full - This requires JTS to be enabled in the transactions subsystem config, and will enable full transaction
interaoprability with other JBoss AS instances.
spec - This does not require JTS to be enabled, but will install the minimum set of transaction interceptors
required for EJB spec compliance. These interceptors detect an incoming transaction and throw an
exception if the invocation should be run in the incoming transaction context.
off - No transaction initalizers will be installed.
none - No transaction initalizers will be installed.
]]>
</xs:documentation>
</xs:annotation>
<xs:attribute name="security" type="securityEnabledType" use="optional" default="off"/>
<xs:attribute name="transactions" type="transactionEnabledType" use="optional" default="off"/>
<xs:attribute name="security" type="securityEnabledType" use="optional" default="none"/>
<xs:attribute name="transactions" type="transactionEnabledType" use="optional" default="none"/>
</xs:complexType>

<xs:complexType name="namingConfigType">
Expand All @@ -126,12 +126,12 @@
* root-context: the naming service root context.
* export-corbaloc: indicates whether the root context should be exported as corbaloc::address:port/NameService
(on) or not (off).
(true) or not (false).
]]>
</xs:documentation>
</xs:annotation>
<xs:attribute name="root-context" type="xs:string" use="optional" default="NameService"/>
<xs:attribute name="export-corbaloc" type="onOffType" use="optional" default="on"/>
<xs:attribute name="export-corbaloc" type="trueFalseType" use="optional" default="true"/>
</xs:complexType>

<xs:complexType name="securityConfigType">
Expand All @@ -156,9 +156,9 @@
]]>
</xs:documentation>
</xs:annotation>
<xs:attribute name="support-ssl" type="onOffType" use="optional" default="off"/>
<xs:attribute name="support-ssl" type="trueFalseType" use="optional" default="false"/>
<xs:attribute name="security-domain" type="xs:string" use="optional"/>
<xs:attribute name="add-component-via-interceptor" type="onOffType" use="optional" default="on"/>
<xs:attribute name="add-component-via-interceptor" type="trueFalseType" use="optional" default="true"/>
<xs:attribute name="client-supports" type="sslConfigType" use="optional" default="MutualAuth"/>
<xs:attribute name="client-requires" type="sslConfigType" use="optional" default="None"/>
<xs:attribute name="server-supports" type="sslConfigType" use="optional" default="MutualAuth"/>
Expand Down Expand Up @@ -300,7 +300,7 @@
<xs:attribute name="detect-misordering" type="xs:string" use="optional"/>
</xs:complexType>

<xs:simpleType name="onOffType">
<xs:simpleType name="trueFalseType">
<xs:annotation>
<xs:documentation>
<![CDATA[
Expand All @@ -309,8 +309,8 @@
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:enumeration value="on"/>
<xs:enumeration value="off"/>
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>

Expand All @@ -321,8 +321,8 @@
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:enumeration value="on"/>
<xs:enumeration value="off"/>
<xs:enumeration value="full"/>
<xs:enumeration value="none"/>
<xs:enumeration value="spec"/>
</xs:restriction>
</xs:simpleType>
Expand All @@ -336,7 +336,7 @@
<xs:restriction base="xs:token">
<xs:enumeration value="identity"/>
<xs:enumeration value="client"/>
<xs:enumeration value="off"/>
<xs:enumeration value="none"/>
</xs:restriction>
</xs:simpleType>

Expand Down
Expand Up @@ -3,8 +3,8 @@
<tcp high-water-mark="${test.exp:100}" number-to-reclaim="${test.exp:30}"/>
<initializers security="${test.exp:off}" transactions="${test.exp:spec}"/>
</orb>
<naming root-context="${test.exp:JBoss/Naming/root}" export-corbaloc="${test.exp:on}"/>
<security support-ssl="${test.exp:off}" add-component-via-interceptor="${test.exp:on}" client-supports="${test.exp:MutualAuth}"
<naming root-context="${test.exp:JBoss/Naming/root}" export-corbaloc="${test.exp:false}"/>
<security support-ssl="${test.exp:false}" add-component-via-interceptor="${test.exp:true}" client-supports="${test.exp:MutualAuth}"
client-requires="${test.exp:None}" server-supports="${test.exp:MutualAuth}" server-requires="${test.exp:None}"/>
<properties>
<property name="${test.exp:some_property}" value="${test.exp:some_value}"/>
Expand Down
Expand Up @@ -4,8 +4,8 @@
<!-- set security=client -->
<initializers security="client" transactions="spec"/>
</orb>
<naming root-context="JBoss/Naming/root" export-corbaloc="on"/>
<security support-ssl="off" add-component-via-interceptor="on" client-supports="MutualAuth"
<naming root-context="JBoss/Naming/root" export-corbaloc="true"/>
<security support-ssl="false" add-component-via-interceptor="true" client-supports="MutualAuth"
client-requires="None" server-supports="MutualAuth" server-requires="None"/>
<properties>
<property name="some_property" value="some_value"/>
Expand Down
Expand Up @@ -4,8 +4,8 @@
<!-- set security=client -->
<initializers security="client" transactions="spec"/>
</orb>
<naming root-context="JBoss/Naming/root" export-corbaloc="on"/>
<security support-ssl="off" add-component-via-interceptor="on" client-supports="MutualAuth"
<naming root-context="JBoss/Naming/root" export-corbaloc="true"/>
<security support-ssl="false" add-component-via-interceptor="true" client-supports="MutualAuth"
client-requires="None" server-supports="MutualAuth" server-requires="None"/>
<properties>
<property name="some_property" value="some_value"/>
Expand Down

0 comments on commit 8ebc4a0

Please sign in to comment.