On Sun, Jul 7, 2013 at 3:45 PM, Ian Boston <[email protected]> wrote:
> On Sunday, July 7, 2013, Dishara Wijewardana wrote:
>
> > On Fri, Jul 5, 2013 at 10:47 AM, Ian Boston <[email protected]<javascript:;>>
> > wrote:
> >
> > > Hi Dishara,
> > >
> > > It does,
> > >
> > > All you need to do, in a OSGI Component annotated with @Component is
> add
> > a
> > > private property and annotate it with @Reference. Eg
> > >
> > > @Reference
> > > private ResourceResolver resourceResolver;
> > >
> > > When the component is activated, the ResourceResolver implementation
> will
> > > in set.
> > >
> > Do we already have a such getter to re use ? In that case I would not
> need
> > to define a resolver variable inside my module.
>
>
> Hi,
>
>
>
>
>
>
>
> IIRC When the class is processed by the Felix scr plugin, it creates getter
> and setter methods for you. If the class is annotated with @Component, the
> scr plugin will create a XML file under OSGI-INF informing the OSGI
> container what services the component depends on. If those services are not
> present in the container, the container won't start the component. In this
> case ResourceResolver is present in one of the core Sling bundles.
>
> When unit testing, the best way of setting the resourceResolver is to use
> reflection to set the property to a mock ResourceResolver created by
> mockito.
>
Hi,
I was got stuck where to find the resolver (according to my
understanding). To set the resolver through reflection, I need to get a
real resolver reference instance.
So as you mentioned (" In this case ResourceResolver is present in one of
the core Sling bundles."), can you point me the class which holds the
reference to the resolver which should be a getter and I can obtain the
resolver reference from reflection. Is there a better way? Forgive If I am
out of the path, I am not quite good at OSGi stuff yet.
Also is there any class that I can refer which has done kind of the same
thing
>
> I am on an iPad at the moment so don't have easy access to the code base.
> If you need more pointers email the list back, and someone might be able to
> help further.
>
> If any of that doesn't make sense, just ask for clarification.
>
> Best regards
> Ian
>
>
>
> >
> >
> > >
> > > hTH
> > > Ian
> > >
> > > On Friday, July 5, 2013, Dishara Wijewardana wrote:
> > >
> > > > Hi Ian,
> > > > Does Sling has a Resource Resolver for Cassandra already ? I am in
> the
> > > > process of re factoring the code based on code reviews.
> > > >
> > > > public class CassandraResourceResolver implements ResourceResolver {
> > > > You wont need this implementation. ResourceResolver is implemented
> for
> > > > you, all you need to implement is the resource provider.
> > > >
> > > > What is the name of the resource resolver we already have ? So that I
> > can
> > > > use it directly.
> > > >
> > > >
> > > > --
> > > > Thanks
> > > > /Dishara
> > > >
> > >
> >
> >
> >
> > --
> > Thanks
> > /Dishara
> >
>
--
Thanks
/Dishara