1 22 package org.jboss.kernel.plugins.deployment; 23 24 import java.util.List ; 25 import java.util.ListIterator ; 26 27 import org.jboss.kernel.Kernel; 28 import org.jboss.kernel.spi.deployment.KernelDeployment; 29 import org.jboss.logging.Logger; 30 import org.jboss.util.collection.CollectionsFactory; 31 32 41 public class BasicKernelDeployer extends AbstractKernelDeployer 42 { 43 44 private static final Logger log = Logger.getLogger(BasicKernelDeployer.class); 45 46 47 protected List <KernelDeployment> deployments = CollectionsFactory.createCopyOnWriteList(); 48 49 54 public BasicKernelDeployer(Kernel kernel) 55 { 56 super(kernel); 57 } 58 59 public void deploy(KernelDeployment deployment) throws Throwable 60 { 61 final boolean trace = log.isTraceEnabled(); 62 if (trace) 63 log.trace("Deploying " + deployment); 64 super.deploy(deployment); 65 deployments.add(deployment); 66 if (trace) 67 log.trace("Deployed " + deployment); 68 } 69 70 public void undeploy(KernelDeployment deployment) 71 { 72 final boolean trace = log.isTraceEnabled(); 73 if (trace) 74 log.trace("Undeploying " + deployment); 75 deployments.remove(deployment); 76 super.undeploy(deployment); 77 if (trace) 78 log.trace("Undeployed " + deployment); 79 } 80 81 84 public void shutdown() 85 { 86 ListIterator iterator = deployments.listIterator(deployments.size()); 87 while (iterator.hasPrevious()) 88 { 89 KernelDeployment deployment = (KernelDeployment) iterator.previous(); 90 undeploy(deployment); 91 } 92 } 93 } 94 | Popular Tags |