JBoss Remoting SVN: r5793 - in remoting3/trunk/jboss-remoting: src/main/java/org/jboss/remoting3 and 4 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-03 23:30:28 -0500 (Wed, 03 Mar 2010)
New Revision: 5793
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java
Modified:
remoting3/trunk/jboss-remoting/pom.xml
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ProtocolServiceType.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java
remoting3/trunk/jboss-remoting/src/test/resources/logging.properties
remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties
Log:
Fix a series of authentication issues
Modified: remoting3/trunk/jboss-remoting/pom.xml
===================================================================
--- remoting3/trunk/jboss-remoting/pom.xml 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/pom.xml 2010-03-04 04:30:28 UTC (rev 5793)
@@ -62,7 +62,7 @@
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-river</artifactId>
<version>${jbmar.version}</version>
- <scope>compile</scope>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
@@ -92,7 +92,7 @@
</property>
<property>
<name>jboss.remoting.leakdebugging</name>
- <value>true</value>
+ <value>false</value>
</property>
</systemProperties>
</configuration>
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 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -26,14 +26,15 @@
import java.net.URI;
import java.nio.charset.Charset;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
-import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
@@ -43,20 +44,20 @@
import org.jboss.remoting3.security.RemotingPermission;
import org.jboss.remoting3.security.SimpleClientCallbackHandler;
import org.jboss.remoting3.spi.AbstractHandleableCloseable;
+import org.jboss.remoting3.spi.ConnectionHandlerContext;
import org.jboss.remoting3.spi.ConnectionHandlerFactory;
import org.jboss.remoting3.spi.ConnectionProvider;
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.remoting3.spi.ConnectionProviderFactory;
+import org.jboss.remoting3.spi.ProtocolServiceType;
import org.jboss.remoting3.spi.RequestHandler;
-import org.jboss.remoting3.spi.ConnectionHandlerContext;
-import org.jboss.remoting3.spi.ProtocolServiceType;
-import org.jboss.xnio.log.Logger;
import org.jboss.xnio.FutureResult;
import org.jboss.xnio.IoFuture;
import org.jboss.xnio.IoUtils;
import org.jboss.xnio.OptionMap;
-import org.jboss.xnio.TranslatingResult;
+import org.jboss.xnio.Result;
import org.jboss.xnio.WeakCloseable;
+import org.jboss.xnio.log.Logger;
import javax.security.auth.callback.CallbackHandler;
@@ -339,7 +340,7 @@
class ServiceRegistration extends AbstractHandleableCloseable<Registration> implements Registration {
ServiceRegistration() {
- super(executor);
+ super(executor, false);
}
protected void closeAction() {
@@ -468,7 +469,7 @@
class ServiceListenerRegistration extends AbstractHandleableCloseable<Registration> implements Registration {
ServiceListenerRegistration() {
- super(executor);
+ super(executor, false);
}
protected void closeAction() {
@@ -569,10 +570,22 @@
throw new UnknownURISchemeException("No connection provider for URI scheme \"" + scheme + "\" is installed");
}
final FutureResult<Connection> futureResult = new FutureResult<Connection>(executor);
- futureResult.addCancelHandler(connectionProvider.connect(destination, connectOptions, new TranslatingResult<ConnectionHandlerFactory, Connection>(futureResult) {
- protected Connection translate(final ConnectionHandlerFactory input) {
- return new ConnectionImpl(EndpointImpl.this, input, connectionProviderContext, destination.toString());
+ // Mark the stack because otherwise debugging connect problems can be incredibly tough
+ final Throwable t = new Throwable();
+ futureResult.addCancelHandler(connectionProvider.connect(destination, connectOptions, new Result<ConnectionHandlerFactory>() {
+ public boolean setResult(final ConnectionHandlerFactory result) {
+ return futureResult.setResult(new ConnectionImpl(EndpointImpl.this, result, connectionProviderContext, destination.toString()));
}
+
+ public boolean setException(final IOException exception) {
+ final StackTraceElement[] st0 = t.getStackTrace();
+ exception.setStackTrace(Arrays.copyOfRange(st0, 1, st0.length));
+ return futureResult.setException(exception);
+ }
+
+ public boolean setCancelled() {
+ return futureResult.setCancelled();
+ }
}, callbackHandler));
return futureResult.getIoFuture();
}
@@ -612,7 +625,7 @@
if (connectionProviders.putIfAbsent(uriScheme, provider) != null) {
throw new DuplicateRegistrationException("URI scheme '" + uriScheme + "' is already registered to a provider");
}
- log.trace("Adding registration for connection provider named %s: %s", name, provider);
+ log.trace("Adding connection provider registration named '%s': %s", uriScheme, provider);
final Registration handle = new MapRegistration<ConnectionProvider>(connectionProviders, uriScheme, provider);
return handle;
}
@@ -644,7 +657,7 @@
if (map.putIfAbsent(name, provider) != null) {
throw new DuplicateRegistrationException(type.getDescription() + " '" + name + "' is already registered");
}
- log.trace("Adding registration for %s named %s: %s", type, name, provider);
+ log.trace("Adding '%s' registration named '%s': %s", type, name, provider);
return new MapRegistration<T>(map, name, provider);
}
@@ -694,7 +707,7 @@
private final T value;
private MapRegistration(final ConcurrentMap<String, T> map, final String key, final T value) {
- super(executor);
+ super(executor, false);
this.map = map;
this.key = key;
this.value = value;
@@ -711,6 +724,10 @@
throw new IllegalStateException(e);
}
}
+
+ public String toString() {
+ return String.format("Registration of '%s': %s", key, value);
+ }
}
final class LocalConnectionContext implements ConnectionHandlerContext {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemotingOptions.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -143,4 +143,9 @@
* Specify the name of a preregistered server authentication provider to use.
*/
public static final Option<String> AUTHENTICATION_PROVIDER = Option.simple(RemotingOptions.class, "AUTHENTICATION_PROVIDER", String.class);
+
+ /**
+ * Specify the number of times a client is allowed to retry authentication before closing the connection.
+ */
+ public static final Option<Integer> AUTHENTICATION_RETRIES = Option.simple(RemotingOptions.class, "AUTHENTICATION_RETRIES", Integer.class);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -137,6 +137,11 @@
});
return;
}
+ case RemoteProtocol.AUTH_REJECTED: {
+ RemoteConnectionHandler.log.trace("Received auth rejected message");
+ factoryResult.setException(new SaslException("Authentication failed"));
+ IoUtils.safeClose(remoteConnection);
+ }
}
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -24,9 +24,9 @@
import java.io.IOException;
import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Set;
import org.jboss.remoting3.ProtocolException;
import org.jboss.remoting3.RemotingOptions;
import org.jboss.remoting3.spi.ConnectionHandlerFactory;
@@ -53,13 +53,13 @@
}
public void handleMessage(final ByteBuffer buffer) {
- List<String> saslMechs = new ArrayList<String>();
+ Set<String> saslMechs = new LinkedHashSet<String>();
String remoteEndpointName = "endpoint";
final int[] ourVersions = connection.getProviderDescriptor().getSupportedVersions();
int bestVersion = -1;
switch (buffer.get()) {
case RemoteProtocol.GREETING: {
- RemoteConnectionHandler.log.warn("Client received greeting message");
+ RemoteConnectionHandler.log.trace("Client received greeting message");
while (buffer.hasRemaining()) {
final byte type = buffer.get();
final int len = buffer.get() & 0xff;
@@ -105,6 +105,11 @@
IoUtils.safeClose(connection);
return;
}
+ if (saslMechs.isEmpty()) {
+ factoryResult.setException(new SaslException("No more authentication mechanisms to try"));
+ IoUtils.safeClose(connection);
+ return;
+ }
// OK now send our authentication request
final OptionMap optionMap = connection.getOptionMap();
final String userName = optionMap.get(RemotingOptions.AUTH_USER_NAME);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -84,6 +84,7 @@
res = channel.write(buffer);
} catch (IOException e1) {
RemoteConnectionHandler.log.trace(e1, "Failed to send client greeting message");
+ factoryResult.setException(e1);
IoUtils.safeClose(connection);
connection.free(buffer);
return;
@@ -93,8 +94,16 @@
return;
}
}
- RemoteConnectionHandler.log.warn("Client sent greeting message");
connection.free(buffer);
+ try {
+ while (! channel.flush());
+ } catch (IOException e) {
+ RemoteConnectionHandler.log.trace(e, "Failed to flush client greeting message");
+ factoryResult.setException(e);
+ IoUtils.safeClose(connection);
+ return;
+ }
+ RemoteConnectionHandler.log.trace("Client sent greeting message");
channel.resumeReads();
return;
}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remote;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.jboss.xnio.channels.SslChannel;
+
+import javax.net.ssl.SSLPeerUnverifiedException;
+import javax.net.ssl.SSLSession;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.sasl.AuthorizeCallback;
+import javax.security.sasl.SaslException;
+import javax.security.sasl.SaslServer;
+
+final class ExternalSaslServer implements SaslServer {
+ private final AtomicBoolean complete = new AtomicBoolean();
+ private String authorizationID;
+ private final SslChannel sslChannel;
+ private final CallbackHandler callbackHandler;
+ private static final byte[] EMPTY = new byte[0];
+
+ ExternalSaslServer(final SslChannel sslChannel, final CallbackHandler callbackHandler) {
+ this.sslChannel = sslChannel;
+ this.callbackHandler = callbackHandler;
+ }
+
+ public String getMechanismName() {
+ return "EXTERNAL";
+ }
+
+ public byte[] evaluateResponse(final byte[] response) throws SaslException {
+ if (complete.getAndSet(true)) {
+ throw new SaslException("Received response after complete");
+ }
+ String userName;
+ try {
+ userName = new String(response, "UTF8");
+ } catch (UnsupportedEncodingException e) {
+ throw new SaslException("Cannot convert user name from UTF-8", e);
+ }
+ final SSLSession session = sslChannel.getSslSession();
+ final Principal peerPrincipal;
+ try {
+ peerPrincipal = session.getPeerPrincipal();
+ } catch (SSLPeerUnverifiedException e) {
+ throw new SaslException("SSL peer is unverified", e);
+ }
+ final AuthorizeCallback authorizeCallback = new AuthorizeCallback(peerPrincipal.getName(), userName);
+ handleCallback(callbackHandler, authorizeCallback);
+ authorizationID = userName;
+ return EMPTY;
+ }
+
+ private static void handleCallback(CallbackHandler handler, Callback callback) throws SaslException {
+ try {
+ handler.handle(new Callback[] {
+ callback,
+ });
+ } catch (SaslException e) {
+ throw e;
+ } catch (IOException e) {
+ throw new SaslException("Failed to authenticate due to callback exception", e);
+ } catch (UnsupportedCallbackException e) {
+ throw new SaslException("Failed to authenticate due to unsupported callback", e);
+ }
+ }
+
+ public boolean isComplete() {
+ return complete.get();
+ }
+
+ public String getAuthorizationID() {
+ return authorizationID;
+ }
+
+ public byte[] unwrap(final byte[] incoming, final int offset, final int len) throws SaslException {
+ throw new IllegalStateException();
+ }
+
+ public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws SaslException {
+ throw new IllegalStateException();
+ }
+
+ public Object getNegotiatedProperty(final String propName) {
+ return null;
+ }
+
+ public void dispose() throws SaslException {
+ }
+}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remote;
+
+import java.util.Map;
+import org.jboss.xnio.channels.SslChannel;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.sasl.SaslException;
+import javax.security.sasl.SaslServer;
+import javax.security.sasl.SaslServerFactory;
+
+final class ExternalSaslServerFactory implements SaslServerFactory {
+
+ private static final String[] NAMES = new String[] { "EXTERNAL" };
+
+ private final SslChannel sslChannel;
+
+ ExternalSaslServerFactory(final SslChannel sslChannel) {
+ this.sslChannel = sslChannel;
+ }
+
+ public SaslServer createSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException {
+ if (! "EXTERNAL".equalsIgnoreCase(mechanism)) {
+ return null;
+ }
+ return new ExternalSaslServer(sslChannel, cbh);
+ }
+
+ public String[] getMechanismNames(final Map<String, ?> props) {
+ return NAMES;
+ }
+}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -44,7 +44,6 @@
private final Pool<ByteBuffer> bufferPool = Buffers.createHeapByteBufferAllocator(4096);
private final MessageHandler.Setter messageHandlerSetter;
private final OptionMap optionMap;
- private boolean readDone;
private final Object writeLock = new Object();
RemoteConnection(final Executor executor, final ConnectedStreamChannel<InetSocketAddress> channel, final OptionMap optionMap, final ProviderDescriptor providerDescriptor) {
@@ -90,12 +89,15 @@
try {
sendBlockingNoClose(buffer);
} catch (IOException e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to send");
IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to send");
IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to send");
IoUtils.safeClose(channel);
throw e;
}
@@ -128,12 +130,15 @@
channel.awaitWritable();
}
} catch (IOException e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to flush");
IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to flush");
IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to flush");
IoUtils.safeClose(channel);
throw e;
}
@@ -147,12 +152,15 @@
channel.awaitWritable();
}
} catch (IOException e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to shutdown writes");
IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to shutdown writes");
IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
+ RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to shutdown writes");
IoUtils.safeClose(channel);
throw e;
}
@@ -194,4 +202,12 @@
ProviderDescriptor getProviderDescriptor() {
return providerDescriptor;
}
+
+ void terminate() {
+ try {
+ channel.close();
+ } catch (IOException e) {
+ RemoteConnectionHandler.log.trace("Channel terminate exception: %s", e);
+ }
+ }
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -51,7 +51,7 @@
public ConnectionProviderFactory getService(final Properties properties) throws IOException {
final String providerName = properties.getProperty("remote.xnio.provider", "default");
final Xnio xnio = Xnio.getInstance(providerName);
- final OptionMap connectorOptions = OptionMap.builder().parseAll(properties, "remote.connector.option").getMap();
+ final OptionMap connectorOptions = OptionMap.builder().parseAll(properties, "remote.connector.option.", getClass().getClassLoader()).getMap();
final Connector<InetSocketAddress, ? extends TcpChannel> connector;
connector = xnio.createTcpConnector(connectorOptions);
return new ConnectionProviderFactory() {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -51,7 +51,7 @@
public ConnectionProviderFactory getService(final Properties properties) throws IOException {
final String providerName = properties.getProperty("remote+ssl.xnio.provider", "default");
final Xnio xnio = Xnio.getInstance(providerName);
- final OptionMap connectorOptions = OptionMap.builder().parseAll(properties, "remote+ssl.connector.option").getMap();
+ final OptionMap connectorOptions = OptionMap.builder().parseAll(properties, "remote+ssl.connector.option.", getClass().getClassLoader()).getMap();
final Connector<InetSocketAddress, ? extends TcpChannel> connector;
try {
connector = xnio.createSslTcpConnector(null, connectorOptions);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -40,12 +40,14 @@
private final RemoteConnection remoteConnection;
private final SaslServer saslServer;
private final ConnectionProviderContext connectionProviderContext;
+ private final ServerInitialAuthenticationHandler initialAuthHandler;
- ServerAuthenticationHandler(final RemoteConnection remoteConnection, final SaslServer saslServer, final ConnectionProviderContext connectionProviderContext) {
+ ServerAuthenticationHandler(final RemoteConnection remoteConnection, final SaslServer saslServer, final ConnectionProviderContext connectionProviderContext, final ServerInitialAuthenticationHandler initialAuthHandler) {
super(remoteConnection);
this.saslServer = saslServer;
this.remoteConnection = remoteConnection;
this.connectionProviderContext = connectionProviderContext;
+ this.initialAuthHandler = initialAuthHandler;
}
public void handleMessage(final ByteBuffer buffer) {
@@ -58,8 +60,8 @@
challenge = saslServer.evaluateResponse(Buffers.take(buffer, buffer.remaining()));
} catch (SaslException e) {
RemoteConnectionHandler.log.trace(e, "Server authentication failed");
- remoteConnection.sendAuthReject("Authentication failed");
- remoteConnection.flushBlocking();
+ initialAuthHandler.rejectAuth();
+ remoteConnection.setMessageHandler(initialAuthHandler);
return;
}
final boolean complete = saslServer.isComplete();
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -24,20 +24,21 @@
import java.nio.ByteBuffer;
import java.util.Map;
-import java.util.Set;
import org.jboss.remoting3.security.ServerAuthenticationProvider;
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.xnio.Buffers;
import org.jboss.xnio.IoUtils;
+import javax.security.sasl.SaslServerFactory;
+
final class ServerGreetingHandler extends AbstractMessageHandler {
private final RemoteConnection connection;
private final ConnectionProviderContext connectionProviderContext;
- private final Set<String> saslMechs;
+ private final Map<String, SaslServerFactory> saslMechs;
private final ServerAuthenticationProvider provider;
private final Map<String, Object> propertyMap;
- ServerGreetingHandler(final RemoteConnection connection, final ConnectionProviderContext connectionProviderContext, final Set<String> saslMechs, final ServerAuthenticationProvider provider, final Map<String, Object> propertyMap) {
+ ServerGreetingHandler(final RemoteConnection connection, final ConnectionProviderContext connectionProviderContext, final Map<String, SaslServerFactory> saslMechs, final ServerAuthenticationProvider provider, final Map<String, Object> propertyMap) {
super(connection);
this.connection = connection;
this.connectionProviderContext = connectionProviderContext;
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -25,29 +25,32 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Map;
-import java.util.Set;
+import org.jboss.remoting3.RemotingOptions;
import org.jboss.remoting3.security.ServerAuthenticationProvider;
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.xnio.Buffers;
import org.jboss.xnio.IoUtils;
-import javax.security.sasl.Sasl;
+import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
+import javax.security.sasl.SaslServerFactory;
final class ServerInitialAuthenticationHandler extends AbstractMessageHandler {
private final RemoteConnection remoteConnection;
private final Map<String, ?> saslPropertyMap;
- private final Set<String> allowedMechs;
+ private final Map<String, SaslServerFactory> allowedMechs;
private final ServerAuthenticationProvider authenticationProvider;
private final ConnectionProviderContext connectionProviderContext;
+ private int retries;
- ServerInitialAuthenticationHandler(final RemoteConnection remoteConnection, final Map<String, ?> saslPropertyMap, final Set<String> allowedMechs, final ServerAuthenticationProvider authenticationProvider, final ConnectionProviderContext connectionProviderContext) {
+ ServerInitialAuthenticationHandler(final RemoteConnection remoteConnection, final Map<String, ?> saslPropertyMap, final Map<String, SaslServerFactory> allowedMechs, final ServerAuthenticationProvider authenticationProvider, final ConnectionProviderContext connectionProviderContext) {
super(remoteConnection);
this.remoteConnection = remoteConnection;
this.saslPropertyMap = saslPropertyMap;
this.allowedMechs = allowedMechs;
this.authenticationProvider = authenticationProvider;
this.connectionProviderContext = connectionProviderContext;
+ retries = remoteConnection.getOptionMap().get(RemotingOptions.AUTHENTICATION_RETRIES, 3);
}
public void handleMessage(final ByteBuffer buffer) {
@@ -56,17 +59,26 @@
try {
// mech name
final String name = Buffers.getModifiedUtf8(buffer);
- if (allowedMechs.contains(name)) {
+ final SaslServerFactory serverFactory = allowedMechs.get(name);
+ if (serverFactory != null) {
RemoteConnectionHandler.log.trace("Selected SASL mechanism %s", name);
final String realm = connectionProviderContext.getEndpoint().getName();
- final SaslServer server = Sasl.createSaslServer(name, "remote", realm, saslPropertyMap, authenticationProvider.getCallbackHandler());
- remoteConnection.setMessageHandler(new ServerAuthenticationHandler(remoteConnection, server, connectionProviderContext));
+ final SaslServer server = serverFactory.createSaslServer(name, "remote", realm, saslPropertyMap, authenticationProvider.getCallbackHandler());
+ remoteConnection.setMessageHandler(new ServerAuthenticationHandler(remoteConnection, server, connectionProviderContext, this));
RemoteConnectionHandler.log.trace("Sending initial challenge");
- remoteConnection.sendAuthMessage(RemoteProtocol.AUTH_CHALLENGE, server.evaluateResponse(SaslUtils.EMPTY));
+ final byte[] resp;
+ try {
+ resp = server.evaluateResponse(SaslUtils.EMPTY);
+ } catch (SaslException e) {
+ RemoteConnectionHandler.log.trace("Rejected invalid SASL response: %s", e);
+ rejectAuth();
+ return;
+ }
+ remoteConnection.sendAuthMessage(RemoteProtocol.AUTH_CHALLENGE, resp);
return;
} else {
RemoteConnectionHandler.log.trace("Rejected invalid SASL mechanism %s", name);
- remoteConnection.sendAuthReject("Invalid mechanism name");
+ rejectAuth();
return;
}
} catch (IOException e) {
@@ -81,4 +93,12 @@
}
}
}
+
+ void rejectAuth() throws IOException {
+ remoteConnection.sendAuthReject("Authentication failed");
+ if (retries-- == 0) {
+ // too bad
+ remoteConnection.terminate();
+ }
+ }
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -27,7 +27,7 @@
import java.nio.ByteBuffer;
import java.util.Enumeration;
import java.util.HashSet;
-import java.util.LinkedHashSet;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.jboss.marshalling.ProviderDescriptor;
@@ -41,6 +41,7 @@
import org.jboss.xnio.Options;
import org.jboss.xnio.Sequence;
import org.jboss.xnio.channels.ConnectedStreamChannel;
+import org.jboss.xnio.channels.SslChannel;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslServerFactory;
@@ -65,20 +66,50 @@
}
final RemoteConnection connection = new RemoteConnection(connectionProviderContext.getExecutor(), channel, optionMap, providerDescriptor);
+ // Get the server authentication provider
+ final String authProvider = optionMap.get(RemotingOptions.AUTHENTICATION_PROVIDER);
+ if (authProvider == null) {
+ RemoteConnectionHandler.log.warn("No authentication provider available");
+ IoUtils.safeClose(connection);
+ return;
+ }
+ final ServerAuthenticationProvider provider = connectionProviderContext.getProtocolServiceProvider(ProtocolServiceType.SERVER_AUTHENTICATION_PROVIDER, authProvider);
+ if (provider == null) {
+ RemoteConnectionHandler.log.warn("No authentication provider available");
+ IoUtils.safeClose(connection);
+ return;
+ }
+
// Calculate available server mechanisms
final Sequence<String> mechs = optionMap.get(Options.SASL_MECHANISMS);
final Set<String> includes = mechs != null ? new HashSet<String>(mechs) : null;
- final Set<String> serverMechanisms = new LinkedHashSet<String>();
final Map<String, Object> propertyMap = SaslUtils.createPropertyMap(optionMap);
final Enumeration<SaslServerFactory> e = Sasl.getSaslServerFactories();
+ final Map<String, SaslServerFactory> saslServerFactories = new LinkedHashMap<String, SaslServerFactory>();
+ if (channel instanceof SslChannel && (includes == null | includes.contains("EXTERNAL"))) {
+ // automatically the best mechanism.
+ saslServerFactories.put("EXTERNAL", new ExternalSaslServerFactory((SslChannel) channel));
+ }
while (e.hasMoreElements()) {
final SaslServerFactory saslServerFactory = e.nextElement();
for (String name : saslServerFactory.getMechanismNames(propertyMap)) {
if (includes == null || includes.contains(name)) {
- serverMechanisms.add(name);
+ saslServerFactories.put(name, saslServerFactory);
}
}
}
+ if (saslServerFactories.isEmpty()) {
+ try {
+ RemoteConnectionHandler.log.trace("Sending server no-mechanisms message");
+ connection.sendAuthReject("No mechanisms available");
+ connection.close();
+ return;
+ } catch (IOException e1) {
+ RemoteConnectionHandler.log.trace(e1, "Failed to send server no-mechanisms message");
+ IoUtils.safeClose(connection);
+ return;
+ }
+ }
// Send server greeting packet...
final ByteBuffer buffer = connection.allocate();
@@ -93,7 +124,7 @@
GreetingUtils.writeInt(buffer, RemoteProtocol.GREETING_MARSHALLER_VERSION, version);
}
// SASL server mechs
- for (String name : serverMechanisms) {
+ for (String name : saslServerFactories.keySet()) {
GreetingUtils.writeString(buffer, RemoteProtocol.GREETING_SASL_MECH, name);
RemoteConnectionHandler.log.trace("Offering SASL mechanism %s", name);
}
@@ -119,24 +150,21 @@
return;
}
}
- RemoteConnectionHandler.log.warn("Server sent greeting message");
connection.free(buffer);
+ try {
+ while (! channel.flush());
+ } catch (IOException e) {
+ RemoteConnectionHandler.log.trace(e, "Failed to flush server greeting message");
+ IoUtils.safeClose(connection);
+ return;
+ }
+ RemoteConnectionHandler.log.trace("Server sent greeting message");
channel.resumeReads();
return;
}
}
});
- final String authProvider = optionMap.get(RemotingOptions.AUTHENTICATION_PROVIDER);
- if (authProvider == null) {
- // todo log no valid auth provider
- IoUtils.safeClose(connection);
- }
- final ServerAuthenticationProvider provider = connectionProviderContext.getProtocolServiceProvider(ProtocolServiceType.SERVER_AUTHENTICATION_PROVIDER, authProvider);
- if (provider == null) {
- // todo log no valid auth provider
- IoUtils.safeClose(connection);
- }
- connection.setMessageHandler(new ServerGreetingHandler(connection, connectionProviderContext, serverMechanisms, provider, propertyMap));
+ connection.setMessageHandler(new ServerGreetingHandler(connection, connectionProviderContext, saslServerFactories, provider, propertyMap));
// and send the greeting
channel.resumeWrites();
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -48,6 +48,7 @@
private final Executor executor;
private final StackTraceElement[] backtrace;
+ private final boolean autoClose;
private final Object closeLock = new Object();
private State state = State.OPEN;
@@ -79,11 +80,22 @@
* @param executor the executor used to execute the close notification handlers
*/
protected AbstractHandleableCloseable(final Executor executor) {
+ this(executor, true);
+ }
+
+ /**
+ * Basic constructor.
+ *
+ * @param executor the executor used to execute the close notification handlers
+ * @param autoClose {@code true} if this instance should automatically close on finalize
+ */
+ protected AbstractHandleableCloseable(final Executor executor, final boolean autoClose) {
if (executor == null) {
throw new NullPointerException("executor is null");
}
this.executor = executor;
backtrace = LEAK_DEBUGGING ? new Throwable().getStackTrace() : null;
+ this.autoClose = autoClose;
}
/**
@@ -241,7 +253,7 @@
try {
super.finalize();
} finally {
- if (isOpen()) {
+ if (autoClose && isOpen()) {
if (LEAK_DEBUGGING) {
final Throwable t = new LeakThrowable();
t.setStackTrace(backtrace);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ProtocolServiceType.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ProtocolServiceType.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ProtocolServiceType.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -106,4 +106,8 @@
public String getDescription() {
return description;
}
+
+ public String toString() {
+ return "protocol service type: \"" + getDescription() + "\"";
+ }
}
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -62,29 +62,33 @@
}
}
- protected Connection getConnection() throws IOException {
+ protected Connection getConnection() throws Exception {
final NetworkServerProvider provider = endpoint.getConnectionProviderInterface(getScheme(), NetworkServerProvider.class);
assertNotNull(provider, "No remote provider interface");
- final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener = provider.getServerListener(OptionMap.builder().set(RemotingOptions.AUTHENTICATION_PROVIDER, "test").setSequence(Options.SASL_MECHANISMS, "DIGEST-MD5").getMap());
+ final OptionMap serverOptions = OptionMap.builder()
+ .set(RemotingOptions.AUTHENTICATION_PROVIDER, "test")
+// .setSequence(Options.SASL_MECHANISMS, "EXTERNAL", "DIGEST-MD5")
+ .setSequence(Options.SASL_MECHANISMS, "DIGEST-MD5")
+ .getMap();
+ final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener = provider.getServerListener(serverOptions);
final Xnio xnio = Xnio.getInstance();
- try {
- final AcceptingServer<InetSocketAddress, ?, ?> server = getServer(listener, xnio);
- final IoFuture<? extends BoundChannel<InetSocketAddress>> future = server.bind(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0));
- final InetSocketAddress localAddress = future.get().getLocalAddress();
- final Connection connection = endpoint.connect(new URI(getScheme(), null, localAddress.getAddress().getHostAddress(), localAddress.getPort(), null, null, null), OptionMap.builder().setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA").getMap(), "user", null, "password".toCharArray()).get();
- connection.addCloseHandler(new CloseHandler<Connection>() {
- public void handleClose(final Connection closed) {
- IoUtils.safeClose(server);
- }
- });
- return connection;
- } catch (Exception e) {
- final IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
+ final AcceptingServer<InetSocketAddress, ?, ?> server = getServer(listener, xnio);
+ final IoFuture<? extends BoundChannel<InetSocketAddress>> future = server.bind(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0));
+ final InetSocketAddress localAddress = future.get().getLocalAddress();
+ final OptionMap clientOptions = OptionMap.builder()
+ .setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA")
+ .getMap();
+ final Connection connection = endpoint.connect(new URI(getScheme(), null, localAddress.getAddress().getHostAddress(), localAddress.getPort(), null, null, null), clientOptions, "user", null, "password".toCharArray()).get();
+ connection.addCloseHandler(new CloseHandler<Connection>() {
+ public void handleClose(final Connection closed) {
+ IoUtils.safeClose(server);
+ }
+ });
+ return connection;
}
+ protected void addClientOptions(OptionMap.Builder optionMapBuilder) {}
+
protected abstract String getScheme();
protected abstract AcceptingServer<InetSocketAddress, ?, ?> getServer(ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener, Xnio xnio) throws NoSuchProviderException, NoSuchAlgorithmException;
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -76,9 +76,9 @@
log.info("-------------------------------------------------------------");
}
- protected abstract Connection getConnection() throws IOException;
+ protected abstract Connection getConnection() throws Exception;
- public void testBasicInvoke() throws IOException {
+ public void testBasicInvoke() throws Exception {
enter();
try {
final InvocationTestObject requestObj = new InvocationTestObject();
@@ -126,7 +126,7 @@
}
}
- public void testBasicSend() throws IOException {
+ public void testBasicSend() throws Exception {
enter();
try {
final InvocationTestObject requestObj = new InvocationTestObject();
@@ -175,7 +175,7 @@
}
}
- public void testBasicClientConnector() throws Throwable {
+ public void testBasicClientConnector() throws Exception {
enter();
try {
final InvocationTestObject requestObj = new InvocationTestObject();
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalTestCase.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalTestCase.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -28,7 +28,7 @@
import org.jboss.xnio.OptionMap;
import org.testng.annotations.Test;
-@Test(suiteName = "Local tests")
+@Test(description = "Local Tests")
public final class LocalTestCase extends InvocationTestBase {
protected Connection getConnection() throws IOException {
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -22,6 +22,7 @@
package org.jboss.remoting3.test;
+import java.io.IOException;
import java.net.InetSocketAddress;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
@@ -36,12 +37,33 @@
@Test(suiteName = "Remote SSL tests")
public final class RemoteSslTestCase extends AbstractRemoteTestCase {
+ // Use anonymous ciphers so we don't need a trust store configuration of any sort
+ private static final String[] CIPHER_SUITES = {
+ "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
+ "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
+ "TLS_DH_anon_WITH_AES_128_CBC_SHA",
+ "TLS_DH_anon_WITH_AES_256_CBC_SHA",
+ "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
+ "SSL_DH_anon_WITH_DES_CBC_SHA",
+ "SSL_DH_anon_WITH_RC4_128_MD5",
+ "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
+ "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
+ };
+
+ private static final String[] PROTOCOLS = {
+ "TLSv1",
+ };
+
protected SslTcpServer getServer(final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener, final Xnio xnio) throws NoSuchProviderException, NoSuchAlgorithmException {
- return xnio.createSslTcpServer(listener, OptionMap.builder().setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA").getMap());
+ final OptionMap serverOptions = OptionMap.builder()
+ .setSequence(Options.SSL_ENABLED_CIPHER_SUITES, CIPHER_SUITES)
+ .setSequence(Options.SSL_ENABLED_PROTOCOLS, PROTOCOLS)
+ .getMap();
+ return xnio.createSslTcpServer(listener, serverOptions);
}
protected String getScheme() {
- if (true) throw new SkipException("SSL");
+ if (false) throw new SkipException("SSL");
return "remote+ssl";
}
}
\ No newline at end of file
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java 2010-03-04 04:30:28 UTC (rev 5793)
@@ -40,7 +40,7 @@
/**
*
*/
-@Test
+@Test(suiteName = "Streams Tests")
public final class StreamsTestCase {
public void testCollectionObjectSink() throws Throwable {
Modified: remoting3/trunk/jboss-remoting/src/test/resources/logging.properties
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/resources/logging.properties 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/test/resources/logging.properties 2010-03-04 04:30:28 UTC (rev 5793)
@@ -21,20 +21,23 @@
#
# Additional logger names to configure (root logger is always configured)
-loggers=javax.security.sasl
+loggers=javax.security.sasl,org.jboss.xnio.ssl
# Root logger configuration
-logger.level=DEBUG
+logger.level=INFO
logger.handlers=CONSOLE
# Configure javax.security.sasl to be less verbose by default
logger.javax.security.sasl.level=INFO
+# Configure org.jboss.xnio.ssl to be less verbose by default
+logger.org.jboss.xnio.ssl.level=INFO
+
# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.target=SYSTEM_ERR
handler.CONSOLE.properties=autoFlush
-handler.CONSOLE.level=DEBUG
+handler.CONSOLE.level=TRACE
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN
Modified: remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties 2010-03-03 16:54:23 UTC (rev 5792)
+++ remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties 2010-03-04 04:30:28 UTC (rev 5793)
@@ -19,3 +19,5 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
#
+
+remote+ssl.connector.option.org.jboss.xnio.Options.SSL_ENABLED_CIPHER_SUITES=SSL_DH_anon_WITH_DES_CBC_SHA
14 years, 8 months
JBoss Remoting SVN: r5792 - in remoting3/trunk: jboss-remoting/src/main/java/org/jboss/remoting3 and 5 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-03 11:54:23 -0500 (Wed, 03 Mar 2010)
New Revision: 5792
Modified:
remoting3/trunk/jboss-remoting/pom.xml
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalRequestHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemoteClassTable.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractClientMessageHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/GreetingUtils.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/StringRot13RequestListener.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java
Log:
JBREM-1201, remove handleClose; JBRAM-1199 add marshaller version to negotiation; also fix some problems in the close path and some minor marshalling issues
Modified: remoting3/trunk/jboss-remoting/pom.xml
===================================================================
--- remoting3/trunk/jboss-remoting/pom.xml 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/pom.xml 2010-03-03 16:54:23 UTC (rev 5792)
@@ -31,8 +31,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <xnio.version>2.1.0.CR1</xnio.version>
- <jbmar.version>1.3.0.CR1</jbmar.version>
+ <xnio.version>2.1.0.CR2-SNAPSHOT</xnio.version>
+ <jbmar.version>1.3.0.CR2-SNAPSHOT</jbmar.version>
</properties>
<groupId>org.jboss.remoting</groupId>
@@ -54,15 +54,15 @@
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
- <artifactId>marshalling-api</artifactId>
+ <artifactId>jboss-marshalling</artifactId>
<version>${jbmar.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
- <artifactId>river</artifactId>
+ <artifactId>jboss-marshalling-river</artifactId>
<version>${jbmar.version}</version>
- <scope>test</scope>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
@@ -90,6 +90,10 @@
<name>java.util.logging.manager</name>
<value>org.jboss.logmanager.LogManager</value>
</property>
+ <property>
+ <name>jboss.remoting.leakdebugging</name>
+ <value>true</value>
+ </property>
</systemProperties>
</configuration>
</plugin>
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 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -612,6 +612,7 @@
if (connectionProviders.putIfAbsent(uriScheme, provider) != null) {
throw new DuplicateRegistrationException("URI scheme '" + uriScheme + "' is already registered to a provider");
}
+ log.trace("Adding registration for connection provider named %s: %s", name, provider);
final Registration handle = new MapRegistration<ConnectionProvider>(connectionProviders, uriScheme, provider);
return handle;
}
@@ -643,6 +644,7 @@
if (map.putIfAbsent(name, provider) != null) {
throw new DuplicateRegistrationException(type.getDescription() + " '" + name + "' is already registered");
}
+ log.trace("Adding registration for %s named %s: %s", type, name, provider);
return new MapRegistration<T>(map, name, provider);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalRequestHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalRequestHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalRequestHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -90,11 +90,7 @@
}
protected void closeAction() throws IOException {
- try {
- requestListener.handleClose();
- } catch (Throwable t) {
- log.error(t, "Unexpected exception in request listener handleClose() method");
- }
+ clientContext.close();
}
public String toString() {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemoteClassTable.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemoteClassTable.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemoteClassTable.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -168,9 +168,5 @@
// no action necessary.
}
}
-
- public void handleClose() {
- // ---
- }
}
}
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 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -25,6 +25,8 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
@@ -160,6 +162,7 @@
addServices(endpoint, ProtocolServiceType.CLASS_RESOLVER, props);
addServices(endpoint, ProtocolServiceType.OBJECT_RESOLVER, props);
addServices(endpoint, ProtocolServiceType.CLASS_EXTERNALIZER_FACTORY, props);
+ final List<RemotingServiceDescriptor<?>> connectionProviders = new ArrayList<RemotingServiceDescriptor<?>>();
for (RemotingServiceDescriptor<?> descriptor : ServiceLoader.load(RemotingServiceDescriptor.class)) {
final String name = descriptor.getName();
final Class<?> serviceType = descriptor.getType();
@@ -171,7 +174,7 @@
}
try {
if (serviceType == ConnectionProviderFactory.class) {
- endpoint.addConnectionProvider(name, (ConnectionProviderFactory) service);
+ connectionProviders.add(descriptor);
} else if (serviceType == ClassTable.class) {
endpoint.addProtocolService(ProtocolServiceType.CLASS_TABLE, name, (ClassTable) service);
} else if (serviceType == ObjectTable.class) {
@@ -184,7 +187,7 @@
endpoint.addProtocolService(ProtocolServiceType.CLASS_EXTERNALIZER_FACTORY, name, (ClassExternalizerFactory) service);
}
} catch (DuplicateRegistrationException e) {
- log.warn("Duplicate registration for '" + name + "' of " + serviceType);
+ log.warn("Duplicate registration for %s '%s'", serviceType, name);
}
}
final Map<String, ProviderDescriptor> found = new HashMap<String, ProviderDescriptor>();
@@ -199,9 +202,20 @@
try {
endpoint.addProtocolService(ProtocolServiceType.MARSHALLER_PROVIDER_DESCRIPTOR, name, found.get(name));
} catch (DuplicateRegistrationException e) {
- log.warn("Duplicate registration for '" + name + "' of " + MarshallerFactory.class);
+ log.warn("Duplicate registration for marshaller factory '%s'", name);
}
}
+ // last but not least, install all the protocol service providers which may depend on prior items
+ for (RemotingServiceDescriptor<?> descriptor : connectionProviders) {
+ final String name = descriptor.getName();
+ try {
+ endpoint.addConnectionProvider(name, (ConnectionProviderFactory) descriptor.getService(props));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } catch (DuplicateRegistrationException e) {
+ log.warn("Duplicate registration for connection provider '%s'", name);
+ }
+ }
ok = true;
return endpoint;
} finally {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -46,10 +46,4 @@
* @throws RemoteExecutionException if the execution failed in some way
*/
void handleRequest(RequestContext<O> context, I request) throws RemoteExecutionException;
-
- /**
- * Handle the client closing. Free up any resources. This method is called after the close has occurred,
- * so exceptions thrown will be ignored.
- */
- void handleClose();
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractClientMessageHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractClientMessageHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractClientMessageHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -23,6 +23,7 @@
package org.jboss.remoting3.remote;
import java.io.IOException;
+import java.nio.channels.ClosedChannelException;
import org.jboss.remoting3.spi.ConnectionHandlerFactory;
import org.jboss.xnio.Result;
@@ -35,6 +36,9 @@
}
public void handleException(final IOException e) {
+ if (e instanceof ClosedChannelException) {
+ return;
+ }
result.setException(e);
super.handleException(e);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -23,6 +23,7 @@
package org.jboss.remoting3.remote;
import java.io.IOException;
+import java.nio.channels.ClosedChannelException;
import org.jboss.xnio.IoUtils;
import org.jboss.xnio.channels.MessageHandler;
@@ -36,14 +37,18 @@
public void handleEof() {
try {
remoteConnection.getChannel().shutdownReads();
+ return;
} catch (IOException e) {
RemoteConnectionHandler.log.trace(e, "Failed to shut down reads for %s", remoteConnection);
+ IoUtils.safeClose(remoteConnection);
}
- remoteConnection.readDone();
- IoUtils.safeClose(remoteConnection);
}
public void handleException(final IOException e) {
+ if (e instanceof ClosedChannelException) {
+ // ignore; just means there was a race.
+ return;
+ }
RemoteConnectionHandler.log.trace(e, "Received exception from %s", remoteConnection);
IoUtils.safeClose(remoteConnection);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -25,7 +25,6 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import org.jboss.marshalling.MarshallerFactory;
-import org.jboss.marshalling.Marshalling;
import org.jboss.remoting3.CloseHandler;
import org.jboss.remoting3.spi.ConnectionHandler;
import org.jboss.remoting3.spi.ConnectionHandlerContext;
@@ -125,7 +124,7 @@
factoryResult.setResult(new ConnectionHandlerFactory() {
public ConnectionHandler createInstance(final ConnectionHandlerContext connectionContext) {
// this happens immediately.
- final MarshallerFactory marshallerFactory = Marshalling.getMarshallerFactory("river");
+ final MarshallerFactory marshallerFactory = remoteConnection.getProviderDescriptor().getMarshallerFactory();
final RemoteConnectionHandler connectionHandler = new RemoteConnectionHandler(connectionContext, remoteConnection, marshallerFactory);
remoteConnection.addCloseHandler(new CloseHandler<Object>() {
public void handleClose(final Object closed) {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -27,9 +27,11 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.jboss.remoting3.ProtocolException;
import org.jboss.remoting3.RemotingOptions;
import org.jboss.remoting3.spi.ConnectionHandlerFactory;
import org.jboss.xnio.Buffers;
+import org.jboss.xnio.IoUtils;
import org.jboss.xnio.OptionMap;
import org.jboss.xnio.Result;
@@ -53,33 +55,56 @@
public void handleMessage(final ByteBuffer buffer) {
List<String> saslMechs = new ArrayList<String>();
String remoteEndpointName = "endpoint";
+ final int[] ourVersions = connection.getProviderDescriptor().getSupportedVersions();
+ int bestVersion = -1;
switch (buffer.get()) {
case RemoteProtocol.GREETING: {
+ RemoteConnectionHandler.log.warn("Client received greeting message");
while (buffer.hasRemaining()) {
final byte type = buffer.get();
final int len = buffer.get() & 0xff;
+ final ByteBuffer data = Buffers.slice(buffer, len);
switch (type) {
case RemoteProtocol.GREETING_VERSION: {
// We only support version zero, so knowing the other side's version is not useful presently
- buffer.get();
- if (len > 1) Buffers.skip(buffer, len - 1);
break;
}
case RemoteProtocol.GREETING_SASL_MECH: {
- saslMechs.add(Buffers.getModifiedUtf8(Buffers.slice(buffer, len)));
+ saslMechs.add(Buffers.getModifiedUtf8(data));
break;
}
case RemoteProtocol.GREETING_ENDPOINT_NAME: {
- remoteEndpointName = Buffers.getModifiedUtf8(Buffers.slice(buffer, len));
+ remoteEndpointName = Buffers.getModifiedUtf8(data);
break;
}
+ case RemoteProtocol.GREETING_MARSHALLER_VERSION: {
+ final int remoteVersion = data.getInt();
+ // is it better than the best one? if not, don't bother
+ if (remoteVersion <= bestVersion) {
+ break;
+ }
+ // do we support it? if not, skip
+ for (int ourVersion : ourVersions) {
+ if (ourVersion == remoteVersion) {
+ bestVersion = remoteVersion;
+ break;
+ }
+ }
+ break;
+ }
default: {
// unknown, skip it for forward compatibility.
- Buffers.skip(buffer, len);
break;
}
}
}
+ // Check the greeting
+ if (bestVersion == -1) {
+ // no matches.
+ factoryResult.setException(new ProtocolException("No matching Marshalling versions could be found"));
+ IoUtils.safeClose(connection);
+ return;
+ }
// OK now send our authentication request
final OptionMap optionMap = connection.getOptionMap();
final String userName = optionMap.get(RemotingOptions.AUTH_USER_NAME);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
+import org.jboss.marshalling.ProviderDescriptor;
import org.jboss.remoting3.spi.ConnectionHandlerFactory;
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.xnio.ChannelListener;
@@ -42,12 +43,14 @@
private final ConnectionProviderContext connectionProviderContext;
private final Result<ConnectionHandlerFactory> factoryResult;
private final CallbackHandler callbackHandler;
+ private final ProviderDescriptor providerDescriptor;
- ClientOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler) {
+ ClientOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler, final ProviderDescriptor providerDescriptor) {
this.optionMap = optionMap;
this.connectionProviderContext = connectionProviderContext;
this.factoryResult = factoryResult;
this.callbackHandler = callbackHandler;
+ this.providerDescriptor = providerDescriptor;
}
public void handleEvent(final ConnectedStreamChannel<InetSocketAddress> channel) {
@@ -56,12 +59,17 @@
} catch (IOException e) {
// ignore
}
- final RemoteConnection connection = new RemoteConnection(connectionProviderContext.getExecutor(), channel, optionMap);
-
+ final RemoteConnection connection = new RemoteConnection(connectionProviderContext.getExecutor(), channel, optionMap, providerDescriptor);
// Send client greeting packet...
final ByteBuffer buffer = connection.allocate();
// length placeholder
buffer.putInt(0);
+ buffer.put(RemoteProtocol.GREETING);
+ // marshaller versions
+ final int[] versions = providerDescriptor.getSupportedVersions();
+ for (int version : versions) {
+ GreetingUtils.writeInt(buffer, RemoteProtocol.GREETING_MARSHALLER_VERSION, version);
+ }
// version ID
GreetingUtils.writeByte(buffer, RemoteProtocol.GREETING_VERSION, RemoteProtocol.VERSION);
// that's it!
@@ -85,6 +93,7 @@
return;
}
}
+ RemoteConnectionHandler.log.warn("Client sent greeting message");
connection.free(buffer);
channel.resumeReads();
return;
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/GreetingUtils.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/GreetingUtils.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/GreetingUtils.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -50,4 +50,10 @@
buffer.put((byte) 1);
buffer.put(value);
}
+
+ static void writeInt(ByteBuffer buffer, byte type, int value) {
+ buffer.put(type);
+ buffer.put((byte) 4);
+ buffer.putInt(value);
+ }
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -28,6 +28,7 @@
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.concurrent.Executor;
+import org.jboss.marshalling.ProviderDescriptor;
import org.jboss.remoting3.spi.AbstractHandleableCloseable;
import org.jboss.xnio.Buffers;
import org.jboss.xnio.IoUtils;
@@ -39,15 +40,17 @@
final class RemoteConnection extends AbstractHandleableCloseable<RemoteConnection> implements Closeable {
private final ConnectedStreamChannel<InetSocketAddress> channel;
+ private final ProviderDescriptor providerDescriptor;
private final Pool<ByteBuffer> bufferPool = Buffers.createHeapByteBufferAllocator(4096);
private final MessageHandler.Setter messageHandlerSetter;
private final OptionMap optionMap;
private boolean readDone;
private final Object writeLock = new Object();
- RemoteConnection(final Executor executor, final ConnectedStreamChannel<InetSocketAddress> channel, final OptionMap optionMap) {
+ RemoteConnection(final Executor executor, final ConnectedStreamChannel<InetSocketAddress> channel, final OptionMap optionMap, final ProviderDescriptor providerDescriptor) {
super(executor);
this.channel = channel;
+ this.providerDescriptor = providerDescriptor;
messageHandlerSetter = Channels.createMessageReader(channel, optionMap);
this.optionMap = optionMap;
}
@@ -57,24 +60,10 @@
try {
shutdownWritesBlocking();
} catch (IOException e) {
- readDone = true;
- writeLock.notifyAll();
IoUtils.safeClose(channel);
return;
}
- while (! readDone) {
- try {
- writeLock.wait();
- } catch (InterruptedException e) {
- readDone = true;
- writeLock.notifyAll();
- IoUtils.safeClose(channel);
- Thread.currentThread().interrupt();
- throw new InterruptedIOException();
- }
- }
}
- channel.close();
}
OptionMap getOptionMap() {
@@ -101,13 +90,13 @@
try {
sendBlockingNoClose(buffer);
} catch (IOException e) {
- IoUtils.safeClose(this);
+ IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
- IoUtils.safeClose(this);
+ IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
- IoUtils.safeClose(this);
+ IoUtils.safeClose(channel);
throw e;
}
}
@@ -139,13 +128,13 @@
channel.awaitWritable();
}
} catch (IOException e) {
- IoUtils.safeClose(this);
+ IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
- IoUtils.safeClose(this);
+ IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
- IoUtils.safeClose(this);
+ IoUtils.safeClose(channel);
throw e;
}
}
@@ -202,12 +191,7 @@
channel.shutdownReads();
}
- void readDone() {
- synchronized (writeLock) {
- readDone = true;
- writeLock.notifyAll();
- }
+ ProviderDescriptor getProviderDescriptor() {
+ return providerDescriptor;
}
-
-
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -67,7 +67,7 @@
private final AtomicBoolean closed = new AtomicBoolean();
- public RemoteConnectionHandler(final ConnectionHandlerContext connectionContext, final RemoteConnection remoteConnection, final MarshallerFactory marshallerFactory) {
+ RemoteConnectionHandler(final ConnectionHandlerContext connectionContext, final RemoteConnection remoteConnection, final MarshallerFactory marshallerFactory) {
super(connectionContext.getConnectionProviderContext().getExecutor());
this.connectionContext = connectionContext;
this.remoteConnection = remoteConnection;
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -26,6 +26,7 @@
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.UnknownHostException;
+import org.jboss.marshalling.ProviderDescriptor;
import org.jboss.remoting3.RemotingOptions;
import org.jboss.remoting3.security.ServerAuthenticationProvider;
import org.jboss.remoting3.spi.ConnectionHandlerFactory;
@@ -52,10 +53,16 @@
private final ConnectionProviderContext connectionProviderContext;
private final Connector<InetSocketAddress, ? extends ConnectedStreamChannel<InetSocketAddress>> connector;
private final ProviderInterface providerInterface = new ProviderInterface();
+ private final ProviderDescriptor providerDescriptor;
RemoteConnectionProvider(final ConnectionProviderContext connectionProviderContext, final Connector<InetSocketAddress, ? extends ConnectedStreamChannel<InetSocketAddress>> connector) {
this.connectionProviderContext = connectionProviderContext;
this.connector = connector;
+ final ProviderDescriptor providerDescriptor = connectionProviderContext.getProtocolServiceProvider(ProtocolServiceType.MARSHALLER_PROVIDER_DESCRIPTOR, "river");
+ if (providerDescriptor == null) {
+ throw new IllegalArgumentException("River marshalling protocol is not installed");
+ }
+ this.providerDescriptor = providerDescriptor;
}
public Cancellable connect(final URI uri, final OptionMap connectOptions, final Result<ConnectionHandlerFactory> result, final CallbackHandler callbackHandler) throws IllegalArgumentException {
@@ -71,7 +78,7 @@
// Open a client channel
final IoFuture<? extends ConnectedStreamChannel<InetSocketAddress>> futureChannel;
try {
- futureChannel = connector.connectTo(new InetSocketAddress(InetAddress.getByName(host), port), new ClientOpenListener(connectOptions, connectionProviderContext, result, callbackHandler), null);
+ futureChannel = connector.connectTo(new InetSocketAddress(InetAddress.getByName(host), port), new ClientOpenListener(connectOptions, connectionProviderContext, result, callbackHandler, providerDescriptor), null);
} catch (UnknownHostException e) {
result.setException(e);
return IoUtils.nullCancellable();
@@ -90,7 +97,7 @@
if (authenticationProvider == null) {
throw new IllegalArgumentException("Missing authentication provider: " + (providerName == null ? "default" : providerName));
}
- return new ServerOpenListener(optionMap, connectionProviderContext);
+ return new ServerOpenListener(optionMap, connectionProviderContext, providerDescriptor);
}
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -67,6 +67,7 @@
static final byte GREETING_VERSION = 0; // sent by client & server
static final byte GREETING_SASL_MECH = 1; // sent by server
static final byte GREETING_ENDPOINT_NAME = 2; // sent by client & server
+ static final byte GREETING_MARSHALLER_VERSION = 3; // sent by client & server
/**
* Create an instance of the connection provider for the "remote" protocol.
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -25,8 +25,6 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import org.jboss.marshalling.MarshallerFactory;
-import org.jboss.marshalling.Marshalling;
-import org.jboss.marshalling.MarshallingConfiguration;
import org.jboss.remoting3.CloseHandler;
import org.jboss.remoting3.spi.ConnectionHandler;
import org.jboss.remoting3.spi.ConnectionHandlerContext;
@@ -70,7 +68,7 @@
remoteConnection.sendAuthMessage(RemoteProtocol.AUTH_COMPLETE, challenge);
connectionProviderContext.accept(new ConnectionHandlerFactory() {
public ConnectionHandler createInstance(final ConnectionHandlerContext connectionContext) {
- final MarshallerFactory marshallerFactory = Marshalling.getMarshallerFactory("river");
+ final MarshallerFactory marshallerFactory = remoteConnection.getProviderDescriptor().getMarshallerFactory();
final RemoteConnectionHandler connectionHandler = new RemoteConnectionHandler(connectionContext, remoteConnection, marshallerFactory);
remoteConnection.addCloseHandler(new CloseHandler<Object>() {
public void handleClose(final Object closed) {
@@ -97,12 +95,4 @@
}
}
}
-
- public void handleEof() {
- IoUtils.safeClose(remoteConnection);
- }
-
- public void handleException(final IOException e) {
- IoUtils.safeClose(remoteConnection);
- }
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -22,7 +22,6 @@
package org.jboss.remoting3.remote;
-import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Map;
import java.util.Set;
@@ -50,19 +49,35 @@
public void handleMessage(final ByteBuffer buffer) {
switch (buffer.get()) {
case RemoteProtocol.GREETING: {
+ RemoteConnectionHandler.log.trace("Server received greeting message");
+ final int[] ourVersions = connection.getProviderDescriptor().getSupportedVersions();
+ int bestVersion = -1;
while (buffer.hasRemaining()) {
final byte type = buffer.get();
final int len = buffer.get() & 0xff;
+ final ByteBuffer data = Buffers.slice(buffer, len);
switch (type) {
case RemoteProtocol.GREETING_VERSION: {
// We only support version zero, so knowing the other side's version is not useful presently
- buffer.get();
- if (len > 1) Buffers.skip(buffer, len - 1);
break;
}
+ case RemoteProtocol.GREETING_MARSHALLER_VERSION: {
+ final int remoteVersion = data.getInt();
+ // is it better than the best one? if not, don't bother
+ if (remoteVersion <= bestVersion) {
+ break;
+ }
+ // do we support it? if not, skip
+ for (int ourVersion : ourVersions) {
+ if (ourVersion == remoteVersion) {
+ bestVersion = remoteVersion;
+ break;
+ }
+ }
+ break;
+ }
default: {
// unknown, skip it for forward compatibility.
- Buffers.skip(buffer, len);
break;
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -30,6 +30,7 @@
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
+import org.jboss.marshalling.ProviderDescriptor;
import org.jboss.remoting3.RemotingOptions;
import org.jboss.remoting3.security.ServerAuthenticationProvider;
import org.jboss.remoting3.spi.ConnectionProviderContext;
@@ -48,10 +49,12 @@
private final OptionMap optionMap;
private final ConnectionProviderContext connectionProviderContext;
+ private final ProviderDescriptor providerDescriptor;
- ServerOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext) {
+ ServerOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext, final ProviderDescriptor providerDescriptor) {
this.optionMap = optionMap;
this.connectionProviderContext = connectionProviderContext;
+ this.providerDescriptor = providerDescriptor;
}
public void handleEvent(final ConnectedStreamChannel<InetSocketAddress> channel) {
@@ -60,7 +63,7 @@
} catch (IOException e) {
// ignore
}
- final RemoteConnection connection = new RemoteConnection(connectionProviderContext.getExecutor(), channel, optionMap);
+ final RemoteConnection connection = new RemoteConnection(connectionProviderContext.getExecutor(), channel, optionMap, providerDescriptor);
// Calculate available server mechanisms
final Sequence<String> mechs = optionMap.get(Options.SASL_MECHANISMS);
@@ -81,8 +84,14 @@
final ByteBuffer buffer = connection.allocate();
// length placeholder
buffer.putInt(0);
+ buffer.put(RemoteProtocol.GREETING);
// version ID
GreetingUtils.writeByte(buffer, RemoteProtocol.GREETING_VERSION, RemoteProtocol.VERSION);
+ // marshaller versions
+ final int[] versions = providerDescriptor.getSupportedVersions();
+ for (int version : versions) {
+ GreetingUtils.writeInt(buffer, RemoteProtocol.GREETING_MARSHALLER_VERSION, version);
+ }
// SASL server mechs
for (String name : serverMechanisms) {
GreetingUtils.writeString(buffer, RemoteProtocol.GREETING_SASL_MECH, name);
@@ -110,6 +119,7 @@
return;
}
}
+ RemoteConnectionHandler.log.warn("Server sent greeting message");
connection.free(buffer);
channel.resumeReads();
return;
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -50,7 +50,6 @@
private final StackTraceElement[] backtrace;
private final Object closeLock = new Object();
- private Thread closingThread;
private State state = State.OPEN;
private Map<Key, CloseHandler<? super T>> closeHandlers = null;
@@ -115,7 +114,6 @@
switch (state) {
case OPEN: {
state = State.CLOSING;
- closingThread = Thread.currentThread();
closeHandlers = this.closeHandlers;
this.closeHandlers = null;
break;
@@ -138,7 +136,6 @@
} finally {
synchronized (closeLock) {
state = State.CLOSED;
- closingThread = null;
closeLock.notifyAll();
}
}
@@ -244,13 +241,13 @@
try {
super.finalize();
} finally {
- if (! isOpen()) {
+ if (isOpen()) {
if (LEAK_DEBUGGING) {
final Throwable t = new LeakThrowable();
t.setStackTrace(backtrace);
log.warn(t, "Leaked a %s instance: %s", getClass().getName(), this);
} else {
- log.warn("Leaked a %s instance: %s", getClass().getName(), this);
+ log.trace("Leaked a %s instance: %s", getClass().getName(), this);
}
IoUtils.safeClose(this);
}
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -27,6 +27,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.jboss.remoting3.Client;
+import org.jboss.remoting3.CloseHandler;
import org.jboss.remoting3.Endpoint;
import org.jboss.remoting3.RemoteExecutionException;
import org.jboss.remoting3.Remoting;
@@ -88,11 +89,12 @@
throw new RemoteExecutionException(e);
}
}
-
- public void handleClose() {
+ }, Object.class, Object.class);
+ localClient.addCloseHandler(new CloseHandler<Client<Object, Object>>() {
+ public void handleClose(final Client<Object, Object> closed) {
log.info("Listener closed");
}
- }, Object.class, Object.class);
+ });
try {
assertEquals(replyObj, localClient.invoke(requestObj));
} finally {
@@ -121,11 +123,12 @@
throw new RemoteExecutionException(e);
}
}
-
- public void handleClose() {
+ }, Object.class, Object.class);
+ localClient.addCloseHandler(new CloseHandler<Client<Object, Object>>() {
+ public void handleClose(final Client<Object, Object> closed) {
log.info("Listener closed");
}
- }, Object.class, Object.class);
+ });
try {
assertEquals(replyObj, localClient.send(requestObj).get());
} finally {
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -23,10 +23,12 @@
package org.jboss.remoting3.test;
import java.io.IOException;
+import org.jboss.marshalling.river.RiverMarshaller;
import org.jboss.remoting3.Client;
import org.jboss.remoting3.ClientConnector;
import org.jboss.remoting3.ClientContext;
import org.jboss.remoting3.ClientListener;
+import org.jboss.remoting3.CloseHandler;
import org.jboss.remoting3.Connection;
import org.jboss.remoting3.Endpoint;
import org.jboss.remoting3.Registration;
@@ -56,6 +58,7 @@
public void setUp() throws IOException {
enter();
try {
+ Thread.currentThread().setContextClassLoader(RiverMarshaller.class.getClassLoader());
endpoint = Remoting.getConfiguredEndpoint();
} finally {
exit();
@@ -83,6 +86,11 @@
final Registration registration = endpoint.serviceBuilder().setGroupName("foo").setServiceType("test1").setRequestType(InvocationTestObject.class).
setReplyType(InvocationTestObject.class).setClientListener(new ClientListener<InvocationTestObject, InvocationTestObject>() {
public RequestListener<InvocationTestObject, InvocationTestObject> handleClientOpen(final ClientContext clientContext) {
+ clientContext.addCloseHandler(new CloseHandler<ClientContext>() {
+ public void handleClose(final ClientContext closed) {
+ log.info("Client closed");
+ }
+ });
return new RequestListener<InvocationTestObject, InvocationTestObject>() {
public void handleRequest(final RequestContext<InvocationTestObject> objectRequestContext, final InvocationTestObject request) throws RemoteExecutionException {
try {
@@ -92,10 +100,6 @@
throw new RemoteExecutionException(e);
}
}
-
- public void handleClose() {
- log.info("Listener closed");
- }
};
}
}).register();
@@ -130,6 +134,11 @@
final Registration registration = endpoint.serviceBuilder().setGroupName("foo").setServiceType("test2").setRequestType(InvocationTestObject.class).
setReplyType(InvocationTestObject.class).setClientListener(new ClientListener<InvocationTestObject, InvocationTestObject>() {
public RequestListener<InvocationTestObject, InvocationTestObject> handleClientOpen(final ClientContext clientContext) {
+ clientContext.addCloseHandler(new CloseHandler<ClientContext>() {
+ public void handleClose(final ClientContext closed) {
+ log.info("Listener closed");
+ }
+ });
return new RequestListener<InvocationTestObject, InvocationTestObject>() {
public void handleRequest(final RequestContext<InvocationTestObject> objectRequestContext, final InvocationTestObject request) throws RemoteExecutionException {
try {
@@ -140,10 +149,6 @@
throw new RemoteExecutionException(e);
}
}
-
- public void handleClose() {
- log.info("Listener closed");
- }
};
}
}).register();
@@ -179,6 +184,11 @@
final Registration registration = endpoint.serviceBuilder().setGroupName("foo").setServiceType("test3").setRequestType(ClientConnector.class).
setReplyType(InvocationTestObject.class).setClientListener(new ClientListener<ClientConnector, InvocationTestObject>() {
public RequestListener<ClientConnector, InvocationTestObject> handleClientOpen(final ClientContext clientContext) {
+ clientContext.addCloseHandler(new CloseHandler<ClientContext>() {
+ public void handleClose(final ClientContext closed) {
+ log.info("Listener closed");
+ }
+ });
return new RequestListener<ClientConnector, InvocationTestObject>() {
public void handleRequest(final RequestContext<InvocationTestObject> objectRequestContext, final ClientConnector request) throws RemoteExecutionException {
try {
@@ -189,10 +199,6 @@
throw new RemoteExecutionException(e);
}
}
-
- public void handleClose() {
- log.info("Listener closed");
- }
};
}
}).register();
@@ -201,7 +207,7 @@
try {
final Client<ClientConnector, InvocationTestObject> client = connection.openClient("test3", "*", ClientConnector.class, InvocationTestObject.class).get();
try {
- client.invoke(connection.createClientConnector(new RequestListener<InvocationTestObject, InvocationTestObject>() {
+ final ClientConnector<InvocationTestObject, InvocationTestObject> clientConnector = connection.createClientConnector(new RequestListener<InvocationTestObject, InvocationTestObject>() {
public void handleRequest(final RequestContext<InvocationTestObject> requestContext, final InvocationTestObject request) throws RemoteExecutionException {
try {
log.info("Got request %s, sending reply %s", request, replyObj);
@@ -210,11 +216,19 @@
throw new RemoteExecutionException(e);
}
}
-
- public void handleClose() {
+ }, InvocationTestObject.class, InvocationTestObject.class);
+ final ClientContext context = clientConnector.getClientContext();
+ context.addCloseHandler(new CloseHandler<ClientContext>() {
+ public void handleClose(final ClientContext closed) {
log.info("Inner listener closed");
}
- }, InvocationTestObject.class, InvocationTestObject.class));
+ });
+ try {
+ client.invoke(clientConnector);
+ } finally {
+ IoUtils.safeClose(context);
+ context.awaitClosedUninterruptibly();
+ }
} finally {
IoUtils.safeClose(client);
client.awaitClosedUninterruptibly();
Modified: remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/StringRot13RequestListener.java
===================================================================
--- remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/StringRot13RequestListener.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/StringRot13RequestListener.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -28,9 +28,6 @@
}
}
- public void handleClose() {
- }
-
private char rot13(final char i) {
if (i >= 'A' && i <= 'M' || i >= 'a' && i <= 'm') {
return (char) (i + 13);
Modified: remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java
===================================================================
--- remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java 2010-03-03 02:53:41 UTC (rev 5791)
+++ remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java 2010-03-03 16:54:23 UTC (rev 5792)
@@ -354,9 +354,6 @@
public static class DrNickRequestListener implements RequestListener<String, String> {
- public void handleClose() {
- }
-
public void handleRequest(RequestContext<String> context, String request) throws RemoteExecutionException {
try {
log.info(this + ": got request: " + request);
@@ -376,9 +373,6 @@
public static class DrFrankensteinRequestListener implements RequestListener<String, String> {
- public void handleClose() {
- }
-
public void handleRequest(RequestContext<String> context, String request) throws RemoteExecutionException {
try {
log.info(this + ": got request: " + request);
@@ -437,9 +431,6 @@
this.endpoint = endpoint;
}
- public void handleClose() {
- }
-
public void handleRequest(RequestContext<RequestWrapper> context, RequestWrapper request) throws RemoteExecutionException {
log.info(this + ": got request: " + request);
Connection connection = null;
@@ -482,16 +473,16 @@
private Client<Object, Object> client;
private int counter;
- public void handleClose() {
- if (client != null) {
- try {
- client.close();
- client = null;
- } catch (IOException e) {
- log.warn(this + " unable to close Client " + client);
- }
- }
- }
+// public void handleClose() {
+// if (client != null) {
+// try {
+// client.close();
+// client = null;
+// } catch (IOException e) {
+// log.warn(this + " unable to close Client " + client);
+// }
+// }
+// }
@SuppressWarnings("unchecked")
@Override
@@ -561,9 +552,6 @@
private static Logger log = Logger.getLogger(CallbackReceiverRequestListener.class);
private ArrayList<Object> callbacks = new ArrayList<Object>();
- public void handleClose() {
- }
-
public void handleRequest(RequestContext<Object> context, Object callback) throws RemoteExecutionException {
log.info(this + ": got callback: " + callback);
callbacks.add(callback);
14 years, 8 months
JBoss Remoting SVN: r5791 - remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 21:53:41 -0500 (Tue, 02 Mar 2010)
New Revision: 5791
Added:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java
Log:
Prep testing of SSL separately
Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java 2010-03-03 02:53:41 UTC (rev 5791)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.test;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import org.jboss.remoting3.CloseHandler;
+import org.jboss.remoting3.Connection;
+import org.jboss.remoting3.RemotingOptions;
+import org.jboss.remoting3.security.SimpleServerAuthenticationProvider;
+import org.jboss.remoting3.spi.NetworkServerProvider;
+import org.jboss.remoting3.spi.ProtocolServiceType;
+import org.jboss.xnio.AcceptingServer;
+import org.jboss.xnio.ChannelListener;
+import org.jboss.xnio.IoFuture;
+import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.OptionMap;
+import org.jboss.xnio.Options;
+import org.jboss.xnio.Xnio;
+import org.jboss.xnio.channels.BoundChannel;
+import org.jboss.xnio.channels.ConnectedStreamChannel;
+import org.testng.annotations.BeforeTest;
+
+import static org.testng.Assert.assertNotNull;
+
+public abstract class AbstractRemoteTestCase extends InvocationTestBase {
+
+ @BeforeTest
+ public void setUp() throws IOException {
+ enter();
+ try {
+ super.setUp();
+ final SimpleServerAuthenticationProvider authenticationProvider = new SimpleServerAuthenticationProvider();
+ authenticationProvider.addUser("user", "endpoint", "password".toCharArray());
+ endpoint.addProtocolService(ProtocolServiceType.SERVER_AUTHENTICATION_PROVIDER, "test", authenticationProvider);
+ } finally {
+ exit();
+ }
+ }
+
+ protected Connection getConnection() throws IOException {
+ final NetworkServerProvider provider = endpoint.getConnectionProviderInterface(getScheme(), NetworkServerProvider.class);
+ assertNotNull(provider, "No remote provider interface");
+ final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener = provider.getServerListener(OptionMap.builder().set(RemotingOptions.AUTHENTICATION_PROVIDER, "test").setSequence(Options.SASL_MECHANISMS, "DIGEST-MD5").getMap());
+ final Xnio xnio = Xnio.getInstance();
+ try {
+ final AcceptingServer<InetSocketAddress, ?, ?> server = getServer(listener, xnio);
+ final IoFuture<? extends BoundChannel<InetSocketAddress>> future = server.bind(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0));
+ final InetSocketAddress localAddress = future.get().getLocalAddress();
+ final Connection connection = endpoint.connect(new URI(getScheme(), null, localAddress.getAddress().getHostAddress(), localAddress.getPort(), null, null, null), OptionMap.builder().setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA").getMap(), "user", null, "password".toCharArray()).get();
+ connection.addCloseHandler(new CloseHandler<Connection>() {
+ public void handleClose(final Connection closed) {
+ IoUtils.safeClose(server);
+ }
+ });
+ return connection;
+ } catch (Exception e) {
+ final IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+
+ protected abstract String getScheme();
+
+ protected abstract AcceptingServer<InetSocketAddress, ?, ?> getServer(ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener, Xnio xnio) throws NoSuchProviderException, NoSuchAlgorithmException;
+}
Copied: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java (from rev 5790, remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java)
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteSslTestCase.java 2010-03-03 02:53:41 UTC (rev 5791)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.test;
+
+import java.net.InetSocketAddress;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import org.jboss.xnio.ChannelListener;
+import org.jboss.xnio.OptionMap;
+import org.jboss.xnio.Options;
+import org.jboss.xnio.SslTcpServer;
+import org.jboss.xnio.Xnio;
+import org.jboss.xnio.channels.ConnectedStreamChannel;
+import org.testng.SkipException;
+import org.testng.annotations.Test;
+
+@Test(suiteName = "Remote SSL tests")
+public final class RemoteSslTestCase extends AbstractRemoteTestCase {
+ protected SslTcpServer getServer(final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener, final Xnio xnio) throws NoSuchProviderException, NoSuchAlgorithmException {
+ return xnio.createSslTcpServer(listener, OptionMap.builder().setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA").getMap());
+ }
+
+ protected String getScheme() {
+ if (true) throw new SkipException("SSL");
+ return "remote+ssl";
+ }
+}
\ No newline at end of file
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java 2010-03-03 02:33:26 UTC (rev 5790)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java 2010-03-03 02:53:41 UTC (rev 5791)
@@ -22,67 +22,21 @@
package org.jboss.remoting3.test;
-import java.io.IOException;
-import java.net.InetAddress;
import java.net.InetSocketAddress;
-import java.net.URI;
-import org.jboss.remoting3.CloseHandler;
-import org.jboss.remoting3.Connection;
-import org.jboss.remoting3.RemotingOptions;
-import org.jboss.remoting3.security.SimpleServerAuthenticationProvider;
-import org.jboss.remoting3.spi.NetworkServerProvider;
-import org.jboss.remoting3.spi.ProtocolServiceType;
-import org.jboss.xnio.AcceptingServer;
import org.jboss.xnio.ChannelListener;
-import org.jboss.xnio.IoFuture;
-import org.jboss.xnio.IoUtils;
import org.jboss.xnio.OptionMap;
-import org.jboss.xnio.Options;
+import org.jboss.xnio.TcpServer;
import org.jboss.xnio.Xnio;
-import org.jboss.xnio.channels.BoundChannel;
import org.jboss.xnio.channels.ConnectedStreamChannel;
-import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-import static org.testng.Assert.assertNotNull;
-
@Test(suiteName = "Remote tests")
-public final class RemoteTestCase extends InvocationTestBase {
-
- @BeforeTest
- public void setUp() throws IOException {
- enter();
- try {
- super.setUp();
- final SimpleServerAuthenticationProvider authenticationProvider = new SimpleServerAuthenticationProvider();
- authenticationProvider.addUser("user", "endpoint", "password".toCharArray());
- endpoint.addProtocolService(ProtocolServiceType.SERVER_AUTHENTICATION_PROVIDER, "test", authenticationProvider);
- } finally {
- exit();
- }
+public final class RemoteTestCase extends AbstractRemoteTestCase {
+ protected TcpServer getServer(final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener, final Xnio xnio) {
+ return xnio.createTcpServer(listener, OptionMap.EMPTY);
}
- protected Connection getConnection() throws IOException {
- final NetworkServerProvider provider = endpoint.getConnectionProviderInterface("remote", NetworkServerProvider.class);
- assertNotNull(provider, "No remote provider interface");
- final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener = provider.getServerListener(OptionMap.builder().set(RemotingOptions.AUTHENTICATION_PROVIDER, "test").setSequence(Options.SASL_MECHANISMS, "DIGEST-MD5").getMap());
- final Xnio xnio = Xnio.getInstance();
- try {
-// final AcceptingServer<InetSocketAddress, ?, ?> server = xnio.createSslTcpServer(listener, OptionMap.builder().setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA").getMap());
- final AcceptingServer<InetSocketAddress, ?, ?> server = xnio.createTcpServer(listener, OptionMap.EMPTY);
- final IoFuture<? extends BoundChannel<InetSocketAddress>> future = server.bind(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0));
- final InetSocketAddress localAddress = future.get().getLocalAddress();
- final Connection connection = endpoint.connect(new URI("remote", null, localAddress.getAddress().getHostAddress(), localAddress.getPort(), null, null, null), OptionMap.builder().setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA").getMap(), "user", null, "password".toCharArray()).get();
- connection.addCloseHandler(new CloseHandler<Connection>() {
- public void handleClose(final Connection closed) {
- IoUtils.safeClose(server);
- }
- });
- return connection;
- } catch (Exception e) {
- final IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
+ protected String getScheme() {
+ return "remote";
}
-}
\ No newline at end of file
+}
14 years, 8 months
JBoss Remoting SVN: r5790 - in remoting3/trunk/jboss-remoting/src: main/java/org/jboss/remoting3/remote and 4 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 21:33:26 -0500 (Tue, 02 Mar 2010)
New Revision: 5790
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java
Removed:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderRegistration.java
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/remote/RemoteConnectionProvider.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java
remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.jboss.remoting3.spi.RemotingServiceDescriptor
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java
remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties
Log:
JBREM-1198: Separate remote from remote+ssl descriptors. Also remove some redundant code and do some other minor cleanup
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 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java 2010-03-03 02:33:26 UTC (rev 5790)
@@ -27,7 +27,6 @@
import java.util.Set;
import org.jboss.remoting3.spi.ConnectionProviderFactory;
import org.jboss.remoting3.spi.RequestHandler;
-import org.jboss.remoting3.spi.ConnectionProviderRegistration;
import org.jboss.remoting3.spi.ProtocolServiceType;
import org.jboss.xnio.IoFuture;
import org.jboss.xnio.OptionMap;
@@ -121,6 +120,14 @@
ServiceBuilder<I, O> setClientListener(ClientListener<? super I, ? extends O> clientListener);
/**
+ * Set the service class loader. This class loader will be used to unmarshall incoming requests.
+ *
+ * @param classLoader the service class loader
+ * @return this builder
+ */
+ ServiceBuilder<I, O> setClassLoader(final ClassLoader classLoader);
+
+ /**
* Set the option map for the service. The options may include, but are not limited to:
* <ul>
* <li>{@link RemotingOptions#BUFFER_SIZE} - the recommended buffer size for marshallers to use for this service</li>
@@ -208,6 +215,18 @@
* You must have the {@link org.jboss.remoting3.security.RemotingPermission connect EndpointPermission} to invoke this method.
*
* @param destination the destination
+ * @return the future connection
+ * @throws IOException if an error occurs while starting the connect attempt
+ */
+ IoFuture<? extends Connection> connect(URI destination) throws IOException;
+
+ /**
+ * Open a connection with a peer. Returns a future connection which may be used to cancel the connection attempt.
+ * 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.security.RemotingPermission connect EndpointPermission} to invoke this method.
+ *
+ * @param destination the destination
* @param connectOptions options to configure this connection
* @return the future connection
* @throws IOException if an error occurs while starting the connect attempt
@@ -257,7 +276,7 @@
* @return a handle which may be used to remove the registration
* @throws DuplicateRegistrationException if there is already a provider registered to that URI scheme
*/
- ConnectionProviderRegistration addConnectionProvider(String uriScheme, ConnectionProviderFactory providerFactory) throws DuplicateRegistrationException;
+ Registration addConnectionProvider(String uriScheme, ConnectionProviderFactory providerFactory) throws DuplicateRegistrationException;
/**
* Get the interface for a connection provider.
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 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2010-03-03 02:33:26 UTC (rev 5790)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.net.URI;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -38,6 +39,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.jboss.marshalling.Pair;
import org.jboss.remoting3.security.RemotingPermission;
import org.jboss.remoting3.security.SimpleClientCallbackHandler;
import org.jboss.remoting3.spi.AbstractHandleableCloseable;
@@ -46,7 +48,6 @@
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.remoting3.spi.ConnectionProviderFactory;
import org.jboss.remoting3.spi.RequestHandler;
-import org.jboss.remoting3.spi.ConnectionProviderRegistration;
import org.jboss.remoting3.spi.ConnectionHandlerContext;
import org.jboss.remoting3.spi.ProtocolServiceType;
import org.jboss.xnio.log.Logger;
@@ -142,7 +143,7 @@
private static final RemotingPermission ADD_SERVICE_LISTENER_PERM = new RemotingPermission("addServiceListener");
private static final RemotingPermission CONNECT_PERM = new RemotingPermission("connect");
private static final RemotingPermission ADD_CONNECTION_PROVIDER_PERM = new RemotingPermission("addConnectionProvider");
- private static final RemotingPermission ADD_MARSHALLING_PROTOCOL_PERM = new RemotingPermission("addMarshallingProtocol");
+ private static final RemotingPermission ADD_PROTOCOL_SERVICE_PERM = new RemotingPermission("addProtocolService");
private static final RemotingPermission GET_CONNECTION_PROVIDER_INTERFACE_PERM = new RemotingPermission("getConnectionProviderInterface");
EndpointImpl(final Executor executor, final String name, final OptionMap optionMap) throws IOException {
@@ -533,17 +534,28 @@
return registration;
}
+ public IoFuture<? extends Connection> connect(final URI destination) throws IOException {
+ final Pair<String, String> userRealm = getUserAndRealm(destination);
+ final String uriUserName = userRealm.getA();
+ final String uriUserRealm = userRealm.getB();
+ final OptionMap finalMap;
+ final OptionMap.Builder builder = OptionMap.builder();
+ if (uriUserName != null) builder.set(RemotingOptions.AUTH_USER_NAME, uriUserName);
+ if (uriUserRealm != null) builder.set(RemotingOptions.AUTH_REALM, uriUserRealm);
+ finalMap = builder.getMap();
+ return doConnect(destination, finalMap, new SimpleClientCallbackHandler(finalMap.get(RemotingOptions.AUTH_USER_NAME), finalMap.get(RemotingOptions.AUTH_REALM), null));
+ }
+
public IoFuture<? extends Connection> connect(final URI destination, final OptionMap connectOptions) throws IOException {
- final String uriUserInfo = destination.getUserInfo();
+ final Pair<String, String> userRealm = getUserAndRealm(destination);
+ final String uriUserName = userRealm.getA();
+ final String uriUserRealm = userRealm.getB();
final OptionMap finalMap;
- if (uriUserInfo != null) {
- final OptionMap.Builder builder = OptionMap.builder().addAll(connectOptions);
- builder.set(RemotingOptions.AUTH_USER_NAME, uriUserInfo);
- finalMap = builder.getMap();
- } else {
- finalMap = connectOptions;
- }
- return doConnect(destination, connectOptions, new SimpleClientCallbackHandler(finalMap.get(RemotingOptions.AUTH_USER_NAME), finalMap.get(RemotingOptions.AUTH_REALM), null));
+ final OptionMap.Builder builder = OptionMap.builder().addAll(connectOptions);
+ if (uriUserName != null) builder.set(RemotingOptions.AUTH_USER_NAME, uriUserName);
+ if (uriUserRealm != null) builder.set(RemotingOptions.AUTH_REALM, uriUserRealm);
+ finalMap = builder.getMap();
+ return doConnect(destination, finalMap, new SimpleClientCallbackHandler(finalMap.get(RemotingOptions.AUTH_USER_NAME), finalMap.get(RemotingOptions.AUTH_REALM), null));
}
private IoFuture<? extends Connection> doConnect(final URI destination, final OptionMap connectOptions, final CallbackHandler callbackHandler) throws IOException {
@@ -566,22 +578,23 @@
}
public IoFuture<? extends Connection> connect(final URI destination, final OptionMap connectOptions, final CallbackHandler callbackHandler) throws IOException {
- final String uriUserInfo = destination.getUserInfo();
+ final Pair<String, String> userRealm = getUserAndRealm(destination);
+ final String uriUserName = userRealm.getA();
+ final String uriUserRealm = userRealm.getB();
final OptionMap finalMap;
- if (uriUserInfo != null) {
- final OptionMap.Builder builder = OptionMap.builder().addAll(connectOptions);
- builder.set(RemotingOptions.AUTH_USER_NAME, uriUserInfo);
- finalMap = builder.getMap();
- } else {
- finalMap = connectOptions;
- }
+ final OptionMap.Builder builder = OptionMap.builder().addAll(connectOptions);
+ if (uriUserName != null) builder.set(RemotingOptions.AUTH_USER_NAME, uriUserName);
+ if (uriUserRealm != null) builder.set(RemotingOptions.AUTH_REALM, uriUserRealm);
+ finalMap = builder.getMap();
return doConnect(destination, finalMap, callbackHandler);
}
public IoFuture<? extends Connection> connect(final URI destination, final OptionMap connectOptions, final String userName, final String realmName, final char[] password) throws IOException {
- final String uriUserInfo = destination.getUserInfo();
- final String actualUserName = userName != null ? userName : uriUserInfo != null ? uriUserInfo : connectOptions.get(RemotingOptions.AUTH_USER_NAME);
- final String actualUserRealm = realmName != null ? realmName : connectOptions.get(RemotingOptions.AUTH_REALM);
+ final Pair<String, String> userRealm = getUserAndRealm(destination);
+ final String uriUserName = userRealm.getA();
+ final String uriUserRealm = userRealm.getB();
+ final String actualUserName = userName != null ? userName : uriUserName != null ? uriUserName : connectOptions.get(RemotingOptions.AUTH_USER_NAME);
+ final String actualUserRealm = realmName != null ? realmName : uriUserRealm != null ? uriUserRealm : connectOptions.get(RemotingOptions.AUTH_REALM);
final OptionMap.Builder builder = OptionMap.builder().addAll(connectOptions);
if (actualUserName != null) builder.set(RemotingOptions.AUTH_USER_NAME, actualUserName);
if (actualUserRealm != null) builder.set(RemotingOptions.AUTH_REALM, actualUserRealm);
@@ -589,7 +602,7 @@
return doConnect(destination, finalMap, new SimpleClientCallbackHandler(actualUserName, actualUserRealm, password));
}
- public ConnectionProviderRegistration addConnectionProvider(final String uriScheme, final ConnectionProviderFactory providerFactory) {
+ public Registration addConnectionProvider(final String uriScheme, final ConnectionProviderFactory providerFactory) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ADD_CONNECTION_PROVIDER_PERM);
@@ -599,7 +612,7 @@
if (connectionProviders.putIfAbsent(uriScheme, provider) != null) {
throw new DuplicateRegistrationException("URI scheme '" + uriScheme + "' is already registered to a provider");
}
- final ConnectionProviderRegistration handle = new ConnectionProviderRegistrationImpl(uriScheme, provider);
+ final Registration handle = new MapRegistration<ConnectionProvider>(connectionProviders, uriScheme, provider);
return handle;
}
@@ -622,7 +635,7 @@
final ConcurrentMap<String, T> map = getMapFor(type);
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
- sm.checkPermission(ADD_MARSHALLING_PROTOCOL_PERM);
+ sm.checkPermission(ADD_PROTOCOL_SERVICE_PERM);
}
if ("default".equals(name)) {
throw new IllegalArgumentException("'default' is not an allowed name");
@@ -637,6 +650,41 @@
return "endpoint \"" + name + "\" <" + Integer.toHexString(hashCode()) + ">";
}
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ private static String uriDecode(String encoded) {
+ final char[] chars = encoded.toCharArray();
+ final int olen = chars.length;
+ final byte[] buf = new byte[olen];
+ int c = 0;
+ for (int i = 0; i < olen; i++) {
+ final char ch = chars[i];
+ if (ch == '%') {
+ buf[c++] = (byte) (Character.digit(chars[++i], 16) << 4 | Character.digit(chars[++i], 16));
+ } else if (ch < 32 || ch > 127) {
+ // skip it
+ } else {
+ buf[c++] = (byte) ch;
+ }
+ }
+ return new String(buf, 0, c, UTF_8);
+ }
+
+ private static final Pair<String, String> EMPTY = Pair.create(null, null);
+
+ private Pair<String, String> getUserAndRealm(URI uri) {
+ final String userInfo = uri.getRawUserInfo();
+ if (userInfo == null) {
+ return EMPTY;
+ }
+ int i = userInfo.indexOf(';');
+ if (i == -1) {
+ return Pair.create(uri.getUserInfo(), null);
+ } else {
+ return Pair.create(uriDecode(userInfo.substring(0, i)), uriDecode(userInfo.substring(i + 1)));
+ }
+ }
+
private class MapRegistration<T> extends AbstractHandleableCloseable<Registration> implements Registration {
private final ConcurrentMap<String, T> map;
@@ -727,33 +775,4 @@
return EndpointImpl.this;
}
}
-
- private class ConnectionProviderRegistrationImpl extends AbstractHandleableCloseable<Registration> implements ConnectionProviderRegistration {
-
- private final String uriScheme;
- private final ConnectionProvider provider;
-
- public ConnectionProviderRegistrationImpl(final String uriScheme, final ConnectionProvider provider) {
- super(executor);
- this.uriScheme = uriScheme;
- this.provider = provider;
- }
-
- protected void closeAction() {
- connectionProviders.remove(uriScheme, provider);
- }
-
- public void close() {
- try {
- super.close();
- } catch (IOException e) {
- // not possible
- throw new IllegalStateException(e);
- }
- }
-
- public Object getProviderInterface() {
- return provider.getProviderInterface();
- }
- }
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java 2010-03-03 02:33:26 UTC (rev 5790)
@@ -51,6 +51,7 @@
private final ConnectionProviderContext connectionProviderContext;
private final Connector<InetSocketAddress, ? extends ConnectedStreamChannel<InetSocketAddress>> connector;
+ private final ProviderInterface providerInterface = new ProviderInterface();
RemoteConnectionProvider(final ConnectionProviderContext connectionProviderContext, final Connector<InetSocketAddress, ? extends ConnectedStreamChannel<InetSocketAddress>> connector) {
this.connectionProviderContext = connectionProviderContext;
@@ -79,7 +80,7 @@
}
public NetworkServerProvider getProviderInterface() {
- return new ProviderInterface();
+ return providerInterface;
}
private class ProviderInterface implements NetworkServerProvider {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java 2010-03-03 02:33:26 UTC (rev 5790)
@@ -50,21 +50,10 @@
public ConnectionProviderFactory getService(final Properties properties) throws IOException {
final String providerName = properties.getProperty("remote.xnio.provider", "default");
- final boolean useSsl = Boolean.parseBoolean(properties.getProperty("remote.ssl.enable", "true"));
final Xnio xnio = Xnio.getInstance(providerName);
final OptionMap connectorOptions = OptionMap.builder().parseAll(properties, "remote.connector.option").getMap();
final Connector<InetSocketAddress, ? extends TcpChannel> connector;
- if (useSsl) {
- try {
- connector = xnio.createSslTcpConnector(null, connectorOptions);
- } catch (Exception e) {
- final IOException ioe = new IOException("Failed to create connector");
- ioe.initCause(e);
- throw ioe;
- }
- } else {
- connector = xnio.createTcpConnector(connectorOptions);
- }
+ connector = xnio.createTcpConnector(connectorOptions);
return new ConnectionProviderFactory() {
public ConnectionProvider createInstance(final ConnectionProviderContext context) {
return RemoteProtocol.getRemoteConnectionProvider(context, connector);
Copied: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java (from rev 5781, remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocolDescriptor.java)
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteSslProtocolDescriptor.java 2010-03-03 02:33:26 UTC (rev 5790)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remote;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.Properties;
+import org.jboss.remoting3.spi.ConnectionProvider;
+import org.jboss.remoting3.spi.ConnectionProviderContext;
+import org.jboss.remoting3.spi.ConnectionProviderFactory;
+import org.jboss.remoting3.spi.RemotingServiceDescriptor;
+import org.jboss.xnio.Connector;
+import org.jboss.xnio.OptionMap;
+import org.jboss.xnio.Xnio;
+import org.jboss.xnio.channels.TcpChannel;
+
+/**
+ * The protocol descriptor for the "remote+ssl" connection protocol. This class is used to auto-detect the "remote+ssl" protocol
+ * in standalone environments.
+ */
+public final class RemoteSslProtocolDescriptor implements RemotingServiceDescriptor<ConnectionProviderFactory> {
+
+ public Class<ConnectionProviderFactory> getType() {
+ return ConnectionProviderFactory.class;
+ }
+
+ public String getName() {
+ return "remote+ssl";
+ }
+
+ public ConnectionProviderFactory getService(final Properties properties) throws IOException {
+ final String providerName = properties.getProperty("remote+ssl.xnio.provider", "default");
+ final Xnio xnio = Xnio.getInstance(providerName);
+ final OptionMap connectorOptions = OptionMap.builder().parseAll(properties, "remote+ssl.connector.option").getMap();
+ final Connector<InetSocketAddress, ? extends TcpChannel> connector;
+ try {
+ connector = xnio.createSslTcpConnector(null, connectorOptions);
+ } catch (Exception e) {
+ final IOException ioe = new IOException("Failed to create connector");
+ ioe.initCause(e);
+ throw ioe;
+ }
+ return new ConnectionProviderFactory() {
+ public ConnectionProvider createInstance(final ConnectionProviderContext context) {
+ return RemoteProtocol.getRemoteConnectionProvider(context, connector);
+ }
+ };
+ }
+}
\ No newline at end of file
Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderRegistration.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderRegistration.java 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderRegistration.java 2010-03-03 02:33:26 UTC (rev 5790)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, 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.spi;
-
-import org.jboss.remoting3.Registration;
-
-/**
- * A handle representing the registration of a connection provider.
- */
-public interface ConnectionProviderRegistration extends Registration {
-
- /**
- * Get the created provider interface associated with this registration.
- *
- * @return the connection provider interface
- */
- Object getProviderInterface();
-}
Modified: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.jboss.remoting3.spi.RemotingServiceDescriptor
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.jboss.remoting3.spi.RemotingServiceDescriptor 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.jboss.remoting3.spi.RemotingServiceDescriptor 2010-03-03 02:33:26 UTC (rev 5790)
@@ -1,4 +1,5 @@
#
-# Remoting "remote" protocol descriptor
+# Remoting "remote" protocol descriptors
#
org.jboss.remoting3.remote.RemoteProtocolDescriptor
+org.jboss.remoting3.remote.RemoteSslProtocolDescriptor
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/RemoteTestCase.java 2010-03-03 02:33:26 UTC (rev 5790)
@@ -44,6 +44,8 @@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import static org.testng.Assert.assertNotNull;
+
@Test(suiteName = "Remote tests")
public final class RemoteTestCase extends InvocationTestBase {
@@ -62,6 +64,7 @@
protected Connection getConnection() throws IOException {
final NetworkServerProvider provider = endpoint.getConnectionProviderInterface("remote", NetworkServerProvider.class);
+ assertNotNull(provider, "No remote provider interface");
final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener = provider.getServerListener(OptionMap.builder().set(RemotingOptions.AUTHENTICATION_PROVIDER, "test").setSequence(Options.SASL_MECHANISMS, "DIGEST-MD5").getMap());
final Xnio xnio = Xnio.getInstance();
try {
Modified: remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties 2010-03-03 02:25:20 UTC (rev 5789)
+++ remoting3/trunk/jboss-remoting/src/test/resources/remoting.properties 2010-03-03 02:33:26 UTC (rev 5790)
@@ -19,5 +19,3 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
#
-
-remote.ssl.enable=false
14 years, 8 months
JBoss Remoting SVN: r5789 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 21:25:20 -0500 (Tue, 02 Mar 2010)
New Revision: 5789
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java
Log:
Event listeners should implement EventListener
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientListener.java 2010-03-02 22:32:34 UTC (rev 5788)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientListener.java 2010-03-03 02:25:20 UTC (rev 5789)
@@ -22,6 +22,8 @@
package org.jboss.remoting3;
+import java.util.EventListener;
+
/**
* A client listener associated with a service. When a client is opened for this service, a new request listener
* is created and returned.
@@ -31,7 +33,7 @@
*
* @apiviz.landmark
*/
-public interface ClientListener<I, O> {
+public interface ClientListener<I, O> extends EventListener {
/**
* Handle a client open by returning a new request listener. The supplied client context may be used to register
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java 2010-03-02 22:32:34 UTC (rev 5788)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RequestListener.java 2010-03-03 02:25:20 UTC (rev 5789)
@@ -22,6 +22,8 @@
package org.jboss.remoting3;
+import java.util.EventListener;
+
/**
* A request listener. Implementations of this interface will reply to client requests.
*
@@ -31,7 +33,7 @@
* @remoting.implement
* @apiviz.landmark
*/
-public interface RequestListener<I, O> {
+public interface RequestListener<I, O> extends EventListener {
/**
* Handle a request. If this method throws {@code RemoteExecutionException}, then that exception is passed
* back to the caller and the request is marked as complete. Otherwise, the request
14 years, 8 months
JBoss Remoting SVN: r5788 - remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 17:32:34 -0500 (Tue, 02 Mar 2010)
New Revision: 5788
Modified:
remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java
Log:
Fix swapped method arguments
Modified: remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java
===================================================================
--- remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java 2010-03-02 21:49:26 UTC (rev 5787)
+++ remoting-mc-int/trunk/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java 2010-03-02 22:32:34 UTC (rev 5788)
@@ -112,7 +112,7 @@
for (ServiceMetaData service : services) {
final String type = service.getType();
final String groupName = defaulted(service.getGroupName(), "default");
- final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(ServiceManager.class.getName(), "Remoting:" + endpoint + ":SERVICE:" + type + ":" + groupName);
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Remoting:" + endpoint + ":SERVICE:" + type + ":" + groupName, ServiceManager.class.getName());
builder.ignoreCreate();
builder.ignoreDestroy();
builder.setStart("start");
@@ -130,7 +130,7 @@
}
for (LocalClientMetaData localClient : localClients) {
final String name = localClient.getName();
- final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Client.class.getName(), name);
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, Client.class.getName());
builder.ignoreCreate();
builder.ignoreDestroy();
builder.ignoreStart();
@@ -144,7 +144,7 @@
}
for (ServerMetaData server : servers) {
final String name = server.getName();
- final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(ChannelListener.class.getName(), name);
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ChannelListener.class.getName());
builder.ignoreCreate();
builder.ignoreDestroy();
builder.ignoreStart();
@@ -158,7 +158,7 @@
}
for (ConnectionMetaData connection : connections) {
final String name = connection.getName();
- final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Connection.class.getName(), name);
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, Connection.class.getName());
builder.ignoreCreate();
builder.ignoreDestroy();
builder.ignoreStart();
@@ -184,7 +184,7 @@
}
for (EndpointMetaData endpointMetaData : endpoints) {
final String name = endpointMetaData.getName();
- final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Endpoint.class.getName(), "Remoting:ENDPOINT:" + name);
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Remoting:ENDPOINT:" + name, Endpoint.class.getName());
if (endpointMetaData.isDefaultFlag()) {
builder.addAlias("Remoting:DEFAULT-ENDPOINT");
}
14 years, 8 months
JBoss Remoting SVN: r5787 - remoting-mc-int/trunk.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 16:49:26 -0500 (Tue, 02 Mar 2010)
New Revision: 5787
Removed:
remoting-mc-int/trunk/metadata/
Log:
Remove empty dir
14 years, 8 months
JBoss Remoting SVN: r5786 - in remoting-mc-int/trunk: metadata and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 16:47:27 -0500 (Tue, 02 Mar 2010)
New Revision: 5786
Added:
remoting-mc-int/trunk/pom.xml
remoting-mc-int/trunk/src/
Removed:
remoting-mc-int/trunk/metadata/pom.xml
remoting-mc-int/trunk/metadata/src/
Log:
Reorganize
Deleted: remoting-mc-int/trunk/metadata/pom.xml
===================================================================
--- remoting-mc-int/trunk/metadata/pom.xml 2010-03-02 21:46:23 UTC (rev 5785)
+++ remoting-mc-int/trunk/metadata/pom.xml 2010-03-02 21:47:27 UTC (rev 5786)
@@ -1,99 +0,0 @@
-<!--
- ~ JBoss, Home of Professional Open Source
- ~ Copyright 2010, 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <properties>
- <jbrem.version>3.1.0.Beta1</jbrem.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <groupId>org.jboss.remoting</groupId>
- <name>JBoss Remoting Metadata</name>
- <artifactId>jboss-remoting-metadata</artifactId>
- <packaging>jar</packaging>
- <version>3.1.0.Beta1-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.jboss.remoting</groupId>
- <artifactId>jboss-remoting</artifactId>
- <version>3.1.0.Beta1</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.xnio</groupId>
- <artifactId>xnio-metadata</artifactId>
- <version>2.1.0.CR1</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.xnio</groupId>
- <artifactId>xnio-api</artifactId>
- <version>2.1.0.CR1</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- <version>2.2.0.Alpha6</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <version>2.0.2.Beta3</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <distributionManagement>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Maven2 Repository</name>
- <url>http://repository.jboss.org/maven2</url>
- </repository>
- </distributionManagement>
-</project>
Copied: remoting-mc-int/trunk/pom.xml (from rev 5785, remoting-mc-int/trunk/metadata/pom.xml)
===================================================================
--- remoting-mc-int/trunk/pom.xml (rev 0)
+++ remoting-mc-int/trunk/pom.xml 2010-03-02 21:47:27 UTC (rev 5786)
@@ -0,0 +1,99 @@
+<!--
+ ~ JBoss, Home of Professional Open Source
+ ~ Copyright 2010, 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <properties>
+ <jbrem.version>3.1.0.Beta1</jbrem.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <groupId>org.jboss.remoting</groupId>
+ <name>JBoss Remoting Metadata</name>
+ <artifactId>jboss-remoting-metadata</artifactId>
+ <packaging>jar</packaging>
+ <version>3.1.0.Beta1-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>3.1.0.Beta1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.xnio</groupId>
+ <artifactId>xnio-metadata</artifactId>
+ <version>2.1.0.CR1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.xnio</groupId>
+ <artifactId>xnio-api</artifactId>
+ <version>2.1.0.CR1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>2.2.0.Alpha6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <version>2.0.2.Beta3</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Maven2 Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </distributionManagement>
+</project>
Copied: remoting-mc-int/trunk/src (from rev 5785, remoting-mc-int/trunk/metadata/src)
14 years, 8 months
JBoss Remoting SVN: r5785 - remoting-mc-int/trunk.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 16:46:23 -0500 (Tue, 02 Mar 2010)
New Revision: 5785
Removed:
remoting-mc-int/trunk/build.properties
remoting-mc-int/trunk/build.xml
Log:
No longer used
Deleted: remoting-mc-int/trunk/build.properties
===================================================================
--- remoting-mc-int/trunk/build.properties 2010-03-02 21:45:22 UTC (rev 5784)
+++ remoting-mc-int/trunk/build.properties 2010-03-02 21:46:23 UTC (rev 5785)
@@ -1,4 +0,0 @@
-javac.source=1.5
-javac.target=1.5
-
-lib.apiviz.doclet=net.gleamynode.apiviz.APIviz
Deleted: remoting-mc-int/trunk/build.xml
===================================================================
--- remoting-mc-int/trunk/build.xml 2010-03-02 21:45:22 UTC (rev 5784)
+++ remoting-mc-int/trunk/build.xml 2010-03-02 21:46:23 UTC (rev 5785)
@@ -1,126 +0,0 @@
-<project name="JBoss Remoting 3 Microcontainer Integration" xmlns:mvn="urn:maven-artifact-ant">
-
- <property file="build.properties.local"/>
- <property file="build.properties"/>
-
- <!-- ============================================== -->
- <!-- LIBRARIES - Keep in alpha order by target name -->
- <!-- ============================================== -->
-
- <property name="maven.ant.file" value="maven-ant-tasks.jar"/>
-
- <target name="jboss.repository" depends="maven-ant">
- <mvn:remoteRepository id="jboss.repository" url="http://repository.jboss.org/maven2"/>
- </target>
-
- <target name="maven-ant.check">
- <available property="maven-ant.exists" file="${maven.ant.file}"/>
- </target>
-
- <target name="maven-ant.fetch" depends="maven-ant.check" unless="maven-ant.exists">
- <get src="http://repository.jboss.org/maven2/org/apache/maven/maven-ant-tasks/2.0.9..." dest="${maven.ant.file}"/>
- </target>
-
- <target name="maven-ant" depends="maven-ant.fetch">
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
- <classpath>
- <pathelement location="${maven.ant.file}"/>
- </classpath>
- </typedef>
- </target>
-
- <!-- External library: JAXB API -->
-
- <target name="lib.jaxb-api" depends="jboss.repository">
- <mvn:dependencies pathId="lib.jaxb-api.classpath">
- <mvn:remoteRepository refid="jboss.repository"/>
- <mvn:dependency groupId="sun-jaxb" artifactId="jaxb-api" version="2.1.9"/>
- </mvn:dependencies>
- </target>
-
- <!-- External library: JBoss Microcontainer kernel -->
-
- <target name="lib.jbossmc-kernel" depends="jboss.repository">
- <mvn:dependencies pathId="lib.jbossmc-kernel.classpath">
- <mvn:remoteRepository refid="jboss.repository"/>
- <mvn:dependency groupId="org.jboss.microcontainer" artifactId="jboss-kernel" version="2.0.1.GA"/>
- </mvn:dependencies>
- </target>
-
- <!-- External library: JBossXB -->
-
- <target name="lib.jbossxb" depends="jboss.repository">
- <mvn:dependencies pathId="lib.jbossxb.classpath">
- <mvn:remoteRepository refid="jboss.repository"/>
- <mvn:dependency groupId="org.jboss" artifactId="jbossxb" version="2.0.0.GA"/>
- </mvn:dependencies>
- </target>
-
- <!-- External library: Remoting API -->
-
- <target name="lib.remoting-api" depends="jboss.repository">
- <mvn:dependencies pathId="lib.remoting-api.classpath">
- <mvn:remoteRepository refid="jboss.repository"/>
- <mvn:dependency groupId="org.jboss.remoting3" artifactId="remoting-api" version="3.0.0.GA"/>
- </mvn:dependencies>
- </target>
-
- <!-- External library: Remoting Core -->
-
- <target name="lib.remoting-core" depends="jboss.repository">
- <mvn:dependencies pathId="lib.remoting-core.classpath">
- <mvn:remoteRepository refid="jboss.repository"/>
- <mvn:dependency groupId="org.jboss.remoting3" artifactId="remoting-core" version="3.0.0.GA"/>
- </mvn:dependencies>
- </target>
-
- <!-- ============================================== -->
- <!-- MODULES - Keep in alpha order by target name -->
- <!-- ============================================== -->
-
- <!-- ======== metadata module ======== -->
-
- <!-- main -->
-
- <target name="metadata.main.compile.depcheck">
- <mkdir dir="metadata/target/main"/>
- <uptodate property="metadata.main.compile.uptodate" targetfile="metadata/target/main/.lastcompile">
- <srcfiles dir="metadata/src/main/java">
- <include name="**/"/>
- <include name="**/*.java"/>
- <exclude name="**/.*"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="metadata.main.compile" depends="lib.jaxb-api,lib.jbossmc-kernel,lib.jbossxb,lib.remoting-api,metadata.main.compile.depcheck" unless="metadata.main.compile.uptodate">
- <mkdir dir="metadata/target/main/classes"/>
- <javac
- source="${javac.source}"
- target="${javac.target}"
- srcdir="metadata/src/main/java"
- destdir="metadata/target/main/classes"
- debug="true">
- <compilerarg value="-Xlint:unchecked"/>
- <classpath>
- </classpath>
- </javac>
- <touch file="metadata/target/main/.lastcompile" verbose="false"/>
- </target>
-
- <target name="metadata.main" depends="metadata.main.compile">
- <path id="metadata.main.classpath">
- <pathelement location="metadata/target/main/classes"/>
- </path>
- </target>
-
- <!-- general -->
-
- <target name="metadata.clean">
- <delete dir="metadata/target"/>
- </target>
-
- <target name="metadata" description="Build the metadata module" depends="metadata.main"/>
-
-</project>
-
14 years, 8 months
JBoss Remoting SVN: r5784 - in remoting-mc-int/trunk/metadata: src/main/java/org/jboss/remoting3/metadata and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-02 16:45:22 -0500 (Tue, 02 Mar 2010)
New Revision: 5784
Added:
remoting-mc-int/trunk/metadata/pom.xml
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientAuthenticationMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ConnectionMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalClientMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RefMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServerMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceManager.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/UserEntryMetaData.java
Removed:
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientSourceMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalServiceMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocateServiceMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemoteServiceMetaData.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceListenerMetaData.java
Modified:
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java
remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java
remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-remoting_3_1.xsd
Log:
Remoting metadata for 3.1
Added: remoting-mc-int/trunk/metadata/pom.xml
===================================================================
--- remoting-mc-int/trunk/metadata/pom.xml (rev 0)
+++ remoting-mc-int/trunk/metadata/pom.xml 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,99 @@
+<!--
+ ~ JBoss, Home of Professional Open Source
+ ~ Copyright 2010, 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <properties>
+ <jbrem.version>3.1.0.Beta1</jbrem.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <groupId>org.jboss.remoting</groupId>
+ <name>JBoss Remoting Metadata</name>
+ <artifactId>jboss-remoting-metadata</artifactId>
+ <packaging>jar</packaging>
+ <version>3.1.0.Beta1-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>3.1.0.Beta1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.xnio</groupId>
+ <artifactId>xnio-metadata</artifactId>
+ <version>2.1.0.CR1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.xnio</groupId>
+ <artifactId>xnio-api</artifactId>
+ <version>2.1.0.CR1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>2.2.0.Alpha6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <version>2.0.2.Beta3</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Maven2 Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </distributionManagement>
+</project>
Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientAuthenticationMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientAuthenticationMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientAuthenticationMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "client-authentication")
+public final class ClientAuthenticationMetaData {
+ private UserEntryMetaData userEntry;
+ private RefMetaData callbackHandler;
+
+ public UserEntryMetaData getUserEntry() {
+ return userEntry;
+ }
+
+ public void setUserEntry(final UserEntryMetaData userEntry) {
+ this.userEntry = userEntry;
+ }
+
+ public RefMetaData getCallbackHandler() {
+ return callbackHandler;
+ }
+
+ public void setCallbackHandler(final RefMetaData callbackHandler) {
+ this.callbackHandler = callbackHandler;
+ }
+}
Deleted: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientMetaData.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.metadata;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- *
- */
-@XmlType(name = "client")
-public final class ClientMetaData {
- private String name;
- private String serviceBean;
- private String requestClassName;
- private String replyClassName;
-
- public String getName() {
- return name;
- }
-
- @XmlAttribute(required = true)
- public void setName(final String name) {
- this.name = name;
- }
-
- public String getServiceBean() {
- return serviceBean;
- }
-
- @XmlAttribute(name = "service-bean", required = true)
- public void setServiceBean(final String serviceBean) {
- this.serviceBean = serviceBean;
- }
-
- public String getRequestClassName() {
- return requestClassName;
- }
-
- @XmlAttribute(name = "request-class-name")
- public void setRequestClassName(final String requestClassName) {
- this.requestClassName = requestClassName;
- }
-
- public String getReplyClassName() {
- return replyClassName;
- }
-
- @XmlAttribute(name = "reply-class-name")
- public void setReplyClassName(final String replyClassName) {
- this.replyClassName = replyClassName;
- }
-}
Deleted: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientSourceMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientSourceMetaData.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientSourceMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.metadata;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- */
-@XmlType(name = "client-source")
-public final class ClientSourceMetaData {
- private String name;
- private String serviceBean;
- private String requestClassName;
- private String replyClassName;
-
- public String getName() {
- return name;
- }
-
- @XmlAttribute(required = true)
- public void setName(final String name) {
- this.name = name;
- }
-
- public String getServiceBean() {
- return serviceBean;
- }
-
- @XmlAttribute(name = "service-bean", required = true)
- public void setServiceBean(final String serviceBean) {
- this.serviceBean = serviceBean;
- }
-
- public String getRequestClassName() {
- return requestClassName;
- }
-
- @XmlAttribute(name = "request-class-name")
- public void setRequestClassName(final String requestClassName) {
- this.requestClassName = requestClassName;
- }
-
- public String getReplyClassName() {
- return replyClassName;
- }
-
- @XmlAttribute(name = "reply-class-name")
- public void setReplyClassName(final String replyClassName) {
- this.replyClassName = replyClassName;
- }
-
-}
Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ConnectionMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ConnectionMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ConnectionMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.xnio.metadata.OptionMetaData;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "connection", propOrder = {})
+public final class ConnectionMetaData {
+ private RefMetaData destination;
+ private ClientAuthenticationMetaData clientAuthentication;
+ private List<OptionMetaData> options = new ArrayList<OptionMetaData>();
+ private String name;
+
+ public RefMetaData getDestination() {
+ return destination;
+ }
+
+ @XmlElement(required = true)
+ public void setDestination(final RefMetaData destination) {
+ this.destination = destination;
+ }
+
+ public ClientAuthenticationMetaData getClientAuthentication() {
+ return clientAuthentication;
+ }
+
+ @XmlElement(name = "authentication")
+ public void setClientAuthentication(final ClientAuthenticationMetaData clientAuthentication) {
+ this.clientAuthentication = clientAuthentication;
+ }
+
+ public List<OptionMetaData> getOptions() {
+ return options;
+ }
+
+ @XmlElementWrapper(name = "options")
+ @XmlElement(name = "option", type = OptionMetaData.class)
+ public void setOptions(final List<OptionMetaData> options) {
+ this.options = options;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/EndpointMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.xnio.metadata.OptionMetaData;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "endpoint", propOrder = {})
+public final class EndpointMetaData {
+ private RefMetaData executor;
+ private List<OptionMetaData> options = new ArrayList<OptionMetaData>();
+ private String name;
+ private boolean defaultFlag = false;
+
+ public RefMetaData getExecutor() {
+ return executor;
+ }
+
+ @XmlElement(name = "executor")
+ public void setExecutor(final RefMetaData executor) {
+ this.executor = executor;
+ }
+
+ public List<OptionMetaData> getOptions() {
+ return options;
+ }
+
+ @XmlElementWrapper(name = "options")
+ @XmlElement(name = "option", type = OptionMetaData.class)
+ public void setOptions(final List<OptionMetaData> options) {
+ this.options = options;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public boolean isDefaultFlag() {
+ return defaultFlag;
+ }
+
+ @XmlAttribute(name = "default")
+ public void setDefaultFlag(final boolean defaultFlag) {
+ this.defaultFlag = defaultFlag;
+ }
+}
Copied: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalClientMetaData.java (from rev 5051, remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ClientMetaData.java)
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalClientMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalClientMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.metadata;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ *
+ */
+@XmlType(name = "client")
+public final class LocalClientMetaData {
+ private String name;
+ private RefMetaData requestClassName;
+ private RefMetaData replyClassName;
+ private RefMetaData requestListener;
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public RefMetaData getRequestClassName() {
+ return requestClassName;
+ }
+
+ @XmlElement(name = "request-class", required = true)
+ public void setRequestClassName(final RefMetaData requestClassName) {
+ this.requestClassName = requestClassName;
+ }
+
+ public RefMetaData getReplyClassName() {
+ return replyClassName;
+ }
+
+ @XmlElement(name = "reply-class", required = true)
+ public void setReplyClassName(final RefMetaData replyClassName) {
+ this.replyClassName = replyClassName;
+ }
+
+ public RefMetaData getRequestListener() {
+ return requestListener;
+ }
+
+ @XmlElement(name = "request-listener", required = true)
+ public void setRequestListener(final RefMetaData requestListener) {
+ this.requestListener = requestListener;
+ }
+}
Deleted: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalServiceMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalServiceMetaData.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalServiceMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.metadata;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- *
- */
-@XmlType(name = "service")
-public final class LocalServiceMetaData implements Cloneable {
-
- private String name;
- private String requestListenerClass;
- private String requestClassName;
- private String replyClassName;
- private String serviceType;
- private String groupName;
- private int metric;
-
- public String getName() {
- return name;
- }
-
- @XmlAttribute(required = true)
- public void setName(final String name) {
- this.name = name;
- }
-
- public String getRequestListenerClass() {
- return requestListenerClass;
- }
-
- @XmlAttribute(name = "request-listener-class")
- public void setRequestListenerClass(final String requestListenerClass) {
- this.requestListenerClass = requestListenerClass;
- }
-
- public String getRequestClassName() {
- return requestClassName;
- }
-
- @XmlAttribute(name = "request-class")
- public void setRequestClassName(final String requestClassName) {
- this.requestClassName = requestClassName;
- }
-
- public String getReplyClassName() {
- return replyClassName;
- }
-
- @XmlAttribute(name = "reply-class")
- public void setReplyClassName(final String replyClassName) {
- this.replyClassName = replyClassName;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- @XmlAttribute(name = "service-type", required = true)
- public void setServiceType(final String serviceType) {
- this.serviceType = serviceType;
- }
-
- public String getGroupName() {
- return groupName;
- }
-
- @XmlAttribute(name = "group-name")
- public void setGroupName(final String groupName) {
- this.groupName = groupName;
- }
-
- public int getMetric() {
- return metric;
- }
-
- @XmlAttribute(name = "metric")
- public void setMetric(final int metric) {
- this.metric = metric;
- }
-
- protected LocalServiceMetaData clone() throws CloneNotSupportedException {
- return (LocalServiceMetaData) super.clone();
- }
-}
Deleted: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocateServiceMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocateServiceMetaData.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocateServiceMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.metadata;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- *
- */
-@XmlType(name = "locate-service")
-public final class LocateServiceMetaData {
- private String name;
- private String uri;
- private String requestClassName;
- private String replyClassName;
-
- public String getName() {
- return name;
- }
-
- @XmlAttribute(required = true)
- public void setName(final String name) {
- this.name = name;
- }
-
- public String getUri() {
- return uri;
- }
-
- @XmlAttribute(required = true)
- public void setUri(final String uri) {
- this.uri = uri;
- }
-
- public String getRequestClassName() {
- return requestClassName;
- }
-
- @XmlAttribute(name = "request-class-name")
- public void setRequestClassName(final String requestClassName) {
- this.requestClassName = requestClassName;
- }
-
- public String getReplyClassName() {
- return replyClassName;
- }
-
- @XmlAttribute(name = "reply-class-name")
- public void setReplyClassName(final String replyClassName) {
- this.replyClassName = replyClassName;
- }
-}
Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RefMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RefMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RefMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "ref", propOrder = {})
+public final class RefMetaData {
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
Deleted: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemoteServiceMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemoteServiceMetaData.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemoteServiceMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.metadata;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- *
- */
-@XmlType(name = "remote-service")
-public final class RemoteServiceMetaData {
- private String name;
- private String serviceType;
- private String groupName;
- private String endpointName;
- private String requestHandlerSourceBean;
- private int metric;
-
- public String getName() {
- return name;
- }
-
- @XmlAttribute(required = true)
- public void setName(final String name) {
- this.name = name;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- @XmlAttribute(name = "service-type", required = true)
- public void setServiceType(final String serviceType) {
- this.serviceType = serviceType;
- }
-
- public String getGroupName() {
- return groupName;
- }
-
- @XmlAttribute(name = "group-name", required = true)
- public void setGroupName(final String groupName) {
- this.groupName = groupName;
- }
-
- public String getEndpointName() {
- return endpointName;
- }
-
- @XmlAttribute(name = "endpoint-name", required = true)
- public void setEndpointName(final String endpointName) {
- this.endpointName = endpointName;
- }
-
- public String getRequestHandlerSourceBean() {
- return requestHandlerSourceBean;
- }
-
- @XmlAttribute(name = "request-handler-source-bean", required = true)
- public void setRequestHandlerSourceBean(final String requestHandlerSourceBean) {
- this.requestHandlerSourceBean = requestHandlerSourceBean;
- }
-
- public int getMetric() {
- return metric;
- }
-
- @XmlAttribute
- public void setMetric(final int metric) {
- this.metric = metric;
- }
-}
Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingHelper.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -22,16 +22,13 @@
package org.jboss.remoting3.metadata;
-import org.jboss.remoting3.spi.RequestHandlerSource;
-import org.jboss.remoting3.spi.Handle;
-import org.jboss.remoting3.spi.RequestHandler;
+import java.net.InetSocketAddress;
import org.jboss.remoting3.Endpoint;
-import org.jboss.remoting3.RequestListener;
-import org.jboss.remoting3.LocalServiceConfiguration;
-import org.jboss.remoting3.Client;
-import org.jboss.remoting3.SimpleCloseable;
-import org.jboss.xnio.IoUtils;
-import java.io.IOException;
+import org.jboss.remoting3.UnknownURISchemeException;
+import org.jboss.remoting3.spi.NetworkServerProvider;
+import org.jboss.xnio.ChannelListener;
+import org.jboss.xnio.OptionMap;
+import org.jboss.xnio.channels.ConnectedStreamChannel;
/**
*
@@ -39,32 +36,7 @@
public final class RemotingHelper {
private RemotingHelper() {}
- @SuppressWarnings({ "unchecked" })
- public static <I, O> Handle<RequestHandlerSource> registerService(final Endpoint endpoint, final Class<I> requestClass, final Class<O> replyClass, final Class<? extends RequestListener> listenerClass, final String serviceType, final String groupName, final int metric) throws IOException, IllegalAccessException, InstantiationException {
- final RequestListener<I, O> listener = (RequestListener<I, O>) listenerClass.newInstance();
- final LocalServiceConfiguration<I, O> config = new LocalServiceConfiguration<I, O>(listener, requestClass, replyClass);
- config.setGroupName(groupName);
- config.setServiceType(serviceType);
- config.setMetric(metric);
- return endpoint.bindLocalService(config);
+ public static ChannelListener<ConnectedStreamChannel<InetSocketAddress>> createServer(Endpoint endpoint, String protocol, OptionMap optionMap) throws UnknownURISchemeException {
+ return endpoint.getConnectionProviderInterface(protocol, NetworkServerProvider.class).getServerListener(optionMap);
}
-
- public static <I, O> Client<I, O> createClient(final Endpoint endpoint, final RequestHandlerSource handlerSource, final Class<I> requestClass, final Class<O> replyClass) throws IOException {
- final Handle<RequestHandler> handle = handlerSource.createRequestHandler();
- try {
- return endpoint.createClient(handle.getResource(), requestClass, replyClass);
- } finally {
- IoUtils.safeClose(handle);
- }
- }
-
- public static SimpleCloseable registerRemoteService(final Endpoint endpoint, final String serviceType, final String groupName, final String endpointName, final RequestHandlerSource requestHandlerSource, final int metric) throws IOException {
- final RemoteServiceConfiguration config = new RemoteServiceConfiguration();
- config.setServiceType(serviceType);
- config.setGroupName(groupName);
- config.setEndpointName(endpointName);
- config.setRequestHandlerSource(requestHandlerSource);
- config.setMetric(metric);
- return endpoint.registerRemoteService(config);
- }
}
Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/RemotingMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -1,17 +1,24 @@
package org.jboss.remoting3.metadata;
import java.io.Serializable;
+import java.net.URI;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import java.util.concurrent.Executor;
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.remoting3.Client;
+import org.jboss.remoting3.Connection;
import org.jboss.remoting3.Endpoint;
-import org.jboss.remoting3.ServiceRegistrationListener;
-import org.jboss.remoting3.spi.RequestHandlerSource;
+import org.jboss.remoting3.Remoting;
+import org.jboss.remoting3.RequestListener;
+import org.jboss.remoting3.security.SimpleClientCallbackHandler;
import org.jboss.xb.annotations.JBossXmlSchema;
+import org.jboss.xnio.ChannelListener;
+import org.jboss.xnio.Option;
+import org.jboss.xnio.OptionMap;
+import org.jboss.xnio.metadata.OptionMetaData;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlNsForm;
@@ -20,23 +27,24 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlAttribute;
+import javax.security.auth.callback.CallbackHandler;
+
/**
* Metadata which describes a Remoting deployment. This class is intended for the parsing of
* {@code jboss-remoting.xml} descriptors.
*/
-@JBossXmlSchema (namespace = "urn:jboss:remoting:3.0", elementFormDefault = XmlNsForm.QUALIFIED)
+@JBossXmlSchema (namespace = "urn:jboss:remoting:3.1", elementFormDefault = XmlNsForm.QUALIFIED)
@XmlRootElement (name = "remoting")
-@XmlType (name = "remoting")
+@XmlType (name = "remoting", propOrder = {})
public class RemotingMetaData implements BeanMetaDataFactory, Serializable {
private static final long serialVersionUID = 1L;
private String endpoint;
- private List<LocalServiceMetaData> localServices;
- private List<RemoteServiceMetaData> remoteServices;
- private List<ClientMetaData> clients;
- private List<ClientSourceMetaData> clientSources;
- private List<ServiceListenerMetaData> serviceListeners;
- private ClassLoader classLoader;
+ private List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
+ private List<LocalClientMetaData> localClients = new ArrayList<LocalClientMetaData>();
+ private List<ServerMetaData> servers = new ArrayList<ServerMetaData>();
+ private List<ConnectionMetaData> connections = new ArrayList<ConnectionMetaData>();
+ private List<EndpointMetaData> endpoints = new ArrayList<EndpointMetaData>();
public String getEndpoint() {
return endpoint;
@@ -47,149 +55,164 @@
this.endpoint = endpoint;
}
- public List<LocalServiceMetaData> getLocalServices() {
- return localServices;
+ public List<ServiceMetaData> getServices() {
+ return services;
}
@XmlElement(name = "local-service")
- public void setLocalServices(final List<LocalServiceMetaData> localServices) {
- this.localServices = localServices;
+ public void setServices(final List<ServiceMetaData> services) {
+ this.services = services;
}
- public List<RemoteServiceMetaData> getRemoteServices() {
- return remoteServices;
+ public List<LocalClientMetaData> getLocalClients() {
+ return localClients;
}
- @XmlElement(name = "remote-service")
- public void setRemoteServices(final List<RemoteServiceMetaData> remoteServices) {
- this.remoteServices = remoteServices;
- }
-
- public List<ClientMetaData> getClients() {
- return clients;
- }
-
@XmlElement(name = "client")
- public void setClients(final List<ClientMetaData> clients) {
- this.clients = clients;
+ public void setLocalClients(final List<LocalClientMetaData> localClients) {
+ this.localClients = localClients;
}
- public List<ClientSourceMetaData> getClientSources() {
- return clientSources;
+ public List<ServerMetaData> getServers() {
+ return servers;
}
- @XmlElement(name = "client-source")
- public void setClientSources(final List<ClientSourceMetaData> clientSources) {
- this.clientSources = clientSources;
+ @XmlElement(name = "server")
+ public void setServers(final List<ServerMetaData> servers) {
+ this.servers = servers;
}
- public List<ServiceListenerMetaData> getServiceListeners() {
- return serviceListeners;
+ public List<ConnectionMetaData> getConnections() {
+ return connections;
}
- @XmlElement(name = "service-listener")
- public void setServiceListeners(final List<ServiceListenerMetaData> serviceListeners) {
- this.serviceListeners = serviceListeners;
+ @XmlElement(name = "connection")
+ public void setConnections(final List<ConnectionMetaData> connections) {
+ this.connections = connections;
}
- public ClassLoader getClassLoader() {
- return classLoader;
+ public List<EndpointMetaData> getEndpoints() {
+ return endpoints;
}
- @Inject
- public void setClassLoader(final ClassLoader classLoader) {
- this.classLoader = classLoader;
+ @XmlElement(name = "endpoint")
+ public void setEndpoints(final List<EndpointMetaData> endpoints) {
+ this.endpoints = endpoints;
}
/**
- * Create a duplicate of this object.
- *
- * @return a duplicate of this object
- */
- public RemotingMetaData clone() throws CloneNotSupportedException {
- final RemotingMetaData metaData = (RemotingMetaData) super.clone();
- metaData.localServices = new ArrayList<LocalServiceMetaData>(localServices.size());
- for (LocalServiceMetaData localService : localServices) {
- metaData.localServices.add(localService.clone());
- }
- return metaData;
- }
-
- /**
* Get the metadata items that this deployment produces.
*
* @return the list of metadata items
*/
@XmlTransient
public List<BeanMetaData> getBeans() {
- try {
- final ClassLoader classLoader = getClassLoader();
- final String endpoint = this.endpoint == null ? "default-remoting-endpoint" : this.endpoint;
- final List<BeanMetaData> metaDataList = new ArrayList<BeanMetaData>();
- for (LocalServiceMetaData localService : localServices) {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(localService.getName());
- builder.setFactoryClass(RemotingHelper.class.getName());
- builder.setFactoryMethod("registerService");
- builder.addConstructorParameter(Endpoint.class.getName(), builder.createInject(endpoint));
- builder.addConstructorParameter(Class.class.getName(), getOptionalClass(localService.getRequestClassName(), classLoader));
- builder.addConstructorParameter(Class.class.getName(), getOptionalClass(localService.getReplyClassName(), classLoader));
- builder.addConstructorParameter(Class.class.getName(), Class.forName(localService.getRequestListenerClass(), false, classLoader));
- builder.addConstructorParameter(String.class.getName(), localService.getServiceType());
- builder.addConstructorParameter(String.class.getName(), localService.getGroupName());
- builder.addConstructorParameter(int.class.getName(), Integer.valueOf(localService.getMetric()));
- builder.setStop("close");
- metaDataList.add(builder.getBeanMetaData());
+ final String endpoint = this.endpoint == null ? "Remoting:DEFAULT-ENDPOINT" : "Remoting:ENDPOINT:" + this.endpoint;
+ final List<BeanMetaData> metaDataList = new ArrayList<BeanMetaData>();
+ for (ServiceMetaData service : services) {
+ final String type = service.getType();
+ final String groupName = defaulted(service.getGroupName(), "default");
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(ServiceManager.class.getName(), "Remoting:" + endpoint + ":SERVICE:" + type + ":" + groupName);
+ builder.ignoreCreate();
+ builder.ignoreDestroy();
+ builder.setStart("start");
+ builder.setStop("stop");
+ builder.addPropertyMetaData("endpoint", builder.createInject(endpoint));
+ builder.addPropertyMetaData("requestType", service.getRequestClassName().getName());
+ builder.addPropertyMetaData("replyType", service.getReplyClassName().getName());
+ builder.addPropertyMetaData("clientListener", builder.createInject(service.getClientListener()));
+ builder.addPropertyMetaData("optionMap", createOptionMap(service.getOptions()));
+ builder.addPropertyMetaData("serviceType", service.getType());
+ final RefMetaData classloader = service.getClassloader();
+ if (classloader != null) builder.addPropertyMetaData("classloader", builder.createInject(classloader.getName()));
+ builder.addPropertyMetaData("groupName", service.getGroupName());
+ metaDataList.add(builder.getBeanMetaData());
+ }
+ for (LocalClientMetaData localClient : localClients) {
+ final String name = localClient.getName();
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Client.class.getName(), name);
+ builder.ignoreCreate();
+ builder.ignoreDestroy();
+ builder.ignoreStart();
+ builder.setStop("close");
+ builder.setFactoryClass(Remoting.class.getName());
+ builder.setFactoryMethod("createLocalClient");
+ builder.addConstructorParameter(Endpoint.class.getName(), builder.createInject(endpoint));
+ builder.addConstructorParameter(RequestListener.class.getName(), builder.createInject(localClient.getRequestListener().getName()));
+ builder.addConstructorParameter(Class.class.getName(), localClient.getRequestClassName().getName());
+ metaDataList.add(builder.getBeanMetaData());
+ }
+ for (ServerMetaData server : servers) {
+ final String name = server.getName();
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(ChannelListener.class.getName(), name);
+ builder.ignoreCreate();
+ builder.ignoreDestroy();
+ builder.ignoreStart();
+ builder.ignoreStop();
+ builder.setFactoryClass(RemotingHelper.class.getName());
+ builder.setFactoryMethod("createServer");
+ builder.addConstructorParameter(Endpoint.class.getName(), builder.createInject(endpoint));
+ builder.addConstructorParameter(String.class.getName(), server.getProtocol());
+ builder.addConstructorParameter(OptionMap.class.getName(), createOptionMap(server.getOptions()));
+ metaDataList.add(builder.getBeanMetaData());
+ }
+ for (ConnectionMetaData connection : connections) {
+ final String name = connection.getName();
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Connection.class.getName(), name);
+ builder.ignoreCreate();
+ builder.ignoreDestroy();
+ builder.ignoreStart();
+ builder.setStop("close");
+ builder.setFactory(endpoint);
+ builder.setFactoryMethod("connect");
+ builder.addConstructorParameter(URI.class.getName(), URI.create(connection.getDestination().getName()));
+ builder.addConstructorParameter(OptionMap.class.getName(), createOptionMap(connection.getOptions()));
+ final ClientAuthenticationMetaData auth = connection.getClientAuthentication();
+ if (auth != null) {
+ final RefMetaData ref = auth.getCallbackHandler();
+ if (ref != null) {
+ builder.addConstructorParameter(CallbackHandler.class.getName(), builder.createInject(ref.getName()));
+ } else {
+ final UserEntryMetaData entry = auth.getUserEntry();
+ final String password = entry.getPassword();
+ builder.addConstructorParameter(CallbackHandler.class.getName(), new SimpleClientCallbackHandler(
+ entry.getUserName(), entry.getUserRealm(), password == null ? null : password.toCharArray()
+ ));
+ }
}
- for (ClientMetaData client : clients) {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(client.getName());
- builder.setFactoryClass(RemotingHelper.class.getName());
- builder.setFactoryMethod("createClient");
- builder.addConstructorParameter(Endpoint.class.getName(), builder.createInject(endpoint));
- builder.addConstructorParameter(RequestHandlerSource.class.getName(), builder.createInject(client.getServiceBean()));
- builder.addConstructorParameter(Class.class.getName(), getOptionalClass(client.getRequestClassName(), classLoader));
- builder.addConstructorParameter(Class.class.getName(), getOptionalClass(client.getReplyClassName(), classLoader));
- builder.setStop("close");
- metaDataList.add(builder.getBeanMetaData());
+ metaDataList.add(builder.getBeanMetaData());
+ }
+ for (EndpointMetaData endpointMetaData : endpoints) {
+ final String name = endpointMetaData.getName();
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(Endpoint.class.getName(), "Remoting:ENDPOINT:" + name);
+ if (endpointMetaData.isDefaultFlag()) {
+ builder.addAlias("Remoting:DEFAULT-ENDPOINT");
}
- for (ClientSourceMetaData clientSource : clientSources) {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(clientSource.getName());
- builder.setFactory(builder.createInject(endpoint));
- builder.setFactoryMethod("createClientSource");
- builder.addConstructorParameter(RequestHandlerSource.class.getName(), builder.createInject(clientSource.getServiceBean()));
- builder.addConstructorParameter(Class.class.getName(), getOptionalClass(clientSource.getRequestClassName(), classLoader));
- builder.addConstructorParameter(Class.class.getName(), getOptionalClass(clientSource.getReplyClassName(), classLoader));
- builder.setStop("close");
- metaDataList.add(builder.getBeanMetaData());
- }
- for (RemoteServiceMetaData remoteService : remoteServices) {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(remoteService.getName());
- builder.setFactoryClass(RemotingHelper.class.getName());
- builder.setFactoryMethod("registerRemoteService");
- builder.addConstructorParameter(Endpoint.class.getName(), builder.createInject(endpoint));
- builder.addConstructorParameter(String.class.getName(), remoteService.getServiceType());
- builder.addConstructorParameter(String.class.getName(), remoteService.getGroupName());
- builder.addConstructorParameter(String.class.getName(), remoteService.getEndpointName());
- builder.addConstructorParameter(RequestHandlerSource.class.getName(), builder.createInject(remoteService.getRequestHandlerSourceBean()));
- builder.addConstructorParameter(int.class.getName(), Integer.valueOf(remoteService.getMetric()));
- builder.setStop("close");
- metaDataList.add(builder.getBeanMetaData());
- }
- for (ServiceListenerMetaData serviceListener : serviceListeners) {
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(serviceListener.getName());
- builder.setFactory(builder.createInject(endpoint));
- builder.setFactoryMethod("addServiceListener");
- builder.addConstructorParameter(ServiceRegistrationListener.class.getName(), builder.createInject(serviceListener.getListenerBean()));
- builder.addConstructorParameter(boolean.class.getName(), Boolean.valueOf(serviceListener.isOnlyNew()));
- builder.setStop("close");
- metaDataList.add(builder.getBeanMetaData());
- }
- return Collections.unmodifiableList(metaDataList);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Cannot find a required class name", e);
+ builder.ignoreCreate();
+ builder.ignoreDestroy();
+ builder.ignoreStart();
+ builder.setStop("close");
+ builder.setFactoryClass(Remoting.class.getName());
+ builder.setFactoryMethod("createEndpoint");
+ builder.addConstructorParameter(String.class.getName(), name);
+ builder.addConstructorParameter(Executor.class.getName(), builder.createInject(endpointMetaData.getExecutor().getName()));
+ builder.addConstructorParameter(OptionMap.class.getName(), createOptionMap(endpointMetaData.getOptions()));
+ metaDataList.add(builder.getBeanMetaData());
}
+ return metaDataList;
}
- private Class<?> getOptionalClass(final String className, final ClassLoader classLoader) throws ClassNotFoundException {
- return className == null ? Object.class : Class.forName(className, false, classLoader);
+ private OptionMap createOptionMap(final List<OptionMetaData> options) {
+ if (options.isEmpty()) return OptionMap.EMPTY;
+ final OptionMap.Builder builder = OptionMap.builder();
+ for (OptionMetaData option : options) {
+ final Option<?> real = Option.fromString(option.getClassName() + "." + option.getName(), Remoting.class.getClassLoader());
+ builder.parse(real, option.getValue());
+ }
+ return builder.getMap();
}
+
+ private static String defaulted(String val, String def) {
+ return val != null ? val : def;
+ }
}
Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServerMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServerMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServerMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.xnio.metadata.OptionMetaData;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "server", propOrder = {})
+public final class ServerMetaData {
+ private List<OptionMetaData> options = new ArrayList<OptionMetaData>();
+ private String protocol = "remote";
+ private String name;
+
+ public List<OptionMetaData> getOptions() {
+ return options;
+ }
+
+ @XmlElementWrapper(name = "options")
+ @XmlElement(name = "option", type = OptionMetaData.class)
+ public void setOptions(final List<OptionMetaData> options) {
+ this.options = options;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ @XmlAttribute
+ public void setProtocol(final String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute(required = true)
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
Deleted: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceListenerMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceListenerMetaData.java 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceListenerMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.metadata;
-
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- *
- */
-@XmlType(name = "service-listener")
-public final class ServiceListenerMetaData {
- private String name;
- private String listenerBean;
- private boolean onlyNew;
-
- public String getName() {
- return name;
- }
-
- @XmlAttribute(required = true)
- public void setName(final String name) {
- this.name = name;
- }
-
- public String getListenerBean() {
- return listenerBean;
- }
-
- @XmlAttribute(name = "listener-bean", required = true)
- public void setListenerBean(final String listenerBean) {
- this.listenerBean = listenerBean;
- }
-
- public boolean isOnlyNew() {
- return onlyNew;
- }
-
- @XmlAttribute(name = "only-new")
- public void setOnlyNew(final boolean onlyNew) {
- this.onlyNew = onlyNew;
- }
-}
Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceManager.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceManager.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceManager.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.metadata;
+
+import java.io.IOException;
+import org.jboss.remoting3.ClientListener;
+import org.jboss.remoting3.Endpoint;
+import org.jboss.remoting3.Registration;
+import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.OptionMap;
+
+public final class ServiceManager<I, O> {
+ private Endpoint endpoint;
+ private Registration serviceRegistration;
+ private Class<I> requestType;
+ private Class<O> replyType;
+ private ClientListener<I, O> clientListener;
+ private OptionMap optionMap;
+ private String serviceType;
+ private String groupName;
+
+ public void setEndpoint(final Endpoint endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void setRequestType(final Class<I> requestType) {
+ this.requestType = requestType;
+ }
+
+ public void setReplyType(final Class<O> replyType) {
+ this.replyType = replyType;
+ }
+
+ public void setClientListener(final ClientListener<I, O> clientListener) {
+ this.clientListener = clientListener;
+ }
+
+ public void setOptionMap(final OptionMap optionMap) {
+ this.optionMap = optionMap;
+ }
+
+ public void setServiceType(final String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public void setGroupName(final String groupName) {
+ this.groupName = groupName;
+ }
+
+ public void start() throws IOException {
+ final Endpoint.ServiceBuilder<I, O> builder = endpoint.serviceBuilder(requestType, replyType);
+ builder.setClientListener(clientListener);
+ builder.setOptionMap(optionMap);
+ builder.setServiceType(serviceType);
+ builder.setGroupName(groupName);
+ serviceRegistration = builder.register();
+ }
+
+ public void stop() {
+ IoUtils.safeClose(serviceRegistration);
+ }
+}
Copied: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceMetaData.java (from rev 5051, remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/LocalServiceMetaData.java)
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/ServiceMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.xnio.metadata.OptionMetaData;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ *
+ */
+@XmlType(name = "service", propOrder = {})
+public final class ServiceMetaData {
+
+ private RefMetaData clientListener;
+ private RefMetaData requestClassName;
+ private RefMetaData replyClassName;
+ private RefMetaData classloader;
+ private List<OptionMetaData> options = new ArrayList<OptionMetaData>();
+ private String type;
+ private String groupName;
+
+ public RefMetaData getClientListener() {
+ return clientListener;
+ }
+
+ @XmlElement(name = "client-listener", required = true)
+ public void setClientListener(final RefMetaData clientListener) {
+ this.clientListener = clientListener;
+ }
+
+ public RefMetaData getRequestClassName() {
+ return requestClassName;
+ }
+
+ @XmlElement(name = "request-class", required = true)
+ public void setRequestClassName(final RefMetaData requestClassName) {
+ this.requestClassName = requestClassName;
+ }
+
+ public RefMetaData getReplyClassName() {
+ return replyClassName;
+ }
+
+ @XmlElement(name = "reply-class", required = true)
+ public void setReplyClassName(final RefMetaData replyClassName) {
+ this.replyClassName = replyClassName;
+ }
+
+ public RefMetaData getClassloader() {
+ return classloader;
+ }
+
+ @XmlElement(name = "classloader")
+ public void setClassloader(final RefMetaData classloader) {
+ this.classloader = classloader;
+ }
+
+ public List<OptionMetaData> getOptions() {
+ return options;
+ }
+
+ @XmlElementWrapper(name = "options")
+ @XmlElement(name = "option", type = OptionMetaData.class)
+ public void setOptions(final List<OptionMetaData> options) {
+ this.options = options;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ @XmlAttribute(name = "type", required = true)
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ @XmlAttribute(name = "group-name")
+ public void setGroupName(final String groupName) {
+ this.groupName = groupName;
+ }
+}
Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/UserEntryMetaData.java
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/UserEntryMetaData.java (rev 0)
+++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadata/UserEntryMetaData.java 2010-03-02 21:45:22 UTC (rev 5784)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "user-entry", propOrder = {})
+public final class UserEntryMetaData {
+ private String userName;
+ private String userRealm;
+ private String password;
+
+ public String getUserName() {
+ return userName;
+ }
+
+ @XmlAttribute(name = "user-name", required = true)
+ public void setUserName(final String userName) {
+ this.userName = userName;
+ }
+
+ public String getUserRealm() {
+ return userRealm;
+ }
+
+ @XmlAttribute(name = "user-realm")
+ public void setUserRealm(final String userRealm) {
+ this.userRealm = userRealm;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ @XmlAttribute
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+}
Modified: remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-remoting_3_1.xsd
===================================================================
--- remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-remoting_3_1.xsd 2010-03-02 06:04:36 UTC (rev 5783)
+++ remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-remoting_3_1.xsd 2010-03-02 21:45:22 UTC (rev 5784)
@@ -54,6 +54,7 @@
<xs:element name="client-listener" type="ref"/>
<xs:element name="request-class" type="ref"/>
<xs:element name="reply-class" type="ref"/>
+ <xs:element name="classloader" type="ref" minOccurs="0"/>
<xs:element name="options" type="xnio:optionsType" minOccurs="0"/>
</xs:all>
<xs:attribute name="type" type="xs:string" use="required"/>
@@ -97,6 +98,7 @@
<xs:element name="options" type="xnio:optionsType" minOccurs="0"/>
</xs:all>
<xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="default" type="xs:boolean" use="optional" default="false"/>
</xs:complexType>
<xs:complexType name="ref">
14 years, 8 months