tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r526399 [1/2] - in /incubator/tuscany/java/sca/modules/implementation-java-runtime/src: main/java/org/apache/tuscany/core/component/ main/java/org/apache/tuscany/core/implementation/ main/java/org/apache/tuscany/core/implementation/java/ ma...
Date Sat, 07 Apr 2007 08:14:51 GMT
Author: rfeng
Date: Sat Apr  7 01:14:49 2007
New Revision: 526399

URL: http://svn.apache.org/viewvc?view=rev&rev=526399
Log:
[work-in-progress] Extract code from kernel/core to implementation-java-runtime, not compiled yet, clean up

Added:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/monitor/
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java   (with props)
Removed:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementation.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementationLoader.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentGenerator.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/TypeNotFoundException.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/implementation/composite/
Modified:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/InstanceFactoryProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactoryProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoComponent.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaInvokerInterceptor.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/TargetMethodNotFoundException.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKProxyService.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/InstanceFactoryProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/InstanceFactoryProvider.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/InstanceFactoryProvider.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/InstanceFactoryProvider.java Sat Apr  7 01:14:49 2007
@@ -18,12 +18,9 @@
  */
 package org.apache.tuscany.core.component;
 
-import java.net.URI;
-
+import org.apache.tuscany.implementation.java.impl.JavaElement;
 import org.apache.tuscany.spi.ObjectFactory;
 
-import org.apache.tuscany.core.model.physical.instancefactory.InjectionSource;
-
 /**
  * @version $Rev$ $Date$
  */
@@ -41,7 +38,7 @@
      * @param name          the injection site name
      * @param objectFactory the object factory
      */
-    void setObjectFactory(InjectionSource name, ObjectFactory<?> objectFactory);
+    void setObjectFactory(JavaElement name, ObjectFactory<?> objectFactory);
 
     /**
      * Returns the type for the injection site
@@ -49,7 +46,7 @@
      * @param injectionSite the injection site name
      * @return the required type
      */
