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

svn commit: r572525 - in /incubator/tuscany/java/sca: itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/ itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/ modules/core/src/main/java/org/apache/tuscany/sc...

Author: rfeng
Date: Mon Sep  3 22:00:52 2007
New Revision: 572525

URL: http://svn.apache.org/viewvc?rev=572525&view=rev
Log:
Apply the patch 5 from Simon Nash for TUSCANY-1500

Added:
    incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java
      - copied, changed from r572502, incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCaseFIXME.java
Removed:
    incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCaseFIXME.java
Modified:
    incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java
    incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
    incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java
    incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java
    incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java

Modified: incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java (original)
+++ incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java Mon Sep  3 22:00:52 2007
@@ -18,7 +18,10 @@
  */
 package org.apache.tuscany.sca.test;
 
+import org.osoa.sca.annotations.Conversational;
+
 // @Remotable
+@Conversational
 /**
  *
  */

Modified: incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java (original)
+++ incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java Mon Sep  3 22:00:52 2007
@@ -20,20 +20,25 @@
 
 import junit.framework.Assert;
 
+import org.osoa.sca.ComponentContext;
 import org.osoa.sca.NoRegisteredCallbackException;
 import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
 import org.osoa.sca.annotations.Reference;
 import org.osoa.sca.annotations.Scope;
 import org.osoa.sca.annotations.Service;
 
 @Service(CallBackSetCallbackConvClient.class)
 @Scope("CONVERSATION")
