tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1103278 - in /tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution: Contribution.java impl/ContributionImpl.java
Date Sun, 15 May 2011 06:51:48 GMT
Author: antelder
Date: Sun May 15 06:51:48 2011
New Revision: 1103278

URL: http://svn.apache.org/viewvc?rev=1103278&view=rev
Log:
Add a method to Contribution to merge in ContributionMetadata

Modified:
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java?rev=1103278&r1=1103277&r2=1103278&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
Sun May 15 06:51:48 2011
@@ -129,4 +129,6 @@ public interface Contribution extends Ar
      * @return the model
      */
     <T> T getArtifactModel(String uri);
+
+    void mergeMetaData(ContributionMetadata metaData);
 }
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java?rev=1103278&r1=1103277&r2=1103278&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
Sun May 15 06:51:48 2011
@@ -22,12 +22,14 @@ package org.apache.tuscany.sca.contribut
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Set;
 
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
 import org.apache.tuscany.sca.contribution.Artifact;
 import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionMetadata;
 import org.apache.tuscany.sca.contribution.Export;
 import org.apache.tuscany.sca.contribution.Import;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
@@ -163,4 +165,23 @@ class ContributionImpl extends Extensibl
         }
         throw new IllegalArgumentException("artifact not found: " + uri);
     }
+
+    @Override
+    public void mergeMetaData(ContributionMetadata metaData) {
+        imports.addAll(metaData.getImports());
+        exports.addAll(metaData.getExports());
+        if (metaData.getDeployables().size() > 0) {
+            // Update the deployable Composite objects with the correct Composite object
for the artifact
+            for (Artifact a : getArtifacts()) {
+                if (a.getModel() instanceof Composite) {
+                    for (ListIterator<Composite> lit = metaData.getDeployables().listIterator();
lit.hasNext();) {
+                        if (lit.next().getName().equals(((Composite)a.getModel()).getName()))
{
+                            lit.set((Composite)a.getModel());
+                        }
+                    }
+                }
+            }
+            deployables.addAll(metaData.getDeployables());
+        }
+    }
 }



Mime
View raw message