You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/04/16 10:40:23 UTC

svn commit: r529169 - in /incubator/tuscany/java/sca: itest/contribution/src/main/resources/ itest/contribution/src/main/resources/META-INF/ modules/core/src/main/java/org/apache/tuscany/core/runtime/ modules/host-embedded/src/main/java/org/apache/tusc...

Author: jsdelfino
Date: Mon Apr 16 01:40:22 2007
New Revision: 529169

URL: http://svn.apache.org/viewvc?view=rev&rev=529169
Log:
Simplified SCARuntime embedded host. Removed obsolete code that was dealing with system SCDL files.

Added:
    incubator/tuscany/java/sca/itest/contribution/src/main/resources/application.composite   (with props)
Removed:
    incubator/tuscany/java/sca/itest/contribution/src/main/resources/META-INF/
Modified:
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfo.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfoImpl.java

Added: incubator/tuscany/java/sca/itest/contribution/src/main/resources/application.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/contribution/src/main/resources/application.composite?view=auto&rev=529169
==============================================================================
--- incubator/tuscany/java/sca/itest/contribution/src/main/resources/application.composite (added)
+++ incubator/tuscany/java/sca/itest/contribution/src/main/resources/application.composite Mon Apr 16 01:40:22 2007
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	   xmlns:foo="http://foo" 
+           name="ContributionTest">
+   
+</composite>

Propchange: incubator/tuscany/java/sca/itest/contribution/src/main/resources/application.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/contribution/src/main/resources/application.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java?view=diff&rev=529169&r1=529168&r2=529169
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java Mon Apr 16 01:40:22 2007
@@ -165,11 +165,11 @@
         this.applicationName = applicationName;
     }
 
