[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: VFS and directory handling

alesj do-not-reply at jboss.com
Thu May 29 08:20:41 EDT 2008


"wolfc" wrote : It's PersistenceUnitInfo that has the responsibility to be spec compliant, but it's VFS that has to provide the facilities to enable it to do so.
What does JPA expect to get in the case of nested jar?
It's neither file or jar. 
OK, not file is obvious.

>From the spec:
anonymous wrote :     
  | .. other URL from which an InputStream in jar format can be obtained.
  | 

In our case this could be it.
If they then did this

  |            ZipInputStream zis;
  |            if (is instanceof ZipInputStream)
  |               zis = (ZipInputStream)is;
  |            else
  |               zis = new ZipInputStream(is); 
  | 

But this would mean that the URL returned had to be VFS based - so that VFSURLConnection would kick in, pointing to nested jar. Which then returns itself as ZipInputStream.

But there is another catch.
Imagine you have that jar in exploded form.
How do you then know weatehr it's a nested jar or just plain dir?
Since for plain dir this does the trick:

  |       String urlString = url.toExternalForm();
  |       if (urlString.startsWith("vfs"))
  |          url = new URL(urlString.substring(3));
  | 

And we're back to Scott's description:
"scott.stark at jboss.org" wrote : 
  | This is the same situation that exists without the vfs for exploded vs packed jars. The only difference without the vfs is that the url prefix is probably jar: for packed, file: for exploded. There is no generic solution I can see
  | 

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

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



More information about the jboss-dev-forums mailing list