diff --git a/build/src/main/resources/docs/schema/jboss-as-remoting_1_0.xsd b/build/src/main/resources/docs/schema/jboss-as-remoting_1_0.xsd index 7b4ff62ff42..7c163aa9ec2 100644 --- a/build/src/main/resources/docs/schema/jboss-as-remoting_1_0.xsd +++ b/build/src/main/resources/docs/schema/jboss-as-remoting_1_0.xsd @@ -100,8 +100,8 @@ - - + + @@ -158,6 +158,17 @@ + + + + + + + + + @@ -169,7 +180,18 @@ - + + + + + + + + + + process-controller protocol remoting + remoting-test sar security server diff --git a/remoting-test/pom.xml b/remoting-test/pom.xml new file mode 100644 index 00000000000..ac9da86743d --- /dev/null +++ b/remoting-test/pom.xml @@ -0,0 +1,94 @@ + + + + + 4.0.0 + + + org.jboss.as + jboss-as-parent + 7.1.0.Alpha2-SNAPSHOT + + + org.jboss.as + jboss-as-remoting-test + 7.1.0.Alpha2-SNAPSHOT + + JBoss Application Server: Remoting Subsystem Test + + + INFO + + + + + + maven-surefire-plugin + + + + java.util.logging.manager + org.jboss.logmanager.LogManager + + + jboss.remoting.leakdebugging + false + + + test.level + ${test.level} + + + + + + + + + + org.jboss.as + jboss-as-remoting + + + + + + org.jboss.logmanager + jboss-logmanager + test + + + junit + junit + test + + + org.jboss.as + jboss-as-subsystem-test + test + + + + diff --git a/remoting-test/src/test/java/org/jboss/as/remoting/RemotingSubsystemTestCase.java b/remoting-test/src/test/java/org/jboss/as/remoting/RemotingSubsystemTestCase.java new file mode 100644 index 00000000000..c65a9916442 --- /dev/null +++ b/remoting-test/src/test/java/org/jboss/as/remoting/RemotingSubsystemTestCase.java @@ -0,0 +1,50 @@ +/* +* JBoss, Home of Professional Open Source. +* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.remoting; + +import java.io.IOException; + +import junit.framework.Assert; + +import org.jboss.as.subsystem.test.AbstractSubsystemBaseTest; + +/** + * + * @author Kabir Khan + */ +public class RemotingSubsystemTestCase extends AbstractSubsystemBaseTest { + + public RemotingSubsystemTestCase() { + // FIXME RemotingSubsystemTestCase constructor + super(RemotingExtension.SUBSYSTEM_NAME, new RemotingExtension()); + } + + @Override + protected String getSubsystemXml() throws IOException { + return readResource("remoting.xml"); + } + + @Override + protected void validateXml(String original, String marshalled) throws Exception { + Assert.assertEquals(original, marshalled); + } +} diff --git a/remoting-test/src/test/resources/org/jboss/as/remoting/remoting.xml b/remoting-test/src/test/resources/org/jboss/as/remoting/remoting.xml new file mode 100644 index 00000000000..d7f71292c13 --- /dev/null +++ b/remoting-test/src/test/resources/org/jboss/as/remoting/remoting.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/remoting/src/main/java/org/jboss/as/remoting/CommonAttributes.java b/remoting/src/main/java/org/jboss/as/remoting/CommonAttributes.java index 448280e826f..18ecd935bb0 100644 --- a/remoting/src/main/java/org/jboss/as/remoting/CommonAttributes.java +++ b/remoting/src/main/java/org/jboss/as/remoting/CommonAttributes.java @@ -34,7 +34,7 @@ interface CommonAttributes { String NO_ACTIVE = "no-active"; String NO_ANONYMOUS = "no-anonymous"; String NO_DICTIONARY = "no-dictionary"; - String NO_PLAINTEXT = "no-plaintext"; + String NO_PLAIN_TEXT = "no-plain-text"; String PASS_CREDENTIALS = "pass-credentials"; String POLICY = "policy"; String PROPERTIES = "properties"; @@ -42,6 +42,8 @@ interface CommonAttributes { String QOP = "qop"; String REUSE_SESSION= "reuse-session"; String SASL = "sasl"; + String SASL_POLICY = "sasl-policy"; + String SECURITY = "security"; String SERVER_AUTH = "server-auth"; String SOCKET_BINDING = "socket-binding"; String STRENGTH = "strength"; diff --git a/remoting/src/main/java/org/jboss/as/remoting/ConnectorAdd.java b/remoting/src/main/java/org/jboss/as/remoting/ConnectorAdd.java index 1b64b3d7e01..4fd2abf7192 100644 --- a/remoting/src/main/java/org/jboss/as/remoting/ConnectorAdd.java +++ b/remoting/src/main/java/org/jboss/as/remoting/ConnectorAdd.java @@ -23,26 +23,22 @@ package org.jboss.as.remoting; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; -import static org.jboss.as.remoting.CommonAttributes.AUTHENTICATION_PROVIDER; import static org.jboss.as.remoting.CommonAttributes.FORWARD_SECRECY; import static org.jboss.as.remoting.CommonAttributes.INCLUDE_MECHANISMS; import static org.jboss.as.remoting.CommonAttributes.NO_ACTIVE; import static org.jboss.as.remoting.CommonAttributes.NO_ANONYMOUS; import static org.jboss.as.remoting.CommonAttributes.NO_DICTIONARY; -import static org.jboss.as.remoting.CommonAttributes.NO_PLAINTEXT; +import static org.jboss.as.remoting.CommonAttributes.NO_PLAIN_TEXT; import static org.jboss.as.remoting.CommonAttributes.PASS_CREDENTIALS; import static org.jboss.as.remoting.CommonAttributes.POLICY; -import static org.jboss.as.remoting.CommonAttributes.PROPERTIES; import static org.jboss.as.remoting.CommonAttributes.QOP; import static org.jboss.as.remoting.CommonAttributes.SASL; import static org.jboss.as.remoting.CommonAttributes.SERVER_AUTH; -import static org.jboss.as.remoting.CommonAttributes.SOCKET_BINDING; import static org.jboss.as.remoting.CommonAttributes.STRENGTH; import java.util.Collection; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Set; import org.jboss.as.controller.AbstractAddStepHandler; @@ -50,7 +46,6 @@ import org.jboss.as.controller.OperationFailedException; import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.ServiceVerificationHandler; -import org.jboss.as.controller.descriptions.DescriptionProvider; import org.jboss.as.network.SocketBinding; import org.jboss.dmr.ModelNode; import org.jboss.msc.service.ServiceController; @@ -67,23 +62,15 @@ * * @author David M. Lloyd * @author Emanuel Muckenhuber + * @author Kabir Khan */ -public class ConnectorAdd extends AbstractAddStepHandler implements DescriptionProvider { +public class ConnectorAdd extends AbstractAddStepHandler { static final ConnectorAdd INSTANCE = new ConnectorAdd(); - protected void populateModel(ModelNode operation, ModelNode model) { - model.get(SOCKET_BINDING).set(operation.require(SOCKET_BINDING)); - if (operation.hasDefined(AUTHENTICATION_PROVIDER)) { - model.get(AUTHENTICATION_PROVIDER).set(operation.get(AUTHENTICATION_PROVIDER)); - } - // - if (operation.hasDefined(SASL)) { - model.get(SASL).set(operation.get(SASL)); - } - if (operation.hasDefined(PROPERTIES)) { - model.get(PROPERTIES).set(operation.get(PROPERTIES)); - } + protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException{ + ConnectorResource.SOCKET_BINDING_ATTRIBUTE.validateAndSet(operation, model); + ConnectorResource.AUTHENTICATION_PROVIER_ATTRIBUTE.validateAndSet(operation, model); } protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List> newControllers) throws OperationFailedException { @@ -93,8 +80,10 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod final ServiceTarget target = context.getServiceTarget(); - ServiceName socketBindingName = SocketBinding.JBOSS_BINDING_NAME.append(operation.require(SOCKET_BINDING).asString()); + ServiceName socketBindingName = SocketBinding.JBOSS_BINDING_NAME.append(ConnectorResource.SOCKET_BINDING_ATTRIBUTE.validateOperation(model).asString()); RemotingServices.installConnectorServicesForSocketBinding(target, RemotingServices.SUBSYSTEM_ENDPOINT, connectorName, socketBindingName, null, null, verificationHandler, newControllers); + + //TODO AuthenticationHandler // // final ConnectorService connectorService = new ConnectorService(); // connectorService.setOptionMap(createOptionMap(operation)); @@ -131,7 +120,7 @@ static OptionMap createOptionMap(final ModelNode parameters) { builder.set(Options.SASL_POLICY_NOACTIVE, policy.get(NO_ACTIVE).asBoolean()); builder.set(Options.SASL_POLICY_NOANONYMOUS, policy.get(NO_ANONYMOUS).asBoolean()); builder.set(Options.SASL_POLICY_NODICTIONARY, policy.get(NO_DICTIONARY).asBoolean()); - builder.set(Options.SASL_POLICY_NOPLAINTEXT, policy.get(NO_PLAINTEXT).asBoolean()); + builder.set(Options.SASL_POLICY_NOPLAINTEXT, policy.get(NO_PLAIN_TEXT).asBoolean()); builder.set(Options.SASL_POLICY_PASS_CREDENTIALS, policy.get(PASS_CREDENTIALS).asBoolean()); } } @@ -153,9 +142,4 @@ static Collection asQopSet(final ModelNode node) { } return set; } - - public ModelNode getModelDescription(Locale locale) { - return RemotingSubsystemProviders.CONNECTOR_ADD.getModelDescription(locale); - } - } diff --git a/remoting/src/main/java/org/jboss/as/remoting/ConnectorRemove.java b/remoting/src/main/java/org/jboss/as/remoting/ConnectorRemove.java index b25961b36a8..32de94dc100 100644 --- a/remoting/src/main/java/org/jboss/as/remoting/ConnectorRemove.java +++ b/remoting/src/main/java/org/jboss/as/remoting/ConnectorRemove.java @@ -24,12 +24,9 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; -import java.util.Locale; - import org.jboss.as.controller.AbstractRemoveStepHandler; import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.PathAddress; -import org.jboss.as.controller.descriptions.DescriptionProvider; import org.jboss.dmr.ModelNode; /** @@ -38,7 +35,7 @@ * @author David M. Lloyd * @author Emanuel Muckenhuber */ -public class ConnectorRemove extends AbstractRemoveStepHandler implements DescriptionProvider { +public class ConnectorRemove extends AbstractRemoveStepHandler { static final ConnectorRemove INSTANCE = new ConnectorRemove(); @@ -51,10 +48,4 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) { // TODO: RE-ADD SERVICES } - - @Override - public ModelNode getModelDescription(Locale locale) { - return RemotingSubsystemProviders.CONNECTOR_REMOVE.getModelDescription(locale); - } - } diff --git a/remoting/src/main/java/org/jboss/as/remoting/ConnectorResource.java b/remoting/src/main/java/org/jboss/as/remoting/ConnectorResource.java new file mode 100644 index 00000000000..7fb2f010491 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/ConnectorResource.java @@ -0,0 +1,59 @@ +/* +* JBoss, Home of Professional Open Source. +* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.remoting; + +import static org.jboss.as.remoting.CommonAttributes.AUTHENTICATION_PROVIDER; +import static org.jboss.as.remoting.CommonAttributes.CONNECTOR; +import static org.jboss.as.remoting.CommonAttributes.SOCKET_BINDING; + +import org.jboss.as.controller.PathElement; +import org.jboss.as.controller.SimpleAttributeDefinition; +import org.jboss.as.controller.SimpleResourceDefinition; +import org.jboss.as.controller.registry.ManagementResourceRegistration; +import org.jboss.dmr.ModelType; + +/** + * + * @author Kabir Khan + */ +public class ConnectorResource extends SimpleResourceDefinition { + + static final ConnectorResource INSTANCE = new ConnectorResource(); + + static final SimpleAttributeDefinition SOCKET_BINDING_ATTRIBUTE = new SimpleAttributeDefinition(SOCKET_BINDING, ModelType.STRING, false); + static final SimpleAttributeDefinition AUTHENTICATION_PROVIER_ATTRIBUTE = new NamedValueAttributeDefinition(AUTHENTICATION_PROVIDER, Attribute.NAME, null, ModelType.STRING, true); + + private ConnectorResource() { + super(PathElement.pathElement(CommonAttributes.CONNECTOR), + RemotingExtension.getResourceDescriptionResolver(CONNECTOR), + ConnectorAdd.INSTANCE, + ConnectorRemove.INSTANCE); + } + + @Override + public void registerAttributes(ManagementResourceRegistration resourceRegistration) { + resourceRegistration.registerReadOnlyAttribute(SOCKET_BINDING_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(AUTHENTICATION_PROVIER_ATTRIBUTE, null); + } + + +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/Element.java b/remoting/src/main/java/org/jboss/as/remoting/Element.java index a23dc5ce469..9c646aa8808 100644 --- a/remoting/src/main/java/org/jboss/as/remoting/Element.java +++ b/remoting/src/main/java/org/jboss/as/remoting/Element.java @@ -40,7 +40,7 @@ public enum Element { NO_ACTIVE("no-active"), NO_ANONYMOUS("no-anonymous"), NO_DICTIONARY("no-dictionary"), - NO_PLAINTEXT("no-plaintext"), + NO_PLAIN_TEXT("no-plain-text"), PASS_CREDENTIALS("pass-credentials"), POLICY("policy"), PROPERTIES("properties"), diff --git a/remoting/src/main/java/org/jboss/as/remoting/NamedValueAttributeDefinition.java b/remoting/src/main/java/org/jboss/as/remoting/NamedValueAttributeDefinition.java new file mode 100644 index 00000000000..60de2ec9a88 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/NamedValueAttributeDefinition.java @@ -0,0 +1,46 @@ +/* +* JBoss, Home of Professional Open Source. +* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.remoting; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.jboss.as.controller.SimpleAttributeDefinition; +import org.jboss.dmr.ModelNode; +import org.jboss.dmr.ModelType; + +class NamedValueAttributeDefinition extends SimpleAttributeDefinition { + final Attribute attribute; + public NamedValueAttributeDefinition(final String name, final Attribute attribute, final ModelNode defaultValue, final ModelType type, final boolean allowNull) { + super(name, defaultValue, type, allowNull); + this.attribute = attribute; + } + + @Override + public void marshallAsElement(ModelNode resourceModel, XMLStreamWriter writer) + throws XMLStreamException { + if (isMarshallable(resourceModel)) { + writer.writeEmptyElement(getXmlName()); + writer.writeAttribute(attribute.getLocalName(), resourceModel.get(getName()).asString()); + } + } +} \ No newline at end of file diff --git a/remoting/src/main/java/org/jboss/as/remoting/PropertyAdd.java b/remoting/src/main/java/org/jboss/as/remoting/PropertyAdd.java new file mode 100644 index 00000000000..22ff4765ee8 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/PropertyAdd.java @@ -0,0 +1,50 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2010, 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.jboss.as.remoting; + +import java.util.List; + +import org.jboss.as.controller.AbstractAddStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.as.controller.OperationFailedException; +import org.jboss.as.controller.ServiceVerificationHandler; +import org.jboss.dmr.ModelNode; +import org.jboss.msc.service.ServiceController; + +/** + * Add a connector to a remoting container. + * + * @author Kabir Khan + */ +public class PropertyAdd extends AbstractAddStepHandler { + + static final PropertyAdd INSTANCE = new PropertyAdd(); + + protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException{ + PropertyResource.VALUE_ATTRIBUTE.validateAndSet(operation, model); + } + + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List> newControllers) throws OperationFailedException { + } + +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/PropertyRemove.java b/remoting/src/main/java/org/jboss/as/remoting/PropertyRemove.java new file mode 100644 index 00000000000..6a9553e20e6 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/PropertyRemove.java @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2010, 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.jboss.as.remoting; + +import org.jboss.as.controller.AbstractRemoveStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.dmr.ModelNode; + +/** + * Removes a connector from the remoting container. + * + * @author Kabir Khan + */ +public class PropertyRemove extends AbstractRemoveStepHandler { + + static final PropertyRemove INSTANCE = new PropertyRemove(); + + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { + } + + protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) { + } +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/PropertyResource.java b/remoting/src/main/java/org/jboss/as/remoting/PropertyResource.java new file mode 100644 index 00000000000..9f655f28821 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/PropertyResource.java @@ -0,0 +1,56 @@ +/* +* JBoss, Home of Professional Open Source. +* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.remoting; + +import static org.jboss.as.remoting.CommonAttributes.PROPERTY; +import static org.jboss.as.remoting.CommonAttributes.VALUE; + +import org.jboss.as.controller.PathElement; +import org.jboss.as.controller.SimpleAttributeDefinition; +import org.jboss.as.controller.SimpleResourceDefinition; +import org.jboss.as.controller.registry.ManagementResourceRegistration; +import org.jboss.dmr.ModelType; + +/** + * + * @author Kabir Khan + */ +public class PropertyResource extends SimpleResourceDefinition { + + static final PropertyResource INSTANCE = new PropertyResource(); + + static final SimpleAttributeDefinition VALUE_ATTRIBUTE = new NamedValueAttributeDefinition(VALUE, Attribute.VALUE, null, ModelType.STRING, true); + + private PropertyResource() { + super(PathElement.pathElement(PROPERTY), + RemotingExtension.getResourceDescriptionResolver(PROPERTY), + PropertyAdd.INSTANCE, + PropertyRemove.INSTANCE); + } + + @Override + public void registerAttributes(ManagementResourceRegistration resourceRegistration) { + resourceRegistration.registerReadOnlyAttribute(VALUE_ATTRIBUTE, null); + } + + +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/RemotingExtension.java b/remoting/src/main/java/org/jboss/as/remoting/RemotingExtension.java index 2663e44903a..205f419f3f4 100644 --- a/remoting/src/main/java/org/jboss/as/remoting/RemotingExtension.java +++ b/remoting/src/main/java/org/jboss/as/remoting/RemotingExtension.java @@ -27,7 +27,6 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIBE; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM; import static org.jboss.as.controller.parsing.ParseUtils.missingRequired; import static org.jboss.as.controller.parsing.ParseUtils.readArrayAttributeElement; @@ -44,35 +43,32 @@ import static org.jboss.as.remoting.CommonAttributes.NO_ACTIVE; import static org.jboss.as.remoting.CommonAttributes.NO_ANONYMOUS; import static org.jboss.as.remoting.CommonAttributes.NO_DICTIONARY; -import static org.jboss.as.remoting.CommonAttributes.NO_PLAINTEXT; +import static org.jboss.as.remoting.CommonAttributes.NO_PLAIN_TEXT; import static org.jboss.as.remoting.CommonAttributes.PASS_CREDENTIALS; import static org.jboss.as.remoting.CommonAttributes.POLICY; -import static org.jboss.as.remoting.CommonAttributes.PROPERTIES; +import static org.jboss.as.remoting.CommonAttributes.PROPERTY; import static org.jboss.as.remoting.CommonAttributes.QOP; import static org.jboss.as.remoting.CommonAttributes.REUSE_SESSION; import static org.jboss.as.remoting.CommonAttributes.SASL; +import static org.jboss.as.remoting.CommonAttributes.SASL_POLICY; +import static org.jboss.as.remoting.CommonAttributes.SECURITY; import static org.jboss.as.remoting.CommonAttributes.SERVER_AUTH; import static org.jboss.as.remoting.CommonAttributes.SOCKET_BINDING; import static org.jboss.as.remoting.CommonAttributes.STRENGTH; -import static org.jboss.as.remoting.CommonAttributes.THREAD_POOL; +import static org.jboss.as.remoting.CommonAttributes.VALUE; import java.util.EnumSet; import java.util.List; -import java.util.Locale; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import org.jboss.as.controller.Extension; import org.jboss.as.controller.ExtensionContext; -import org.jboss.as.controller.OperationContext; -import org.jboss.as.controller.OperationFailedException; -import org.jboss.as.controller.OperationStepHandler; -import org.jboss.as.controller.PathAddress; -import org.jboss.as.controller.PathElement; import org.jboss.as.controller.SubsystemRegistration; -import org.jboss.as.controller.descriptions.DescriptionProvider; -import org.jboss.as.controller.descriptions.common.CommonDescriptions; +import org.jboss.as.controller.descriptions.ResourceDescriptionResolver; +import org.jboss.as.controller.descriptions.StandardResourceDescriptionResolver; +import org.jboss.as.controller.operations.common.GenericSubsystemDescribeHandler; import org.jboss.as.controller.operations.common.Util; import org.jboss.as.controller.parsing.ExtensionParsingContext; import org.jboss.as.controller.parsing.ParseUtils; @@ -80,7 +76,6 @@ import org.jboss.as.controller.registry.ManagementResourceRegistration; import org.jboss.as.controller.registry.OperationEntry; import org.jboss.dmr.ModelNode; -import org.jboss.dmr.ModelType; import org.jboss.dmr.Property; import org.jboss.staxmapper.XMLElementReader; import org.jboss.staxmapper.XMLElementWriter; @@ -99,8 +94,17 @@ public class RemotingExtension implements Extension { public static final String SUBSYSTEM_NAME = "remoting"; - //This is given by ServerEnvironment.NODE_NAME - private static final String NODE_NAME = "jboss.node.name"; + private static final String RESOURCE_NAME = RemotingExtension.class.getPackage().getName() + ".LocalDescriptions"; + + private static final String NODE_NAME_PROPERTY = "jboss.node.name"; + static final String NODE_NAME; + static { + NODE_NAME = SecurityActions.getSystemProperty(RemotingExtension.NODE_NAME_PROPERTY); + } + + static ResourceDescriptionResolver getResourceDescriptionResolver(final String keyPrefix) { + return new StandardResourceDescriptionResolver(keyPrefix, RESOURCE_NAME, RemotingExtension.class.getClassLoader(), true, false); + } @Override public void initialize(ExtensionContext context) { @@ -108,17 +112,15 @@ public void initialize(ExtensionContext context) { // Register the remoting subsystem final SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME); registration.registerXMLElementWriter(NewRemotingSubsystemParser.INSTANCE); - // Remoting subsystem description and operation handlers - final ManagementResourceRegistration subsystem = registration.registerSubsystemModel(RemotingSubsystemProviders.SUBSYSTEM); - subsystem.registerOperationHandler(ADD, new RemotingSubsystemAdd(SecurityActions.getSystemProperty(NODE_NAME)), RemotingSubsystemProviders.SUBSYSTEM_ADD, false); - subsystem.registerOperationHandler(DESCRIBE, RemotingSubsystemDescribeHandler.INSTANCE, RemotingSubsystemDescribeHandler.INSTANCE, false, OperationEntry.EntryType.PRIVATE); - // Remoting connectors - final ManagementResourceRegistration connectors = subsystem.registerSubModel(PathElement.pathElement(CONNECTOR), RemotingSubsystemProviders.CONNECTOR_SPEC); - connectors.registerOperationHandler(ADD, ConnectorAdd.INSTANCE, ConnectorAdd.INSTANCE, false); - connectors.registerOperationHandler(REMOVE, ConnectorRemove.INSTANCE, ConnectorRemove.INSTANCE, false); + final ManagementResourceRegistration subsystem = registration.registerSubsystemModel(RemotingSubsystemRootResource.INSTANCE); + subsystem.registerOperationHandler(DESCRIBE, GenericSubsystemDescribeHandler.INSTANCE, GenericSubsystemDescribeHandler.INSTANCE, false, OperationEntry.EntryType.PRIVATE); - connectors.registerSubModel(PathElement.pathElement(SASL), RemotingSubsystemProviders.SASL_SPEC); + final ManagementResourceRegistration connector = subsystem.registerSubModel(ConnectorResource.INSTANCE); + connector.registerSubModel(PropertyResource.INSTANCE); + final ManagementResourceRegistration sasl = connector.registerSubModel(SaslResource.INSTANCE); + sasl.registerSubModel(SaslPolicyResource.INSTANCE); + sasl.registerSubModel(PropertyResource.INSTANCE); } /** @@ -222,6 +224,7 @@ void parseConnector(XMLExtendedStreamReader reader, final ModelNode address, fin connector.get(OP_ADDR).set(address).add(CONNECTOR, name); // requestProperties.get(NAME).set(name); // Name is part of the address connector.get(SOCKET_BINDING).set(socketBinding); + list.add(connector); // Handle nested elements. final EnumSet visited = EnumSet.noneOf(Element.class); @@ -235,11 +238,11 @@ void parseConnector(XMLExtendedStreamReader reader, final ModelNode address, fin visited.add(element); switch (element) { case SASL: { - connector.get(SASL).set(parseSaslElement(reader)); + parseSaslElement(reader, connector.get(OP_ADDR), list); break; } case PROPERTIES: { - parseProperties(reader, connector.get(PROPERTIES)); + parseProperties(reader, connector.get(OP_ADDR), list); break; } case AUTHENTICATION_PROVIDER: { @@ -257,12 +260,13 @@ void parseConnector(XMLExtendedStreamReader reader, final ModelNode address, fin } } } - - list.add(connector); } - ModelNode parseSaslElement(final XMLExtendedStreamReader reader) throws XMLStreamException { + void parseSaslElement(final XMLExtendedStreamReader reader, final ModelNode address, final List list) throws XMLStreamException { final ModelNode saslElement = new ModelNode(); + saslElement.get(OP).set(ADD); + saslElement.get(OP_ADDR).set(address).add(SaslResource.SASL_CONFIG_PATH.getKey(), SaslResource.SASL_CONFIG_PATH.getValue()); + list.add(saslElement); // No attributes final int count = reader.getAttributeCount(); @@ -288,16 +292,22 @@ ModelNode parseSaslElement(final XMLExtendedStreamReader reader) throws XMLStrea break; } case POLICY: { - saslElement.get(POLICY).set(parsePolicyElement(reader)); + parsePolicyElement(reader, saslElement.get(OP_ADDR), list); break; } case PROPERTIES: { - parseProperties(reader, saslElement.get(PROPERTIES)); + parseProperties(reader, saslElement.get(OP_ADDR), list); break; } case QOP: { - //FIXME is this really an attribute? - saslElement.get(QOP).set(readArrayAttributeElement(reader, "value", SaslQop.class).toString()); + String[] qop = readArrayAttributeElement(reader, "value", String.class); + for (String q : qop) { + try { + saslElement.get(QOP).add(SaslQop.fromString(q).getString().toLowerCase()); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Invalid QOP value: " + q); + } + } break; } case REUSE_SESSION: { @@ -310,7 +320,14 @@ ModelNode parseSaslElement(final XMLExtendedStreamReader reader) throws XMLStrea } case STRENGTH: { //FIXME is this really an xml attribute? - saslElement.get(STRENGTH).set(readArrayAttributeElement(reader, "value", SaslStrength.class).toString()); + String[] strength = readArrayAttributeElement(reader, "value", String.class); + for (String s : strength) { + try { + saslElement.get(STRENGTH).add(SaslStrength.valueOf(s.toUpperCase()).name().toLowerCase()); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Invalid Strength value: " + s); + } + } break; } default: { @@ -324,11 +341,14 @@ ModelNode parseSaslElement(final XMLExtendedStreamReader reader) throws XMLStrea } } } - return saslElement; } - ModelNode parsePolicyElement(XMLExtendedStreamReader reader) throws XMLStreamException { + ModelNode parsePolicyElement(XMLExtendedStreamReader reader, final ModelNode address, final List list) throws XMLStreamException { final ModelNode policy = new ModelNode(); + policy.get(OP).set(ADD); + policy.get(OP_ADDR).set(address).add(SaslPolicyResource.SASL_POLICY_CONFIG_PATH.getKey(), SaslPolicyResource.SASL_POLICY_CONFIG_PATH.getValue()); + list.add(policy); + if (reader.getAttributeCount() > 0) { throw ParseUtils.unexpectedAttribute(reader, 0); } @@ -352,15 +372,15 @@ ModelNode parsePolicyElement(XMLExtendedStreamReader reader) throws XMLStreamExc break; } case NO_ANONYMOUS: { - policy.set(NO_ANONYMOUS).set(readBooleanAttributeElement(reader, "value")); + policy.get(NO_ANONYMOUS).set(readBooleanAttributeElement(reader, "value")); break; } case NO_DICTIONARY: { policy.get(NO_DICTIONARY).set(readBooleanAttributeElement(reader, "value")); break; } - case NO_PLAINTEXT: { - policy.get(NO_PLAINTEXT).set(readBooleanAttributeElement(reader, "value")); + case NO_PLAIN_TEXT: { + policy.get(NO_PLAIN_TEXT).set(readBooleanAttributeElement(reader, "value")); break; } case PASS_CREDENTIALS: { @@ -381,11 +401,15 @@ ModelNode parsePolicyElement(XMLExtendedStreamReader reader) throws XMLStreamExc return policy; } - void parseProperties(XMLExtendedStreamReader reader, final ModelNode node) throws XMLStreamException { + private void parseProperties(XMLExtendedStreamReader reader, final ModelNode address, final List list) throws XMLStreamException { while (reader.nextTag() != END_ELEMENT) { reader.require(START_ELEMENT, Namespace.CURRENT.getUriString(), Element.PROPERTY.getLocalName()); final Property property = readProperty(reader); - node.set(property); + ModelNode propertyOp = new ModelNode(); + propertyOp.get(OP).set(ADD); + propertyOp.get(OP_ADDR).set(address).add(PROPERTY, property.getName()); + propertyOp.get(VALUE).set(property.getValue()); + list.add(propertyOp); } } @@ -411,60 +435,43 @@ public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingCon private void writeConnector(final XMLExtendedStreamWriter writer, final ModelNode node, final String name) throws XMLStreamException { writer.writeStartElement(Element.CONNECTOR.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), name); - writeAttribute(writer, Attribute.SOCKET_BINDING, node.require(SOCKET_BINDING)); - if (node.hasDefined(AUTHENTICATION_PROVIDER)) { - writeSimpleChild(writer, Element.AUTHENTICATION_PROVIDER, Attribute.NAME, node.get(AUTHENTICATION_PROVIDER)); - } - if (has(node, PROPERTIES)) { - writeProperties(writer, node.get(PROPERTIES)); + ConnectorResource.SOCKET_BINDING_ATTRIBUTE.marshallAsAttribute(node, writer); + ConnectorResource.AUTHENTICATION_PROVIER_ATTRIBUTE.marshallAsElement(node, writer); + + if (node.hasDefined(PROPERTY)) { + writeProperties(writer, node.get(PROPERTY)); } - if (has(node, SASL)) { - writeSasl(writer, node.get(SASL)); + if (node.hasDefined(SECURITY) && node.get(SECURITY).hasDefined(SASL)) { + writeSasl(writer, node.get(SECURITY, SASL)); } writer.writeEndElement(); } private void writeProperties(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException { writer.writeStartElement(Element.PROPERTIES.getLocalName()); - for (String name : node.keys()) { - if (has(node, name)) { - final ModelNode prop = node.get(name); - if (prop.getType() == ModelType.PROPERTY) { - writer.writeStartElement(Element.PROPERTY.getLocalName()); - writer.writeAttribute(Attribute.NAME.getLocalName(), name); - writeAttribute(writer, Attribute.VALUE, prop.asProperty().getValue()); - writer.writeEndElement(); - } - } + for (Property prop : node.asPropertyList()) { + writer.writeStartElement(Element.PROPERTY.getLocalName()); + writer.writeAttribute(Attribute.NAME.getLocalName(), prop.getName()); + PropertyResource.VALUE_ATTRIBUTE.marshallAsAttribute(prop.getValue(), writer); + writer.writeEndElement(); } writer.writeEndElement(); } private void writeSasl(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException { writer.writeStartElement(Element.SASL.getLocalName()); - if (has(node, INCLUDE_MECHANISMS)) { - - } - if (has(node, QOP)) { - //FIXME is this really an xml attribute? - writeSimpleChild(writer, Element.QOP, Attribute.VALUE, node.get(QOP)); - } - if (has(node, STRENGTH)) { - //FIXME is this really an xml attribute? - writeSimpleChild(writer, Element.STRENGTH, Attribute.VALUE, node.get(STRENGTH)); - } - if (has(node, REUSE_SESSION)) { - writeSimpleChild(writer, Element.REUSE_SESSION, Attribute.VALUE, node.get(REUSE_SESSION)); - } - if (has(node, SERVER_AUTH)) { - writeSimpleChild(writer, Element.SERVER_AUTH, Attribute.VALUE, node.get(SERVER_AUTH)); - } - if (has(node, POLICY)) { - writePolicy(writer, node.get(POLICY)); + SaslResource.INCLUDE_MECHANISMS_ATTRIBUTE.marshallAsElement(node, writer); + SaslResource.QOP_ATTRIBUTE.marshallAsElement(node, writer); + SaslResource.STRENGTH_ATTRIBUTE.marshallAsElement(node, writer); + SaslResource.SERVER_AUTH_ATTRIBUTE.marshallAsElement(node, writer); + SaslResource.REUSE_SESSION_ATTRIBUTE.marshallAsElement(node, writer); + + if (node.hasDefined(SASL_POLICY)) { + writePolicy(writer, node.get(SASL_POLICY)); } - if (has(node, PROPERTIES)) { - writeProperties(writer, node.get(PROPERTIES)); + if (node.hasDefined(PROPERTY)) { + writeProperties(writer, node.get(PROPERTY)); } writer.writeEndElement(); @@ -472,83 +479,14 @@ private void writeSasl(final XMLExtendedStreamWriter writer, final ModelNode nod private void writePolicy(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException { writer.writeStartElement(Element.POLICY.getLocalName()); - - if (has(node, FORWARD_SECRECY)) { - writeSimpleChild(writer, Element.FORWARD_SECRECY, Attribute.VALUE, node.get(FORWARD_SECRECY)); - } - if (has(node, NO_ACTIVE)) { - writeSimpleChild(writer, Element.NO_ACTIVE, Attribute.VALUE, node.get(NO_ACTIVE)); - } - if (has(node, NO_ANONYMOUS)) { - writeSimpleChild(writer, Element.NO_ANONYMOUS, Attribute.VALUE, node.get(NO_ANONYMOUS)); - } - if (has(node, NO_DICTIONARY)) { - writeSimpleChild(writer, Element.NO_DICTIONARY, Attribute.VALUE, node.get(NO_DICTIONARY)); - } - if (has(node, NO_PLAINTEXT)) { - writeSimpleChild(writer, Element.NO_PLAINTEXT, Attribute.VALUE, node.get(NO_PLAINTEXT)); - } - if (has(node, PASS_CREDENTIALS)) { - writeSimpleChild(writer, Element.PASS_CREDENTIALS, Attribute.VALUE, node.get(PASS_CREDENTIALS)); - } - + final ModelNode policy = node.get(POLICY); + SaslPolicyResource.FORWARD_SECRECY_ATTRIBUTE.marshallAsElement(policy, writer); + SaslPolicyResource.NO_ACTIVE_ATTRIBUTE.marshallAsElement(policy, writer); + SaslPolicyResource.NO_ANONYMOUS_ATTRIBUTE.marshallAsElement(policy, writer); + SaslPolicyResource.NO_DICTIONARY_ATTRIBUTE.marshallAsElement(policy, writer); + SaslPolicyResource.NO_PLAIN_TEXT_ATTRIBUTE.marshallAsElement(policy, writer); + SaslPolicyResource.PASS_CREDENTIALS_ATTRIBUTE.marshallAsElement(policy, writer); writer.writeEndElement(); } - - private boolean has(ModelNode node, String name) { - return node.has(name) && node.get(name).isDefined(); - } - - private void writeAttribute(final XMLExtendedStreamWriter writer, final Attribute attr, final ModelNode value) throws XMLStreamException { - writer.writeAttribute(attr.getLocalName(), value.asString()); - } - - private void writeSimpleChild(final XMLExtendedStreamWriter writer, final Element element, final Attribute attr, final ModelNode value) throws XMLStreamException { - writer.writeStartElement(element.getLocalName()); - writeAttribute(writer, attr, value); - writer.writeEndElement(); - } - - } - - private static class RemotingSubsystemDescribeHandler implements OperationStepHandler, DescriptionProvider { - static final RemotingSubsystemDescribeHandler INSTANCE = new RemotingSubsystemDescribeHandler(); - - public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { - - final ModelNode result = context.getResult(); - final ModelNode model = context.readModel(PathAddress.EMPTY_ADDRESS); - - final PathAddress address = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME)); - final ModelNode subsystem = new ModelNode(); - subsystem.get(OP).set(ADD); - subsystem.get(OP_ADDR).set(address.toModelNode()); - subsystem.get(THREAD_POOL).set(model.get(THREAD_POOL)); - - result.add(subsystem); - - if (model.hasDefined(CONNECTOR)) { - for (org.jboss.dmr.Property prop : model.get(CONNECTOR).asPropertyList()) { - final ModelNode connector = prop.getValue(); - final ModelNode add = Util.getEmptyOperation(ADD, address.append(PathElement.pathElement(CONNECTOR, prop.getName())).toModelNode()); - if (connector.hasDefined(SOCKET_BINDING)) { - add.get(SOCKET_BINDING).set(connector.get(SOCKET_BINDING)); - } - if (connector.hasDefined(AUTHENTICATION_PROVIDER)) { - add.get(AUTHENTICATION_PROVIDER).set(AUTHENTICATION_PROVIDER); - } - if (connector.hasDefined(SASL)) { - add.get(SASL); - } - result.add(add); - } - } - context.completeStep(); - } - - @Override - public ModelNode getModelDescription(Locale locale) { - return CommonDescriptions.getSubsystemDescribeOperation(locale); - } } } diff --git a/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemAdd.java b/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemAdd.java index 59561da98e0..319d64e427f 100644 --- a/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemAdd.java +++ b/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemAdd.java @@ -41,10 +41,9 @@ */ class RemotingSubsystemAdd extends AbstractAddStepHandler { - private final String nodeName; + static final RemotingSubsystemAdd INSTANCE = new RemotingSubsystemAdd(); - public RemotingSubsystemAdd(String nodeName) { - this.nodeName = nodeName; + private RemotingSubsystemAdd() { } protected void populateModel(ModelNode operation, ModelNode model) { @@ -54,7 +53,7 @@ protected void populateModel(ModelNode operation, ModelNode model) { protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List> newControllers) { // create endpoint - final EndpointService endpointService = new EndpointService(nodeName, EndpointService.EndpointType.SUBSYSTEM); + final EndpointService endpointService = new EndpointService(RemotingExtension.NODE_NAME, EndpointService.EndpointType.SUBSYSTEM); // todo configure option map endpointService.setOptionMap(OptionMap.EMPTY); diff --git a/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemProviders.java b/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemProviders.java deleted file mode 100644 index f692d6eae4b..00000000000 --- a/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemProviders.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2010, 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.jboss.as.remoting; - -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ATTRIBUTES; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CHILDREN; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEFAULT; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HEAD_COMMENT_ALLOWED; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAMESPACE; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUIRED; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.TAIL_COMMENT_ALLOWED; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.TYPE; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE_TYPE; -import static org.jboss.as.remoting.CommonAttributes.AUTHENTICATION_PROVIDER; -import static org.jboss.as.remoting.CommonAttributes.CONNECTOR; -import static org.jboss.as.remoting.CommonAttributes.FORWARD_SECRECY; -import static org.jboss.as.remoting.CommonAttributes.INCLUDE_MECHANISMS; -import static org.jboss.as.remoting.CommonAttributes.NO_ACTIVE; -import static org.jboss.as.remoting.CommonAttributes.NO_ANONYMOUS; -import static org.jboss.as.remoting.CommonAttributes.NO_DICTIONARY; -import static org.jboss.as.remoting.CommonAttributes.NO_PLAINTEXT; -import static org.jboss.as.remoting.CommonAttributes.PASS_CREDENTIALS; -import static org.jboss.as.remoting.CommonAttributes.POLICY; -import static org.jboss.as.remoting.CommonAttributes.PROPERTIES; -import static org.jboss.as.remoting.CommonAttributes.QOP; -import static org.jboss.as.remoting.CommonAttributes.REUSE_SESSION; -import static org.jboss.as.remoting.CommonAttributes.SASL; -import static org.jboss.as.remoting.CommonAttributes.SERVER_AUTH; -import static org.jboss.as.remoting.CommonAttributes.SOCKET_BINDING; - -import java.util.Locale; -import java.util.ResourceBundle; - -import org.jboss.as.controller.descriptions.DescriptionProvider; -import org.jboss.dmr.ModelNode; -import org.jboss.dmr.ModelType; - -/** - * The remoting subsystem description providers. - * - * @author Emanuel Muckenhuber - */ -class RemotingSubsystemProviders { - - static final String RESOURCE_NAME = RemotingSubsystemProviders.class.getPackage().getName() + ".LocalDescriptions"; - - static final DescriptionProvider SUBSYSTEM = new DescriptionProvider() { - - @Override - public ModelNode getModelDescription(Locale locale) { - final ResourceBundle bundle = getResourceBundle(locale); - - final ModelNode subsystem = new ModelNode(); - subsystem.get(DESCRIPTION).set(bundle.getString("remoting")); - subsystem.get(HEAD_COMMENT_ALLOWED).set(true); - subsystem.get(TAIL_COMMENT_ALLOWED).set(true); - subsystem.get(NAMESPACE).set(Namespace.REMOTING_1_0.getUriString()); - - subsystem.get(CHILDREN, CONNECTOR, DESCRIPTION).set(bundle.getString("remoting.connectors")); - - return subsystem; - } - }; - - static final DescriptionProvider SUBSYSTEM_ADD = new DescriptionProvider() { - - @Override - public ModelNode getModelDescription(final Locale locale) { - final ResourceBundle bundle = getResourceBundle(locale); - - final ModelNode operation = new ModelNode(); - operation.get(OPERATION_NAME).set("add"); - operation.get(DESCRIPTION).set(bundle.getString("remoting.add")); - - return operation; - } - }; - - static final DescriptionProvider CONNECTOR_ADD = new DescriptionProvider() { - - @Override - public ModelNode getModelDescription(final Locale locale) { - final ResourceBundle bundle = getResourceBundle(locale); - - final ModelNode operation = new ModelNode(); - operation.get(OPERATION_NAME).set("add"); - operation.get(DESCRIPTION).set(bundle.getString("remoting.connector.add")); - -// operation.get(REQUEST_PROPERTIES, NAME, TYPE).set(ModelType.STRING); -// operation.get(REQUEST_PROPERTIES, NAME, DESCRIPTION).set(bundle.getString("remoting.connector.name")); -// operation.get(REQUEST_PROPERTIES, NAME, REQUIRED).set(true); - - operation.get(REQUEST_PROPERTIES, SOCKET_BINDING, TYPE).set(ModelType.STRING); - operation.get(REQUEST_PROPERTIES, SOCKET_BINDING, DESCRIPTION).set(bundle.getString("remoting.connector.socket-binding")); - operation.get(REQUEST_PROPERTIES, SOCKET_BINDING, REQUIRED).set(true); - - operation.get(REQUEST_PROPERTIES, AUTHENTICATION_PROVIDER, TYPE).set(ModelType.STRING); - operation.get(REQUEST_PROPERTIES, AUTHENTICATION_PROVIDER, DESCRIPTION).set(bundle.getString("remoting.connector.authentication-provider")); - operation.get(REQUEST_PROPERTIES, AUTHENTICATION_PROVIDER, REQUIRED).set(false); - - //TODO make a child resource rather than a complex attribute AS7-1831 - operation.get(REQUEST_PROPERTIES, SASL).set(getSaslElement(bundle, VALUE_TYPE)); - operation.get(REQUEST_PROPERTIES, SASL, TYPE).set(ModelType.OBJECT); - - return operation; - } - }; - - static final DescriptionProvider CONNECTOR_REMOVE = new DescriptionProvider() { - - @Override - public ModelNode getModelDescription(final Locale locale) { - final ResourceBundle bundle = getResourceBundle(locale); - - final ModelNode operation = new ModelNode(); - operation.get(OPERATION_NAME).set("remove"); - operation.get(DESCRIPTION).set(bundle.getString("remoting.connector.remove")); - - operation.get(REQUEST_PROPERTIES, NAME, TYPE).set(ModelType.STRING); - operation.get(REQUEST_PROPERTIES, NAME, DESCRIPTION).set(bundle.getString("remoting.connector.name")); - operation.get(REQUEST_PROPERTIES, NAME, REQUIRED).set(true); - - return operation; - } - }; - - static final DescriptionProvider CONNECTOR_SPEC = new DescriptionProvider( ) { - - @Override - public ModelNode getModelDescription(Locale locale) { - final ResourceBundle bundle = getResourceBundle(locale); - return getConnectorDescription(bundle); - } - }; - - - static ModelNode getConnectorDescription(final ResourceBundle bundle) { - final ModelNode connector = new ModelNode(); - - connector.get(DESCRIPTION).set(bundle.getString("remoting.connector")); - - connector.get(ATTRIBUTES, NAME, TYPE).set(ModelType.STRING); - connector.get(ATTRIBUTES, NAME, DESCRIPTION).set(bundle.getString("remoting.connector.name")); - connector.get(ATTRIBUTES, NAME, REQUIRED).set(true); - - connector.get(ATTRIBUTES, SOCKET_BINDING, TYPE).set(ModelType.STRING); - connector.get(ATTRIBUTES, SOCKET_BINDING, DESCRIPTION).set(bundle.getString("remoting.connector.socket-binding")); - connector.get(ATTRIBUTES, SOCKET_BINDING, REQUIRED).set(true); - - connector.get(ATTRIBUTES, AUTHENTICATION_PROVIDER, TYPE).set(ModelType.STRING); - connector.get(ATTRIBUTES, AUTHENTICATION_PROVIDER, DESCRIPTION).set(bundle.getString("remoting.connector.authentication-provider")); - connector.get(ATTRIBUTES, AUTHENTICATION_PROVIDER, REQUIRED).set(false); - - connector.get(CHILDREN, SASL, DESCRIPTION).set(bundle.getString("remoting.connector.sasl")); - - return connector; - } - - static final DescriptionProvider SASL_SPEC = new DescriptionProvider() { - - @Override - public ModelNode getModelDescription(Locale locale) { - final ResourceBundle bundle = getResourceBundle(locale); - return getSaslElement(bundle); - } - }; - - private static ModelNode getSaslElement(final ResourceBundle bundle) { - return getSaslElement(bundle, ATTRIBUTES); - } - - private static ModelNode getSaslElement(final ResourceBundle bundle, String propType) { - final ModelNode sasl = new ModelNode(); - - sasl.get(DESCRIPTION).set(bundle.getString("remoting.sasl")); - - sasl.get(propType, REUSE_SESSION, TYPE).set(ModelType.BOOLEAN); - sasl.get(propType, REUSE_SESSION, DESCRIPTION).set(bundle.getString("remoting.sasl.reuse-session")); - sasl.get(propType, REUSE_SESSION, REQUIRED).set(false); - sasl.get(propType, REUSE_SESSION, DEFAULT).set(false); - - sasl.get(propType, SERVER_AUTH, TYPE).set(ModelType.BOOLEAN); - sasl.get(propType, SERVER_AUTH, DESCRIPTION).set(bundle.getString("remoting.sasl.server-auth")); - sasl.get(propType, SERVER_AUTH, REQUIRED).set(false); - sasl.get(propType, SERVER_AUTH, DEFAULT).set(false); - - sasl.get(propType, INCLUDE_MECHANISMS, TYPE).set(ModelType.LIST); - sasl.get(propType, INCLUDE_MECHANISMS, VALUE_TYPE).set(ModelType.STRING); - sasl.get(propType, INCLUDE_MECHANISMS, DESCRIPTION).set(bundle.getString("remoting.sasl.include-mechanisms")); - sasl.get(propType, INCLUDE_MECHANISMS, REQUIRED).set(false); - - sasl.get(propType, QOP, TYPE).set(ModelType.LIST); - sasl.get(propType, QOP, VALUE_TYPE).set(ModelType.STRING); - sasl.get(propType, QOP, DESCRIPTION).set(bundle.getString("remoting.sasl.qop")); - sasl.get(propType, QOP, REQUIRED).set(false); - - sasl.get(propType, POLICY).set(getPolicyElement(bundle)); - - sasl.get(propType, PROPERTIES, TYPE).set(ModelType.LIST); - sasl.get(propType, PROPERTIES, DESCRIPTION).set(bundle.getString("remoting.sasl.properties")); - sasl.get(propType, PROPERTIES, VALUE_TYPE).set(ModelType.PROPERTY); - - return sasl; - } - - static ModelNode getPolicyElement(final ResourceBundle bundle) { - final ModelNode policy = new ModelNode(); - - policy.get(TYPE).set(ModelType.OBJECT); - policy.get(DESCRIPTION).set(bundle.getString("remoting.sasl.policy")); - - policy.get(VALUE_TYPE, FORWARD_SECRECY, TYPE).set(ModelType.BOOLEAN); - policy.get(VALUE_TYPE, FORWARD_SECRECY, DESCRIPTION).set(bundle.getString("remoting.sasl.policy.forward-secrecy")); - policy.get(VALUE_TYPE, FORWARD_SECRECY, REQUIRED).set(false); - policy.get(VALUE_TYPE, NO_ACTIVE, TYPE).set(ModelType.BOOLEAN); - policy.get(VALUE_TYPE, NO_ACTIVE, DESCRIPTION).set(bundle.getString("remoting.sasl.policy.no-active")); - policy.get(VALUE_TYPE, NO_ACTIVE, REQUIRED).set(false); - policy.get(VALUE_TYPE, NO_ANONYMOUS, TYPE).set(ModelType.BOOLEAN); - policy.get(VALUE_TYPE, NO_ANONYMOUS, DESCRIPTION).set(bundle.getString("remoting.sasl.policy.no-anonymous")); - policy.get(VALUE_TYPE, NO_ANONYMOUS, REQUIRED).set(false); - policy.get(VALUE_TYPE, NO_DICTIONARY, TYPE).set(ModelType.BOOLEAN); - policy.get(VALUE_TYPE, NO_DICTIONARY, DESCRIPTION).set(bundle.getString("remoting.sasl.policy.no-dictionary")); - policy.get(VALUE_TYPE, NO_DICTIONARY, REQUIRED).set(false); - policy.get(VALUE_TYPE, NO_PLAINTEXT, TYPE).set(ModelType.BOOLEAN); - policy.get(VALUE_TYPE, NO_PLAINTEXT, DESCRIPTION).set(bundle.getString("remoting.sasl.policy.no-plain-text")); - policy.get(VALUE_TYPE, NO_PLAINTEXT, REQUIRED).set(false); - policy.get(VALUE_TYPE, PASS_CREDENTIALS, TYPE).set(ModelType.BOOLEAN); - policy.get(VALUE_TYPE, PASS_CREDENTIALS, DESCRIPTION).set(bundle.getString("remoting.sasl.policy.pass-credentials")); - policy.get(VALUE_TYPE, PASS_CREDENTIALS, REQUIRED).set(false); - - return policy; - } - - - private static ResourceBundle getResourceBundle(Locale locale) { - if (locale == null) { - locale = Locale.getDefault(); - } - return ResourceBundle.getBundle(RESOURCE_NAME, locale); - } -} diff --git a/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemRemove.java b/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemRemove.java new file mode 100644 index 00000000000..ffc0b7b6542 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemRemove.java @@ -0,0 +1,45 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2010, 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.jboss.as.remoting; + +import org.jboss.as.controller.AbstractRemoveStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.dmr.ModelNode; + +/** + * Removes the remoting subsystem + * + * @author Kabir Khan + */ +public class RemotingSubsystemRemove extends AbstractRemoveStepHandler { + + static final RemotingSubsystemRemove INSTANCE = new RemotingSubsystemRemove(); + + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { + context.removeService(RemotingServices.SUBSYSTEM_ENDPOINT); + } + + protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) { + // TODO: RE-ADD SERVICES + } +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemRootResource.java b/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemRootResource.java new file mode 100644 index 00000000000..bfcba61c1e0 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/RemotingSubsystemRootResource.java @@ -0,0 +1,42 @@ +/* +* JBoss, Home of Professional Open Source. +* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.remoting; + +import org.jboss.as.controller.PathElement; +import org.jboss.as.controller.SimpleResourceDefinition; +import org.jboss.as.controller.descriptions.ModelDescriptionConstants; + +/** + * + * @author Kabir Khan + */ +public class RemotingSubsystemRootResource extends SimpleResourceDefinition { + + static final RemotingSubsystemRootResource INSTANCE = new RemotingSubsystemRootResource(); + + private RemotingSubsystemRootResource() { + super(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, RemotingExtension.SUBSYSTEM_NAME), + RemotingExtension.getResourceDescriptionResolver(RemotingExtension.SUBSYSTEM_NAME), + RemotingSubsystemAdd.INSTANCE, + RemotingSubsystemRemove.INSTANCE); + } +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/SaslAdd.java b/remoting/src/main/java/org/jboss/as/remoting/SaslAdd.java new file mode 100644 index 00000000000..cd946afeeb1 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/SaslAdd.java @@ -0,0 +1,56 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2010, 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.jboss.as.remoting; + +import java.util.List; + +import org.jboss.as.controller.AbstractAddStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.as.controller.OperationFailedException; +import org.jboss.as.controller.ServiceVerificationHandler; +import org.jboss.dmr.ModelNode; +import org.jboss.msc.service.ServiceController; + +/** + * Add a connector to a remoting container. + * + * @author David M. Lloyd + * @author Emanuel Muckenhuber + * @author Kabir Khan + */ +public class SaslAdd extends AbstractAddStepHandler { + + static final SaslAdd INSTANCE = new SaslAdd(); + + protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException{ + SaslResource.INCLUDE_MECHANISMS_ATTRIBUTE.validateAndSet(operation, model); + SaslResource.QOP_ATTRIBUTE.validateAndSet(operation, model); + SaslResource.STRENGTH_ATTRIBUTE.validateAndSet(operation, model); + SaslResource.REUSE_SESSION_ATTRIBUTE.validateAndSet(operation, model); + SaslResource.SERVER_AUTH_ATTRIBUTE.validateAndSet(operation, model); + } + + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List> newControllers) throws OperationFailedException { + } + +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyAdd.java b/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyAdd.java new file mode 100644 index 00000000000..29dbf1fb505 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyAdd.java @@ -0,0 +1,55 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2010, 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.jboss.as.remoting; + +import java.util.List; + +import org.jboss.as.controller.AbstractAddStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.as.controller.OperationFailedException; +import org.jboss.as.controller.ServiceVerificationHandler; +import org.jboss.dmr.ModelNode; +import org.jboss.msc.service.ServiceController; + +/** + * Add a connector to a remoting container. + * + * @author Kabir Khan + */ +public class SaslPolicyAdd extends AbstractAddStepHandler { + + static final SaslPolicyAdd INSTANCE = new SaslPolicyAdd(); + + protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException{ + SaslPolicyResource.FORWARD_SECRECY_ATTRIBUTE.validateAndSet(operation, model); + SaslPolicyResource.NO_ACTIVE_ATTRIBUTE.validateAndSet(operation, model); + SaslPolicyResource.NO_ANONYMOUS_ATTRIBUTE.validateAndSet(operation, model); + SaslPolicyResource.NO_DICTIONARY_ATTRIBUTE.validateAndSet(operation, model); + SaslPolicyResource.NO_PLAIN_TEXT_ATTRIBUTE.validateAndSet(operation, model); + SaslPolicyResource.PASS_CREDENTIALS_ATTRIBUTE.validateAndSet(operation, model); + } + + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List> newControllers) throws OperationFailedException { + } + +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyRemove.java b/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyRemove.java new file mode 100644 index 00000000000..a060131e981 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyRemove.java @@ -0,0 +1,44 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2010, 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.jboss.as.remoting; + +import org.jboss.as.controller.AbstractRemoveStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.dmr.ModelNode; + +/** + * Removes a connector from the remoting container. + * + * @author Kabir Khan + */ +public class SaslPolicyRemove extends AbstractRemoveStepHandler { + + static final SaslPolicyRemove INSTANCE = new SaslPolicyRemove(); + + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { + } + + protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) { + // TODO: RE-ADD SERVICES + } +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyResource.java b/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyResource.java new file mode 100644 index 00000000000..0bd77cdaa75 --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/SaslPolicyResource.java @@ -0,0 +1,78 @@ +/* +* JBoss, Home of Professional Open Source. +* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.remoting; + +import static org.jboss.as.remoting.CommonAttributes.FORWARD_SECRECY; +import static org.jboss.as.remoting.CommonAttributes.NO_ACTIVE; +import static org.jboss.as.remoting.CommonAttributes.NO_ANONYMOUS; +import static org.jboss.as.remoting.CommonAttributes.NO_DICTIONARY; +import static org.jboss.as.remoting.CommonAttributes.NO_PLAIN_TEXT; +import static org.jboss.as.remoting.CommonAttributes.PASS_CREDENTIALS; +import static org.jboss.as.remoting.CommonAttributes.POLICY; +import static org.jboss.as.remoting.CommonAttributes.SASL_POLICY; + +import org.jboss.as.controller.AttributeDefinition; +import org.jboss.as.controller.PathElement; +import org.jboss.as.controller.SimpleResourceDefinition; +import org.jboss.as.controller.registry.ManagementResourceRegistration; +import org.jboss.dmr.ModelNode; +import org.jboss.dmr.ModelType; + +/** + * + * @author Kabir Khan + */ +public class SaslPolicyResource extends SimpleResourceDefinition { + static final PathElement SASL_POLICY_CONFIG_PATH = PathElement.pathElement(SASL_POLICY, POLICY); + + static final SaslPolicyResource INSTANCE = new SaslPolicyResource(); + + static final AttributeDefinition FORWARD_SECRECY_ATTRIBUTE = new BooleanValueAttributeDefinition(FORWARD_SECRECY); + static final AttributeDefinition NO_ACTIVE_ATTRIBUTE = new BooleanValueAttributeDefinition(NO_ACTIVE); + static final AttributeDefinition NO_ANONYMOUS_ATTRIBUTE = new BooleanValueAttributeDefinition(NO_ANONYMOUS); + static final AttributeDefinition NO_DICTIONARY_ATTRIBUTE = new BooleanValueAttributeDefinition(NO_DICTIONARY); + static final AttributeDefinition NO_PLAIN_TEXT_ATTRIBUTE = new BooleanValueAttributeDefinition(NO_PLAIN_TEXT); + static final AttributeDefinition PASS_CREDENTIALS_ATTRIBUTE = new BooleanValueAttributeDefinition(PASS_CREDENTIALS); + + private SaslPolicyResource() { + super(SASL_POLICY_CONFIG_PATH, + RemotingExtension.getResourceDescriptionResolver(POLICY), + SaslPolicyAdd.INSTANCE, + SaslPolicyRemove.INSTANCE); + } + + @Override + public void registerAttributes(ManagementResourceRegistration resourceRegistration) { + resourceRegistration.registerReadOnlyAttribute(FORWARD_SECRECY_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(NO_ACTIVE_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(NO_ANONYMOUS_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(NO_DICTIONARY_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(NO_PLAIN_TEXT_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(PASS_CREDENTIALS_ATTRIBUTE, null); + } + + private static class BooleanValueAttributeDefinition extends NamedValueAttributeDefinition { + public BooleanValueAttributeDefinition(String name) { + super(name, Attribute.VALUE, new ModelNode().set(true), ModelType.BOOLEAN, true); + } + } +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/SaslRemove.java b/remoting/src/main/java/org/jboss/as/remoting/SaslRemove.java new file mode 100644 index 00000000000..6b4528ce11e --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/SaslRemove.java @@ -0,0 +1,44 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2010, 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.jboss.as.remoting; + +import org.jboss.as.controller.AbstractRemoveStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.dmr.ModelNode; + +/** + * Removes a connector from the remoting container. + * + * @author Kabir Khan + */ +public class SaslRemove extends AbstractRemoveStepHandler { + + static final SaslRemove INSTANCE = new SaslRemove(); + + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { + } + + protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) { + // TODO: RE-ADD SERVICES + } +} diff --git a/remoting/src/main/java/org/jboss/as/remoting/SaslResource.java b/remoting/src/main/java/org/jboss/as/remoting/SaslResource.java new file mode 100644 index 00000000000..0fbdc6d675e --- /dev/null +++ b/remoting/src/main/java/org/jboss/as/remoting/SaslResource.java @@ -0,0 +1,167 @@ +/* +* JBoss, Home of Professional Open Source. +* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.remoting; + +import static org.jboss.as.remoting.CommonAttributes.INCLUDE_MECHANISMS; +import static org.jboss.as.remoting.CommonAttributes.QOP; +import static org.jboss.as.remoting.CommonAttributes.REUSE_SESSION; +import static org.jboss.as.remoting.CommonAttributes.SASL; +import static org.jboss.as.remoting.CommonAttributes.SECURITY; +import static org.jboss.as.remoting.CommonAttributes.SERVER_AUTH; +import static org.jboss.as.remoting.CommonAttributes.STRENGTH; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.jboss.as.controller.AttributeDefinition; +import org.jboss.as.controller.ListAttributeDefinition; +import org.jboss.as.controller.PathElement; +import org.jboss.as.controller.SimpleResourceDefinition; +import org.jboss.as.controller.descriptions.ModelDescriptionConstants; +import org.jboss.as.controller.descriptions.ResourceDescriptionResolver; +import org.jboss.as.controller.operations.validation.AllowedValuesValidator; +import org.jboss.as.controller.operations.validation.ParameterValidator; +import org.jboss.as.controller.operations.validation.StringLengthValidator; +import org.jboss.as.controller.registry.ManagementResourceRegistration; +import org.jboss.dmr.ModelNode; +import org.jboss.dmr.ModelType; +import org.xnio.sasl.SaslQop; +import org.xnio.sasl.SaslStrength; + +/** + * + * @author Kabir Khan + */ +public class SaslResource extends SimpleResourceDefinition { + static final PathElement SASL_CONFIG_PATH = PathElement.pathElement(SECURITY, SASL); + + static final SaslResource INSTANCE = new SaslResource(); + + static final AttributeDefinition INCLUDE_MECHANISMS_ATTRIBUTE = new SaslListAttributeDefinition(Element.INCLUDE_MECHANISMS, INCLUDE_MECHANISMS, true); + static final AttributeDefinition QOP_ATTRIBUTE = new SaslListAttributeDefinition(Element.QOP, QOP, true, QopParameterValidation.INSTANCE); + static final AttributeDefinition STRENGTH_ATTRIBUTE = new SaslListAttributeDefinition(Element.STRENGTH, STRENGTH, true, StrengthParameterValidation.INSTANCE); + static final AttributeDefinition REUSE_SESSION_ATTRIBUTE = new NamedValueAttributeDefinition(REUSE_SESSION, Attribute.VALUE, new ModelNode().set(false), ModelType.BOOLEAN, true); + static final AttributeDefinition SERVER_AUTH_ATTRIBUTE = new NamedValueAttributeDefinition(SERVER_AUTH, Attribute.VALUE, new ModelNode().set(false), ModelType.BOOLEAN, true); + + + private SaslResource() { + super(SASL_CONFIG_PATH, + RemotingExtension.getResourceDescriptionResolver(SASL), + SaslAdd.INSTANCE, + SaslRemove.INSTANCE); + } + + @Override + public void registerAttributes(ManagementResourceRegistration resourceRegistration) { + resourceRegistration.registerReadOnlyAttribute(INCLUDE_MECHANISMS_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(QOP_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(STRENGTH_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(REUSE_SESSION_ATTRIBUTE, null); + resourceRegistration.registerReadOnlyAttribute(SERVER_AUTH_ATTRIBUTE, null); + } + + private static class SaslListAttributeDefinition extends ListAttributeDefinition { + final Element element; + + SaslListAttributeDefinition(Element element, String name, boolean allowNull) { + this(element, name, allowNull, new StringLengthValidator(1)); + } + + SaslListAttributeDefinition(Element element, String name, boolean allowNull, ParameterValidator validator) { + super(name, allowNull, new StringLengthValidator(1)); + this.element = element; + } + + @Override + protected void addValueTypeDescription(ModelNode node, ResourceBundle bundle) { + setValueType(node); + } + + @Override + protected void addAttributeValueTypeDescription(ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) { + setValueType(node); + } + + @Override + protected void addOperationParameterValueTypeDescription(ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) { + setValueType(node); + } + + @Override + public void marshallAsElement(ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamException { + if (resourceModel.hasDefined(getName())) { + List list = resourceModel.get(getName()).asList(); + if (list.size() > 0) { + writer.writeEmptyElement(element.getLocalName()); + StringBuilder sb = new StringBuilder(); + for (ModelNode child : list) { + if (sb.length() > 0) { + sb.append(" "); + } + sb.append(child.asString()); + } + writer.writeAttribute(Attribute.VALUE.getLocalName(), sb.toString()); + } + } + } + + private void setValueType(ModelNode node) { + node.get(ModelDescriptionConstants.VALUE_TYPE).set(ModelType.STRING); + } + } + + private abstract static class SaslEnumValidator extends StringLengthValidator implements AllowedValuesValidator { + final List allowedValues = new ArrayList(); + + SaslEnumValidator(Enum[] src, boolean toLowerCase) { + super(1); + for (Enum e : src) { + allowedValues.add(new ModelNode().set(toLowerCase ? e.name().toLowerCase() : e.name())); + } + } + + @Override + public List getAllowedValues() { + return allowedValues; + } + + } + + private static class QopParameterValidation extends SaslEnumValidator implements AllowedValuesValidator { + static final QopParameterValidation INSTANCE = new QopParameterValidation(); + public QopParameterValidation() { + super(SaslQop.values(), false); + } + } + + private static class StrengthParameterValidation extends SaslEnumValidator implements AllowedValuesValidator { + static final StrengthParameterValidation INSTANCE = new StrengthParameterValidation(); + public StrengthParameterValidation() { + super(SaslStrength.values(), true); + } + } +} diff --git a/remoting/src/main/resources/org/jboss/as/remoting/LocalDescriptions.properties b/remoting/src/main/resources/org/jboss/as/remoting/LocalDescriptions.properties index 4e51acb9ae2..4567b18b82b 100644 --- a/remoting/src/main/resources/org/jboss/as/remoting/LocalDescriptions.properties +++ b/remoting/src/main/resources/org/jboss/as/remoting/LocalDescriptions.properties @@ -1,28 +1,53 @@ remoting=The configuration of the Remoting subsystem. -remoting.add=Adds the Remoting subsystem -remoting.thread-pool=The "thread-pool" attribute specifies what thread pool to use for Remoting invocations and asynchronous tasks. -remoting.connectors=The remoting connectors. +remoting.add=Adds the Remoting subsystem. +remoting.remove=Removes the Remoting subsystem. +remoting.connector=The remoting connectors. -remoting.connector=The configuration of a Remoting connector. -remoting.connector.add=Adds a Remoting connector. -remoting.connector.remove=Removes a remoting connector. -remoting.connector.name=The unique name of this connector. -remoting.connector.socket-binding=The name (or names) of the socket binding(s) to attach to. -remoting.connector.sasl=The "sasl" element contains the SASL authentication configuration for this connector. -remoting.connector.authentication-provider=The "authentication-provider" element contains the name of the authentication provider to use for incoming connections. +connector=The configuration of a Remoting connector. +connector.add=Adds a Remoting connector. +connector.remove=Removes a remoting connector. +connector.socket-binding=The name (or names) of the socket binding(s) to attach to. +connector.authentication-provider=The "authentication-provider" element contains the name of the authentication provider to use for incoming connections. +connector.security=Configuration of security for this connector. +connector.property=Properties to further configure the connector. -remoting.sasl=The configuration of the SASL authentication layer for this server. -remoting.sasl.include-mechanisms=The optional nested "include-mechanisms" element contains a whitelist of allowed SASL mechanism names. No mechanisms will be allowed which are not present in this list. -remoting.sasl.qop=The optional nested "qop" element contains a list of quality-of-protection values, in decreasing order of preference. -remoting.sasl.strength=The optional nested "strength" element contains a list of cipher strength values, in decreasing order of preference. -remoting.sasl.reuse-session=The optional nested "reuse-session" boolean element specifies whether or not the server should attempt to reuse previously authenticated session information. The mechanism may or may not support such reuse, and other factors may also prevent it. -remoting.sasl.server-auth=The optional nested "server-auth" boolean element specifies whether the server should authenticate to the client. Not all mechanisms may support this setting. +sasl=The "sasl" element contains the SASL authentication configuration for this connector. +sasl.add=Adds the SASL authentication configuration for its connector +sasl.remove=Removes the SASL authentication configuration for its connector +sasl.include-mechanisms=The optional nested "include-mechanisms" element contains a whitelist of allowed SASL mechanism names. No mechanisms will be allowed which are not present in this list. +sasl.qop=The optional nested "qop" element contains a list of quality-of-protection values, in decreasing order of preference. +sasl.strength=The optional nested "strength" element contains a list of cipher strength values, in decreasing order of preference. +sasl.reuse-session=The optional nested "reuse-session" boolean element specifies whether or not the server should attempt to reuse previously authenticated session information. The mechanism may or may not support such reuse, and other factors may also prevent it. +sasl.server-auth=The optional nested "server-auth" boolean element specifies whether the server should authenticate to the client. Not all mechanisms may support this setting. +sasl.sasl-policy=Specifies an optional policy to use to narrow down the available set of mechanisms. +sasl.property=Properties to further configure sasl. -remoting.sasl.policy=The optional nested "policy" boolean element specifies a policy to use to narrow down the available set of mechanisms. -remoting.sasl.policy.forward-secrecy=The optional nested "forward-secrecy" element contains a boolean value which specifies whether mechanisms that implement forward secrecy between sessions are required. Forward secrecy means that breaking into one session will not automatically provide information for breaking into future sessions. -remoting.sasl.policy.no-active=The optional nested "no-active" element contains a boolean value which specifies whether mechanisms susceptible to active (non-dictionary) attacks are not permitted. "false" to permit, "true" to deny. -remoting.sasl.policy.no-anonymous=The optional nested "no-anonymous" element contains a boolean value which specifies whether mechanisms that accept anonymous login are permitted. "false" to permit, "true" to deny. -remoting.sasl.policy.no-dictionary=The optional nested "no-dictionary" element contains a boolean value which specifies whether mechanisms susceptible to passive dictionary attacks are permitted. "false" to permit, "true" to deny. -remoting.sasl.policy.no-plain-text=The optional nested "no-plain-text" element contains a boolean value which specifies whether mechanisms susceptible to simple plain passive attacks (e.g., "PLAIN") are not permitted. "false" to permit, "true" to deny. -remoting.sasl.policy.pass-credentials=The optional nested "pass-credentials" element contains a boolean value which specifies whether mechanisms that pass client credentials are required. -remoting.sasl.properties=Additional properties to configure sasl. \ No newline at end of file +policy=The policy configuration. +policy.add=Adds the SASL policy. +policy.remove=Removes the SASL policy. +policy.forward-secrecy=The optional nested "forward-secrecy" element contains a boolean value which specifies whether mechanisms that implement forward secrecy between sessions are required. Forward secrecy means that breaking into one session will not automatically provide information for breaking into future sessions. +policy.no-active=The optional nested "no-active" element contains a boolean value which specifies whether mechanisms susceptible to active (non-dictionary) attacks are not permitted. "false" to permit, "true" to deny. +policy.no-anonymous=The optional nested "no-anonymous" element contains a boolean value which specifies whether mechanisms that accept anonymous login are permitted. "false" to permit, "true" to deny. +policy.no-dictionary=The optional nested "no-dictionary" element contains a boolean value which specifies whether mechanisms susceptible to passive dictionary attacks are permitted. "false" to permit, "true" to deny. +policy.no-plain-text=The optional nested "no-plain-text" element contains a boolean value which specifies whether mechanisms susceptible to simple plain passive attacks (e.g., "PLAIN") are not permitted. "false" to permit, "true" to deny. +policy.pass-credentials=The optional nested "pass-credentials" element contains a boolean value which specifies whether mechanisms that pass client credentials are required. + +property=Properties supported by the underlying provider. The property name is inferred from the last element of the properties address. +property.add=Adds a property. +property.remove=Removes a property. +property.value=The property value. + +#remoting.sasl=The configuration of the SASL authentication layer for this server. +#remoting.sasl.include-mechanisms=The optional nested "include-mechanisms" element contains a whitelist of allowed SASL mechanism names. No mechanisms will be allowed which are not present in this list. +#remoting.sasl.qop=The optional nested "qop" element contains a list of quality-of-protection values, in decreasing order of preference. +#remoting.sasl.strength=The optional nested "strength" element contains a list of cipher strength values, in decreasing order of preference. +#remoting.sasl.reuse-session=The optional nested "reuse-session" boolean element specifies whether or not the server should attempt to reuse previously authenticated session information. The mechanism may or may not support such reuse, and other factors may also prevent it. +#remoting.sasl.server-auth=The optional nested "server-auth" boolean element specifies whether the server should authenticate to the client. Not all mechanisms may support this setting. + +#remoting.sasl.policy.forward-secrecy=The optional nested "forward-secrecy" element contains a boolean value which specifies whether mechanisms that implement forward secrecy between sessions are required. Forward secrecy means that breaking into one session will not automatically provide information for breaking into future sessions. +#remoting.sasl.policy.no-active=The optional nested "no-active" element contains a boolean value which specifies whether mechanisms susceptible to active (non-dictionary) attacks are not permitted. "false" to permit, "true" to deny. +#remoting.sasl.policy.no-anonymous=The optional nested "no-anonymous" element contains a boolean value which specifies whether mechanisms that accept anonymous login are permitted. "false" to permit, "true" to deny. +#remoting.sasl.policy.no-dictionary=The optional nested "no-dictionary" element contains a boolean value which specifies whether mechanisms susceptible to passive dictionary attacks are permitted. "false" to permit, "true" to deny. +#remoting.sasl.policy.no-plain-text=The optional nested "no-plain-text" element contains a boolean value which specifies whether mechanisms susceptible to simple plain passive attacks (e.g., "PLAIN") are not permitted. "false" to permit, "true" to deny. +#remoting.sasl.policy.pass-credentials=The optional nested "pass-credentials" element contains a boolean value which specifies whether mechanisms that pass client credentials are required. +#remoting.sasl.properties=Additional properties to configure sasl. \ No newline at end of file diff --git a/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemBaseTest.java b/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemBaseTest.java index 744fc74d3ae..243608d908b 100644 --- a/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemBaseTest.java +++ b/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemBaseTest.java @@ -26,10 +26,10 @@ import java.util.List; import junit.framework.Assert; + import org.jboss.as.controller.Extension; import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; -import org.jboss.as.subsystem.test.ModelDescriptionValidator.ValidationConfiguration; import org.jboss.dmr.ModelNode; import org.junit.Test; @@ -71,11 +71,11 @@ protected String getSubsystemXml(String configId) throws IOException { /** * Validate the marshalled xml. * - * @param orignal the original subsystem xml + * @param original the original subsystem xml * @param marshalled the marshalled subsystem xml * @throws Exception */ - protected void validateXml(final String orignal, final String marshalled) throws Exception { + protected void validateXml(final String original, final String marshalled) throws Exception { // TODO check if the marshalled xml can be validated against the schema } @@ -154,5 +154,4 @@ protected OperationContext.Type getType() { } }; } - } diff --git a/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemTest.java b/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemTest.java index b178cfcf72d..5c931a7bc0a 100644 --- a/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemTest.java +++ b/subsystem-test/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemTest.java @@ -47,14 +47,6 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -import org.jboss.as.server.DeployerChainAddHandler; -import org.w3c.dom.Document; -import org.w3c.dom.bootstrap.DOMImplementationRegistry; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSInput; -import org.w3c.dom.ls.LSParser; -import org.w3c.dom.ls.LSSerializer; - import junit.framework.Assert; import junit.framework.AssertionFailedError; @@ -91,6 +83,7 @@ import org.jboss.as.controller.registry.OperationEntry.EntryType; import org.jboss.as.controller.registry.OperationEntry.Flag; import org.jboss.as.controller.registry.Resource; +import org.jboss.as.server.DeployerChainAddHandler; import org.jboss.as.server.Services; import org.jboss.as.server.controller.descriptions.ServerDescriptionProviders; import org.jboss.as.server.deployment.repository.impl.ContentRepositoryImpl; @@ -112,6 +105,12 @@ import org.jboss.staxmapper.XMLMapper; import org.junit.After; import org.junit.Before; +import org.w3c.dom.Document; +import org.w3c.dom.bootstrap.DOMImplementationRegistry; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSInput; +import org.w3c.dom.ls.LSParser; +import org.w3c.dom.ls.LSSerializer; /** * The base class for parsing tests which does the work of setting up the environment for parsing @@ -187,7 +186,7 @@ protected Extension getMainExtension() { protected String readResource(final String name) throws IOException { URL configURL = getClass().getResource(name); - org.junit.Assert.assertNotNull(name + " url is not null", configURL); + org.junit.Assert.assertNotNull(name + " url is null", configURL); BufferedReader reader = new BufferedReader(new InputStreamReader(configURL.openStream())); StringWriter writer = new StringWriter(); @@ -480,7 +479,6 @@ private void validateDescriptionProviders(AdditionalInitialization additionalIni builder.append("\n"); } - System.out.println(builder.toString()); if (arbitraryDescriptors != null) { Assert.fail("Failed due to validation errors in the model. Please fix :-) " + builder.toString()); }