Hi,

Am 25.10.2011 um 13:13 schrieb Olaf Otto:

> Hi,
> 
> I am trying to create a ManagedServiceFactory implementation and have so 
> far failed to get it to work using SCR metadata. The plugin 
> documentation is somewhat confusing; is it impossible to use a dynamic 
> service declaration for a ManagedServiceFactory? 

Yes, you have to set the configurationFactory attribute of the @Component 
annotation to true. This will generate a Metatype descriptor indicating factory 
configurations.

There is no need to implement the ManagedFactory interface. SCR will create an 
instance of the component for each factory configuration instance for you.

Regards
Felix


> (http://felix.apache.org/site/apache-felix-maven-scr-plugin.html)
> 
> What I have is this
> 
> @Service(ManagedServiceFactory.class)
> @Component(label = "Test service factory", metatype = true)
> @Properties({
>     @Property(name = "service.pid", value = 
> "org.acme.FactoredType.factory")
> })
> public class TestServiceFactory implements ManagedServiceFactory {
>  @Property(value = "defaultValue")
>  public static final String SOME_PROPERTY = "someProperty";
>  // implementation...
> }
> 
> However The service shows up like a regular Service in the felix config 
> admin. I can edit the @Property, and the config is persisted in the 
> admin service, however none of the implemented ManagedServiceFactory 
> methods get called. Do I need to use the factory... properties of the 
> @Component annotation? Is it necessary to manually register the service?
> 
> Any hint is appreciated!
> Thanks,
> Olaf
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to