Thanks for the info. I'm getting all the plugin.xml files from the classpath 
with:

getClass().getClassLoader().getResources("plugin.xml");

The result I'm parsing and then creating new QFile's with 
"classpath:jarfilename#plugins.xml" to read the content from the files. It 
works 
very nice and was easy to implement. Thanks for the suggestion.

/Dimitri




Gunnar Sletta <[EMAIL PROTECTED]> wrote:
 
> Dimitri Frederickx wrote:
>> Hi all,
>> 
>> I want to develop some kind of plugin mechanism for my application.
>> Every plugin is a new jar file that I put on my classpath. Each plugin
>> has a configuration file that is called plugin.xml which is located in
>> the jar file.
>> 
>> At startup I must read all plugin.xml files from the classpath. Let's
>> say that I have 5 plugins (jars) installed, I must read 5 plugin.xml
>> files.
>> 
>> I Qt Jambi you can easily access files from the classpath by
>> specifying the path on a QFile that starts with "classpath:". But is
>> there an easy way to retrieve a list of files with the same name. All
>> my plugin.xml files are on the classpath, but located in different
>> jar-files. How can I read all the files that the system can find? Is
>> this supported in Qt Jambi?
>> 
>> /Dimitri
> 
> Hi Dimitri,
> 
> Our classpath file engine is a convenience around other existing java 
> functionality, and most suited for locating unique resources within the 
> classpath. If you want to list all resources named x in your classpath 
> it is just as easy to use ClassLoader.getResources("name").
> 
> If you want to do this using QFile, you can look in the classpath for 
> ..jar files and then do, "classpath:jarfilename#plugins.xml" to query 
> each indiviual jar file for its plugin.xml file.
> 
> best regards,
> Gunnar
> 

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to