[jboss-dev-forums] [Embedded JBoss Development] - Archive Conversion Design Descussion

johnbailey do-not-reply at jboss.com
Mon Aug 24 20:28:50 EDT 2009


In flushing out the design of a archive conversion utility, I wanted to get some more input.  It seems like there are a few possible use cases for converting archive types.  

1.  Change the internal storage archive of an existing container archive (this seems like the primary use case):

  | JavaArchive javaMemArchive = new JavaArchiveImpl(new MemoryMapArchiveImpl("test.jar"));
  |       
  | JavaArchive javaVfsArchive = MagicArchiveConverter.asVfsArchive(javaMemArchive);
  |  ....
  |  

2.  Change the container archive but maintain storage archive (not sure how often this will occur):


  | JavaArchive javaMemArchive = new JavaArchiveImpl(new MemoryMapArchiveImpl("test.jar"));
  |       
  | WebArchive warMemArchive = MagicArchiveConverter.asWebArchive(javaMemArchive);
  | ...
  | 

3.  Change the container archive and storage archive:

  | JavaArchive javaMemArchive = new JavaArchiveImpl(new MemoryMapArchiveImpl("test.jar"));
  |       
  | WebArchive warMemArchive = MagicArchiveConverter.asWebArchive(javaMemArchive);
  |       
  | WebArchive waVfsArchive = MagicArchiveConverter.asVfsArchive(warMemArchive);
  | ...
  | 

Am I missing any use cases? 

The 3ed is not really a different use case, as it is just 1 and 2 in subsequent calls, but it would be nice to do both in one call.

In previous discussions we discussed a builder style API with nice "asVfs" like methods.  An issue I see with the builder style API is extension will become an issue.   As new impls are added, we would need to update the base.  Should we be looking at more of a factory to support extension?  We would most likely loose some of the niceness of the API, but would be more flexible.  

Any thoughts


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

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



More information about the jboss-dev-forums mailing list