2008/5/7 jaredmac <[EMAIL PROTECTED]>:

>
>
> Felix Meschberger-2 wrote:
> >
> > Not as per the OSGi framework specification. You might of course - as I
> > said above - create a FooFactory and register that factory as a service.
> > Your application would then get the FooFactory service and ask that
> > FooFactory for Foo instances.
> >
> > Hope this helps.
> >
>
> Great, thank you - that does help. A FooFactory is exactly where I was
> headed, and I wanted to make sure that I wasn't creating extra work for
> myself if there were some factory-like capabilities built in to OSGi.
>

Actually there are factory concepts built into OSGi which let you create
new service instances on demand, and tailor them per client request...

For plain services you'd need to implement the ServiceFactory API
(see section 5.6, page 117 of the core spec)

For configurable services you'd use ManagedServiceFactory instead
(see section 104.6, page 77 of the compendium spec)

For component services, ie. DS, you would use a factory component
(see section 112.2.4, page 286 of the compendium spec) - the SCR
bundle will register a ComponentFactory service using the factory id
on behalf of the providing bundle, which client bundles can then use
to create component instances (see the newInstance method)

HTH - the core and compendium specs have better explanations :)

   http://www.osgi.org/Specifications/HomePage

Thanks again,
> Jared
> --
> View this message in context:
> http://www.nabble.com/Are-service-implementors-inherently-singletons--tp17090261p17092093.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Cheers, Stuart

Reply via email to