public void resolve(WebImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
// Resolve the component type
String uri = implementation.getURI();
if (uri != null) {
WebModuleInfo webModuleInfo = new WebModuleInfoImpl();
webModuleInfo.setUri(URI.create(uri));
webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo);
if(jeeOptionalExtension != null) {
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
List<Class<?>> webArtifacts = new ArrayList<Class<?>>();
webArtifacts.addAll(webModuleInfo.getServletClasses());
webArtifacts.addAll(webModuleInfo.getFilterClasses());
webArtifacts.addAll(webModuleInfo.getListenerClasses());
webArtifacts.addAll(webModuleInfo.getJSFClasses());
JavaImplementation ji = javaImplementationFactory.createJavaImplementation();
for(Class<?> clazz : webArtifacts) {
try {
javaImplementationFactory.createJavaImplementation(ji, clazz);
} catch (IntrospectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
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()) {
ComponentReference ref = assemblyFactory.createComponentReference();
ref.setName(jspRefTag.name);
JavaInterfaceContract intfContract = javaInterfaceFactory.createJavaInterfaceContract();
try {
intfContract.setInterface(javaInterfaceFactory.createJavaInterface(jspRefTag.type));