diff options
author | vamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-20 14:50:18 +0000 |
---|---|---|
committer | vamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-20 14:50:18 +0000 |
commit | 297509632fec4b0630702e6368603a079e00b590 (patch) | |
tree | b99d4a19d7dd0fa11c2e6fe5c75c464f1b94b3b6 /branches/sca-java-1.x/modules/implementation-web/src/main/java | |
parent | 8def8718672e9dcc6217ade51464510fb51fa722 (diff) |
Preprocess properties as well.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@719244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-web/src/main/java')
-rw-r--r-- | branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java | 27 |
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;
+ }
+
}
|