[jboss-remoting-commits] JBoss Remoting SVN: r5594 - in remoting3/trunk/jboss-remoting/src/main: resources/META-INF and 1 other directory.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Nov 17 14:30:40 EST 2009


Author: david.lloyd at jboss.com
Date: 2009-11-17 14:30:39 -0500 (Tue, 17 Nov 2009)
New Revision: 5594

Added:
   remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java
Removed:
   remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Options.java
   remoting3/trunk/jboss-remoting/src/main/resources/META-INF/jboss-classloading.xml
Modified:
   remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java
   remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
   remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java
Log:
Changes to support interactive authentication

Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java	2009-11-13 21:50:09 UTC (rev 5593)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java	2009-11-17 19:30:39 UTC (rev 5594)
@@ -10,6 +10,8 @@
 import org.jboss.xnio.IoFuture;
 import org.jboss.xnio.OptionMap;
 
+import javax.security.auth.callback.CallbackHandler;
+
 /**
  * A potential participant in a JBoss Remoting communications relationship.
  * <p/>
@@ -102,22 +104,22 @@
         /**
          * Set the option map for the service.  The options may include, but are not limited to:
          * <ul>
-         * <li>{@link Options#BUFFER_SIZE} - the recommended buffer size for marshallers to use for this service</li>
-         * <li>{@link Options#CLASS_COUNT} - the recommended class count for marshallers to use for this service</li>
-         * <li>{@link Options#INSTANCE_COUNT} - the recommended instance count for marshallers to use for this service</li>
-         * <li>{@link Options#METRIC} - the relative desirability or "distance" of this service</li>
-         * <li>{@link Options#MARSHALLING_PROTOCOLS} - the marshalling protocols which are allowed for this service,
+         * <li>{@link RemotingOptions#BUFFER_SIZE} - the recommended buffer size for marshallers to use for this service</li>
+         * <li>{@link RemotingOptions#CLASS_COUNT} - the recommended class count for marshallers to use for this service</li>
+         * <li>{@link RemotingOptions#INSTANCE_COUNT} - the recommended instance count for marshallers to use for this service</li>
+         * <li>{@link RemotingOptions#METRIC} - the relative desirability or "distance" of this service</li>
+         * <li>{@link RemotingOptions#MARSHALLING_PROTOCOLS} - the marshalling protocols which are allowed for this service,
          *          in order of decreasing preference; if none is given, all registered protocols will
          *          be made available</li>
-         * <li>{@link Options#MARSHALLING_CLASS_RESOLVERS} - the class resolvers which are allowed for this service,
+         * <li>{@link RemotingOptions#MARSHALLING_CLASS_RESOLVERS} - the class resolvers which are allowed for this service,
          *          in order of decreasing preference; if none is given, the default class resolver is used</li>
-         * <li>{@link Options#MARSHALLING_CLASS_TABLES} - the class tables which are allowed for this service, in order
+         * <li>{@link RemotingOptions#MARSHALLING_CLASS_TABLES} - the class tables which are allowed for this service, in order
          *          of decreasing preference</li>
-         * <li>{@link Options#MARSHALLING_EXTERNALIZER_FACTORIES} - the class externalizer factories which are allowed
+         * <li>{@link RemotingOptions#MARSHALLING_EXTERNALIZER_FACTORIES} - the class externalizer factories which are allowed
          *          for this service, in order of decreasing preference</li>
-         * <li>{@link Options#REMOTELY_VISIBLE} - {@code true} if this service should be remotely accessible,
+         * <li>{@link RemotingOptions#REMOTELY_VISIBLE} - {@code true} if this service should be remotely accessible,
          *          {@code false} otherwise (defaults to {@code true})</li>
-         * <li>{@link Options#REQUIRE_SECURE} - {@code true} if this service may only be accessed over a secure/encrypted
+         * <li>{@link RemotingOptions#REQUIRE_SECURE} - {@code true} if this service may only be accessed over a secure/encrypted
          *          channel; defaults to {@code false}, however this should be set to {@code true} if sensitive data (e.g.
          *          passwords) may be transmitted as part of a payload</li>
          * </ul>
@@ -178,6 +180,21 @@
     IoFuture<? extends Connection> connect(URI destination, OptionMap connectOptions) throws IOException;
 
     /**
+     * Open a connection with a peer.  Returns a future connection which may be used to cancel the connection attempt.
+     * The given callback handler is used to retrieve local authentication information, if the protocol demands it.
+     * This method does not block; use the return value to wait for a result if you wish to block.
+     * <p/>
+     * You must have the {@link org.jboss.remoting3.EndpointPermission connect EndpointPermission} to invoke this method.
+     *
+     * @param destination the destination
+     * @param connectOptions options to configure this connection
+     * @param callbackHandler the local callback handler to use for authentication
+     * @return the future connection
+     * @throws IOException if an error occurs while starting the connect attempt
+     */
+    IoFuture<? extends Connection> connect(URI destination, OptionMap connectOptions, CallbackHandler callbackHandler) throws IOException;
+
+    /**
      * Register a connection provider for a URI scheme.  The provider factory is called with the context which can
      * be used to accept new connections or terminate the registration.
      * <p/>

Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java	2009-11-13 21:50:09 UTC (rev 5593)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java	2009-11-17 19:30:39 UTC (rev 5594)
@@ -60,6 +60,8 @@
 import org.jboss.xnio.TranslatingResult;
 import org.jboss.xnio.WeakCloseable;
 
+import javax.security.auth.callback.CallbackHandler;
+
 /**
  *
  */
