[jboss-remoting-commits] JBoss Remoting SVN: r4688 - in remoting3/trunk: protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex and 2 other directories.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Nov 14 19:29:52 EST 2008


Author: david.lloyd at 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;
-    }
-}




More information about the jboss-remoting-commits mailing list