You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by js...@apache.org on 2006/06/30 19:01:43 UTC

svn commit: r418329 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java

Author: jstrachan
Date: Fri Jun 30 10:01:43 2006
New Revision: 418329

URL: http://svn.apache.org/viewvc?rev=418329&view=rev
Log:
support the dynamic resolution of service: URIs

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java?rev=418329&r1=418328&r2=418329&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java Fri Jun 30 10:01:43 2006
@@ -301,6 +301,12 @@
                             String[] parts = split(uri);
                             return getInternalEndpoint(new QName(parts[0], parts[1]), parts[2]);
                         }
+                        else if (uri.startsWith("service:")) {
+                            uri = uri.substring("service:".length());
+                            String[] parts = splitService(uri);
+                            return getEndpoint(new QName(parts[0], parts[1]), parts[1]);
+                        }
+                        // TODO should we support interface: and operation: here?
                     }
                 }
             }
@@ -310,6 +316,20 @@
         return null;
     }
 
+    protected String[] splitService(String uri) {
+        char sep;
+        uri = uri.trim();
+        if (uri.indexOf('/') > 0) {
+            sep = '/';
+        } else {
+            sep = ':';
+        }
+        int idx1 = uri.lastIndexOf(sep);
+        String svcName = uri.substring(idx1 + 1);
+        String nsUri   = uri.substring(0, idx1);
+        return new String[] { nsUri, svcName };
+    }
+    
     protected String[] split(String uri) {
         char sep;
         uri = uri.trim();