private ApplicationInfo getApplicationInfo(EjbContainerUtil ejbUtil) throws NamingException { ApplicationRegistry appRegistry = ejbUtil.getServices().getService(ApplicationRegistry.class); Applications applications = ejbUtil.getServices().getService(Applications.class); String appNamePrefix = (String) initialContext.lookup("java:app/AppName"); Set<String> appNames = appRegistry.getAllApplicationNames(); Set<String> disabledApps = new TreeSet<>(); for (String appName : appNames) { if (appName.startsWith(appNamePrefix)) { Application appDesc = applications.getApplication(appName); if (appDesc != null && !ejbUtil.getDeployment().isAppEnabled(appDesc)) { // skip disabled version of the app disabledApps.add(appName); } else { return ejbUtil.getDeployment().get(appName); } } } // grab the latest one, there is no way to make // sure which one the user is actually enabling, // so use the best case, i.e. upgrade Iterator<String> it = disabledApps.iterator(); String lastDisabledApp = null; while (it.hasNext()) { lastDisabledApp = it.next(); } if (lastDisabledApp != null) { return ejbUtil.getDeployment().get(lastDisabledApp); } throw new NamingException("Application Information Not Found"); }
allAppNames.addAll(appRegistry.getAllApplicationNames()); for (String appName : allAppNames) { ApplicationInfo appInfo = appRegistry.get(appName);
try { if (event.is(EventTypes.SERVER_READY)) { for (String appName : applicationRegistry.getAllApplicationNames()) { ApplicationInfo applicationInfo = applicationRegistry.get(appName); registerIfBatchJobsDirExists(applicationInfo);