sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: [DISCUSS] Generic ServiceMap for ServiceResolver
Date Wed, 02 Oct 2013 14:11:01 GMT
Ok, so you're basically suggesting an extension mechanism comparable to the
adapter pattern?

Carsten


2013/10/2 Mike Hummel <mh@mikehummel.de>

> In my understanding the service registry is not able to differ between the
> resource implementations like mongo or jcr. If the operation is provided
> from the resource provider it is specialised for the underlying
> implementation.
>
> This is what you need for ResourceSecurityAccess or manipulating rights on
> the resource - without knowledge of the underlying data store.
>
>
> 2013/10/1 Carsten Ziegeler <cziegeler@apache.org>
>
> > Hi,
> >
> > I'm not sure I completely understand your proposal. What's the difference
> > to looking up the MoveOperation (or other services) directly from the
> > service registry?
> >
> > Carsten
> >
> >
> > 2013/9/30 Mike Hummel <mh@mikehummel.de>
> >
> > > Hi,
> > >
> > > with ResourceAccessSecurity there's the first service depending on the
> > > ServiceResolver and loaded by the ServiceTracker. For further services
> we
> > > should use a generic way to handle this.
> > >
> > > Another goal is that we can implement operations in this way for
> > different
> > > ServiceResolver in a generic way. For example default operations like
> > > 'move' 'copy' 'checkout' 'checkin' can then be implemented for
> different
> > > Resources (jcr, mongodb).
> > >
> > > On next step it can be used by the post servlet to access it via REST.
> > >
> > > I implemented a try like this
> > >
> > > public interface ServiceMap {
> > >
> > >
> > >  /**
> > >
> > >  * Return the instance of the Service for the requested interface
> > >
> > >  *
> > >
> > >  * @param requestedInterface The Service or null if not found
> > >
> > >  * @return
> > >
> > >  */
> > >
> > > <T> T getService(Class<T> requestedInterface);
> > >
> > >  }
> > >
> > > public interface ResourceResolver {
> > >
> > > …
> > >
> > >     /**
> > >
> > >      * Return the service map for this resolver.
> > >
> > >      *
> > >
> > >      * @return
> > >
> > >      */
> > >
> > >     ServiceMap getServiceMap();
> > >
> > > }
> > >
> > > To use a service use
> > >
> > > ResourceAccessSecurity  service =
> > >
> > >
> >
> resource.getResourceResolver().getServiceMap().getService(ResourceAccessSecurity.class);
> > >
> > > or maybe
> > >
> > > MoveOperation  service =
> > >
> > >
> >
> resource.getResourceResolver().getServiceMap().getService(MoveOperation.class);
> > > service.move(resource,targetPath);
> > >
> > > Ok, what's the goal?
> > >
> > > 1. We do not need to change resource providers if we initiate a new
> > service
> > > for resources
> > > 2. A generic way to access operations if the service implement an
> > > Operation-Interface via REST / Post-Servlet
> > >
> > > What do you think?
> > >
> > > Mike
> > >
> >
> >
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
> >
>



-- 
Carsten Ziegeler
cziegeler@apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message