protected UndeployCommandParameters getUndeployParams( OSGiApplicationInfo osgiAppInfo) { UndeployCommandParameters parameters = new UndeployCommandParameters(); parameters.name = osgiAppInfo.getAppInfo().getName(); parameters.origin = DeployCommandParameters.Origin.undeploy; return parameters; }
/** * preserve the old application's resources so that they can be registered during deploy. * @param dc DeploymentContext * @param undeployCommandParameters undeploy command parameters */ private void preserveResources(DeploymentContext dc, UndeployCommandParameters undeployCommandParameters) { try{ if (undeployCommandParameters.origin == OpsParams.Origin.undeploy) { Properties properties = undeployCommandParameters.properties; if(properties != null){ String preserve = properties.getProperty(DeploymentProperties.PRESERVE_APP_SCOPED_RESOURCES); if(preserve != null && Boolean.valueOf(preserve)){ debug("Preserve app scoped resources enabled"); final UndeployCommandParameters commandParams = dc.getCommandParameters(UndeployCommandParameters.class); String appName = commandParams.name(); Application app = applications.getApplication(appName); preserveResources(app); //store application info (for module information ie., sniffer type) preservedApps.put(appName, app); } } } }catch(Exception e){ // only DeploymentExceptions are propagated and result in deployment failure // in the event notification infrastructure throw new DeploymentException(e.getMessage(), e); } }
protected UndeployCommandParameters getUndeployParams( OSGiApplicationInfo osgiAppInfo) { UndeployCommandParameters parameters = new UndeployCommandParameters(); parameters.name = osgiAppInfo.getAppInfo().getName(); parameters.origin = DeployCommandParameters.Origin.undeploy; return parameters; }
/** * preserve the old application's resources so that they can be registered during deploy. * @param dc DeploymentContext * @param undeployCommandParameters undeploy command parameters */ private void preserveResources(DeploymentContext dc, UndeployCommandParameters undeployCommandParameters) { try{ if (undeployCommandParameters.origin == OpsParams.Origin.undeploy) { Properties properties = undeployCommandParameters.properties; if(properties != null){ String preserve = properties.getProperty(DeploymentProperties.PRESERVE_APP_SCOPED_RESOURCES); if(preserve != null && Boolean.valueOf(preserve)){ debug("Preserve app scoped resources enabled"); final UndeployCommandParameters commandParams = dc.getCommandParameters(UndeployCommandParameters.class); String appName = commandParams.name(); Application app = applications.getApplication(appName); preserveResources(app); //store application info (for module information ie., sniffer type) preservedApps.put(appName, app); } } } }catch(Exception e){ // only DeploymentExceptions are propagated and result in deployment failure // in the event notification infrastructure throw new DeploymentException(e.getMessage(), e); } }
private void stopApplication(Application app, ApplicationInfo appInfo) { final ActionReport dummy = new HTMLActionReporter(); if (appInfo!=null) { UndeployCommandParameters parameters = new UndeployCommandParameters(appInfo.getName()); parameters.origin = UndeployCommandParameters.Origin.unload; parameters.command = UndeployCommandParameters.Command.shutdown_server; try { deployment.disable(parameters, app, appInfo, dummy, logger); } catch (Exception e) { logger.log(Level.SEVERE, KernelLoggerInfo.loadingApplicationErrorDisable, e); } unloadApplicationForTenants(app, dummy); appRegistry.remove(appInfo.getName()); } }
private void cleanupPreservedResources(DeploymentContext dc, Event event) { if (Deployment.DEPLOYMENT_FAILURE.equals(event.type())) { final DeployCommandParameters deployCommandParameters = dc.getCommandParameters(DeployCommandParameters.class); if (deployCommandParameters.origin == OpsParams.Origin.deploy || deployCommandParameters.origin == OpsParams.Origin.deploy_instance || deployCommandParameters.origin == OpsParams.Origin.create_application_ref) { Properties properties = deployCommandParameters.properties; String appName = deployCommandParameters.name(); cleanupPreservedResources(appName, properties); } } else if (Deployment.UNDEPLOYMENT_FAILURE.equals(event.type())) { final UndeployCommandParameters undeployCommandParameters = dc.getCommandParameters(UndeployCommandParameters.class); if (undeployCommandParameters.origin == OpsParams.Origin.undeploy) { Properties properties = undeployCommandParameters.properties; String appName = undeployCommandParameters.name(); cleanupPreservedResources(appName, properties); } } }
ActionReport report = new HTMLActionReporter(); UndeployCommandParameters commandParams = new UndeployCommandParameters(); commandParams.name = appName; commandParams.target = server.getName();
private void cleanupPreservedResources(DeploymentContext dc, Event event) { if (Deployment.DEPLOYMENT_FAILURE.equals(event.type())) { final DeployCommandParameters deployCommandParameters = dc.getCommandParameters(DeployCommandParameters.class); if (deployCommandParameters.origin == OpsParams.Origin.deploy || deployCommandParameters.origin == OpsParams.Origin.deploy_instance || deployCommandParameters.origin == OpsParams.Origin.create_application_ref) { Properties properties = deployCommandParameters.properties; String appName = deployCommandParameters.name(); cleanupPreservedResources(appName, properties); } } else if (Deployment.UNDEPLOYMENT_FAILURE.equals(event.type())) { final UndeployCommandParameters undeployCommandParameters = dc.getCommandParameters(UndeployCommandParameters.class); if (undeployCommandParameters.origin == OpsParams.Origin.undeploy) { Properties properties = undeployCommandParameters.properties; String appName = undeployCommandParameters.name(); cleanupPreservedResources(appName, properties); } } }
params = new UndeployCommandParameters(name);
UndeployCommandParameters parameters = new UndeployCommandParameters(); parameters.name = DeploymentUtils.getInternalNameForTenant(app.getName(), tenant.getTenant()); parameters.origin = UndeployCommandParameters.Origin.unload;