summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly-xml/src/main
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-03-18 01:34:22 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-03-18 01:34:22 +0000
commitbc902f7edf8ea0a278e322c485dd2fc977d02294 (patch)
treeef9aa67c64adb9ce03a88fccc7e92d8872846968 /sca-java-2.x/trunk/modules/assembly-xml/src/main
parent0155d4682e2fcc0a677eff08df8dca36cb046f7f (diff)
TUSCANY-3452 - Adding support for new extensibility for contract based elements, adjusting current xml for the new model and adapting our element extension list to read/write semantycally same xml when these extensions are in use
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@924584 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java15
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java47
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java3
3 files changed, 29 insertions, 36 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
index a878054d99..b402b6e3a3 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
@@ -38,6 +38,8 @@ import static org.apache.tuscany.sca.assembly.xml.Constants.REFERENCE_QNAME;
import static org.apache.tuscany.sca.assembly.xml.Constants.SERVICE;
import static org.apache.tuscany.sca.assembly.xml.Constants.SERVICE_QNAME;
import static org.apache.tuscany.sca.assembly.xml.Constants.TYPE;
+import static org.apache.tuscany.sca.assembly.xml.Constants.EXTENSION;
+import static org.apache.tuscany.sca.assembly.xml.Constants.EXTENSION_QNAME;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -166,7 +168,12 @@ public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StA
} else {
policyProcessor.readPolicies(contract, operation, reader);
}
+ } else if(EXTENSION_QNAME.equals(name)) {
+ // Handle <extension>
+ //ignore element as this is a wrapper for extensibility
+ break;
} else {
+
// Read an extension element
Object extension = extensionProcessor.read(reader, context);
@@ -267,9 +274,7 @@ public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StA
writeEnd(writer);
}
- for (Object extension: service.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
+ this.writeExtendedElements(writer, service, extensionProcessor, context);
writeEnd(writer);
}
@@ -304,9 +309,7 @@ public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StA
writeEnd(writer);
}
- for (Object extension: reference.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
+ this.writeExtendedElements(writer, reference, extensionProcessor, context);
writeEnd(writer);
}
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
index 68791e2caa..885fde0612 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -59,6 +59,8 @@ import static org.apache.tuscany.sca.assembly.xml.Constants.URI;
import static org.apache.tuscany.sca.assembly.xml.Constants.WIRE;
import static org.apache.tuscany.sca.assembly.xml.Constants.WIRED_BY_IMPL;
import static org.apache.tuscany.sca.assembly.xml.Constants.WIRE_QNAME;
+import static org.apache.tuscany.sca.assembly.xml.Constants.EXTENSION;
+import static org.apache.tuscany.sca.assembly.xml.Constants.EXTENSION_QNAME;
import java.util.ArrayList;
import java.util.List;
@@ -217,8 +219,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
componentService.setName(getString(reader, NAME));
//handle extension attributes
- this
- .readExtendedAttributes(reader, name, componentService, extensionAttributeProcessor, context);
+ this.readExtendedAttributes(reader, name, componentService, extensionAttributeProcessor, context);
component.getServices().add(componentService);
policyProcessor.readPolicies(contract, reader);
@@ -254,8 +255,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
}
//handle extension attributes
- this
- .readExtendedAttributes(reader, name, compositeService, extensionAttributeProcessor, context);
+ this.readExtendedAttributes(reader, name, compositeService, extensionAttributeProcessor, context);
composite.getServices().add(compositeService);
policyProcessor.readPolicies(contract, reader);
@@ -499,7 +499,10 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
callback.getPolicySets().add(policySet);
}
}
-
+ } else if(EXTENSION_QNAME.equals(name)) {
+ // Handle <extension>
+ //ignore element as this is a wrapper for extensibility
+ break;
} else {
// Read an extension element
@@ -697,17 +700,13 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
}
// Write extensions
- for (Object extension : callback.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
+ this.writeExtendedElements(writer, service, extensionProcessor, context);
writeEnd(writer);
}
// Write extensions
- for (Object extension : service.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
+ this.writeExtendedElements(writer, service, extensionProcessor, context);
writeEnd(writer);
}
@@ -770,18 +769,14 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
}
// Write extensions
- for (Object extension : callback.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
+ this.writeExtendedElements(writer, callback, extensionProcessor, context);
writeEnd(writer);
}
// Write extensions
- for (Object extension : service.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
-
+ this.writeExtendedElements(writer, service, extensionProcessor, context);
+
writeEnd(writer);
}
@@ -821,17 +816,13 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
}
// Write extensions
- for (Object extensions : callback.getExtensions()) {
- extensionProcessor.write(extensions, writer, context);
- }
+ this.writeExtendedElements(writer, callback, extensionProcessor, context);
writeEnd(writer);
}
// Write extensions
- for (Object extensions : reference.getExtensions()) {
- extensionProcessor.write(extensions, writer, context);
- }
+ this.writeExtendedElements(writer, reference, extensionProcessor, context);
writeEnd(writer);
}
@@ -909,17 +900,13 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
}
// Write extensions
- for (Object extension : callback.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
+ this.writeExtendedElements(writer, callback, extensionProcessor, context);
writeEnd(writer);
}
// Write extensions
- for (Object extension : reference.getExtensions()) {
- extensionProcessor.write(extension, writer, context);
- }
+ this.writeExtendedElements(writer, reference, extensionProcessor, context);
writeEnd(writer);
}
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
index bc9a7a4d26..48cfbbb381 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
@@ -69,6 +69,9 @@ public interface Constants {
String BINDING_SCA = "binding.sca";
QName BINDING_SCA_QNAME = new QName(Constants.SCA11_NS, BINDING_SCA);
+ String EXTENSION = "extensions";
+ QName EXTENSION_QNAME = new QName(Constants.SCA11_NS, EXTENSION);
+
String NAME = "name";
String VALUE = "value";
QName VALUE_QNAME = new QName(SCA11_NS, VALUE);