tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r527713 - in /incubator/tuscany/java/sca/modules: core-spi/src/main/java/org/apache/tuscany/spi/wire/ core/src/main/java/org/apache/tuscany/core/util/ host-embedded/src/main/java/org/apache/tuscany/host/embedded/ implementation-java-runtime...
Date Wed, 11 Apr 2007 22:35:07 GMT
Author: antelder
Date: Wed Apr 11 15:35:01 2007
New Revision: 527713

URL: http://svn.apache.org/viewvc?view=rev&rev=527713
Log:
Fix problem with multiple versions of PojoWorkContextTunnel by moving to a single verions
intuscany core

Added:
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/util/PojoWorkContextTunnel.java
  (with props)
Removed:
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/PojoWorkContextTunnel.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/implementation/PojoWorkContextTunnel.java
Modified:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ComponentObjectFactory.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/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerSerializationTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java?view=diff&rev=527713&r1=527712&r2=527713
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java
(original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java
Wed Apr 11 15:35:01 2007
@@ -72,7 +72,7 @@
             msg.setCallbackUris(workContext.getCallbackUris());
             Operation operation = chain.getOperation();
             Interface contract = operation.getInterface();
-            if (contract.isConversational()) {
+            if (contract != null && contract.isConversational()) {
                 Operation.ConversationSequence sequence = chain.getOperation().getConversationSequence();
                 if (sequence == Operation.ConversationSequence.CONVERSATION_END) {
                     msg.setConversationSequence(TargetInvoker.END);

Added: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/util/PojoWorkContextTunnel.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/util/PojoWorkContextTunnel.java?view=auto&rev=527713
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/util/PojoWorkContextTunnel.java
(added)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/util/PojoWorkContextTunnel.java
Wed Apr 11 15:35:01 2007
@@ -0,0 +1,63 @@
+/*
+ * 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.util;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+/**
+ * Class for tunneling a WorkContext through the invocation of a user class.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class PojoWorkContextTunnel {
+    private static final ThreadLocal<WorkContext> CONTEXT = new ThreadLocal<WorkContext>();
+
+    private PojoWorkContextTunnel() {
+    }
+
+    /**
+     * Set the WorkContext for the current thread.
+     * The current work context is returned and must be restored after the invocation is
complete.
+     * Typical usage would be:
+     * <pre>
+     *   WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext);
+     *   try {
+     *      ... invoke user code ...
+     *   } finally {
+     *     PojoWorkContextTunnel.setThreadWorkContext(old);
+     *   }
+     * </pre>
+     * @param context
+     * @return the current work context for the thread; this must be restored after the invocation
is made
+     */
+    public static WorkContext setThreadWorkContext(WorkContext context) {
+        WorkContext old = CONTEXT.get();
+        CONTEXT.set(context);
+        return old;
+    }
+
+    /**
+     * Returns the WorkContext for the current thread.
+     *
+     * @return the WorkContext for the current thread
+     */
+    public static WorkContext getThreadWorkContext() {
+        return CONTEXT.get();
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/util/PojoWorkContextTunnel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/util/PojoWorkContextTunnel.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java?view=diff&rev=527713&r1=527712&r2=527713
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java
Wed Apr 11 15:35:01 2007
@@ -37,6 +37,7 @@
 import org.apache.tuscany.core.bootstrap.ExtensionPointRegistryImpl;
 import org.apache.tuscany.core.component.SimpleWorkContext;
 import org.apache.tuscany.core.runtime.AbstractRuntime;
+import org.apache.tuscany.core.util.PojoWorkContextTunnel;
 import org.apache.tuscany.host.runtime.InitializationException;
 import org.apache.tuscany.interfacedef.java.xml.JavaInterfaceProcessor;
 import org.apache.tuscany.interfacedef.wsdl.xml.WSDLDocumentProcessor;

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ComponentObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ComponentObjectFactory.java?view=diff&rev=527713&r1=527712&r2=527713
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ComponentObjectFactory.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/core/component/ComponentObjectFactory.java
Wed Apr 11 15:35:01 2007
@@ -18,13 +18,13 @@
  */
 package org.apache.tuscany.core.component;
 
-import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.core.util.PojoWorkContextTunnel;
 import org.apache.tuscany.spi.ObjectCreationException;
-import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.ObjectFactory;
 import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.component.TargetResolutionException;
 import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
 
 /**
  * @version $Rev$ $Date$

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=527713&r1=527712&r2=527713
==============================================================================
--- 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
Wed Apr 11 15:35:01 2007
@@ -31,7 +31,7 @@
 import java.util.UUID;
 
 import org.apache.tuscany.assembly.Contract;
-import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
+import org.apache.tuscany.core.util.PojoWorkContextTunnel;
 import org.apache.tuscany.core.wire.NoMethodForOperationException;
 import org.apache.tuscany.core.wire.WireUtils;
 import org.apache.tuscany.spi.Scope;

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerSerializationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerSerializationTestCase.java?view=diff&rev=527713&r1=527712&r2=527713
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerSerializationTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerSerializationTestCase.java
Wed Apr 11 15:35:01 2007
@@ -32,8 +32,8 @@
 
 import org.apache.tuscany.assembly.Contract;
 import org.apache.tuscany.core.component.WorkContextImpl;
-import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
 import org.apache.tuscany.core.implementation.java.ModelHelper;
+import org.apache.tuscany.core.util.PojoWorkContextTunnel;
 import org.apache.tuscany.core.wire.InvocationChainImpl;
 import org.apache.tuscany.core.wire.InvokerInterceptor;
 import org.apache.tuscany.interfacedef.Operation;

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java?view=diff&rev=527713&r1=527712&r2=527713
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java
Wed Apr 11 15:35:01 2007
@@ -30,8 +30,8 @@
 
 import org.apache.tuscany.assembly.Contract;
 import org.apache.tuscany.core.component.SimpleWorkContext;
-import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
 import org.apache.tuscany.core.implementation.java.ModelHelper;
+import org.apache.tuscany.core.util.PojoWorkContextTunnel;
 import org.apache.tuscany.core.wire.InvocationChainImpl;
 import org.apache.tuscany.core.wire.WireImpl;
 import org.apache.tuscany.interfacedef.DataType;



---------------------------------------------------------------------
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