This content has been marked as final.
Show 6 replies
-
1. Re: Shortcomings of Virtual Archives (in progress)
jason.greene Jul 13, 2009 11:59 AM (in response to alrubinger)There really is no need for the "classes" to appear in VFS. If someone wants to get a stream for a class instance, they would normally do clazz.getClassLoader().getResource(clazz.getName()) anyway, because there is no guarantee that a class visible to the deployment is actually in the deployment
-
2. Re: Shortcomings of Virtual Archives (in progress)
alrubinger Jul 13, 2009 12:35 PM (in response to alrubinger)"jason.greene@jboss.com" wrote:
There really is no need for the "classes" to appear in VFS. If someone wants to get a stream for a class instance, they would normally do clazz.getClassLoader().getResource(clazz.getName()) anyway, because there is no guarantee that a class visible to the deployment is actually in the deployment
In some cases, the classes do need to be in the virtual archive.
This has to work the same way a physical deployment would. In a real JAR, we've got class files. So the deployment CL picks those up and uses them if the FQN is not already handled by a parent CL.
The only difference in the testing scenario is that the classes *are* all visible to a parent CL (usually the appCL) because the test launcher will put everything on java.class.path. In this case copying the bytes again within memory is a waste.
However, I could conceivably add classes as resources from elsewhere on the file system, and these are not covered under java.class.path. In that case, the bytes need to be copied and in memory within the virtual archive.
S,
ALR -
3. Re: Shortcomings of Virtual Archives (in progress)
jason.greene Jul 13, 2009 1:33 PM (in response to alrubinger)"ALRubinger" wrote:
However, I could conceivably add classes as resources from elsewhere on the file system, and these are not covered under java.class.path. In that case, the bytes need to be copied and in memory within the virtual archive.
If you have a class instance, then putting its bytes in the VFS is a waste. If you don't have a class instance, then you have a very different API, that operates off of Files/URLs. -
4. Re: Shortcomings of Virtual Archives (in progress)
alrubinger Jul 13, 2009 1:42 PM (in response to alrubinger)"jason.greene@jboss.com" wrote:
If you have a class instance, then putting its bytes in the VFS is a waste.
So you agree with me that the subject of this Thread is appropriate? :)"jason.greene@jboss.com" wrote:
If you don't have a class instance, then you have a very different API, that operates off of Files/URLs.
addClass(Class<?> class) simply delegates out to addResource(String resource):
http://anonsvn.jboss.org/repos/jbossas/projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/base/AbstractVirtualArchive.java
http://anonsvn.jboss.org/repos/jbossas/projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/impl/vfs/VirtualVfsArchiveImpl.java
Both are covered by the API:
http://anonsvn.jboss.org/repos/jbossas/projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/incubation/virtual/spi/ExtensibleVirtualArchive.java
S,
ALR -
5. Re: Shortcomings of Virtual Archives (in progress)
jason.greene Jul 13, 2009 1:53 PM (in response to alrubinger)"ALRubinger" wrote:
"jason.greene@jboss.com" wrote:
If you don't have a class instance, then you have a very different API, that operates off of Files/URLs.
addClass(Class<?> class) simply delegates out to addResource(String resource):
Perhaps we are both saying the same thing (just differently)?
My point was that these two methods should completely different behaviors. The class case should never need representation in the VFS, since the class instance (no matter where it came from), will work fine. In essence this is really the same as a specialized classloading configuration that pulls in files from outside the deployment. The major difference being that annotation scanning by frameworks such as ejb3 must be ran on these classes.
The resource case, on the otherhand, makes perfect sense for custom VFS behavior, since these really are files. -
6. Re: Shortcomings of Virtual Archives (in progress)
alrubinger Jul 13, 2009 2:06 PM (in response to alrubinger)OK cool, looks like we're both on the same page regarding the use cases and the issues then.
So next to solve is "how". :) And then doing it.
S,
ALR