You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/03/28 18:03:04 UTC

svn commit: r523381 [4/4] - in /incubator/tuscany/java/sca/kernel: core/src/main/java/org/apache/tuscany/core/bootstrap/ core/src/main/java/org/apache/tuscany/core/builder/ core/src/main/java/org/apache/tuscany/core/deployer/ core/src/main/java/org/apa...

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java Wed Mar 28 09:03:01 2007
@@ -19,90 +19,108 @@
 package org.apache.tuscany.core.implementation.processor;
 
 import java.lang.reflect.Constructor;
-import java.util.List;
 
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
 import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
 import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
 import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
 import org.apache.tuscany.spi.implementation.java.JavaMappedService;
 import org.apache.tuscany.spi.implementation.java.PojoComponentType;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
 
 /**
- * Verifies constructors that have extensible annotation types, i.e. that have parameters marked by annotations which
- * are themselves processed by some other implementation processor
- *
+ * Verifies constructors that have extensible annotation types, i.e. that have
+ * parameters marked by annotations which are themselves processed by some other
+ * implementation processor
+ * 
  * @version $Rev$ $Date$
  */
-public class HeutisticExtensibleConstructorTestCase extends TestCase {
+public class HeutisticExtensibleConstructorTestCase extends AbstractConstructorProcessorTest {
 
-    private HeuristicPojoProcessor processor =
-        new HeuristicPojoProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+    private HeuristicPojoProcessor processor;
+
+    public HeutisticExtensibleConstructorTestCase() {
+        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+        processor = new HeuristicPojoProcessor();
+        processor.setInterfaceProcessorRegistry(registry);
+    }
 
+    private <T> void visitEnd(Class<T> clazz,
+                              PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+                              DeploymentContext context) throws ProcessingException {
+        for (Constructor<T> constructor : clazz.getConstructors()) {
+            visitConstructor(constructor, type, context);
+        }
+        processor.visitEnd(clazz, type, context);
+    }
+    
     /**
-     * Verifies heuristic processing can be called priot to an extension annotation processors being called.
+     * Verifies heuristic processing can be called priot to an extension
+     * annotation processors being called.
      */
     public void testBarAnnotationProcessedFirst() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type 
+            = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
         ConstructorDefinition<Foo> definition = new ConstructorDefinition<Foo>(ctor);
         type.setConstructorDefinition(definition);
         JavaMappedProperty property = new JavaMappedProperty();
         property.setName("myBar");
-        definition.getInjectionNames().add("myBar");
+        definition.getParameters()[0].setName("myBar");
         type.getProperties().put("myBar", property);
-        processor.visitEnd(Foo.class, type, null);
+        visitEnd(Foo.class, type, null);
         assertEquals(2, type.getProperties().size());
     }
 
     /**
-     * Verifies heuristic processing can be called before an extension annotation processors is called.
-     * <p/>
-     * For example, given:
-     * <pre> Foo(@Bar String prop, @org.osoa.sca.annotations.Property(name = "foo") String prop2)</pre>
-     * <p/>
-     * Heuristic evaluation of @Property can occur prior to another implementation processor evaluating @Bar
-     *
+     * Verifies heuristic processing can be called before an extension
+     * annotation processors is called. <p/> For example, given:
+     * 
+     * <pre>
+     *  Foo(@Bar String prop, @org.osoa.sca.annotations.Property(name = &quot;foo&quot;) String prop2)
+     * </pre>
+     * 
+     * <p/> Heuristic evaluation of
+     * @Property can occur prior to another implementation processor evaluating
+     * @Bar
      * @throws Exception
      */
     public void testBarAnnotationProcessedLast() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
-        processor.visitEnd(Foo.class, type, null);
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        visitEnd(Foo.class, type, null);
 
         // now simulate process the bar impl
         ConstructorDefinition<?> definition = type.getConstructorDefinition();
-        List<String> injectionNames = definition.getInjectionNames();
-        injectionNames.remove(0);
-        injectionNames.add(0, "mybar");
+        definition.getParameters()[0].setName("myBar");
         type.getProperties().put("mybar", new JavaMappedProperty<String>());
 
         assertEquals(2, type.getProperties().size());
-        assertEquals("foo", definition.getInjectionNames().get(1));
+        assertEquals("foo", definition.getParameters()[1].getName());
     }
 
     /**
-     * Verifies heuristic processing can be called before an extension annotation processors is called with the
-     * extension parameter in a middle position. Specifically, verifies that the heuristic processor updates injection
-     * names and preserves their ordering.
+     * Verifies heuristic processing can be called before an extension
+     * annotation processors is called with the extension parameter in a middle
+     * position. Specifically, verifies that the heuristic processor updates
+     * injection names and preserves their ordering.
      */
     public void testBarAnnotationProcessedFirstInMiddle() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         Constructor<Foo2> ctor = Foo2.class.getConstructor(String.class, String.class, String.class);
         ConstructorDefinition<Foo2> definition = new ConstructorDefinition<Foo2>(ctor);
         type.setConstructorDefinition(definition);
