Sling
  1. Sling
  2. SLING-1262

Implement ResourceResolverFactory concept

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JCR Resource 2.0.6, API 2.0.8
    • Fix Version/s: JCR Resource 2.0.8, API 2.1.0
    • Component/s: API, JCR
    • Labels:
      None

      Activity

      Hide
      Justin Edelson added a comment -

      can this be marked as resolved?

      Show
      Justin Edelson added a comment - can this be marked as resolved?
      Hide
      Carsten Ziegeler added a comment -

      Merged the two factories into a single component; factored out the resource provider handling

      Show
      Carsten Ziegeler added a comment - Merged the two factories into a single component; factored out the resource provider handling
      Hide
      Carsten Ziegeler added a comment - - edited

      Implemented the close() method in the JcrResourceResolver

      Show
      Carsten Ziegeler added a comment - - edited Implemented the close() method in the JcrResourceResolver
      Hide
      Carsten Ziegeler added a comment -

      Hmm, no I don't think that so - our docs for the SlingException state that SlingException (and sub classes) are not meant to be catched by client code.
      A LoginException is something you definitly want to catch and do somethin

      Show
      Carsten Ziegeler added a comment - Hmm, no I don't think that so - our docs for the SlingException state that SlingException (and sub classes) are not meant to be catched by client code. A LoginException is something you definitly want to catch and do somethin
      Hide
      Felix Meschberger added a comment -

      Sorry, to be a PITA: Shouldn't LoginException extend SlingException ?

      Show
      Felix Meschberger added a comment - Sorry, to be a PITA: Shouldn't LoginException extend SlingException ?
      Hide
      Carsten Ziegeler added a comment -

      Ups, right

      Ok, I've added the LoginException to the api and added a first simple implementation to the jcr resource bundle.

      Show
      Carsten Ziegeler added a comment - Ups, right Ok, I've added the LoginException to the api and added a first simple implementation to the jcr resource bundle.
      Hide
      Felix Meschberger added a comment -

      > What happens if a login fails?

      This is actually described on the wiki page: A LoginException is thrown.

      Show
      Felix Meschberger added a comment - > What happens if a login fails? This is actually described on the wiki page: A LoginException is thrown.
      Hide
      Carsten Ziegeler added a comment -

      As discussed on the mailing list, I reverted to a close() method on the resource resolver.

      The question is now, what exceptions do we except to be thrown by the factory?
      What happens if a login fails?

      Show
      Carsten Ziegeler added a comment - As discussed on the mailing list, I reverted to a close() method on the resource resolver. The question is now, what exceptions do we except to be thrown by the factory? What happens if a login fails?
      Hide
      Carsten Ziegeler added a comment -

      I've added a first version of the ResourceResolverFactory to the API in revision 918645

      Rethinking this, I think we should rather add a dispose method to the factory than a close method to the resource resolver itself. This makes the lifecycle a little bit more obvious and prevents clients from calling the close method. Only the code who created the resource resolver has the factory and can therefore dispose the resource resolver

      Show
      Carsten Ziegeler added a comment - I've added a first version of the ResourceResolverFactory to the API in revision 918645 Rethinking this, I think we should rather add a dispose method to the factory than a close method to the resource resolver itself. This makes the lifecycle a little bit more obvious and prevents clients from calling the close method. Only the code who created the resource resolver has the factory and can therefore dispose the resource resolver
      Hide
      Carsten Ziegeler added a comment -

      We also need support for impersonation:
      Instead of providing a separate method we define a constant for a sudo user property. If this is set in the map passed to getResourceResolver or getAdmin...RR, the factory internally does the login and then sudo's the resource resolver and only returns the sudo'ed one.
      This makes handling impersonation easier

      Show
      Carsten Ziegeler added a comment - We also need support for impersonation: Instead of providing a separate method we define a constant for a sudo user property. If this is set in the map passed to getResourceResolver or getAdmin...RR, the factory internally does the login and then sudo's the resource resolver and only returns the sudo'ed one. This makes handling impersonation easier
      Hide
      Carsten Ziegeler added a comment -

      We should pass an (optional) map into getAdministrativeResourceResolver() for further information like workspace etc. But this should be optional

      Show
      Carsten Ziegeler added a comment - We should pass an (optional) map into getAdministrativeResourceResolver() for further information like workspace etc. But this should be optional
      Hide
      Carsten Ziegeler added a comment -

      I think as a first step we should:

      • introduce the ResourceResolverFactory interface in the API with the following methods:
      • getResourceResolver(Map)
      • getAdministrativeResourceResolver()
      • add the close() methode to the ResourceResolver

      Support for anonymous login: if the provided map to getResourceResolver does not contain a user name and no credentials object, anonymous login is tried

      Show
      Carsten Ziegeler added a comment - I think as a first step we should: introduce the ResourceResolverFactory interface in the API with the following methods: getResourceResolver(Map) getAdministrativeResourceResolver() add the close() methode to the ResourceResolver Support for anonymous login: if the provided map to getResourceResolver does not contain a user name and no credentials object, anonymous login is tried
      Hide
      Felix Meschberger added a comment -
      Show
      Felix Meschberger added a comment - Starting prototype implementation in http://svn.apache.org/repos/asf/sling/whiteboard/fmeschbe/resource

        People

        • Assignee:
          Felix Meschberger
          Reporter:
          Felix Meschberger
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development