SMX4の2つ以上のバンドル間で構成を正常に共有できた人はいますか?私が探しているのはこれです:
- に単一のファイルがある
$SMX_HOME/etc/myconfiguration.cfg
- この構成を「利用可能」にして、Springdmを使用するOSGi構成管理者を介してバンドルに注入できるようにします。
<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" 永続的-id="myconfiguration"> <prop key = "db.driverClassName"> org.postgresql.Driver </ prop> <prop key = "db.url"> jdbc:postgresql:// localhost / db </ prop> <propkey="db.username">一部のユーザー</prop> <prop key = "db.password"> somepassword </ prop> <prop key = "amq.brokerURL"> vm:// default </ prop> </ osgix:cm-properties> <ctx:property-placeholderproperties-ref = "cfg" />
次に、次のようなものをBeanに注入できます。
。 。 。 <bean id = "activeMqConnectionFactory" class = "org.apache.activemq.ActiveMQConnectionFactory"> <property name = "brokerURL" value = "$ {amq.brokerURL}" /> </ bean> 。 。 。
単一のバンドルの場合、それはすべて桃色です。私が探しているのは、これを一度定義してから、バンドルのセットのプロパティと同じ構成ファイルを再利用できるようにする方法です。現在、複数のバンドルがあり、それぞれに独自の構成インスタンス(永続ID)があるため、データベース接続やJava JMSなどを必要とする各バンドルでは、すべてのファイルで構成を繰り返す必要があります。
現在、OSGiコンテナーとしてApacheFelixを使用しているApacheServicemix4を使用しています。