You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/02/02 21:53:34 UTC

svn commit: r502747 - in /incubator/tuscany/java/sca/kernel: ./ api/ core/src/main/java/org/apache/tuscany/core/implementation/composite/ core/src/main/java/org/apache/tuscany/core/implementation/processor/ core/src/main/java/org/apache/tuscany/core/in...

Author: jboynes
Date: Fri Feb  2 12:53:33 2007
New Revision: 502747

URL: http://svn.apache.org/viewvc?view=rev&rev=502747
Log:
update kernel to latest version of spec api

Removed:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeContext.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedCompositeContext.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeContextTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/ContextObjectFactoryTestCase.java
    incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/Launcher.java
Modified:
    incubator/tuscany/java/sca/kernel/api/pom.xml
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java
    incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
    incubator/tuscany/java/sca/kernel/pom.xml

Modified: incubator/tuscany/java/sca/kernel/api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/api/pom.xml?view=diff&rev=502747&r1=502746&r2=502747
==============================================================================
--- incubator/tuscany/java/sca/kernel/api/pom.xml (original)
+++ incubator/tuscany/java/sca/kernel/api/pom.xml Fri Feb  2 12:53:33 2007
@@ -32,7 +32,7 @@
     <dependencies>
         <dependency>
             <groupId>org.osoa</groupId>
-            <artifactId>sca-api-r0.95</artifactId>
+            <artifactId>sca-api-r${scaSpecVersion}</artifactId>
         </dependency>
         <dependency>
             <groupId>junit</groupId>

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java?view=diff&rev=502747&r1=502746&r2=502747
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java Fri Feb  2 12:53:33 2007
@@ -21,8 +21,8 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
-import org.osoa.sca.CompositeContext;
 import org.osoa.sca.RequestContext;
+import org.osoa.sca.ComponentContext;
 import org.osoa.sca.annotations.Context;
 
 import org.apache.tuscany.spi.annotation.Autowire;
@@ -38,7 +38,6 @@
 import org.apache.tuscany.spi.implementation.java.Resource;
 import org.apache.tuscany.spi.wire.WireService;
 
-import org.apache.tuscany.core.injection.CompositeContextObjectFactory;
 import org.apache.tuscany.core.injection.RequestContextObjectFactory;
 import org.apache.tuscany.core.util.JavaIntrospectionHelper;
 
@@ -74,7 +73,10 @@
             throw new IllegalContextException("Context setter must have one parameter", method.toString());
         }
         Class<?> paramType = method.getParameterTypes()[0];
