summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/contribution/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/contribution/src')
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java14
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java21
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java1
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java11
4 files changed, 40 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java
index 5f26c3d907..a62d7155c9 100644
--- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java
+++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java
@@ -31,6 +31,20 @@ import org.apache.tuscany.sca.assembly.Extensible;
* @version $Rev$ $Date$
*/
public interface ContributionMetadata extends Base, Extensible {
+
+ /**
+ * Returns the spec version of the contribution metadata used to build this model
+ *
+ * @return the spec version used to build this model
+ */
+ String getSpecVersion();
+
+ /**
+ * Sets the spec version of the contribution metadata used to build this model
+ *
+ * @param specVersion the spec version used to build this model
+ */
+ void setSpecVersion(String specVersion);
/**
* Returns a list of exports based on the contribution metadata.
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java
index da8c879a93..e2397c6f26 100644
--- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java
+++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java
@@ -34,20 +34,22 @@ import org.apache.tuscany.sca.contribution.Import;
* @version $Rev$ $Date$
*/
class ContributionMetadataImpl extends ExtensibleImpl implements ContributionMetadata {
- private boolean unresolved;
+
+ private String specVersion = "undefined";
private List<Export> exports = new ArrayList<Export>();
private List<Import> imports = new ArrayList<Import>();
private List<Composite> deployables = new ArrayList<Composite>();
-
+ private boolean unresolved;
+
ContributionMetadataImpl() {
}
- public boolean isUnresolved() {
- return unresolved;
+ public String getSpecVersion() {
+ return specVersion;
}
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
+ public void setSpecVersion(String specVersion) {
+ this.specVersion = specVersion;
}
public List<Export> getExports() {
@@ -62,4 +64,11 @@ class ContributionMetadataImpl extends ExtensibleImpl implements ContributionMet
return deployables;
}
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
index 6feb0569c6..823684f422 100644
--- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
+++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
@@ -135,6 +135,7 @@ public class ContributionMetadataProcessor extends BaseStAXArtifactProcessor imp
// Read <contribution>
contribution = this.contributionFactory.createContributionMetadata();
+ contribution.setSpecVersion(SCA11_NS);
contribution.setUnresolved(true);
readExtendedAttributes(reader, contribution, attributeProcessor, assemblyFactory, context);
diff --git a/sca-java-2.x/trunk/modules/contribution/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java b/sca-java-2.x/trunk/modules/contribution/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
index a4aa564392..de6a8ac151 100644
--- a/sca-java-2.x/trunk/modules/contribution/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
+++ b/sca-java-2.x/trunk/modules/contribution/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
@@ -50,6 +50,7 @@ import org.junit.Test;
*/
public class ContributionMetadataProcessorTestCase {
+ private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912";
private static final String VALID_XML =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<contribution xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\""
@@ -64,7 +65,7 @@ public class ContributionMetadataProcessorTestCase {
+ "<deployable composite=\"ns:Composite1\"/>"
+ "<deployable/>"
+ "</contribution>";
-
+
private static XMLInputFactory inputFactory;
private static XMLOutputFactory outputFactory;
private static StAXArtifactProcessor<Object> staxProcessor;
@@ -110,6 +111,14 @@ public class ContributionMetadataProcessorTestCase {
}
@Test
+ public void testReadSpecVersion() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+ ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader, context);
+ assertNotNull(contribution);
+ assertEquals(SCA11_NS, contribution.getSpecVersion());
+ }
+
+ @Test
public void testWrite() throws Exception {
XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader, context);