Injecting OSGI services using sling models

2014-11-19 Thread Hass Joseph Khafaji
Hello, I am trying to inject OSGI service defined using scr annotation into a sling model class using the @inject annotation. What we seem to be getting is that the ModelAdapterFactory is unable to inject the service into the corresponding field as if it was an incompatible type. We not

Re: Injecting OSGI services using sling models

2014-11-19 Thread Sarwar Bhuiyan
The model is not an OSGi service/component right? I'm not sure of why you need a reference to an osgi service in the model but you can probably use a setter by yourself but I still think you can just have another service which does the action on the model instead of the model calling the service.

Re: Injecting OSGI services using sling models

2014-11-19 Thread Sarwar Bhuiyan
Could you paste that bit of code please? On Wednesday, November 19, 2014, Hass Joseph Khafaji hasanein@gmail.com wrote: The model is simply a sling model class, not an osgi service at all. The model is being looked up via slightly, thus it has to be fully populated when that happen which

Re: including transitive dependencies in sling bundles

2014-11-19 Thread Bertrand Delacretaz
Hi, On Wed, Nov 19, 2014 at 1:39 AM, Bruce Edge bruce.e...@nextissuemedia.com wrote: ...What is the preferred way to include a bundle's transitive dependencies in the jar that is deployed to the OGSI service?... The preferred way is not to embed them but rather deploy them as separate bundles.

Re: Injecting OSGI services using sling models

2014-11-19 Thread Felix Meschberger
Hi Could it be that you announce the component to be „ManagedService“ but the class does not implement it and thus the component cannot be instantiated at all ? Regards Felix Am 19.11.2014 um 12:32 schrieb Hasanein Khafaji hasanein@gmail.com: Let's assume that Bundle A defines a

Re: Injecting OSGI services using sling models

2014-11-19 Thread Hasanein Khafaji
Sorry, I forgot to add that. It implements ManagedService. Do you think it has anything to do with the fact that the interface and the implementation are in different bundles, thus get loaded by a different class loader? and end up being incompatible when reflection is used to set one type to the

RE: Injecting OSGI services using sling models

2014-11-19 Thread Jason Bailey
That's an usual problem you're having. You should be able to see the service you've defined in the OSGi panel before executing the request that creates the model. -Jason From: Hasanein Khafaji hasanein@gmail.com Sent: Wednesday, November 19, 2014

Re: Injecting OSGI services using sling models

2014-11-19 Thread Hasanein Khafaji
From OSGi point of view, the service is active and the component is marked as satisfied. An instance of the component is being obtained from OSGi but it only fails when the ModelAdapterFactory tries to inject this back into the model class. Here is the method from the ModelAdapterFactory where