-        if (CompositeContext.class.equals(paramType)) {
+        if (ComponentContext.class.equals(paramType)) {
+            // FIXME: handle injection of ComponentContext
+            throw new UnsupportedOperationException();
+/*
             String name = method.getName();
             name = JavaIntrospectionHelper.toPropertyName(name);
             Resource resource = new Resource();
@@ -82,6 +84,7 @@
             resource.setMember(method);
             resource.setObjectFactory(new CompositeContextObjectFactory(parent, wireService));
             type.getResources().put(name, resource);
+*/
         } else if (RequestContext.class.equals(paramType)) {
             String name = method.getName();
             name = JavaIntrospectionHelper.toPropertyName(name);
@@ -102,13 +105,17 @@
             return;
         }
         Class<?> paramType = field.getType();
-        if (CompositeContext.class.equals(paramType)) {
+        if (ComponentContext.class.equals(paramType)) {
+            // FIXME: handle injection of ComponentContext
+            throw new UnsupportedOperationException();
+/*
             String name = field.getName();
             Resource resource = new Resource();
             resource.setName(name);
             resource.setMember(field);
             resource.setObjectFactory(new CompositeContextObjectFactory(parent, wireService));
             type.getResources().put(name, resource);
+*/
         } else if (RequestContext.class.equals(paramType)) {
             String name = field.getName();
             name = JavaIntrospectionHelper.toPropertyName(name);

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java?view=diff&rev=502747&r1=502746&r2=502747
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java Fri Feb  2 12:53:33 2007
@@ -21,31 +21,27 @@
 import java.net.URL;
 import javax.xml.stream.XMLInputFactory;
 
-import org.osoa.sca.CompositeContext;
-
 import org.apache.tuscany.core.bootstrap.Bootstrapper;
 import org.apache.tuscany.core.bootstrap.DefaultBootstrapper;
 import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
 import org.apache.tuscany.core.monitor.NullMonitorFactory;
-import org.apache.tuscany.core.launcher.CompositeContextImpl;
 import org.apache.tuscany.host.MonitorFactory;
 import org.apache.tuscany.host.RuntimeInfo;
 import org.apache.tuscany.host.management.ManagementService;
 import org.apache.tuscany.host.runtime.InitializationException;
 import org.apache.tuscany.host.runtime.TuscanyRuntime;
-import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
 import org.apache.tuscany.spi.bootstrap.ComponentNames;
+import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
 import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.ComponentException;
-import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.SCAObject;
-import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.TargetResolutionException;
 import org.apache.tuscany.spi.deployer.Deployer;
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.model.ComponentDefinition;
-import org.apache.tuscany.spi.model.CompositeImplementation;
 import org.apache.tuscany.spi.services.management.TuscanyManagementService;
 import org.apache.tuscany.spi.wire.WireService;
 
@@ -213,7 +209,6 @@
     }
 
 
-
     protected Bootstrapper createBootstrapper() {
         TuscanyManagementService tms = (TuscanyManagementService) getManagementService();
         return new DefaultBootstrapper(getMonitorFactory(), xmlFactory, tms);
@@ -234,7 +229,7 @@
             throw new InitializationException("Deployer must be an atomic component");
         }
         try {
-            return (Deployer)((AtomicComponent)deployerComponent).getTargetInstance();
+            return (Deployer) ((AtomicComponent) deployerComponent).getTargetInstance();
         } catch (TargetResolutionException e) {
             throw new InitializationException(e);
         }
@@ -246,7 +241,7 @@
             throw new InitializationException("WireService must be an atomic component");
         }
         try {
-            return (WireService)((AtomicComponent)wireServiceComponent).getTargetInstance();
+            return (WireService) ((AtomicComponent) wireServiceComponent).getTargetInstance();
         } catch (TargetResolutionException e) {
             throw new InitializationException(e);
         }
@@ -267,45 +262,4 @@
 
         return (CompositeComponent) deployer.deploy(parent, definition);
     }
-
-    @Deprecated
-    public CompositeContext deployApplication(String name, URL scdlLocation, ClassLoader classLoader)
-        throws InitializationException {
-        try {
-            CompositeComponent application = deployApplicationScdl(getDeployer(),
-                                                                   getRuntime().getRootComponent(),
-                                                                   name,
-                                                                   scdlLocation,
-                                                                   classLoader);
-            application.start();
-            return new CompositeContextImpl(application, getWireService());
-        } catch (LoaderException ex) {
-            throw new InitializationException(ex);
-        } catch (BuilderException ex) {
-            throw new InitializationException(ex);
-        } catch (ComponentException ex) {
-            throw new InitializationException(ex);
-        }
-    }
-
-    protected CompositeComponent deployApplicationScdl(Deployer deployer,
-                                                       CompositeComponent parent,
-                                                       String name,
-                                                       URL applicationScdl,
-                                                       ClassLoader applicationClassLoader)
-        throws LoaderException, BuilderException, ComponentException {
-
-        CompositeImplementation impl = new CompositeImplementation();
-        impl.setScdlLocation(applicationScdl);
-        impl.setClassLoader(applicationClassLoader);
-        ComponentDefinition<CompositeImplementation> definition =
-            new ComponentDefinition<CompositeImplementation>(name, impl);
-
-        return (CompositeComponent) deployer.deploy(parent, definition);
-    }
-
-    public CompositeContext getContext() {
-        throw new UnsupportedOperationException();
-    }
-
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java?view=diff&rev=502747&r1=502746&r2=502747
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java Fri Feb  2 12:53:33 2007
@@ -20,8 +20,6 @@
 
 import java.util.LinkedList;
 
-import org.osoa.sca.CompositeContext;
-import org.osoa.sca.CurrentCompositeContext;
 import org.osoa.sca.ServiceRuntimeException;
 
 import org.apache.tuscany.spi.component.WorkContext;
