Hola Miguel: Does that method dynamically see if something changes? I say this because I don't need such an advanced method, but i'll test it if it's the only way. // translation--> Necesito hacer todos esos pasos, sólo para cargar un .properties externo? Me explico, sólo necesito que el bundle sepa cargar el .properties desde la ubicación actual del .jar. Por cierto, muchas gracias por tu tiempo, se agradece la ayuda a un becario.. //
Thanks for your time, any help appreciated. On 1 February 2010 11:05, Miguel <[email protected]> wrote: > > Hi, > I am not pretty sure to understand you. By the way, what you need is: > > 1. install the following bundles: > > org.apache.felix.fileinstall > > a configuration admin implementation, for instance, the apache felix one: > > org.apache.felix.configadmin > > > 2. set up a jvm property where you configuration will be, for instance: > > -Dfelix.fileinstall.dir=/home/mcm/easywireless/workspace_jee/configuration > > 3. create a configuration file there, ending with cfg, for instance: > > m...@mcm:~/easywireless/workspace_jee/configuration$ ls > > iturecomendation.application.cfg nettranslator.application.cfg > netplanning.application.cfg positionsimulator.application.cfg > > 4. Use config admin osgi service. Get the service, implements it, override > updated method: > > public class myClass implements ManagedService { > > > @Override > public void updated(Dictionary properties) throws ConfigurationException { > > // this method will be called everytime the configuration file changes. > Really dynamic. You will retrieved the configuration parameters in a > Dictionary. > > } > > } > > Miguel > Sent from Madrid, Spain > > On Mon, Feb 1, 2010 at 10:51 AM, Asier Aranbarri Beldarrain < > [email protected]> wrote: > >> Hi Miguel: >> >> I have an issue with that solution; I need to send just two things, the >> bundle (bundleX.jar) and a config.properties file, just that. With the file >> install, wouldn't I need another .jar? >> >> Hi Jean: >> >> I don't understand that solution(sorry, newby here). Should I implement >> that code in the META-INF? How could I load it from the .java classes? >> >> Hi Neil: >> >> NewFileInputStream, getResourceasStream, ... don't work to load files from >> outside the classpath. They do work inside Eclipse-Equinox, but not when you >> export the .jar. I tested them all, I think: >> >> - propertiesFile.load(new FileInputStream("/config/BD.properties")); >> - InputStream is = >> ConfigIni.class.getResourceAsStream("/config/BD.properties"); >> - InputStream is= >> this.getClass().getResourceAsStream("/BD.properties"); >> >> But they just load dinamically inside Eclipse. >> >> Thanks, >> >> Asier >> >> >> On 1 February 2010 10:41, Jean-Baptiste Onofré <[email protected]> wrote: >> >>> Hi Neil, >>> >>> The FileInputStream() usage is correct too. I simply focus on another way >>> to do it using blueprint :) >>> >>> Regards >>> JB >>> >>> >>> Neil Bartlett wrote: >>> >>>> Sorry if I am missing something obvious, but what is wrong with "new >>>> FileInputStream(...)" ? >>>> >>>> Neil >>>> >>>> On Mon, Feb 1, 2010 at 9:12 AM, Asier Aranbarri Beldarrain >>>> <[email protected]> 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 >>>> >>> _______________________________________________ >>> 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 >> > > > _______________________________________________ > 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
