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 Tue, 01 Oct 2013 12:59:37 GMT
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

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