-    public URL getApplicationScdl() {
+    public URL getApplicationSCDL() {
         return applicationScdl;
     }
 
-    public void setApplicationScdl(URL applicationScdl) {
+    public void setApplicationSCDL(URL applicationScdl) {
         this.applicationScdl = applicationScdl;
     }
 

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java?view=diff&rev=529169&r1=529168&r2=529169
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java Mon Apr 16 01:40:22 2007
@@ -122,22 +122,7 @@
      */
     public static void start() {
         try {
-            getInstance().startup(null, null, null, null);
-        } catch (Exception e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    /**
-     * Start the SCA Runtime with the given SCDLs
-     * 
-     * @param system The URL for the system SCDL
-     * @param extensions An array of URLs for extensions
-     * @param application The URL for the application SCDL
-     */
-    public static void start(URL system, URL[] extensions, URL application, String compositePath) {
-        try {
-            getInstance().startup(system, extensions, application, compositePath);
+            getInstance().startup(null, null);
         } catch (Exception e) {
             throw new IllegalStateException(e);
         }
@@ -150,39 +135,22 @@
      */
     public static void start(URL application, String compositePath) {
         try {
-            getInstance().startup(null, null, application, compositePath);
+            getInstance().startup(application, compositePath);
         } catch (Exception e) {
             throw new IllegalStateException(e);
         }
     }
 
     /**
-     * Start the SCA Runtime with the given SCDL
+     * Start the SCA Runtime with the given composite file.
      * 
-     * @param compositePath The path of the application SCDL
+     * @param compositePath The path of the composite file.
      */
     public static void start(String compositePath) {
         try {
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
             URL applicationURL = cl.getResource(compositePath);
-            getInstance().startup(null, null, applicationURL, compositePath);
-        } catch (Exception e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    /**
-     * Start the SCA Runtime with the given SCDL
-     * 
-     * @param compositePath The path of the system SCDL
-     * @param compositePath The path of the application SCDL
-     */
-    public static void start(String system, String compositePath) {
-        try {
-            ClassLoader cl = Thread.currentThread().getContextClassLoader();
-            URL systemURL = cl.getResource(system);
-            URL applicationURL = cl.getResource(compositePath);
-            getInstance().startup(systemURL, null, applicationURL, compositePath);
+            getInstance().startup(applicationURL, compositePath);
         } catch (Exception e) {
             throw new IllegalStateException(e);
         }
@@ -230,14 +198,12 @@
     /**
      * Start up the runtime
      * 
-     * @param system The URL of the SCDL for tuscany system composite
-     * @param extensions The URLs of the SCDLs for tuscany extension composites
      * @param application The URL of the SCDL for the application composite
      * @param compositePath The path of the application composite relative to
      *            the application URL
      * @throws Exception
      */
-    protected abstract void startup(URL system, URL[] extensions, URL application, String compositePath)
+    protected abstract void startup(URL application, String compositePath)
         throws Exception;
 
     /**

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java?view=diff&rev=529169&r1=529168&r2=529169
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java Mon Apr 16 01:40:22 2007
@@ -38,12 +38,10 @@
 
     protected SimpleRuntime runtime;
 
-    protected void startup(URL system, URL[] exts, URL applicationSCDL, String compositePath) throws Exception {
+    protected void startup(URL applicationSCDL, String compositePath) throws Exception {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        List<URL> extensions = exts == null ? null : Arrays.asList(exts);
         URI contributionURI = URI.create("/default");
-        SimpleRuntimeInfo runtimeInfo = new SimpleRuntimeInfoImpl(cl, system, extensions, contributionURI,
-                                                                  applicationSCDL, compositePath);
+        SimpleRuntimeInfo runtimeInfo = new SimpleRuntimeInfoImpl(cl, contributionURI, applicationSCDL, compositePath);
         runtime = new SimpleRuntimeImpl(runtimeInfo);
 
         try {

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=529169&r1=529168&r2=529169
==============================================================================
--- 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 Mon Apr 16 01:40:22 2007
@@ -50,7 +50,6 @@
 import org.apache.tuscany.contribution.service.impl.PackageTypeDescriberImpl;
 import org.apache.tuscany.contribution.service.util.FileHelper;
 import org.apache.tuscany.core.bootstrap.ExtensionPointRegistryImpl;
-import org.apache.tuscany.core.component.SimpleWorkContext;
 import org.apache.tuscany.core.component.WorkContextImpl;
 import org.apache.tuscany.core.runtime.AbstractRuntime;
 import org.apache.tuscany.host.runtime.InitializationException;
@@ -75,8 +74,7 @@
         super(SimpleRuntimeInfo.class);
         ClassLoader hostClassLoader = runtimeInfo.getClassLoader();
         setHostClassLoader(hostClassLoader);
-        setApplicationScdl(runtimeInfo.getApplicationSCDL());
-        setSystemScdl(runtimeInfo.getSystemSCDL());
+        setApplicationSCDL(runtimeInfo.getApplicationSCDL());
         setRuntimeInfo(runtimeInfo);
     }
 
@@ -158,7 +156,7 @@
 
         // Contribute and activate the SCA contribution
         URI uri = URI.create("sca://default/");
-        URL root = getContributionLocation(getApplicationScdl(), runtimeInfo.getCompositePath());
+        URL root = getContributionLocation(getApplicationSCDL(), runtimeInfo.getCompositePath());
         contributionService.contribute(uri, root, false);
         Contribution contribution = contributionService.getContribution(uri);
         // FIXME: Need to getDeployables() as list of Composites

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfo.java?view=diff&rev=529169&r1=529168&r2=529169
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfo.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfo.java Mon Apr 16 01:40:22 2007
@@ -21,7 +21,6 @@
 
 import java.net.URI;
 import java.net.URL;
-import java.util.List;
 
 import org.apache.tuscany.host.RuntimeInfo;
 import org.apache.tuscany.spi.bootstrap.ComponentNames;
@@ -32,22 +31,13 @@
 public interface SimpleRuntimeInfo extends RuntimeInfo {
     URI DEFAULT_COMPOSITE = ComponentNames.TUSCANY_APPLICATION_ROOT.resolve("default");
 
-    String DEFAULT_SYSTEM_SCDL = "META-INF/tuscany/default-system.composite";
-    String SYSTEM_SCDL = "system.composite";
-    String EXTENSION_SCDL = "META-INF/sca/extension.composite";
-    String SERVICE_SCDL = "META-INF/sca/service.composite";
-    String META_APPLICATION_SCDL = "META-INF/sca/application.composite";
     String APPLICATION_SCDL = "application.composite";
 
     ClassLoader getClassLoader();
 
     String getCompositePath();
 
-    URL getSystemSCDL();
-
     URL getApplicationSCDL();
-
-    List<URL> getExtensionSCDLs();
 
     URL getContributionRoot();
 

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfoImpl.java?view=diff&rev=529169&r1=529168&r2=529169
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfoImpl.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeInfoImpl.java Mon Apr 16 01:40:22 2007
@@ -19,14 +19,9 @@
 
 package org.apache.tuscany.host.embedded;
 
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
 
 import org.apache.tuscany.contribution.service.util.FileHelper;
 import org.apache.tuscany.host.AbstractRuntimeInfo;
@@ -37,11 +32,7 @@
 public class SimpleRuntimeInfoImpl extends AbstractRuntimeInfo implements SimpleRuntimeInfo {
     private ClassLoader classLoader;
     private String compositePath;
-
-    private List<URL> extensions;
     private URL applicationSCDL;
-    private URL systemSCDL;
-
     private URL contributionURL;
     private URI contributionURI;
 
@@ -53,20 +44,15 @@
      * @param systemSCDL
      */
     public SimpleRuntimeInfoImpl(ClassLoader classLoader,
-                                 URL systemSCDL,
-                                 List<URL> extensions,
                                  URI contributionURI,
                                  URL applicationSCDL,
                                  String compositePath) {
         this(classLoader, compositePath);
-        this.extensions = extensions;
         this.applicationSCDL = applicationSCDL;
-        this.systemSCDL = systemSCDL;
         this.contributionURI = contributionURI;
     }
 
     public SimpleRuntimeInfoImpl(ClassLoader classLoader, String compositePath) {
-        // super(domain, applicationRootDirectory, baseUrl, online, runtimeId);
         super(URI.create("sca://domain/local"), null, null, false, "simple");
         if (classLoader != null) {
             this.classLoader = classLoader;
@@ -91,18 +77,13 @@
             applicationSCDL = classLoader.getResource(compositePath);
             if (applicationSCDL == null) {
                 applicationSCDL = classLoader.getResource(APPLICATION_SCDL);
-                if (applicationSCDL == null) {
-                    applicationSCDL = classLoader.getResource(META_APPLICATION_SCDL);
-                    if (applicationSCDL != null) {
-                        compositePath = META_APPLICATION_SCDL;
-                    }
-                } else {
+                if (applicationSCDL != null) {
                     if (compositePath == null) {
                         compositePath = APPLICATION_SCDL;
                     }
                 }
                 if (applicationSCDL == null) {
-                    throw new IllegalArgumentException("application SCDL not found: " + APPLICATION_SCDL);
+                    throw new IllegalArgumentException("Application composite not found: " + APPLICATION_SCDL);
                 }
             }
         }
@@ -114,39 +95,6 @@
             contributionURL = getContributionLocation(getApplicationSCDL(), compositePath);
         }
         return contributionURL;
-    }
-
-    public List<URL> getExtensionSCDLs() {
-        if (extensions == null) {
-            try {
-                List<URL> extensionURLs = new ArrayList<URL>();
-                Enumeration<URL> urls = classLoader.getResources(SERVICE_SCDL);
-                extensionURLs.addAll(Collections.list(urls));
-                urls = classLoader.getResources(EXTENSION_SCDL);
-                extensionURLs.addAll(Collections.list(urls));
-                if (extensions != null) {
-                    for (URL ext : extensions) {
-                        if (!extensionURLs.contains(ext)) {
-                            extensionURLs.add(ext);
-                        }
-                    }
-                }
-                extensions = extensionURLs;
-            } catch (IOException e) {
-                throw new IllegalArgumentException(e);
-            }
-        }
-        return extensions;
-    }
-
-    public URL getSystemSCDL() {
-        if (systemSCDL == null) {
-            systemSCDL = classLoader.getResource(SYSTEM_SCDL);
-            if (systemSCDL == null) {
-                systemSCDL = classLoader.getResource(DEFAULT_SYSTEM_SCDL);
-            }
-        }
-        return systemSCDL;
     }
 
     private static URL getContributionLocation(URL applicationSCDL, String compositePath) {



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