You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2007/02/07 17:19:42 UTC

svn commit: r504606 [5/5] - in /incubator/tuscany/java/sca/kernel: core/src/main/java/org/apache/tuscany/core/binding/local/ core/src/main/java/org/apache/tuscany/core/bootstrap/ core/src/main/java/org/apache/tuscany/core/builder/ core/src/main/java/or...

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java Wed Feb  7 08:19:34 2007
@@ -47,6 +47,7 @@
 import org.apache.tuscany.spi.event.Event;
 import org.apache.tuscany.spi.model.Scope;
 import org.apache.tuscany.spi.services.management.TuscanyManagementService;
+import org.apache.tuscany.spi.util.UriHelper;
 import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.OutboundWire;
 import org.apache.tuscany.spi.wire.Wire;
@@ -64,15 +65,9 @@
     protected final Map<String, Document> propertyValues;
     protected final Connector connector;
 
-    protected final Map<String, SCAObject> systemChildren = new ConcurrentHashMap<String, SCAObject>();
-    protected final List<Service> systemServices = new ArrayList<Service>();
-    protected final List<Reference> systemReferenceBindings = new ArrayList<Reference>();
-
     // autowire mappings
     protected final Map<Class, InboundWire> autowireInternal = new ConcurrentHashMap<Class, InboundWire>();
     protected final Map<Class, InboundWire> autowireExternal = new ConcurrentHashMap<Class, InboundWire>();
