Is there an OSGI Framework Bundle API for accessing nested archive content?
The ValidatorFactoryGBean uses Bundle.getEntry() to get to META-INF/validation.xml and WEB-INF/validation.xml files in EJB and Web archives. This works fine for standalone modules. When the JAR or WAR is packaged in an EAR file, Bundle.getEntry(war-modulename.war/WEB-INF/validation.xml) gets me to the file as WAR file is exploded and repackaged in the EAR whereas Bundle.getEntry(ejb-modulename.jar/META-INF/validation.xml) does not work since the EJB jar is stored as is in the EAR. One option I can think of is to get the EJB jar entry, store it to a temporary file, open it with Jar APIs to get to META-INF/validation.xml. myapp.ear my-ejb.jar (EJB jar is stored as is) +--META-INF +-- validation.xml +--my-web.war (WAR file is exploded, so WEB-INF is a directory in the repackaged EAR) +--WEB-INF +-- validation.xml Is there any Bundle API that will allow to access the content in the nested archives? Or any other way to get to the file of interest without creating temporary files? -- Vamsi
Re: Is there an OSGI Framework Bundle API for accessing nested archive content?
I think we've put all the jars or wars that could have this file in them in the bundle class path, so I would expect bundle.getResources() to provide all the possiblilites. I haven't tried it in this context, but it seems to work for something similar -- finding META-INF/resources directories in jars in WEB-INF/lib in wars. thanks david jencks On Oct 8, 2010, at 9:15 AM, Vamsavardhana Reddy wrote: The ValidatorFactoryGBean uses Bundle.getEntry() to get to META-INF/validation.xml and WEB-INF/validation.xml files in EJB and Web archives. This works fine for standalone modules. When the JAR or WAR is packaged in an EAR file, Bundle.getEntry(war-modulename.war/WEB-INF/validation.xml) gets me to the file as WAR file is exploded and repackaged in the EAR whereas Bundle.getEntry(ejb-modulename.jar/META-INF/validation.xml) does not work since the EJB jar is stored as is in the EAR. One option I can think of is to get the EJB jar entry, store it to a temporary file, open it with Jar APIs to get to META-INF/validation.xml. myapp.ear my-ejb.jar (EJB jar is stored as is) +--META-INF +-- validation.xml +--my-web.war (WAR file is exploded, so WEB-INF is a directory in the repackaged EAR) +--WEB-INF +-- validation.xml Is there any Bundle API that will allow to access the content in the nested archives? Or any other way to get to the file of interest without creating temporary files? -- Vamsi
Re: Is there an OSGI Framework Bundle API for accessing nested archive content?
David, Bundle.getResources() does seem to work, but I am afraid it does not help me in this case as each EJB jar can have its own META-INF/validation.xml and when there are mulitple EJB jars in the EAR, it is not possible to distinguish which URL points to the one I am looking for in particular. On Fri, Oct 8, 2010 at 10:37 PM, David Jencks david_jen...@yahoo.comwrote: I think we've put all the jars or wars that could have this file in them in the bundle class path, so I would expect bundle.getResources() to provide all the possiblilites. I haven't tried it in this context, but it seems to work for something similar -- finding META-INF/resources directories in jars in WEB-INF/lib in wars. thanks david jencks On Oct 8, 2010, at 9:15 AM, Vamsavardhana Reddy wrote: The ValidatorFactoryGBean uses Bundle.getEntry() to get to META-INF/validation.xml and WEB-INF/validation.xml files in EJB and Web archives. This works fine for standalone modules. When the JAR or WAR is packaged in an EAR file, Bundle.getEntry(war-modulename.war/WEB-INF/validation.xml) gets me to the file as WAR file is exploded and repackaged in the EAR whereas Bundle.getEntry(ejb-modulename.jar/META-INF/validation.xml) does not work since the EJB jar is stored as is in the EAR. One option I can think of is to get the EJB jar entry, store it to a temporary file, open it with Jar APIs to get to META-INF/validation.xml. myapp.ear my-ejb.jar (EJB jar is stored as is) +--META-INF +-- validation.xml +--my-web.war (WAR file is exploded, so WEB-INF is a directory in the repackaged EAR) +--WEB-INF +-- validation.xml Is there any Bundle API that will allow to access the content in the nested archives? Or any other way to get to the file of interest without creating temporary files? -- Vamsi -- Vamsi
Re: Is there an OSGI Framework Bundle API for accessing nested archive content?
There is no way to access the nest jar file by native OSGi API, actually, you could find that, both Felix and Equonix will extract the embeded jar files in their cache folders. But you might use those finder classes in xbean package. 2010/10/9 Vamsavardhana Reddy c1vams...@gmail.com David, Bundle.getResources() does seem to work, but I am afraid it does not help me in this case as each EJB jar can have its own META-INF/validation.xml and when there are mulitple EJB jars in the EAR, it is not possible to distinguish which URL points to the one I am looking for in particular. On Fri, Oct 8, 2010 at 10:37 PM, David Jencks david_jen...@yahoo.comwrote: I think we've put all the jars or wars that could have this file in them in the bundle class path, so I would expect bundle.getResources() to provide all the possiblilites. I haven't tried it in this context, but it seems to work for something similar -- finding META-INF/resources directories in jars in WEB-INF/lib in wars. thanks david jencks On Oct 8, 2010, at 9:15 AM, Vamsavardhana Reddy wrote: The ValidatorFactoryGBean uses Bundle.getEntry() to get to META-INF/validation.xml and WEB-INF/validation.xml files in EJB and Web archives. This works fine for standalone modules. When the JAR or WAR is packaged in an EAR file, Bundle.getEntry(war-modulename.war/WEB-INF/validation.xml) gets me to the file as WAR file is exploded and repackaged in the EAR whereas Bundle.getEntry(ejb-modulename.jar/META-INF/validation.xml) does not work since the EJB jar is stored as is in the EAR. One option I can think of is to get the EJB jar entry, store it to a temporary file, open it with Jar APIs to get to META-INF/validation.xml. myapp.ear my-ejb.jar (EJB jar is stored as is) +--META-INF +-- validation.xml +--my-web.war (WAR file is exploded, so WEB-INF is a directory in the repackaged EAR) +--WEB-INF +-- validation.xml Is there any Bundle API that will allow to access the content in the nested archives? Or any other way to get to the file of interest without creating temporary files? -- Vamsi -- Vamsi -- Ivan