Thanks Johan. I will look into the CM properties. It is new to me.  


Johan Edstrom-3 wrote:
> 
> You could us CM Properties for this.
> It'll create a Dictionary of properties that you can export, or populate
> via a config file
> 
> ServiceReference ref =
> context.getServiceReference(ConfigurationAdmin.class.getName());
>         ConfigurationAdmin cs = (ConfigurationAdmin)
> context.getService(ref);
>      
>         org.osgi.service.cm.Configuration conf =
> cs.getConfiguration("superduper", null);
>         Dictionary<Object, Object> props = conf.getProperties();
>         if (props == null) {
>             props = new Properties();
>         }
> 
>        
>         props.put("hibernate.dialect",
> "org.hibernate.dialect.HSQLDialect");
>         props.put("hibernate.show_sql", "false");
>         props.put("hibernate.jdbc.batch_size", "0");
>         props.put("jdbc.driverClassName", "org.hsqldb.jdbcDriver");
>         props.put("jdbc.url",
> "jdbc:hsqldb:hsql://localhost/wcsri_pubsub");
>         props.put("jdbc.username", "sa");
>         props.put("jdbc.password", "");
>         props.put("jdbc.initialSize", "5");
>         props.put("jdbc.maxActive", "10");
>         props.put("jdbc.maxIdle", "10");
>         props.put("jdbc.defaultAutoCommit", "false");
>         props.put("transactionType", "RESOURCE_LOCAL");
>            */
>         conf.update(props);
> 
> You can then access this service, both via spring, blueprint and or purely
> as osgi.
> 
> On May 5, 2010, at 10:04 AM, gnanda wrote:
> 
>> 
>> Hi all,
>> I have a scenario where I need to create a singleton pojo class that will
>> be deployed in smx (as OSGI service?) and could be started and stopped
>> from
>> management command. This class would contain a hashmap of some business
>> entities reading from the database and cache in memory. The memory will
>> be
>> refreshed re-reading again on a notification send to the bean ( Not sure
>> yet, how to do this part though)
>> 
>> I have 2 more service assemblies deployed and they need to lookup entity
>> by
>> calling the above singleton bean class. My knowledge with SA and OSGI is
>> not
>> very clear. 
>> 
>> I have questions below
>> 
>> 1)Should I create a serviceassemby containg one su having the  smx-bean
>> defined in it? or should I create an OSGI service wrapping up a POJO
>> class? 
>> 
>> 2)Can one su inside a SA call another su deployed inside another SA?
>> 
>> 3)When I list my SAs from karaf console by "list" command. Thay do not
>> have
>> "started" status though my SAs work as expected. Does that mean SA do not
>> have service life cycle ?
>> 
>> Please suggest
>> 
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/smx4.2-singleton-bean-class-with-its-own-service-life-cycle-tp28462815p28462815.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
> 
> Johan Edstrom
> 
> [email protected]
> 
> They that can give up essential liberty to purchase a little temporary
> safety, deserve neither liberty nor safety.
> 
> Benjamin Franklin, Historical Review of Pennsylvania, 1759
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/smx4.2-singleton-bean-class-with-its-own-service-life-cycle-tp28462815p28474377.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to