-public class CallBackSetCallbackConvClientImpl implements CallBackSetCallbackConvClient {
+public class CallBackSetCallbackConvClientImpl implements CallBackSetCallbackConvClient,
+        //FIXME: remove the following hack, needed to get around current JavaImplementationInvoker limitation
+        CallBackSetCallbackConvCallback {
 
+    @Context
+    protected ComponentContext componentContext;
     @Reference
     protected CallBackSetCallbackConvService aCallBackService;
     private CallBackSetCallbackConvObjectCallback aCallbackObject = null;
-    private Object monitor = new Object();
 
     public void run() {
 
@@ -76,24 +81,13 @@
 
         aCallbackObject = new CallBackSetCallbackConvObjectCallback();
         aCallbackObject.incrementCallBackCount();
-        aCallbackObject.setMonitor(monitor);
 
-        ((ServiceReference)aCallBackService).setCallback(aCallbackObject);
-        aCallBackService.knockKnock("Knock Knock");
-
-        // Lets give the callback a little time to complete....
-
-        int count = 0;
-
-        synchronized (monitor) {
-            while (aCallbackObject.getCount() != 2 && count++ < 30) {
-                try {
-                    monitor.wait(1000L);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
+        ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+                = componentContext.cast(aCallBackService);
+        aCallBackServiceRef.setCallback(aCallbackObject);
+        //FIXME: remove the following workaround for runtime bug
+        aCallBackServiceRef.getService().knockKnock("Knock Knock");
+        //aCallBackService.knockKnock("Knock Knock");
 
         Assert.assertEquals("CallBackSetCallbackConv - Test7", 2, aCallbackObject.getCount());
 
@@ -105,25 +99,27 @@
 
         //
         // This test is to specify an Object that is not a service reference
-        // that does not impliment
+        // that does not implement
         // the callback interface. The expected result is an appropriate
         // exception.
         //
 
         try {
-            ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackConvBadCallback());
-            aCallBackService.knockKnock("Knock Knock");
+            ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+                    = componentContext.cast(aCallBackService);
+            aCallBackServiceRef.setCallback(new CallBackSetCallbackConvBadCallback());
+            //FIXME: remove the following workaround for runtime bug
+            aCallBackServiceRef.getService().knockKnock("Knock Knock");
+            //aCallBackService.knockKnock("Knock Knock");
         }
 
         //
         // This should catch an appropriate exception.
         // 
 
-        catch (NoRegisteredCallbackException NotRegEx) // This needs to be
-                                                        // changed to proper
-                                                        // exception once we
-                                                        // know what it is ;-)
+        catch (IllegalArgumentException goodEx)
         {
+            System.out.println("correct exception " + goodEx);
             correctException = true;
         }
 
@@ -142,25 +138,26 @@
 
         //
         // This test is to specify an Object that is not a service reference
-        // that does impliment
+        // that does implement
         // the callback interface but does not implement Serializeable. Verify
         // an appropriate exception
         // is thrown.
         //
 
         try {
-            ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackConvNonSerCallback());
-            aCallBackService.knockKnock("Knock Knock");
+            ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+                    = componentContext.cast(aCallBackService);
+            aCallBackServiceRef.setCallback(new CallBackSetCallbackConvNonSerCallback());
+            //FIXME: remove the following workaround for runtime bug
+            aCallBackServiceRef.getService().knockKnock("Knock Knock");
+            //aCallBackService.knockKnock("Knock Knock");
         }
         //
         // This should catch an appropriate exception.
         //
-        catch (NoRegisteredCallbackException NotRegEx) // This needs to be
-                                                        // changed to
-                                                        // appropriate exception
-                                                        // when we know what it
-                                                        // is ;-)
+        catch (IllegalArgumentException goodEx)
         {
+            System.out.println("correct exception " + goodEx);
             correctException = true;
         } catch (Exception ex) {
             ex.printStackTrace();
@@ -168,6 +165,16 @@
 
         Assert.assertEquals("CallBackSetCallbackConv - Test9", true, correctException);
 
+    }
+
+    //FIXME: remove the following methods, needed to get around current JavaImplementationInvoker limitation
+
+    public void callBackMessage(String aString) {
+        throw new IllegalStateException("CallbackSetCallbackConvClientImpl.callbackMessage called");
+    }
+
+    public void callBackIncrement(String aString) {
+        throw new IllegalStateException("CallbackSetCallbackConvClientImpl.callbackIncrement called");
     }
 
 }

Modified: incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java (original)
+++ incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java Mon Sep  3 22:00:52 2007
@@ -19,10 +19,12 @@
 package org.apache.tuscany.sca.test;
 
 
-public class CallBackSetCallbackConvObjectCallback implements CallBackSetCallbackConvCallback {
-
+public class CallBackSetCallbackConvObjectCallback
+        //FIXME: remove the following hack, needed to get around current JavaImplementationInvoker limitation
+        extends CallBackSetCallbackConvClientImpl
+        //implements CallBackSetCallbackConvCallback
+{
     private int callBackCount = 0;
-    private Object monitor;
 
     public CallBackSetCallbackConvObjectCallback() {
         super();
@@ -36,10 +38,6 @@
         return callBackCount;
     }
 
-    public void setMonitor(Object anObject) {
-        monitor = anObject;
-    }
-
     public void callBackMessage(String aString) {
 
         System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString);
@@ -50,10 +48,7 @@
 
         System.out.println("Entering callback increment: " + aString);
 
-        synchronized (monitor) {
-            this.incrementCallBackCount();
-            monitor.notify();
-        }
+        this.incrementCallBackCount();
     }
 
 }

Modified: incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java (original)
+++ incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java Mon Sep  3 22:00:52 2007
@@ -19,8 +19,10 @@
 package org.apache.tuscany.sca.test;
 
 import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
 
 // @Remotable
+@Conversational
 @Callback(CallBackSetCallbackConvCallback.class)
 /**
  * 

Modified: incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java (original)
+++ incubator/tuscany/java/sca/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java Mon Sep  3 22:00:52 2007
@@ -33,20 +33,16 @@
 public class CallBackSetCallbackConvServiceImpl implements CallBackSetCallbackConvService {
 
     @Callback
-    private CallBackSetCallbackConvCallback callback;
+    protected CallBackSetCallbackConvCallback callback;
     @Context
     protected ComponentContext context;
 
     public void knockKnock(String aString) {
 
-        try {
-            System.out.println("CallBackBasicServiceImpl message received: " + aString);
-            callback.callBackMessage("Who's There");
-            System.out.println("CallBackBasicServiceImpl response sent");
-            return;
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
+        System.out.println("CallBackSetCallbackConvServiceImpl message received: " + aString);
+        callback.callBackMessage("Who's There");
+        callback.callBackIncrement("This should do it");
+        System.out.println("CallBackSetCallbackConvServiceImpl response sent");
 
     }
 

Copied: incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java (from r572502, incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCaseFIXME.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java?p2=incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java&p1=incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCaseFIXME.java&r1=572502&r2=572525&rev=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCaseFIXME.java (original)
+++ incubator/tuscany/java/sca/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java Mon Sep  3 22:00:52 2007
@@ -22,8 +22,7 @@
 
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 
-//FIXME Fix this test case
-public class CallBackSetCallbackConvTestCaseFIXME extends TestCase {
+public class CallBackSetCallbackConvTestCase extends TestCase {
 
     private SCADomain domain;
     private CallBackSetCallbackConvClient aCallBackClient;

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java Mon Sep  3 22:00:52 2007
@@ -26,6 +26,7 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
 import org.osoa.sca.Conversation;
 import org.osoa.sca.ServiceReference;
 
@@ -99,6 +100,10 @@
     }
 
     public void setCallback(Object callback) {
+        if (callback != null && !(callback instanceof CallableReference)) {
+            //FIXME: need to check if callback object supports the callback interface
+            // returned by reference.getInterfaceContract().getCallbackInterface()
+        }    
         this.callback = callback;
     }
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java Mon Sep  3 22:00:52 2007
@@ -30,9 +30,12 @@
 
 import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
 import org.apache.tuscany.sca.core.context.ConversationImpl;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
 import org.apache.tuscany.sca.core.scope.Scope;
 import org.apache.tuscany.sca.core.scope.ScopeContainer;
 import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
 import org.apache.tuscany.sca.interfacedef.ConversationSequence;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
@@ -227,7 +230,7 @@
                 // register the calling component instance against this 
                 // new conversation id so that stateful callbacks will be
                 // able to find it
-                if (wire.getSource().getCallbackEndpoint() != null) {
+                if (wire.getSource().getCallbackEndpoint() != null && callbackObject == null) {
                     // the component instance is already registered
                     // so add another registration
                     ScopeContainer<Object> scopeContainer = getConversationalScopeContainer(wire);
@@ -288,10 +291,14 @@
                     } else {
                         if (contract != null) {
                             if (!contract.isConversational()) {
-                                throw new IllegalArgumentException(
-                                                                   "Callback object for stateless callback is not a ServiceReference");
+                                throw new IllegalArgumentException
+                                        ("Callback object for stateless callback is not a ServiceReference");
                             } else {
-                                //FIXME: add callback object to scope container
+                                ScopeContainer<Object> scopeContainer = getConversationalScopeContainer(wire);
+                                if (scopeContainer != null) {
+                                    InstanceWrapper<Object> wrapper = new CallbackObjectWrapper(callbackObject);
+                                    scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
+                                }
                                 msg.setFrom(callbackEndpoint);
                             }
                         }
@@ -359,6 +366,31 @@
      */
     public void setCallableReference(CallableReference<?> callableReference) {
         this.callableReference = callableReference;
+    }
+
+    /**
+     * Minimal wrapper for a callback object contained in a ServiceReference
+     */
+    private static class CallbackObjectWrapper<T> implements InstanceWrapper<T> {
+
+        private T instance;
+
+        private CallbackObjectWrapper(T instance) {
+            this.instance = instance;
+        }
+
+        public T getInstance() {
+            return instance;
+        }
+
+        public void start() {
+            // do nothing
+        }
+        
+        public void stop() {
+            // do nothing
+        }
+
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java Mon Sep  3 22:00:52 2007
@@ -85,6 +85,10 @@
         // do nothing here. the conversational scope container implements this
     }
 
+    public void registerWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetResolutionException { 
+        // do nothing here. the conversational scope container implements this
+    }
+
     public void onEvent(Event event) {
     }
 

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java Mon Sep  3 22:00:52 2007
@@ -183,6 +183,21 @@
         // add the reference to the collection
         this.instanceLifecycleCollection.put(newContextId, anInstanceWrapper);  
     }
+
+    public void registerWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
+        // if a wrapper for a different instance is already registered for this contextId, remove it
+        InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
+        if (anInstanceWrapper != null) {
+            if (anInstanceWrapper.getInstanceWrapper(contextId).getInstance() != wrapper.getInstance()) {
+                remove(contextId);
+            } else {
+                return;
+            }
+        }
+
+        anInstanceWrapper = new InstanceLifeCycleWrapper(wrapper, contextId);  
+        this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
+    }
     
     
     // The remove is invoked when a conversation is explicitly ended.  This can occur by using the @EndsConversation or API.  
@@ -224,6 +239,16 @@
          this.expirationInterval = max_age;
          this.maxIdleTime = max_idle_time;
          this.createInstance(contextId);
+        }
+
+        private InstanceLifeCycleWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException
+        {
+         this.instanceIds.add(contextId);
+         this.creationTime = System.currentTimeMillis();
+         this.lastReferencedTime = this.creationTime;
+         this.expirationInterval = max_age;
+         this.maxIdleTime = max_idle_time;
+         wrappers.put(contextId, wrapper);       
         }
         
         private boolean isExpired() 

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java?rev=572525&r1=572524&r2=572525&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java Mon Sep  3 22:00:52 2007
@@ -61,19 +61,31 @@
      * @return the wrapper for the target instance
      * @throws TargetResolutionException if there was a problem instantiating the target instance
      */
