incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1345510 - in /sling/whiteboard/SLING-2396: api/src/main/java/org/apache/sling/api/resource/ jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/ resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl...
Date Sat, 02 Jun 2012 14:08:54 GMT
Author: cziegeler
Date: Sat Jun  2 14:08:53 2012
New Revision: 1345510

URL: http://svn.apache.org/viewvc?rev=1345510&view=rev
Log:
SLING-2396 : Add new resource provider interfaces (WiP)

Added:
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
  (contents, props changed)
      - copied, changed from r1343698, sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributesProvider.java
Removed:
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributesProvider.java
Modified:
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/DynamicResourceProvider.java
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
    sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
    sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
    sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
    sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryImpl.java
    sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/RootResourceProviderEntry.java

Copied: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
(from r1343698, sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributesProvider.java)
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java?p2=sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java&p1=sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributesProvider.java&r1=1343698&r2=1345510&rev=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributesProvider.java
(original)
+++ sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
Sat Jun  2 14:08:53 2012
@@ -25,12 +25,16 @@ import java.util.Collection;
  * It allows to add attributes to the set of available attributes from a
  * resource resolver.
  *
+ * This extension is supported for services directly implementing the
+ * {@link ResourceProvider} interface and {@link ResourceProvider}s
+ * returned through a {@link ResourceProviderFactory}.
+ *
  * @see ResourceResolver#getAttribute(String)
  * @see ResourceResolver#getAttributeNames()
  *
  * @since 2.2
  */
