Est-ce que quelqu'un a réussi à partager la configuration entre deux ou plusieurs bundles dans SMX4? Ce que je suis à la recherche est la suivante:Partage d'un fichier de configuration entre des ensembles OSGi dans Apache Servicemix 4?
- Avoir un seul fichier dans
$SMX_HOME/etc/myconfiguration.cfg
- Avez cette configuration être « disponible » à injecter dans mes paquets via la configuration OSGi administration à l'aide dm Spring, à savoir
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:osgix="http://www.springframework.org/schema/osgi-compendium" xmlns:ctx="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd"> <osgix:cm-properties id="cfg" persistent-id="myconfiguration"> <prop key="db.driverClassName">org.postgresql.Driver</prop> <prop key="db.url">jdbc:postgresql://localhost/db</prop> <prop key="db.username">someuser</prop> <prop key="db.password">somepassword</prop> <prop key="amq.brokerURL">vm://default</prop> </osgix:cm-properties> <ctx:property-placeholder properties-ref="cfg" />
Ensuite, je peux injecter des choses comme ça dans mon haricot (s):
. . . <bean id="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="${amq.brokerURL}" /> </bean> . . .
Tout cela n'est que pêche, pour un seul paquet. Ce que je cherche est un moyen de définir cela une fois et ensuite être en mesure de réutiliser le même fichier de configuration en tant que propriétés pour un ensemble de bundles. À l'heure actuelle, j'ai plusieurs paquets, chacun avec sa propre instance de configuration (identifiant persistant) et par conséquent, chaque paquet nécessitant une connexion à une base de données, Java JMS, etc. doit être répété dans chaque fichier.
Actuellement, j'utilise Apache Servicemix 4, qui utilise Apache Felix comme conteneur OSGi.
Votre problème est-il résolu? – FrVaBe
Ouais! Je vous remercie. – snortasprocket