public void undeploy(OpsParams params, ExtendedDeploymentContext context) { String appName = params.name(); postUndeploy(appName, context); }
public List<URI> getAppLibs() throws URISyntaxException { List<URI> libURIs = new ArrayList<URI>(); if (parameters.libraries() != null) { URL[] urls = ASClassLoaderUtil.getDeployParamLibrariesAsURLs( parameters.libraries(), env); for (URL url : urls) { libURIs.add(url.toURI()); } } Set<String> extensionList = null; try{ extensionList = InstalledLibrariesResolver.getInstalledLibraries(source); }catch(IOException ioe){ throw new RuntimeException(ioe); } URL[] extensionListLibraries = ASClassLoaderUtil.getLibrariesAsURLs(extensionList, env); for (URL url : extensionListLibraries) { libURIs.add(url.toURI()); if(logger.isLoggable(Level.FINEST)){ logger.log(Level.FINEST, "Detected [EXTENSION_LIST]" + " installed-library [ " + url + " ] for archive [ "+source.getName()+ "]"); } } return libURIs; }
public File getAppInternalDir() { final File internalDir = new File(env.getApplicationRepositoryPath(), INTERNAL_DIR_NAME); return new File(internalDir, VersioningUtils.getRepositoryName(parameters.name())); }
@Override public void unload(DummyApplication container, DeploymentContext context) { OpsParams params = context.getCommandParameters(OpsParams.class); cleanSecurityContext(params.name()); }
/** * Returns a scratch directory that can be used to store things in. * The scratch directory will be persisted accross server restart but * not accross redeployment of the same application * * @param subDirName the sub directory name of the scratch dir * @return the scratch directory for this application based on * passed in subDirName. Returns the root scratch dir if the * passed in value is null. */ public File getScratchDir(String subDirName) { File rootScratchDir = env.getApplicationStubPath(); if (subDirName != null ) rootScratchDir = new File(rootScratchDir, subDirName); String appDirName = VersioningUtils.getRepositoryName(parameters.name()); return new File(rootScratchDir, appDirName); }
@Override public void unload(DummyApplication container, DeploymentContext context) { OpsParams params = context.getCommandParameters(OpsParams.class); cleanSecurityContext(params.name()); }
public void createApplicationClassLoader(ClassLoaderHierarchy clh, ArchiveHandler handler) throws URISyntaxException, MalformedURLException { this.addTransientAppMetaData(ExtendedDeploymentContext.IS_TEMP_CLASSLOADER, Boolean.FALSE); this.cloader = createClassLoader(clh, handler, parameters.name()); }
private static ResourceInfo getResourceInfo(DeploymentContext ctx, String dataSourceName) { ResourceInfo resourceInfo; if(dataSourceName.startsWith("java:app") /* || jndiName.startsWith("java:module") // Use of module scoped resources from JPA still needs to be speced out*/){ String applicationName = ctx.getCommandParameters(OpsParams.class).name(); resourceInfo = new ResourceInfo(dataSourceName, applicationName); }else{ resourceInfo = new ResourceInfo(dataSourceName); } return resourceInfo; } }
public static void removeRoleMapper(DeploymentContext dc) { OpsParams params = dc.getCommandParameters(OpsParams.class); if (params.origin != OpsParams.Origin.undeploy) { return; } String appName = params.name(); SecurityRoleMapperFactory factory = SecurityRoleMapperFactoryGen.getSecurityRoleMapperFactory(); if (factory == null) { throw new IllegalArgumentException("This application has no role mapper factory defined"); } factory.removeRoleMapper(appName); } }
public static void removeRoleMapper(DeploymentContext dc) { OpsParams params = dc.getCommandParameters(OpsParams.class); if (params.origin != OpsParams.Origin.undeploy) { return; } String appName = params.name(); SecurityRoleMapperFactory factory = getRoleMapperFactory(); factory.removeRoleMapper(appName); }
public void run() { if (phase.equals(ExtendedDeploymentContext.Phase.REPLICATION)) { OpsParams params = context.getCommandParameters(OpsParams.class); if (params.origin == OpsParams.Origin.deploy) { String appName = params.name(); serviceOrchestratorImpl.postDeploy(appName, context); } //make sure it is indeed undeploy and not disable. //params.origin is "undeploy" for both "undeploy" as well "disable" phase //hence using the actual command issued to confirm. if (params.origin == OpsParams.Origin.undeploy) { if (params.command == OpsParams.Command.undeploy) { serviceOrchestratorImpl.undeploy(params, context); } } //we get only after-CLEAN-unload-disable event. //we expect after-STOP-unload-disable, but since the target is not "DAS", //DAS will not receive such event. String appName = params.name(); if (params.origin == OpsParams.Origin.unload) { if (params.command == OpsParams.Command.disable) { if (isValidApplication(appName)) { serviceOrchestratorImpl.disable(appName, context); } } } } } });
/** * Clean any files and artifacts that were created during the execution * of the prepare method. * * @param context deployment context */ public void clean(DeploymentContext context) { if (undeploymentVisitor!=null) { String appName = context.getCommandParameters(OpsParams.class).name(); Application app = getApplicationFromApplicationInfo(appName); if (app != null) { context.addModuleMetaData(app); undeploymentVisitor.accept(app); } } }
@Override protected void cleanArtifacts(DeploymentContext dc) throws DeploymentException { removePolicy(dc); SecurityUtil.removeRoleMapper(dc); OpsParams params = dc.getCommandParameters(OpsParams.class); if (this.appCnonceMap != null) { CNonceCache cache = appCnonceMap.remove(params.name()); if (cache != null) { cache.destroy(); } } }
public void run() { if (phase.equals(ExtendedDeploymentContext.Phase.PREPARE)) { OpsParams params = context.getCommandParameters(OpsParams.class); String appName = params.name(); if (params.origin == OpsParams.Origin.deploy) { serviceOrchestratorImpl.preDeploy(appName, context); } else if (params.origin == OpsParams.Origin.load) { if (params.command == OpsParams.Command.startup_server) { if (isValidApplication(appName)) { serviceOrchestratorImpl.startup(appName, context); } } else { if (params.command == OpsParams.Command.enable) { if (isValidApplication(appName)) { serviceOrchestratorImpl.enable(appName, context); } } } } } else if (phase.equals(ExtendedDeploymentContext.Phase.STOP)) { OpsParams params = context.getCommandParameters(OpsParams.class); String appName = params.name(); if (params.origin == OpsParams.Origin.undeploy) { if (params.command == OpsParams.Command.disable) { serviceOrchestratorImpl.preUndeploy(appName, context); } } } } });
@Override protected void generateArtifacts(DeploymentContext dc) throws DeploymentException { OpsParams params = dc.getCommandParameters(OpsParams.class); if (params.origin != OpsParams.Origin.deploy) { return; } String appName = params.name(); try { Application app = dc.getModuleMetaData(Application.class); Set<WebBundleDescriptor> webDesc = app.getWebBundleDescriptors(); if (webDesc == null) { return; } for (WebBundleDescriptor webBD : webDesc) { loadPolicy(webBD, false); } } catch (Exception se) { String msg = "Error in generating security policy for " + appName; throw new DeploymentException(msg, se); } }
String uniqueAppId = appProps.getProperty(APP_UNIQUE_ID_PROP); try { if (getTimeoutStatusFromApplicationInfo(params.name()) && uniqueAppId != null) { String target = ((params.origin.isDeploy())? dc.getCommandParameters(DeployCommandParameters.class).target : List<String> targets = (List<String>)dc.getTransientAppMetaData(DeploymentProperties.PREVIOUS_TARGETS, List.class); if (targets == null) { targets = domain.getAllReferencedTargetsForApplication(params.name()); uniqueAppId + " will not be deleted"); } else { if (getKeepStateFromApplicationInfo(params.name())) { _logger.log(Level.INFO, "Timers will not be destroyed since keepstate is true for application {0}", params.name()); } else { timerService.destroyAllTimers(Long.parseLong(uniqueAppId)); String appName = params.name(); String[] contextIds = ejbSecManagerFactory.getContextsForApp(appName, false);
String uniqueAppId = appProps.getProperty(APP_UNIQUE_ID_PROP); try { if (getTimeoutStatusFromApplicationInfo(params.name()) && uniqueAppId != null) { String target = ((params.origin.isDeploy())? dc.getCommandParameters(DeployCommandParameters.class).target : List<String> targets = (List<String>)dc.getTransientAppMetaData(DeploymentProperties.PREVIOUS_TARGETS, List.class); if (targets == null) { targets = domain.getAllReferencedTargetsForApplication(params.name()); uniqueAppId + " will not be deleted"); } else { if (getKeepStateFromApplicationInfo(params.name())) { _logger.log(Level.INFO, "Timers will not be destroyed since keepstate is true for application {0}", params.name()); } else { timerService.destroyAllTimers(Long.parseLong(uniqueAppId)); String appName = params.name(); String[] contextIds = ejbSecManagerFactory.getContextsForApp(appName, false);
String repositoryBitName = copy.params().name(); try { repositoryBitName = VersioningUtils.getRepositoryName(repositoryBitName);