tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1102968 - in /tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution: Contribution.java impl/ContributionImpl.java
Date Sat, 14 May 2011 07:43:26 GMT
Author: antelder
Date: Sat May 14 07:43:26 2011
New Revision: 1102968

URL: http://svn.apache.org/viewvc?rev=1102968&view=rev
Log:
Add a method to Contribution to get an artifacts Model object

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=1102968&r1=1102967&r2=1102968&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
Sat May 14 07:43:26 2011
@@ -122,5 +122,11 @@ public interface Contribution extends Ar
      * @return
      */
     Set<String> getTypes();
-
+    
+    /**
+     * Get an artifacts model object
+     * @param uri The artifact uri
+     * @return the model
+     */
+    <T> T getArtifactModel(String uri);
 }
\ 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=1102968&r1=1102967&r2=1102968&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
Sat May 14 07:43:26 2011
@@ -155,4 +155,12 @@ class ContributionImpl extends Extensibl
         return types;
     }
 
+    public <T> T getArtifactModel(String uri) {
+        for (Artifact a : getArtifacts()) {
+            if (a.getURI().equals(uri)) {
+                return (T) a.getModel();
+            }
+        }
+        throw new IllegalArgumentException("artifact not found: " + uri);
+    }
 }



Mime
View raw message