tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r398828 - in /incubator/tuscany/java/sca: bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/ containers/container.java/src/main/j...
Date Tue, 02 May 2006 06:49:06 GMT
Author: jmarino
Date: Mon May  1 23:49:04 2006
New Revision: 398828

URL: http://svn.apache.org/viewcvs?rev=398828&view=rev
Log:
refactor entrypoint and external service API to reflect generics has opposed to having subclasses implement handlesTargetType

Added:
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java
      - copied, changed from r398774, incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/GenericReflectionTestCase.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java
Removed:
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/GenericReflectionTestCase.java
Modified:
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java
    incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java
    incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
    incubator/tuscany/java/sca/containers/container.java/src/main/resources/system.fragment
    incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
    incubator/tuscany/java/sca/containers/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java
    incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java Mon May  1 23:49:04 2006
@@ -19,10 +19,10 @@
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
-
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
 
+import commonj.sdo.helper.TypeHelper;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
@@ -30,7 +30,6 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContextConstants;
 import org.apache.axis2.description.AxisService;
-import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding;
 import org.apache.tuscany.binding.axis2.config.WSExternalServiceContextFactory;
 import org.apache.tuscany.binding.axis2.handler.Axis2OperationInvoker;
 import org.apache.tuscany.binding.axis2.handler.Axis2ServiceInvoker;
@@ -38,28 +37,22 @@
 import org.apache.tuscany.binding.axis2.util.DataBinding;
 import org.apache.tuscany.binding.axis2.util.SDODataBinding;
 import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
+import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding;
 import org.apache.tuscany.core.builder.BuilderConfigException;
 import org.apache.tuscany.core.builder.impl.ExternalServiceContextFactory;
 import org.apache.tuscany.core.extension.ExternalServiceBuilderSupport;
 import org.apache.tuscany.core.injection.SingletonObjectFactory;
-import org.apache.tuscany.model.assembly.Binding;
 import org.apache.tuscany.model.assembly.ExternalService;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.osoa.sca.annotations.Scope;
 
-import commonj.sdo.helper.TypeHelper;
-
 /**
- * Creates a <code>ContextFactory</code> for an external service configured with the {@link WebServiceBinding}
+ * Creates a <code>ContextFactory</code> for an external service configured with the {@link
+ * WebServiceBinding}
  */
 @Scope("MODULE")
