use of org.eclipse.jst.server.core.IEnterpriseApplication in project webtools.servertools by eclipse.
the class J2EEUtil method getEnterpriseApplications.
/**
* Returns the enterprise applications that the module is contained within.
*
* @param module a J2EE module
* @param monitor a progress monitor, or <code>null</code> if progress
* reporting and cancellation are not desired
* @return a possibly empty array of enterprise applications
*/
public static IModule[] getEnterpriseApplications(IJ2EEModule module, IProgressMonitor monitor) {
if (shouldUseCache()) {
List<IModule> list = earCache2.get(module);
if (list == null)
return EMPTY_LIST;
return list.toArray(new IModule[list.size()]);
}
List<IModule> list = new ArrayList<IModule>();
IModule[] modules = ServerUtil.getModules(EAR_MODULE);
if (modules != null) {
for (IModule module2 : modules) {
IEnterpriseApplication ear = (IEnterpriseApplication) module2.loadAdapter(IEnterpriseApplication.class, monitor);
if (ear != null) {
IModule[] modules2 = ear.getModules();
if (modules2 != null) {
for (IModule m : modules2) {
if (module.equals(m.loadAdapter(IJ2EEModule.class, monitor)))
list.add(module2);
}
}
}
}
}
return list.toArray(new IModule[list.size()]);
}
Aggregations