Deployment redeploy
alesj Jun 6, 2008 8:46 AMAfter spending a day on figuring out why my jboss-minimal-tests are not working as they should I also stumbled upon a question what happens if metadata changes?
I remember I had previous discussion about this with Scott.
I even found TODO (which is probably my) in
- http://anonsvn.jboss.org/repos/jbossas/trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
But I can see I never given it enough of thought, since I only yesterday saw that we're missing all this functionality in deployers.
Why 'missing all this functionality in deployers'?
Since in order for a client to know if the metadata has been changed, it needs to know where metadata resides, but that's is server side (structure) detail.
So this is what I came up with.
Few pseudo code lines.
The entry point to all should of course be - as for all other deployment things - DeployerClient:
// deleted, modified, nothing ModifcationType getModificationType();
First we need to know if client slide Deployment still exists:
boolean exists();
which for VFSDeployment it would check if the root still exists.
Then we need to get server side representation of deployment - DeploymentContext.
And recursively check it is was modified.
if (deploymentContext.isModified()) return true; List<DeploymentContext> chidren = deploymentContext.getChildre(); for (DeploymentContext child : children) return checkModified(child);
Probably in case of VFSDeploymentContext we will check the root and metadata locations.
So at the end, impl in MainDeployerImpl would look like
ModificationType getModificationType(Deployment deployment) { if (deployment.exists() == false) return DELETED; DeploymentContext context = getContext(deployment); if (context.isModified()) return MODIFIED; else return NONE; }
(OK, bunch of assert checks missing, but we get the picture :-))
So ProfileImpl would then simply call this method to see which deployment need to be handled.
Sounds OK?