-public class ExternalWebServiceBuilder extends ExternalServiceBuilderSupport {
-
-    @Override
-    protected boolean handlesBindingType(Binding binding) {
-        return binding instanceof WebServiceBinding;
-    }
+public class ExternalWebServiceBuilder extends ExternalServiceBuilderSupport<WebServiceBinding> {
 
     /*
      * (non-Javadoc)

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java Mon May  1 23:49:04 2006
@@ -27,15 +27,7 @@
 import org.osoa.sca.annotations.Scope;
 
 @Scope("MODULE")
-public class ExternalWebServiceWireBuilder extends WireBuilderSupport {
-
-    public ExternalWebServiceWireBuilder() {
-    }
-
-    @Override
-    protected boolean handlesTargetType(Class targetType) {
-        return WSExternalServiceContextFactory.class.isAssignableFrom(targetType);
-    }
+public class ExternalWebServiceWireBuilder extends WireBuilderSupport<WSExternalServiceContextFactory> {
 
     @Override
     protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) {

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java Mon May  1 23:49:04 2006
@@ -21,21 +21,16 @@
 import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
 import org.apache.tuscany.core.extension.EntryPointBuilderSupport;
 import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.model.assembly.Binding;
 import org.apache.tuscany.model.assembly.EntryPoint;
 import org.osoa.sca.annotations.Scope;
 
 /**
  * Creates a <code>ContextFactory</code> for an entry point configured with the {@link WebServiceBinding}
- * 
+ *
  * @version $Rev$ $Date$
  */
 @Scope("MODULE")
-public class WebServiceEntryPointBuilder extends EntryPointBuilderSupport {
-
-    protected boolean handlesBindingType(Binding binding) {
-        return binding instanceof WebServiceBinding;
-    }
+public class WebServiceEntryPointBuilder extends EntryPointBuilderSupport<WebServiceBinding> {
 
     protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) {
         return new WSEntryPointContextFactory(entryPoint.getName(), messageFactory);

Modified: incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java Mon May  1 23:49:04 2006
@@ -16,17 +16,11 @@
 import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
 import org.apache.tuscany.core.extension.EntryPointBuilderSupport;
 import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.model.assembly.Binding;
 import org.apache.tuscany.model.assembly.EntryPoint;
 import org.osoa.sca.annotations.Scope;
 
 @Scope("MODULE")
-public class JSONRPCEntryPointBuilder extends  EntryPointBuilderSupport {
-
-    @Override
-    protected boolean handlesBindingType(Binding binding) {
-        return JSONRPCBinding.class.isAssignableFrom(binding.getClass());
-    }
+public class JSONRPCEntryPointBuilder extends EntryPointBuilderSupport<JSONRPCBinding> {
 
     @Override
     protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) {

Modified: incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java (original)
+++ incubator/tuscany/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java Mon May  1 23:49:04 2006
@@ -29,11 +29,7 @@
  * @version $Rev$ $Date$
  */
 @Scope("MODULE")
-public class JavaTargetWireBuilder extends WireBuilderSupport {
-
-    protected boolean handlesTargetType(Class targetType) {
-        return JavaContextFactory.class.isAssignableFrom(targetType);
-    }
+public class JavaTargetWireBuilder extends WireBuilderSupport<JavaContextFactory> {
 
     protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) {
         boolean cacheable = !downScope;

Modified: incubator/tuscany/java/sca/containers/container.java/src/main/resources/system.fragment
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/main/resources/system.fragment?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.java/src/main/resources/system.fragment (original)
+++ incubator/tuscany/java/sca/containers/container.java/src/main/resources/system.fragment Mon May  1 23:49:04 2006
@@ -21,6 +21,10 @@
     <component name="org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder">
         <system:implementation.system class="org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder"/>
     </component>
+    <component name="org.apache.tuscany.core.config.ComponentTypeIntrospector">
+        <system:implementation.system class="org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector"/>
+    </component>
+
 
     <component name="org.apache.tuscany.container.java.builder.JavaTargetWireBuilder">
         <system:implementation.system class="org.apache.tuscany.container.java.builder.JavaTargetWireBuilder"/>

Modified: incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java (original)
+++ incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java Mon May  1 23:49:04 2006
@@ -33,7 +33,7 @@
 
     public void testHelloWorld() throws Exception {
         TuscanyRuntime tuscany = new TuscanyRuntime("test", null);
-        tuscany.start();
+        tuscany.start();                     
         ModuleContext moduleContext = CurrentModuleContext.getContext();
         assertNotNull(moduleContext);
 

Modified: incubator/tuscany/java/sca/containers/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java (original)
+++ incubator/tuscany/java/sca/containers/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java Mon May  1 23:49:04 2006
@@ -32,11 +32,7 @@
  * @version $Rev$ $Date$
  */
 @Scope("MODULE")
-public class JavaScriptTargetWireBuilder extends WireBuilderSupport {
-
-    protected boolean handlesTargetType(Class targetType) {
-        return JavaScriptContextFactory.class.isAssignableFrom(targetType);
-    }
+public class JavaScriptTargetWireBuilder extends WireBuilderSupport<JavaScriptContextFactory> {
 
     protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) {
         String serviceName = targetName.getPartName();

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java Mon May  1 23:49:04 2006
@@ -23,7 +23,6 @@
 import org.apache.tuscany.core.config.processor.ProcessorUtils;
 import org.apache.tuscany.core.system.context.SystemCompositeContextImpl;
 import org.apache.tuscany.core.context.impl.CompositeContextImpl;
-import org.apache.tuscany.core.extension.config.ImplementationProcessor;
 import org.apache.tuscany.model.assembly.AssemblyFactory;
 import org.apache.tuscany.model.assembly.AssemblyContext;
 import org.apache.tuscany.model.assembly.Module;

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java Mon May  1 23:49:04 2006
@@ -25,20 +25,22 @@
 
 import org.apache.tuscany.core.config.ComponentTypeIntrospector;
 import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.core.extension.config.ImplementationProcessor;
 import org.apache.tuscany.core.config.JavaIntrospectionHelper;
 import org.apache.tuscany.core.config.processor.ProcessorUtils;
+import org.apache.tuscany.core.extension.config.ImplementationProcessor;
 import org.apache.tuscany.core.system.annotation.Autowire;
 import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
 import org.apache.tuscany.model.assembly.AssemblyFactory;
 import org.apache.tuscany.model.assembly.ComponentInfo;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.ComponentName;
 
 /**
  * Introspects Java annotation-based metata data
  *
  * @version $Rev$ $Date$
  */
-@org.osoa.sca.annotations.Service(interfaces = {ComponentTypeIntrospector.class})
+@org.osoa.sca.annotations.Service(ComponentTypeIntrospector.class)
 public class Java5ComponentTypeIntrospector implements ComponentTypeIntrospector {
 
     private AssemblyFactory factory;
@@ -54,6 +56,7 @@
 
     @Autowire
     public void setFactory(SystemAssemblyFactory factory) {
+        System.out.println("setting "+factory);
         this.factory = factory;
         //FIXME JFM HACK
         List<ImplementationProcessor> processors = ProcessorUtils.createCoreProcessors(factory);
@@ -63,6 +66,14 @@
         // END hack
     }
 
+    @ComponentName
+    protected String name;
+
+    @Init(eager = true)
+    public void init(){
+        System.out.println("Eager init"+name);
+    }
+
     public void registerProcessor(ImplementationProcessor processor) {
         processors.add(processor);
     }
@@ -72,8 +83,8 @@
     }
 
     /**
-     * Visits the given implementation type and calls back to {@link org.apache.tuscany.core.extension.config.ImplementationProcessor}s registered with
-     * this introspector to build up a {@link ComponentInfo}
+     * Visits the given implementation type and calls back to {@link org.apache.tuscany.core.extension.config.ImplementationProcessor}s
+     * registered with this introspector to build up a {@link ComponentInfo}
      *
      * @return ComponentInfo representing the implementation type metadata
      * @throws ConfigurationLoadException if there is an error introspecting the implementation type

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java Mon May  1 23:49:04 2006
@@ -52,15 +52,15 @@
         // visiting the base implementation class
         List<org.apache.tuscany.model.assembly.Service> services = type.getServices();
         Class[] interfaces = clazz.getInterfaces();
+        org.osoa.sca.annotations.Service serviceAnnotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class);
         if (interfaces.length == 0) {
             // no interfaces so the class is the service
             addService(services, clazz);
-        } else if (interfaces.length == 1) {
+        } else if (serviceAnnotation == null && interfaces.length == 1) {
             // the impl has one interface, assign it to be the service
             addService(services, interfaces[0]);
         } else {
             // visiting the implementation class
-            org.osoa.sca.annotations.Service serviceAnnotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class);
             if (serviceAnnotation == null) {
                 return;
             }

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java Mon May  1 23:49:04 2006
@@ -21,7 +21,7 @@
 public interface ExternalServiceContext extends Context {
 
     /**
-     * Returns the handler responsible for flowing a request through the entry point
+     * Returns the handler responsible for flowing a request through the external service
      * @throws TargetException
      */
      public Object getHandler() throws TargetException;

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java Mon May  1 23:49:04 2006
@@ -13,6 +13,9 @@
  */
 package org.apache.tuscany.core.extension;
 
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
 import org.apache.tuscany.core.builder.BuilderException;
 import org.apache.tuscany.core.builder.ContextFactoryBuilder;
 import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry;
@@ -33,13 +36,21 @@
  *
  * @version $$Rev$$ $$Date$$
  */
-public abstract class EntryPointBuilderSupport implements ContextFactoryBuilder {
+public abstract class EntryPointBuilderSupport<T extends Binding> implements ContextFactoryBuilder {
 
     protected ContextFactoryBuilderRegistry builderRegistry;
     protected WireFactoryService wireService;
     protected MessageFactory messageFactory;
+    protected Class bindingClass;
 
     public EntryPointBuilderSupport() {
+        // reflect the generic type of the subclass
+        Type type = this.getClass().getGenericSuperclass();
+        if (type instanceof ParameterizedType) {
+            bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0];
+        } else {
+            throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized");
+        }
     }
 
     @Init(eager = true)
@@ -72,8 +83,10 @@
             return;
         }
         EntryPoint entryPoint = (EntryPoint) object;
-        if (entryPoint.getBindings().size() < 1
-                || !(handlesBindingType(entryPoint.getBindings().get(0)))) {
+        if (entryPoint.getBindings().size() < 1) {
+            return;
+        }
+        if (!bindingClass.isAssignableFrom(entryPoint.getBindings().get(0).getClass())) {
             return;
         }
 
@@ -86,14 +99,12 @@
     }
 
     /**
-     * Returns true if an extending implementation can process the given binding element
-     */
-    protected abstract boolean handlesBindingType(Binding binding);
-
-    /**
-     * Callback to create the specific <code>ContextFactory</code> type associated with the extending implementation
+     * Callback to create the specific <code>ContextFactory</code> type associated with the extending
+     * implementation
+     *
      * @param entryPoint the entry point being processed
-     * @param msgFactory the message factory to be used by <code>EntryPointContext</code> when flowing invocations
+     * @param msgFactory the message factory to be used by <code>EntryPointContext</code> when flowing
+     *                   invocations
      */
     protected abstract EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory);
 

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java Mon May  1 23:49:04 2006
@@ -1,5 +1,8 @@
 package org.apache.tuscany.core.extension;
 
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
 import org.apache.tuscany.core.builder.BuilderException;
 import org.apache.tuscany.core.builder.ContextFactoryBuilder;
 import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry;
@@ -19,15 +22,24 @@
  *
  * @version $$Rev$$ $$Date$$
  */
-public abstract class ExternalServiceBuilderSupport implements ContextFactoryBuilder {
+public abstract class ExternalServiceBuilderSupport<T extends Binding> implements ContextFactoryBuilder {
 
     private ContextFactoryBuilderRegistry builderRegistry;
     private WireFactoryService wireService;
+    protected Class bindingClass;
 
     public ExternalServiceBuilderSupport() {
+        // reflect the generic type of the subclass
+        Type type = this.getClass().getGenericSuperclass();
+        if (type instanceof ParameterizedType) {
+            bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0];
+        } else {
+            throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized");
+        }
     }
 
     public ExternalServiceBuilderSupport(WireFactoryService wireService) {
+        this();
         this.wireService = wireService;
     }
 
@@ -51,8 +63,11 @@
             return;
         }
         ExternalService externalService = (ExternalService) object;
-        if (externalService.getBindings().size() < 1
-                || !(handlesBindingType(externalService.getBindings().get(0)))) {
+        if (externalService.getBindings().size() < 1) {
+            //   || !(handlesBindingType(externalService.getBindings().get(0)))) {
+            return;
+        }
+        if (!bindingClass.isAssignableFrom(externalService.getBindings().get(0).getClass())) {
             return;
         }
 
@@ -69,12 +84,14 @@
     /**
      * Returns true if an extending implementation can process the given binding element
      */
-    protected abstract boolean handlesBindingType(Binding binding);
+    //protected abstract boolean handlesBindingType(Binding binding);
 
     /**
-    * Callback to create the specific <code>ContextFactory</code> type associated with the extending implementation
-    * @param externalService the external service being processed
-    */
+     * Callback to create the specific <code>ContextFactory</code> type associated with the extending
+     * implementation
+     *
+     * @param externalService the external service being processed
+     */
     protected abstract ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService);
 
 }

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java Mon May  1 23:49:04 2006
@@ -13,6 +13,10 @@
  */
 package org.apache.tuscany.core.extension;
 
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
 import org.apache.tuscany.core.builder.BuilderConfigException;
 import org.apache.tuscany.core.builder.WireBuilder;
 import org.apache.tuscany.core.context.QualifiedName;
@@ -21,21 +25,20 @@
 import org.apache.tuscany.core.system.annotation.Autowire;
 import org.apache.tuscany.core.wire.SourceInvocationConfiguration;
 import org.apache.tuscany.core.wire.SourceWireFactory;
+import org.apache.tuscany.core.wire.TargetInvocationConfiguration;
 import org.apache.tuscany.core.wire.TargetInvoker;
 import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.core.wire.TargetInvocationConfiguration;
 import org.osoa.sca.annotations.Init;
 
-import java.lang.reflect.Method;
-
 /**
  * A base class for {@link WireBuilder} implementations
  *
  * @version $$Rev$$ $$Date$$
  */
-public abstract class WireBuilderSupport implements WireBuilder {
+public abstract class WireBuilderSupport<T> implements WireBuilder {
 
     protected RuntimeContext runtimeContext;
+    protected Class targetClass;
 
     @Autowire
     public void setRuntimeContext(RuntimeContext context) {
@@ -43,6 +46,13 @@
     }
 
     public WireBuilderSupport() {
+        // reflect the generic type of the subclass
+        Type type = this.getClass().getGenericSuperclass();
+        if (type instanceof ParameterizedType) {
+            targetClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0];
+        } else {
+            throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized");
+        }
     }
 
     @Init(eager = true)
@@ -52,9 +62,10 @@
 
     public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope,
                         ScopeContext targetScopeContext) throws BuilderConfigException {
-        if (!handlesTargetType(targetType)) {
+        if (!targetClass.isAssignableFrom(targetType)) {
             return;
         }
+
         for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations()
                 .values()) {
             TargetInvoker invoker = createInvoker(sourceFactory.getConfiguration()
@@ -65,30 +76,25 @@
 
     public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext)
             throws BuilderConfigException {
-        
-        if (!handlesTargetType(targetType)) {
+
+        if (!targetClass.isAssignableFrom(targetType)) {
             return;
         }
         for (TargetInvocationConfiguration targetInvocationConfig : targetFactory.getConfiguration().getInvocationConfigurations()
                 .values()) {
             Method method = targetInvocationConfig.getMethod();
-            TargetInvoker invoker = createInvoker(targetFactory.getConfiguration().getTargetName(), method, targetScopeContext,false);
+            TargetInvoker invoker = createInvoker(targetFactory.getConfiguration().getTargetName(), method, targetScopeContext, false);
             targetInvocationConfig.setTargetInvoker(invoker);
         }
     }
 
     /**
-     * Returns true if an extending implementation can process the given target type
-     */
-    protected abstract boolean handlesTargetType(Class targetType);
-
-    /**
      * Callback to create the specific <code>TargetInvoker</code> type for dispatching to the target type
      *
      * @param targetName the fully qualified name of the wire target
-     * @param operation the operation the invoker will be associated with
-     * @param context the scope context that manages the target context
-     * @param downScope whether the wire source scope is "longer" than the target
+     * @param operation  the operation the invoker will be associated with
+     * @param context    the scope context that manages the target context
+     * @param downScope  whether the wire source scope is "longer" than the target
      */
     protected abstract TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope);
 

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java Mon May  1 23:49:04 2006
@@ -19,7 +19,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -27,8 +26,8 @@
 import org.apache.tuscany.core.config.ComponentTypeIntrospector;
 import org.apache.tuscany.core.config.ConfigurationException;
 import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.core.config.processor.ProcessorUtils;
 import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector;
+import org.apache.tuscany.core.config.processor.ProcessorUtils;
 import org.apache.tuscany.core.loader.assembly.ComponentLoader;
 import org.apache.tuscany.core.loader.assembly.EntryPointLoader;
 import org.apache.tuscany.core.loader.assembly.InterfaceJavaLoader;

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java Mon May  1 23:49:04 2006
@@ -62,13 +62,6 @@
             throw e;
         }
         AutowireContext ctx = (AutowireContext) parent;
-//        if (ctx == null && required) {
-//            AutowireResolutionException e = new AutowireResolutionException("Required autowire not found");
-//            e.setIdentifier(autowireType.getName());
-//            throw e;
-//        } else if (ctx == null) {
-//            return null;
-//        }
         return ctx.resolveInstance(autowireType);
     }
 

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java Mon May  1 23:49:04 2006
@@ -66,6 +66,18 @@
     }
 
     /**
+     * Tests the case where an implementation specifies a service interface of its parent as opposed to the
+     * single interface it directly implements
+     */
+    public void testInteraceHierarchyServiceProcessing() throws Exception {
+        ComponentInfo type = factory.createComponentInfo();
+        introspector.introspect(SuperFooImpl.class, type);
+        assertEquals(1, type.getServices().size());
+        ServiceContract contract = type.getServices().get(0).getServiceContract();
+        assertEquals(SuperSuperFoo.class, contract.getInterface());
+    }
+
+    /**
      * Tests the case where a class implements two interfaces, with one specified using <code>@Service</code>
      * and one marked with <code>@Remotable</code>
      */
@@ -119,24 +131,15 @@
     }
 
     /**
-    FIXME JFM - temporarily disabled until non-annotated properties are fixed
-    public void testPropertyProcessing() throws Exception {
-        ComponentInfo type = factory.createComponentInfo();
-        introspector.introspect(TestComponentImpl.class, type);
-        List<Property>properties = type.getProperties();
-        assertEquals(3, properties.size());
-        for (Property property : properties) {
-            if (!property.getName().equals("foo") && !property.getName().equals("fooRequired")
-                    && !property.getName().equals("baz")) {
-                fail("Property names not handled properly");
-            }
-            if (property.getName().equals("fooRequired")) {
-                assertTrue(property.isRequired());
-            } else {
-                assertFalse(property.isRequired());
-            }
-        }
-    } **/
+     * FIXME JFM - temporarily disabled until non-annotated properties are fixed public void
+     * testPropertyProcessing() throws Exception { ComponentInfo type = factory.createComponentInfo();
+     * introspector.introspect(TestComponentImpl.class, type); List<Property>properties =
+     * type.getProperties(); assertEquals(3, properties.size()); for (Property property : properties) { if
+     * (!property.getName().equals("foo") && !property.getName().equals("fooRequired") &&
+     * !property.getName().equals("baz")) { fail("Property names not handled properly"); } if
+     * (property.getName().equals("fooRequired")) { assertTrue(property.isRequired()); } else {
+     * assertFalse(property.isRequired()); } } } *
+     */
 
     public void testReferenceProcessing() throws Exception {
         ComponentInfo type = factory.createComponentInfo();
@@ -164,7 +167,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         factory = new SystemAssemblyFactoryImpl();
-        introspector = ProcessorUtils.createCoreIntrospector(factory); 
+        introspector = ProcessorUtils.createCoreIntrospector(factory);
     }
 
 }

Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java?rev=398828&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java Mon May  1 23:49:04 2006
@@ -0,0 +1,7 @@
+package org.apache.tuscany.core.config.impl;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface SuperFoo {
+}

Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java?rev=398828&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java Mon May  1 23:49:04 2006
@@ -0,0 +1,10 @@
+package org.apache.tuscany.core.config.impl;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+@Service(SuperSuperFoo.class)
+public class SuperFooImpl extends SuperSuperFooImpl implements SuperFoo{
+}

Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java?rev=398828&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java Mon May  1 23:49:04 2006
@@ -0,0 +1,7 @@
+package org.apache.tuscany.core.config.impl;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface SuperSuperFoo {
+}

Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java?rev=398828&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java Mon May  1 23:49:04 2006
@@ -0,0 +1,20 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.config.impl;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class SuperSuperFooImpl implements SuperSuperFoo {
+}

Copied: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java (from r398774, incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/GenericReflectionTestCase.java)
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java?p2=incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java&p1=incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/GenericReflectionTestCase.java&r1=398774&r2=398828&rev=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/GenericReflectionTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java Mon May  1 23:49:04 2006
@@ -9,7 +9,7 @@
 /**
  * @version $$Rev$$ $$Date$$
  */
-public class GenericReflectionTestCase extends TestCase {
+public class ContextFactorySupportTestCase extends TestCase {
 
     public void testGenericReflection() throws Exception {
         TestFactoryBuilder b = new TestFactoryBuilder();

Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java?rev=398828&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java Mon May  1 23:49:04 2006
@@ -0,0 +1,62 @@
+package org.apache.tuscany.core.extension;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
+import org.apache.tuscany.core.message.MessageFactory;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.EntryPoint;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class EntryPointBuilderSupportTestCase extends TestCase {
+
+    public void testGenericReflection() throws Exception {
+        EntryPointBuilderSupportTestCase.TestEntryPointBuilder b = new EntryPointBuilderSupportTestCase.TestEntryPointBuilder();
+        assertEquals(EntryPointBuilderSupportTestCase.TestBinding.class, b.getImplementationClass());
+    }
+
+    public void testNegativeGenericReflection() throws Exception {
+        try {
+            new EntryPointBuilderSupportTestCase.NonGenericFactoryBuilder();
+            fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName());
+        } catch (AssertionError e) {
+            // indicates success
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+
+    private class TestEntryPointBuilder extends EntryPointBuilderSupport<EntryPointBuilderSupportTestCase.TestBinding> {
+
+        public Class getImplementationClass() {
+            return bindingClass;
+        }
+
+        protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) {
+            return null;
+        }
+    }
+
+    private class NonGenericFactoryBuilder extends EntryPointBuilderSupport {
+
+        public Class getImplementationClass() {
+            return bindingClass;
+        }
+
+        protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) {
+            return null;
+        }
+    }
+
+    private interface TestBinding extends Binding {
+
+    }
+}

Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java?rev=398828&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java Mon May  1 23:49:04 2006
@@ -0,0 +1,64 @@
+package org.apache.tuscany.core.extension;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.builder.impl.ExternalServiceContextFactory;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.ExternalService;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class ExternalServiceBuilderSupportTestCase extends TestCase {
+
+    public void testGenericReflection() throws Exception {
+        ExternalServiceBuilderSupportTestCase.TestExternalServiceBuilder b = new ExternalServiceBuilderSupportTestCase.TestExternalServiceBuilder();
+        assertEquals(ExternalServiceBuilderSupportTestCase.TestBinding.class, b.getImplementationClass());
+    }
+
+    public void testNegativeGenericReflection() throws Exception {
+        try {
+            new ExternalServiceBuilderSupportTestCase.NonGenericFactoryBuilder();
+            fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName());
+        } catch (AssertionError e) {
+            // indicates success
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+
+    private class TestExternalServiceBuilder extends ExternalServiceBuilderSupport<ExternalServiceBuilderSupportTestCase.TestBinding> {
+
+
+        public Class getImplementationClass() {
+            return bindingClass;
+        }
+
+        protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) {
+            return null;
+        }
+    }
+
+    private class NonGenericFactoryBuilder extends ExternalServiceBuilderSupport {
+
+
+        public Class getImplementationClass() {
+            return bindingClass;
+        }
+
+
+        protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) {
+            return null;
+        }
+    }
+
+    private interface TestBinding extends Binding {
+
+    }
+}

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java?rev=398828&r1=398827&r2=398828&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java Mon May  1 23:49:04 2006
@@ -1,5 +1,10 @@
 package org.apache.tuscany.core.extension;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
 import junit.framework.TestCase;
 import org.apache.tuscany.core.builder.impl.DefaultWireBuilder;
 import org.apache.tuscany.core.context.QualifiedName;
@@ -14,11 +19,6 @@
 import org.apache.tuscany.core.wire.mock.MockScopeContext;
 import org.apache.tuscany.model.assembly.Implementation;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * @version $$Rev$$ $$Date$$
  */
@@ -26,8 +26,8 @@
     private Method m;
 
     /**
-     * Tests that {@link WireBuilderSupport} only processes connect operations and sets target invokers for the correct target
-     * type.
+     * Tests that {@link WireBuilderSupport} only processes connect operations and sets target invokers for
+     * the correct target type.
      * <p/>
      * Verifies TUSCANY-218
      *
@@ -79,22 +79,14 @@
 
     }
 
-    private class FooWireBuilder extends WireBuilderSupport {
-
-        protected boolean handlesTargetType(Class targetType) {
-            return Foo.class.isAssignableFrom(targetType);
-        }
+    private class FooWireBuilder extends WireBuilderSupport<Foo> {
 
         protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) {
             return new FooInvoker();
         }
     }
 
-    private class BarWireBuilder extends WireBuilderSupport {
-
-        protected boolean handlesTargetType(Class targetType) {
-            return Bar.class.isAssignableFrom(targetType);
-        }
+    private class BarWireBuilder extends WireBuilderSupport<Bar> {
 
         protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) {
             return new BarInvoker();



Mime
View raw message