Search in sources :

Example 6 with ApplicationName

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

the class ConfigBeansUtilities method getApplicationRefsInServer.

/**
 * Lists the app refs for apps assigned to the specified server, excluding
 * system apps from the result if requested.
 * @param sn server name to check
 * @param excludeSystemApps whether system apps should be excluded
 * @return List of ApplicationRef for apps assigned to the specified server
 */
public List<ApplicationRef> getApplicationRefsInServer(String sn, boolean excludeSystemApps) {
    Servers ss = domain.getServers();
    List<Server> list = ss.getServer();
    Server theServer = null;
    for (Server s : list) {
        if (s.getName().equals(sn)) {
            theServer = s;
            break;
        }
    }
    if (theServer != null) {
        List<ApplicationName> modulesToExclude = excludeSystemApps ? domain.getSystemApplications().getModules() : Collections.<ApplicationName>emptyList();
        List<ApplicationRef> result = new ArrayList<ApplicationRef>();
        for (ApplicationRef candidateRef : theServer.getApplicationRef()) {
            String appRefModuleName = candidateRef.getRef();
            boolean isSystem = false;
            for (ApplicationName sysModule : modulesToExclude) {
                if (sysModule.getName().equals(appRefModuleName)) {
                    isSystem = true;
                    break;
                }
            }
            if (!isSystem) {
                result.add(candidateRef);
            }
        }
        return result;
    } else {
        return Collections.<ApplicationRef>emptyList();
    }
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName) ArrayList(java.util.ArrayList)

Example 7 with ApplicationName

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

the class ModulesTest method modulesTest.

@Test
public void modulesTest() {
    for (ApplicationName module : modules) {
        logger.fine("Found module " + module.getName());
        assertTrue(module.getName() != null);
    }
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName) Test(org.junit.Test)

Example 8 with ApplicationName

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

the class ApplicationsTest method getModulesTest.

@Test
public void getModulesTest() {
    Applications apps = getHabitat().getService(Applications.class);
    List<ApplicationName> modules = apps.getModules();
    for (ApplicationName module : modules) {
        logger.fine("Module = " + module.getName());
    }
    assertTrue(modules != null);
}
Also used : ApplicationName(org.glassfish.api.admin.config.ApplicationName) Test(org.junit.Test)

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