JBoss Remoting SVN: r4694 - remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 20:50:12 -0500 (Fri, 14 Nov 2008)
New Revision: 4694
Modified:
remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java
Log:
Better testcase logging
Modified: remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java
===================================================================
--- remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java 2008-11-15 01:49:58 UTC (rev 4693)
+++ remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java 2008-11-15 01:50:12 UTC (rev 4694)
@@ -68,7 +68,7 @@
LoggingHelper.init();
}
- public static final Logger log = Logger.getLogger(ConnectionTestCase.class);
+ public static final Logger log = Logger.getLogger(ConnectionTestCase.class.getSimpleName());
public void testConnection() throws Throwable {
final String REQUEST = "request";
@@ -121,6 +121,10 @@
log.debug("Client closed");
latch.countDown();
}
+
+ public String toString() {
+ return "TestListener";
+ }
}, Object.class, Object.class);
localServiceConfiguration.setServiceType("connection.test");
localServiceConfiguration.setGroupName("testgroup");
16 years, 1 month
JBoss Remoting SVN: r4693 - remoting3/trunk/api/src/main/resources/META-INF.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 20:49:58 -0500 (Fri, 14 Nov 2008)
New Revision: 4693
Modified:
remoting3/trunk/api/src/main/resources/META-INF/jboss-classloading.xml
Log:
XNIO 1.2.0 is required
Modified: remoting3/trunk/api/src/main/resources/META-INF/jboss-classloading.xml
===================================================================
--- remoting3/trunk/api/src/main/resources/META-INF/jboss-classloading.xml 2008-11-15 01:49:38 UTC (rev 4692)
+++ remoting3/trunk/api/src/main/resources/META-INF/jboss-classloading.xml 2008-11-15 01:49:58 UTC (rev 4693)
@@ -7,7 +7,7 @@
<package name="org.jboss.remoting.stream" version="3.0.0"/>
</capabilities>
<requirements>
- <module name="xnio-api" from-inclusive="true" from="1.1.0" reExport="true"/>
+ <module name="xnio-api" from-inclusive="true" from="1.2.0" reExport="true"/>
<module name="marshalling-api" from-inclusive="true" from="1.0.0" reExport="true"/>
</requirements>
</classloading>
16 years, 1 month
JBoss Remoting SVN: r4692 - remoting3/trunk/api/src/main/java/org/jboss/remoting/spi.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 20:49:38 -0500 (Fri, 14 Nov 2008)
New Revision: 4692
Modified:
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java
Log:
javadoc
Modified: remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java 2008-11-15 01:20:50 UTC (rev 4691)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java 2008-11-15 01:49:38 UTC (rev 4692)
@@ -34,16 +34,31 @@
import org.jboss.xnio.log.Logger;
/**
- *
+ * A registry associating names with services. Specifically, the name is associated with a handle to a request handler
+ * source instance; this handle is owned by the registry, so closing the handle will remove the entry.
*/
public final class NamedServiceRegistry {
public static final Logger log = Logger.getLogger("org.jboss.remoting.named-registry");
private final ConcurrentMap<QualifiedName, Handle<RequestHandlerSource>> map = new ConcurrentHashMap<QualifiedName, Handle<RequestHandlerSource>>();
+ /**
+ * Construct a new empty registry.
+ */
public NamedServiceRegistry() {
}
+ /**
+ * Register a service at the given path. If the given service is closed, an exception will be thrown. Returns
+ * a handle to the service which may be used to unregister this service from the registry. In addition, if the
+ * service is closed, the registration will be automatically removed. To monitor the registration, add a close
+ * handler to the returned handle.
+ *
+ * @param path the path of the service registration
+ * @param service the service
+ * @return a handle which can be used to unregister the service
+ * @throws IOException if an error occurs
+ */
public Handle<RequestHandlerSource> registerService(final QualifiedName path, final RequestHandlerSource service) throws IOException {
if (path == null) {
throw new NullPointerException("path is null");
@@ -73,14 +88,28 @@
}
}
+ /**
+ * Find a service at a location in the registry.
+ *
+ * @param path the path
+ * @return a handle to the service, or {@code null} if it is not found
+ */
public Handle<RequestHandlerSource> lookupService(QualifiedName path) {
return map.get(path);
}
+ /**
+ * Get an unmodifiable view of the entry set of the registry.
+ *
+ * @return a set view
+ */
public Set<Map.Entry<QualifiedName, Handle<RequestHandlerSource>>> getEntrySet() {
return Collections.unmodifiableSet(map.entrySet());
}
+ /**
+ * Returns a brief description of this object.
+ */
public String toString() {
return "named service registry <" + Integer.toHexString(hashCode()) + ">";
}
16 years, 1 month
JBoss Remoting SVN: r4691 - in remoting3/trunk/api/src: test/java/org/jboss/remoting/spi and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 20:20:50 -0500 (Fri, 14 Nov 2008)
New Revision: 4691
Added:
remoting3/trunk/api/src/test/java/org/jboss/remoting/spi/NameTestCase.java
Modified:
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java
Log:
Add QualifiedName testcase
Modified: remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java 2008-11-15 01:05:49 UTC (rev 4690)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java 2008-11-15 01:20:50 UTC (rev 4691)
@@ -36,6 +36,7 @@
*/
public final class QualifiedName implements Comparable<QualifiedName>, Iterable<String> {
private final String[] segments;
+ private static final QualifiedName ROOT_NAME = new QualifiedName(new String[0]);
public QualifiedName(final String[] segments) {
if (segments == null) {
@@ -107,6 +108,9 @@
if (path.charAt(0) != '/') {
throw new IllegalArgumentException("Relative paths are not allowed");
}
+ if (len == 1) {
+ return ROOT_NAME;
+ }
int segStart = 0;
int segEnd;
do {
Added: remoting3/trunk/api/src/test/java/org/jboss/remoting/spi/NameTestCase.java
===================================================================
--- remoting3/trunk/api/src/test/java/org/jboss/remoting/spi/NameTestCase.java (rev 0)
+++ remoting3/trunk/api/src/test/java/org/jboss/remoting/spi/NameTestCase.java 2008-11-15 01:20:50 UTC (rev 4691)
@@ -0,0 +1,92 @@
+/*
+ * 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.remoting.spi;
+
+import junit.framework.TestCase;
+import org.jboss.remoting.test.support.LoggingHelper;
+import java.util.Iterator;
+
+/**
+ *
+ */
+public final class NameTestCase extends TestCase {
+ static {
+ LoggingHelper.init();
+ }
+
+ public void testParseEmpty() {
+ boolean ok = false;
+ try {
+ QualifiedName.parse("");
+ } catch (IllegalArgumentException e) {
+ assertEquals("Wrong exception message", "Empty path", e.getMessage());
+ ok = true;
+ }
+ assertTrue("Exception not thrown", ok);
+ }
+
+ public void testParseRelative() {
+ boolean ok = false;
+ try {
+ QualifiedName.parse("some relative path/foo/bar");
+ } catch (IllegalArgumentException e) {
+ assertEquals("Wrong exception message", "Relative paths are not allowed", e.getMessage());
+ ok = true;
+ }
+ assertTrue("Exception not thrown", ok);
+ }
+
+ public void testParseRoot() {
+ final Iterator<String> i = QualifiedName.parse("/").iterator();
+ assertFalse(i.hasNext());
+ }
+
+ public void testParseOneLevel() {
+ final Iterator<String> i = QualifiedName.parse("/firstElement").iterator();
+ assertTrue(i.hasNext());
+ assertEquals("Wrong segment name", "firstElement", i.next());
+ assertFalse(i.hasNext());
+ }
+
+ public void testParseTwoLevel() {
+ final Iterator<String> i = QualifiedName.parse("/firstElement/secondElement").iterator();
+ assertTrue(i.hasNext());
+ assertEquals("Wrong segment name", "firstElement", i.next());
+ assertTrue(i.hasNext());
+ assertEquals("Wrong segment name", "secondElement", i.next());
+ assertFalse(i.hasNext());
+ }
+
+ public void testParseManyLevel() {
+ final Iterator<String> i = QualifiedName.parse("/firstElement/secondElement/boo/test+with+spaces%20test").iterator();
+ assertTrue(i.hasNext());
+ assertEquals("Wrong segment name", "firstElement", i.next());
+ assertTrue(i.hasNext());
+ assertEquals("Wrong segment name", "secondElement", i.next());
+ assertTrue(i.hasNext());
+ assertEquals("Wrong segment name", "boo", i.next());
+ assertTrue(i.hasNext());
+ assertEquals("Wrong segment name", "test with spaces test", i.next());
+ assertFalse(i.hasNext());
+ }
+}
16 years, 1 month
JBoss Remoting SVN: r4690 - in remoting3/trunk: api/src/main/java/org/jboss/remoting/spi and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 20:05:49 -0500 (Fri, 14 Nov 2008)
New Revision: 4690
Modified:
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java
remoting3/trunk/build.xml
Log:
api no longer depends on util
Modified: remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java 2008-11-15 00:46:59 UTC (rev 4689)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java 2008-11-15 01:05:49 UTC (rev 4690)
@@ -23,11 +23,11 @@
package org.jboss.remoting.spi;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.Map;
import java.util.Set;
import java.util.Collections;
import java.io.IOException;
-import org.jboss.remoting.util.CollectionUtil;
import org.jboss.remoting.ServiceRegistrationException;
import org.jboss.remoting.CloseHandler;
import org.jboss.xnio.IoUtils;
@@ -39,7 +39,7 @@
public final class NamedServiceRegistry {
public static final Logger log = Logger.getLogger("org.jboss.remoting.named-registry");
- private final ConcurrentMap<QualifiedName, Handle<RequestHandlerSource>> map = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<QualifiedName, Handle<RequestHandlerSource>> map = new ConcurrentHashMap<QualifiedName, Handle<RequestHandlerSource>>();
public NamedServiceRegistry() {
}
Modified: remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java 2008-11-15 00:46:59 UTC (rev 4689)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java 2008-11-15 01:05:49 UTC (rev 4690)
@@ -30,7 +30,6 @@
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.io.UnsupportedEncodingException;
-import org.jboss.remoting.util.CollectionUtil;
/**
*
@@ -101,18 +100,20 @@
public static QualifiedName parse(String path) {
List<String> decoded = new ArrayList<String>();
- boolean first = true;
- for (String segment : CollectionUtil.split("/", path)) {
- if (first) {
- if (segment.length() > 0) {
- throw new IllegalArgumentException("Relative paths are not allowed");
- }
- first = false;
- continue;
- } else {
- if (segment.length() == 0) {
- throw new IllegalArgumentException("Empty segment in path");
- }
+ final int len = path.length();
+ if (len < 1) {
+ throw new IllegalArgumentException("Empty path");
+ }
+ if (path.charAt(0) != '/') {
+ throw new IllegalArgumentException("Relative paths are not allowed");
+ }
+ int segStart = 0;
+ int segEnd;
+ do {
+ segEnd = path.indexOf('/', segStart + 1);
+ String segment = segEnd == -1 ? path.substring(segStart + 1) : path.substring(segStart + 1, segEnd);
+ if (segment.length() == 0) {
+ throw new IllegalArgumentException(segEnd == -1 ? "Invalid trailing slash" : "Empty segment in path");
}
try {
decoded.add(URLDecoder.decode(segment, "utf-8"));
@@ -120,7 +121,8 @@
// cannot happen
throw new IllegalStateException(e);
}
- }
+ segStart = segEnd;
+ } while (segEnd != -1);
return new QualifiedName(decoded.toArray(new String[decoded.size()]));
}
Modified: remoting3/trunk/build.xml
===================================================================
--- remoting3/trunk/build.xml 2008-11-15 00:46:59 UTC (rev 4689)
+++ remoting3/trunk/build.xml 2008-11-15 01:05:49 UTC (rev 4690)
@@ -252,7 +252,6 @@
<classpath>
<pathelement location="${lib.marshalling-api.local}"/>
<pathelement location="${lib.xnio-api.local}"/>
- <path refid="util.classpath"/>
</classpath>
</javac>
<touch file="api/target/main/.lastcompile" verbose="false"/>
@@ -305,7 +304,6 @@
<classpath>
<path refid="api.classpath"/>
<path refid="testing-support.classpath"/>
- <path refid="util.classpath"/>
<pathelement location="api/target/test/classes"/>
<pathelement location="${lib.junit.local}"/>
<pathelement location="${lib.marshalling-api.local}"/>
@@ -337,7 +335,7 @@
<delete dir="api/target"/>
</target>
- <target name="api" description="Build the API module" depends="lib.marshalling-api,lib.xnio-api,util,api.compile">
+ <target name="api" description="Build the API module" depends="lib.marshalling-api,lib.xnio-api,api.compile">
<path id="api.classpath">
<pathelement location="api/target/main/classes"/>
</path>
@@ -1079,9 +1077,6 @@
<zipfileset dir="transporter/target/main/classes">
<include name="**/*.class"/>
</zipfileset>
- <zipfileset dir="util/target/main/classes">
- <include name="**/*.class"/>
- </zipfileset>
</jar>
</target>
16 years, 1 month
JBoss Remoting SVN: r4689 - in remoting3/trunk: core/src/main/java/org/jboss/remoting/core and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 19:46:59 -0500 (Fri, 14 Nov 2008)
New Revision: 4689
Added:
remoting3/trunk/api/src/main/java/org/jboss/remoting/ServiceURI.java
Removed:
remoting3/trunk/util/src/main/java/org/jboss/remoting/util/ServiceURI.java
Modified:
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/EndpointImpl.java
Log:
Move ServiceURI to api module
Copied: remoting3/trunk/api/src/main/java/org/jboss/remoting/ServiceURI.java (from rev 4687, remoting3/trunk/util/src/main/java/org/jboss/remoting/util/ServiceURI.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/ServiceURI.java (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/ServiceURI.java 2008-11-15 00:46:59 UTC (rev 4689)
@@ -0,0 +1,131 @@
+package org.jboss.remoting;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * A parser for JBoss Remoting URI types.
+ */
+public final class ServiceURI {
+ public static final String SCHEME = "jrs";
+
+ private ServiceURI() {
+ }
+
+ /**
+ * Determine if this URI is a valid Remoting service URI.
+ *
+ * @param uri the URI
+ * @return {@code true} if the given URI is a valid Remoting service URI
+ */
+ public static boolean isRemotingServiceUri(final URI uri) {
+ return SCHEME.equals(uri.getScheme()) && uri.isOpaque();
+ }
+
+ /**
+ * Get the service type from a Remoting service URI.
+ *
+ * @param uri the URI
+ * @return the service type
+ * @throws IllegalArgumentException if the given URI is not for a remoting service
+ */
+ public static String getServiceType(final URI uri) throws IllegalArgumentException {
+ if (! isRemotingServiceUri(uri)) {
+ throw new IllegalArgumentException("Not a valid remoting service URI");
+ }
+ final String ssp = uri.getSchemeSpecificPart();
+ final int firstColon = ssp.indexOf(':');
+ final String serviceType;
+ if (firstColon == -1) {
+ serviceType = ssp;
+ } else {
+ serviceType = ssp.substring(0, firstColon);
+ }
+ return serviceType;
+ }
+
+ /**
+ * Get the group name from a Remoting service URI.
+ *
+ * @param uri the URI
+ * @return the group name
+ * @throws IllegalArgumentException if the given URI is not for a remoting service
+ */
+ public static String getGroupName(final URI uri) throws IllegalArgumentException {
+ if (! isRemotingServiceUri(uri)) {
+ throw new IllegalArgumentException("Not a valid remoting service URI");
+ }
+ final String ssp = uri.getSchemeSpecificPart();
+ final int firstColon = ssp.indexOf(':');
+ final String groupName;
+ if (firstColon == -1) {
+ return "";
+ }
+ final int secondColon = ssp.indexOf(':', firstColon + 1);
+ if (secondColon == -1) {
+ groupName = ssp.substring(firstColon + 1);
+ } else {
+ groupName = ssp.substring(firstColon + 1, secondColon);
+ }
+ return groupName;
+ }
+
+ /**
+ * Get the endpoint name from a Remoting service URI.
+ *
+ * @param uri the URI
+ * @return the endpoint name
+ * @throws IllegalArgumentException if the given URI is not for a remoting service
+ */
+ public static String getEndpointName(final URI uri) throws IllegalArgumentException {
+ if (! isRemotingServiceUri(uri)) {
+ throw new IllegalArgumentException("Not a valid remoting service URI");
+ }
+ final String ssp = uri.getSchemeSpecificPart();
+ final int firstColon = ssp.indexOf(':');
+ final String endpointName;
+ if (firstColon == -1) {
+ return "";
+ }
+ final int secondColon = ssp.indexOf(':', firstColon + 1);
+ if (secondColon == -1) {
+ return "";
+ }
+ // ::: is not officially supported, but this leaves room for extensions
+ final int thirdColon = ssp.indexOf(':', secondColon + 1);
+ if (thirdColon == -1) {
+ endpointName = ssp.substring(secondColon + 1);
+ } else {
+ endpointName = ssp.substring(secondColon + 1, thirdColon);
+ }
+ return endpointName;
+ }
+
+ /**
+ * Create a Remoting service URI.
+ *
+ * @param serviceType the service type, if any
+ * @param groupName the group name, if any
+ * @param endpointName the endpoint name, if any
+ * @return the URI
+ */
+ public static URI create(String serviceType, String groupName, String endpointName) {
+ try {
+ StringBuilder builder = new StringBuilder(serviceType.length() + groupName.length() + endpointName.length() + 2);
+ if (serviceType != null && serviceType.length() > 0) {
+ builder.append(serviceType);
+ }
+ builder.append(':');
+ if (groupName != null && groupName.length() > 0) {
+ builder.append(groupName);
+ }
+ builder.append(':');
+ if (endpointName != null && endpointName.length() > 0) {
+ builder.append(endpointName);
+ }
+ return new URI(SCHEME, builder.toString(), null);
+ } catch (URISyntaxException e) {
+ throw new IllegalStateException("URI syntax exception should not be possible here", e);
+ }
+ }
+}
Modified: remoting3/trunk/core/src/main/java/org/jboss/remoting/core/EndpointImpl.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/remoting/core/EndpointImpl.java 2008-11-15 00:29:52 UTC (rev 4688)
+++ remoting3/trunk/core/src/main/java/org/jboss/remoting/core/EndpointImpl.java 2008-11-15 00:46:59 UTC (rev 4689)
@@ -21,6 +21,7 @@
import org.jboss.remoting.LocalServiceConfiguration;
import org.jboss.remoting.EndpointPermission;
import org.jboss.remoting.RemoteServiceConfiguration;
+import org.jboss.remoting.ServiceURI;
import org.jboss.remoting.spi.AbstractSimpleCloseable;
import org.jboss.remoting.spi.Handle;
import org.jboss.remoting.spi.RequestHandler;
@@ -28,7 +29,6 @@
import org.jboss.remoting.util.CollectionUtil;
import org.jboss.remoting.util.NamingThreadFactory;
import org.jboss.remoting.util.OrderedExecutorFactory;
-import org.jboss.remoting.util.ServiceURI;
import org.jboss.remoting.version.Version;
import org.jboss.xnio.FailedIoFuture;
import org.jboss.xnio.FinishedIoFuture;
Deleted: remoting3/trunk/util/src/main/java/org/jboss/remoting/util/ServiceURI.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/remoting/util/ServiceURI.java 2008-11-15 00:29:52 UTC (rev 4688)
+++ remoting3/trunk/util/src/main/java/org/jboss/remoting/util/ServiceURI.java 2008-11-15 00:46:59 UTC (rev 4689)
@@ -1,131 +0,0 @@
-package org.jboss.remoting.util;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * A parser for JBoss Remoting URI types.
- */
-public final class ServiceURI {
- public static final String SCHEME = "jrs";
-
- private ServiceURI() {
- }
-
- /**
- * Determine if this URI is a valid Remoting service URI.
- *
- * @param uri the URI
- * @return {@code true} if the given URI is a valid Remoting service URI
- */
- public static boolean isRemotingServiceUri(final URI uri) {
- return SCHEME.equals(uri.getScheme()) && uri.isOpaque();
- }
-
- /**
- * Get the service type from a Remoting service URI.
- *
- * @param uri the URI
- * @return the service type
- * @throws IllegalArgumentException if the given URI is not for a remoting service
- */
- public static String getServiceType(final URI uri) throws IllegalArgumentException {
- if (! isRemotingServiceUri(uri)) {
- throw new IllegalArgumentException("Not a valid remoting service URI");
- }
- final String ssp = uri.getSchemeSpecificPart();
- final int firstColon = ssp.indexOf(':');
- final String serviceType;
- if (firstColon == -1) {
- serviceType = ssp;
- } else {
- serviceType = ssp.substring(0, firstColon);
- }
- return serviceType;
- }
-
- /**
- * Get the group name from a Remoting service URI.
- *
- * @param uri the URI
- * @return the group name
- * @throws IllegalArgumentException if the given URI is not for a remoting service
- */
- public static String getGroupName(final URI uri) throws IllegalArgumentException {
- if (! isRemotingServiceUri(uri)) {
- throw new IllegalArgumentException("Not a valid remoting service URI");
- }
- final String ssp = uri.getSchemeSpecificPart();
- final int firstColon = ssp.indexOf(':');
- final String groupName;
- if (firstColon == -1) {
- return "";
- }
- final int secondColon = ssp.indexOf(':', firstColon + 1);
- if (secondColon == -1) {
- groupName = ssp.substring(firstColon + 1);
- } else {
- groupName = ssp.substring(firstColon + 1, secondColon);
- }
- return groupName;
- }
-
- /**
- * Get the endpoint name from a Remoting service URI.
- *
- * @param uri the URI
- * @return the endpoint name
- * @throws IllegalArgumentException if the given URI is not for a remoting service
- */
- public static String getEndpointName(final URI uri) throws IllegalArgumentException {
- if (! isRemotingServiceUri(uri)) {
- throw new IllegalArgumentException("Not a valid remoting service URI");
- }
- final String ssp = uri.getSchemeSpecificPart();
- final int firstColon = ssp.indexOf(':');
- final String endpointName;
- if (firstColon == -1) {
- return "";
- }
- final int secondColon = ssp.indexOf(':', firstColon + 1);
- if (secondColon == -1) {
- return "";
- }
- // ::: is not officially supported, but this leaves room for extensions
- final int thirdColon = ssp.indexOf(':', secondColon + 1);
- if (thirdColon == -1) {
- endpointName = ssp.substring(secondColon + 1);
- } else {
- endpointName = ssp.substring(secondColon + 1, thirdColon);
- }
- return endpointName;
- }
-
- /**
- * Create a Remoting service URI.
- *
- * @param serviceType the service type, if any
- * @param groupName the group name, if any
- * @param endpointName the endpoint name, if any
- * @return the URI
- */
- public static URI create(String serviceType, String groupName, String endpointName) {
- try {
- StringBuilder builder = new StringBuilder(serviceType.length() + groupName.length() + endpointName.length() + 2);
- if (serviceType != null && serviceType.length() > 0) {
- builder.append(serviceType);
- }
- builder.append(':');
- if (groupName != null && groupName.length() > 0) {
- builder.append(groupName);
- }
- builder.append(':');
- if (endpointName != null && endpointName.length() > 0) {
- builder.append(endpointName);
- }
- return new URI(SCHEME, builder.toString(), null);
- } catch (URISyntaxException e) {
- throw new IllegalStateException("URI syntax exception should not be possible here", e);
- }
- }
-}
16 years, 1 month
JBoss Remoting SVN: r4688 - in remoting3/trunk: protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex and 2 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 19:29:52 -0500 (Fri, 14 Nov 2008)
New Revision: 4688
Added:
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java
Removed:
remoting3/trunk/util/src/main/java/org/jboss/remoting/util/QualifiedName.java
Modified:
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConnection.java
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexReadHandler.java
remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java
Log:
Move QualifiedName to api module
Modified: remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java 2008-11-14 21:32:52 UTC (rev 4687)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/NamedServiceRegistry.java 2008-11-15 00:29:52 UTC (rev 4688)
@@ -27,7 +27,6 @@
import java.util.Set;
import java.util.Collections;
import java.io.IOException;
-import org.jboss.remoting.util.QualifiedName;
import org.jboss.remoting.util.CollectionUtil;
import org.jboss.remoting.ServiceRegistrationException;
import org.jboss.remoting.CloseHandler;
Copied: remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java (from rev 4687, remoting3/trunk/util/src/main/java/org/jboss/remoting/util/QualifiedName.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/QualifiedName.java 2008-11-15 00:29:52 UTC (rev 4688)
@@ -0,0 +1,152 @@
+/*
+ * 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.remoting.spi;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.io.UnsupportedEncodingException;
+import org.jboss.remoting.util.CollectionUtil;
+
+/**
+ *
+ */
+public final class QualifiedName implements Comparable<QualifiedName>, Iterable<String> {
+ private final String[] segments;
+
+ public QualifiedName(final String[] segments) {
+ if (segments == null) {
+ throw new NullPointerException("segments is null");
+ }
+ for (String s : segments) {
+ if (s == null) {
+ throw new NullPointerException("a segment is null");
+ }
+ }
+ this.segments = segments;
+ }
+
+ public boolean equals(final Object o) {
+ if (this == o) return true;
+ if (! (o instanceof QualifiedName)) return false;
+ final QualifiedName name = (QualifiedName) o;
+ if (!Arrays.equals(segments, name.segments)) return false;
+ return true;
+ }
+
+ public int hashCode() {
+ return Arrays.hashCode(segments);
+ }
+
+ public int compareTo(final QualifiedName o) {
+ if (this == o) return 0;
+ String[] a = segments;
+ String[] b = o.segments;
+ final int alen = a.length;
+ final int blen = b.length;
+ for (int i = 0; i < alen && i < blen; i ++) {
+ final int cmp = a[i].compareTo(b[i]);
+ if (cmp != 0) {
+ return cmp;
+ }
+ }
+ if (alen < blen) {
+ return -1;
+ } else if (alen > blen) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ if (segments.length == 0) {
+ return "/";
+ } else for (String segment : segments) {
+ try {
+ builder.append('/');
+ builder.append(URLEncoder.encode(segment, "utf-8"));
+ } catch (UnsupportedEncodingException e) {
+ // cannot happen
+ throw new IllegalStateException(e);
+ }
+ }
+ return builder.toString();
+ }
+
+ public static QualifiedName parse(String path) {
+ List<String> decoded = new ArrayList<String>();
+ boolean first = true;
+ for (String segment : CollectionUtil.split("/", path)) {
+ if (first) {
+ if (segment.length() > 0) {
+ throw new IllegalArgumentException("Relative paths are not allowed");
+ }
+ first = false;
+ continue;
+ } else {
+ if (segment.length() == 0) {
+ throw new IllegalArgumentException("Empty segment in path");
+ }
+ }
+ try {
+ decoded.add(URLDecoder.decode(segment, "utf-8"));
+ } catch (UnsupportedEncodingException e) {
+ // cannot happen
+ throw new IllegalStateException(e);
+ }
+ }
+ return new QualifiedName(decoded.toArray(new String[decoded.size()]));
+ }
+
+ public Iterator<String> iterator() {
+ return new Iterator<String>() {
+ int i;
+
+ public boolean hasNext() {
+ return i < segments.length;
+ }
+
+ public String next() {
+ try {
+ return segments[i++];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new NoSuchElementException("next() past end");
+ }
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove()");
+ }
+ };
+ }
+
+ public int length() {
+ return segments.length;
+ }
+}
Modified: remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConnection.java
===================================================================
--- remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConnection.java 2008-11-14 21:32:52 UTC (rev 4687)
+++ remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConnection.java 2008-11-15 00:29:52 UTC (rev 4688)
@@ -38,9 +38,9 @@
import org.jboss.remoting.spi.NamedServiceRegistry;
import org.jboss.remoting.spi.SpiUtils;
import org.jboss.remoting.spi.AbstractHandleableCloseable;
+import org.jboss.remoting.spi.QualifiedName;
import org.jboss.remoting.Endpoint;
import org.jboss.remoting.IndeterminateOutcomeException;
-import org.jboss.remoting.util.QualifiedName;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.List;
Modified: remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexReadHandler.java
===================================================================
--- remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexReadHandler.java 2008-11-14 21:32:52 UTC (rev 4687)
+++ remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexReadHandler.java 2008-11-15 00:29:52 UTC (rev 4688)
@@ -37,7 +37,7 @@
import org.jboss.remoting.ReplyException;
import org.jboss.remoting.RemoteExecutionException;
import org.jboss.remoting.ServiceRegistrationException;
-import org.jboss.remoting.util.QualifiedName;
+import org.jboss.remoting.spi.QualifiedName;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.marshalling.Marshalling;
import org.jboss.marshalling.Marshaller;
Modified: remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java
===================================================================
--- remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java 2008-11-14 21:32:52 UTC (rev 4687)
+++ remoting3/trunk/protocol/multiplex/src/test/java/org/jboss/remoting/protocol/multiplex/ConnectionTestCase.java 2008-11-15 00:29:52 UTC (rev 4688)
@@ -41,7 +41,7 @@
import org.jboss.remoting.RemoteExecutionException;
import org.jboss.remoting.ClientSource;
import org.jboss.remoting.Client;
-import org.jboss.remoting.util.QualifiedName;
+import org.jboss.remoting.spi.QualifiedName;
import org.jboss.remoting.spi.NamedServiceRegistry;
import org.jboss.remoting.spi.RequestHandlerSource;
import org.jboss.remoting.spi.Handle;
Deleted: remoting3/trunk/util/src/main/java/org/jboss/remoting/util/QualifiedName.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/remoting/util/QualifiedName.java 2008-11-14 21:32:52 UTC (rev 4687)
+++ remoting3/trunk/util/src/main/java/org/jboss/remoting/util/QualifiedName.java 2008-11-15 00:29:52 UTC (rev 4688)
@@ -1,151 +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.remoting.util;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.io.UnsupportedEncodingException;
-
-/**
- *
- */
-public final class QualifiedName implements Comparable<QualifiedName>, Iterable<String> {
- private final String[] segments;
-
- public QualifiedName(final String[] segments) {
- if (segments == null) {
- throw new NullPointerException("segments is null");
- }
- for (String s : segments) {
- if (s == null) {
- throw new NullPointerException("a segment is null");
- }
- }
- this.segments = segments;
- }
-
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (! (o instanceof QualifiedName)) return false;
- final QualifiedName name = (QualifiedName) o;
- if (!Arrays.equals(segments, name.segments)) return false;
- return true;
- }
-
- public int hashCode() {
- return Arrays.hashCode(segments);
- }
-
- public int compareTo(final QualifiedName o) {
- if (this == o) return 0;
- String[] a = segments;
- String[] b = o.segments;
- final int alen = a.length;
- final int blen = b.length;
- for (int i = 0; i < alen && i < blen; i ++) {
- final int cmp = a[i].compareTo(b[i]);
- if (cmp != 0) {
- return cmp;
- }
- }
- if (alen < blen) {
- return -1;
- } else if (alen > blen) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public String toString() {
- StringBuilder builder = new StringBuilder();
- if (segments.length == 0) {
- return "/";
- } else for (String segment : segments) {
- try {
- builder.append('/');
- builder.append(URLEncoder.encode(segment, "utf-8"));
- } catch (UnsupportedEncodingException e) {
- // cannot happen
- throw new IllegalStateException(e);
- }
- }
- return builder.toString();
- }
-
- public static QualifiedName parse(String path) {
- List<String> decoded = new ArrayList<String>();
- boolean first = true;
- for (String segment : CollectionUtil.split("/", path)) {
- if (first) {
- if (segment.length() > 0) {
- throw new IllegalArgumentException("Relative paths are not allowed");
- }
- first = false;
- continue;
- } else {
- if (segment.length() == 0) {
- throw new IllegalArgumentException("Empty segment in path");
- }
- }
- try {
- decoded.add(URLDecoder.decode(segment, "utf-8"));
- } catch (UnsupportedEncodingException e) {
- // cannot happen
- throw new IllegalStateException(e);
- }
- }
- return new QualifiedName(decoded.toArray(new String[decoded.size()]));
- }
-
- public Iterator<String> iterator() {
- return new Iterator<String>() {
- int i;
-
- public boolean hasNext() {
- return i < segments.length;
- }
-
- public String next() {
- try {
- return segments[i++];
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new NoSuchElementException("next() past end");
- }
- }
-
- public void remove() {
- throw new UnsupportedOperationException("remove()");
- }
- };
- }
-
- public int length() {
- return segments.length;
- }
-}
16 years, 1 month
JBoss Remoting SVN: r4687 - remoting3/trunk/testing-support/src/main/resources.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 16:32:52 -0500 (Fri, 14 Nov 2008)
New Revision: 4687
Modified:
remoting3/trunk/testing-support/src/main/resources/testing.policy
Log:
More strict testing permissions
Modified: remoting3/trunk/testing-support/src/main/resources/testing.policy
===================================================================
--- remoting3/trunk/testing-support/src/main/resources/testing.policy 2008-11-14 20:09:27 UTC (rev 4686)
+++ remoting3/trunk/testing-support/src/main/resources/testing.policy 2008-11-14 21:32:52 UTC (rev 4687)
@@ -16,7 +16,6 @@
grant codeBase "file:${build.home}/protocol/basic/target/test/classes/-"
{
permission java.lang.RuntimePermission "modifyThread"; // for executor control
- permission java.net.SocketPermission "*:*", "accept, connect, resolve";
permission org.jboss.remoting.EndpointPermission "createRequestHandler";
permission org.jboss.remoting.EndpointPermission "createClient";
};
@@ -24,9 +23,10 @@
grant codeBase "file:${build.home}/protocol/multiplex/target/test/classes/-"
{
permission java.lang.RuntimePermission "modifyThread"; // for executor control
- permission java.net.SocketPermission "*:*", "accept, connect, resolve";
permission org.jboss.remoting.EndpointPermission "createRequestHandler";
permission org.jboss.remoting.EndpointPermission "createClient";
+ permission org.jboss.remoting.EndpointPermission "createClientSource";
+ permission org.jboss.remoting.EndpointPermission "registerService";
};
// Permissions for Remoting itself
16 years, 1 month
JBoss Remoting SVN: r4686 - remoting3/trunk/version/src/main/java/org/jboss/remoting/version.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 15:09:27 -0500 (Fri, 14 Nov 2008)
New Revision: 4686
Modified:
remoting3/trunk/version/src/main/java/org/jboss/remoting/version/Version.java
Log:
Next release will be Beta2
Modified: remoting3/trunk/version/src/main/java/org/jboss/remoting/version/Version.java
===================================================================
--- remoting3/trunk/version/src/main/java/org/jboss/remoting/version/Version.java 2008-11-14 20:08:37 UTC (rev 4685)
+++ remoting3/trunk/version/src/main/java/org/jboss/remoting/version/Version.java 2008-11-14 20:09:27 UTC (rev 4686)
@@ -11,7 +11,7 @@
/**
* The version.
*/
- public static final String VERSION = "3.0.0.Beta1";
+ public static final String VERSION = "3.0.0.Beta2";
/**
* Print the version to {@code System.out}.
16 years, 1 month
JBoss Remoting SVN: r4685 - remoting3/tags.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-11-14 15:08:37 -0500 (Fri, 14 Nov 2008)
New Revision: 4685
Added:
remoting3/tags/3.0.0.Beta1/
Log:
Release Beta1
Copied: remoting3/tags/3.0.0.Beta1 (from rev 4684, remoting3/trunk)
16 years, 1 month