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/08 14:35:54 UTC

svn commit: r494068 - in /incubator/tuscany/java/sca/kernel: core/src/main/java/org/apache/tuscany/core/implementation/ core/src/main/java/org/apache/tuscany/core/implementation/system/component/ core/src/main/java/org/apache/tuscany/core/injection/ co...

Author: jmarino
Date: Mon Jan  8 05:35:53 2007
New Revision: 494068

URL: http://svn.apache.org/viewvc?view=rev&rev=494068
Log:
remove reference to class on mutliplicity injection and make it specific to Java impl types

Added:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java   (with props)
Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java
    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/extension/AtomicComponentExtension.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java?view=diff&rev=494068&r1=494067&r2=494068
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java Mon Jan  8 05:35:53 2007
@@ -43,6 +43,7 @@
 import org.apache.tuscany.core.injection.ListMultiplicityObjectFactory;
 import org.apache.tuscany.core.injection.MethodInjector;
 import org.apache.tuscany.core.injection.NoAccessorException;
+import org.apache.tuscany.core.injection.NoMultiplicityTypeException;
 import org.apache.tuscany.core.injection.ObjectCallbackException;
 import org.apache.tuscany.core.injection.PojoObjectFactory;
 
@@ -198,7 +199,7 @@
         //TODO error if ref not set on constructor or ref site
     }
 
-    public void onReferenceWires(Class<?> multiplicityClass, List<OutboundWire> wires) {
+    public void onReferenceWires(List<OutboundWire> wires) {
         assert wires.size() > 0 : "Wires were empty";
         String referenceName = wires.get(0).getReferenceName();
         Member member = referenceSites.get(referenceName);
@@ -210,7 +211,11 @@
                 throw new NoAccessorException(referenceName);
             }
         }
-        injectors.add(createMultiplicityInjector(member, multiplicityClass, wires));
+        Class<?> type = wires.get(0).getServiceContract().getInterfaceClass();
+        if (type == null) {
+            throw new NoMultiplicityTypeException("Java interface must be specified for multiplicity", referenceName);
+        }
+        injectors.add(createMultiplicityInjector(member, type, wires));
         //TODO multiplicity for constructor injection
     }
 

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java?view=diff&rev=494068&r1=494067&r2=494068
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java Mon Jan  8 05:35:53 2007
@@ -133,7 +133,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public void addOutboundWires(Class<?> multiplicityClass, List<OutboundWire> wires) {
+    public void addOutboundWires(List<OutboundWire> wires) {
         throw new UnsupportedOperationException();
     }
 

Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java?view=auto&rev=494068
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java Mon Jan  8 05:35:53 2007
@@ -0,0 +1,29 @@
+/*
+ * 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.injection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NoMultiplicityTypeException extends InjectionRuntimeException {
+
+    public NoMultiplicityTypeException(String message, String identifier) {
+        super(message, identifier);
+    }
+}

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java?view=diff&rev=494068&r1=494067&r2=494068
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java Mon Jan  8 05:35:53 2007
@@ -186,7 +186,7 @@
         outboundWire.setTargetName(new QualifiedName(targetName + "/" + serviceName));
         List<OutboundWire> factories = new ArrayList<OutboundWire>();
         factories.add(outboundWire);
-        sourceComponent.addOutboundWires(sourceReferenceClass, factories);
+        sourceComponent.addOutboundWires(factories);
         targetScope.register(targetComponent);
         sourceScope.register(sourceComponent);
         CONNECTOR.connect(outboundWire, inboundWire, false);

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=494068&r1=494067&r2=494068
==============================================================================
--- 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 Mon Jan  8 05:35:53 2007
@@ -82,9 +82,8 @@
     /**
      * Adds a set of source-side multiplicity wires for the given reference. Source-side wires contain the invocation
      * chains for a reference in the implementation associated with the instance wrapper created by this configuration.
-     * FIXME should take ServiceContract
      */
-    void addOutboundWires(Class<?> multiplicityClass, List<OutboundWire> wires);
+    void addOutboundWires(List<OutboundWire> wires);
 
     /**
      * Notifies the given instance of an initialization event.

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java?view=diff&rev=494068&r1=494067&r2=494068
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java Mon Jan  8 05:35:53 2007
@@ -171,10 +171,10 @@
         return Collections.unmodifiableMap(referenceWires);
     }
 
-    public void addOutboundWires(Class<?> multiplicityClass, List<OutboundWire> wires) {
+    public void addOutboundWires(List<OutboundWire> wires) {
         assert wires != null && wires.size() > 0;
         referenceWires.put(wires.get(0).getReferenceName(), wires);
-        onReferenceWires(multiplicityClass, wires);
+        onReferenceWires(wires);
     }
 
     public void removeInstance() throws ComponentException {
@@ -184,7 +184,7 @@
     protected void onReferenceWire(OutboundWire wire) {
     }
 
-    protected void onReferenceWires(Class<?> multiplicityClass, List<OutboundWire> wires) {
+    protected void onReferenceWires(List<OutboundWire> wires) {
     }
 
     protected void onServiceWire(InboundWire wire) {



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