summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/implementation-ejb/src/main/java
diff options
context:
space:
mode:
authorvamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2009-11-05 06:08:47 +0000
committervamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2009-11-05 06:08:47 +0000
commit73f83aa2af6c25757ca8eee53d6d5ecb6fd7d6df (patch)
treed1f1bfb87bcb4801d295ad04e69fbf23ce3d2d79 /branches/sca-java-1.x/modules/implementation-ejb/src/main/java
parent4d7463b06ae6fc6760d2bbbd0b448b1904ea9b3e (diff)
Obtain the injection points for ejb component from implementation.web
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@833009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-ejb/src/main/java')
-rw-r--r--branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java37
-rw-r--r--branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java43
-rw-r--r--branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java38
3 files changed, 118 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java b/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
index 0d3b05f0c9..3243c94aa7 100644
--- a/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
+++ b/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
@@ -18,7 +18,13 @@
*/
package org.apache.tuscany.sca.implementation.ejb;
+import java.util.Collection;
+import java.util.Map;
+
import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.contribution.jee.InjectionTarget;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
@@ -41,4 +47,35 @@ public interface EJBImplementation extends Implementation {
*/
void setEJBLink(String ejbLink);
+ /**
+ * 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();
+
+ /**
+ * Returns the injection points for SCA callbacks
+ *
+ * @return Map with injection points for SCA callbacks
+ */
+ Map<String, Collection<JavaElementImpl>> getCallbackInjectionPoints();
+
+ Map<InjectionTarget, Class<?>> getOptExtensionReferenceInjectionPoints();
+
+ Map<String, String> getOptExtensionPropertyInjectionPoints();
}
diff --git a/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java b/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
index 8bcff6eb70..f912e4b36f 100644
--- a/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
+++ b/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
@@ -18,6 +18,10 @@
*/
package org.apache.tuscany.sca.implementation.ejb.impl;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ConstrainingType;
import org.apache.tuscany.sca.assembly.Property;
@@ -25,7 +29,10 @@ 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.contribution.jee.InjectionTarget;
import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -38,6 +45,18 @@ class EJBImplementationImpl extends ImplementationImpl implements EJBImplementat
private String ejbLink;
+ 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>();
+
+ private final Map<String, Collection<JavaElementImpl>> callbackInjectionPoints = new HashMap<String, Collection<JavaElementImpl>>();
+
+ private Map<InjectionTarget, Class<?>> optExtReferenceInjectionPoints = new HashMap<InjectionTarget, Class<?>>();
+
+ private Map<String, String> optExtPropertyInjectionPoints = new HashMap<String, String>();
+
/**
* Constructs a new EJB implementation.
*/
@@ -64,6 +83,30 @@ class EJBImplementationImpl extends ImplementationImpl implements EJBImplementat
this.ejbLink = ejbLink;
}
+ public Map<String, JavaElementImpl> getPropertyInjectionPoints() {
+ return propertyInjectionPoints;
+ }
+
+ public Map<String, JavaElementImpl> getReferenceInjectionPoints() {
+ return referenceInjectionPoints;
+ }
+
+ public Map<String, JavaResourceImpl> getResourceInjectionPoints() {
+ return resourceInjectionPoints;
+ }
+
+ public Map<String, Collection<JavaElementImpl>> getCallbackInjectionPoints() {
+ return callbackInjectionPoints;
+ }
+
+ public Map<InjectionTarget, Class<?>> getOptExtensionReferenceInjectionPoints() {
+ return optExtReferenceInjectionPoints;
+ }
+
+ public Map<String, String> getOptExtensionPropertyInjectionPoints() {
+ return optExtPropertyInjectionPoints;
+ }
+
/**
* Use preProcess to add any references and properties dynamically
*/
diff --git a/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java b/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
index cfbad6c0f2..30c42f47a8 100644
--- a/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
+++ b/branches/sca-java-1.x/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
@@ -21,6 +21,10 @@ package org.apache.tuscany.sca.implementation.ejb.xml;
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
@@ -30,10 +34,13 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.jee.EjbInfo;
import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
+import org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo;
+import org.apache.tuscany.sca.contribution.jee.EnvEntryInfo;
import org.apache.tuscany.sca.contribution.jee.JavaEEExtension;
import org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension;
import org.apache.tuscany.sca.contribution.jee.impl.EjbModuleInfoImpl;
@@ -49,6 +56,8 @@ 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.PropertyProcessor;
import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
@@ -175,6 +184,23 @@ public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implem
if (ct != null){
implementation.getReferences().addAll(ct.getReferences());
implementation.getProperties().addAll(ct.getProperties());
+
+ // Injection points
+ List<String> propertyNames = new ArrayList<String>();
+ for(Property prop : ct.getProperties()) {
+ propertyNames.add(prop.getName());
+ }
+ EjbInfo ejbInfo = ejbModuleInfo.getEjbInfo(uri);
+ for(Map.Entry<String, EjbReferenceInfo> entry : ejbInfo.ejbReferences.entrySet()) {
+ EjbReferenceInfo ejbRef = entry.getValue();
+ implementation.getOptExtensionReferenceInjectionPoints().put(ejbRef.injectionTarget, ejbRef.businessInterface);
+ }
+ for(Map.Entry<String, EnvEntryInfo> entry : ejbInfo.envEntries.entrySet()) {
+ EnvEntryInfo envEntry = entry.getValue();
+ if(propertyNames.contains(envEntry.name.replace("/", "_"))) {
+ implementation.getOptExtensionPropertyInjectionPoints().put(envEntry.name, envEntry.type);
+ }
+ }
}
}
@@ -191,6 +217,18 @@ public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implem
implementation.getReferences().addAll(ji.getReferences());
implementation.getProperties().addAll(ji.getProperties());
implementation.getServices().addAll(ji.getServices());
+ 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());
+ }
+ for(Map.Entry<String, Collection<JavaElementImpl>> entry : ji.getCallbackMembers().entrySet()) {
+ implementation.getCallbackInjectionPoints().put(entry.getKey(), entry.getValue());
+ }
} catch (IntrospectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();