summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly-xml/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src')
-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);