/** * Deploy a url * * @param url the deployment url * @throws Throwable for any error */ protected KernelDeployment deploy(final URL url) throws Throwable { HornetQBootstrapServer.log.debug("Deploying " + url); KernelDeployment deployment = deployer.deploy(url); deployments.add(deployment); HornetQBootstrapServer.log.debug("Deployed " + url); return deployment; }
/** * Undeploy a deployment * * @param deployment the deployment */ public void undeploy(final KernelDeployment deployment) throws Throwable { HornetQBootstrapServer.log.debug("Undeploying " + deployment.getName()); deployments.remove(deployment); try { deployer.undeploy(deployment); HornetQBootstrapServer.log.debug("Undeployed " + deployment.getName()); } catch (Throwable t) { HornetQBootstrapServer.log.warn("Error during undeployment: " + deployment.getName(), t); } }
@Override public void bootstrap() throws Throwable { super.bootstrap(); deployer = new BeanXMLDeployer(getKernel()); Runtime.getRuntime().addShutdownHook(new Shutdown()); for (String arg : args) { deploy(arg); } deployer.validate(); }
/** Deploys a XML on the container */ public KernelDeployment deploy(final String name, final String xml) throws Throwable { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); PrintStream printOut = new PrintStream(byteOut); printOut.print(xml); printOut.flush(); ByteArrayInputStream is = new ByteArrayInputStream(byteOut.toByteArray()); KernelDeployment deployment = deployer.deploy(name, is); deployments.add(deployment); return deployment; }