You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/05/23 11:08:11 UTC

svn commit: r947387 - /tuscany/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java

Author: antelder
Date: Sun May 23 09:08:11 2010
New Revision: 947387

URL: http://svn.apache.org/viewvc?rev=947387&view=rev
Log:
Updateto use getLocationAsURL from common module, add some todo's and delete some blank lines

Modified:
    tuscany/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java

Modified: tuscany/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java?rev=947387&r1=947386&r2=947387&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/section10/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java Sun May 23 09:08:11 2010
@@ -19,9 +19,7 @@
 
 package org.apache.tuscany.sca.something.impl;
 
-import java.io.File;
 import java.io.Reader;
-import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
@@ -84,12 +82,12 @@ public class Section10Impl implements Se
     
     public void installContribution(String uri, String contributionURL, List<String> dependentContributionURIs, boolean autoDeploy) throws ContributionReadException, ActivationException {
         Monitor monitor = deployer.createMonitor();
-        URL url = getLocationAsURL(contributionURL);
+        URL url = IOHelper.getLocationAsURL(contributionURL);
         Contribution contribution = deployer.loadContribution(URI.create(uri), url, monitor);
         InstalledContribution ic = new InstalledContribution(uri, url.toString(), contribution);
         installedContributions.put(uri, ic);
         if (autoDeploy) {
-            for (Composite c : contribution.getDeployables()) {
+            for (Composite c : ic.getDefaultDeployables()) {
                 deployComposite(c, ic);
             }
         }
@@ -103,7 +101,8 @@ public class Section10Impl implements Se
 
         Monitor monitor = monitorFactory.createMonitor();
         Composite composite = deployer.loadXMLDocument(compositeXML, monitor);
-        
+        // TODO: does this need to do check the monitor
+
         String compositeArtifcatURI = composite.getName().getLocalPart() + ".composite";
         for (Artifact a : ic.getContribution().getArtifacts()) {
             if (compositeArtifcatURI.equals(a.getURI())) {
@@ -112,9 +111,7 @@ public class Section10Impl implements Se
         }
 
         deployer.attachDeploymentComposite(ic.getContribution(), composite, true);
-        
         deployComposite(composite, ic);
-
         return compositeArtifcatURI;
     }
 
@@ -246,15 +243,4 @@ public class Section10Impl implements Se
         ic.getDeployedComposites().add(dc);
     }
 
-    protected URL getLocationAsURL(String location) throws ContributionReadException {
-        URI uri = IOHelper.createURI(location);
-        if (uri.getScheme() == null) {
-            uri = new File(location).toURI();
-        }
-        try {
-            return uri.toURL();
-        } catch (MalformedURLException e) {
-            throw new ContributionReadException(e);
-        }
-    }
 }