On Thu, Jun 19, 2008 at 6:53 PM, Christian López Espínola
<[EMAIL PROTECTED]> wrote:

> The XMLs needed on my project will be embedded on the plugin jar.
> I was wondering how to load them,
...
> and with the ¿module classloader?
>        ClassLoader loader = UIFactory.class.getClassLoader(); //
> UIFactory is a class in my module
>        URL url = loader.getResource(file);
>
> On both cases url is null.

This is pretty close to what you want.  You probably just have the
name specified wrong.  You can actually save a step since you don't
need to fetch the class loader explicitly, so you can just use

  this.getClass().getResourceAsStream("org.argouml.module.mymodule.foo.xml")

or something similar.  Look for other uses of this method to load
profiles or configuration files to get hints on how you need to adjust
your naming to work (and, of course, make sure that your XML file is
actually getting copied to the right spot in the build directory or
jar).

You *don't* want to use the system classloader, because it's not going
to have access to the classes loaded by your module's module-specific
classloader.

> PS: Once this is resolved, should it be part of the module, or should
> I add the solution to ResourceLoader and ResourceLoaderWrapper so
> others can benefit?

It's one line, so I don't see a need to add it to the utility classes.
 A lot of the ResourceLoader machinery is just there for historical
purposes.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to