use of com.sun.enterprise.config.serverbeans.Application in project Payara by payara.
the class ListLifecycleModulesCommand method execute.
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
ActionReport.MessagePart part = report.getTopMessagePart();
boolean found = false;
for (Application app : domain.getApplicationsInTarget(target)) {
if (app.isLifecycleModule()) {
ActionReport.MessagePart childPart = part.addChild();
childPart.setMessage(app.getName());
found = true;
}
}
if (!found && !terse) {
part.setMessage(localStrings.getLocalString("list.components.no.elements.to.list", "Nothing to List."));
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
use of com.sun.enterprise.config.serverbeans.Application in project Payara by payara.
the class ApplicationConfigListener method handleOtherAppConfigChanges.
private void handleOtherAppConfigChanges(Object parent, String appName) {
Application application = applications.getApplication(appName);
if (application.isLifecycleModule()) {
return;
}
// config changes if the application is in enabled state
if (isCurrentInstanceMatchingTarget(parent) && deployment.isAppEnabled(application)) {
disableApplication(appName);
enableApplication(appName);
}
}
use of com.sun.enterprise.config.serverbeans.Application in project Payara by payara.
the class ApplicationConfigListener method disableApplication.
private void disableApplication(String appName) {
Application app = applications.getApplication(appName);
ApplicationRef appRef = domain.getApplicationRefInServer(server.getName(), appName);
// by the current server instance, do not unload
if (app == null || appRef == null) {
return;
}
ApplicationInfo appInfo = appRegistry.get(appName);
if (appInfo == null || !appInfo.isLoaded()) {
return;
}
try {
ActionReport report = new HTMLActionReporter();
UndeployCommandParameters commandParams = new UndeployCommandParameters();
commandParams.name = appName;
commandParams.target = server.getName();
commandParams.origin = UndeployCommandParameters.Origin.unload;
commandParams.command = UndeployCommandParameters.Command.disable;
deployment.disable(commandParams, app, appInfo, report, logger);
if (report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
throw new Exception(report.getMessage());
}
} catch (Exception e) {
logger.log(Level.SEVERE, KernelLoggerInfo.loadingApplicationErrorDisable, e);
throw new RuntimeException(e);
}
}
use of com.sun.enterprise.config.serverbeans.Application 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;
}
use of com.sun.enterprise.config.serverbeans.Application 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());
}
}
}
Aggregations