summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/contribution
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-14 07:43:26 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-14 07:43:26 +0000
commit5d0104c47545c30a7a41bc55d19139b9e78023b8 (patch)
treeea2876a7e4d09e573c3befc3792240e5534c4dc1 /sca-java-2.x/trunk/modules/contribution
parent605c341eebc67f9dc0b55c130c96ca464ab0924e (diff)
Add a method to Contribution to get an artifacts Model object
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1102968 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/contribution')
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java8
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java8
2 files changed, 15 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
index 777ba1f986..af2dd66863 100644
--- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
+++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
@@ -122,5 +122,11 @@ public interface Contribution extends Artifact, Extensible {
* @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
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
index c31763151d..31ddc5b793 100644
--- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
+++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
@@ -155,4 +155,12 @@ class ContributionImpl extends ExtensibleImpl implements Contribution {
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);
+ }
}