Property injection for SCA properties in implementation.web computed by Java EE optional extension

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832369 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vamsic007 2009-11-03 10:00:17 +00:00
parent a2c3f4546c
commit 30a5d3989b
3 changed files with 20 additions and 0 deletions

View file

@ -66,4 +66,6 @@ public interface WebImplementation extends Implementation {
Map<String, JavaResourceImpl> getResourceInjectionPoints();
Map<InjectionTarget, Class<?>> getOptExtensionReferenceInjectionPoints();
Map<String, String> getOptExtensionPropertyInjectionPoints();
}

View file

@ -51,6 +51,8 @@ class WebImplementationImpl extends ImplementationImpl implements WebImplementat
private Map<String, JavaResourceImpl> resourceInjectionPoints = new HashMap<String, JavaResourceImpl>();
private Map<InjectionTarget, Class<?>> optExtReferenceInjectionPoints = new HashMap<InjectionTarget, Class<?>>();
private Map<String, String> optExtPropertyInjectionPoints = new HashMap<String, String>();
/**
* Constructs a new Web implementation.
*/
@ -159,4 +161,8 @@ class WebImplementationImpl extends ImplementationImpl implements WebImplementat
public Map<InjectionTarget, Class<?>> getOptExtensionReferenceInjectionPoints() {
return optExtReferenceInjectionPoints;
}
public Map<String, String> getOptExtensionPropertyInjectionPoints() {
return optExtPropertyInjectionPoints;
}
}

View file

@ -33,9 +33,11 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.ComponentReference;
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.EjbReferenceInfo;
import org.apache.tuscany.sca.contribution.jee.EnvEntryInfo;
import org.apache.tuscany.sca.contribution.jee.JspReferenceTagInfo;
import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
import org.apache.tuscany.sca.contribution.jee.JavaEEExtension;
@ -143,11 +145,21 @@ public class WebImplementationProcessor extends BaseStAXArtifactProcessor implem
ComponentType ct = jeeOptionalExtension.createImplementationWebComponentType(webModuleInfo);
implementation.getReferences().addAll(ct.getReferences());
implementation.getProperties().addAll(ct.getProperties());
List<String> propertyNames = new ArrayList<String>();
for(Property prop : ct.getProperties()) {
propertyNames.add(prop.getName());
}
// Injection points from optional extension
for(Map.Entry<String, EjbReferenceInfo> entry : webModuleInfo.getEjbReferences().entrySet()) {
EjbReferenceInfo ejbRef = entry.getValue();
implementation.getOptExtensionReferenceInjectionPoints().put(ejbRef.injectionTarget, ejbRef.businessInterface);
}
for(Map.Entry<String, EnvEntryInfo> entry : webModuleInfo.getEnvEntries().entrySet()) {
EnvEntryInfo envEntry = entry.getValue();
if(propertyNames.contains(envEntry.name.replace("/", "_"))) {
implementation.getOptExtensionPropertyInjectionPoints().put(envEntry.name, envEntry.type);
}
}
}
// Introspection of classes