@@ -58,7 +56,6 @@
     }
 
     public Message invoke(final Message msg) {
-        final CompositeContext currentContext = CurrentCompositeContext.getContext();
         // Retrieve conversation id to transfer to new thread
         // Notice that we cannot clear the conversation id from the current thread
         final Object conversationID = workContext.getIdentifier(Scope.CONVERSATION);
@@ -71,16 +68,7 @@
                     if (conversationID != null) {
                         workContext.setIdentifier(Scope.CONVERSATION, conversationID);
                     }
-                    CompositeContext oldContext = CurrentCompositeContext.setContext(currentContext);
-                    try {
-                        next.invoke(msg);
-                    } catch (Exception e) {
-                        // REVIEW uncomment when it is available
-                        // monitor.executionError(e);
-                        e.printStackTrace();
-                    } finally {
-                        CurrentCompositeContext.setContext(oldContext);
-                    }
+                    next.invoke(msg);
                 }
             });
         } catch (Exception e) {

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java?view=diff&rev=502747&r1=502746&r2=502747
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java Fri Feb  2 12:53:33 2007
@@ -21,7 +21,9 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
-import org.osoa.sca.CompositeContext;
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.osoa.sca.ComponentContext;
 import org.osoa.sca.RequestContext;
 import org.osoa.sca.annotations.Context;
 
@@ -33,9 +35,6 @@
 import org.apache.tuscany.spi.implementation.java.PojoComponentType;
 import org.apache.tuscany.spi.wire.WireService;
 
-import junit.framework.TestCase;
-import org.easymock.EasyMock;
-
 /**
  * @version $Rev$ $Date$
  */
@@ -43,14 +42,19 @@
     private ContextProcessor processor;
     private CompositeComponent composite;
 
+    // FIXME: resurrect to test ComponentContext injection
+/*
     public void testCompositeContextMethod() throws Exception {
-        Method method = Foo.class.getMethod("setContext", CompositeContext.class);
+        Method method = Foo.class.getMethod("setContext", ComponentContext.class);
         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
             new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         processor.visitMethod(composite, method, type, null);
         assertNotNull(type.getResources().get("context"));
     }
+*/
 
+    // FIXME: resurrect to test ComponentContext injection
+/*
     public void testCompositeContextField() throws Exception {
         Field field = Foo.class.getDeclaredField("context");
         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
@@ -58,6 +62,7 @@
         processor.visitField(composite, field, type, null);
         assertNotNull(type.getResources().get("context"));
     }
+*/
 
     public void testRequestContextMethod() throws Exception {
         Method method = Foo.class.getMethod("setRequestContext", RequestContext.class);
@@ -101,7 +106,7 @@
 
 
     public void testInvalidParamNum() throws Exception {
-        Method method = Foo.class.getMethod("setContext", CompositeContext.class, String.class);
+        Method method = Foo.class.getMethod("setContext", ComponentContext.class, String.class);
         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
             new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         try {
@@ -125,7 +130,7 @@
     }
 
     public void testNoContext() throws Exception {
-        Method method = Foo.class.getMethod("noContext", CompositeContext.class);
+        Method method = Foo.class.getMethod("noContext", ComponentContext.class);
         PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
             new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         processor.visitMethod(composite, method, type, null);
@@ -150,18 +155,18 @@
 
     private class Foo {
         @Context
-        protected CompositeContext context;
+        protected ComponentContext context;
 
         @Context
         protected Object badContext;
 
-        protected CompositeContext noContext;
+        protected ComponentContext noContext;
 
         @Context
         protected RequestContext requestContext;
 
         @Context
-        public void setContext(CompositeContext context) {
+        public void setContext(ComponentContext context) {
 
         }
 
@@ -171,7 +176,7 @@
         }
 
         @Context
-        public void setContext(CompositeContext context, String string) {
+        public void setContext(ComponentContext context, String string) {
 
         }
 
@@ -180,7 +185,7 @@
 
         }
 
-        public void noContext(CompositeContext context) {
+        public void noContext(ComponentContext context) {
 
         }
 

Modified: incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java?view=diff&rev=502747&r1=502746&r2=502747
==============================================================================
--- incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java (original)
+++ incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java Fri Feb  2 12:53:33 2007
@@ -20,8 +20,6 @@
 
 import java.net.URL;
 
-import org.osoa.sca.CompositeContext;
-
 import org.apache.tuscany.host.MonitorFactory;
 import org.apache.tuscany.host.RuntimeInfo;
 import org.apache.tuscany.host.management.ManagementService;
@@ -114,66 +112,4 @@
      * @throws ShutdownException if there is an error destroying the runtime
      */
     void destroy() throws ShutdownException;
-
-    /**
-     * Returns the current SCA context
-     */
-    @Deprecated
-    CompositeContext getContext();
-
-    /**
-     * Returns the name of the component associated with the application SCDL.
-     *
-     * @return the name of the component associated with the application SCDL
-     */
-    @Deprecated
-    String getApplicationName();
-
-    /**
-     * Sets the name of the component associated with the application SCDL.
-     *
-     * @param applicationName the name of the component associated with the application SCDL
-     */
-    @Deprecated
-    void setApplicationName(String applicationName);
-
-    /**
-     * Returns the location of the default application's SCDL.
-     *
-     * @return the location of the default application's SCDL
-     */
-    @Deprecated
-    URL getApplicationScdl();
-
-    /**
-     * Sets the location of the default application's SCDL
-     *
-     * @param applicationScdl the location of the default application's SCDL
-     */
-    @Deprecated
-    void setApplicationScdl(URL applicationScdl);
-
-    /**
-     * Get the application classloader
-     */
-    @Deprecated
-    ClassLoader getApplicationClassLoader();
-
-    /**
-     * Set the application classloader
-     */
-    @Deprecated
-    void setApplicationClassLoader(ClassLoader applicationClassLoader);
-
-    /**
-     * Temporary API to allow and application to be deployed until we get the proper deployment services running.
-     *
-     * @param name the name of the component for the application
-     * @param scdlLocation the location of a SCDL composite document to use as the component's implementation
-     * @param classLoader the classloader to associated with the application component
-     * @return the context for the application's composite component
-     */
-    @Deprecated
-    CompositeContext deployApplication(String name, URL scdlLocation, ClassLoader classLoader)
-        throws InitializationException;
 }

Modified: incubator/tuscany/java/sca/kernel/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/pom.xml?view=diff&rev=502747&r1=502746&r2=502747
==============================================================================
--- incubator/tuscany/java/sca/kernel/pom.xml (original)
+++ incubator/tuscany/java/sca/kernel/pom.xml Fri Feb  2 12:53:33 2007
@@ -30,6 +30,11 @@
     <name>Apache Tuscany SCA Kernel Sub-Project</name>
     <version>1.0-incubator-SNAPSHOT</version>
 
+    <properties>
+        <!-- version the SCA API that we implement -->
+        <scaSpecVersion>1.0</scaSpecVersion>
+    </properties>
+
     <!-- definition of repositories where the parent pom can be found -->
     <repositories>
         <repository>
@@ -55,6 +60,57 @@
             </snapshots>
         </repository>
     </repositories>
+
+    <!-- dependencies used by the kernel -->
+    <dependencyManagement>
+        <dependencies>
+            <!-- org.osoa.sca API -->
+            <dependency>
+                <groupId>org.osoa</groupId>
+                <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+                <version>1.0-incubator-SNAPSHOT</version>
+                <scope>compile</scope>
+            </dependency>
+
+            <!-- javax.servlet API -->
+            <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>servlet-api</artifactId>
+                <version>2.4</version>
+                <scope>provided</scope>
+            </dependency>
+
+            <!-- java.xml.stream API -->
+            <dependency>
+                <groupId>stax</groupId>
+                <artifactId>stax-api</artifactId>
+                <version>1.0.1</version>
+                <scope>compile</scope>
+            </dependency>
+
+            <!-- junit version -->
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>3.8.1</version>
+                <scope>test</scope>
+            </dependency>
+
+            <!-- EasyMock version -->
+            <dependency>
+                <groupId>org.easymock</groupId>
+                <artifactId>easymock</artifactId>
+                <version>2.2</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.easymock</groupId>
+                <artifactId>easymockclassextension</artifactId>
+                <version>2.2</version>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
 
     <build>
         <defaultGoal>install</defaultGoal>



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