tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1104134 - /tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
Date Tue, 17 May 2011 11:05:13 GMT
Author: antelder
Date: Tue May 17 11:05:13 2011
New Revision: 1104134

URL: http://svn.apache.org/viewvc?rev=1104134&view=rev
Log:
Remove unused methods on InstalledContribution and add a method to merge in contribution metadata

Modified:
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java?rev=1104134&r1=1104133&r2=1104134&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
Tue May 17 11:05:13 2011
@@ -26,6 +26,15 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+
 public class InstalledContribution implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -42,9 +51,6 @@ public class InstalledContribution imple
     private List<String> javaImports = new ArrayList<String>();
     private List<String> namespaceImports = new ArrayList<String>();
     
-    private String metaData;
-    private boolean overwriteMetaData;
-    
     // the URI and XML content of composites to include in the contribution
     private Map<String, String> additionalDeployables = new HashMap<String, String>();
 
@@ -74,18 +80,6 @@ public class InstalledContribution imple
     public List<String> getDependentContributionURIs() {
         return dependentContributionURIs;
     }
-    public String getMetaData() {
-        return metaData;
-    }
-    public void setMetaData(String metaData) {
-        this.metaData = metaData;
-    }
-    public boolean isOverwriteMetaData() {
-        return overwriteMetaData;
-    }
-    public void setOverwriteMetaData(boolean overwriteMetaData) {
-        this.overwriteMetaData = overwriteMetaData;
-    }
     public Map<String, String> getAdditionalDeployables() {
         return additionalDeployables;
     }
@@ -102,6 +96,37 @@ public class InstalledContribution imple
         return namespaceImports;
     }
     
+    public void configureMetaData(Contribution contribution) {
+
+        if (contribution.getDeployables() != null) {
+            for (Composite composite : contribution.getDeployables()) {
+                getDeployables().add(composite.getURI());
+            }
+        }
+
+        if (contribution.getExports() != null) {
+            for (Export export : contribution.getExports()) {
+                // TODO: Handle these and others in a more extensible way
+                if (export instanceof JavaExport) {
+                    getJavaExports().add(((JavaExport)export).getPackage());
+                } else if (export instanceof NamespaceExport) {
+                    getNamespaceExports().add(((NamespaceExport)export).getNamespace());
+                } 
+            }
+        }
+        
+        if (contribution.getImports() != null) {
+            for (Import imprt : contribution.getImports()) {
+                // TODO: Handle these and others in a more extensible way
+                if (imprt instanceof JavaImport) {
+                    getJavaImports().add(((JavaImport)imprt).getPackage());
+                } else if (imprt instanceof NamespaceImport) {
+                    getNamespaceImports().add(((NamespaceImport)imprt).getNamespace());
+                } 
+            }
+        }
+    }
+    
     /**
      * Derives a URI for the contribution based on its URL
      */



Mime
View raw message