Hi, On 22.02.11 11:25, "Jean-Baptiste Reich" <[email protected]> wrote:
>Thank you for your answer. > >I can't use annotations so I guess that I can declare my component in the >metadata.xml like this: > ><component classname="test.MyService" name="MyService" public="false"> > <provides /> > <properties pid="test.MyService"> > > ... > > </properties></component> > > ><instance ...> > ></instance> > > >But in the xml file we do not specify if it is a ManagedService or a >ManagedServiceFactory ? How can I know which service is registered ? In the above xml files, only the managed service will be registered as the factory is not public. You set the managed service pid to test.MyService. Note that managed service and managed service factories cannot have the same pid. If you want, you can also specify the managed service pid in your instance declaration: <instance component="...MyComponent"> <property name="managed.service.pid" value="my.pid"/> </instance> Regards, Clement > > >Thank you > > >2011/2/21 Clement Escoffier <[email protected]> > >> Hi, >> >> On 21.02.11 16:26, "Jean-Baptiste Reich" <[email protected]> >> wrote: >> >> >Hello, >> > >> >I am reading the iPOJO documentation but I don't see how I can handle >>the >> >creation of a singleton component when a configuration in config admin >>is >> >there. >> >My problem is to wait until a configuration is available for a given >>pid >> >and >> >to create the unique instance of my component at that moment. >> > >> >I have seen that I could declare a factory on my component which >>results >> >in >> >the creation of a ManagedServiceFactory but with that I can't limit the >> >number of instances... >> > >> >Another way is to declare a private component with a pid and to >>declare my >> >single instance in the metadata.xml but like this my object is created >> >even >> >if I don't have configuration in config admin... >> > >> >Is there a way to do that ? >> >> You can also expose a ManagedService using: >> @Component(managedservice=pid, publicFactory=false) >> >> Where pid is the desired managed service pid. >> >> Regards, >> >> Clement >> >> > >> >Thanks >> >> >> >> --------------------------------------------------------------------- >> 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]

