sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1573153 - in /sling/trunk/bundles/servlets/resolver/src: main/java/org/apache/sling/servlets/resolver/internal/ main/java/org/apache/sling/servlets/resolver/internal/helper/ main/resources/OSGI-INF/metatype/ test/java/org/apache/sling/serv...
Date Sat, 01 Mar 2014 11:18:39 GMT
Author: cziegeler
Date: Sat Mar  1 11:18:38 2014
New Revision: 1573153

URL: http://svn.apache.org/r1573153
Log:
SLING-3424 : Remove unused workspace support

Removed:
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/ResolveFromRequestAndDefaultSlingServletResolverTest.java
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/ResolveFromRequestNoDefaultSlingServletResolverTest.java
Modified:
    sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
    sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
    sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
    sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/NamedScriptResourceCollector.java
    sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollector.java
    sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java

Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
Sat Mar  1 11:18:38 2014
@@ -146,20 +146,6 @@ public class SlingServletResolver
     @Property(intValue=DEFAULT_CACHE_SIZE)
     public static final String PROP_CACHE_SIZE = "servletresolver.cacheSize";
 
-    @Property
-    public static final String PROP_DEFAULT_SCRIPT_WORKSPACE = "servletresolver.defaultScriptWorkspace";
-
-    private static final boolean DEFAULT_USE_DEFAULT_WORKSPACE = false;
-
-    @Property(boolValue=DEFAULT_USE_DEFAULT_WORKSPACE)
-    public static final String PROP_USE_REQUEST_WORKSPACE = "servletresolver.useRequestWorkspace";
-
-    private static final boolean DEFAULT_USE_REQUEST_WORKSPACE = false;
-
-    @Property(boolValue=DEFAULT_USE_REQUEST_WORKSPACE)
-    public static final String PROP_USE_DEFAULT_WORKSPACE = "servletresolver.useDefaultWorkspace";
-
-
     private static final String REF_SERVLET = "Servlet";
 
     @Property(value="/", unbounded=PropertyUnbounded.ARRAY)
@@ -210,25 +196,6 @@ public class SlingServletResolver
     private ServiceRegistration eventHandlerReg;
 
     /**
-     * If true, the primary workspace name for script resolution will be the
-     * same as that used to resolve the request's resource.
-     */
-    private boolean useRequestWorkspace;
-
-    /**
-     * If true and useRequestWorkspace is true and no scripts are found using
-     * the request workspace, also use the default workspace. If
-     * useRequestWorkspace is false, this value is ignored.
-     */
-    private boolean useDefaultWorkspace;
-
-    /**
-     * The default workspace to use (might be null to use the default
-     * workspace).
-     */
-    private String defaultWorkspaceName;
-
-    /**
      * The allowed execution paths.
      */
     private String[] executionPaths;
@@ -261,20 +228,7 @@ public class SlingServletResolver
         Servlet servlet = null;
 
         if ( type != null && type.length() > 0 ) {
-            if (this.useRequestWorkspace) {
-                final String wspName = getWorkspaceName(request);
-                // First, we use a resource resolver using the same workspace as the
-                // resource
-                servlet = resolveServlet(request, type, scriptResolver, wspName);
-
-                // now we try the default workspace
-                if (servlet == null && this.useDefaultWorkspace && wspName
!= null ) {
-                    servlet = resolveServlet(request, type, scriptResolver, this.defaultWorkspaceName);
-                }
-
-            } else {
-                servlet = resolveServlet(request, type, scriptResolver, this.defaultWorkspaceName);
-            }
+            servlet = resolveServlet(request, type, scriptResolver);
         }
 
         // last resort, use the core bundle default servlet
@@ -454,21 +408,19 @@ public class SlingServletResolver
         tracker.startTimer(timerName);
 
         try {
-            final String wspName = (this.useRequestWorkspace ? getWorkspaceName(request)
: null);
-
             // find the error handler component
             Resource resource = getErrorResource(request);
 
             // find a servlet for the status as the method name
             ResourceCollector locationUtil = new ResourceCollector(String.valueOf(status),
-                    ServletResolverConstants.ERROR_HANDLER_PATH, resource, wspName,
+                    ServletResolverConstants.ERROR_HANDLER_PATH, resource,
                     this.executionPaths);
             Servlet servlet = getServlet(locationUtil, request, scriptResolver);
 
             // fall back to default servlet if none
             if (servlet == null) {
                 servlet = getDefaultErrorServlet(request, scriptResolver,
-                    resource, wspName);
+                    resource);
             }
 
             // set the message properties
