|
[
Permlink
| « Hide
]
Jean-Baptiste Onofré added a comment - 20/Jan/09 06:41 AM
For information, the <classpath/> management class is in servicemix-common. It's the ClassLoaderXmlPreprocessor.
Not sure how feasible it is to use regexp on non file based urls.
Well, I have seen the <location/> usage in the getClassLoader(SpringApplicationContext applicationContext, XmlBeanDefinitionReader reader, Document document) method.
For the <location/>, a classpath List is created and populated with location element. After that, this classpath List is transformed into a URLs array. URI uri = root.toURI().resolve(location); // where root is a File provided in the constructor I'm going to patch the getResource(String location) method to detect if the location is a JarUrlConnection or a File and return a URL. I have seen that getResource(String location) method is used to load a classpath.xml file (in the SU root) too.
This classpath.xml must be remain a File. So, I will make a little patch of the preprocess() method to let the classpath.xml as a File. Step 1 : add the support of jar: and file: classpath entries.
The path contains the getResource() changes in the ClassLoaderXmlPreprocessor and a small unit test for different kind of provided URLs. The patch root is servicemix-core. I resume to better support (and try the regexp support as made in Commons VFS).
Jean-Baptiste Onofré made changes - 30/Jan/09 12:02 AM
A new patch that use ZipFile/ZipEntry to use regexp and generate the matching URL.
Warning : this patch is work in progress (unit test fails). I need to work on it and so it's not intended for inclusion.
Jean-Baptiste Onofré made changes - 08/Feb/09 12:27 PM
Correct the issue. Now parse the URI using StringBuffer/String. Get the ZipFile and looking into entries.
Add unit test with a ear file. Need to complete with new unit tests.
Jean-Baptiste Onofré made changes - 08/Feb/09 11:34 PM
This is the first real patch release.
It includes the support of :
Guillaume, could make a quick review on the patch and give me some feedback ? Thanks,
Jean-Baptiste Onofré made changes - 13/Feb/09 03:38 AM
After dealing with Guillaume, the getResource() method should now return a list of URL.
Currently the getJarResource() supports regexp but returns only the first occurence that match. A more efficient way is to return the list of all URLs matching the regexp.
Jean-Baptiste Onofré made changes - 14/Feb/09 09:36 AM
Gert Vanthienen made changes - 14/Feb/09 02:06 PM
This patch now supports multi URLs.
Jean-Baptiste Onofré made changes - 15/Feb/09 12:35 PM
I'm going to extend the patch to be able to use system properties.
Has we have the servicemix.home argument in the SMX startup (provided using -Dservicemix.home=), it can be interesting to use this property in the <location/> definition. With it, we will be able to use notation like : This patch contains :
Jean-Baptiste Onofré made changes - 20/Feb/09 12:48 PM
To avoid unit test failure after applying the patch (as the test.ear file shouldn't be created using the patch file), I have commented the unit test assert around the ear exploring.
This patch should be the final one. I build a complete SMX3 distribution and make "real" tests.
Jean-Baptiste Onofré made changes - 20/Feb/09 11:58 PM
The last patch contains only the change on the unit test. We need to apply both
Here is the complete patch with the commented part of the unit test.
I build SMX3 using this to perform "real" tests.
Jean-Baptiste Onofré made changes - 21/Feb/09 01:09 AM
Thanks for your comment Guillaume, I will submit a new patch including this.
Patch containing the last Guillaume's comment.
Jean-Baptiste Onofré made changes - 26/Mar/09 03:06 AM
Another tip from Guillaume, the replaceString method can be replaced by :
for (Enumeration e = properties.propertyNames(); e.hasMoreElements()
[
Patch commited. It will be included in the next SMX3 release.
Jean-Baptiste Onofré made changes - 06/Apr/09 12:31 PM
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||