-        // insert placeholder for first param, which would be done by a processor
-        definition.getInjectionNames().add("");
+        // insert placeholder for first param, which would be done by a
+        // processor
+        definition.getParameters()[0].setName("");
         JavaMappedProperty property = new JavaMappedProperty();
+        property.setJavaType(String.class);
         property.setName("myBar");
-        definition.getInjectionNames().add("myBar");
+        definition.getParameters()[1].setName("myBar");
         type.getProperties().put("myBar", property);
-        processor.visitEnd(Foo2.class, type, null);
-        assertEquals("baz", definition.getInjectionNames().get(0));
+        visitEnd(Foo2.class, type, null);
+        assertEquals("baz", definition.getParameters()[0].getName());
         assertEquals(2, type.getProperties().size());
         assertEquals(1, type.getReferences().size());
     }
@@ -112,18 +130,19 @@
     }
 
     public static class Foo {
-        public Foo(@Bar String prop, @org.osoa.sca.annotations.Property(name = "foo") String prop2) {
+        public Foo(@Bar
+        String prop, @org.osoa.sca.annotations.Property(name = "foo")
+        String prop2) {
         }
     }
 
     public static class Foo2 {
-        public Foo2(@org.osoa.sca.annotations.Reference(name = "baz") String prop1,
-                    @Bar String prop2,
-                    @org.osoa.sca.annotations.Property(name = "foo") String prop3) {
+        public Foo2(@org.osoa.sca.annotations.Reference(name = "baz")
+        String prop1, @Bar
+        String prop2, @org.osoa.sca.annotations.Property(name = "foo")
+        String prop3) {
         }
     }
 
-
 }
-
 

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java Wed Mar 28 09:03:01 2007
@@ -86,9 +86,10 @@
         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
             new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         Constructor<Bar> ctor = Bar.class.getConstructor(BazMonitor.class);
+        ConstructorDefinition<Bar> definition = new ConstructorDefinition<Bar>(ctor);
         EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(BazMonitor.class))).andReturn(null);
         EasyMock.replay(monitorFactory);
-        processor.visitConstructor(ctor, type, null);
+        processor.visitConstructorParameter(definition.getParameters()[0], type, null);
         Map<String, JavaMappedProperty<?>> properties = type.getProperties();
         assertTrue(
             properties.get(BazMonitor.class.getName()).getDefaultValueFactory() instanceof SingletonObjectFactory);
@@ -107,12 +108,12 @@
         EasyMock.replay(monitorFactory);
         ConstructorDefinition<Bar> definition = new ConstructorDefinition<Bar>(ctor);
         JavaMappedProperty prop = new JavaMappedProperty();
-        definition.getInjectionNames().add("prop");
+        definition.getParameters()[0].setName("prop");
         type.setConstructorDefinition(definition);
         type.getProperties().put("prop", prop);
-        processor.visitConstructor(ctor, type, null);
+        processor.visitConstructorParameter(definition.getParameters()[1], type, null);
         Map<String, JavaMappedProperty<?>> properties = type.getProperties();
-        assertEquals(BazMonitor.class.getName(), definition.getInjectionNames().get(1));
+        assertEquals(BazMonitor.class.getName(), definition.getParameters()[1].getName());
         assertEquals(2, type.getProperties().size());
         String name = BazMonitor.class.getName();
         assertTrue(properties.get(name).getDefaultValueFactory() instanceof SingletonObjectFactory);
@@ -127,13 +128,13 @@
         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
             new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         Constructor<Bar> ctor = Bar.class.getConstructor(String.class, BazMonitor.class);
+        ConstructorDefinition<Bar> definition = new ConstructorDefinition<Bar>(ctor);
         EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(BazMonitor.class))).andReturn(null);
         EasyMock.replay(monitorFactory);
-        processor.visitConstructor(ctor, type, null);
+        processor.visitConstructorParameter(definition.getParameters()[1], type, null);
         Map<String, JavaMappedProperty<?>> properties = type.getProperties();
-        ConstructorDefinition definition = type.getConstructorDefinition();
-        assertEquals(2, definition.getInjectionNames().size());
-        assertEquals(BazMonitor.class.getName(), definition.getInjectionNames().get(1));
+        assertEquals(2, definition.getParameters().length);
+        assertEquals(BazMonitor.class.getName(), definition.getParameters()[1].getName());
         String name = BazMonitor.class.getName();
         assertTrue(properties.get(name).getDefaultValueFactory() instanceof SingletonObjectFactory);
         EasyMock.verify(monitorFactory);
