private void failsafeStop(DeploymentAspect aspect, Deployment dep) { try { logInvocation(aspect, "Stop"); aspect.stop(dep); } catch (RuntimeException rte) { WSFDeploymentException.rethrow(rte); } }
public void setDeploymentAspects(List<DeploymentAspect> aspects) { depAspects.clear(); depAspects.addAll(aspects); if (log.isTraceEnabled()) { // Debug the aspect list StringBuilder builder = new StringBuilder("setDeploymentAspects on " + name); for (DeploymentAspect aspect : aspects) builder.append("\n " + aspect.getClass().getName() + " provides: " + aspect.getProvidesAsSet() + " requires: " + aspect.getRequiresAsSet()); log.trace(builder); } }
private DeploymentAspect getLastAspect(final List<DeploymentAspect> aspects) { final Iterator<DeploymentAspect> i = aspects.iterator(); DeploymentAspect aspect; while (i.hasNext()) { aspect = i.next(); if (aspect.isLast()) { i.remove(); return aspect; } } throw Messages.MESSAGES.noDeploymentAspectFoundWithAttributeLast(); }
private void throwSortException(List<DeploymentAspect> sortedAspects, List<DeploymentAspect> allAspects) { Set<String> providedConditions = new HashSet<String>(); for (int i = 0; i < sortedAspects.size(); i++) { DeploymentAspect sortedAspect = sortedAspects.get(i); providedConditions.addAll(sortedAspect.getProvidesAsSet()); } String exmsg = "Cannot add deployment aspect(s)"; StringBuilder str = new StringBuilder(exmsg); if (manager.getParent() != null) str.append("\n" + manager.getParent().getName() + " provides: " + parentProvidedConditions); str.append("\n" + manager.getName() + " provides: " + providedConditions); for (DeploymentAspect da : allAspects) { str.append("\n " + da.getClass().getName() + ", requires: " + da.getRequires()); } log.error(str); throw new IllegalStateException(str.toString()); }
if (aspect.isLast()) final Set<String> inputs = aspect.getRequiresAsSet(); for (String input : inputs) if (!aspect.isLast()) final Set<String> outputs = aspect.getProvidesAsSet(); for (String output : outputs) this.setRelativeOrder(aspect.getRelativeOrder()); this.aspect = aspect;
@Override public void undeploy(final DeploymentUnit unit) { if (isWebServiceDeployment(unit)) { final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY); if (aspect.canHandle(dep)) { ROOT_LOGGER.aspectStop(aspect, unit.getName()); ClassLoader origClassLoader = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(aspect.getLoader()); aspect.stop(dep); } finally { SecurityActions.setContextClassLoader(origClassLoader); } } } }
/** * If deployed unit is related to web services this method delegates * to deployment aspect and calls its create() and start() methods. * * @param unit deployment unit * @throws DeploymentException on deployment failure */ @Override protected void internalDeploy(final DeploymentUnit unit) throws DeploymentException { if (ASHelper.isWebServiceDeployment(unit)) { this.log.debug(this.aspect + " start: " + unit.getName()); final Deployment dep = ASHelper.getRequiredAttachment(unit, Deployment.class); if (this.aspect.canHandle(dep)) { //set the context classloader using the proper one from the deployment aspect ClassLoader deployerClassLoader = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(this.aspect.getLoader()); this.aspect.start(dep); } finally { SecurityActions.setContextClassLoader(deployerClassLoader); } } } }
providedConditions.addAll(aspect.getProvidesAsSet()); try SecurityActions.setContextClassLoader(aspect.getLoader()); aspect.start(dep);
@Override public void undeploy(final DeploymentUnit unit) { if (isWebServiceDeployment(unit)) { final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY); WSLogger.ROOT_LOGGER.tracef("%s stop: %s", aspect, unit.getName()); ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(aspect.getLoader()); aspect.stop(dep); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader); } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); if (isWebServiceDeployment(unit)) { ensureAspectInitialized(); final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY); WSLogger.ROOT_LOGGER.tracef("%s start: %s", aspect, unit.getName()); ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(aspect.getLoader()); dep.addAttachment(ServiceTarget.class, phaseContext.getServiceTarget()); aspect.start(dep); dep.removeAttachment(ServiceTarget.class); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader); } } }
providedConditions.addAll(aspect.getProvidesAsSet()); aspect.start(dep);
parentProvidedConditions.addAll(aspect.getProvidesAsSet()); if (aspect.getRequires() == null || parentProvidedConditions.containsAll(aspect.getRequiresAsSet())) if (DeploymentAspect.LAST_DEPLOYMENT_ASPECT.equals(aspect.getRequires()))
/** * If deployed unit is related to web services this method delegates * to deployment aspect and calls its create() and start() methods. * * @param unit deployment unit * @throws DeploymentException on deployment failure */ @Override protected void internalDeploy(final DeploymentUnit unit) throws DeploymentException { if (ASHelper.isWebServiceDeployment(unit)) { this.log.debug(this.aspect + " start: " + unit.getName()); final Deployment dep = ASHelper.getRequiredAttachment(unit, Deployment.class); this.aspect.start(dep); } }
deploymentAspect.setRelativeOrder(Integer.parseInt(priority.trim()));
if (aspect.isLast()) final Set<String> inputs = aspect.getRequiresAsSet(); for (String input : inputs) if (!aspect.isLast()) final Set<String> outputs = aspect.getProvidesAsSet(); for (String output : outputs) this.setRelativeOrder(aspect.getRelativeOrder()); this.aspect = aspect;
/** * If undeployed unit is related to web services this method delegates * to deployment aspect and calls its stop() and destroy() methods. * * @param unit deployment unit */ @Override protected void internalUndeploy(final DeploymentUnit unit) { if (ASHelper.isWebServiceDeployment(unit)) { this.log.debug(this.aspect + " stop: " + unit.getName()); final Deployment dep = ASHelper.getRequiredAttachment(unit, Deployment.class); if (this.aspect.canHandle(dep)) { //set the context classloader using the proper one from the deployment aspect ClassLoader deployerClassLoader = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(this.aspect.getLoader()); this.aspect.stop(dep); } finally { SecurityActions.setContextClassLoader(deployerClassLoader); } } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); if (isWebServiceDeployment(unit)) { ensureAspectInitialized(); final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY); if (aspect.canHandle(dep)) { ROOT_LOGGER.aspectStart(aspect, unit.getName()); ClassLoader origClassLoader = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(aspect.getLoader()); dep.addAttachment(ServiceTarget.class, phaseContext.getServiceTarget()); aspect.start(dep); dep.removeAttachment(ServiceTarget.class); } finally { SecurityActions.setContextClassLoader(origClassLoader); } } } }
@Override public void undeploy(final DeploymentUnit unit) { if (isWebServiceDeployment(unit)) { final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY); WSLogger.ROOT_LOGGER.tracef("%s stop: %s", aspect, unit.getName()); ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(aspect.getLoader()); aspect.stop(dep); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader); } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); if (isWebServiceDeployment(unit)) { ensureAspectInitialized(); final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY); WSLogger.ROOT_LOGGER.tracef("%s start: %s", aspect, unit.getName()); ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(aspect.getLoader()); dep.addAttachment(ServiceTarget.class, phaseContext.getServiceTarget()); aspect.start(dep); dep.removeAttachment(ServiceTarget.class); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader); } } }
/** * If deployed unit is related to web services this method delegates * to deployment aspect and calls its create() and start() methods. * * @param unit deployment unit * @throws DeploymentException on deployment failure */ @Override protected void internalDeploy(final DeploymentUnit unit) throws DeploymentException { if (ASHelper.isWebServiceDeployment(unit)) { this.log.debug(this.aspect + " start: " + unit.getName()); final Deployment dep = ASHelper.getRequiredAttachment(unit, Deployment.class); this.aspect.start(dep); } }