-    protected final Map<Class, InboundWire> systemAutowireInternal = new ConcurrentHashMap<Class, InboundWire>();
-    protected final Map<Class, InboundWire> systemAutowireExternal = new ConcurrentHashMap<Class, InboundWire>();
 
     /**
      * Management service to use.
@@ -125,57 +120,41 @@
         return children.get(name);
     }
 
-    public SCAObject getSystemChild(String name) {
-        assert name != null;
-        return systemChildren.get(name);
-    }
-
     public void register(SCAObject child) throws ComponentRegistrationException {
         assert child instanceof Service || child instanceof Reference || child instanceof Component;
-        if (child.isSystem()) {
-            if (systemChildren.get(child.getName()) != null) {
-                throw new DuplicateNameException("A system child is already registered with the name", child.getName());
-            }
-            systemChildren.put(child.getName(), child);
+        String name;
+        // TODO JFM should just use fragment when only refs and services are registered
+        if (child.getUri().getFragment() != null) {
+            name = child.getUri().getFragment();
         } else {
-            if (children.get(child.getName()) != null) {
-                throw new DuplicateNameException("A child is already registered with the name", child.getName());
-            }
-            children.put(child.getName(), child);
+            name = UriHelper.getBaseName(child.getUri());
         }
+        if (children.get(name) != null) {
+            String uri = child.getUri().toString();
+            throw new DuplicateNameException("A child is already registered with the name", uri);
+        }
+        children.put(name, child);
         if (child instanceof Service) {
             Service service = (Service) child;
             synchronized (services) {
-                if (service.isSystem()) {
-                    systemServices.add(service);
-                } else {
-                    services.add(service);
-                }
+                services.add(service);
             }
             registerAutowire(service);
         } else if (child instanceof Reference) {
             Reference reference = (Reference) child;
             synchronized (references) {
-                if (reference.isSystem()) {
-                    systemReferenceBindings.add(reference);
-                } else {
-                    references.add(reference);
-                }
+                references.add(reference);
             }
             registerAutowire(reference);
         } else if (child instanceof AtomicComponent) {
             AtomicComponent atomic = (AtomicComponent) child;
             registerAutowire(atomic);
             if (managementService != null) {
-                managementService.registerComponent(atomic.getName(), atomic);
+                managementService.registerComponent(atomic.getUri().toString(), atomic);
             }
         } else if (child instanceof CompositeComponent) {
             CompositeComponent component = (CompositeComponent) child;
-            if (lifecycleState == RUNNING && component.getLifecycleState() == UNINITIALIZED) {
-                component.start();
-            }
             registerAutowire(component);
-            addListener(component);
         }
     }
 
@@ -184,7 +163,7 @@
             Map<String, List<OutboundWire>> map = new HashMap<String, List<OutboundWire>>();
             for (Reference reference : references) {
                 List<OutboundWire> wires = new ArrayList<OutboundWire>();
-                map.put(reference.getName(), wires);
+                map.put(reference.getUri().getFragment(), wires);
                 for (ReferenceBinding binding : reference.getReferenceBindings()) {
                     OutboundWire wire = binding.getOutboundWire();
                     if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
@@ -219,25 +198,44 @@
         return null;
     }
 
-    public InboundWire getInboundSystemWire(String serviceName) {
-        Service service;
-        if (serviceName == null) {
-            if (systemServices.size() != 1) {
-                return null;
+    public InboundWire getTargetWire(String targetName) {
+        SCAObject object = null;
+        if (targetName == null) {
+            if (services.size() == 1) {
+                object = services.get(0);
+            } else if (references.size() == 1) {
+                object = references.get(0);
             }
-            service = systemServices.get(0);
         } else {
-            SCAObject object = systemChildren.get(serviceName);
-            if (!(object instanceof Service)) {
+            object = children.get(targetName);
+        }
+        if (object instanceof Service) {
+            Service service = (Service) object;
+            List<ServiceBinding> bindings = service.getServiceBindings();
+            if (bindings.isEmpty()) {
                 return null;
             }
-            service = (Service) object;
-        }
-        for (ServiceBinding binding : service.getServiceBindings()) {
-            InboundWire wire = binding.getInboundWire();
-            if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
-                return wire;
+            for (ServiceBinding binding : bindings) {
+                InboundWire wire = binding.getInboundWire();
+                if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
+                    return wire;
+                }
             }
+            // for now, pick the first one
+            return bindings.get(0).getInboundWire();
+        } else if (object instanceof Reference) {
+            Reference reference = (Reference) object;
+            List<ReferenceBinding> bindings = reference.getReferenceBindings();
+            if (bindings.isEmpty()) {
+                return null;
+            }
+            for (ReferenceBinding binding : bindings) {
+                InboundWire wire = binding.getInboundWire();
+                if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
+                    return wire;
+                }
+            }
+            return bindings.get(0).getInboundWire();
         }
         return null;
     }
@@ -257,21 +255,6 @@
         }
     }
 
-    public Collection<InboundWire> getInboundSystemWires() {
-        synchronized (systemServices) {
-            List<InboundWire> map = new ArrayList<InboundWire>();
-            for (Service service : systemServices) {
-                for (ServiceBinding binding : service.getServiceBindings()) {
-                    InboundWire wire = binding.getInboundWire();
-                    if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
-                        map.add(wire);
-                    }
-                }
-            }
-            return map;
-        }
-    }
-
     public InboundWire resolveAutowire(Class<?> instanceInterface) throws TargetResolutionException {
         // FIXME JNB make this faster and thread safe
         for (Map.Entry<Class, InboundWire> service : autowireInternal.entrySet()) {
@@ -285,19 +268,6 @@
         return null;
     }
 
-    public InboundWire resolveSystemAutowire(Class<?> instanceInterface) throws TargetResolutionException {
-        // FIXME JNB make this faster and thread safe
-        for (Map.Entry<Class, InboundWire> service : systemAutowireInternal.entrySet()) {
-            if (instanceInterface.isAssignableFrom(service.getKey())) {
-                return service.getValue();
-            }
-        }
-        if (getParent() != null) {
-            return getParent().resolveSystemAutowire(instanceInterface);
-        }
-        return null;
-    }
-
     public InboundWire resolveExternalAutowire(Class<?> instanceInterface) throws TargetResolutionException {
         // FIXME JNB make this faster and thread safe
         for (Map.Entry<Class, InboundWire> service : autowireExternal.entrySet()) {
@@ -311,29 +281,9 @@
         return null;
     }
 
-    public InboundWire resolveSystemExternalAutowire(Class<?> instanceInterface) throws TargetResolutionException {
-        // FIXME JNB make this faster and thread safe
-        for (Map.Entry<Class, InboundWire> service : systemAutowireExternal.entrySet()) {
-            if (instanceInterface.isAssignableFrom(service.getKey())) {
-                return service.getValue();
-            }
-        }
-        if (getParent() != null) {
-            return getParent().resolveAutowire(instanceInterface);
-        }
-        return null;
-    }
-
     public void prepare() throws PrepareException {
         // Connect services and references first so that their wires are linked first
         List<SCAObject> childList = new ArrayList<SCAObject>();
-        for (SCAObject child : systemChildren.values()) {
-            if (child instanceof Component) {
-                childList.add(child);
-            } else {
-                childList.add(0, child);
-            }
-        }
         // connect system artifacts
         for (SCAObject child : childList) {
             // connect all children
@@ -341,10 +291,8 @@
             try {
                 connector.connect(child);
                 child.prepare();
-            } catch (PrepareException e) {
-                e.addContextName(getName());
             } catch (WiringException e) {
-                throw new PrepareException("Error preparing composite", getName(), e);
+                throw new PrepareException("Error preparing composite", getUri().toString(), e);
             }
         }
 
@@ -363,11 +311,8 @@
             try {
                 connector.connect(child);
                 child.prepare();
-            } catch (PrepareException e) {
-                e.addContextName(getName());
-                throw e;
             } catch (WiringException e) {
-                throw new PrepareException("Error preparing composite", getName(), e);
+                throw new PrepareException("Error preparing composite", getUri().toString(), e);
             }
         }
     }
@@ -377,62 +322,36 @@
             // The ServiceContract is not from Java
             return;
         }
-        if (service.isSystem()) {
-            if (systemAutowireExternal.containsKey(interfaze)) {
-                return;
-            }
-            // TODO autowire should allow multiple interfaces
-            List<ServiceBinding> bindings = service.getServiceBindings();
-            if (bindings.size() == 0) {
-                return;
-            }
-            // pick the first binding until autowire allows multiple interfaces
-            InboundWire wire = bindings.get(0).getInboundWire();
-            if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
-                throw new InvalidAutowireInterface("Matching inbound wire not found for interface",
-                    interfaze.getName());
-            }
-            systemAutowireExternal.put(interfaze, wire);
-        } else {
-            if (autowireExternal.containsKey(interfaze)) {
-                return;
-            }
-            // TODO autowire should allow multiple interfaces
-            List<ServiceBinding> bindings = service.getServiceBindings();
-            if (bindings.size() == 0) {
-                return;
-            }
-            // pick the first binding until autowire allows multiple interfaces
-            InboundWire wire = bindings.get(0).getInboundWire();
-            if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
-                String iName = interfaze.getName();
-                throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
-            }
-            autowireExternal.put(interfaze, wire);
+        if (autowireExternal.containsKey(interfaze)) {
+            return;
+        }
+        // TODO autowire should allow multiple interfaces
+        List<ServiceBinding> bindings = service.getServiceBindings();
+        if (bindings.size() == 0) {
+            return;
+        }
+        // pick the first binding until autowire allows multiple interfaces
+        InboundWire wire = bindings.get(0).getInboundWire();
+        if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+            String iName = interfaze.getName();
+            throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
         }
+        autowireExternal.put(interfaze, wire);
     }
 
-    protected void registerAutowireInternal(Class<?> interfaze, InboundWire wire, boolean system)
-        throws InvalidAutowireInterface {
+    protected void registerAutowireInternal(Class<?> interfaze, InboundWire wire) throws InvalidAutowireInterface {
         if (interfaze == null) {
             // The ServiceContract is not from Java
             return;
         }
-        if (system) {
-            if (systemAutowireInternal.containsKey(interfaze)) {
-                return;
-            }
-            systemAutowireInternal.put(interfaze, wire);
-        } else {
-            if (autowireInternal.containsKey(interfaze)) {
-                return;
-            }
-            if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
-                String iName = interfaze.getName();
-                throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
-            }
-            autowireInternal.put(interfaze, wire);
+        if (autowireInternal.containsKey(interfaze)) {
+            return;
+        }
+        if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+            String iName = interfaze.getName();
+            throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
         }
+        autowireInternal.put(interfaze, wire);
     }
 
     protected void registerAutowireInternal(Class<?> interfaze, Reference reference) throws InvalidAutowireInterface {
@@ -440,37 +359,20 @@
             // The ServiceContract is not from Java
             return;
         }
-        if (reference.isSystem()) {
-            if (systemAutowireInternal.containsKey(interfaze)) {
-                return;
-            }
-            List<ReferenceBinding> bindings = reference.getReferenceBindings();
-            if (bindings.size() == 0) {
-                return;
-            }
-            // pick the first binding until autowire allows multiple interfaces
-            InboundWire wire = bindings.get(0).getInboundWire();
-            if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
-                throw new InvalidAutowireInterface("Matching inbound wire not found for interface",
-                    interfaze.getName());
-            }
-            systemAutowireInternal.put(interfaze, wire);
-        } else {
-            if (autowireInternal.containsKey(interfaze)) {
-                return;
-            }
-            List<ReferenceBinding> bindings = reference.getReferenceBindings();
-            if (bindings.size() == 0) {
-                return;
-            }
-            // pick the first binding until autowire allows multiple interfaces
-            InboundWire wire = bindings.get(0).getInboundWire();
-            if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
-                String iName = interfaze.getName();
-                throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
-            }
-            autowireInternal.put(interfaze, wire);
+        if (autowireInternal.containsKey(interfaze)) {
+            return;
+        }
+        List<ReferenceBinding> bindings = reference.getReferenceBindings();
+        if (bindings.size() == 0) {
+            return;
+        }
+        // pick the first binding until autowire allows multiple interfaces
+        InboundWire wire = bindings.get(0).getInboundWire();
+        if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+            String iName = interfaze.getName();
+            throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
         }
+        autowireInternal.put(interfaze, wire);
     }
 
     protected void registerAutowireInternal(Class<?> interfaze, AtomicComponent component)
@@ -479,48 +381,24 @@
             // The ServiceContract is not from Java
             return;
         }
-        if (component.isSystem()) {
-            if (systemAutowireInternal.containsKey(interfaze) || component.getInboundWires().size() == 0) {
-                return;
-            }
-            for (InboundWire wire : component.getInboundWires()) {
-                Class<?> clazz = wire.getServiceContract().getInterfaceClass();
-                if (clazz.isAssignableFrom(interfaze)) {
-                    systemAutowireInternal.put(interfaze, wire);
-                    return;
-                }
-            }
-            throw new InvalidAutowireInterface("Matching inbound wire not found for interface", interfaze.getName());
-        } else {
-            if (autowireInternal.containsKey(interfaze) || component.getInboundWires().size() == 0) {
+        if (autowireInternal.containsKey(interfaze) || component.getInboundWires().size() == 0) {
+            return;
+        }
+        for (InboundWire wire : component.getInboundWires()) {
+            if (interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+                autowireInternal.put(interfaze, wire);
                 return;
             }
-            for (InboundWire wire : component.getInboundWires()) {
-                if (interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
-                    autowireInternal.put(interfaze, wire);
-                    return;
-                }
-            }
-            throw new InvalidAutowireInterface("Matching inbound wire not found for interface", interfaze.getName());
         }
+        throw new InvalidAutowireInterface("Matching inbound wire not found for interface", interfaze.getName());
     }
 
     protected void registerAutowire(CompositeComponent component) throws InvalidAutowireInterface {
-        if (component.isSystem()) {
-            // the composite is under the system hierarchy so only register its system services
-            Collection<InboundWire> wires = component.getInboundSystemWires();
-            for (InboundWire wire : wires) {
-                Class<?> clazz = wire.getServiceContract().getInterfaceClass();
-                registerAutowireInternal(clazz, wire, true);
-            }
-
-        } else {
-            // the composite is under the application hierarchy so only register its non-system services
-            Collection<InboundWire> wires = component.getInboundWires();
-            for (InboundWire wire : wires) {
-                Class<?> clazz = wire.getServiceContract().getInterfaceClass();
-                registerAutowireInternal(clazz, wire, false);
-            }
+        // the composite is under the application hierarchy so only register its non-system services
+        Collection<InboundWire> wires = component.getInboundWires();
+        for (InboundWire wire : wires) {
+            Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+            registerAutowireInternal(clazz, wire);
         }
     }
 

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java Wed Feb  7 08:19:34 2007
@@ -72,9 +72,4 @@
         return bindingServiceContract;
     }
 
-    @Override
-    public boolean isSystem() {
-        return reference != null && reference.isSystem();
-    }
-
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java Wed Feb  7 08:19:34 2007
@@ -81,9 +81,4 @@
         return bindingServiceContract;
     }
 
-    @Override
-    public boolean isSystem() {
-        return service != null && service.isSystem();
-    }
-
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java Wed Feb  7 08:19:34 2007
@@ -40,8 +40,4 @@
         throw new UnsupportedOperationException();
     }
 
-    public boolean isSystem() {
-        return true;
-    }
-
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java Wed Feb  7 08:19:34 2007
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.LinkedList;
+import java.net.URI;
 
 import org.apache.tuscany.spi.component.WorkContext;
 import org.apache.tuscany.spi.wire.InboundWire;
@@ -59,7 +60,7 @@
                 workContext.setCurrentCorrelationId(messageId);
             }
             if (wire != null) {
-                LinkedList<Object> callbackRoutingChain = msg.getCallbackRoutingChain();
+                LinkedList<URI> callbackRoutingChain = msg.getCallbackRoutingChain();
                 if (callbackRoutingChain != null) {
                     workContext.setCurrentCallbackRoutingChain(callbackRoutingChain);
                 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java Wed Feb  7 08:19:34 2007
@@ -39,7 +39,7 @@
  * @version $Rev$ $Date$
  */
 public class ComponentDefinition<I extends Implementation<?>> extends ModelObject {
-    private URI name;
+    private URI uri;
     private Integer initLevel;
     private final I implementation;
     private final Map<String, ReferenceTarget> referenceTargets = new HashMap<String, ReferenceTarget>();
@@ -48,11 +48,11 @@
     /**
      * Constructor specifying the component's name and implementation.
      *
-     * @param name           the name of this component
+     * @param uri           the name of this component
      * @param implementation the implementation of this component
      */
-    public ComponentDefinition(URI name, I implementation) {
-        this.name = name;
+    public ComponentDefinition(URI uri, I implementation) {
+        this.uri = uri;
         this.implementation = implementation;
     }
 
@@ -79,17 +79,17 @@
      *
      * @return the name of this component
      */
-    public URI getName() {
-        return name;
+    public URI getUri() {
+        return uri;
     }
 
     /**
      * Sets the name of this component.
      *
-     * @param name the name of this component
+     * @param uri the name of this component
      */
-    public void setName(URI name) {
-        this.name = name;
+    public void setUri(URI uri) {
+        this.uri = uri;
     }
 
     /**

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java Wed Feb  7 08:19:34 2007
@@ -163,7 +163,7 @@
 
 
     public void add(ComponentDefinition<? extends Implementation<?>> componentDefinition) {
-        components.put(UriHelper.getBaseName(componentDefinition.getName()), componentDefinition);
+        components.put(UriHelper.getBaseName(componentDefinition.getUri()), componentDefinition);
     }
 
     public Map<String, Include> getIncludes() {

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java Wed Feb  7 08:19:34 2007
@@ -21,6 +21,8 @@
 import java.net.URI;
 
 /**
+ * Utility methods for handling URIs
+ *
  * @version $Rev$ $Date$
  */
 public final class UriHelper {
@@ -44,4 +46,42 @@
         }
     }
 
+    /**
+     * Returns the parent name for a component URI, e.g. 'sca://Foo' for 'sca://Foo/Bar'
+     *
+     * @param uri the URI to parse
+     * @return the base name
+     */
+    public static String getParentName(URI uri) {
+        String s = uri.toString();
+        int pos = s.lastIndexOf('/');
+        int len = 0;
+        if (uri.getScheme() != null) {
+            len = uri.getScheme().length() + 3;
+        }
+        if ((len == 0 && pos > 0) || pos > len) {
+            return s.substring(0, pos);
+        } else {
+            return "";
+        }
+    }
+
+    /**
+     * Returns the parent component name as a URI
+     *
+     * @param uri the child URI
+     * @return the parent component name
+     */
+    public static URI getParentNameAsUri(URI uri) {
+        return URI.create(getParentName(uri));
+    }
+
+    public static URI getDefragmentedName(URI uri) {
+        if (uri.getFragment() == null) {
+            return uri;
+        }
+        String s = uri.toString();
+        int pos = s.lastIndexOf('#');
+        return URI.create(s.substring(0, pos));
+    }
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java Wed Feb  7 08:19:34 2007
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.LinkedList;
+import java.net.URI;
 
 import org.apache.tuscany.spi.model.InteractionScope;
 import org.apache.tuscany.spi.model.Operation;
@@ -38,7 +39,7 @@
                             TargetInvoker invoker,
                             Object[] args,
                             Object correlationId,
-                            LinkedList<Object> callbackRoutingChain)
+                            LinkedList<URI> callbackRoutingChain)
         throws Throwable {
         Interceptor headInterceptor = chain.getHeadInterceptor();
         if (headInterceptor == null) {
@@ -57,7 +58,7 @@
         } else {
             Message msg = new MessageImpl();
             msg.setTargetInvoker(invoker);
-            Object fromAddress = getFromAddress();
+            URI fromAddress = getFromAddress();
             if (fromAddress != null && callbackRoutingChain != null) {
                 throw new AssertionError("Can't use both a from address and callback routing chain");
             }
@@ -97,7 +98,7 @@
         }
     }
 
-    protected Object getFromAddress() {
+    protected URI getFromAddress() {
         // Default to null, only needed in outbound (forward) direction
         return null;
     }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java Wed Feb  7 08:19:34 2007
@@ -19,6 +19,7 @@
 package org.apache.tuscany.spi.wire;
 
 import java.util.Map;
+import java.net.URI;
 
 import org.apache.tuscany.spi.model.Operation;
 
@@ -49,17 +50,17 @@
      * Returns the callback invocation configuration for each operation on a service specified by a reference or a
      * target service.
      */
-    Map<Operation<?>, OutboundInvocationChain> getSourceCallbackInvocationChains(Object targetAddr);
+    Map<Operation<?>, OutboundInvocationChain> getSourceCallbackInvocationChains(URI targetAddr);
 
     /**
      * Adds the collection of callback invocation chains keyed by operation for a given target addr
      */
-    void addSourceCallbackInvocationChains(Object targetAddr, Map<Operation<?>, OutboundInvocationChain> chains);
+    void addSourceCallbackInvocationChains(URI targetAddr, Map<Operation<?>, OutboundInvocationChain> chains);
 
     /**
      * Adds the callback invocation chain associated with the given operation for a given target addr
      */
-    void addSourceCallbackInvocationChain(Object targetAddr, Operation<?> operation, OutboundInvocationChain chain);
+    void addSourceCallbackInvocationChain(URI targetAddr, Operation<?> operation, OutboundInvocationChain chain);
 
     /**
      * Returns the name of the callback associated with the service of the wire

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java Wed Feb  7 08:19:34 2007
@@ -19,6 +19,7 @@
 package org.apache.tuscany.spi.wire;
 
 import java.util.LinkedList;
+import java.net.URI;
 
 /**
  * Represents a request, response, or exception flowing through a wire
@@ -50,22 +51,22 @@
     /**
      * Returns the latest 'address' of the SCAObject where this message originated
      */
-    Object popFromAddress();
+    URI popFromAddress();
 
     /**
      * Adds the latest 'address' of the SCAObject where this message originated
      */
-    void pushFromAddress(Object fromAddress);
+    void pushFromAddress(URI fromAddress);
 
     /**
      * Returns the chain of SCAObject addresses
      */
-    LinkedList<Object> getCallbackRoutingChain();
+    LinkedList<URI> getCallbackRoutingChain();
 
     /**
      * Sets the chain of SCAObject addresses
      */
-    void setCallbackRoutingChain(LinkedList<Object> fromAddresses);
+    void setCallbackRoutingChain(LinkedList<URI> fromAddresses);
 
     /**
      * Returns the id of the message

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java Wed Feb  7 08:19:34 2007
@@ -19,6 +19,7 @@
 package org.apache.tuscany.spi.wire;
 
 import java.util.LinkedList;
+import java.net.URI;
 
 /**
  * The default implementation of a message flowed through a wire during an invocation
@@ -28,7 +29,7 @@
 public class MessageImpl implements Message {
     private Object body;
     private TargetInvoker invoker;
-    private LinkedList<Object> callbackRoutingChain;
+    private LinkedList<URI> callbackRoutingChain;
     private Object messageId;
     private Object correlationId;
     private boolean isFault;
@@ -54,22 +55,22 @@
         return invoker;
     }
 
-    public Object popFromAddress() {
+    public URI popFromAddress() {
         return callbackRoutingChain.removeFirst();
     }
 
-    public void pushFromAddress(Object fromAddress) {
+    public void pushFromAddress(URI fromAddress) {
         if (callbackRoutingChain == null) {
-            callbackRoutingChain = new LinkedList<Object>();
+            callbackRoutingChain = new LinkedList<URI>();
         }
         callbackRoutingChain.addFirst(fromAddress);
     }
 
-    public LinkedList<Object> getCallbackRoutingChain() {
+    public LinkedList<URI> getCallbackRoutingChain() {
         return callbackRoutingChain;
     }
 
-    public void setCallbackRoutingChain(LinkedList<Object> callbackRoutingChain) {
+    public void setCallbackRoutingChain(LinkedList<URI> callbackRoutingChain) {
         this.callbackRoutingChain = callbackRoutingChain;
     }
 

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java Wed Feb  7 08:19:34 2007
@@ -21,7 +21,6 @@
 import java.net.URI;
 import java.util.Map;
 
-import org.apache.tuscany.spi.QualifiedName;
 import org.apache.tuscany.spi.model.Operation;
 
 /**
@@ -34,16 +33,6 @@
 public interface OutboundWire extends Wire {
 
     /**
-     * Returns the name of the target
-     */
-    QualifiedName getTargetName();
-
-    /**
-     * Sets the name of the target
-     */
-    void setTargetName(QualifiedName name);
-
-    /**
      * Returns the URI of the wire target
      *
      * @return the URI of the wire target
@@ -57,8 +46,14 @@
      */
     void setTargetUri(URI uri);
 
+    /**
+     * @deprecated
+     */
     boolean isAutowire();
 
+    /**
+     * @deprecated
+     */
     void setAutowire(boolean val);
 
     /**

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java Wed Feb  7 08:19:34 2007
@@ -87,11 +87,13 @@
 
     /**
      * Returns the SCAObject that contains this wire
+     * @deprecated 
      */
     SCAObject getContainer();
 
     /**
      * Sets the name of the SCAObject that contains this wire
+     * @deprecated
      */
     void setContainer(SCAObject container);
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java Wed Feb  7 08:19:34 2007
@@ -19,9 +19,9 @@
 package org.apache.tuscany.spi.wire;
 
 import java.lang.reflect.Method;
+import java.net.URI;
 import java.util.Map;
 
-import org.apache.tuscany.spi.QualifiedName;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.ReferenceBinding;
 import org.apache.tuscany.spi.component.ServiceBinding;
@@ -118,7 +118,7 @@
      * @param targetName       the qualified target name or null if the reference referes to a target outside the SCA
      *                         domain
      */
-    void createWires(ReferenceBinding referenceBinding, ServiceContract<?> contract, QualifiedName targetName);
+    void createWires(ReferenceBinding referenceBinding, ServiceContract<?> contract, URI targetName);
 
     /**
      * Creates and injects wires for a service binding

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java Wed Feb  7 08:19:34 2007
@@ -80,12 +80,6 @@
         assertNotNull(object.toString());
     }
 
-    public void testGetName() throws Exception {
-        SCAObject object = new TestSCAObject(new URI("foo"), null);
-        assertEquals(new URI("foo"), object.getName());
-    }
-
-
     public void testToPrepare() throws Exception {
         SCAObject object = new TestSCAObject(new URI("foo"), null);
         object.prepare();

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java Wed Feb  7 08:19:34 2007
@@ -60,77 +60,12 @@
         wires.add(wire);
         AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
         EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
-        EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
-        EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+        EasyMock.expect(component.getUri()).andReturn(URI.create("component")).atLeastOnce();
         EasyMock.replay(component);
         composite.register(component);
         assertEquals(wire, composite.resolveAutowire(Foo.class));
     }
 
-    public void testAutowireSystemAtomicComponent() throws Exception {
-        InboundWire wire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
-        EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
-        EasyMock.replay(wire);
-        ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
-        EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
-        EasyMock.replay(binding);
-        List<InboundWire> wires = new ArrayList<InboundWire>();
-        wires.add(wire);
-        AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
-        EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
-        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
-        EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
-        EasyMock.replay(component);
-        composite.register(component);
-        assertEquals(wire, composite.resolveSystemAutowire(Foo.class));
-    }
-
-    public void testAutowireSystemCompositeComponent() throws Exception {
-        // configure service
-        InboundWire wire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
-        EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
-        EasyMock.replay(wire);
-        ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
-        EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
-        EasyMock.replay(binding);
-        Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
-        service.getServiceBindings();
-        List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
-        bindings.add(binding);
-        EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
-        EasyMock.replay(service);
-
-        // configure system service
-        InboundWire systemWire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(systemWire.getServiceContract()).andReturn(contract2).atLeastOnce();
-        EasyMock.expect(systemWire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
-        EasyMock.replay(systemWire);
-        ServiceBinding systemBinding = EasyMock.createMock(ServiceBinding.class);
-        EasyMock.expect(systemBinding.getInboundWire()).andReturn(systemWire).atLeastOnce();
-        EasyMock.replay(systemBinding);
-        Service systemService = EasyMock.createMock(Service.class);
-        EasyMock.expect(systemService.getName()).andReturn("systemService").atLeastOnce();
-        EasyMock.expect(systemService.isSystem()).andReturn(true).atLeastOnce();
-        systemService.getServiceBindings();
-        List<ServiceBinding> systemBindings = new ArrayList<ServiceBinding>();
-        systemBindings.add(systemBinding);
-        EasyMock.expectLastCall().andReturn(systemBindings).atLeastOnce();
-        EasyMock.replay(systemService);
-
-        CompositeComponent child = new MockComposite(true);
-        child.register(service);
-        child.register(systemService);
-        composite.register(child);
-        // since the child is registered under the system hierarchy, its services should not be visible from the
-        // applicaiton hierarchy
-        assertNull(composite.resolveAutowire(Foo.class));
-        assertEquals(systemWire, composite.resolveSystemAutowire(Bar.class));
-    }
-
     public void testAutowireCompositeComponent() throws Exception {
         // configure service
         InboundWire wire = EasyMock.createMock(InboundWire.class);
@@ -141,8 +76,7 @@
         EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
         EasyMock.replay(binding);
         Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service.getUri()).andReturn(URI.create("service")).atLeastOnce();
         service.getServiceBindings();
         List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
         bindings.add(binding);
@@ -158,8 +92,7 @@
         EasyMock.expect(systemBinding.getInboundWire()).andReturn(systemWire).atLeastOnce();
         EasyMock.replay(systemBinding);
         Service systemService = EasyMock.createMock(Service.class);
-        EasyMock.expect(systemService.getName()).andReturn("systemService").atLeastOnce();
-        EasyMock.expect(systemService.isSystem()).andReturn(true).atLeastOnce();
+        EasyMock.expect(systemService.getUri()).andReturn(URI.create("systemService")).atLeastOnce();
         systemService.getServiceBindings();
         List<ServiceBinding> systemBindings = new ArrayList<ServiceBinding>();
         systemBindings.add(systemBinding);
@@ -173,27 +106,6 @@
         // since the child is registered under the application hierarchy, its services should not be visible from the
         // system hierarchy
         assertEquals(wire, composite.resolveAutowire(Foo.class));
-        assertNull(composite.resolveSystemAutowire(Bar.class));
-    }
-
-    public void testAutowireSystemService() throws Exception {
-        InboundWire wire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
-        EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
-        EasyMock.replay(wire);
-        ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
-        EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
-        EasyMock.replay(binding);
-        Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
-        service.getServiceBindings();
-        List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
-        bindings.add(binding);
-        EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
-        EasyMock.replay(service);
-        composite.register(service);
-        assertEquals(wire, composite.resolveSystemExternalAutowire(Foo.class));
     }
 
     public void testAutowireService() throws Exception {
@@ -205,8 +117,7 @@
         EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
         EasyMock.replay(binding);
         Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service.getUri()).andReturn(URI.create("service")).atLeastOnce();
         service.getServiceBindings();
         List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
         bindings.add(binding);
@@ -225,8 +136,7 @@
         EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
         EasyMock.replay(binding);
         Reference reference = EasyMock.createMock(Reference.class);
-        EasyMock.expect(reference.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(reference.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(reference.getUri()).andReturn(URI.create("reference")).atLeastOnce();
         reference.getReferenceBindings();
         List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
         bindings.add(binding);
@@ -236,27 +146,6 @@
         assertEquals(wire, composite.resolveAutowire(Foo.class));
     }
 
-    public void testAutowireSystemReference() throws Exception {
-        InboundWire wire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
-        EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
-        EasyMock.replay(wire);
-        ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
-        EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
-        EasyMock.replay(binding);
-        Reference reference = EasyMock.createMock(Reference.class);
-        EasyMock.expect(reference.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(reference.isSystem()).andReturn(true).atLeastOnce();
-        reference.getReferenceBindings();
-        List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
-        bindings.add(binding);
-        EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
-        EasyMock.replay(reference);
-        composite.register(reference);
-        assertEquals(wire, composite.resolveSystemAutowire(Foo.class));
-    }
-
-
     protected void setUp() throws Exception {
         super.setUp();
         contract = new ServiceContract<Object>(Foo.class) {
@@ -286,10 +175,6 @@
         public MockComposite(boolean system) throws URISyntaxException {
             super(new URI("foo"), null, null, null);
             this.system = system;
-        }
-
-        public boolean isSystem() {
-            return system;
         }
 
         public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java Wed Feb  7 08:19:34 2007
@@ -18,11 +18,11 @@
  */
 package org.apache.tuscany.spi.extension;
 
+import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import java.net.URI;
 import javax.xml.namespace.QName;
 
 import org.apache.tuscany.spi.component.CompositeComponent;
@@ -58,8 +58,7 @@
         EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
         EasyMock.replay(binding);
         Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service.getUri()).andReturn(URI.create("composite#service")).atLeastOnce();
         service.getServiceBindings();
         List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
         bindings.add(binding);
@@ -78,8 +77,7 @@
         EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
         EasyMock.replay(binding);
         Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service.getUri()).andReturn(URI.create("composite#service")).atLeastOnce();
         service.getServiceBindings();
         List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
         bindings.add(binding);