-     InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException;
+    InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException;
      
-     /**
-      * Allows a component to be registered against more than one context id. This is required in the
-      * case of stateful callbacks where we want to identify the originating client component instance 
-      * as the callback target but we don't want to reuse the clients original conversation id
-      * 
-      * @param existingContextId  an id that identifies an existing component instance
-      * @param newContextId a new id against which this component will also be registered
-      * @throws TargetResolutionException
-      */
-     public void addWrapperReference(KEY existingContextId, KEY newContextId) 
-       throws TargetResolutionException;   
+    /**
+     * Allows a component to be registered against more than one context id. This is required in the
+     * case of stateful callbacks where we want to identify the originating client component instance 
+     * as the callback target but we don't want to reuse the clients original conversation id
+     * 
+     * @param existingContextId  an id that identifies an existing component instance
+     * @param newContextId a new id against which this component will also be registered
+     * @throws TargetResolutionException
+     */
+    void addWrapperReference(KEY existingContextId, KEY newContextId) 
+        throws TargetResolutionException;   
+
+    /**
+     * Register an existing instance against a context id.  This is needed
+     * for a stateful callback where the service reference for the forward call
+     * contains a callback object that is not a service reference.
+     * 
+     * @param wrapper the instance wrapper for the instance to be registered
+     * @param contextId the id for the scope context
+     * @throws TargetResolutionException
+     */
+    void registerWrapper(InstanceWrapper wrapper, KEY contextId) 
+        throws TargetResolutionException;   
 
     /**
      * Returns an implementation instance associated with the current scope context.
@@ -83,7 +95,7 @@
      * @return the wrapper for the target instance
      * @throws TargetResolutionException if there was a problem instantiating the target instance
      */