@@ -511,8 +463,6 @@ public class SlingServletResolver
         tracker.startTimer(timerName);
 
         try {
-            final String wspName = (this.useRequestWorkspace ? getWorkspaceName(request)
: null);
-
             // find the error handler component
             Servlet servlet = null;
             Resource resource = getErrorResource(request);
@@ -521,7 +471,7 @@ public class SlingServletResolver
             while (servlet == null && tClass != Object.class) {
                 // find a servlet for the simple class name as the method name
                 ResourceCollector locationUtil = new ResourceCollector(tClass.getSimpleName(),
-                        ServletResolverConstants.ERROR_HANDLER_PATH, resource, wspName,
+                        ServletResolverConstants.ERROR_HANDLER_PATH, resource,
                         this.executionPaths);
                 servlet = getServlet(locationUtil, request, scriptResolver);
 
@@ -531,7 +481,7 @@ public class SlingServletResolver
 
             if (servlet == null) {
                 servlet = getDefaultErrorServlet(request, scriptResolver,
-                    resource, wspName);
+                    resource);
             }
 
             // set the message properties
@@ -572,12 +522,11 @@ public class SlingServletResolver
 
     /**
      * Resolve an appropriate servlet for a given request and resource type
-     * using the provided ResourceResolver and workspace
+     * using the provided ResourceResolver
      */
     private Servlet resolveServlet(final SlingHttpServletRequest request,
             final String type,
-            final ResourceResolver resolver,
-            final String workspaceName) {
+            final ResourceResolver resolver) {
         Servlet servlet = null;
 
         // first check whether the type of a resource is the absolute
@@ -585,9 +534,6 @@ public class SlingServletResolver
         if (type.charAt(0) == '/') {
             String scriptPath = ResourceUtil.normalize(type);
             if ( this.isPathAllowed(scriptPath) ) {
-                if ( workspaceName != null ) {
-                    scriptPath = workspaceName + ':' + type;
-                }
                 final Resource res = resolver.getResource(scriptPath);
                 if (res != null) {
                     servlet = res.adaptTo(Servlet.class);
@@ -605,7 +551,7 @@ public class SlingServletResolver
         }
         if ( servlet == null ) {
             // the resource type is not absolute, so lets go for the deep search
-            final ResourceCollector locationUtil = ResourceCollector.create(request, workspaceName,
this.executionPaths, this.defaultExtensions);
+            final ResourceCollector locationUtil = ResourceCollector.create(request, this.executionPaths,
this.defaultExtensions);
             servlet = getServlet(locationUtil, request, resolver);
 
             if (servlet != null && LOGGER.isDebugEnabled()) {
@@ -735,15 +681,13 @@ public class SlingServletResolver
     private Servlet getDefaultErrorServlet(
             final SlingHttpServletRequest request,
             final ResourceResolver scriptResolver,
-            final Resource resource,
-            final String workspaceName) {
+            final Resource resource) {
 
         // find a default error handler according to the resource type
         // tree of the given resource
         final ResourceCollector locationUtil = new ResourceCollector(
             ServletResolverConstants.DEFAULT_ERROR_HANDLER_NAME,
             ServletResolverConstants.ERROR_HANDLER_PATH, resource,
-            workspaceName,
             this.executionPaths);
         final Servlet servlet = getServlet(locationUtil, request,
             scriptResolver);
@@ -795,21 +739,6 @@ public class SlingServletResolver
         }
     }
 
-    /**
-     * Package scoped to help with testing.
-     */
-    String getWorkspaceName(SlingHttpServletRequest request) {
-        if ( this.useRequestWorkspace ) {
-            final String path = request.getResource().getPath();
-            final int pos = path.indexOf(":/");
-            if ( pos == -1 ) {
-                return null; // default workspace
-            }
-            return path.substring(0, pos);
-        }
-        return null;
-    }
-
     private Map<String, Object> createAuthenticationInfo(final Dictionary<String,
Object> props) {
         final Map<String, Object> authInfo = new HashMap<String, Object>();
         // if a script user is configured we use this user to read the scripts
@@ -834,17 +763,6 @@ public class SlingServletResolver
             servletRoot = DEFAULT_SERVLET_ROOT;
         }
 
-        // workspace handling and resource resolver creation
-        this.useDefaultWorkspace = OsgiUtil.toBoolean(properties.get(PROP_USE_DEFAULT_WORKSPACE),
DEFAULT_USE_DEFAULT_WORKSPACE);
-        this.useRequestWorkspace = OsgiUtil.toBoolean(properties.get(PROP_USE_REQUEST_WORKSPACE),
DEFAULT_USE_REQUEST_WORKSPACE);
-
-        String defaultWorkspaceProp = (String) properties.get(PROP_DEFAULT_SCRIPT_WORKSPACE);
-        if ( defaultWorkspaceProp != null && defaultWorkspaceProp.trim().length()
== 0 ) {
-            defaultWorkspaceProp = null;
-        }
-        this.defaultWorkspaceName = defaultWorkspaceProp;
-
-
         final Collection<ServiceReference> refs;
         synchronized (this.pendingServlets) {
 
@@ -1266,7 +1184,6 @@ public class SlingServletResolver
                     } else {
                         final ResourceCollector locationUtil = ResourceCollector.create(
                                 resource,
-                                defaultWorkspaceName,
                                 requestPathInfo.getExtension(),
                                 executionPaths,
                                 defaultExtensions,

Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
Sat Mar  1 11:18:38 2014
@@ -52,13 +52,9 @@ public abstract class AbstractResourceCo
 
     protected final String[] executionPaths;
 
-    protected final String workspaceName;
-
-
     public AbstractResourceCollector(final String baseResourceType,
             final String resourceType,
             final String resourceSuperType,
-            final String workspaceName,
             final String extension,
             final String[] executionPaths) {
         this.baseResourceType = baseResourceType;
@@ -66,14 +62,13 @@ public abstract class AbstractResourceCo
         this.resourceSuperType = resourceSuperType;
         this.extension = extension;
         this.executionPaths = executionPaths;
-        this.workspaceName = workspaceName;
     }
 
     public final Collection<Resource> getServlets(ResourceResolver resolver) {
 
         final SortedSet<Resource> resources = new TreeSet<Resource>();
         final Iterator<String> locations = new LocationIterator(resourceType, resourceSuperType,
-                                                                baseResourceType, workspaceName,
resolver);
+                                                                baseResourceType, resolver);
         while (locations.hasNext()) {
             final String location = locations.next();
 
@@ -132,9 +127,6 @@ public abstract class AbstractResourceCo
      */
     protected final Resource getResource(final ResourceResolver resolver,
                                          String path) {
-        if ( this.workspaceName != null ) {
-            path = workspaceName + ':' + path;
-        }
         Resource res = resolver.getResource(path);
 
         if (res == null) {
@@ -160,8 +152,7 @@ public abstract class AbstractResourceCo
         if ( stringEquals(resourceType, o.resourceType)
              && stringEquals(resourceSuperType, o.resourceSuperType)
              && stringEquals(extension, o.extension)
-             && stringEquals(baseResourceType, o.baseResourceType)
-             && stringEquals(workspaceName, o.workspaceName)) {
+             && stringEquals(baseResourceType, o.baseResourceType)) {
             return true;
         }
         return false;

Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
Sat Mar  1 11:18:38 2014
@@ -86,9 +86,6 @@ public class LocationIterator implements
 
     /** Set of used resource types to detect a circular resource type hierarchy. */
     private final Set<String> usedResourceTypes = new HashSet<String>();
-    
-    // the workspace name
-    private String workspaceName;
 
     /**
      * Creates an instance of this iterator starting with a location built from
@@ -101,10 +98,9 @@ public class LocationIterator implements
      * @param resolver The resource resolver
      */
     public LocationIterator(String resourceType, String resourceSuperType, String baseResourceType,
-            String workspaceName, ResourceResolver resolver) {
+            ResourceResolver resolver) {
         this.resolver = resolver;
         this.baseResourceType = baseResourceType;
-        this.workspaceName = workspaceName;
 
         String[] tmpPath = resolver.getSearchPath();
         if (tmpPath == null || tmpPath.length == 0) {
@@ -225,7 +221,7 @@ public class LocationIterator implements
 
         return superType;
     }
-   
+
     // this method is largely duplicated from ResourceUtil, but takes the configured
     // workspaceName into account.
     private String getResourceSuperType(final ResourceResolver resourceResolver,
@@ -236,13 +232,8 @@ public class LocationIterator implements
         String resourceSuperType = null;
         // if the path is absolute, use it directly
         if ( rtPath != null && rtPath.startsWith("/") ) {
-            final String candidatePath;
-            if ( this.workspaceName != null ) {
-                candidatePath = workspaceName + ':' + rtPath;
-            } else {
-                candidatePath = rtPath;
-            }
-            
+            final String candidatePath = rtPath;
+
             final Resource rtResource = resourceResolver.getResource(candidatePath);
             if ( rtResource != null ) {
                 resourceSuperType = rtResource.getResourceSuperType();
@@ -251,12 +242,7 @@ public class LocationIterator implements
         } else {
             // if the path is relative we use the search paths
             for(final String searchPath : resourceResolver.getSearchPath()) {
-                final String candidatePath;
-                if ( this.workspaceName != null ) {
-                    candidatePath = workspaceName + ':' + searchPath + rtPath;
-                } else {
-                    candidatePath = searchPath + rtPath;
-                }
+                final String candidatePath = searchPath + rtPath;
                 final Resource rtResource = resourceResolver.getResource(candidatePath);
                 if ( rtResource != null && rtResource.getResourceSuperType() != null
) {
                     resourceSuperType = rtResource.getResourceSuperType();

Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/NamedScriptResourceCollector.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/NamedScriptResourceCollector.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/NamedScriptResourceCollector.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/NamedScriptResourceCollector.java
Sat Mar  1 11:18:38 2014
@@ -74,7 +74,7 @@ public class NamedScriptResourceCollecto
                               final String scriptName,
                               final String extension,
                               final String[] executionPaths) {
-        super(baseResourceType, resourceType, resourceSuperType, null, extension, executionPaths);
+        super(baseResourceType, resourceType, resourceSuperType, extension, executionPaths);
         this.scriptName = scriptName;
         // create the hash code once
         final String key = baseResourceType + ':' + this.scriptName + ':' +
@@ -83,6 +83,7 @@ public class NamedScriptResourceCollecto
         this.hashCode = key.hashCode();
     }
 
+    @Override
     protected void getWeightedResources(final Set<Resource> resources,
                                         final Resource location) {
         final ResourceResolver resolver = location.getResourceResolver();
@@ -115,7 +116,7 @@ public class NamedScriptResourceCollecto
             if ( !this.isPathAllowed(child.getPath()) ) {
                 continue;
             }
-            final String currentScriptName = ResourceUtil.getName(child);
+            final String currentScriptName = child.getName();
             final int lastDot = currentScriptName.lastIndexOf('.');
             if (lastDot < 0) {
                 // no extension in the name, this is not a script

Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollector.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollector.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollector.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollector.java
Sat Mar  1 11:18:38 2014
@@ -18,7 +18,6 @@
  */
 package org.apache.sling.servlets.resolver.internal.helper;
 
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Set;
 
@@ -28,7 +27,6 @@ import org.apache.sling.api.SlingHttpSer
 import org.apache.sling.api.request.RequestPathInfo;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.servlets.resolver.internal.ServletResolverConstants;
 import org.apache.sling.servlets.resolver.internal.resource.ServletResourceProviderFactory;
 
@@ -81,27 +79,25 @@ public class ResourceCollector extends A
      *
      * @param request The <code>SlingHttpServletRequest</code> for which to
      *            return a <code>ResourceCollector</code>.
-     * @param workspaceName
      * @return The <code>ResourceCollector</code> to find servlets and scripts
      *         suitable for handling the <code>request</code>.
      */
     public static ResourceCollector create(
-            final SlingHttpServletRequest request, final String workspaceName,
+            final SlingHttpServletRequest request,
             final String[] executionPaths, final String[] defaultExtensions) {
         final RequestPathInfo requestPathInfo = request.getRequestPathInfo();
         final boolean isDefaultExtension = ArrayUtils.contains(defaultExtensions, requestPathInfo.getExtension());
-        return new ResourceCollector(request.getResource(), workspaceName, requestPathInfo.getExtension(),
executionPaths, isDefaultExtension,
+        return new ResourceCollector(request.getResource(), requestPathInfo.getExtension(),
executionPaths, isDefaultExtension,
                 request.getMethod(), requestPathInfo.getSelectors());
     }
-    
-    public static ResourceCollector create(final Resource resource, 
-            final String workspaceName,
+
+    public static ResourceCollector create(final Resource resource,
             final String extension,
             final String[] executionPaths, final String[] defaultExtensions,
             final String methodName, final String[] selectors
             ) {
         boolean isDefaultExtension = ArrayUtils.contains(defaultExtensions, extension);
-        return new ResourceCollector(resource, workspaceName, extension, executionPaths,
isDefaultExtension, methodName, selectors);
+        return new ResourceCollector(resource, extension, executionPaths, isDefaultExtension,
methodName, selectors);
     }
 
     /**
@@ -120,12 +116,12 @@ public class ResourceCollector extends A
      */
     public ResourceCollector(final String methodName,
             final String baseResourceType, final Resource resource,
-            final String workspaceName, final String[] executionPaths) {
+            final String[] executionPaths) {
         super((baseResourceType != null
                 ? baseResourceType
                 : ServletResolverConstants.DEFAULT_SERVLET_NAME),
             resource.getResourceType(), resource.getResourceSuperType(),
-            workspaceName, null, executionPaths);
+            null, executionPaths);
         this.methodName = methodName;
         this.requestSelectors = new String[0];
         this.numRequestSelectors = 0;
@@ -140,8 +136,7 @@ public class ResourceCollector extends A
         final String key = methodName + ':' + baseResourceType + ':'
             + extension + "::"
             + (this.resourceType == null ? "" : this.resourceType) + ':'
-            + (this.resourceSuperType == null ? "" : this.resourceSuperType)
-            + ':' + (this.workspaceName == null ? "" : this.workspaceName);
+            + (this.resourceSuperType == null ? "" : this.resourceSuperType);
         this.hashCode = key.hashCode();
     }
 
@@ -151,7 +146,6 @@ public class ResourceCollector extends A
      *
      * @param methodName The <code>methodName</code> used to find scripts for.
      *            This must not be <code>null</code>.
-     * @param workspaceName The <code>workspaceName</code>.
      * @param baseResourceType The basic resource type to use as a final
      *            resource super type. If this is <code>null</code> the default
      *            value
@@ -159,14 +153,14 @@ public class ResourceCollector extends A
      *            is assumed.
      */
     private ResourceCollector(final Resource resource,
-            final String workspaceName, final String extension,
+            final String extension,
             final String[] executionPaths,
             final boolean isDefaultExtension,
             final String methodName,
             final String[] selectors) {
         super(ServletResolverConstants.DEFAULT_SERVLET_NAME,
                 resource.getResourceType(),
-                resource.getResourceSuperType(), workspaceName,
+                resource.getResourceSuperType(),
                 extension, executionPaths);
             this.methodName = methodName;
 
@@ -184,17 +178,17 @@ public class ResourceCollector extends A
             final String key = methodName + ':' + baseResourceType + ':'
                 + extension + ':' + StringUtils.join(requestSelectors, '.') + ':'
                 + (this.resourceType == null ? "" : this.resourceType) + ':'
-                + (this.resourceSuperType == null ? "" : this.resourceSuperType)
-                + ':' + (this.workspaceName == null ? "" : this.workspaceName);
+                + (this.resourceSuperType == null ? "" : this.resourceSuperType);
             this.hashCode = key.hashCode();
     }
 
+    @Override
     protected void getWeightedResources(final Set<Resource> resources,
             final Resource location) {
 
         final ResourceResolver resolver = location.getResourceResolver();
         Resource current = location;
-        String parentName = ResourceUtil.getName(current);
+        String parentName = current.getName();
 
         int selIdx = 0;
         String selector;
@@ -210,7 +204,7 @@ public class ResourceCollector extends A
                 if (!this.isPathAllowed(child.getPath())) {
                     continue;
                 }
-                String scriptName = ResourceUtil.getName(child);
+                String scriptName = child.getName();
                 int lastDot = scriptName.lastIndexOf('.');
                 if (lastDot < 0) {
                     // no extension in the name, this is not a script

Modified: sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
Sat Mar  1 11:18:38 2014
@@ -48,19 +48,6 @@ servletresolver.cacheSize.name = Cache S
 servletresolver.cacheSize.description = This property configures the size of the \
  cache used for script resolution. A value lower than 5 disables the cache.
 
-servletresolver.defaultScriptWorkspace.name = Script Workspace
-servletresolver.defaultScriptWorkspace.description = The workspace name which \
- should be used as a default for script resolution.
-
-servletresolver.useRequestWorkspace.name = Use Request Workspace
-servletresolver.useRequestWorkspace.description = If enabled, the primary workspace \
- name for script resolution will be the same as that used to resolve the request's resource.
-
-servletresolver.useDefaultWorkspace.name = Use Default Workspace
-servletresolver.useDefaultWorkspace.description = If enabled and if use request workspace
\
- is enabled and no scripts are found using the request workspace, also use the default workspace.
\
- If use request workspace is disabled, this value is ignored.
-
 servletresolver.paths.name = Execution Paths
 servletresolver.paths.description = The paths to search for executable scripts. If no path
is configured \
  this is treated like the default (/ = root) which allows to execute all scripts. By configuring
some \

Modified: sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
Sat Mar  1 11:18:38 2014
@@ -74,6 +74,7 @@ public class SlingServletResolverTest {
 
     @Before public void setUp() throws Exception {
         mockResourceResolver = new MockResourceResolver() {
+            @Override
             public void close() {
                 // nothing to do;
             }
@@ -101,16 +102,9 @@ public class SlingServletResolverTest {
         };
 
         servlet = new MockSlingRequestHandlerServlet();
-        servletResolver = new SlingServletResolver() {
+        servletResolver = new SlingServletResolver();
 
-            @Override
-            String getWorkspaceName(SlingHttpServletRequest request) {
-                return getRequestWorkspaceName();
-            }
-
-        };
-
-        Class<?> resolverClass = servletResolver.getClass().getSuperclass();
+        Class<?> resolverClass = servletResolver.getClass();
 
         // set resource resolver factory
         final Field resolverField = resolverClass.getDeclaredField("resourceResolverFactory");
@@ -123,7 +117,7 @@ public class SlingServletResolverTest {
             public ServiceRegistration registerService(String s, Object o, Dictionary dictionary)
{
                 return null;
             }
-            
+
             @Override
             public ServiceRegistration registerService(String[] strings, Object o, Dictionary
dictionary) {
                 return null;

Modified: sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
Sat Mar  1 11:18:38 2014
@@ -33,7 +33,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -55,7 +55,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /apps/foo/bar
@@ -78,7 +78,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /apps/foo/bar
@@ -113,7 +113,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -140,7 +140,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -168,7 +168,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -199,7 +199,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -230,7 +230,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /apps/foo/bar
@@ -262,7 +262,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /apps/foo/bar
@@ -310,7 +310,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -346,7 +346,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -383,7 +383,7 @@ public class LocationIteratorTest extend
         final Resource r = request.getResource();
         LocationIterator li = new LocationIterator(r.getResourceType(),
                 r.getResourceSuperType(),
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /foo/bar
@@ -416,7 +416,7 @@ public class LocationIteratorTest extend
         resourceResolver.setSearchPath(root0, root1);
         LocationIterator li = new LocationIterator("",
                 null,
-                "", null,
+                "",
                 resourceResolver);
         assertTrue(li.hasNext());
         assertEquals("/apps/", li.next());
@@ -431,7 +431,7 @@ public class LocationIteratorTest extend
         resourceResolver.setSearchPath(root0, root1);
         LocationIterator li = new LocationIterator("a/b",
                 null,
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
         assertTrue(li.hasNext());
         assertEquals(root0 + "/a/b", li.next());
@@ -450,7 +450,7 @@ public class LocationIteratorTest extend
         resourceResolver.setSearchPath(root0, root1);
         LocationIterator li = new LocationIterator("a/b",
                 "c/d",
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
         assertTrue(li.hasNext());
         assertEquals(root0 + "/a/b", li.next());
@@ -487,7 +487,7 @@ public class LocationIteratorTest extend
 
         LocationIterator li = new LocationIterator(resourceType,
                 resourceSuperType,
-                DEFAULT_SERVLET_NAME, null,
+                DEFAULT_SERVLET_NAME,
                 resourceResolver);
 
         // 1. /libs/foo/bar

Modified: sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
Sat Mar  1 11:18:38 2014
@@ -270,7 +270,7 @@ public class ResourceCollectorTest exten
             pathMap.put(name, path);
         }
 
-        ResourceCollector lu = ResourceCollector.create(request, null, null, new String[]
{"html"});
+        ResourceCollector lu = ResourceCollector.create(request, null, new String[] {"html"});
         Collection<Resource> res = lu.getServlets(request.getResource().getResourceResolver());
         Iterator<Resource> rIter = res.iterator();
 

Modified: sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java?rev=1573153&r1=1573152&r2=1573153&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
Sat Mar  1 11:18:38 2014
@@ -68,7 +68,7 @@ public class ScriptSelectionTest extends
 
         // Create mock request and get scripts from ResourceCollector
         final MockSlingHttpServletRequest req = makeRequest(method, selectors, extension);
-        final ResourceCollector u = ResourceCollector.create(req, null, null, new String[]
{"html"});
+        final ResourceCollector u = ResourceCollector.create(req, null, new String[] {"html"});
         final Collection<Resource> s = u.getServlets(req.getResource().getResourceResolver());
 
         if(expectedScript == null) {



Mime
View raw message