You can use blueprint felix extension. It works like a Spring property placeholder. In your OSGI-INF/blueprint/config.xml, you can use:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";
default-activation="lazy">

    <ext:property-placeholder>
       <ext:location>file:/your/path/file.cfg</ext:location>
    </ext:property-placeholder>

    <bean id="mybean" class="my.package.Bean">
        <property name="myproperty" value="${property.in.file}"/>
    </bean>
</blueprint>

Regards
JB

Asier Aranbarri Beldarrain wrote:
Hi everyone:

I need to load a config.properties file from outside an osgi bundle and I'm having real issues getting it. The .properties MUST be outisde the classpath, since it must be modified by the user( put user and password from mysql) and then read from the bundle (bundle.jar).

I have no problem loading from outside with an static path or a dynamic path INSIDE eclipse. But when I try to load it dinamycally from the eclipse-independent osgi, I cannot read the file.

Is there any way to load a file outside the classpath with a .jar? I repeat that the .properties MUST be outside the classpath. Static paths don't do the work for me since I am forcing the user to put in an specific location and that's not acceptable(also, he's on linux and I on windows, so the path C:\ ... doesnt work).

Thank you very much,

Asier


------------------------------------------------------------------------

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to