-    Class<?> getMemberType(InjectionSource injectionSite);
+    Class<?> getMemberType(JavaElement injectionSite);
 
     /**
      * Create an instance factory that can be used to create component instances.

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactory.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactory.java Sat Apr  7 01:14:49 2007
@@ -21,12 +21,11 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 
-import org.apache.tuscany.spi.component.InstanceWrapper;
-import org.apache.tuscany.core.component.scope.ReflectiveInstanceWrapper;
 import org.apache.tuscany.core.injection.EventInvoker;
 import org.apache.tuscany.core.injection.Injector;
 import org.apache.tuscany.spi.ObjectCreationException;
 import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.InstanceWrapper;
 
 /**
  * @version $Rev$ $Date$

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactoryProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactoryProvider.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactoryProvider.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ReflectiveInstanceFactoryProvider.java Sat Apr  7 01:14:49 2007
@@ -29,9 +29,9 @@
 import org.apache.tuscany.core.injection.EventInvoker;
 import org.apache.tuscany.core.injection.FieldInjector;
 import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.MethodInjector;
 import org.apache.tuscany.core.injection.MethodEventInvoker;
-import org.apache.tuscany.core.model.physical.instancefactory.InjectionSource;
+import org.apache.tuscany.core.injection.MethodInjector;
+import org.apache.tuscany.implementation.java.impl.JavaElement;
 import org.apache.tuscany.spi.ObjectFactory;
 
 /**
@@ -40,15 +40,15 @@
 public class ReflectiveInstanceFactoryProvider<T> implements InstanceFactoryProvider<T> {
     private final Class<T> implementationClass;
     private final Constructor<T> constructor;
-    private final List<InjectionSource> constructorNames;
-    private final Map<InjectionSource, Member> injectionSites;
+    private final List<JavaElement> constructorNames;
+    private final Map<JavaElement, Member> injectionSites;
     private final EventInvoker<T> initInvoker;
     private final EventInvoker<T> destroyInvoker;
-    private final Map<InjectionSource, ObjectFactory<?>> factories = new HashMap<InjectionSource, ObjectFactory<?>>();
+    private final Map<JavaElement, ObjectFactory<?>> factories = new HashMap<JavaElement, ObjectFactory<?>>();
 
     public ReflectiveInstanceFactoryProvider(Constructor<T> constructor,
-                                             List<InjectionSource> constructorNames,
-                                             Map<InjectionSource, Member> injectionSites,
+                                             List<JavaElement> constructorNames,
+                                             Map<JavaElement, Member> injectionSites,
                                              Method initMethod,
                                              Method destroyMethod) {
         this.implementationClass = constructor.getDeclaringClass();
@@ -59,11 +59,11 @@
         this.destroyInvoker = destroyMethod == null ? null : new MethodEventInvoker<T>(destroyMethod);
     }
 
-    public void setObjectFactory(InjectionSource name, ObjectFactory<?> objectFactory) {
+    public void setObjectFactory(JavaElement name, ObjectFactory<?> objectFactory) {
         factories.put(name, objectFactory);
     }
 
-    public Class<?> getMemberType(InjectionSource injectionSource) {
+    public Class<?> getMemberType(JavaElement injectionSource) {
         
         // TODO How do we decide whether this is a member or constructor arg
         Member member = injectionSites.get(injectionSource);
@@ -95,7 +95,7 @@
     protected ObjectFactory<?>[] getConstructorArgs() {
         ObjectFactory<?>[] initArgs = new ObjectFactory<?>[constructorNames.size()];
         for (int i = 0; i < initArgs.length; i++) {
-            InjectionSource name = constructorNames.get(i);
+            JavaElement name = constructorNames.get(i);
             ObjectFactory<?> factory = factories.get(name);
             assert factory != null;
             initArgs[i] = factory;
@@ -109,8 +109,8 @@
         Injector<T>[] injectors = (Injector<T>[]) new Injector[injectionSites.size()];
 
         int i = 0;
-        for (Map.Entry<InjectionSource, Member> entry : injectionSites.entrySet()) {
-            InjectionSource name = entry.getKey();
+        for (Map.Entry<JavaElement, Member> entry : injectionSites.entrySet()) {
+            JavaElement name = entry.getKey();
             Member site = entry.getValue();
             ObjectFactory<?> factory = factories.get(name);
             assert factory != null;

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java Sat Apr  7 01:14:49 2007
@@ -29,30 +29,12 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-
-import org.apache.tuscany.spi.CoreRuntimeException;
-import org.apache.tuscany.spi.ObjectCreationException;
-import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.component.InstanceWrapper;
-import org.apache.tuscany.spi.component.TargetDestructionException;
-import org.apache.tuscany.spi.component.TargetResolutionException;
-import org.apache.tuscany.spi.extension.AtomicComponentExtension;
-import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
-import org.apache.tuscany.spi.implementation.java.Parameter;
-import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.wire.Wire;
-
 import org.apache.tuscany.api.annotation.Resource;
 import org.apache.tuscany.core.component.ComponentContextImpl;
 import org.apache.tuscany.core.component.ComponentContextProvider;
 import org.apache.tuscany.core.component.InstanceFactory;
+import org.apache.tuscany.core.component.ReflectiveInstanceWrapper;
 import org.apache.tuscany.core.component.ServiceReferenceImpl;
-import org.apache.tuscany.core.component.scope.ReflectiveInstanceWrapper;
 import org.apache.tuscany.core.injection.ArrayMultiplicityObjectFactory;
 import org.apache.tuscany.core.injection.CallbackWireObjectFactory;
 import org.apache.tuscany.core.injection.ConversationIDObjectFactory;
@@ -66,6 +48,22 @@
 import org.apache.tuscany.core.injection.NoMultiplicityTypeException;
 import org.apache.tuscany.core.injection.ObjectCallbackException;
 import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
+import org.apache.tuscany.implementation.java.impl.Parameter;
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.wire.Wire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
 
 /**
  * Base implementation of an

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoComponent.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoComponent.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoComponent.java Sat Apr  7 01:14:49 2007
@@ -22,10 +22,15 @@
 import java.util.List;
 import java.util.Map;
 
-import org.osoa.sca.ComponentContext;
-
+import org.apache.tuscany.assembly.Property;
+import org.apache.tuscany.core.component.ComponentObjectFactory;
+import org.apache.tuscany.core.component.InstanceFactory;
+import org.apache.tuscany.core.component.InstanceFactoryProvider;
+import org.apache.tuscany.idl.Operation;
+import org.apache.tuscany.implementation.java.impl.JavaElement;
 import org.apache.tuscany.spi.ObjectCreationException;
 import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.Scope;
 import org.apache.tuscany.spi.component.AbstractSCAObject;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.ComponentException;
@@ -36,17 +41,9 @@
 import org.apache.tuscany.spi.component.Service;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
 import org.apache.tuscany.spi.component.TargetResolutionException;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.PropertyValue;
-import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.wire.Wire;
-
-import org.apache.tuscany.core.component.InstanceFactory;
-import org.apache.tuscany.core.component.InstanceFactoryProvider;
-import org.apache.tuscany.core.component.ComponentObjectFactory;
-import org.apache.tuscany.core.model.physical.instancefactory.InjectionSource;
+import org.osoa.sca.ComponentContext;
 
 /**
  * Base class for Component implementations based on Java objects.
@@ -124,11 +121,6 @@
         return new ComponentObjectFactory(this, scopeContainer);
     }
 
-    public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
-        throws TargetInvokerCreationException {
-        return null;
-    }
-
     public ComponentContext getComponentContext() {
         return null;
     }
@@ -137,11 +129,11 @@
         return null;
     }
 
-    public Map<String, PropertyValue<?>> getDefaultPropertyValues() {
+    public Map<String, Property> getDefaultPropertyValues() {
         return null;
     }
 
-    public void setDefaultPropertyValues(Map<String, PropertyValue<?>> defaultPropertyValues) {
+    public void setDefaultPropertyValues(Map<String, Property> defaultPropertyValues) {
     }
 
     public ScopeContainer getScopeContainer() {
@@ -152,11 +144,11 @@
         return provider.getImplementationClass();
     }
 
-    public void setObjectFactory(InjectionSource name, ObjectFactory<?> objectFactory) {
+    public void setObjectFactory(JavaElement name, ObjectFactory<?> objectFactory) {
         provider.setObjectFactory(name, objectFactory);
     }
 
-    public Class<?> getMemberType(InjectionSource injectionSite) {
+    public Class<?> getMemberType(JavaElement injectionSite) {
         return provider.getMemberType(injectionSite);
     }
 

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java Sat Apr  7 01:14:49 2007
@@ -25,14 +25,13 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
-import org.apache.tuscany.spi.wire.ProxyService;
-
+import org.apache.tuscany.core.component.InstanceFactory;
 import org.apache.tuscany.core.injection.EventInvoker;
 import org.apache.tuscany.core.injection.Injector;
 import org.apache.tuscany.core.injection.PojoObjectFactory;
-import org.apache.tuscany.core.component.InstanceFactory;
+import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.ProxyService;
 
 /**
  * Encapsulates confuration for a Java-based atomic component

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java Sat Apr  7 01:14:49 2007
@@ -20,18 +20,16 @@
 
 import java.lang.reflect.Method;
 
+import org.apache.tuscany.core.implementation.PojoAtomicComponent;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.util.JavaIDLUtils;
+import org.apache.tuscany.core.wire.WireObjectFactory;
+import org.apache.tuscany.idl.Operation;
 import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.idl.java.JavaIDLUtils;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.wire.Wire;
 
-import org.apache.tuscany.core.implementation.PojoAtomicComponent;
-import org.apache.tuscany.core.implementation.PojoConfiguration;
-import org.apache.tuscany.core.wire.WireObjectFactory;
-
 /**
  * The runtime instantiation of Java component implementations
  *
@@ -43,11 +41,11 @@
         super(configuration);
     }
 
-    public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+    public TargetInvoker createTargetInvoker(String targetName, Operation operation, boolean isCallback)
         throws TargetInvokerCreationException {
 
         Class<?> implClass;
-        if (operation.isCallback()) {
+        if (isCallback) {
             implClass = operation.getServiceContract().getCallbackClass();
         } else {
             implClass = implementationClass;
@@ -59,11 +57,6 @@
             throw new TargetMethodNotFoundException(operation);
         }
 
-    }
-
-    public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
-        throws TargetInvokerCreationException {
-        throw new UnsupportedOperationException();
     }
 
     protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire) {

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java Sat Apr  7 01:14:49 2007
@@ -22,30 +22,25 @@
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.annotations.Reference;
-
+import org.apache.tuscany.assembly.Component;
+import org.apache.tuscany.core.implementation.PojoComponentContextFactory;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.ResourceObjectFactory;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
+import org.apache.tuscany.implementation.java.impl.JavaElement;
+import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.impl.Resource;
 import org.apache.tuscany.spi.ObjectFactory;
 import org.apache.tuscany.spi.builder.BuilderConfigException;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
 import org.apache.tuscany.spi.host.ResourceHost;
-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.Parameter;
-import org.apache.tuscany.spi.implementation.java.PojoComponentType;
-import org.apache.tuscany.spi.implementation.java.Resource;
-import org.apache.tuscany.spi.model.ComponentDefinition;
-import org.apache.tuscany.spi.model.PropertyValue;
-
-import org.apache.tuscany.core.implementation.PojoComponentContextFactory;
-import org.apache.tuscany.core.implementation.PojoConfiguration;
-import org.apache.tuscany.core.injection.MethodEventInvoker;
-import org.apache.tuscany.core.injection.PojoObjectFactory;
-import org.apache.tuscany.core.injection.ResourceObjectFactory;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Reference;
 
 /**
  * Builds a Java-based atomic context from a component definition
@@ -62,17 +57,12 @@
     }
 
     @SuppressWarnings("unchecked")
-    public AtomicComponent build(ComponentDefinition<JavaImplementation> definition, DeploymentContext context)
+    public AtomicComponent build(Component definition, DeploymentContext context)
         throws BuilderConfigException {
-        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
-            definition.getImplementation().getComponentType();
+        JavaImplementationDefinition componentType = (JavaImplementationDefinition)
+            definition.getImplementation();
 
         PojoConfiguration configuration = new PojoConfiguration();
-        if (definition.getInitLevel() != null) {
-            configuration.setInitLevel(definition.getInitLevel());
-        } else {
-            configuration.setInitLevel(componentType.getInitLevel());
-        }
         if (componentType.getMaxAge() > 0) {
             configuration.setMaxAge(componentType.getMaxAge());
         } else if (componentType.getMaxIdleTime() > 0) {
@@ -93,12 +83,12 @@
         configuration.setImplementationClass(definition.getImplementation().getImplementationClass());
 
         // setup property injection sites
-        for (JavaMappedProperty<?> property : componentType.getProperties().values()) {
-            configuration.addPropertySite(property.getName(), property.getMember());
+        for (JavaElement property : componentType.getPropertyMembers().values()) {
+            configuration.addPropertySite(property.getName(), property);
         }
 
         // setup reference injection sites
-        for (JavaMappedReference reference : componentType.getReferences().values()) {
+        for (JavaElement reference : componentType.getReferenceMembers().values()) {
             Member member = reference.getMember();
             if (member != null) {
                 // could be null if the reference is mapped to a constructor
@@ -179,7 +169,7 @@
         return new ResourceObjectFactory<T>(type, mappedName, optional, host);
     }
 
-    private void handleProperties(ComponentDefinition<JavaImplementation> definition, JavaAtomicComponent component) {
+    private void handleProperties(Component definition, JavaAtomicComponent component) {
         for (PropertyValue<?> property : definition.getPropertyValues().values()) {
             ObjectFactory<?> factory = property.getValueFactory();
             if (factory != null) {

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java Sat Apr  7 01:14:49 2007
@@ -20,22 +20,14 @@
 
 import java.net.URL;
 
+import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.introspection.IntrospectionRegistry;
+import org.apache.tuscany.implementation.java.introspection.Introspector;
+import org.apache.tuscany.implementation.java.introspection.ProcessingException;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.osoa.sca.annotations.Constructor;
 import org.osoa.sca.annotations.Reference;
-
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
-import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
-import org.apache.tuscany.spi.implementation.java.Introspector;
-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 org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.loader.LoaderRegistry;
-
-import org.apache.tuscany.core.util.JavaIntrospectionHelper;
 
 /**
  * @version $Rev$ $Date$

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaInvokerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaInvokerInterceptor.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaInvokerInterceptor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaInvokerInterceptor.java Sat Apr  7 01:14:49 2007
@@ -40,13 +40,13 @@
  */
 public class JavaInvokerInterceptor<T, CONTEXT> implements Interceptor {
     /* indicates that no conversational sequence is associated with the message */
-    public final static short NONE = 0;
+    public static final short NONE = 0;
     /* indicates that the message initiates a conversation */
-    public final static short START = 1;
+    public static final short START = 1;
     /* indicates that the message continues a conversation */
-    public final static short CONTINUE = 2;
+    public static final short CONTINUE = 2;
     /* indicates that the message ends a conversation */
-    public final static short END = 3;
+    public static final short END = 3;
 
     private Method operation;
     private AtomicComponent<T> component;

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java Sat Apr  7 01:14:49 2007
@@ -21,6 +21,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
+import org.apache.tuscany.spi.Scope;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.ComponentException;
 import org.apache.tuscany.spi.component.InstanceWrapper;
@@ -29,24 +30,21 @@
 import org.apache.tuscany.spi.component.TargetException;
 import org.apache.tuscany.spi.component.WorkContext;
 import org.apache.tuscany.spi.extension.TargetInvokerExtension;
-import org.apache.tuscany.spi.model.Scope;
 
 /**
- * Responsible for synchronously dispatching an invocation to a Java component implementation instance
- *
+ * Responsible for synchronously dispatching an invocation to a Java component
+ * implementation instance
+ * 
  * @version $Rev$ $Date$
  */
 public class JavaTargetInvoker<T> extends TargetInvokerExtension {
     protected Method operation;
+    protected boolean stateless;
+    protected InstanceWrapper<T> target;
     private final AtomicComponent<T> component;
     private final ScopeContainer scopeContainer;
-    protected InstanceWrapper<T> target;
-    protected boolean stateless;
 
-    public JavaTargetInvoker(Method operation,
-                             AtomicComponent<T> component,
-                             ScopeContainer scopeContainer
-    ) {
+    public JavaTargetInvoker(Method operation, AtomicComponent<T> component, ScopeContainer scopeContainer) {
         assert operation != null : "Operation method cannot be null";
         this.operation = operation;
         this.component = component;
@@ -54,7 +52,45 @@
         stateless = Scope.STATELESS == scopeContainer.getScope();
     }
 
-    public Object invokeTarget(final Object payload, final short sequence, WorkContext workContext) throws InvocationTargetException {
+    @Override
+    public JavaTargetInvoker clone() throws CloneNotSupportedException {
+        try {
+            JavaTargetInvoker invoker = (JavaTargetInvoker)super.clone();
+            invoker.target = null;
+            return invoker;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }
+
+    /**
+     * Resolves the target service instance or returns a cached one
+     */
+    protected InstanceWrapper<T> getInstance(short sequence, Object contextId) throws TargetException {
+        switch (sequence) {
+            case NONE:
+                if (cacheable) {
+                    if (target == null) {
+                        target = scopeContainer.getWrapper(component, contextId);
+                    }
+                    return target;
+                } else {
+                    return scopeContainer.getWrapper(component, contextId);
+                }
+            case START:
+                assert !cacheable;
+                return scopeContainer.getWrapper(component, contextId);
+            case CONTINUE:
+            case END:
+                assert !cacheable;
+                return scopeContainer.getAssociatedWrapper(component, contextId);
+            default:
+                throw new InvalidConversationSequenceException("Unknown sequence type", String.valueOf(sequence));
+        }
+    }
+
+    public Object invokeTarget(final Object payload, final short sequence, WorkContext workContext)
+        throws InvocationTargetException {
         Object contextId = workContext.getIdentifier(scopeContainer.getScope());
         try {
             InstanceWrapper<T> wrapper = getInstance(sequence, contextId);
@@ -63,7 +99,7 @@
             if (payload != null && !payload.getClass().isArray()) {
                 ret = operation.invoke(instance, payload);
             } else {
-                ret = operation.invoke(instance, (Object[]) payload);
+                ret = operation.invoke(instance, (Object[])payload);
             }
             scopeContainer.returnWrapper(component, wrapper, contextId);
             if (sequence == END) {
@@ -77,43 +113,5 @@
             throw new InvocationTargetException(e);
         }
     }
-
-    @Override
-    public JavaTargetInvoker clone() throws CloneNotSupportedException {
-        try {
-            JavaTargetInvoker invoker = (JavaTargetInvoker) super.clone();
-            invoker.target = null;
-            return invoker;
-        } catch (CloneNotSupportedException e) {
-            return null; // will not happen
-        }
-    }
-
-    /**
-     * Resolves the target service instance or returns a cached one
-     */
-    protected InstanceWrapper<T> getInstance(short sequence, Object contextId) throws TargetException {
-        switch (sequence) {
-        case NONE:
-            if (cacheable) {
-                if (target == null) {
-                    target = scopeContainer.getWrapper(component, contextId);
-                }
-                return target;
-            } else {
-                return scopeContainer.getWrapper(component, contextId);
-            }
-        case START:
-            assert !cacheable;
-            return scopeContainer.getWrapper(component, contextId);
-        case CONTINUE:
-        case END:
-            assert !cacheable;
-            return scopeContainer.getAssociatedWrapper(component, contextId);
-        default:
-            throw new InvalidConversationSequenceException("Unknown sequence type", String.valueOf(sequence));
-        }
-    }
-
 
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/TargetMethodNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/TargetMethodNotFoundException.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/TargetMethodNotFoundException.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/java/TargetMethodNotFoundException.java Sat Apr  7 01:14:49 2007
@@ -18,29 +18,25 @@
  */
 package org.apache.tuscany.core.implementation.java;
 
+import org.apache.tuscany.idl.Operation;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
 
 /**
  * @version $Rev$ $Date$
  */
 public class TargetMethodNotFoundException extends TargetInvokerCreationException {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -8565552977647191863L;
     private Operation operation;
-    private PhysicalOperationDefinition pOperation;
 
     /**
-     * @deprecated
      * @param operation
      */
     public TargetMethodNotFoundException(Operation operation) {
         super("Target method not found for operation");
         this.operation = operation;
-    }
-
-    public TargetMethodNotFoundException(PhysicalOperationDefinition operation) {
-        super("Target method not found for operation");
-        this.pOperation = operation;
     }
 
     public Operation getOperation() {

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java Sat Apr  7 01:14:49 2007
@@ -19,8 +19,8 @@
 package org.apache.tuscany.core.injection;
 
 import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.Scope;
 import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.model.Scope;
 
 public class ConversationIDObjectFactory implements ObjectFactory<String> {
     

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java Sat Apr  7 01:14:49 2007
@@ -18,7 +18,7 @@
  */
 package org.apache.tuscany.core.injection;
 
-import org.apache.tuscany.api.TuscanyRuntimeException;
+import org.apache.tuscany.spi.TuscanyRuntimeException;
 
 /**
  * Root unchecked exception for the injection package

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java Sat Apr  7 01:14:49 2007
@@ -18,13 +18,11 @@
  */
 package org.apache.tuscany.core.injection;
 
-import org.osoa.sca.RequestContext;
-
+import org.apache.tuscany.core.implementation.composite.RequestContextImpl;
 import org.apache.tuscany.spi.ObjectCreationException;
 import org.apache.tuscany.spi.ObjectFactory;
 import org.apache.tuscany.spi.component.WorkContext;
-
-import org.apache.tuscany.core.implementation.composite.ManagedRequestContext;
+import org.osoa.sca.RequestContext;
 
 /**
  * Creates instances of {@link org.apache.tuscany.core.implementation.composite.ManagedRequestContext} for injection on
@@ -40,7 +38,7 @@
         this.workContext = workContext;
     }
 
-    public ManagedRequestContext getInstance() throws ObjectCreationException {
-        return new ManagedRequestContext(workContext);
+    public RequestContext getInstance() throws ObjectCreationException {
+        return new RequestContextImpl(workContext);
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java Sat Apr  7 01:14:49 2007
@@ -20,9 +20,9 @@
 
 import java.io.PrintWriter;
 
-import org.apache.tuscany.api.TuscanyException;
-import org.apache.tuscany.api.TuscanyRuntimeException;
 import org.apache.tuscany.host.monitor.ExceptionFormatter;
+import org.apache.tuscany.spi.TuscanyException;
+import org.apache.tuscany.spi.TuscanyRuntimeException;
 
 /**
  * Performs basics formatting of exceptions for JDK logging

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java Sat Apr  7 01:14:49 2007
@@ -32,18 +32,16 @@
 import java.util.List;
 import java.util.Map;
 
-import org.osoa.sca.NoRegisteredCallbackException;
-
+import org.apache.tuscany.idl.Operation;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.ReactivationException;
 import org.apache.tuscany.spi.component.SCAExternalizable;
 import org.apache.tuscany.spi.component.WorkContext;
-import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findOperation;
-import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.wire.AbstractInvocationHandler;
 import org.apache.tuscany.spi.wire.InvocationChain;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.wire.Wire;
+import org.osoa.sca.NoRegisteredCallbackException;
 
 
 /**
@@ -98,7 +96,7 @@
         assert targetAddress != null;
         Wire wire = wires.get(targetAddress);
         assert wire != null;
-        Map<Operation<?>, InvocationChain> chains = wire.getCallbackInvocationChains();
+        Map<Operation, InvocationChain> chains = wire.getCallbackInvocationChains();
         Operation operation = findOperation(method, chains.keySet());
         InvocationChain chain = chains.get(operation);
         TargetInvoker invoker = chain.getTargetInvoker();

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java Sat Apr  7 01:14:49 2007
@@ -30,23 +30,22 @@
 import java.util.Map;
 import java.util.UUID;
 
+import org.apache.tuscany.assembly.Contract;
+import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
+import org.apache.tuscany.core.wire.NoMethodForOperationException;
+import org.apache.tuscany.core.wire.WireUtils;
+import org.apache.tuscany.spi.Scope;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.ReactivationException;
 import org.apache.tuscany.spi.component.SCAExternalizable;
 import org.apache.tuscany.spi.component.TargetInvocationException;
 import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.AbstractInvocationHandler;
 import org.apache.tuscany.spi.wire.ChainHolder;
 import org.apache.tuscany.spi.wire.InvocationChain;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.wire.Wire;
 
-import org.apache.tuscany.core.wire.NoMethodForOperationException;
-import org.apache.tuscany.core.wire.WireUtils;
-import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
-
 
 /**
  * Dispatches to a target through a wire.
@@ -205,10 +204,10 @@
      */
     private void init(Class<?> interfaze, Wire wire, Map<Method, ChainHolder> mapping)
         throws NoMethodForOperationException {
-        ServiceContract contract = wire.getSourceContract();
+        Contract contract = wire.getSourceContract();
         this.referenceName = wire.getSourceUri().getFragment();
-        this.conversational = contract.isConversational();
-        this.callback = contract.getCallbackClass() != null;
+        this.conversational = contract.getInterface().isConversational();
+        this.callback = contract.getCallbackInterface() != null;
         // FIXME JFM this should not be dependent on PojoAtomicComponent
         // JFM commenting out as this should not be specific to pojo types
 //        this.wireContainerIsAtomicComponent = scaObject instanceof PojoAtomicComponent;

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKProxyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKProxyService.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKProxyService.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/wire/jdk/JDKProxyService.java Sat Apr  7 01:14:49 2007
@@ -24,18 +24,15 @@
 import java.util.List;
 import java.util.Map;
 
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.annotations.Constructor;
-import org.osoa.sca.annotations.EagerInit;
-import org.osoa.sca.annotations.Reference;
-
+import org.apache.tuscany.core.wire.ProxyServiceExtension;
 import org.apache.tuscany.spi.component.WorkContext;
 import org.apache.tuscany.spi.wire.ChainHolder;
 import org.apache.tuscany.spi.wire.ProxyCreationException;
 import org.apache.tuscany.spi.wire.Wire;
-import org.apache.tuscany.spi.wire.InvocationChain;
-
-import org.apache.tuscany.core.wire.ProxyServiceExtension;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Reference;
 
 /**
  * the default implementation of a wire service that uses JDK dynamic proxies
@@ -62,14 +59,6 @@
         return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
     }
 
-    public <T> T createProxy2(Class<T> interfaze, boolean conversational, Wire wire) throws ProxyCreationException {
-        assert interfaze != null;
-        assert wire != null;
-        JDKInvocationHandler2 handler = new JDKInvocationHandler2(interfaze, conversational, wire, context);
-        ClassLoader cl = interfaze.getClassLoader();
-        return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
-    }
-
     public <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, ChainHolder> mapping)
         throws ProxyCreationException {
         assert interfaze != null;
@@ -83,12 +72,6 @@
     public Object createCallbackProxy(Class<?> interfaze, List<Wire> wires) throws ProxyCreationException {
         ClassLoader cl = interfaze.getClassLoader();
         JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wires, context);
-        return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
-    }
-
-    public Object createCallbackProxy(Class<?> interfaze) throws ProxyCreationException {
-        ClassLoader cl = interfaze.getClassLoader();
-        JDKCallbackInvocationHandler2 handler = new JDKCallbackInvocationHandler2(context);
         return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
     }
 

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java?view=auto&rev=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java Sat Apr  7 01:14:49 2007
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.integration.conversation;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.scope.ConversationalScopeContainer;
+import org.apache.tuscany.core.services.store.memory.MemoryStore;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Provides helper methods for setting up a partial runtime for conversational test cases.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractConversationTestCase extends TestCase {
+    protected ScopeContainer container;
+    protected MemoryStore store;
+    protected WorkContext workContext;
+
+    protected void createRuntime() {
+        workContext = new WorkContextImpl();
+        store = new MemoryStore(EasyMock.createNiceMock(StoreMonitor.class));
+        container = new ConversationalScopeContainer(store, workContext, null);
+    }
+
+    protected void initializeRuntime() {
+        store.init();
+        container.start();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java?view=auto&rev=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java Sat Apr  7 01:14:49 2007
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
+import org.easymock.classextension.EasyMock;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Verifies conversational resources are cleaned up if the maximum idle time is exceeded
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ConversationIdleExpireTestCase extends AbstractConversationTestCase {
+    protected AtomicComponent target;
+    private JDKInvocationHandler handler;
+    private FooImpl targetInstance;
+    private Method operation1;
+    private Method operation2;
+    private final Object mutex = new Object();
+
+    public void testConversationExpire() throws Throwable {
+        workContext.setIdentifier(Scope.CONVERSATION, "12345A");
+        // start the conversation
+        handler.invoke(operation1, null);
+        // verify the instance was persisted
+        assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+        synchronized (mutex) {
+            mutex.wait(100);
+        }
+        // verify the instance was expired
+        assertNull(store.readRecord(target, "12345A"));
+        // continue the conversation - should throw an error
+        try {
+            handler.invoke(operation2, null);
+            fail();
+        } catch (TargetNotFoundException e) {
+            // expected
+        }
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        createRuntime();
+        store.setReaperInterval(10);
+        initializeRuntime();
+
+        targetInstance = EasyMock.createMock(FooImpl.class);
+        targetInstance.operation1();
+        targetInstance.operation2();
+        targetInstance.end();
+        EasyMock.replay(targetInstance);
+        target = createTarget();
+
+        Wire wire = MockFactory.createWire("foo", Foo.class);
+        for (InvocationChain chain : wire.getInvocationChains().values()) {
+            chain.setTargetInvoker(target.createTargetInvoker("target", chain.getOperation(), false));
+        }
+        handler = new JDKInvocationHandler(Foo.class, wire, workContext);
+        operation1 = Foo.class.getMethod("operation1");
+        operation2 = Foo.class.getMethod("operation2");
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        container.stop();
+        store.destroy();
+    }
+
+    private JavaAtomicComponent createTarget() throws Exception {
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setName(new URI("target"));
+        configuration.setMaxIdleTime(50);
+        configuration.setInstanceFactory(new MockPojoFactory(FooImpl.class.getConstructor()));
+        configuration.setImplementationClass(FooImpl.class);
+        JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+        component.setScopeContainer(container);
+        component.start();
+        return component;
+    }
+
+    private class MockPojoFactory extends PojoObjectFactory<FooImpl> {
+        public MockPojoFactory(Constructor<FooImpl> ctr) {
+            super(ctr);
+        }
+
+        public FooImpl getInstance() throws ObjectCreationException {
+            return targetInstance;
+        }
+    }
+
+    @Conversational
+    public static interface Foo {
+
+        void operation1();
+
+        void operation2();
+
+        @EndsConversation
+        void end();
+
+    }
+
+    public static class FooImpl implements Foo {
+
+        public void operation1() {
+        }
+
+        public void operation2() {
+        }
+
+        @EndsConversation
+        public void end() {
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java?view=auto&rev=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java Sat Apr  7 01:14:49 2007
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
+import org.easymock.classextension.EasyMock;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Verifies conversational resources are cleaned up if the maximum age is exceeded
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ConversationMaxAgeExpireTestCase extends AbstractConversationTestCase {
+    protected AtomicComponent target;
+    private JDKInvocationHandler handler;
+    private FooImpl targetInstance;
+    private Method operation1;
+    private Method operation2;
+    private final Object mutex = new Object();
+
+    public void testConversationExpire() throws Throwable {
+/*
+        workContext.setIdentifier(org.apache.tuscany.spi.model.Scope.CONVERSATION, "12345A");
+        // start the conversation
+        handler.invoke(operation1, null);
+        // verify the instance was persisted
+        assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+        synchronized (mutex) {
+            mutex.wait(100);
+        }
+        // verify the instance was expired
+        assertNull(store.readRecord(target, "12345A"));
+        // continue the conversation - should throw an error
+        try {
+            handler.invoke(operation2, null);
+            fail();
+        } catch (TargetNotFoundException e) {
+            // expected
+        }
+*/
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        createRuntime();
+        store.setReaperInterval(10);
+        initializeRuntime();
+
+        targetInstance = EasyMock.createMock(FooImpl.class);
+        targetInstance.operation1();
+        targetInstance.operation2();
+        targetInstance.end();
+        EasyMock.replay(targetInstance);
+        target = createTarget();
+        // create source component mock
+        JavaAtomicComponent source = EasyMock.createMock(JavaAtomicComponent.class);
+        EasyMock.expect(source.getUri()).andReturn(URI.create("source")).atLeastOnce();
+        EasyMock.replay(source);
+
+        Wire wire = MockFactory.createWire("foo", Foo.class);
+        for (InvocationChain chain : wire.getInvocationChains().values()) {
+            chain.setTargetInvoker(target.createTargetInvoker("target", chain.getOperation(), false));
+        }
+        handler = new JDKInvocationHandler(Foo.class, wire, workContext);
+        operation1 = Foo.class.getMethod("operation1");
+        operation2 = Foo.class.getMethod("operation2");
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        container.stop();
+        store.destroy();
+    }
+
+    private AtomicComponent createTarget() throws Exception {
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setName(new URI("target"));
+        configuration.setMaxAge(50);
+        Constructor<FooImpl> ctor = FooImpl.class.getConstructor();
+        configuration.setInstanceFactory(new MockPojoFactory(ctor));
+        configuration.setImplementationClass(FooImpl.class);
+        JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+        component.setScopeContainer(container);
+        component.start();
+        return component;
+    }
+
+    private class MockPojoFactory extends PojoObjectFactory<FooImpl> {
+        public MockPojoFactory(Constructor<FooImpl> ctr) {
+            super(ctr);
+        }
+
+        public FooImpl getInstance() throws ObjectCreationException {
+            return targetInstance;
+        }
+    }
+
+    @Conversational
+    public static interface Foo {
+
+        void operation1();
+
+        void operation2();
+
+        @EndsConversation
+        void end();
+
+    }
+
+    public static class FooImpl implements Foo {
+
+        public void operation1() {
+        }
+
+        public void operation2() {
+        }
+
+        @EndsConversation
+        public void end() {
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java?view=auto&rev=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java Sat Apr  7 01:14:49 2007
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
+import org.easymock.classextension.EasyMock;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Verifies start, continue and end conversation invocations are processed properly. Checks that a target instance is
+ * properly instantiated and persisted in the store. Additionally verifies that invocations are dispatched to a target
+ * instance, and that start, continue, and end operations are performed correctly. Finally, verfies that the target
+ * instance is removed from the store when the conversation ends.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ConversationStartStopEndTestCase extends AbstractConversationTestCase {
+    protected AtomicComponent target;
+    private FooImpl targetInstance;
+    private JDKInvocationHandler handler;
+    private Method operation1;
+    private Method operation2;
+    private Method endOperation;
+
+    public void testConversationStartContinueEnd() throws Throwable {
+        workContext.setIdentifier(Scope.CONVERSATION, "12345A");
+        // start the conversation
+        handler.invoke(operation1, null);
+        // verify the instance was persisted
+        assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+        // continue the conversation
+        handler.invoke(operation2, null);
+        // verify the instance was persisted
+        assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+        // end the conversation
+        handler.invoke(endOperation, null);
+        workContext.clearIdentifier(Scope.CONVERSATION);
+        EasyMock.verify(targetInstance);
+        // verify the store has removed the instance
+        assertNull(store.readRecord(target, "12345A"));
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        createRuntime();
+        initializeRuntime();
+        targetInstance = EasyMock.createMock(FooImpl.class);
+        targetInstance.operation1();
+        targetInstance.operation2();
+        targetInstance.end();
+        EasyMock.replay(targetInstance);
+        // create target component mock
+        target = createAtomicComponent();
+        Wire wire = MockFactory.createWire("foo", Foo.class);
+        for (InvocationChain chain : wire.getInvocationChains().values()) {
+            chain.setTargetInvoker(target.createTargetInvoker("foo", chain.getOperation(), false));
+        }
+        handler = new JDKInvocationHandler(Foo.class, wire, workContext);
+        operation1 = Foo.class.getMethod("operation1");
+        operation2 = Foo.class.getMethod("operation2");
+        endOperation = Foo.class.getMethod("end");
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        container.stop();
+        store.destroy();
+    }
+
+    private JavaAtomicComponent createAtomicComponent() throws Exception {
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setName(new URI("target"));
+        configuration.setInstanceFactory(new MockPojoFactory(FooImpl.class.getConstructor()));
+        configuration.setImplementationClass(FooImpl.class);
+        JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+        component.setScopeContainer(container);
+        component.start();
+        return component;
+    }
+
+    private class MockPojoFactory extends PojoObjectFactory<FooImpl> {
+        public MockPojoFactory(Constructor<FooImpl> ctr) {
+            super(ctr);
+        }
+
+        public FooImpl getInstance() throws ObjectCreationException {
+            return targetInstance;
+        }
+    }
+
+    @Conversational
+    public static interface Foo {
+
+        void operation1();
+
+        void operation2();
+
+        @EndsConversation
+        void end();
+
+    }
+
+    public static class FooImpl implements Foo {
+
+        public void operation1() {
+        }
+
+        public void operation2() {
+        }
+
+        @EndsConversation
+        public void end() {
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java?view=diff&rev=526399&r1=526398&r2=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java Sat Apr  7 01:14:49 2007
@@ -26,19 +26,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.tuscany.spi.component.AtomicComponent;
-import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.Interceptor;
-import org.apache.tuscany.spi.wire.InvocationChain;
-import org.apache.tuscany.spi.wire.Wire;
-import org.apache.tuscany.spi.wire.ProxyService;
-
 import org.apache.tuscany.core.component.WorkContextImpl;
-import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
 import org.apache.tuscany.core.implementation.PojoConfiguration;
 import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
 import org.apache.tuscany.core.injection.PojoObjectFactory;
@@ -46,6 +34,16 @@
 import org.apache.tuscany.core.wire.InvokerInterceptor;
 import org.apache.tuscany.core.wire.WireImpl;
 import org.apache.tuscany.core.wire.jdk.JDKProxyService;
+import org.apache.tuscany.idl.InvalidInterfaceException;
+import org.apache.tuscany.idl.Operation;
+import org.apache.tuscany.idl.java.introspection.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.idl.java.introspection.impl.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * @version $$Rev$$ $$Date$$
@@ -165,12 +163,12 @@
     }
 
     public static <T> Wire createWire(String serviceName, Class<T> interfaze)
-        throws InvalidServiceContractException {
+        throws InvalidInterfaceException {
         return createWire(serviceName, interfaze, null);
     }
 
     public static <T> Wire createWire(String serviceName, Class<T> interfaze, Interceptor interceptor)
-        throws InvalidServiceContractException {
+        throws InvalidInterfaceException {
         Wire wire = new WireImpl();
         ServiceContract<?> contract = REGISTRY.introspect(interfaze);
         wire.setSourceContract(contract);
@@ -195,10 +193,10 @@
     }
 
     private static void createChains(Class<?> interfaze, Interceptor interceptor, Wire wire)
-        throws InvalidServiceContractException {
+        throws InvalidInterfaceException {
 
         ServiceContract<?> contract = REGISTRY.introspect(interfaze);
-        for (Operation<?> method : contract.getOperations().values()) {
+        for (Operation method : contract.getOperations().values()) {
             InvocationChain chain = new InvocationChainImpl(method);
             if (interceptor != null) {
                 chain.addInterceptor(interceptor);

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java?view=auto&rev=526399
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java Sat Apr  7 01:14:49 2007
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.integration.wire;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+import java.net.URI;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.mock.component.TargetImpl;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class ReferenceInjectionTestCase extends TestCase {
+    private Map<String, Member> members;
+
+    public void testProxiedReferenceInjection() throws Exception {
+        ScopeContainer scope = new CompositeScopeContainer(null);
+        scope.start();
+        URI groupId = URI.create("composite");
+        scope.startContext(groupId, groupId);
+        Map<String, AtomicComponent> components = MockFactory.createWiredComponents("source",
+            SourceImpl.class,
+            scope,
+            members,
+            "target",
+            Target.class,
+            TargetImpl.class,
+            scope);
+        AtomicComponent sourceComponent = components.get("source");
+        Source source = (Source) sourceComponent.getTargetInstance();
+        Target target = source.getTarget();
+        assertTrue(Proxy.isProxyClass(target.getClass()));
+
+        assertNotNull(target);
+        scope.stop();
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        members = new HashMap<String, Member>();
+        Method m = SourceImpl.class.getMethod("setTarget", Target.class);
+        members.put("target", m);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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


Mime
View raw message