diff options
author | vamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-23 07:41:37 +0000 |
---|---|---|
committer | vamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-23 07:41:37 +0000 |
commit | dea318e825c32ea2415c60fec19121f3c7ad4b18 (patch) | |
tree | a5b1b853f3f09d7735ab815ec0a1bf9a88495031 /branches/sca-java-1.x/modules/implementation-web/src/main/java | |
parent | 756bf45a97409eb42ecd2e478abbbee4101ae997 (diff) |
Make the WebImplementationProcessor compute the injection points for properties, references and resources like component context etc.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@828951 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-web/src/main/java')
3 files changed, 61 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java b/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java index 86af3d7204..b8b8be1ffb 100644 --- a/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java +++ b/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java @@ -18,7 +18,11 @@ */
package org.apache.tuscany.sca.implementation.web;
+import java.util.Map;
+
import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
@@ -39,4 +43,24 @@ public interface WebImplementation extends Implementation { */
void setWebURI(String webappURI);
+ /**
+ * Returns the injection points for SCA references
+ *
+ * @return Map with injection points for SCA references
+ */
+ Map<String, JavaElementImpl> getReferenceInjectionPoints();
+
+ /**
+ * Returns the injection points for SCA properties
+ *
+ * @return Map with injection points for SCA properties
+ */
+ Map<String, JavaElementImpl> getPropertyInjectionPoints();
+
+ /**
+ * Returns the injection points for SCA resources like component context, component name, etc.
+ *
+ * @return Map with injection points for SCA resources
+ */
+ Map<String, JavaResourceImpl> getResourceInjectionPoints();
}
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 bd48f7a521..ec0627f0a8 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 @@ -19,7 +19,9 @@ package org.apache.tuscany.sca.implementation.web.impl;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ConstrainingType;
@@ -28,6 +30,8 @@ import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
import org.apache.tuscany.sca.implementation.web.WebImplementation;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -39,6 +43,11 @@ class WebImplementationImpl extends ImplementationImpl implements WebImplementat private String webURI;
+ private Map<String, JavaElementImpl> propertyInjectionPoints = new HashMap<String, JavaElementImpl>();
+
+ private Map<String, JavaElementImpl> referenceInjectionPoints = new HashMap<String, JavaElementImpl>();
+
+ private Map<String, JavaResourceImpl> resourceInjectionPoints = new HashMap<String, JavaResourceImpl>();
/**
* Constructs a new Web implementation.
*/
@@ -132,4 +141,16 @@ class WebImplementationImpl extends ImplementationImpl implements WebImplementat return newProperty;
}
+ public Map<String, JavaElementImpl> getPropertyInjectionPoints() {
+ return propertyInjectionPoints;
+ }
+
+ public Map<String, JavaElementImpl> getReferenceInjectionPoints() {
+ return referenceInjectionPoints;
+ }
+
+ public Map<String, JavaResourceImpl> getResourceInjectionPoints() {
+ return resourceInjectionPoints;
+ }
+
}
diff --git a/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java b/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java index d79517f232..d1c611dc2f 100644 --- a/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java +++ b/branches/sca-java-1.x/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java @@ -23,6 +23,7 @@ import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; import java.net.URI;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -49,6 +50,10 @@ import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFacto import org.apache.tuscany.sca.implementation.java.IntrospectionException;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
import org.apache.tuscany.sca.implementation.web.WebImplementation;
import org.apache.tuscany.sca.implementation.web.WebImplementationFactory;
import org.apache.tuscany.sca.implementation.web.introspect.PropertyProcessor;
@@ -85,6 +90,8 @@ public class WebImplementationProcessor extends BaseStAXArtifactProcessor implem this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
javaImplementationFactory.addClassVisitor(new ReferenceProcessor(assemblyFactory, javaInterfaceFactory));
javaImplementationFactory.addClassVisitor(new PropertyProcessor(assemblyFactory));
+ javaImplementationFactory.addClassVisitor(new ComponentNameProcessor(assemblyFactory));
+ javaImplementationFactory.addClassVisitor(new ContextProcessor(assemblyFactory));
}
public QName getArtifactType() {
@@ -154,6 +161,15 @@ public class WebImplementationProcessor extends BaseStAXArtifactProcessor implem }
implementation.getReferences().addAll(ji.getReferences());
implementation.getProperties().addAll(ji.getProperties());
+ for(Map.Entry<String, JavaElementImpl> entry : ji.getReferenceMembers().entrySet()) {
+ implementation.getReferenceInjectionPoints().put(entry.getKey(), entry.getValue());
+ }
+ for(Map.Entry<String, JavaElementImpl> entry : ji.getPropertyMembers().entrySet()) {
+ implementation.getPropertyInjectionPoints().put(entry.getKey(), entry.getValue());
+ }
+ for(Map.Entry<String, JavaResourceImpl> entry : ji.getResources().entrySet()) {
+ implementation.getResourceInjectionPoints().put(entry.getKey(), entry.getValue());
+ }
// SCA References in JSP Tags
for(JspReferenceTagInfo jspRefTag : webModuleInfo.getJspReferenceTags()) {
|