How to list files in a bundleresource:// URL? [message #554085] |
Fri, 20 August 2010 06:14 |
Tassilo Horn Messages: 93 Registered: July 2009 |
Member |
|
|
Hi all,
we have a graph library that also includes a graph querying language.
That language has an extensible function library, i.e. all function
classes extend some abstract Greql2Function class and reside in a fixed
package. On startup, there's a Greql2FunctionLibrary class residing in
the same package as the functions which checks for available functions
and registeres them. It gets the available resources using
Enumeration<URL> resources = Greql2FunctionLibrary.class
.getClassLoader().getResources(nondottedPackageName);
where nondottedPackageName is the package name of the funlib with dots
replaced by /.
When the library project is used by another eclipse project as project
dependency, one resource is a file URL, and the functions are registered
by iterating the files in Greql2FunctionLibrary.class's directory. When
the lib is used as JAR, I get a jar:file: URL and use a JarFile and
iterate the JarEntries.
But now we would like to provide the library also as Eclipse plugin.
But then, the URL I get is
bundleresource://355.fwk626614097/de/uni_koblenz/jgralab/gre ql2/funlib/
How do I iterate the contents of that URL/directory?
If possible, I'd much prefer a plain java.* solution, because I don't
want the library to depend on anything eclipse specific only in order to
make it usable from eclipse.
Thanks for pointers,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
|
|
|
Re: How to list files in a bundleresource:// URL? [message #554094 is a reply to message #554085] |
Fri, 20 August 2010 07:24 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi,
It's not the real answer to your question but e4's CSS engine has the
same problem you have. It would like to be extensible in OSGi and
none-OSGi environments.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=322189 for a
discussion on how we try to target the problem in Eclipse 4.1 (it
currently looks like we'll take the plugin.xml way which also works out
side OSGi).
Another idea is that if you get the bundle you'll get access to the its
location (e.g. the real jar, the real directory) and you can walk this
directory/jar to find the appropriate classes you'll load through the
Bundle once more
Tom
Am 20.08.10 08:14, schrieb Tassilo Horn:
> Hi all,
>
> we have a graph library that also includes a graph querying language.
> That language has an extensible function library, i.e. all function
> classes extend some abstract Greql2Function class and reside in a fixed
> package. On startup, there's a Greql2FunctionLibrary class residing in
> the same package as the functions which checks for available functions
> and registeres them. It gets the available resources using
>
> Enumeration<URL> resources = Greql2FunctionLibrary.class
> .getClassLoader().getResources(nondottedPackageName);
>
> where nondottedPackageName is the package name of the funlib with dots
> replaced by /.
>
> When the library project is used by another eclipse project as project
> dependency, one resource is a file URL, and the functions are registered
> by iterating the files in Greql2FunctionLibrary.class's directory. When
> the lib is used as JAR, I get a jar:file: URL and use a JarFile and
> iterate the JarEntries.
>
> But now we would like to provide the library also as Eclipse plugin.
> But then, the URL I get is
>
> bundleresource://355.fwk626614097/de/uni_koblenz/jgralab/gre ql2/funlib/
>
> How do I iterate the contents of that URL/directory?
>
> If possible, I'd much prefer a plain java.* solution, because I don't
> want the library to depend on anything eclipse specific only in order to
> make it usable from eclipse.
>
> Thanks for pointers,
> Tassilo
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03878 seconds