Ask Your Question

How to read properties file under open daylight's configuration directory from OSGI module

asked 2014-11-23 07:21:47 -0700

Hi Folks,

I have OSGI module deployed in open daylight. Now I am trying to read properties file under open daylight's configuration directory. Any helpful links, direction or guidance is appreciated.

Thanks in Advance, Darpan

edit retag flag offensive close merge delete


any answer

satlight ( 2016-03-08 23:14:33 -0700 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2016-05-16 05:24:48 -0700

jgoodyear gravatar image

You'll need to use ConfigAdmin to read properties file.

How are you wiring your bundle? Direct OSGi calls? Blueprint? Declarative Services? Spring DM?

edit flag offensive delete publish link more

answered 2016-05-16 06:58:32 -0700

medox gravatar image

related question cvan help you File option Problem is that we are working in an OSGi environment, so when trying to create a File with the asset path. The asset path is in fact a link to the bundle URL url = getClass().getClassLoader().getResource("/excel/file.xslx"); File file = new File(url.toURI()); // URI = bundle://449.124:/excel/file.xlsx So following Exception occurs: java.lang.IllegalArgumentException: URI scheme is not "file"

Trying to use the URL path instead also is not successful:

File file = new File(url.getPath()); // Path= /excel/file.xslx if(!file.exists()){ // FILE DOES NOT EXIST } Path option When I try to use the path open method, it cannot seem to resolve the path, since I always get following Exception: java.lang.IllegalStateException: Zip File is closed

opcPackage =; // Path= /excel/file.xslx Any ideas on how I can reference my file from within a bundle environment in order for it to load? Or am I missing something obvious here? the accpeted answer here link text

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-11-23 07:21:47 -0700

Seen: 1,438 times

Last updated: May 16 '16