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/01/10 16:31:35 UTC

svn commit: r494851 - in /incubator/tuscany/java/sca: kernel/core/src/main/java/org/apache/tuscany/core/binding/local/ kernel/core/src/main/java/org/apache/tuscany/core/builder/ kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/co...

Author: jmarino
Date: Wed Jan 10 07:31:33 2007
New Revision: 494851

URL: http://svn.apache.org/viewvc?view=rev&rev=494851
Log:
start refactor to allow connect process to treat atomic and composite components alike, i.e. remove special cases for atomic components

Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceBinding.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceBinding.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java
    incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java
    incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java
    incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java
    incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java
    incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java
    incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java
    incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java
    incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java
    incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java
    incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java Wed Jan 10 07:31:33 2007
@@ -29,6 +29,7 @@
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.loader.StAXElementLoader;
 import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * Loader responsible for handling the local binding
@@ -36,11 +37,9 @@
  * @version $Rev$ $Date$
  */
 public class LocalBindingLoader implements StAXElementLoader {
-    private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
-    private static final QName BINDING = new QName(NS, "binding.local");
 
     public QName getXMLType() {
-        return BINDING;
+        return Wire.LOCAL_BINDING;
     }
 
     public ModelObject load(CompositeComponent parent,

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java Wed Jan 10 07:31:33 2007
@@ -1,5 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.tuscany.core.binding.local;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
@@ -7,6 +27,7 @@
 import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * The runtime representaion of the local reference binding
@@ -17,6 +38,10 @@
 
     public LocalReferenceBinding(String name, CompositeComponent parent) throws CoreRuntimeException {
         super(name, parent);
+    }
+
+    public QName getBindingType() {
+        return Wire.LOCAL_BINDING;
     }
 
     public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.core.binding.local;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
@@ -25,6 +27,7 @@
 import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * The runtime representaion of the local service binding
@@ -35,6 +38,10 @@
 
     public LocalServiceBinding(String name, CompositeComponent parent) throws CoreRuntimeException {
         super(name, parent);
+    }
+
+    public QName getBindingType() {
+        return Wire.LOCAL_BINDING;
     }
 
     public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java Wed Jan 10 07:31:33 2007
@@ -26,6 +26,7 @@
 import org.apache.tuscany.spi.QualifiedName;
 import org.apache.tuscany.spi.annotation.Autowire;
 import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.builder.MissingWireTargetException;
 import org.apache.tuscany.spi.builder.WiringException;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.Component;
@@ -53,7 +54,6 @@
 import org.apache.tuscany.spi.wire.WirePostProcessorRegistry;
 import org.apache.tuscany.spi.wire.WireService;
 
-import org.apache.tuscany.core.binding.local.LocalReferenceBinding;
 import org.apache.tuscany.core.wire.LoopBackWire;
 import org.apache.tuscany.core.wire.NonBlockingBridgingInterceptor;
 import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor;
@@ -85,8 +85,8 @@
     }
 
     public void connect(SCAObject source) throws WiringException {
-        if (source instanceof AtomicComponent) {
-            handleAtomic((AtomicComponent) source);
+        if (source instanceof Component) {
+            handleComponent((Component) source);
         } else if (source instanceof Reference) {
             handleReference((Reference) source);
         } else if (source instanceof Service) {
@@ -591,34 +591,10 @@
             OutboundWire outboundWire = binding.getOutboundWire();
             // connect the reference's inbound and outbound wires
             connect(inboundWire, outboundWire, true);
-
-            if (binding instanceof LocalReferenceBinding) {
-                String targetName = outboundWire.getTargetName().getPartName();
-                String serviceName = outboundWire.getTargetName().getPortName();
-                // A reference configured with the local binding is always connected to a target that is a sibling
-                // of the reference's parent composite.
-                parent = parent.getParent();
-                if (parent == null) {
-                    throw new TargetServiceNotFoundException("Reference target parent not found",
-                        reference.getName(),
-                        null,
-                        targetName,
-                        serviceName);
-                }
-                SCAObject target = parent.getChild(targetName);
-                if (target instanceof Reference) {
-                    throw new InvalidTargetTypeException("Invalid target type",
-                        reference.getName(),
-                        null,
-                        targetName,
-                        serviceName);
-                }
-                connect(binding, outboundWire, target);
-            }
         }
     }
 
-    private void handleAtomic(AtomicComponent component) throws WiringException {
+    private void handleComponent(Component component) throws WiringException {
         CompositeComponent parent = component.getParent();
         assert parent != null;
         // connect outbound wires for component references to their targets
@@ -637,6 +613,10 @@
                         if (outboundWire.isAutowire()) {
                             autowire(outboundWire, parent);
                         } else {
+                            if (outboundWire.getTargetName() == null) {
+                                String referenceName = outboundWire.getReferenceName();
+                                throw new MissingWireTargetException("Target name was null", referenceName);
+                            }
                             SCAObject target = parent.getChild(outboundWire.getTargetName().getPartName());
                             connect(component, outboundWire, target);
                         }
@@ -648,25 +628,28 @@
                 }
             }
         }
-        // connect inbound wires
-        for (InboundWire inboundWire : component.getInboundWires()) {
-            for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
-                Operation<?> operation = chain.getOperation();
-                String serviceName = inboundWire.getServiceName();
-                TargetInvoker invoker;
-                try {
-                    invoker = component.createTargetInvoker(serviceName, operation, null);
-                } catch (TargetInvokerCreationException e) {
-                    String targetName = inboundWire.getContainer().getName();
-                    throw new WireConnectException("Error processing inbound wire",
-                        null,
-                        null,
-                        targetName,
-                        serviceName,
-                        e);
+        if (component instanceof AtomicComponent) {
+            // connect inbound wires for atomic components
+            // JFM TODO this will be moved out to AtomicComponent prepare
+            for (InboundWire inboundWire : component.getInboundWires()) {
+                for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
+                    Operation<?> operation = chain.getOperation();
+                    String serviceName = inboundWire.getServiceName();
+                    TargetInvoker invoker;
+                    try {
+                        invoker = component.createTargetInvoker(serviceName, operation, null);
+                    } catch (TargetInvokerCreationException e) {
+                        String targetName = inboundWire.getContainer().getName();
+                        throw new WireConnectException("Error processing inbound wire",
+                            null,
+                            null,
+                            targetName,
+                            serviceName,
+                            e);
+                    }
+                    chain.setTargetInvoker(invoker);
+                    chain.prepare();
                 }
-                chain.setTargetInvoker(invoker);
-                chain.prepare();
             }
         }
     }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.core.implementation.system.component;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.component.AbstractSCAObject;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.Reference;
@@ -28,6 +30,7 @@
 import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.OutboundWire;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * Default implementation of a reference configured with the system binding
@@ -49,6 +52,10 @@
 
     public void setInboundWire(InboundWire wire) {
         this.inboundWire = wire;
+    }
+
+    public QName getBindingType() {
+        return Wire.LOCAL_BINDING;
     }
 
     public void setReference(Reference reference) {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceBinding.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.core.implementation.system.component;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.component.AbstractSCAObject;
 import org.apache.tuscany.spi.component.CompositeComponent;
@@ -30,6 +32,7 @@
 import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.OutboundWire;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * Runtime artifact for the system binding
@@ -46,6 +49,10 @@
         throws CoreRuntimeException {
         super(name, parent);
         this.serviceContract = serviceContract;
+    }
+
+    public QName getBindingType() {
+        return Wire.LOCAL_BINDING;
     }
 
     public void setService(Service service) {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java Wed Jan 10 07:31:33 2007
@@ -50,12 +50,25 @@
     private AtomicComponent targetComponent;
     private boolean optimizable;
 
-    public QName getBindingType() {
-        return bindingType;
+
+    /**
+     * Creates a local inbound wire
+     */
+    public InboundWireImpl() {
     }
 
-    public void setBindingType(QName bindingType) {
+
+    /**
+     * Creates an inbound wire for the given binding type
+     *
+     * @param bindingType the binding type
+     */
+    public InboundWireImpl(QName bindingType) {
         this.bindingType = bindingType;
+    }
+
+    public QName getBindingType() {
+        return bindingType;
     }
 
     public Object getTargetService() throws TargetResolutionException {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java Wed Jan 10 07:31:33 2007
@@ -51,9 +51,21 @@
     private boolean autowire;
     private boolean optimizable;
 
+    /**
+     * Creates a local outbound wire
+     */
     public OutboundWireImpl() {
     }
 
+    /**
+     * Creates an outbound wire for the given binding type
+     *
+     * @param bindingType the binding type
+     */
+    public OutboundWireImpl(QName bindingType) {
+        this.bindingType = bindingType;
+    }
+
     public void setOptimizable(boolean optimizable) {
         this.optimizable = optimizable;
     }
@@ -62,10 +74,6 @@
         return bindingType;
     }
 
-    public void setBindingType(QName bindingType) {
-        this.bindingType = bindingType;
-    }
-
     public Object getTargetService() throws TargetResolutionException {
         if (targetWire == null) {
             return null;
@@ -156,22 +164,6 @@
 
     public boolean isOptimizable() {
         return optimizable;
-//        for (OutboundInvocationChain chain : chains.values()) {
-//            if (chain.getHeadInterceptor() != null) {
-//                Interceptor current = chain.getHeadInterceptor();
-//                if (current == null) {
-//                    break;
-//                }
-//                while (current != null) {
-//                    if (!current.isOptimizable()) {
-//                        return false;
-//                    }
-//                    current = current.getNext();
-//                }
-//            }
-//        }
-//        // if there is a callback, the wire is never optimizable since the callback target needs to be disambiguated
-//        return callbackTargetChains.isEmpty();
     }
 
     public SCAObject getContainer() {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java Wed Jan 10 07:31:33 2007
@@ -103,14 +103,14 @@
     }
 
     public void createWires(ReferenceBinding referenceBinding, ServiceContract<?> contract, QualifiedName targetName) {
-        InboundWire inboundWire = new InboundWireImpl();
+        InboundWire inboundWire = new InboundWireImpl(referenceBinding.getBindingType());
         inboundWire.setServiceContract(contract);
         inboundWire.setContainer(referenceBinding);
         for (Operation<?> operation : contract.getOperations().values()) {
             InboundInvocationChain chain = createInboundChain(operation);
             inboundWire.addInvocationChain(operation, chain);
         }
-        OutboundWire outboundWire = new OutboundWireImpl();
+        OutboundWire outboundWire = new OutboundWireImpl(referenceBinding.getBindingType());
         outboundWire.setTargetName(targetName);
 
         // [rfeng] Check if the Reference has the binding contract
@@ -148,7 +148,7 @@
     }
 
     public void createWires(ServiceBinding serviceBinding, ServiceContract<?> contract, String targetName) {
-        InboundWire inboundWire = new InboundWireImpl();
+        InboundWire inboundWire = new InboundWireImpl(serviceBinding.getBindingType());
         // [rfeng] Check if the Reference has the serviceBinding contract
         ServiceContract<?> bindingContract = serviceBinding.getBindingServiceContract();
         if (bindingContract == null) {
@@ -163,7 +163,7 @@
             inboundWire.addInvocationChain(operation, inboundChain);
         }
 
-        OutboundWire outboundWire = new OutboundWireImpl();
+        OutboundWire outboundWire = new OutboundWireImpl(serviceBinding.getBindingType());
         outboundWire.setServiceContract(contract);
         outboundWire.setTargetName(new QualifiedName(targetName));
         outboundWire.setContainer(serviceBinding);

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java Wed Jan 10 07:31:33 2007
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.tuscany.core.builder;
 
 import java.lang.reflect.InvocationTargetException;
@@ -58,8 +76,6 @@
     protected ConnectorImpl connector;
     protected ServiceContract contract;
     protected Operation<Type> operation;
-    protected InboundWire localServiceInboundWire;
-    protected InboundWireImpl serviceInboundWire;
 
     protected void setUp() throws Exception {
         super.setUp();
@@ -80,6 +96,7 @@
 
         // create the target
         AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
+        EasyMock.expect(target.getName()).andReturn(TARGET).anyTimes();
         EasyMock.expect(target.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
         EasyMock.expect(target.isSystem()).andReturn(false).atLeastOnce();
         target.getInboundWire(EasyMock.eq(TARGET_SERVICE));
@@ -121,13 +138,12 @@
     }
 
 
-    protected Service createService() throws WireConnectException {
+    protected Service createServiceNonLocalBinding() throws WireConnectException {
         QName qName = new QName("foo", "bar");
         ServiceBinding serviceBinding = new MockServiceBinding();
         InboundInvocationChain targetInboundChain = new InboundInvocationChainImpl(operation);
         targetInboundChain.addInterceptor(new SynchronousBridgingInterceptor());
-        serviceInboundWire = new InboundWireImpl();
-        serviceInboundWire.setBindingType(qName);
+        InboundWire serviceInboundWire = new InboundWireImpl(qName);
         serviceInboundWire.setServiceContract(contract);
         serviceInboundWire.addInvocationChain(operation, targetInboundChain);
         serviceInboundWire.setContainer(serviceBinding);
@@ -135,11 +151,10 @@
         OutboundInvocationChain targetOutboundChain = new OutboundInvocationChainImpl(operation);
         // place an invoker interceptor on the end
         targetOutboundChain.addInterceptor(new InvokerInterceptor());
-        OutboundWireImpl targetOutboundWire = new OutboundWireImpl();
+        OutboundWire targetOutboundWire = new OutboundWireImpl(qName);
         targetOutboundWire.setServiceContract(contract);
         targetOutboundWire.addInvocationChain(operation, targetOutboundChain);
         targetOutboundWire.setContainer(serviceBinding);
-        targetOutboundWire.setBindingType(qName);
 
         serviceBinding.setInboundWire(serviceInboundWire);
         serviceBinding.setOutboundWire(targetOutboundWire);
@@ -161,7 +176,7 @@
         LocalServiceBinding serviceBinding = new LocalServiceBinding(TARGET, parent);
         InboundInvocationChain targetInboundChain = new InboundInvocationChainImpl(operation);
         targetInboundChain.addInterceptor(new SynchronousBridgingInterceptor());
-        localServiceInboundWire = new InboundWireImpl();
+        InboundWire localServiceInboundWire = new InboundWireImpl();
         localServiceInboundWire.setServiceContract(contract);
         localServiceInboundWire.addInvocationChain(operation, targetInboundChain);
         localServiceInboundWire.setContainer(serviceBinding);
@@ -212,7 +227,8 @@
         chain.addInterceptor(new SynchronousBridgingInterceptor());
         InboundWire wire = new InboundWireImpl();
         wire.setServiceContract(contract);
-        wire.setContainer(new LocalReferenceBinding("", parent));
+        LocalReferenceBinding referenceBinding = new LocalReferenceBinding("", parent);
+        wire.setContainer(referenceBinding);
         wire.addInvocationChain(operation, chain);
 
         OutboundInvocationChain targetOutboundChain = new OutboundInvocationChainImpl(operation);
@@ -221,7 +237,8 @@
         OutboundWire targetOutboundWire = new OutboundWireImpl();
         targetOutboundWire.setServiceContract(contract);
         targetOutboundWire.addInvocationChain(operation, targetOutboundChain);
-
+        referenceBinding.setInboundWire(wire);
+        referenceBinding.setOutboundWire(targetOutboundWire);
         // manually connect the service chains
         connector.connect(chain, targetOutboundChain);
         return wire;

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java Wed Jan 10 07:31:33 2007
@@ -1,19 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.tuscany.core.builder;
 
 import java.util.Collections;
 
 import org.apache.tuscany.spi.QualifiedName;
-import org.apache.tuscany.spi.model.Scope;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.Reference;
 import org.apache.tuscany.spi.component.ReferenceBinding;
 import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.model.Scope;
 import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.Interceptor;
 import org.apache.tuscany.spi.wire.Message;
 import org.apache.tuscany.spi.wire.MessageImpl;
 
+import org.apache.tuscany.core.implementation.composite.CompositeComponentImpl;
 import org.apache.tuscany.core.implementation.composite.ReferenceImpl;
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
@@ -25,17 +45,29 @@
  */
 public class LocalReferenceWiringTestCase extends AbstractConnectorImplTestCase {
     protected ReferenceBinding referenceBinding;
-    private Service service;
     private Reference reference;
-    private AtomicComponent atomicComponent;
 
     /**
-     * Verifies the case where inbound and outbound reference wires are connected followed by the outbound reference
-     * wire being connected to a target that is an atomic component and child of the reference's parent composite. This
-     * wiring scenario occurs when a reference is configured with the local binding.
+     * Verifies the case where the outbound reference wire is connected to a target atomic component that is a sibling
+     * to the reference's parent composite. This wiring scenario occurs when a reference is configured with the local
+     * binding.
      */
     public void testConnectLocalReferenceBindingToAtomicComponentService() throws Exception {
-        createLocalReferenceToSiblingAtomicConfiguration();
+        final AtomicComponent atomicComponent = createAtomicTarget();
+        CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+        topComposite.getChild(TARGET);
+        EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+            public Object answer() throws Throwable {
+                return atomicComponent;
+            }
+        });
+        EasyMock.replay(topComposite);
+        CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
+        reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+        parent.register(reference);
+        // connect to the target
+        connector.connect(parent);
+        // connect the internal reference chains
         connector.connect(reference);
         InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
         Interceptor interceptor = chain.getHeadInterceptor();
@@ -46,72 +78,11 @@
     }
 
     /**
-     * Verifies the case where inbound and outbound reference wires are connected followed by the outbound reference
-     * wire being connected to a target. This wiring scenario occurs when a reference is configured with the local
+     * Verifies the case where the outbound reference wire is connected to a target composite service that is a sibling
+     * to the reference's parent composite. This wiring scenario occurs when a reference is configured with the local
      * binding.
      */
     public void testConnectLocalReferenceBindingToCompositeService() throws Exception {
-        createLocalReferenceToServiceConfiguration();
-        connector.connect(reference);
-        InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
-        Interceptor interceptor = chain.getHeadInterceptor();
-        MessageImpl msg = new MessageImpl();
-        msg.setTargetInvoker(new MockInvoker());
-        Message resp = interceptor.invoke(msg);
-        assertEquals(RESPONSE, resp.getBody());
-    }
-
-    public void testConnectLocalReferenceBindingToCompositeServiceNoMatchingBinding() throws Exception {
-        createLocalReferenceToInvalidServiceConfiguration();
-        try {
-            connector.connect(reference);
-            fail();
-        } catch (NoCompatibleBindingsException e) {
-            // expected
-        }
-    }
-
-    /**
-     * Verifies a connection to a service offered by a sibling composite of the reference's parent
-     *
-     * @throws Exception
-     */
-    public void testConnectLocalReferenceBindingToSiblingCompositeService() throws Exception {
-        createLocalReferenceToSiblingCompositeServiceConfiguration();
-        connector.connect(reference);
-        InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
-        Interceptor interceptor = chain.getHeadInterceptor();
-        MessageImpl msg = new MessageImpl();
-        msg.setTargetInvoker(new MockInvoker());
-        Message resp = interceptor.invoke(msg);
-        assertEquals(RESPONSE, resp.getBody());
-    }
-
-    public void testConnectLocalReferenceBindingToSiblingCompositeServiceNoMatchingBinding() throws Exception {
-        createLocalReferenceToSiblingCompositeServiceConfigurationNoMatchingBinding();
-        try {
-            connector.connect(reference);
-            fail();
-        } catch (TargetServiceNotFoundException e) {
-            // expected
-        }
-    }
-
-    public void testConnectLocalReferenceBindingToInvalidTarget() throws Exception {
-        createLocalReferenceToInvalidTarget();
-        try {
-            connector.connect(reference);
-            fail();
-        } catch (InvalidTargetTypeException e) {
-            // expected
-        }
-    }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    private void createLocalReferenceToServiceConfiguration() throws Exception {
         final CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
 
         topComposite.getInboundWire(TARGET);
@@ -120,7 +91,7 @@
                 return createLocalInboundWire(topComposite);
             }
         });
-        service = createLocalService(topComposite);
+        final Service service = createLocalService(topComposite);
         topComposite.getChild(TARGET);
         EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
             public Object answer() throws Throwable {
@@ -129,16 +100,27 @@
         });
         EasyMock.replay(topComposite);
 
-        CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(parent.getParent()).andReturn(topComposite);
-        EasyMock.replay(parent);
-
-        //service = createLocalService(topComposite);
+        CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
         reference = createLocalReference(parent, TARGET_NAME);
+        parent.register(reference);
+        connector.connect(parent);
+        connector.connect(reference);
+        InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
+        Interceptor interceptor = chain.getHeadInterceptor();
+        MessageImpl msg = new MessageImpl();
+        msg.setTargetInvoker(new MockInvoker());
+        Message resp = interceptor.invoke(msg);
+        assertEquals(RESPONSE, resp.getBody());
     }
 
-    private void createLocalReferenceToInvalidServiceConfiguration() throws Exception {
+    /**
+     * Verfies an exception if the target composite service (a sibling to the reference's parent) does not have a local
+     * binding
+     */
+    public void testConnectLocalReferenceBindingToCompositeServiceNoMatchingBinding() throws Exception {
+        final Service service = createServiceNonLocalBinding();
         CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+        EasyMock.expect(topComposite.getName()).andReturn("foo");
         topComposite.getChild(TARGET);
         EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
             public Object answer() throws Throwable {
@@ -147,17 +129,29 @@
         });
         EasyMock.replay(topComposite);
 
-        CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(parent.getParent()).andReturn(topComposite);
-        EasyMock.replay(parent);
-
-        service = createService();
+        CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
         reference = createLocalReference(parent, TARGET_NAME);
+        parent.register(reference);
+        try {
+            connector.connect(parent);
+            fail();
+        } catch (NoCompatibleBindingsException e) {
+            // expected
+        }
     }
 
-    private void createLocalReferenceToSiblingCompositeServiceConfiguration() throws Exception {
+    /**
+     * Verifies a connection to a service offered by a sibling composite of the reference's parent
+     *
+     * @throws Exception
+     */
+    public void testConnectLocalReferenceBindingToSiblingCompositeService() throws Exception {
         final CompositeComponent sibling = EasyMock.createMock(CompositeComponent.class);
-        //final InboundWire wire = createLocalInboundWire(sibling);
+        final InboundWire localServiceInboundWire = createLocalInboundWire(sibling);
+        EasyMock.expect(sibling.getName()).andReturn("sibling").atLeastOnce();
+        sibling.getInboundWires();
+        EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
+        EasyMock.expect(sibling.isSystem()).andReturn(false).atLeastOnce();
         sibling.getInboundWire(TARGET_SERVICE);
         EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
             public Object answer() throws Throwable {
@@ -168,6 +162,7 @@
         EasyMock.replay(sibling);
 
         CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+        EasyMock.expect(topComposite.getName()).andReturn("foo").atLeastOnce();
         topComposite.getChild(TARGET);
         EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
             public Object answer() throws Throwable {
@@ -176,72 +171,59 @@
         });
         EasyMock.replay(topComposite);
 
-        CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(parent.getParent()).andReturn(topComposite);
-        EasyMock.replay(parent);
-
-        service = createLocalService(topComposite);
+        CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
         reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+        parent.register(reference);
+        parent.register(sibling);
+        connector.connect(parent);
+        connector.connect(reference);
+        InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
+        Interceptor interceptor = chain.getHeadInterceptor();
+        MessageImpl msg = new MessageImpl();
+        msg.setTargetInvoker(new MockInvoker());
+        Message resp = interceptor.invoke(msg);
+        assertEquals(RESPONSE, resp.getBody());
     }
 
-    private void createLocalReferenceToSiblingCompositeServiceConfigurationNoMatchingBinding() throws Exception {
-        final CompositeComponent sibling = EasyMock.createMock(CompositeComponent.class);
-        sibling.getInboundWire(TARGET_SERVICE);
-        EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return null;
-            }
-        });
-        EasyMock.replay(sibling);
-
-        CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
-        topComposite.getChild(TARGET);
-        EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return sibling;
-            }
-        });
-        EasyMock.replay(topComposite);
-
-        CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(parent.getParent()).andReturn(topComposite);
-        EasyMock.replay(parent);
-
-        service = createService();
-        reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+    public void testConnectLocalReferenceBindingToSiblingCompositeServiceNoMatchingBinding() throws Exception {
+        try {
+            final CompositeComponent sibling = EasyMock.createMock(CompositeComponent.class);
+            sibling.getInboundWire(TARGET_SERVICE);
+            EasyMock.expectLastCall().andReturn(null);
+            EasyMock.expect(sibling.getName()).andReturn("sibling").atLeastOnce();
+            EasyMock.expect(sibling.getScope()).andReturn(Scope.SYSTEM).atLeastOnce();
+            EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+                public Object answer() throws Throwable {
+                    return null;
+                }
+            });
+            EasyMock.replay(sibling);
+
+            CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+            topComposite.getChild(TARGET);
+            EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+                public Object answer() throws Throwable {
+                    return sibling;
+                }
+            });
+            EasyMock.expect(topComposite.getName()).andReturn("top").atLeastOnce();
+            EasyMock.replay(topComposite);
+
+            CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
+
+            reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+            parent.register(reference);
+            connector.connect(parent);
+            fail();
+        } catch (TargetServiceNotFoundException e) {
+            // expected
+        }
     }
 
