tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r526299 - in /incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution: ContributionServiceImpl.java processor/FolderContributionProcessor.java processor/JarContributionProcessor.java
Date Fri, 06 Apr 2007 22:28:03 GMT
Author: lresende
Date: Fri Apr  6 15:28:01 2007
New Revision: 526299

URL: http://svn.apache.org/viewvc?view=rev&rev=526299
Log:
Adapting to packageProcessor returning a list of URI

Modified:
    incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
    incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/FolderContributionProcessor.java
    incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/JarContributionProcessor.java

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java?view=diff&rev=526299&r1=526298&r2=526299
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
Fri Apr  6 15:28:01 2007
@@ -35,6 +35,7 @@
 import org.apache.tuscany.services.contribution.model.Contribution;
 import org.apache.tuscany.services.contribution.model.DeployedArtifact;
 import org.apache.tuscany.services.contribution.util.IOHelper;
+import org.apache.tuscany.services.spi.contribution.ArtifactProcessor;
 import org.apache.tuscany.services.spi.contribution.ArtifactProcessorRegistry;
 import org.apache.tuscany.services.spi.contribution.ArtifactResolverRegistry;
 import org.apache.tuscany.services.spi.contribution.ContributionException;
@@ -253,31 +254,43 @@
             contributionArtifacts = this.packageProcessorRegistry.getArtifacts(locationURL,
contributionStream);
         }
 
-        processArtifactRead(contribution, contributionArtifacts);
-
+        //processReadPhase(contribution, contributionArtifacts);
+        //processResolvePhase(contribution);
+        //processOptimizationPhase();
+        
         // store the contribution on the registry
         this.contributionRegistry.put(contribution.getUri(), contribution);
     }
 
-    private void processArtifactRead(Contribution contribution, List<URI> artifacts)
throws ContributionException,
+    private void processReadPhase(Contribution contribution, List<URI> artifacts) throws
ContributionException,
         MalformedURLException {
         for (URI a : artifacts) {
             URL artifactURL = packageProcessorRegistry.getArtifactURL(contribution.getLocation(),
a);
-            Object model = this.artifactProcessorRegistry.read(artifactURL);
+            Object model = ((ArtifactProcessor)this.artifactProcessorRegistry).read(artifactURL);
 
             if (model != null) {
-                URI artifactURI = getArtifactURI(contribution.getUri(), artifactURL);
+                URI artifactURI = contribution.getUri().resolve(a);
                 DeployedArtifact artifact = new DeployedArtifact(artifactURI);
                 artifact.setLocation(artifactURL);
                 contribution.addArtifact(artifact);
             }
         }
     }
-
-    private URI getArtifactURI(URI baseURI, URL artifactURL) {
-        String artifactPath = artifactURL.toExternalForm().substring(artifactURL.toExternalForm().length());
-        return baseURI.resolve(artifactPath);
-
+    
+    private void processResolvePhase(Contribution contribution){
+        //for each artifact that was processed on the contribution
+        for(DeployedArtifact artifact : contribution.getArtifacts().values()){
+            //for each model object for the artifact
+            for(Object model : artifact.getModelObjects(Class.class).values()){
+                //resolve it
+                
+            }
+        }
+        
+    }
+    
+    private void processOptimizationPhase(){
+        //TODO
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/FolderContributionProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/FolderContributionProcessor.java?view=diff&rev=526299&r1=526298&r2=526299
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/FolderContributionProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/FolderContributionProcessor.java
Fri Apr  6 15:28:01 2007
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -68,6 +69,10 @@
                 traverse(fileList, files[i], root);
             }
         }
+    }
+    
+    public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
+        return new URL(sourceURL, artifact.toString());
     }
 
     /**

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/JarContributionProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/JarContributionProcessor.java?view=diff&rev=526299&r1=526298&r2=526299
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/JarContributionProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/processor/JarContributionProcessor.java
Fri Apr  6 15:28:01 2007
@@ -56,7 +56,6 @@
         } else {
             return new URL("jar:" + sourceURL.toExternalForm() + "!/" + artifact);
         }
-
     }
 
     public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws
ContributionException,



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