use of com.sun.enterprise.config.serverbeans.Application in project Payara by payara.
the class ApplicationConfigListener method enableApplication.
private void enableApplication(String appName) {
Application app = applications.getApplication(appName);
ApplicationRef appRef = domain.getApplicationRefInServer(server.getName(), appName);
// by the current server instance, do not load
if (app == null || appRef == null) {
return;
}
// if the application is not in enable state, do not load
if (!deployment.isAppEnabled(app)) {
return;
}
ApplicationInfo appInfo = appRegistry.get(appName);
if (appInfo == null || appInfo.isLoaded()) {
return;
}
long operationStartTime = Calendar.getInstance().getTimeInMillis();
try {
ActionReport report = new HTMLActionReporter();
deployment.enable(server.getName(), app, appRef, report, logger);
if (report.getActionExitCode().equals(ActionReport.ExitCode.SUCCESS)) {
logger.log(Level.INFO, KernelLoggerInfo.loadingApplicationTime, new Object[] { appName, (Calendar.getInstance().getTimeInMillis() - operationStartTime) });
} else if (report.getActionExitCode().equals(ActionReport.ExitCode.WARNING)) {
logger.log(Level.WARNING, KernelLoggerInfo.loadingApplicationWarning, new Object[] { appName, report.getMessage() });
} else if (report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
throw new Exception(report.getMessage());
}
} catch (Exception e) {
logger.log(Level.SEVERE, KernelLoggerInfo.loadingApplicationErrorEnable, e);
throw new RuntimeException(e);
}
}
use of com.sun.enterprise.config.serverbeans.Application in project Payara by payara.
the class ContainerExtensionTest method applicationExtensionTest.
@Test
public void applicationExtensionTest() {
Application a = habitat.getService(Application.class);
List<AnApplicationExtension> taes = a.getExtensionsByType(AnApplicationExtension.class);
assertEquals(taes.size(), 2);
}
use of com.sun.enterprise.config.serverbeans.Application in project Payara by payara.
the class CollectionsAccessTest method semiProtectedTest.
@Test(expected = TransactionFailure.class)
public void semiProtectedTest() throws TransactionFailure {
final Applications apps = getHabitat().getService(Applications.class);
assertTrue(apps != null);
ConfigSupport.apply(new SingleConfigCode<Applications>() {
public Object run(Applications param) throws PropertyVetoException, TransactionFailure {
// this is the bug, we should not get the list from apps but from param.
List<ApplicationName> modules = apps.getModules();
Application m = param.createChild(Application.class);
// should throw an exception
modules.add(m);
return m;
}
}, apps);
}
use of com.sun.enterprise.config.serverbeans.Application in project Payara by payara.
the class CollectionsAccessTest method protectedTest.
@Test
public void protectedTest() throws TransactionFailure {
final Applications apps = getHabitat().getService(Applications.class);
assertTrue(apps != null);
ConfigSupport.apply(new SingleConfigCode<Applications>() {
public Object run(Applications param) throws PropertyVetoException, TransactionFailure {
List<ApplicationName> modules = param.getModules();
Application m = param.createChild(Application.class);
m.setName("ejb-test");
m.setLocation("test-location");
m.setObjectType("ejb");
modules.add(m);
modules.remove(m);
return m;
}
}, apps);
}
Aggregations