diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/contribution/src/main/java')
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); + } } |