[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Deployment cleanup & modifications

adrian@jboss.org do-not-reply at jboss.com
Thu Jan 29 08:45:39 EST 2009


"adrian at jboss.org" wrote : 
  | The "simplist" solution to this problem should be that when somebody creates a root
  | VFSContext it is against that object that the "temp" information should be stored
  | or at least linked.
  | 
  | That root VFSContext should always be "live" while somebody holds a
  | link to the root VirtualFile.
  | 
  | Then when somebody asks to cleanup a VirtualFile within that context, it can workout
  | which parts of the temp information need to be removed.
  | 
  | The context should still be usable, its just removed the temp data which would need to be
  | reconstructed. Which is why close() or destroy() is a bad name/semantic.

By way of a more concrete example using your example:

deploy/
* myapp.ear (exploded)
** myweb-ui.war (packed)
*** WEB-INF/lib
**** some-persistence.jar
***** META-INF/persistence.xml 

Typically the root VFS context is going to be the deploy folder.

When you want to unpack myweb-ui.war or some-persistence.jar you tell the
root context what you've done.

(As usual this is pseudo code)

  | VFSContext ctx = getRootContext();
  | ctx.addCacheInfo(getPath(), origName, new TempJarInfo(...));
  | 
  | public class TempJarInfo implements VFSCacheInfo
  | {
  | ...
  | 
  |    public void cleanup() { ... }
  | }
  | 

This avoids also trivially allows you to avoid unpacking them again, since you can ask
this cache.


  | // Already unpacked?
  | VFSContext ctx = getRootContext();
  | tempName = ctx.getCacheInfo(getPath(), origName);
  | 

Then when the deployment says you can cleanup "deploy/myapp.war"
you can iterate over these cached objects that being with that VFS path and clean
them up.


  | VFSContext ctx = getRootContext();
  | ctx.cleanupCache(getPath());
  | 
  | i.e.
  | 
  | for (Map.Entry<String, VFSCacheInfo> entry : allCacheItems)
  | {
  |    if (entry.getKey().startsWith(path))
  |      getValue().cleanup();
  | }
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205557#4205557

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205557



More information about the jboss-dev-forums mailing list