karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Achim Nierbeck <bcanh...@googlemail.com>
Subject Re: Managed Properties question
Date Mon, 20 Dec 2010 16:51:22 GMT
This is a short example on how I did it with spring-dm should be
comparable:

<!-- Configuration Admin Service Factory -->
<osgix:managed-service-factory
factory-pid="my.own.factory.pid"
interface="my.own.interface"
update-strategy="bean-managed" update-method="setProperties">
<bean id="theBeanID"
class="my.own.ClassImplementingInterface" >
<property name="propA" />
<property name="propB" />
<!-- these properties can also be leaved blank I think. -->
</bean>
</osgix:managed-service-factory>

This one works.


2010/12/20 karafman <mvangeertruy@comcast.net>

>
> It still isn't working.
>
> Here's an excerpt of my .cfg file (none of the names in the file have any
> characters other than [a-z, A-Z]:
> myAppDbShowSql = false
> myAppDbFormatSql = false
>
> In the file where I get my service I have:
> <osgix:cm-properties id="myAppDatabaseProperties"
> persistent-id="myApp.data.access"/>
> ctx:property-placeholder properties-ref="myAppDatabaseProperties"/>
>
> In the file where I am using the managed service I have (unnecessary bits
> removed):
> <bean id="myAppSessionFactory"
> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
> p:dataSource-ref="myAppPoolDataSource">
>  <osgix:managedProperties persistent-id="myApp.data.access"
> update-strategy="container-managed"/>
>  <property name="mappingResources">
>   <list>hibernate valies</list>
>  </property>
>  <property name="hibernateProperties">
>    <props>
>     <prop key="hibernate.show_sql">${myAppDbShowSql}</prop>
>     <prop key="hibernate.format_sql">${myAppDbFormatSql}</prop>
>    </props>
>   </property>
> </bean>
>
> When I change the values in my .cfg file, I can see those changes being
> populated by doing a config:list.
>
> However, I get the following error in my log:
> Configuration for myApp.data.access has already been used for service
> [org.osgi.service.cm.ManagedService, id=127, bundle=89] and will be also
> given to [org.osgi.service.cm.ManagedService, id=128, bundle=89]
>
> When I restart bundle 89, the properties are properly consumed.
>
> Anyone know what's going wrong?
>
>
> -----
> Karafman
> Slayer of the JEE
> Pounder of the Perl Programmer
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Managed-Properties-question-tp2107407p2121172.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Mime
View raw message