private File getTimerServiceShutdownFile() throws Exception { File timerServiceShutdownFile = null; String j2eeAppPath = ConfigBeansUtilities.getLocation(appID); File timerServiceShutdownDirectory = new File(j2eeAppPath + File.separator); if (!timerServiceShutdownDirectory.mkdirs()) { if( logger.isLoggable(Level.FINE) ) { logger.log(Level.FINE, "Failed to create timerServiceShutdownDirectory"); } } timerServiceShutdownFile = new File(j2eeAppPath + File.separator + TIMER_SERVICE_FILE); return timerServiceShutdownFile; }
public static boolean isStandAloneRA(String moduleName){ return ConfigBeansUtilities.getModule(moduleName)!= null; }
public static String getEnabled(String sn, String moduleID) { ApplicationRef appRef = getApplicationRefInServer(sn, moduleID); if (appRef != null) { return appRef.getEnabled(); } else { return null; } }
static RefContainer chooseRefContainer( final Domain domain, final String target, final ConfigBeansUtilities configBeansUtilities) { Config config = domain.getConfigs().getConfigByName(target); if (config != null) { return config; } Server server = configBeansUtilities.getServerNamed(target); if (server != null) { return server; } Cluster cluster = domain.getClusterNamed(target); return cluster; } }
/** Returns the list of system-applications that are referenced from the given server. * A server references an application, if the server has an element named * <application-ref> in it that points to given application. The given server * is a <server> element inside domain. * * @param sn the string denoting name of the server * @return List of system-applications for that server, an empty list in case there is none */ public List<Application> getSystemApplicationsReferencedFrom(String sn) { if (domain == null || sn == null) throw new IllegalArgumentException("Null argument"); List<Application> allApps = getAllDefinedSystemApplications(); if (allApps.isEmpty()) { return allApps; //if there are no sys-apps, none can reference one :) } //allApps now contains ALL the system applications Server s = getServerNamed(sn); List<Application> referencedApps = new ArrayList<Application>(); List<ApplicationRef> appsReferenced = s.getApplicationRef(); for (ApplicationRef ref : appsReferenced) { for (Application app : allApps) { if (ref.getRef().equals(app.getName())) { referencedApps.add(app); } } } return referencedApps; }
if (!Boolean.parseBoolean(ConfigBeansUtilities.getDirectoryDeployed(name))) { report.setMessage(localStrings.getLocalString("redeploy.command.cannot.redeploy","Cannot redeploy this app {0} without specify the operand.", name)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); super.path = (path==null)?new File(ConfigBeansUtilities.getLocation(name)):path; if (super.path == null) {
wmInfo = findWebModuleInJ2eeApp(appsBean, wmID, appRegistry); if (wmInfo == null) { String contextRoot = ConfigBeansUtilities.getContextRoot(wmID); String location = ConfigBeansUtilities.getLocation(wmID); if (contextRoot!=null && location != null) { File docroot = new File(location);
public Application getSystemApplicationReferencedFrom(String sn, String appName) { //returns null in case there is none List<Application> allApps = getSystemApplicationsReferencedFrom(sn); for (Application app : allApps) { if (app.getName().equals(appName)) { return app; } } return null; } public boolean isNamedSystemApplicationReferencedFrom(String appName, String serverName) {
@Override public void initialize(NotDuplicateTargetName constraintAnnotation) { domain = ConfigBeansUtilities.getDomain(); }
/** * Lists the app refs for non-system apps assigned to the specified server * @param sn server name * @return List of ApplicationRef for non-system apps assigned to the specified server */ public static List<ApplicationRef> getApplicationRefsInServer(String sn) { return getApplicationRefsInServer(sn, true); }
public boolean resourceExists(String jndiName, String target) { boolean exists = false; if(target.equals(DOMAIN)){ //if target is "domain", as long as the resource is present in "resources" section, //it is valid. exists = true; }else if(ConfigBeansUtilities.getServerNamed(target) != null){ Server server = configBeanUtilities.getServerNamed(target); exists = server.isResourceRefExists(jndiName); }else if (domain.getClusterNamed(target) != null){ Cluster cluster = domain.getClusterNamed(target); exists = cluster.isResourceRefExists(jndiName); }else{ //if target is "CONFIG", as long as the resource is present in "resources" section, //it is valid. for(Config config : domain.getConfigs().getConfig()){ if(config.getName().equals(target)){ exists = true; break; } } } return exists; }
/** Returns the list of system-applications that are referenced from the given server. * A server references an application, if the server has an element named * <application-ref> in it that points to given application. The given server * is a <server> element inside domain. * * @param sn the string denoting name of the server * @return List of system-applications for that server, an empty list in case there is none */ public static List<Application> getSystemApplicationsReferencedFrom(String sn) { if (domain == null || sn == null) throw new IllegalArgumentException("Null argument"); List<Application> allApps = getAllDefinedSystemApplications(); if (allApps.isEmpty()) { return allApps; //if there are no sys-apps, none can reference one :) } //allApps now contains ALL the system applications Server s = getServerNamed(sn); List<Application> referencedApps = new ArrayList<Application>(); List<ApplicationRef> appsReferenced = s.getApplicationRef(); for (ApplicationRef ref : appsReferenced) { for (Application app : allApps) { if (ref.getRef().equals(app.getName())) { referencedApps.add(app); } } } return referencedApps; }
public boolean isNamedSystemApplicationReferencedFrom(String appName, String serverName) { List <Application> referencedApps = getSystemApplicationsReferencedFrom(serverName); for (Application app : referencedApps) { if (app.getName().equals(appName)) return true; } return false; }
@Override public void initialize(NotDuplicateTargetName constraintAnnotation) { ServiceLocator locator = ServiceLocatorFactory.getInstance().find("default"); if (locator == null) return; ConfigBeansUtilities cbu = locator.getService(ConfigBeansUtilities.class); if (cbu == null) return; domain = cbu.getDomain(); }
/** * Lists the app refs for non-system apps assigned to the specified server * @param sn server name * @return List of ApplicationRef for non-system apps assigned to the specified server */ public List<ApplicationRef> getApplicationRefsInServer(String sn) { return getApplicationRefsInServer(sn, true); }
public boolean resourceExists(String jndiName, String target) { boolean exists = false; Domain domain = habitat.getService(Domain.class); if(target.equals(DOMAIN)){ //if target is "domain", as long as the resource is present in "resources" section, //it is valid. exists = true; }else if(habitat.<ConfigBeansUtilities>getService(ConfigBeansUtilities.class).getServerNamed(target) != null){ Server server = habitat.<ConfigBeansUtilities>getService(ConfigBeansUtilities.class).getServerNamed(target); exists = server.isResourceRefExists(jndiName); }else if (domain.getClusterNamed(target) != null){ Cluster cluster = domain.getClusterNamed(target); exists = cluster.isResourceRefExists(jndiName); }else{ //if target is "CONFIG", as long as the resource is present in "resources" section, //it is valid. for(Config config : domain.getConfigs().getConfig()){ if(config.getName().equals(target)){ exists = true; break; } } } return exists; }
location = ConnectorsUtil.getSystemModuleLocation(moduleName); }else{ location = ConfigBeansUtilities.getLocation(moduleName); if(location == null){ location = ConfigBeansUtilities.getLocation(appName); if(location != null){ location = location + File.separator + rarName + "_rar";
public String getContextRoot(String moduleID) { ApplicationName module = getModule(moduleID); if (module == null) { return null; } if (module instanceof Application) { return ((Application)module).getContextRoot(); } else { return null; } }
public static boolean isNamedSystemApplicationReferencedFrom(String appName, String serverName) { List <Application> referencedApps = getSystemApplicationsReferencedFrom(serverName); for (Application app : referencedApps) { if (app.getName().equals(appName)) return true; } return false; }
public String getEnabled(String sn, String moduleID) { ApplicationRef appRef = getApplicationRefInServer(sn, moduleID); if (appRef != null) { return appRef.getEnabled(); } else { return null; } }