summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java b/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
index e64069cec1..f44da1f5bb 100644
--- a/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
+++ b/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
@@ -97,7 +97,7 @@ class WebImplementationImpl implements WebImplementation, ComponentPreProcessor
}
/**
- * Use preProcess to add any references dynamically
+ * Use preProcess to add any references and properties dynamically
* TODO: also support introspection and handle WEB-INF/web.componentType (spec line 503)
*/
public void preProcess(Component component) {
@@ -111,6 +111,12 @@ class WebImplementationImpl implements WebImplementation, ComponentPreProcessor
getReferences().add(createReference(reference));
}
}
+
+ for (Property property : rtc.getProperties()) {
+ if (getProperty(property.getName()) == null) {
+ getProperties().add(createProperty(property));
+ }
+ }
}
protected Reference getReference(String name) {
@@ -132,4 +138,23 @@ class WebImplementationImpl implements WebImplementation, ComponentPreProcessor
return newReference;
}
+ protected Property getProperty(String name) {
+ for (Property property : getProperties()) {
+ if (property.getName().equals(name)) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ protected Property createProperty(Property property) {
+ Property newProperty;
+ try {
+ newProperty = (Property)property.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e); // should not ever happen
+ }
+ return newProperty;
+ }
+
}