Author: jmarino
Date: Sat Jan  6 01:28:49 2007
New Revision: 493437

URL: http://svn.apache.org/viewvc?view=rev&rev=493437
Log:
move getInboundWire(..) to Component

Modified:
    
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java
    
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java
    
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
    
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
    
incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java

Modified: 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java?view=diff&rev=493437&r1=493436&r2=493437
==============================================================================
--- 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java
 (original)
+++ 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java
 Sat Jan  6 01:28:49 2007
@@ -19,7 +19,6 @@
 package org.apache.tuscany.spi.component;
 
 import org.apache.tuscany.spi.ObjectCreationException;
-import org.apache.tuscany.spi.wire.InboundWire;
 
 /**
  * The runtime instantiation of an SCA atomic, or leaf-type, component
@@ -95,17 +94,11 @@
     void removeInstance() throws ComponentException;
 
     /**
-     * Returns the wire associated with the given service name or null if not 
found
-     */
-    InboundWire getInboundWire(String serviceName);
-    
-    /**
      * Returns the target instance associated with the component. A target 
instance is the actual object a request is
      * dispatched to sans wire chain.
      *
      * @throws TargetResolutionException
-     *
      */
     Object getTargetInstance() throws TargetResolutionException;
-    
+
 }

Modified: 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java?view=diff&rev=493437&r1=493436&r2=493437
==============================================================================
--- 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java
 (original)
+++ 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java
 Sat Jan  6 01:28:49 2007
@@ -36,6 +36,11 @@
 public interface Component extends SCAObject {
 
     /**
+     * Returns the internal wire associated with the given service name or 
null if not found
+     */
+    InboundWire getInboundWire(String serviceName);
+
+    /**
      * Adds a target-side wire. Target-side wire factories contain the 
invocation chains associated with the destination
      * service of a wire
      */

Modified: 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java?view=diff&rev=493437&r1=493436&r2=493437
==============================================================================
--- 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
 (original)
+++ 
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
 Sat Jan  6 01:28:49 2007
@@ -19,7 +19,6 @@
 package org.apache.tuscany.spi.component;
 
 import java.util.List;
-import javax.xml.namespace.QName;
 
 import org.w3c.dom.Document;
 
@@ -41,15 +40,6 @@
      * @param scopeContainer the scope container associated with the composite
      */
     void setScopeContainer(ScopeContainer scopeContainer);
-
-    /**
-     * Returns an inbound wire associated with the given service and binding 
type
-     *
-     * @param serviceName the name of the service
-     * @param bindingType the binding type
-     * @return the wire or null if not found
-     */
-    InboundWire getInboundWire(String serviceName, QName bindingType);
 
     /**
      * Returns the value of a Property of this composite.

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=493437&r1=493436&r2=493437
==============================================================================
--- 
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
 Sat Jan  6 01:28:49 2007
@@ -24,7 +24,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import javax.xml.namespace.QName;
 
 import org.w3c.dom.Document;
 
@@ -50,6 +49,7 @@
 import org.apache.tuscany.spi.services.management.ManagementService;
 import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * An extension point for composite components, which new types may extend
@@ -220,7 +220,7 @@
         //TODO implement
     }
 
-    public InboundWire getInboundWire(String serviceName, QName bindingType) {
+    public InboundWire getInboundWire(String serviceName) {
         SCAObject object = children.get(serviceName);
         if (!(object instanceof Service)) {
             return null;
@@ -228,7 +228,7 @@
         Service service = (Service) object;
         for (ServiceBinding binding : service.getServiceBindings()) {
             InboundWire wire = binding.getInboundWire();
-            if (bindingType.equals(wire.getBindingType())) {
+            if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
                 return wire;
             }
         }

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=493437&r1=493436&r2=493437
==============================================================================
--- 
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
 Sat Jan  6 01:28:49 2007
@@ -18,15 +18,20 @@
  */
 package org.apache.tuscany.spi.extension;
 
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
 import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
 
 import junit.framework.TestCase;
 import org.easymock.EasyMock;
@@ -80,6 +85,30 @@
         composite.register(service2);
         assertNull(composite.getService(null));
         assertNull(composite.getSystemService(null));
+    }
+
+    public void testInboundWire() throws Exception {
+        ServiceContract<?> contract = new ServiceContract(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(false).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.getInboundWire("service"));
     }
 
     protected void setUp() throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to