Search in sources :

Example 1 with ApplicationName

use of org.glassfish.api.admin.config.ApplicationName in project Payara by payara.

the class DynamicReloader method chooseAppsToReload.

private synchronized List<AppReloadInfo> chooseAppsToReload() throws URISyntaxException {
    List<AppReloadInfo> result = new ArrayList<AppReloadInfo>();
    /*
         * The collectionof AppReloadInfo might not contain entries for all
         * current apps (for example, if an app has been deployed since the
         * previous run of the reloader).  Use the current list of all known
         * apps, and for each of those try to find an AppReloadInfo entry for
         * it.
         */
    Set<AppReloadInfo> possiblyUndeployedApps = new HashSet<AppReloadInfo>(appReloadInfo.values());
    for (ApplicationName m : applications.getModules()) {
        if (m instanceof Application) {
            Application app = (Application) m;
            if (app.getLocation() == null || Boolean.valueOf(app.getDeployProperties().getProperty(ServerTags.IS_LIFECYCLE))) {
                // skip lifecycle modules
                continue;
            }
            AppReloadInfo reloadInfo = findOrCreateAppReloadInfo(app);
            if (reloadInfo.needsReload()) {
                logger.fine("[Reloader] Selecting app " + reloadInfo.getApplication().getName() + " to reload");
                result.add(reloadInfo);
            }
            possiblyUndeployedApps.remove(reloadInfo);
        }
    }
    /*
         * Remove any apps from the reload info that are no longer present.
         */
    for (AppReloadInfo info : possiblyUndeployedApps) {
        logger.fine("[Reloader] Removing undeployed app " + info.getApplication().getName() + " from reload info");
        appReloadInfo.remove(info.getApplication().getName());
    }
    return result;
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName) ArrayList(java.util.ArrayList) Application(com.sun.enterprise.config.serverbeans.Application) HashSet(java.util.HashSet)

Example 2 with ApplicationName

use of org.glassfish.api.admin.config.ApplicationName in project Payara by payara.

the class DynamicReloader method initAppReloadInfo.

/**
 * Records reload information about the currently-known applications.
 *
 * @param applications
 */
private synchronized void initAppReloadInfo(Applications applications) throws URISyntaxException {
    appReloadInfo = new HashMap<String, AppReloadInfo>();
    logger.fine("[Reloader] Preparing list of apps to monitor:");
    for (ApplicationName m : applications.getModules()) {
        if (m instanceof Application) {
            Application app = (Application) m;
            if (Boolean.valueOf(app.getDeployProperties().getProperty(ServerTags.IS_LIFECYCLE))) {
                // skip lifecycle modules
                continue;
            }
            AppReloadInfo info = new AppReloadInfo(app);
            appReloadInfo.put(app.getName(), info);
            logger.fine("[Reloader] Monitoring " + app.getName() + " at " + app.getLocation());
        }
    }
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName) Application(com.sun.enterprise.config.serverbeans.Application)

Example 3 with ApplicationName

use of org.glassfish.api.admin.config.ApplicationName in project Payara by payara.

the class ConfigBeansUtilities method getAllDefinedSystemApplications.

public List<Application> getAllDefinedSystemApplications() {
    List<Application> allSysApps = new ArrayList<Application>();
    SystemApplications sa = domain.getSystemApplications();
    if (sa != null) {
        for (ApplicationName m : sa.getModules()) {
            if (m instanceof Application)
                allSysApps.add((Application) m);
        }
    }
    return allSysApps;
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName) ArrayList(java.util.ArrayList)

Example 4 with ApplicationName

use of org.glassfish.api.admin.config.ApplicationName in project Payara by payara.

the class ConfigBeansUtilities method getLocation.

public String getLocation(String moduleID) {
    ApplicationName module = getModule(moduleID);
    if (module == null) {
        return null;
    }
    String location = null;
    if (module instanceof Application) {
        location = ((Application) module).getLocation();
    }
    try {
        if (location != null) {
            return new URI(location).getPath();
        } else {
            return null;
        }
    } catch (URISyntaxException e) {
        return null;
    }
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 5 with ApplicationName

use of org.glassfish.api.admin.config.ApplicationName in project Payara by payara.

the class ConnectorsUtil method isStandAloneRA.

public static boolean isStandAloneRA(String moduleName) {
    ConfigBeansUtilities cbu = getConfigBeansUtilities();
    ApplicationName an = null;
    if (cbu != null) {
        an = cbu.getModule(moduleName);
    }
    return (an != null);
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName)

Aggregations

ApplicationName (org.glassfish.api.admin.config.ApplicationName)8 ArrayList (java.util.ArrayList)3 Application (com.sun.enterprise.config.serverbeans.Application)2 Test (org.junit.Test)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 HashSet (java.util.HashSet)1