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();
}
}
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);
}
}
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);
}
Aggregations