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"); }
public String getEnabled(String sn, String moduleID) { ApplicationRef appRef = getApplicationRefInServer(sn, moduleID); if (appRef != null) { return appRef.getEnabled(); } else { return null; } }
public PropertyResolver(Domain domain, String instanceName) { _domain = domain; _server = _domain.getServerNamed(instanceName); if (_server != null) { _config = _domain.getConfigNamed(_server.getConfigRef()); } else { _config = _domain.getConfigNamed(instanceName); } _cluster = _domain.getClusterForInstance(instanceName); }
/** * Returns config element that represents a given server * @param targetName the name of the target * @return Config element representing the server instance */ public Config getServerConfig(String targetName) { Server s = domain.getServerNamed(targetName); if(s == null) return null; return domain.getConfigNamed(s.getConfigRef()); }
private Config getConfigForName(String name) { if (domain.getConfigNamed(name) != null) return domain.getConfigNamed(name); if (domain.getServerNamed(name) != null) return domain.getServerNamed(name).getConfig(); return null; } }
public boolean isAppEnabled(Application app) { if (Boolean.valueOf(app.getEnabled())) { ApplicationRef appRef = server.getApplicationRef(app.getName()); if (appRef != null && Boolean.valueOf(appRef.getEnabled())) { return true; } } return false; }
public static Cluster getClusterNamed(Domain d, String name) { if (d.getClusters() == null || name == null) { return null; } List<Cluster> clusters = d.getClusters().getCluster(); for (Cluster c : clusters) { if (name.equals(c.getName().trim())) { return c; } } return null; }
public static boolean isAppReferencedByPaaSTarget(Domain me, String appName) { List<String> referencedTargets = me.getAllReferencedTargetsForApplication(appName); for (String target : referencedTargets) { Cluster cluster = me.getClusterNamed(target); if (cluster != null) { if (cluster.isVirtual()) { return true; } } } return false; }
public static Cluster getClusterForInstance(Domain d,String instanceName){ List<Cluster> clusterList = d.getClusters().getCluster(); for (Cluster cluster:clusterList) { List<ServerRef> serverRefs =cluster.getServerRef(); for (ServerRef serverRef:serverRefs){ if (serverRef.getRef().equals(instanceName)) { return cluster; } } } return null; }
private boolean isServerRunning(String serverName) { Server server = domain.getServerNamed(serverName); return (server == null) ? false : server.isRunning(); }
private boolean isResourceExists(String jndiName) { //resource-ref is created only for a BindableResource return domain.getResources().getResourceByName(BindableResource.class, jndiName) != null; } }
public Resources getResources(String applicationName){ Application app = applications.getApplication(applicationName); if(app != null){ return app.getResources(); } return null; }
public static String getEnabledForApplication(Domain d, String target, String appName) { ApplicationRef appRef = d.getApplicationRefInTarget( appName, target); if (appRef != null) { return appRef.getEnabled(); } else { return null; } }
public String getVirtualServers(String sn, String moduleID) { ApplicationRef appRef = getApplicationRefInServer(sn, moduleID); if (appRef != null) { return appRef.getVirtualServers(); } else { return null; } }
public static String getVirtualServersForApplication(Domain d, String target, String appName) { ApplicationRef appRef = d.getApplicationRefInTarget( appName, target); if (appRef != null) { return appRef.getVirtualServers(); } else { return null; } }
public static String getContextRoot(String moduleID) { ApplicationName module = getModule(moduleID); if (module == null) { return null; } if (module instanceof Application) { return ((Application)module).getContextRoot(); } else if (module instanceof WebModule) { return ((WebModule)module).getContextRoot(); } else { return null; } }
public static String getEnabledForApplication(Domain d, String target, String appName) { ApplicationRef appRef = d.getApplicationRefInTarget( appName, target); if (appRef != null) { return appRef.getEnabled(); } else { return null; } }
public static String getEnabled(String sn, String moduleID) { ApplicationRef appRef = getApplicationRefInServer(sn, moduleID); if (appRef != null) { return appRef.getEnabled(); } else { return null; } }
public static String getVirtualServers(String sn, String moduleID) { ApplicationRef appRef = getApplicationRefInServer(sn, moduleID); if (appRef != null) { return appRef.getVirtualServers(); } else { return null; } }