@@ -89,37 +87,15 @@
         assertNull(composite.getInboundWire("service"));
     }
 
-    public void testDefaultSystemInboundWire() throws Exception {
-        InboundWire wire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
-        EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
-        EasyMock.replay(wire);
-        ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
-        EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
-        EasyMock.replay(binding);
-        Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
-        service.getServiceBindings();
-        List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
-        bindings.add(binding);
-        EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
-        EasyMock.replay(service);
-        composite.register(service);
-        assertEquals(wire, composite.getInboundSystemWire(null));
-    }
-
     public void testMoreThanOneServiceGetDefault() throws Exception {
         Service service1 = EasyMock.createMock(Service.class);
-        EasyMock.expect(service1.getName()).andReturn("service1").atLeastOnce();
-        EasyMock.expect(service1.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service1.getUri()).andReturn(URI.create("service1")).atLeastOnce();
         service1.getServiceBindings();
         EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
         EasyMock.replay(service1);
 
         Service service2 = EasyMock.createMock(Service.class);
-        EasyMock.expect(service2.getName()).andReturn("service2").atLeastOnce();
-        EasyMock.expect(service2.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service2.getUri()).andReturn(URI.create("service2")).atLeastOnce();
         service2.getServiceBindings();
         EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
         EasyMock.replay(service2);
@@ -127,7 +103,6 @@
         composite.register(service1);
         composite.register(service2);
         assertNull(composite.getInboundWire(null));
-        assertNull(composite.getInboundSystemWire(null));
     }
 
     public void testInboundWire() throws Exception {
@@ -143,8 +118,7 @@
         EasyMock.replay(binding);
 
         Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service.getUri()).andReturn(URI.create("composite#service")).atLeastOnce();
         List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
         bindings.add(binding);
         service.getServiceBindings();
