You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Alessandro Adamou <al...@istc.cnr.it> on 2011/06/29 13:37:13 UTC

Getting bundle resource as a file:// URL

Hi,

I need to create a java.io.File object from a Stanbol bundle resource.

Problem is, on Felix calls to Class#getResource() or 
ClassLoader#getResource() return only URLs with the bundle:// scheme, 
and getting a File from it won't work.

I need to use Class or ClassLoader, no BundleContext or 
ComponentContext, as this has to work outside of OSGi too.

I've read Eclipse has something like 
org.eclipse.core.runtime.FileLocator for that, but what about Felix?

Thanks

Alessandro

-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"As for the charges against me, I am unconcerned. I am beyond their timid, lying morality, and so I am beyond caring."
(Col. Walter E. Kurtz)


Re: Getting bundle resource as a file:// URL

Posted by Alessandro Adamou <al...@istc.cnr.it>.
> I've read Eclipse has something like 
> org.eclipse.core.runtime.FileLocator for that, but what about Felix?

To be more precise, I'd like to know if Felix has any utilities in its 
APi that can be called without having the actual Felix framework running.

> Thanks
>
> Alessandro
>
> -- 
> M.Sc. Alessandro Adamou
>
> Alma Mater Studiorum - Università di Bologna
> Department of Computer Science
> Mura Anteo Zamboni 7, Bologna - Italy
>
> Semantic Technology Laboratory (STLab)
> Institute for Cognitive Science and Technology (ISTC)
> National Research Council (CNR)
> Via Nomentana 56, 00161 Rome - Italy
>
>
> "As for the charges against me, I am unconcerned. I am beyond their timid, lying morality, and so I am beyond caring."
> (Col. Walter E. Kurtz)


-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"As for the charges against me, I am unconcerned. I am beyond their timid, lying morality, and so I am beyond caring."
(Col. Walter E. Kurtz)