This content has been marked as final.
Show 2 replies
-
1. Re: Programmatic redeploy using DeploymentManager
emuckenhuber Feb 9, 2009 4:34 AM (in response to juergen.zimmermann)"Juergen.Zimmermann" wrote:
Can org.jboss.deployers.spi.management.deploy.DeploymentManager be used for redeploying e.g. an EAR?
Basically you can deploy a new deployment over deploymentManager. So you can use copyContent = true
to copy and deploy a zipped file, or copyContent = false to just deploy the url (this also works for exploded deployments)"Juergen.Zimmermann" wrote:
If so, are there any examples or wiki pages?
Maybe this example helps, if you look at the setUp and tearDown method:
https://anonsvn.jboss.org/repos/jbossas/trunk/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java
Please note that the usage and interface will most probably change in 5.1.x. -
2. Re: Programmatic redeploy using DeploymentManager
juergen.zimmermann Feb 9, 2009 7:07 AM (in response to juergen.zimmermann)Thank you! This is exactly what I was looking for.
To summarize: here are the steps for programmatic redeployment with JBossAS 5.0.0.GA:Context ctx = new InitialContext(); ProfileService ps = (ProfileService) ctx.lookup("ProfileService"); ctx.close(); DeploymentManager ds = ps.getDeploymentManager(); // %JBOSS_HOME%\server\default ds.loadProfile(new ProfileKey("default"), false); String earName = "foo.ear"; String earUrl = "file:/.../foo.ear"; DeploymentProgress stop = ds.stop(ManagedDeployment.DeploymentPhase.APPLICATION, earName); stop.run(); checkProgress(stop); DeploymentProgress distribute = ds.distribute(earName, ManagedDeployment.DeploymentPhase.APPLICATION, new URL(earUrl), false); distribute.run(); checkProgress(distribute); private static void checkProgress(DeploymentProgress progress) throws Exception { DeploymentStatus status = progress.getDeploymentStatus(); Throwable failure = status.getFailure(); if (failure != null) { throw new Exception(failure); } }