-    private void createLocalReferenceToSiblingAtomicConfiguration() throws Exception {
-        final CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
-        topComposite.getChild(TARGET);
-        EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
-            public Object answer() throws Throwable {
-                return atomicComponent;
-            }
-        });
-        EasyMock.replay(topComposite);
-
-        CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(parent.getParent()).andReturn(topComposite).atLeastOnce();
-        EasyMock.replay(parent);
-        atomicComponent = createAtomicTarget();
-        reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+    protected void setUp() throws Exception {
+        super.setUp();
     }
 
-    private void createLocalReferenceToInvalidTarget() throws Exception {
-        CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
-        Reference reference = EasyMock.createNiceMock(Reference.class);
-        reference.getReferenceBindings();
-        EasyMock.expectLastCall().andReturn(Collections.emptyList());
-        EasyMock.replay(reference);
-        EasyMock.expect(topComposite.getChild(TARGET)).andReturn(reference);
-        EasyMock.replay(topComposite);
-
-        CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(parent.getParent()).andReturn(topComposite);
-        EasyMock.replay(parent);
-        this.reference = createLocalReference(parent, TARGET_NAME);
-    }
 
     private Reference createLocalReference(CompositeComponent parent, QualifiedName target) throws Exception {
         referenceBinding = createLocalReferenceBinding(target);

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.core.mock.binding;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.component.AbstractSCAObject;
 import org.apache.tuscany.spi.component.Service;
 import org.apache.tuscany.spi.component.ServiceBinding;
@@ -40,6 +42,10 @@
 
     public MockServiceBinding() {
         super("foo", null);
+    }
+
+    public QName getBindingType() {
+        return null;
     }
 
     public void setService(Service service) {

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java Wed Jan 10 07:31:33 2007
@@ -24,6 +24,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.QualifiedName;
 import org.apache.tuscany.spi.component.AbstractSCAObject;
 import org.apache.tuscany.spi.component.AtomicComponent;
@@ -269,6 +271,10 @@
 
         public void setBindingServiceContract(ServiceContract<?> bindingServiceContract) {
             this.bindingServiceContract = bindingServiceContract;
+        }
+
+        public QName getBindingType() {
+            return null;
         }
 
         public void setReference(Reference reference) {

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.spi.component;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.InboundWire;
@@ -31,6 +33,13 @@
  */
 public interface ReferenceBinding extends SCAObject {
 
+    /**
+     * Returns the binding qualified name
+     *
+     * @return the binding qualified name
+     */
+    QName getBindingType();
+    
     /**
      * Sets the parent reference for the binding
      *

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.spi.component;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.InboundWire;
@@ -30,6 +32,13 @@
  * @version $Rev$ $Date$
  */
 public interface ServiceBinding extends SCAObject {
+
+    /**
+     * Returns the binding qualified name
+     *
+     * @return the binding qualified name
+     */
+    QName getBindingType();
 
     /**
      * Sets the parent service for the binding

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=494851&r1=494850&r2=494851
==============================================================================
--- 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 Jan 10 07:31:33 2007
@@ -355,10 +355,7 @@
             // connect all children
             // TODO for composite wires, should delegate down
             try {
-                // TODO JFM fixme test
-                if (!(child instanceof CompositeComponent)) {
-                    connector.connect(child);
-                }
+                connector.connect(child);
                 child.prepare();
             } catch (PrepareException e) {
                 e.addContextName(getName());

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=494851&r1=494850&r2=494851
==============================================================================
--- 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 Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.spi.extension;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.component.AbstractSCAObject;
 import org.apache.tuscany.spi.component.CompositeComponent;
@@ -87,6 +89,5 @@
     public boolean isSystem() {
         return service != null && service.isSystem();
     }
-
 
 }

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=494851&r1=494850&r2=494851
==============================================================================
--- 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 Jan 10 07:31:33 2007
@@ -30,8 +30,7 @@
  * @version $$Rev$$ $$Date$$
  */
 public interface Wire {
-
-    QName LOCAL_BINDING = new QName("http://tuscany.apache.org/xmlns/sca/binding/1.0", "local");
+    QName LOCAL_BINDING = new QName("http://tuscany.apache.org/xmlns/sca/binding/1.0", "binding.local");
 
     QName getBindingType();
 

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=494851&r1=494850&r2=494851
==============================================================================
--- 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 Jan 10 07:31:33 2007
@@ -1,5 +1,7 @@
 package org.apache.tuscany.spi.extension;
 
+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;
@@ -51,6 +53,10 @@
     private static class MockBindingExtension extends ReferenceBindingExtension {
         public MockBindingExtension() {
             super(null, null);
+        }
+
+        public QName getBindingType() {
+            return null;
         }
 
         public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)

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=494851&r1=494850&r2=494851
==============================================================================
--- 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 Jan 10 07:31:33 2007
@@ -22,6 +22,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+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;
@@ -77,6 +79,10 @@
     private class TestReferenceBinding extends ReferenceBindingExtension {
         public TestReferenceBinding() {
             super(null, null);
+        }
+
+        public QName getBindingType() {
+            return null;
         }
 
         public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {

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=494851&r1=494850&r2=494851
==============================================================================
--- 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 Jan 10 07:31:33 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.spi.extension;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.component.Service;
 import org.apache.tuscany.spi.model.Scope;
 
@@ -31,18 +33,27 @@
 
     public void testScope() throws Exception {
         ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+            public QName getBindingType() {
+                return null;
+            }
         };
         assertEquals(Scope.SYSTEM, binding.getScope());
     }
 
     public void testPrepare() throws Exception {
         ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+            public QName getBindingType() {
+                return null;
+            }
         };
         binding.prepare();
     }
 
     public void testIsSystemNoParent() throws Exception {
         ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+            public QName getBindingType() {
+                return null;
+            }
         };
         assertFalse(binding.isSystem());
     }
@@ -52,6 +63,9 @@
         EasyMock.expect(service.isSystem()).andReturn(true);
         EasyMock.replay(service);
         ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+            public QName getBindingType() {
+                return null;
+            }
         };
         binding.setService(service);
         assertTrue(binding.isSystem());
@@ -62,6 +76,9 @@
         EasyMock.expect(service.isSystem()).andReturn(false);
         EasyMock.replay(service);
         ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+            public QName getBindingType() {
+                return null;
+            }
         };
         binding.setService(service);
         assertFalse(binding.isSystem());

Modified: incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReferenceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,7 @@
 
 import java.lang.reflect.Method;
 import java.rmi.Remote;
+import javax.xml.namespace.QName;
 
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
@@ -30,11 +31,16 @@
  * @version $Rev$ $Date$
  */
 public class OSGiReferenceBinding extends ReferenceBindingExtension {
+    private static final QName BINDING_OSGI = new QName("http://tuscany.apache.org/xmlns/osgi/1.0", "binding.osgi");
     //private final String uri;
 
     public OSGiReferenceBinding(String name, CompositeComponent parent) {
         super(name, parent);
         //this.uri = uri;
+    }
+
+    public QName getBindingType() {
+        return BINDING_OSGI;
     }
 
     public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {

Modified: incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java (original)
+++ incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiServiceBinding.java Wed Jan 10 07:31:33 2007
@@ -20,6 +20,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.Properties;
+import javax.xml.namespace.QName;
 
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.SCAObjectStartException;
@@ -33,6 +34,7 @@
  * @version $Rev$ $Date$
  */
 public class OSGiServiceBinding extends ServiceBindingExtension {
+    private static final QName BINDING_OSGI = new QName("http://tuscany.apache.org/xmlns/osgi/1.0", "binding.osgi");
     private final String osgiServiceName;
     //private final Class<? extends Object> service;
     private OSGiHost host;
@@ -48,10 +50,10 @@
      * @param host            the OSGi host
      */
     public OSGiServiceBinding(String name,
-                       CompositeComponent parent,
-                       WireService wireService,
-                       String osgiServiceName,
-                       OSGiHost host) {
+                              CompositeComponent parent,
+                              WireService wireService,
+                              String osgiServiceName,
+                              OSGiHost host) {
         super(name, parent);
         this.osgiServiceName = osgiServiceName;
         //this.service = service;
@@ -87,6 +89,10 @@
     public void stop() {
         super.stop();
         //Unregister the service with OSGi
+    }
+
+    public QName getBindingType() {
+        return BINDING_OSGI;
     }
 
     private class ServiceFactoryProxyHandler implements InvocationHandler {

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java Wed Jan 10 07:31:33 2007
@@ -76,7 +76,7 @@
      * @param serviceName the service name associated with the wire
      * @param interfaze   the interface associated with the wire
      */
-    public static <T> InboundWire createInboundWire(String serviceName, Class<T> interfaze)
+    public static <T> InboundWire createLocalInboundWire(String serviceName, Class<T> interfaze)
         throws InvalidServiceContractException {
         InboundWire wire = new InboundWireImpl();
         JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
@@ -95,7 +95,7 @@
      * @param refName   the reference name the wire is associated with on the client
      * @param interfaze the interface associated with the wire
      */
-    public static <T> OutboundWire createOutboundWire(String refName, Class<T> interfaze)
+    public static <T> OutboundWire createLocalOutboundWire(String refName, Class<T> interfaze)
         throws InvalidServiceContractException {
         OutboundWire wire = new OutboundWireImpl();
         wire.setReferenceName(refName);

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java Wed Jan 10 07:31:33 2007
@@ -18,6 +18,10 @@
  */
 package org.apache.tuscany.test.binding;
 
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.Version;
+
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.extension.ServiceBindingExtension;
@@ -26,8 +30,14 @@
  * @version $Rev$ $Date$
  */
 public class TestBindingServiceBinding extends ServiceBindingExtension {
+    private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket");
+
     public TestBindingServiceBinding(String name, CompositeComponent parent) throws CoreRuntimeException {
         super(name, parent);
         // do nothing, but this could register with the host environment
+    }
+
+    public QName getBindingType() {
+        return BINDING_TEST;
     }
 }

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java Wed Jan 10 07:31:33 2007
@@ -1,5 +1,9 @@
 package org.apache.tuscany.test.binding;
 
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.Version;
+
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
 import org.apache.tuscany.spi.model.Operation;
@@ -10,9 +14,14 @@
  * @version $Rev$ $Date$
  */
 public class TestReferenceBinding extends ReferenceBindingExtension {
+    private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket");
 
     public TestReferenceBinding(String name, CompositeComponent parent) {
         super(name, parent);
+    }
+
+    public QName getBindingType() {
+        return BINDING_TEST;
     }
 
     public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java Wed Jan 10 07:31:33 2007
@@ -9,6 +9,10 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.Version;
+
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.extension.ServiceBindingExtension;
@@ -24,6 +28,7 @@
  * @version $Rev$ $Date$
  */
 public class TestSocketBindingServiceBinding extends ServiceBindingExtension {
+    private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket");
     private int port;
     private ServerSocket socket;
     private ExecutorService executor;
@@ -34,6 +39,10 @@
         this.port = port;
     }
 
+    public QName getBindingType() {
+        return BINDING_TEST;
+    }
+    
     public void start() {
         executor = Executors.newSingleThreadExecutor();
         // create a listener, note that a work scheduler should normally be used to spawn work in different threads

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java?view=diff&rev=494851&r1=494850&r2=494851
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java Wed Jan 10 07:31:33 2007
@@ -1,5 +1,9 @@
 package org.apache.tuscany.test.binding;
 
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.Version;
+
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
 import org.apache.tuscany.spi.model.Operation;
@@ -10,6 +14,7 @@
  * @version $Rev$ $Date$
  */
 public class TestSocketReferenceBinding extends ReferenceBindingExtension {
+    private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket");
 
     private String host;
     private int port;
@@ -21,6 +26,10 @@
         super(name, parent);
         this.port = port;
         this.host = host;
+    }
+
+    public QName getBindingType() {
+        return BINDING_TEST;
     }
 
     public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {



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