You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Rice Yeh <ri...@gmail.com> on 2011/02/10 08:44:08 UTC

[KARAF] ManagedServiceFactory.updated not called

Hi,
  I have registered a ManagedServiceFactory service in an activator:

                Dictionary properties = new Hashtable();
                properties.put(Constants.SERVICE_PID,
"xs.persistence.hibernate.session.factory");
                this.hibernateConfigurationFactoryService =
                        context.registerService(

ManagedServiceFactory.class.getName(),
                                        new HibernateConfigurationFactory(),

                                        properties);

Then I put a file called xs.persistence.hibernate.session.factory.cfg under
the etc directory. With config:list, I can find the configuration is noticed
by configuration admin service. However, why the updated method of
HibernateConfigurationFactory( implementation of ManagedServiceFactory)  is
never called? What more should I do?

Rice

Re: [KARAF] ManagedServiceFactory.updated not called

Posted by Rice Yeh <ri...@gmail.com>.
I just found the documentation. It is in the 4.6 of the user guide.

Rice

On Thu, Feb 10, 2011 at 4:50 PM, Rice Yeh <ri...@gmail.com> wrote:

> Hi Felix,
>   So you mean what I need to do is to rename the file
> xs.persistence.hibernate.
> session.factory.cfg to xs.persistence.hibernate.
> session.factory-pidalias.cfg? What is meant by --pidalias ? It is a
> variable that I should replace with some pid alias value?
>
> Rice
>
>
> On Thu, Feb 10, 2011 at 3:51 PM, Felix Meschberger <fm...@adobe.com>wrote:
>
>> Hi,
>>
>> Am Donnerstag, den 10.02.2011, 07:44 +0000 schrieb Rice Yeh:
>> > Hi,
>> >   I have registered a ManagedServiceFactory service in an activator:
>> >
>> >                 Dictionary properties = new Hashtable();
>> >                 properties.put(Constants.SERVICE_PID,
>> > "xs.persistence.hibernate.session.factory");
>> >                 this.hibernateConfigurationFactoryService =
>> >                         context.registerService(
>> >
>> > ManagedServiceFactory.class.getName(),
>> >                                         new
>> HibernateConfigurationFactory(),
>> >
>> >                                         properties);
>> >
>> > Then I put a file called xs.persistence.hibernate.session.factory.cfg
>> under
>> > the etc directory. With config:list, I can find the configuration is
>> noticed
>> > by configuration admin service. However, why the updated method of
>> > HibernateConfigurationFactory( implementation of ManagedServiceFactory)
>>  is
>> > never called? What more should I do?
>>
>> Not really, 100% sure. But it looks like you are creating a regular
>> configuration and not a factory configuration. For the
>> ManagedServiceFactory to be called you have to create a factory
>> configuraiton.
>>
>> Again, I am not sure, but I think this would be done if you call your
>> configuration file something like
>> xs.persistence.hibernate.session.factory-pidalias.cfg
>>
>> This should create a factory configuration with factory PID
>> xs.persistence.hibernate.session.factory and an automatically generated
>> PID and provide this to your ManagedServiceFactory.
>>
>> Regards
>> Felix
>>
>> >
>> > Rice
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>

Re: [KARAF] ManagedServiceFactory.updated not called

Posted by Rice Yeh <ri...@gmail.com>.
Hi Felix,
  So you mean what I need to do is to rename the file
xs.persistence.hibernate.
session.factory.cfg to xs.persistence.hibernate.
session.factory-pidalias.cfg? What is meant by --pidalias ? It is a variable
that I should replace with some pid alias value?

Rice


On Thu, Feb 10, 2011 at 3:51 PM, Felix Meschberger <fm...@adobe.com>wrote:

> Hi,
>
> Am Donnerstag, den 10.02.2011, 07:44 +0000 schrieb Rice Yeh:
> > Hi,
> >   I have registered a ManagedServiceFactory service in an activator:
> >
> >                 Dictionary properties = new Hashtable();
> >                 properties.put(Constants.SERVICE_PID,
> > "xs.persistence.hibernate.session.factory");
> >                 this.hibernateConfigurationFactoryService =
> >                         context.registerService(
> >
> > ManagedServiceFactory.class.getName(),
> >                                         new
> HibernateConfigurationFactory(),
> >
> >                                         properties);
> >
> > Then I put a file called xs.persistence.hibernate.session.factory.cfg
> under
> > the etc directory. With config:list, I can find the configuration is
> noticed
> > by configuration admin service. However, why the updated method of
> > HibernateConfigurationFactory( implementation of ManagedServiceFactory)
>  is
> > never called? What more should I do?
>
> Not really, 100% sure. But it looks like you are creating a regular
> configuration and not a factory configuration. For the
> ManagedServiceFactory to be called you have to create a factory
> configuraiton.
>
> Again, I am not sure, but I think this would be done if you call your
> configuration file something like
> xs.persistence.hibernate.session.factory-pidalias.cfg
>
> This should create a factory configuration with factory PID
> xs.persistence.hibernate.session.factory and an automatically generated
> PID and provide this to your ManagedServiceFactory.
>
> Regards
> Felix
>
> >
> > Rice
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: [KARAF] ManagedServiceFactory.updated not called

Posted by Felix Meschberger <fm...@adobe.com>.
Hi,

Am Donnerstag, den 10.02.2011, 07:44 +0000 schrieb Rice Yeh: 
> Hi,
>   I have registered a ManagedServiceFactory service in an activator:
> 
>                 Dictionary properties = new Hashtable();
>                 properties.put(Constants.SERVICE_PID,
> "xs.persistence.hibernate.session.factory");
>                 this.hibernateConfigurationFactoryService =
>                         context.registerService(
> 
> ManagedServiceFactory.class.getName(),
>                                         new HibernateConfigurationFactory(),
> 
>                                         properties);
> 
> Then I put a file called xs.persistence.hibernate.session.factory.cfg under
> the etc directory. With config:list, I can find the configuration is noticed
> by configuration admin service. However, why the updated method of
> HibernateConfigurationFactory( implementation of ManagedServiceFactory)  is
> never called? What more should I do?

Not really, 100% sure. But it looks like you are creating a regular
configuration and not a factory configuration. For the
ManagedServiceFactory to be called you have to create a factory
configuraiton.

Again, I am not sure, but I think this would be done if you call your
configuration file something like
xs.persistence.hibernate.session.factory-pidalias.cfg

This should create a factory configuration with factory PID
xs.persistence.hibernate.session.factory and an automatically generated
PID and provide this to your ManagedServiceFactory.

Regards
Felix

> 
> Rice



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org