@@ -143,8 +144,8 @@
         super.setUp();
         monitorFactory = EasyMock.createMock(MonitorFactory.class);
         JavaInterfaceProcessorRegistryImpl registry = new JavaInterfaceProcessorRegistryImpl();
-        ImplementationProcessorServiceImpl processor = new ImplementationProcessorServiceImpl(registry);
-        this.processor = new MonitorProcessor(monitorFactory, processor);
+        this.processor = new MonitorProcessor(monitorFactory);
+        processor.setInterfaceProcessorRegistry(registry);
     }
 
     private class Foo {

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java Wed Mar 28 09:03:01 2007
@@ -107,8 +107,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
-        JavaInterfaceProcessorRegistryImpl registry = new JavaInterfaceProcessorRegistryImpl();
-        processor = new PropertyProcessor(new ImplementationProcessorServiceImpl(registry));
+        processor = new PropertyProcessor();
     }
 
     private class Foo {

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java Wed Mar 28 09:03:01 2007
@@ -38,9 +38,8 @@
  */
 public class ReferenceProcessorTestCase extends TestCase {
 
-    PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-        new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
-    ReferenceProcessor processor = new ReferenceProcessor(new JavaInterfaceProcessorRegistryImpl());
+    private PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type;
+    private ReferenceProcessor processor;
 
     public void testMethodAnnotation() throws Exception {
         processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setFoo", Ref.class), type, null);
@@ -48,7 +47,7 @@
         assertNotNull(reference);
         ServiceContract contract = reference.getServiceContract();
         assertEquals(Ref.class, contract.getInterfaceClass());
-        assertEquals("ReferenceProcessorTestCase$Ref", contract.getInterfaceName());
+        assertEquals("Ref", contract.getInterfaceName());
     }
 
     public void testMethodRequired() throws Exception {
@@ -56,9 +55,9 @@
             ReferenceProcessorTestCase.Foo.class.getMethod("setFooRequired", Ref.class),
                               type,
                               null);
-        JavaMappedReference prop = type.getReferences().get("fooRequired");
-        assertNotNull(prop);
-        assertTrue(prop.isRequired());
+        JavaMappedReference ref = type.getReferences().get("fooRequired");
+        assertNotNull(ref);
+        assertTrue(ref.isRequired());
     }
 
     public void testMethodName() throws Exception {
@@ -75,7 +74,7 @@
         assertNotNull(reference);
         ServiceContract contract = reference.getServiceContract();
         assertEquals(Ref.class, contract.getInterfaceClass());
-        assertEquals("ReferenceProcessorTestCase$Ref", contract.getInterfaceName());
+        assertEquals("Ref", contract.getInterfaceName());
     }
 
     public void testFieldRequired() throws Exception {
@@ -125,7 +124,8 @@
     protected void setUp() throws Exception {
         super.setUp();
         type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
-        processor = new ReferenceProcessor(new JavaInterfaceProcessorRegistryImpl());
+        processor = new ReferenceProcessor();
+        processor.setInterfaceProcessorRegistry(new JavaInterfaceProcessorRegistryImpl());
     }
 
     private interface Ref {

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java Wed Mar 28 09:03:01 2007
@@ -21,30 +21,32 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Service;
+import junit.framework.TestCase;
 
+import org.apache.tuscany.core.idl.java.IllegalCallbackException;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
 import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
 import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
 import org.apache.tuscany.spi.implementation.java.JavaMappedService;
 import org.apache.tuscany.spi.implementation.java.PojoComponentType;
 import org.apache.tuscany.spi.implementation.java.ProcessingException;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
-import org.apache.tuscany.core.idl.java.IllegalCallbackException;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ServiceCallbackTestCase extends TestCase {
+    private ServiceProcessor processor;
 
-    ServiceProcessor processor =
-        new ServiceProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+    @Override
+    protected void setUp() throws Exception {
+        processor = new ServiceProcessor();
+        processor.setInterfaceProcessorRegistry(new JavaInterfaceProcessorRegistryImpl());
+    }
 
     public void testMethodCallbackInterface() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         processor.visitClass(FooImpl.class, type, null);
         JavaMappedService service = type.getServices().get(Foo.class.getSimpleName());
         assertNotNull(service);
@@ -54,8 +56,7 @@
     }
 
     public void testFieldCallbackInterface() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         processor.visitClass(FooImpl.class, type, null);
         JavaMappedService service = type.getServices().get(Foo.class.getSimpleName());
         assertNotNull(service);
@@ -65,8 +66,7 @@
     }
 
     public void testMethodDoesNotMatchCallback() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         processor.visitClass(BadBarImpl.class, type, null);
         Method method = BadBarImpl.class.getMethod("setWrongInterfaceCallback", String.class);
         try {
@@ -78,8 +78,7 @@
     }
 
     public void testNoParamCallback() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         processor.visitClass(BadBarImpl.class, type, null);
         Method method = BadBarImpl.class.getMethod("setNoParamCallback");
         try {
@@ -91,8 +90,7 @@
     }
 
     public void testFieldDoesNotMatchCallback() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         processor.visitClass(BadBarImpl.class, type, null);
         Field field = BadBarImpl.class.getDeclaredField("wrongInterfaceCallback");
         try {
@@ -104,8 +102,7 @@
     }
 
     public void testBadCallbackInterfaceAnnotation() throws Exception {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
-            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         try {
             processor.visitClass(BadFooImpl.class, type, null);
             fail();
@@ -161,6 +158,5 @@
     private static class BadFooImpl implements BadFoo {
 
     }
-
 
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java Wed Mar 28 09:03:01 2007
@@ -22,6 +22,8 @@
 import org.osoa.sca.annotations.Remotable;
 import org.osoa.sca.annotations.Service;
 
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
 import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
 import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
 import org.apache.tuscany.spi.implementation.java.JavaMappedService;
@@ -30,6 +32,7 @@
 
 import junit.framework.TestCase;
 import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
 
 /**
  * @version $Rev$ $Date$
@@ -45,7 +48,7 @@
         ServiceContract contract = service.getServiceContract();
         assertEquals(Baz.class, contract.getInterfaceClass());
         assertEquals(Bar.class, contract.getCallbackClass());
-        assertEquals("ServiceProcessorTestCase$Bar", contract.getCallbackName());
+        assertEquals("Bar", contract.getCallbackName());
         assertNotNull(type.getServices().get(Bar.class.getSimpleName()));
     }
 
@@ -96,8 +99,9 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        JavaInterfaceProcessorRegistryImpl registry = new JavaInterfaceProcessorRegistryImpl();
-        processor = new ServiceProcessor(new ImplementationProcessorServiceImpl(registry));
+        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+        processor = new ServiceProcessor();
+        processor.setInterfaceProcessorRegistry(registry);
         type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
     }
 

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java Wed Mar 28 09:03:01 2007
@@ -18,21 +18,13 @@
  */
 package org.apache.tuscany.core.implementation.system.loader;
 
-import org.apache.tuscany.spi.component.Component;
-import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
-import org.apache.tuscany.spi.implementation.java.PojoComponentType;
-import org.apache.tuscany.spi.implementation.java.ProcessingException;
-import org.apache.tuscany.spi.model.Property;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
-import org.apache.tuscany.spi.model.ServiceDefinition;
-
 import junit.framework.TestCase;
+
 import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
 import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
 import org.apache.tuscany.core.implementation.processor.ConstructorProcessor;
 import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
 import org.apache.tuscany.core.implementation.processor.HeuristicPojoProcessor;
-import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
 import org.apache.tuscany.core.implementation.processor.InitProcessor;
 import org.apache.tuscany.core.implementation.processor.PropertyProcessor;
 import org.apache.tuscany.core.implementation.processor.ReferenceProcessor;
@@ -42,7 +34,11 @@
 import org.apache.tuscany.core.mock.component.BasicInterface;
 import org.apache.tuscany.core.mock.component.BasicInterfaceImpl;
 import org.apache.tuscany.core.monitor.NullMonitorFactory;
-import org.easymock.EasyMock;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
 
 /**
  * @version $Rev$ $Date$
@@ -51,7 +47,6 @@
     private SystemComponentTypeLoader loader;
 
     public void testIntrospectUnannotatedClass() throws ProcessingException {
-        Component parent = EasyMock.createNiceMock(Component.class);
         SystemImplementation impl = new SystemImplementation(BasicInterfaceImpl.class);
         PojoComponentType<?, ?, ?> componentType = loader.loadByIntrospection(impl, null);
         ServiceDefinition service = componentType.getServices().get(BasicInterface.class.getSimpleName());
@@ -65,18 +60,23 @@
     protected void setUp() throws Exception {
         super.setUp();
         JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
-        ImplementationProcessorService service =
-            new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
         IntrospectionRegistryImpl registry = new IntrospectionRegistryImpl();
         registry.setMonitor(new NullMonitorFactory().getMonitor(IntrospectionRegistryImpl.Monitor.class));
-        registry.registerProcessor(new ConstructorProcessor(service));
+        registry.registerProcessor(new ConstructorProcessor());
         registry.registerProcessor(new DestroyProcessor());
         registry.registerProcessor(new InitProcessor());
         registry.registerProcessor(new ScopeProcessor());
-        registry.registerProcessor(new PropertyProcessor(service));
-        registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
-        registry.registerProcessor(new ServiceProcessor(service));
-        registry.registerProcessor(new HeuristicPojoProcessor(service));
+        registry.registerProcessor(new PropertyProcessor());
+        ReferenceProcessor referenceProcessor = new ReferenceProcessor();
+        referenceProcessor.setInterfaceProcessorRegistry(interfaceProcessorRegistry);
+        registry.registerProcessor(referenceProcessor);
+        registry.registerProcessor(new ServiceProcessor());
+        ServiceProcessor serviceProcessor = new ServiceProcessor();
+        serviceProcessor.setInterfaceProcessorRegistry(interfaceProcessorRegistry);
+        registry.registerProcessor(serviceProcessor);
+        HeuristicPojoProcessor pojoProcessor = new HeuristicPojoProcessor();
+        pojoProcessor.setInterfaceProcessorRegistry(interfaceProcessorRegistry);
+        registry.registerProcessor(pojoProcessor);
         loader = new SystemComponentTypeLoader(registry);
     }
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java Wed Mar 28 09:03:01 2007
@@ -18,31 +18,28 @@
  */
 package org.apache.tuscany.core.integration.implementation;
 
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.apache.tuscany.api.annotation.Resource;
-
-import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
-import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
-import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
-import org.apache.tuscany.spi.implementation.java.JavaMappedService;
-import org.apache.tuscany.spi.implementation.java.PojoComponentType;
 import static org.apache.tuscany.spi.model.Scope.COMPOSITE;
-
 import junit.framework.TestCase;
+
+import org.apache.tuscany.api.annotation.Resource;
 import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
 import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
 import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
-import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
 import org.apache.tuscany.core.implementation.processor.InitProcessor;
 import org.apache.tuscany.core.implementation.processor.PropertyProcessor;
 import org.apache.tuscany.core.implementation.processor.ReferenceProcessor;
 import org.apache.tuscany.core.implementation.processor.ResourceProcessor;
 import org.apache.tuscany.core.implementation.processor.ScopeProcessor;
 import org.apache.tuscany.core.monitor.NullMonitorFactory;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
 
 /**
  * Sanity check of the <code>IntegrationRegistry</code> to verify operation with processors
@@ -73,9 +70,10 @@
         registry.registerProcessor(new InitProcessor());
         registry.registerProcessor(new ScopeProcessor());
         JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
-        ImplementationProcessorService service = new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
-        registry.registerProcessor(new PropertyProcessor(service));
-        registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
+        registry.registerProcessor(new PropertyProcessor());
+        ReferenceProcessor referenceProcessor = new ReferenceProcessor();
+        referenceProcessor.setInterfaceProcessorRegistry(interfaceProcessorRegistry);
+        registry.registerProcessor(referenceProcessor);
         registry.registerProcessor(new ResourceProcessor());
     }
 

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java Wed Mar 28 09:03:01 2007
@@ -22,13 +22,11 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
 
-import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
-
 import junit.framework.TestCase;
+
 import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
 import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
 import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
-import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
 import org.apache.tuscany.core.implementation.processor.InitProcessor;
 import org.apache.tuscany.core.implementation.processor.PropertyProcessor;
 import org.apache.tuscany.core.implementation.processor.ReferenceProcessor;
@@ -38,8 +36,6 @@
 
 public class JavaContributionProcessorTestCase extends TestCase {
     private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
-    private static final String JAVA_ARTIFACT_URL =
-        "jar:file://repository/sample-calculator.jar!/calculator/AddService.class";
     private IntrospectionRegistryImpl registry;
 
     protected void setUp() throws Exception {
@@ -50,9 +46,10 @@
         registry.registerProcessor(new InitProcessor());
         registry.registerProcessor(new ScopeProcessor());
         JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
-        ImplementationProcessorService service = new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
-        registry.registerProcessor(new PropertyProcessor(service));
-        registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
+        registry.registerProcessor(new PropertyProcessor());
+        ReferenceProcessor referenceProcessor = new ReferenceProcessor();
+        referenceProcessor.setInterfaceProcessorRegistry(interfaceProcessorRegistry);
+        registry.registerProcessor(referenceProcessor);
         registry.registerProcessor(new ResourceProcessor());
     }
 

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java Wed Mar 28 09:03:01 2007
@@ -19,33 +19,35 @@
 package org.apache.tuscany.spi.implementation.java;
 
 import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
- * Hold injection information for the constructor used to instantiate a component implementation instance
- *
+ * Hold injection information for the constructor used to instantiate a
+ * component implementation instance
+ * 
  * @version $Rev$ $Date$
  */
 public class ConstructorDefinition<T> {
 
     private Constructor<T> constructor;
-    private List<String> injectionNames;
+    private Parameter[] parameters;
 
     public ConstructorDefinition(Constructor<T> constructor) {
         this.constructor = constructor;
-        injectionNames = new ArrayList<String>();
+        int size = constructor.getParameterTypes().length;
+        parameters = new Parameter[size];
+        for (int i = 0; i < size; i++) {
+            parameters[i] = new Parameter(constructor, i);
+        }
     }
 
     public Constructor<T> getConstructor() {
         return constructor;
     }
 
-    public List<String> getInjectionNames() {
-        return injectionNames;
-    }
-
-    public void setInjectionNames(List<String> injectionNames) {
-        this.injectionNames = injectionNames;
+    /**
+     * @return the parameters
+     */
+    public Parameter[] getParameters() {
+        return parameters;
     }
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java Wed Mar 28 09:03:01 2007
@@ -89,14 +89,28 @@
         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
         DeploymentContext context)
         throws ProcessingException;
+    
+    /**
+     * @param parameter
+     * @param type
+     * @param context
+     * @throws ProcessingException
+     */
+    void visitConstructorParameter(Parameter parameter,
+                                   PojoComponentType<JavaMappedService, 
+                                   JavaMappedReference, JavaMappedProperty<?>> type,
+                                   DeploymentContext context) throws ProcessingException;
 
     /**
-     * A callback received as the component implementation's public and protected fields are evaluated
-     *
-     * @param field   the current public or protected field being evaluated
-     * @param type    the incomplete component type associated with the implementation class
+     * A callback received as the component implementation's public and
+     * protected fields are evaluated
+     * 
+     * @param field the current public or protected field being evaluated
+     * @param type the incomplete component type associated with the
+     *            implementation class
      * @param context the current deployment context
-     * @throws ProcessingException if an error is encountered while processing metadata
+     * @throws ProcessingException if an error is encountered while processing
+     *             metadata
      */
     void visitField(
         Field field,

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java Wed Mar 28 09:03:01 2007
@@ -23,6 +23,8 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
 import java.util.Collection;
 
 import org.osoa.sca.annotations.Destroy;
@@ -31,21 +33,29 @@
 import org.osoa.sca.annotations.Reference;
 
 import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
 
 /**
- * A convenience class for annotation processors which alleviates the need to implement unused callbacks
- *
+ * A convenience class for annotation processors which alleviates the need to
+ * implement unused callbacks
+ * 
  * @version $Rev$ $Date$
  */
 @EagerInit
 public abstract class ImplementationProcessorExtension implements ImplementationProcessor {
-    private IntrospectionRegistry registry;
+    protected IntrospectionRegistry registry;
+    protected JavaInterfaceProcessorRegistry interfaceProcessorRegistry;
 
     @Reference
     public void setRegistry(IntrospectionRegistry registry) {
         this.registry = registry;
     }
 
+    @Reference
+    public void setInterfaceProcessorRegistry(JavaInterfaceProcessorRegistry interfaceProcessorRegistry) {
+        this.interfaceProcessorRegistry = interfaceProcessorRegistry;
+    }
+
     @Init
     public void init() {
         registry.registerProcessor(this);
@@ -58,28 +68,22 @@
 
     public <T> void visitClass(Class<T> clazz,
                                PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
-                               DeploymentContext context)
-        throws ProcessingException {
+                               DeploymentContext context) throws ProcessingException {
     }
 
     public <T> void visitSuperClass(Class<T> clazz,
-                                    PojoComponentType<JavaMappedService,
-                                        JavaMappedReference, JavaMappedProperty<?>> type,
-                                    DeploymentContext context)
-        throws ProcessingException {
+                                    PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+                                    DeploymentContext context) throws ProcessingException {
     }
 
     public void visitMethod(Method method,
                             PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
-                            DeploymentContext context)
-        throws ProcessingException {
+                            DeploymentContext context) throws ProcessingException {
     }
 
     public <T> void visitConstructor(Constructor<T> constructor,
-                                     PojoComponentType<JavaMappedService,
-                                         JavaMappedReference, JavaMappedProperty<?>> type,
-                                     DeploymentContext context)
-        throws ProcessingException {
+                                     PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+                                     DeploymentContext context) throws ProcessingException {
     }
 
     public void visitField(Field field,
@@ -100,12 +104,12 @@
             if (genericType == cls) {
                 return Object.class;
             } else {
-                ParameterizedType parameterizedType = (ParameterizedType) genericType;
+                ParameterizedType parameterizedType = (ParameterizedType)genericType;
                 Type baseType = parameterizedType.getActualTypeArguments()[0];
                 if (baseType instanceof Class) {
-                    return (Class<?>) baseType;
+                    return (Class<?>)baseType;
                 } else if (baseType instanceof ParameterizedType) {
-                    return (Class<?>) ((ParameterizedType) baseType).getRawType();
+                    return (Class<?>)((ParameterizedType)baseType).getRawType();
                 } else {
                     return null;
                 }
@@ -113,5 +117,11 @@
         } else {
             return cls;
         }
+    }
+
+    public void visitConstructorParameter(Parameter parameter,
+                                          PojoComponentType<JavaMappedService, 
+                                          JavaMappedReference, JavaMappedProperty<?>> type,
+                                          DeploymentContext context) throws ProcessingException {
     }
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java Wed Mar 28 09:03:01 2007
@@ -1,92 +0,0 @@
-/*
- * 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.spi.implementation.java;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Member;
-import java.lang.reflect.Type;
-import java.util.List;
-
-import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.model.ServiceContract;
-
-/**
- * Provides utility methods for Java implementation processing
- *
- * @version $Rev$ $Date$
- */
-public interface ImplementationProcessorService {
-
-    /**
-     * Introspects the given interface to produce a mapped service
-     */
-    JavaMappedService createService(Class<?> interfaze) throws InvalidServiceContractException;
-
-    JavaMappedReference createReference(String name, Member member, Class<?> paramType) throws ProcessingException;
-
-    /**
-     * Processes the callback contract for a given interface type
-     *
-     * @param interfaze the interface type to examine
-     * @param contract  the service contract the callback is associated wth
-     * @throws InvalidServiceContractException
-     *
-     */
-    void processCallback(Class<?> interfaze, ServiceContract<?> contract) throws InvalidServiceContractException;
-
-    /**
-     * Determines if all the members of a collection have unique types
-     *
-     * @param collection the collection to analyze
-     * @return true if the types are unique
-     */
-    boolean areUnique(Class[] collection);
-
-    /**
-     * Inserts a name at the specified position, paddiling the list if its size is less than the position
-     */
-    void addName(List<String> names, int pos, String name);
-
-    /**
-     * Processes a constructor parameter by introspecting its annotations
-     *
-     * @param param            the parameter to process
-     * @param genericParam     the generic type of the parameter
-     * @param paramAnnotations the parameter annotations
-     * @param constructorNames the array of constructorNames specified by
-     * @param pos              the declaration position of the constructor parameter
-     * @param type             the component type associated with implementation being reflected
-     * @param injectionNames   the list of parameter constructorNames specified on parameter annotations
-     * @throws ProcessingException
-     */
-    boolean processParam(Class<?> param,
-                         Type genericParam,
-                         Annotation[] paramAnnotations,
-                         String[] constructorNames,
-                         int pos,
-                         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
-                         List<String> injectionNames) throws ProcessingException;
-
-    /**
-     * Returns true if <code>@Property</code> or <code>@Reference</code> are present in the given array
-     * @return true if one of the annotations are present
-     */
-    boolean injectionAnnotationsPresent(Annotation[][] annots);
-
-}

Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaElement.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaElement.java?view=auto&rev=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaElement.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaElement.java Wed Mar 28 09:03:01 2007
@@ -0,0 +1,206 @@
+/*
+ * 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.spi.implementation.java;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaElement {
+    private AnnotatedElement anchor;
+    private ElementType elementType;
+    private Class<?> type;
+    private Type genericType;
+    private int index = -1;
+    private String name;
+
+    public JavaElement(Package pkg) {
+        this.anchor = pkg;
+        this.elementType = ElementType.PACKAGE;
+        this.name = pkg.getName();
+    }
+
+    public JavaElement(Class<?> cls) {
+        this.anchor = cls;
+        this.elementType = ElementType.TYPE;
+        this.type = cls;
+        this.genericType = cls;
+        this.name = cls.getName();
+    }
+
+    public JavaElement(Field field) {
+        this.anchor = field;
+        this.elementType = ElementType.FIELD;
+        this.type = field.getType();
+        this.genericType = field.getGenericType();
+        this.name = field.getName();
+    }
+
+    public JavaElement(Method method) {
+        this.anchor = method;
+        this.elementType = ElementType.METHOD;
+        this.type = method.getReturnType();
+        this.genericType = method.getGenericReturnType();
+        this.name = method.getName();
+    }
+
+    public JavaElement(Constructor<?> constructor) {
+        this.anchor = constructor;
+        this.elementType = ElementType.CONSTRUCTOR;
+        this.type = null;
+        this.genericType = null;
+        this.name = constructor.getName();
+    }
+
+    public JavaElement(Constructor<?> constructor, int index) {
+        this.anchor = constructor;
+        this.elementType = ElementType.PARAMETER;
+        this.type = constructor.getParameterTypes()[index];
+        this.genericType = constructor.getGenericParameterTypes()[index];
+        this.index = index;
+        this.name = "";
+    }
+
+    public JavaElement(Method method, int index) {
+        this.anchor = method;
+        this.elementType = ElementType.PARAMETER;
+        this.type = method.getParameterTypes()[index];
+        this.genericType = method.getGenericParameterTypes()[index];
+        this.index = index;
+        this.name = "";
+    }
+
+    /**
+     * @return the anchor
+     */
+    public AnnotatedElement getAnchor() {
+        return anchor;
+    }
+
+    /**
+     * @return the elementType
+     */
+    public ElementType getElementType() {
+        return elementType;
+    }
+
+    /**
+     * @return the genericType
+     */
+    public Type getGenericType() {
+        return genericType;
+    }
+
+    /**
+     * @return the index
+     */
+    public int getIndex() {
+        return index;
+    }
+
+    /**
+     * @return the type
+     */
+    public Class<?> getType() {
+        return type;
+    }
+
+    public Annotation[] getAnnotations() {
+        if (elementType == ElementType.PARAMETER) {
+            if (anchor instanceof Method) {
+                // We only care about the method-level annotaions
+                return ((Method)anchor).getAnnotations();
+            }
+            if (anchor instanceof Constructor) {
+                return ((Constructor)anchor).getParameterAnnotations()[index];
+            }
+        }
+        return anchor.getAnnotations();
+    }
+
+    public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+        for (Annotation a : getAnnotations()) {
+            if (a.annotationType() == annotationType) {
+                return annotationType.cast(a);
+            }
+        }
+        return null;
+    }
+
+    public String toString() {
+        return anchor.toString() + (elementType == ElementType.PARAMETER ? "[" + index + "]" : "");
+    }
+
+    @Override
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ((anchor == null) ? 0 : anchor.hashCode());
+        result = PRIME * result + index;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final JavaElement other = (JavaElement)obj;
+        if (anchor == null) {
+            if (other.anchor != null) {
+                return false;
+            }
+        } else if (!anchor.equals(other.anchor)) {
+            return false;
+        }
+        if (index != other.index) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java Wed Mar 28 09:03:01 2007
@@ -1,61 +0,0 @@
-/*
- * 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.spi.implementation.java;
-
-import org.apache.tuscany.spi.model.ComponentType;
-
-/**
- * A specialized component type definition whose services, references and properties can be mapped to the Java
- * programming model.
- *
- * @version $Rev$ $Date$
- */
-public class JavaMappedComponentType<
-    S extends JavaMappedService,
-    R extends JavaMappedReference,
-    P extends JavaMappedProperty<?>
-    > extends ComponentType<S, R, P> {
-
-    private Class<?> implClass;
-
-    public JavaMappedComponentType() {
-    }
-
-    public JavaMappedComponentType(Class<?> implClass) {
-        this.implClass = implClass;
-    }
-
-    /**
-     * Returns the implementation class associated with this component type.
-     *
-     * @return the implementation class associated with this component type
-     */
-    public Class<?> getImplClass() {
-        return implClass;
-    }
-
-    /**
-     * Sets the implementation class associated with this component type.
-     *
-     * @param implClass the implementation class associated with this component type
-     */
-    public void setImplClass(Class<?> implClass) {
-        this.implClass = implClass;
-    }
-}

Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Parameter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Parameter.java?view=auto&rev=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Parameter.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Parameter.java Wed Mar 28 09:03:01 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.spi.implementation.java;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Parameter extends JavaElement {
+    private Class<? extends Annotation> classifer;
+
+    /**
+     * @param constructor
+     * @param index
+     */
+    public Parameter(Constructor<?> constructor, int index) {
+        super(constructor, index);
+    }
+
+    /**
+     * @return the classifer
+     */
+    public Class<? extends Annotation> getClassifer() {
+        return classifer;
+    }
+
+    /**
+     * @param classifer the classifer to set
+     */
+    public void setClassifer(Class<? extends Annotation> classifer) {
+        this.classifer = classifer;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Parameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Parameter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java?view=diff&rev=523381&r1=523380&r2=523381
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java Wed Mar 28 09:03:01 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.tuscany.spi.implementation.java;
 
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -39,6 +40,7 @@
     extends ComponentType<S, R, P> {
     private Class<?> implClass;
     private ConstructorDefinition<?> constructorDefinition;
+    private Map<Constructor, ConstructorDefinition> constructors = new HashMap<Constructor, ConstructorDefinition>();
     private Method initMethod;
     private Method destroyMethod;
     private final Map<String, Resource> resources = new HashMap<String, Resource>();
@@ -174,5 +176,12 @@
     
     public boolean isAllowsPassByReference(Method method) {
         return allowsPassByReference || allowsPassByReferenceMethods.contains(method);
+    }
+
+    /**
+     * @return the constructors
+     */
+    public Map<Constructor, ConstructorDefinition> getConstructors() {
+        return constructors;
     }
 }



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