-public interface AttributesProvider {
+public interface AttributableResourceProvider {
 
     /**
      * Returns a collection of attribute names whose value can be retrieved

Propchange: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/DynamicResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/DynamicResourceProvider.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/DynamicResourceProvider.java
(original)
+++ sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/DynamicResourceProvider.java
Sat Jun  2 14:08:53 2012
@@ -27,7 +27,14 @@ package org.apache.sling.api.resource;
  * connection to the system is dynamic and might go away (due to network
  * changes, updates etc.).
  *
+ * The {@link #isLive()} method can be called to check whether the
+ * provider is still active.
+ * The {@link #close()} method should be called to free any resources
+ * held by this resource provider.
+ *
  * @see ResourceProviderFactory#getResourceProvider(java.util.Map)
+ * @see ResourceProviderFactory#getAdministrativeResourceProvider(java.util.Map)
+ *
  * @since 2.2
  */
 public interface DynamicResourceProvider {

Modified: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
(original)
+++ sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
Sat Jun  2 14:08:53 2012
@@ -25,6 +25,12 @@ import java.util.Map;
 /**
  * A queriable resource provider is an extension of a resource provider.
  *
+ * This extension is supported for services directly implementing the
+ * {@link ResourceProvider} interface and {@link ResourceProvider}s
+ * returned through a {@link ResourceProviderFactory}.
+ *
+ * TODO - what should the resource provider do, if the language is not supported?
+ *
  * @since 2.2.0
  */
 public interface QueriableResourceProvider {

Modified: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
(original)
+++ sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
Sat Jun  2 14:08:53 2012
@@ -29,8 +29,14 @@ import org.apache.sling.api.SlingExcepti
  * transparently access resources from different locations such as a JCR
  * repository (the default) or OSGi bundles.
  * <p>
- * This interface is intended to be implemented by providers of Resource instances on behalf
of the {@link ResourceResolver}. It
- * is not intended to be used by client applications directly.
+ * This interface is intended to be implemented by providers of resource
+ * instances on behalf of the {@link ResourceResolver}. It
+ * is not intended to be used by client applications directly. A resource
+ * provider can either directly implement this service interface, e.g.
+ * when no user authentication is provided (like for bundle resources)
+ * or a {@link ResourceProviderFactory} service can be implemented which
+ * upon successful authentication returns a resource provider with the
+ * given user credentials.
  */
 public interface ResourceProvider {
 
@@ -52,7 +58,7 @@ public interface ResourceProvider {
      * resource
      * tree down to a deeply nested provided resource which has no concrete
      * parent hierarchy (value is"sling:syntheticResourceProviderResource").
-     * 
+     *
      * @see #listChildren(Resource)
      */
     String RESOURCE_TYPE_SYNTHETIC = "sling:syntheticResourceProviderResource";
@@ -64,7 +70,7 @@ public interface ResourceProvider {
      * This method is called to resolve a resource for the given request. The properties
of the request, such as request
      * parameters, may be use to parametrize the resource resolution. An example of such
parametrization is support for a JSR-311
      * style resource provider to support the parametrized URL patterns.
-     * 
+     *
      * @param resourceResolver
      *            The {@link ResourceResolver} to which the returned {@link Resource} is
attached.
      * @return <code>null</code> If this provider does not have a resource for
@@ -73,12 +79,13 @@ public interface ResourceProvider {
      *             may be thrown in case of any problem creating the <code>Resource</code>
instance.
      * @deprecated since 2.3.0 (and JCR Resource 2.1.0), this method will not be invoked.
      */
+    @Deprecated
     Resource getResource(ResourceResolver resourceResolver, HttpServletRequest request, String
path);
 
     /**
      * Returns a resource from this resource provider or <code>null</code> if
      * the resource provider cannot find it. The path should have one of the {@link #ROOTS}
strings as its prefix.
-     * 
+     *
      * @param resourceResolver
      *            The {@link ResourceResolver} to which the returned {@link Resource} is
attached.
      * @return <code>null</code> If this provider does not have a resource for
@@ -100,7 +107,7 @@ public interface ResourceProvider {
      * The returned iterator may in turn contain resources which do not actually exist but
are required to traverse the resource
      * tree. Such resources SHOULD be {@link SyntheticResource} objects whose resource type
MUST be set to
      * {@link #RESOURCE_TYPE_SYNTHETIC}.
-     * 
+     *
      * @param parent
      *            The {@link Resource Resource} whose children are requested.
      * @return An <code>Iterator</code> of {@link Resource} objects or <code>null</code>
if the resource provider has no children

Modified: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java
(original)
+++ sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java
Sat Jun  2 14:08:53 2012
@@ -24,13 +24,19 @@ import java.util.Map;
  * The <code>ResourceProviderFactory</code> defines the service API to get and
  * create <code>ResourceProviders</code>s.
  * <p>
- * If the resource provider is not used anymore and implements the {@link java.io.Closeable}
+ * If the resource provider is not used anymore and implements the {@link DynamicResourceProvider}
  * interface, the close method should be called.
  *
  * @since 2.2.0
  */
 public interface ResourceProviderFactory {
 
+    /**
+     * A required resource provider factory is accessed directly when a new resource resolver
+     * is created. Only if authentication against all required resource provider factories
+     * is successful, a resource resolver is created by the resource resolver factory.
+     * Boolean service property, default vaule is <code>false</true>
+     */
     String PROPERTY_REQUIRED = "required";
 
     /**
@@ -39,46 +45,44 @@ public interface ResourceProviderFactory
      * Generally this map will contain a user name and password to authenticate.
      * <p>
      * If the <code>authenticationInfo</code> map is <code>null</code>
the
-     * <code>ResourceResolver</code> returned will generally not be authenticated
and only provide
+     * <code>ResourceProvider</code> returned will generally not be authenticated
and only provide
      * minimal privileges, if any at all.
      *
      * @param authenticationInfo
      *            A map of further credential information which may be used by
-     *            the implementation to parametrize how the resource resolver is
+     *            the implementation to parametrize how the resource provider is
      *            created. This may be <code>null</code>.
-     * @return A {@link ResourceResolver} according to the <code>authenticationInfo</code>.
+     * @return A {@link ResourceProvider} according to the <code>authenticationInfo</code>.
      * @throws LoginException
-     *             If an error occurrs creating the new <code>ResourceResolver</code>
with the
-     *             provided credential
-     *             data.
+     *             If an error occurrs creating the new <code>ResourceProvider</code>
with the
+     *             provided credential data.
      */
     ResourceProvider getResourceProvider(Map<String, Object> authenticationInfo) throws
LoginException;
 
     /**
-     * Returns a new {@link ResourceResolver} instance with administrative
+     * Returns a new {@link ResourceProvider} instance with administrative
      * privileges with further configuration taken from the given <code>authenticationInfo</code>
      * map.
      * <p>
      * Note, that if the <code>authenticationInfo</code> map contains the
-     * {@link #USER_IMPERSONATION} attribute the <code>ResourceResolver</code>
returned will only
+     * {@link ResourceResolverFactory#USER_IMPERSONATION} attribute the <code>ResourceProvider</code>
returned will only
      * have administrative privileges if the user identified by the property has administrative
      * privileges.
      * <p>
      * <b><i>NOTE: This method is intended for use by infrastructure bundles
to access the
-     * repository and provide general services. This method MUST not be used to handle client
+     * resource tree and provide general services. This method MUST not be used to handle
client
      * requests of whatever kinds. To handle client requests a regular authenticated resource
-     * resolver retrieved through {@link #getResourceResolver(Map)} must be used.</i></b>
+     * provider retrieved through {@link #getResourceProvider(Map)} must be used.</i></b>
      *
      * @param authenticationInfo
      *            A map of further credential information which may be used by
-     *            the implementation to parametrize how the resource resolver is
+     *            the implementation to parametrize how the resource provider is
      *            created. This may be <code>null</code>.
-     * @return A {@link ResourceResolver} with administrative privileges unless
-     *         the {@link #USER_IMPERSONATION} was set in the <code>authenticationInfo</code>.
+     * @return A {@link ResourceProvider} with administrative privileges unless
+     *         the {@link ResourceResolverFactory#USER_IMPERSONATION} was set in the <code>authenticationInfo</code>.
      * @throws LoginException
-     *             If an error occurrs creating the new <code>ResourceResolver</code>
with the
-     *             provided credential
-     *             data.
+     *             If an error occurrs creating the new <code>ResourceResolverFactory</code>
with the
+     *             provided credential data.
      */
     ResourceProvider getAdministrativeResourceProvider(Map<String, Object> authenticationInfo)
throws LoginException;
 }

Modified: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
(original)
+++ sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
Sat Jun  2 14:08:53 2012
@@ -102,7 +102,9 @@ public interface ResourceResolver extend
      * should be used to resolve the resource.
      *
      * @since 2.1
+     * @deprecated
      */
+    @Deprecated
     String REQUEST_ATTR_WORKSPACE_INFO = ResourceResolver.class.getName()
         + "/use.workspace";
 
@@ -127,8 +129,7 @@ public interface ResourceResolver extend
      * The difference between this method and the {@link #resolve(String)}
      * method is, that this method may take request properties like the scheme,
      * the host header or request parameters into account to resolve the
-     * resource. If the {@link #REQUEST_ATTR_WORKSPACE_INFO} attribute is set,
-     * the given workspace is used to resolve the resource.
+     * resource.
      *
      * @param request The http servlet request object providing more hints at
      *            how to resolve the <code>absPath</code>. This parameter may
be
@@ -186,9 +187,7 @@ public interface ResourceResolver extend
      * anymore. Implementations are expected to implement this method calling
      * the {@link #resolve(HttpServletRequest, String)} where the
      * <code>absPath</code> argument is the result of calling the
-     * <code>getPathInfo()</code> on the <code>request</code> object.
If the
-     * {@link #REQUEST_ATTR_WORKSPACE_INFO} attribute is set, the given
-     * workspace is used to resolve the resource.
+     * <code>getPathInfo()</code> on the <code>request</code> object.
      *
      * @param request The http servlet request object used to resolve the
      *            resource for. This must not be <code>null</code>.

Modified: sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
(original)
+++ sling/whiteboard/SLING-2396/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
Sat Jun  2 14:08:53 2012
@@ -132,35 +132,20 @@ public class ResourceUtil {
         if (path == null || "/".equals(path)) {
             return null;
         }
-        
-        String workspaceName = null;
-        
-        final int wsSepPos = path.indexOf(":/");
-        if (wsSepPos != -1) {
-            workspaceName = path.substring(0, wsSepPos);
-            path = path.substring(wsSepPos + 1);
-        }
 
         // find the last slash, after which to cut off
         int lastSlash = path.lastIndexOf('/');
         if (lastSlash < 0) {
             // no slash in the path
             return null;
-        } else if (lastSlash == 0) {
+        }
+        if (lastSlash == 0) {
             // parent is root
-            if (workspaceName != null) {
-                return workspaceName + ":/";
-            } else {
-                return "/";
-            }
+            return "/";
         }
 
-        String parentPath = path.substring(0, lastSlash);
-        if (workspaceName != null) {
-            return workspaceName + ":" + parentPath;
-        } else {
-            return parentPath;
-        }
+        final String parentPath = path.substring(0, lastSlash);
+        return parentPath;
     }
 
     /**
@@ -170,6 +155,7 @@ public class ResourceUtil {
      * @return The parent resource or null if the rsrc is the root.
      * @deprecated since 2.1.0, use {@link Resource#getParent()} instead
      */
+    @Deprecated
     public static Resource getParent(Resource rsrc) {
         final String parentPath = ResourceUtil.getParent(rsrc.getPath());
         if (parentPath == null) {
@@ -184,6 +170,7 @@ public class ResourceUtil {
      * @throws NullPointerException If <code>rsrc</code> is <code>null</code>.
      * @deprecated since 2.1.0, use {@link Resource#getName()} instead
      */
+    @Deprecated
     public static String getName(Resource rsrc) {
         /*
          * Same as AbstractResource.getName() implementation to prevent problems
@@ -306,6 +293,7 @@ public class ResourceUtil {
      * @see ResourceResolver#listChildren(Resource)
      * @deprecated since 2.1.0, use {@link Resource#listChildren()} instead
      */
+    @Deprecated
     public static Iterator<Resource> listChildren(Resource parent) {
         /*
          * Same as AbstractResource.listChildren() implementation to prevent

Modified: sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
(original)
+++ sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
Sat Jun  2 14:08:53 2012
@@ -38,7 +38,7 @@ import javax.jcr.query.RowIterator;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.sling.api.SlingException;
-import org.apache.sling.api.resource.AttributesProvider;
+import org.apache.sling.api.resource.AttributableResourceProvider;
 import org.apache.sling.api.resource.DynamicResourceProvider;
 import org.apache.sling.api.resource.QueriableResourceProvider;
 import org.apache.sling.api.resource.QuerySyntaxException;
@@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory;
 public class JcrResourceProvider
     implements ResourceProvider,
                DynamicResourceProvider,
-               AttributesProvider,
+               AttributableResourceProvider,
                QueriableResourceProvider {
 
     /** column name for node path */
@@ -159,8 +159,8 @@ public class JcrResourceProvider
      * @throws RepositoryException If an error occurrs accessingor checking the
      *             item in the repository.
      */
-    private JcrItemResource createResource(ResourceResolver resourceResolver,
-            String path) throws RepositoryException {
+    private JcrItemResource createResource(final ResourceResolver resourceResolver,
+            final String path) throws RepositoryException {
         if (itemExists(path)) {
             Item item = session.getItem(path);
             if (item.isNode()) {
@@ -191,7 +191,7 @@ public class JcrResourceProvider
      *         session has read access. If the item does not exist,
      *         <code>false</code> is returned ignoring access control.
      */
-    private boolean itemExists(String path) {
+    private boolean itemExists(final String path) {
 
         try {
             return session.itemExists(path);
@@ -329,7 +329,7 @@ public class JcrResourceProvider
     }
 
     /**
-     * @see org.apache.sling.api.resource.AttributesProvider#getAttributeNames()
+     * @see org.apache.sling.api.resource.AttributableResourceProvider#getAttributeNames()
      */
     public Collection<String> getAttributeNames() {
         this.checkClosed();
@@ -345,7 +345,7 @@ public class JcrResourceProvider
     }
 
     /**
-     * @see org.apache.sling.api.resource.AttributesProvider#getAttribute(java.lang.String)
+     * @see org.apache.sling.api.resource.AttributableResourceProvider#getAttribute(java.lang.String)
      */
     public Object getAttribute(final String name) {
         this.checkClosed();

Modified: sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
(original)
+++ sling/whiteboard/SLING-2396/jcr.resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
Sat Jun  2 14:08:53 2012
@@ -163,8 +163,9 @@ public class JcrResourceProviderFactory 
      * @throws LoginException If something goes wrong.
      */
     private Session handleImpersonation(final Session session,
-            final Map<String, Object> authenticationInfo, boolean logoutSession)
-            throws LoginException {
+            final Map<String, Object> authenticationInfo,
+            final boolean logoutSession)
+    throws LoginException {
         final String sudoUser = getSudoUser(authenticationInfo);
         if (sudoUser != null && !session.getUserID().equals(sudoUser)) {
             try {
@@ -174,7 +175,7 @@ public class JcrResourceProviderFactory 
                 creds.setAttribute(ResourceResolver.USER_IMPERSONATOR,
                     session.getUserID());
                 return session.impersonate(creds);
-            } catch (RepositoryException re) {
+            } catch (final RepositoryException re) {
                 throw getLoginException(re);
             } finally {
                 if (logoutSession) {

Modified: sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryImpl.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryImpl.java
(original)
+++ sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryImpl.java
Sat Jun  2 14:08:53 2012
@@ -64,6 +64,7 @@ import org.slf4j.LoggerFactory;
  * <li>Fires OSGi EventAdmin events on behalf of internal helper objects
  * </ul>
  *
+ * TODO : Should we implement modifiable? It would be easy but what about long running resolvers?
  */
 @Component(
      name = "org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl",

Modified: sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/RootResourceProviderEntry.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/RootResourceProviderEntry.java?rev=1345510&r1=1345509&r2=1345510&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/RootResourceProviderEntry.java
(original)
+++ sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/RootResourceProviderEntry.java
Sat Jun  2 14:08:53 2012
@@ -32,7 +32,7 @@ import java.util.Set;
 
 import org.apache.sling.api.SlingConstants;
 import org.apache.sling.api.adapter.Adaptable;
-import org.apache.sling.api.resource.AttributesProvider;
+import org.apache.sling.api.resource.AttributableResourceProvider;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.QueriableResourceProvider;
 import org.apache.sling.api.resource.Resource;
@@ -69,7 +69,7 @@ public class RootResourceProviderEntry e
     private final SortedProviderList<QueriableResourceProvider> queriableProviders
= new SortedProviderList<QueriableResourceProvider>(QueriableResourceProvider.class);
 
     /** All attribute resource providers. */
-    private final SortedProviderList<AttributesProvider> attributeProviders = new SortedProviderList<AttributesProvider>(AttributesProvider.class);
+    private final SortedProviderList<AttributableResourceProvider> attributeProviders
= new SortedProviderList<AttributableResourceProvider>(AttributableResourceProvider.class);
 
     public RootResourceProviderEntry() {
         super("/", null);
@@ -238,16 +238,16 @@ public class RootResourceProviderEntry e
 
     /**
      * Invoke all attributes providers and combine the result
-     * @see AttributesProvider#getAttributeNames()
+     * @see AttributableResourceProvider#getAttributeNames()
      */
     public Iterator<String> getAttributeNames(final ResourceResolverContext ctx) {
         final Set<String> names = new HashSet<String>();
         if ( ctx.getAuthInfo() != null ) {
             names.addAll(ctx.getAuthInfo().keySet());
         }
-        final Iterator<AttributesProvider> i = this.attributeProviders.getProviders(ctx);
+        final Iterator<AttributableResourceProvider> i = this.attributeProviders.getProviders(ctx);
         while ( i.hasNext() ) {
-            final AttributesProvider adap = i.next();
+            final AttributableResourceProvider adap = i.next();
             final Collection<String> newNames = adap.getAttributeNames();
             if ( newNames != null ) {
                 names.addAll(newNames);
@@ -260,7 +260,7 @@ public class RootResourceProviderEntry e
 
     /**
      * Return the result from the first matching attributes provider
-     * @see AttributesProvider#getAttribute(String)
+     * @see AttributableResourceProvider#getAttribute(String)
      */
     public Object getAttribute(final ResourceResolverContext ctx, final String name) {
         Object result = null;
@@ -269,9 +269,9 @@ public class RootResourceProviderEntry e
                 result = ctx.getAuthInfo().get(name);
             }
             if ( result == null ) {
-                final Iterator<AttributesProvider> i = this.attributeProviders.getProviders(ctx);
+                final Iterator<AttributableResourceProvider> i = this.attributeProviders.getProviders(ctx);
                 while ( result == null && i.hasNext() ) {
-                    final AttributesProvider adap = i.next();
+                    final AttributableResourceProvider adap = i.next();
                     result = adap.getAttribute(name);
                 }
             }
@@ -290,8 +290,8 @@ public class RootResourceProviderEntry e
         if ( provider instanceof QueriableResourceProvider ) {
             this.queriableProviders.add((QueriableResourceProvider)provider);
         }
-        if ( provider instanceof AttributesProvider ) {
-            this.attributeProviders.add((AttributesProvider)provider);
+        if ( provider instanceof AttributableResourceProvider ) {
+            this.attributeProviders.add((AttributableResourceProvider)provider);
         }
     }
 
@@ -306,8 +306,8 @@ public class RootResourceProviderEntry e
         if ( provider instanceof QueriableResourceProvider ) {
             this.queriableProviders.remove((QueriableResourceProvider)provider);
         }
-        if ( provider instanceof AttributesProvider ) {
-            this.attributeProviders.remove((AttributesProvider)provider);
+        if ( provider instanceof AttributableResourceProvider ) {
+            this.attributeProviders.remove((AttributableResourceProvider)provider);
         }
     }
 



Mime
View raw message