What if you use @Reference with ReferenceCardinality set
ReferenceCardinality.OPTIONAL_MULTIPLE. Then you would get bind and
unbind callbacks
Have a look at Sling AdapterManagerImpl [1] which uses this approach
(though it uses Javadoc based SCR config mechanism). Same thing done
using annotations would look like
@Reference(
        name="AdapterFactory",
        referenceInterface = org.apache.sling.api.adapter.AdapterFactory.class,
        cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE,
        policy = ReferencePolicy.DYNAMIC
)
And then you add
protected void bindAdapterFactory(ServiceReference reference)
protected void unbindAdapterFactory(ServiceReference reference)

Chetan Mehrotra
[1] http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java

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

Reply via email to