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.

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
>

Reply via email to