-     InstanceWrapper getAssociatedWrapper(KEY contextId)
+    InstanceWrapper getAssociatedWrapper(KEY contextId)
         throws TargetResolutionException;
 
     /**
@@ -93,59 +105,55 @@
      *
      * @throws TargetDestructionException if there was a problem returning the target instance
      */
-     void returnWrapper(InstanceWrapper wrapper, KEY contextId)
+    void returnWrapper(InstanceWrapper wrapper, KEY contextId)
         throws TargetDestructionException;
 
-     /**
-      * Removes an identified component implementation instance associated with the current 
-      * context from persistent storage
-      *
-      * @param contextId the identifier of the context to remove. 
-      */
-      void remove(KEY contextId) 
-          throws TargetDestructionException;     
-
-      /* A configuration error state */
-      int CONFIG_ERROR = -1;
-      /* Has not been initialized */
-      int UNINITIALIZED = 0;
-      /* In the process of being configured and initialized */
-      int INITIALIZING = 1;
-      /* Instantiated and configured */
-      int INITIALIZED = 2;
-      /* Configured and initialized */
-      int RUNNING = 4;
-      /* In the process of being shutdown */
-      int STOPPING = 5;
-      /* Has been shutdown and removed from the composite */
-      int STOPPED = 6;
-      /* In an error state */
-      int ERROR = 7;
-
-      /**
-       * Returns the lifecycle state
-       *
-       * @see #UNINITIALIZED
-       * @see #INITIALIZING
-       * @see #INITIALIZED
-       * @see #RUNNING
-       * @see #STOPPING
-       * @see #STOPPED
-       */
-      int getLifecycleState();
-
-      /**
-       * Starts the Lifecycle.
-       *
-       * @throws CoreRuntimeException
-       */
-      void start();
-
-      /**
-       * Stops the Lifecycle.
-       *
-       * @throws CoreRuntimeException
-       */
-      void stop();
+    /**
+     * Removes an identified component implementation instance associated with the current 
+     * context from persistent storage
+     *
+     * @param contextId the identifier of the context to remove. 
+     */
+    void remove(KEY contextId) 
+        throws TargetDestructionException;     
+
+    /* A configuration error state */
+    int CONFIG_ERROR = -1;
+    /* Has not been initialized */
+    int UNINITIALIZED = 0;
+    /* In the process of being configured and initialized */
+    int INITIALIZING = 1;
+    /* Instantiated and configured */
+    int INITIALIZED = 2;
+    /* Configured and initialized */
+    int RUNNING = 4;
+    /* In the process of being shutdown */
+    int STOPPING = 5;
+    /* Has been shutdown and removed from the composite */
+    int STOPPED = 6;
+    /* In an error state */
+    int ERROR = 7;
+
+    /**
+     * Returns the lifecycle state
+     *
+     * @see #UNINITIALIZED
+     * @see #INITIALIZING
+     * @see #INITIALIZED
+     * @see #RUNNING
+     * @see #STOPPING
+     * @see #STOPPED
+     */
+    int getLifecycleState();
+
+    /**
+     * Starts the Lifecycle.
+     */
+    void start();
+
+    /**
+     * Stops the Lifecycle.
+     */
+    void stop();
 
 }



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