@@ -167,8 +141,7 @@
         EasyMock.replay(binding);
 
         Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service.getUri()).andReturn(URI.create("composite#service")).atLeastOnce();
         List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
         bindings.add(binding);
         service.getServiceBindings();
@@ -191,8 +164,7 @@
         EasyMock.replay(binding);
 
         Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(service.getUri()).andReturn(URI.create("composite#service")).atLeastOnce();
         List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
         bindings.add(binding);
         service.getServiceBindings();
@@ -222,8 +194,7 @@
         EasyMock.expect(binding.getOutboundWire()).andReturn(outboundWire).atLeastOnce();
         EasyMock.replay(binding);
         Reference reference = EasyMock.createMock(Reference.class);
-        EasyMock.expect(reference.getName()).andReturn("reference").atLeastOnce();
-        EasyMock.expect(reference.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(reference.getUri()).andReturn(URI.create("composite#reference")).atLeastOnce();
         List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
         bindings.add(binding);
         EasyMock.expect(reference.getReferenceBindings()).andReturn(bindings).atLeastOnce();
@@ -254,8 +225,7 @@
         EasyMock.expect(binding.getOutboundWire()).andReturn(outboundWire).atLeastOnce();
         EasyMock.replay(binding);
         Reference reference = EasyMock.createMock(Reference.class);
-        EasyMock.expect(reference.getName()).andReturn("reference").atLeastOnce();
-        EasyMock.expect(reference.isSystem()).andReturn(false).atLeastOnce();
+        EasyMock.expect(reference.getUri()).andReturn(URI.create("composite#reference")).atLeastOnce();
         List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
         bindings.add(binding);
         EasyMock.expect(reference.getReferenceBindings()).andReturn(bindings).atLeastOnce();
@@ -263,54 +233,6 @@
         composite.register(reference);
         Map<String, List<OutboundWire>> wires = composite.getOutboundWires();
         assertEquals(0, wires.get("reference").size());
-    }
-
-    public void testInboundSystemWire() throws Exception {
-        ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
-        };
-        InboundWire wire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING);
-        wire.getServiceContract();
-        EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
-        EasyMock.replay(wire);
-        ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
-        EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
-        EasyMock.replay(binding);
-
-        Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
-        List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
-        bindings.add(binding);
-        service.getServiceBindings();
-        EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
-        EasyMock.replay(service);
-        composite.register(service);
-        assertNotNull(composite.getInboundSystemWire("service"));
-    }
-
-    public void testInboundSystemWires() throws Exception {
-        ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
-        };
-        InboundWire wire = EasyMock.createMock(InboundWire.class);
-        EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING);
-        wire.getServiceContract();
-        EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
-        EasyMock.replay(wire);
-        ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
-        EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
-        EasyMock.replay(binding);
-
-        Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
-        EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
-        List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
-        bindings.add(binding);
-        service.getServiceBindings();
-        EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
-        EasyMock.replay(service);
-        composite.register(service);
-        assertEquals(wire, composite.getInboundSystemWires().iterator().next());
     }
 
     protected void setUp() throws Exception {

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java Wed Feb  7 08:19:34 2007
@@ -3,7 +3,6 @@
 import java.net.URI;
 import javax.xml.namespace.QName;
 
-import org.apache.tuscany.spi.component.Reference;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
 import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.model.Scope;
@@ -11,7 +10,6 @@
 import org.apache.tuscany.spi.wire.TargetInvoker;
 
 import junit.framework.TestCase;
-import org.easymock.EasyMock;
 
 /**
  * @version $Rev$ $Date$
@@ -26,29 +24,6 @@
     public void testPrepare() throws Exception {
         ReferenceBindingExtension binding = new MockBindingExtension();
         binding.prepare();
-    }
-
-    public void testIsSystemNoParent() throws Exception {
-        ReferenceBindingExtension binding = new MockBindingExtension();
-        assertFalse(binding.isSystem());
-    }
-
-    public void testIsSystem() throws Exception {
-        Reference reference = EasyMock.createMock(Reference.class);
-        EasyMock.expect(reference.isSystem()).andReturn(true);
-        EasyMock.replay(reference);
-        ReferenceBindingExtension binding = new MockBindingExtension();
-        binding.setReference(reference);
-        assertTrue(binding.isSystem());
-    }
-
-    public void testIsNotSystem() throws Exception {
-        Reference reference = EasyMock.createMock(Reference.class);
-        EasyMock.expect(reference.isSystem()).andReturn(false);
-        EasyMock.replay(reference);
-        ReferenceBindingExtension binding = new MockBindingExtension();
-        binding.setReference(reference);
-        assertFalse(binding.isSystem());
     }
 
     private static class MockBindingExtension extends ReferenceBindingExtension {

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java Wed Feb  7 08:19:34 2007
@@ -19,13 +19,11 @@
 package org.apache.tuscany.spi.extension;
 
 import java.lang.reflect.Type;
+import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
-import java.net.URI;
-
 import javax.xml.namespace.QName;
 
-import org.apache.tuscany.spi.QualifiedName;
 import org.apache.tuscany.spi.model.Operation;
 import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
 import org.apache.tuscany.spi.model.Scope;
@@ -66,8 +64,6 @@
         chains.put(operation, chain);
         expectLastCall().andReturn(chains);
         OutboundWire outboundWire = createMock(OutboundWire.class);
-        outboundWire.getTargetName();
-        expectLastCall().andReturn(new QualifiedName("foo/bar"));
         replay(chain);
         replay(wire);
         replay(outboundWire);

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java Wed Feb  7 08:19:34 2007
@@ -21,17 +21,15 @@
 import java.net.URI;
 import javax.xml.namespace.QName;
 
-import org.apache.tuscany.spi.component.Service;
 import org.apache.tuscany.spi.model.Scope;
 
 import junit.framework.TestCase;
-import org.easymock.EasyMock;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ServiceBindingExtensionTestCase extends TestCase {
-    private URI uri;   
+    private URI uri;
 
     public void testScope() throws Exception {
         ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
@@ -50,42 +48,6 @@
         };
         binding.prepare();
     }
-
-    public void testIsSystemNoParent() throws Exception {
-        ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
-            public QName getBindingType() {
-                return null;
-            }
-        };
-        assertFalse(binding.isSystem());
-    }
-
-    public void testIsSystem() throws Exception {
-        Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.isSystem()).andReturn(true);
-        EasyMock.replay(service);
-        ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
-            public QName getBindingType() {
-                return null;
-            }
-        };
-        binding.setService(service);
-        assertTrue(binding.isSystem());
-    }
-
-    public void testIsNotSystem() throws Exception {
-        Service service = EasyMock.createMock(Service.class);
-        EasyMock.expect(service.isSystem()).andReturn(false);
-        EasyMock.replay(service);
-        ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
-            public QName getBindingType() {
-                return null;
-            }
-        };
-        binding.setService(service);
-        assertFalse(binding.isSystem());
-    }
-
 
     protected void setUp() throws Exception {
         super.setUp();

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java Wed Feb  7 08:19:34 2007
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.LinkedList;
+import java.net.URI;
 
 import org.apache.tuscany.spi.component.WorkContext;
 import org.apache.tuscany.spi.wire.InboundWire;
@@ -36,7 +37,7 @@
 
     @SuppressWarnings("unchecked")
     public void testStart() {
-        Object from = new Object();
+        URI from = URI.create("foo");
         InboundWire wire = EasyMock.createMock(InboundWire.class);
         EasyMock.replay(wire);
         WorkContext context;
@@ -60,7 +61,7 @@
 
     @SuppressWarnings("unchecked")
     public void testContinue() {
-        Object from = new Object();
+        URI from = URI.create("foo");
         InboundWire wire = EasyMock.createMock(InboundWire.class);
         EasyMock.replay(wire);
         WorkContext context;
@@ -84,7 +85,7 @@
 
     @SuppressWarnings("unchecked")
     public void testEnd() {
-        Object from = new Object();
+        URI from = URI.create("foo");
         InboundWire wire = EasyMock.createMock(InboundWire.class);
         EasyMock.replay(wire);
         WorkContext context;
@@ -108,7 +109,7 @@
 
     @SuppressWarnings("unchecked")
     public void testNone() {
-        Object from = new Object();
+        URI from = URI.create("foo");
         InboundWire wire = EasyMock.createMock(InboundWire.class);
         EasyMock.replay(wire);
         WorkContext context;

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java Wed Feb  7 08:19:34 2007
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.LinkedList;
+import java.net.URI;
 
 import org.apache.tuscany.spi.component.WorkContext;
 import org.apache.tuscany.spi.wire.InboundWire;
@@ -36,7 +37,7 @@
 
     @SuppressWarnings("unchecked")
     public void testNonBlockingDispatch() {
-        Object from = new Object();
+        URI from = URI.create("foo");
         InboundWire wire = EasyMock.createMock(InboundWire.class);
         EasyMock.replay(wire);
         WorkContext context;

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java Wed Feb  7 08:19:34 2007
@@ -47,4 +47,64 @@
         assertEquals("foo", UriHelper.getBaseName(uri));
     }
 
+    public void testBaseNameFragment() throws Exception {
+        URI uri = new URI("#foo");
+        assertEquals("#foo", UriHelper.getBaseName(uri));
+    }
+
+    public void testParentName() throws Exception {
+        URI uri = new URI("foo/bar");
+        assertEquals("foo", UriHelper.getParentName(uri));
+    }
+
+    public void testNoParentName() throws Exception {
+        URI uri = new URI("foo");
+        assertEquals("", UriHelper.getParentName(uri));
+    }
+
+    public void testNoParentNameScheme() throws Exception {
+        URI uri = new URI("sca://foo");
+        assertEquals("", UriHelper.getParentName(uri));
+    }
+
+    public void testParentNameScheme() throws Exception {
+        URI uri = new URI("sca://foo/bar");
+        assertEquals("sca://foo", UriHelper.getParentName(uri));
+    }
+
+    public void testMultiParentName() throws Exception {
+        URI uri = new URI("foo/bar/baz");
+        assertEquals("foo/bar", UriHelper.getParentName(uri));
+    }
+
+    public void testParentFragment() throws Exception {
+        URI uri = new URI("#baz");
+        assertEquals("", UriHelper.getParentName(uri));
+    }
+
+    public void testMultiParentNameScheme() throws Exception {
+        URI uri = new URI("sca://foo/bar/baz");
+        assertEquals("sca://foo/bar", UriHelper.getParentName(uri));
+    }
+
+    public void testParentNameSchemeFragment() throws Exception {
+        URI uri = new URI("sca://foo/bar#bar");
+        assertEquals("sca://foo", UriHelper.getParentName(uri));
+    }
+
+    public void testDefragmentedNameScheme() throws Exception {
+        URI uri = new URI("sca://foo/bar#bar");
+        assertEquals("sca://foo/bar", UriHelper.getDefragmentedName(uri).toString());
+    }
+
+    public void testDefragmentedName() throws Exception {
+        URI uri = new URI("foo/bar#bar");
+        assertEquals("foo/bar", UriHelper.getDefragmentedName(uri).toString());
+    }
+
+    public void testDefragmentedNoName() throws Exception {
+        URI uri = new URI("#bar");
+        assertEquals("", UriHelper.getDefragmentedName(uri).toString());
+    }
+
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java?view=diff&rev=504606&r1=504605&r2=504606
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java Wed Feb  7 08:19:34 2007
@@ -3,6 +3,7 @@
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
 import java.util.LinkedList;
+import java.net.URI;
 
 import junit.framework.TestCase;
 import org.easymock.EasyMock;
@@ -20,7 +21,7 @@
         OutboundInvocationChain chain = EasyMock.createMock(OutboundInvocationChain.class);
         EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor);
         EasyMock.replay(chain);
-        Object resp = handler.invoke(chain, invoker, new String[]{"foo"}, null, new LinkedList<Object>());
+        Object resp = handler.invoke(chain, invoker, new String[]{"foo"}, null, new LinkedList<URI>());
         assertEquals("response", resp);
     }
 
@@ -31,7 +32,7 @@
         EasyMock.expect(chain.getHeadInterceptor()).andReturn(null);
         EasyMock.expect(chain.getTargetInvoker()).andReturn(invoker);
         EasyMock.replay(chain);
-        Object resp = handler.invoke(chain, invoker, new String[]{"foo"}, null, new LinkedList<Object>());
+        Object resp = handler.invoke(chain, invoker, new String[]{"foo"}, null, new LinkedList<URI>());
         assertEquals("response", resp);
     }
 
@@ -67,8 +68,8 @@
 
     private class InvocationHandler extends AbstractOutboundInvocationHandler {
 
-        protected Object getFromAddress() {
-            return new Object();
+        protected URI getFromAddress() {
+            return URI.create("from");
         }
 
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org