@@ -309,7 +311,7 @@
             if (clientListener == null) {
                 throw new NullPointerException("clientListener is null");
             }
-            final Integer metric = optionMap.get(Options.METRIC);
+            final Integer metric = optionMap.get(RemotingOptions.METRIC);
             if (metric != null && metric.intValue() < 0) {
                 throw new IllegalArgumentException("metric must be greater than or equal to zero");
             }
@@ -487,6 +489,10 @@
     }
 
     public IoFuture<? extends Connection> connect(final URI destination, final OptionMap connectOptions) throws IOException {
+        return connect(destination, connectOptions, null);
+    }
+
+    public IoFuture<? extends Connection> connect(final URI destination, final OptionMap connectOptions, final CallbackHandler callbackHandler) throws IOException {
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPermission(CONNECT_PERM);

Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Options.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Options.java	2009-11-13 21:50:09 UTC (rev 5593)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Options.java	2009-11-17 19:30:39 UTC (rev 5594)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.remoting3;
-
-import org.jboss.xnio.Option;
-import org.jboss.xnio.Sequence;
-
-/**
- * Common options for service registration.
- */
-public final class Options {
-
-    private Options() {
-    }
-
-    /**
-     * Configure the maximum number of threads for a simple endpoint.
-     */
-    public static final Option<Integer> MAX_THREADS = Option.simple(Options.class, "MAX_THREADS", Integer.class);
-
-    /**
-     * Specify whether connection providers should automatically be detected and loaded.
-     */
-    public static final Option<Boolean> LOAD_PROVIDERS = Option.simple(Options.class, "LOAD_PROVIDERS", Boolean.class);
-
-    /**
-     * Request that the marshalling layer require the use of one of the listed marshalling protocols, in order of decreasing preference.
-     */
-    public static final Option<Sequence<String>> MARSHALLING_PROTOCOLS = Option.sequence(Options.class, "MARSHALLING_PROTOCOLS", String.class);
-
-    /**
-     * Request that the marshalling layer require the presense of one of the listed user-defined class tables, in order of decreasing preference.
-     */
-    public static final Option<Sequence<String>> MARSHALLING_CLASS_TABLES = Option.sequence(Options.class, "MARSHALLING_CLASS_TABLES", String.class);
-
-    /**
-     * Request that the marshalling layer require the presense of one of the listed user-defined object tables, in order of decreasing preference.
-     */
-    public static final Option<Sequence<String>> MARSHALLING_OBJECT_TABLES = Option.sequence(Options.class, "MARSHALLING_OBJECT_TABLES", String.class);
-
-    /**
-     * Request that the marshalling layer require the presense of one of the listed class resolvers, in order of decreasing preference.
-     */
-    public static final Option<Sequence<String>> MARSHALLING_CLASS_RESOLVERS = Option.sequence(Options.class, "MARSHALLING_CLASS_RESOLVERS", String.class);
-
-    /**
-     * Request that the marshalling layer require the presense of one of the listed object resolvers, in order of decreasing preference.
-     */
-    public static final Option<Sequence<String>> MARSHALLING_OBJECT_RESOLVERS = Option.sequence(Options.class, "MARSHALLING_OBJECT_RESOLVERS", String.class);
-
-    /**
-     * Request that the marshalling layer require the presense of one of the listed user-defined externalizer factories, in order of decreasing preference.
-     */
-    public static final Option<Sequence<String>> MARSHALLING_EXTERNALIZER_FACTORIES = Option.sequence(Options.class, "MARSHALLING_EXTERNALIZER_FACTORIES", String.class);
-
-    /**
-     * Specify a metric which is a hint that describes the relative desirability of this service.
-     */
-    public static final Option<Integer> METRIC = Option.simple(Options.class, "METRIC", Integer.class);
-
-    /**
-     * Specify that the registered service should or should not be visible remotely.
-     */
-    public static final Option<Boolean> REMOTELY_VISIBLE = Option.simple(Options.class, "REMOTELY_VISIBLE", Boolean.class);
-
-    /**
-     * Specify the buffer size for any configured marshaller or unmarshaller.
-     */
-    public static final Option<Integer> BUFFER_SIZE = Option.simple(Options.class, "BUFFER_SIZE", Integer.class);
-
-    /**
-     * Specify the expected class count for any configured marshaller or unmarshaller.
-     */
-    public static final Option<Integer> CLASS_COUNT = Option.simple(Options.class, "CLASS_COUNT", Integer.class);
-
-    /**
-     * Specify the expected instance count for any configured marshaller or unmarshaller.
-     */
-    public static final Option<Integer> INSTANCE_COUNT = Option.simple(Options.class, "INSTANCE_COUNT", Integer.class);
-
-    /**
-     * Specify whether the service may be accessed from connections which are unencrypted, or whether encryption is
-     * required.
-     */
-    public static final Option<Boolean> REQUIRE_SECURE = Option.simple(Options.class, "REQUIRE_SECURE", Boolean.class);
-
-    public static final Option<Integer> MAX_TRANSMIT_SIZE = Option.simple(Options.class, "MAX_TRANSMIT_SIZE", Integer.class);
-
-    public static final Option<Integer> MAX_RECEIVE_SIZE = Option.simple(Options.class, "MAX_RECEIVE_SIZE", Integer.class);
-
-    public static final Option<Integer> TRANSMIT_WINDOW_SIZE = Option.simple(Options.class, "TRANSMIT_WINDOW_SIZE", Integer.class);
-
-    public static final Option<Integer> RECEIVE_WINDOW_SIZE = Option.simple(Options.class, "RECEIVE_WINDOW_SIZE", Integer.class);
-
-    public static final Option<Integer> MAX_OUTBOUND_CHANNELS = Option.simple(Options.class, "MAX_OUTBOUND_CHANNELS", Integer.class);
-
-    public static final Option<Integer> MAX_INBOUND_CHANNELS = Option.simple(Options.class, "MAX_INBOUND_CHANNELS", Integer.class);
-}

Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java	2009-11-13 21:50:09 UTC (rev 5593)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java	2009-11-17 19:30:39 UTC (rev 5594)
@@ -80,14 +80,14 @@
      * @return the endpoint
      */
     public static Endpoint createEndpoint(final String name, final int maxThreads) throws IOException {
-        return createEndpoint(name, OptionMap.builder().set(Options.MAX_THREADS, maxThreads).getMap());
+        return createEndpoint(name, OptionMap.builder().set(RemotingOptions.MAX_THREADS, maxThreads).getMap());
     }
 
     /**
      * Create an endpoint configured with the given option map.  The following options are supported:
      * <ul>
-     * <li>{@link Options#MAX_THREADS} - specify the maximum number of threads for the created thread pool (default 10)</li>
-     * <li>{@link Options#LOAD_PROVIDERS} - specify whether providers should be auto-loaded (default {@code true})</li>
+     * <li>{@link RemotingOptions#MAX_THREADS} - specify the maximum number of threads for the created thread pool (default 10)</li>
+     * <li>{@link RemotingOptions#LOAD_PROVIDERS} - specify whether providers should be auto-loaded (default {@code true})</li>
      * </ul>
      *
      * @param endpointName the endpoint name
@@ -102,14 +102,14 @@
         if (optionMap == null) {
             throw new NullPointerException("optionMap is null");
         }
-        final CloseableExecutor executor = createExecutor(optionMap.get(Options.MAX_THREADS, 10));
+        final CloseableExecutor executor = createExecutor(optionMap.get(RemotingOptions.MAX_THREADS, 10));
         final Endpoint endpoint = createEndpoint(executor, endpointName);
         endpoint.addCloseHandler(new CloseHandler<Endpoint>() {
             public void handleClose(final Endpoint closed) {
                 IoUtils.safeClose(executor);
             }
         });
-        if (optionMap.get(Options.LOAD_PROVIDERS, true)) {
+        if (optionMap.get(RemotingOptions.LOAD_PROVIDERS, true)) {
             for (RemotingServiceDescriptor<?> descriptor : ServiceLoader.load(RemotingServiceDescriptor.class)) {
                 final String name = descriptor.getName();
                 final Class<?> serviceType = descriptor.getType();

Copied: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java (from rev 5591, remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Options.java)
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java	                        (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java	2009-11-17 19:30:39 UTC (rev 5594)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.remoting3;
+
+import org.jboss.xnio.Option;
+import org.jboss.xnio.Sequence;
+
+/**
+ * Common options for Remoting configuration.
+ */
+public final class RemotingOptions {
+
+    private RemotingOptions() {
+    }
+
+    /**
+     * Configure the maximum number of threads for a simple endpoint.
+     */
+    public static final Option<Integer> MAX_THREADS = Option.simple(RemotingOptions.class, "MAX_THREADS", Integer.class);
+
+    /**
+     * Specify whether connection providers should automatically be detected and loaded.
+     */
+    public static final Option<Boolean> LOAD_PROVIDERS = Option.simple(RemotingOptions.class, "LOAD_PROVIDERS", Boolean.class);
+
+    /**
+     * Request that the marshalling layer require the use of one of the listed marshalling protocols, in order of decreasing preference.
+     */
+    public static final Option<Sequence<String>> MARSHALLING_PROTOCOLS = Option.sequence(RemotingOptions.class, "MARSHALLING_PROTOCOLS", String.class);
+
+    /**
+     * Request that the marshalling layer require the presense of one of the listed user-defined class tables, in order of decreasing preference.
+     */
+    public static final Option<Sequence<String>> MARSHALLING_CLASS_TABLES = Option.sequence(RemotingOptions.class, "MARSHALLING_CLASS_TABLES", String.class);
+
+    /**
+     * Request that the marshalling layer require the presense of one of the listed user-defined object tables, in order of decreasing preference.
+     */
+    public static final Option<Sequence<String>> MARSHALLING_OBJECT_TABLES = Option.sequence(RemotingOptions.class, "MARSHALLING_OBJECT_TABLES", String.class);
+
+    /**
+     * Request that the marshalling layer require the presense of one of the listed class resolvers, in order of decreasing preference.
+     */
+    public static final Option<Sequence<String>> MARSHALLING_CLASS_RESOLVERS = Option.sequence(RemotingOptions.class, "MARSHALLING_CLASS_RESOLVERS", String.class);
+
+    /**
+     * Request that the marshalling layer require the presense of one of the listed object resolvers, in order of decreasing preference.
+     */
+    public static final Option<Sequence<String>> MARSHALLING_OBJECT_RESOLVERS = Option.sequence(RemotingOptions.class, "MARSHALLING_OBJECT_RESOLVERS", String.class);
+
+    /**
+     * Request that the marshalling layer require the presense of one of the listed user-defined externalizer factories, in order of decreasing preference.
+     */
+    public static final Option<Sequence<String>> MARSHALLING_EXTERNALIZER_FACTORIES = Option.sequence(RemotingOptions.class, "MARSHALLING_EXTERNALIZER_FACTORIES", String.class);
+
+    /**
+     * Specify a metric which is a hint that describes the relative desirability of this service.
+     */
+    public static final Option<Integer> METRIC = Option.simple(RemotingOptions.class, "METRIC", Integer.class);
+
+    /**
+     * Specify that the registered service should or should not be visible remotely.
+     */
+    public static final Option<Boolean> REMOTELY_VISIBLE = Option.simple(RemotingOptions.class, "REMOTELY_VISIBLE", Boolean.class);
+
+    /**
+     * Specify the buffer size for any configured marshaller or unmarshaller.
+     */
+    public static final Option<Integer> BUFFER_SIZE = Option.simple(RemotingOptions.class, "BUFFER_SIZE", Integer.class);
+
+    /**
+     * Specify the expected class count for any configured marshaller or unmarshaller.
+     */
+    public static final Option<Integer> CLASS_COUNT = Option.simple(RemotingOptions.class, "CLASS_COUNT", Integer.class);
+
+    /**
+     * Specify the expected instance count for any configured marshaller or unmarshaller.
+     */
+    public static final Option<Integer> INSTANCE_COUNT = Option.simple(RemotingOptions.class, "INSTANCE_COUNT", Integer.class);
+
+    /**
+     * Specify whether the service may be accessed from connections which are unencrypted, or whether encryption is
+     * required.
+     */
+    public static final Option<Boolean> REQUIRE_SECURE = Option.simple(RemotingOptions.class, "REQUIRE_SECURE", Boolean.class);
+
+    public static final Option<Integer> MAX_TRANSMIT_SIZE = Option.simple(RemotingOptions.class, "MAX_TRANSMIT_SIZE", Integer.class);
+
+    public static final Option<Integer> MAX_RECEIVE_SIZE = Option.simple(RemotingOptions.class, "MAX_RECEIVE_SIZE", Integer.class);
+
+    public static final Option<Integer> TRANSMIT_WINDOW_SIZE = Option.simple(RemotingOptions.class, "TRANSMIT_WINDOW_SIZE", Integer.class);
+
+    public static final Option<Integer> RECEIVE_WINDOW_SIZE = Option.simple(RemotingOptions.class, "RECEIVE_WINDOW_SIZE", Integer.class);
+
+    public static final Option<Integer> MAX_OUTBOUND_CHANNELS = Option.simple(RemotingOptions.class, "MAX_OUTBOUND_CHANNELS", Integer.class);
+
+    public static final Option<Integer> MAX_INBOUND_CHANNELS = Option.simple(RemotingOptions.class, "MAX_INBOUND_CHANNELS", Integer.class);
+
+    public static final Option<String> AUTH_USER_NAME = Option.simple(RemotingOptions.class, "AUTH_USER_NAME", String.class);
+
+    public static final Option<String> AUTH_REALM = Option.simple(RemotingOptions.class, "AUTH_REALM", String.class);
+}

Deleted: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/jboss-classloading.xml
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/resources/META-INF/jboss-classloading.xml	2009-11-13 21:50:09 UTC (rev 5593)
+++ remoting3/trunk/jboss-remoting/src/main/resources/META-INF/jboss-classloading.xml	2009-11-17 19:30:39 UTC (rev 5594)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<classloading name="jboss-remoting-api" version="3.0.0.GA" xmlns="urn:jboss:classloading:1.0">
-    <capabilities>
-        <package name="org.jboss.remoting3"/>
-        <package name="org.jboss.remoting3.spi"/>
-        <package name="org.jboss.remoting3.stream"/>
-    </capabilities>
-    <requirements>
-        <module name="xnio-api" from-inclusive="true" from="1.2.0.GA" reExport="true"/>
-        <module name="marshalling-api" from-inclusive="true" from="1.0.0.GA" reExport="true"/>
-    </requirements>
-</classloading>



More information about the jboss-remoting-commits mailing list