}
return createWebModuleInfo(wm);
}
private WebModuleInfo createWebModuleInfo(WebModule webModule) {
WebModuleInfo wmInfo = new WebModuleInfoImpl();
WebApp webApp = webModule.getWebApp();
ClassLoader classLoader = webModule.getClassLoader();
wmInfo.setmoduleClassloader(classLoader);
// Process Remote EJB References
for (Map.Entry<String, EjbRef> entry : webApp.getEjbRefMap().entrySet()) {
EjbRef ejbRef = entry.getValue();
if(ejbRef.getHome() != null) {
// References to only EJB3 beans need to be considered.
// Skip the current on as it is not a reference to an EJB3 bean.
continue;
}
if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
// Only Remote EJB references need to be considered.
// Skip the current one as it is not a remote reference.
continue;
}
//FIXME: ejbRef.getEjbRefType() is null sometimes. Need a different way to figure the type.
if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
// Only references to Session beans need to be considered.
// Skip the current one as it is not a Session bean.
continue;
}
try {
wmInfo.getEjbReferences().put(ejbRef.getEjbRefName(), createEjbReferenceInfo(ejbRef, classLoader));
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// Process env-entries to compute properties
for (Map.Entry<String, EnvEntry> entry : webApp.getEnvEntryMap().entrySet()) {
EnvEntry envEntry = entry.getValue();
wmInfo.getEnvEntries().put(envEntry.getEnvEntryName(), createEnvEntryInfo(envEntry));
}
// Process Servlets
for(Servlet servlet: webApp.getServlet()) {
try {
wmInfo.getServletClasses().add(classLoader.loadClass(servlet.getServletClass()));
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// Process Filters
for(Filter filter: webApp.getFilter()) {
try {
wmInfo.getFilterClasses().add(classLoader.loadClass(filter.getFilterClass()));
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// Process Listeners
for(Listener listener: webApp.getListener()) {
try {
wmInfo.getListenerClasses().add(classLoader.loadClass(listener.getListenerClass()));
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}