You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2009/05/04 09:56:59 UTC

svn commit: r771230 - in /incubator/sling/trunk/bundles/jcr/resource/src: main/java/org/apache/sling/jcr/resource/internal/ main/resources/OSGI-INF/metatype/ test/java/org/apache/sling/jcr/resource/internal/

Author: fmeschbe
Date: Mon May  4 07:56:58 2009
New Revision: 771230

URL: http://svn.apache.org/viewvc?rev=771230&view=rev
Log:
SLING-950 Remove old resource resolver and respective configuration
and tests.

Removed:
    incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
    incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Modified:
    incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
    incubator/sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties
    incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2Test.java

Modified: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java?rev=771230&r1=771229&r2=771230&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java (original)
+++ incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java Mon May  4 07:56:58 2009
@@ -87,11 +87,6 @@
     }
 
     /**
-     * @scr.property value="true" type="Boolean"
-     */
-    private static final String PROP_USE_NEW_RESOLVER = "resource.resolver.new";
-
-    /**
      * @scr.property values.1="/apps" values.2="/libs"
      */
     public static final String PROP_PATH = "resource.resolver.searchpath";
@@ -143,22 +138,6 @@
      */
     private static final String PROP_MAPPING = "resource.resolver.mapping";
 
-    /**
-     * These regexps are executing during the resource resolving phase before
-     * the mappings are applied.
-     *
-     * @scr.property values.1="/_([^/]+?)_|/$1:"
-     */
-    private static final String PROP_REGEXPS = "resource.resolver.regexps";
-
-    /**
-     * These regexps are executed during a map operation as the back conversion
-     * of the {@link #PROP_REGEXPS}
-     *
-     * @scr.property values.1="/([^/]+?):([^/]+)|/_$1_$2"
-     */
-    private static final String PROP_MAPREGEXPS = "resource.resolver.mapregexps";
-
     /** default log */
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -197,12 +176,6 @@
     /** The fake urls */
     private BidiMap virtualURLMap;
 
-    /** The regexp patterns */
-    private ResourcePattern[] patterns;
-
-    /** The back regexp patterns */
-    private ResourcePattern[] backPatterns;
-
     /** <code>true</code>, if direct mappings from URI to handle are allowed */
     private boolean allowDirect = false;
 
@@ -211,15 +184,6 @@
 
     private ResourceProviderEntry rootProviderEntry;
 
-    /**
-     * Temporary field to select which JcrResourceResolver implementation to
-     * use.
-     *
-     * @see #PROP_USE_NEW_RESOLVER
-     * @see #getResourceResolver(Session)
-     */
-    private boolean useNewResourceResolver;
-
     // whether to mangle paths with namespaces or not
     private boolean mangleNamespacePrefixes;
 
@@ -237,11 +201,7 @@
         JcrResourceProviderEntry sessionRoot = new JcrResourceProviderEntry(
             session, rootProviderEntry, getJcrResourceTypeProviders());
 
-        if (useNewResourceResolver) {
-            return new JcrResourceResolver2(sessionRoot, this, mapEntries);
-        }
-
-        return new JcrResourceResolver(sessionRoot, this);
+        return new JcrResourceResolver2(sessionRoot, this, mapEntries);
     }
 
     protected JcrResourceTypeProvider[] getJcrResourceTypeProviders() {
@@ -290,14 +250,6 @@
         return searchPath;
     }
 
-    ResourcePattern[] getPatterns() {
-        return patterns;
-    }
-
-    ResourcePattern[] getBackPatterns() {
-        return backPatterns;
-    }
-
     boolean isMangleNamespacePrefixes() {
         return mangleNamespacePrefixes;
 
@@ -326,20 +278,6 @@
 
         Dictionary<?, ?> properties = componentContext.getProperties();
 
-        // BEGIN Temporary solution to select old and new JcrResourceResolver
-        // select new or old resource resolver
-        String propNewRes = componentContext.getBundleContext().getProperty(
-            PROP_USE_NEW_RESOLVER);
-        boolean flagNewRes = !"false".equalsIgnoreCase(propNewRes);
-        useNewResourceResolver = OsgiUtil.toBoolean(
-            properties.get(PROP_USE_NEW_RESOLVER), flagNewRes);
-        if (useNewResourceResolver) {
-            log.info("activate: Using new JCR ResourceResolver with extended Mapping");
-        } else {
-            log.info("activate: Using old JCR ResourceResolver");
-        }
-        // END Temporary solution to select old and new JcrResourceResolver
-
         BidiMap virtuals = new TreeBidiMap();
         String[] virtualList = (String[]) properties.get(PROP_VIRTUAL);
         for (int i = 0; virtualList != null && i < virtualList.length; i++) {
@@ -367,10 +305,6 @@
             mappings = tmp;
         }
 
-        // regexps
-        this.patterns = this.getResourcePatterns((String[]) properties.get(PROP_REGEXPS));
-        this.backPatterns = this.getResourcePatterns((String[]) properties.get(PROP_MAPREGEXPS));
-
         // from configuration if available
         searchPath = OsgiUtil.toStringArray(properties.get(PROP_PATH));
         if (searchPath != null && searchPath.length > 0) {
@@ -401,15 +335,13 @@
         this.processDelayedJcrResourceTypeProviders();
 
         // set up the map entries from configuration
-        if (useNewResourceResolver) {
-            try {
-                mapEntries = new MapEntries(this, getRepository());
-                plugin = new JcrResourceResolverWebConsolePlugin(componentContext.getBundleContext(), this);
-            } catch (Exception e) {
-                log.error(
-                    "activate: Cannot access repository, failed setting up Mapping Support",
-                    e);
-            }
+        try {
+            mapEntries = new MapEntries(this, getRepository());
+            plugin = new JcrResourceResolverWebConsolePlugin(componentContext.getBundleContext(), this);
+        } catch (Exception e) {
+            log.error(
+                "activate: Cannot access repository, failed setting up Mapping Support",
+                e);
         }
     }
 
@@ -422,7 +354,7 @@
             plugin = null;
         }
 
-        if (useNewResourceResolver) {
+        if (mapEntries != null) {
             mapEntries.dispose();
             mapEntries = MapEntries.EMPTY;
         }

Modified: incubator/sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=771230&r1=771229&r2=771230&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ incubator/sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties Mon May  4 07:56:58 2009
@@ -29,14 +29,6 @@
 resource.resolver.description =  Configures the Resource Resolver for request \
  URL and resource path rewriting.
 
-resource.resolver.new.name = Use New Resource Resolver
-resource.resolver.new.description = Whether to use the new or the traditional \
- Resource Resolver. The new Resource Resolver ignores all mapping configurations \
- in this configuration but uses a new mechanism for resource resolution as \
- explained at http://cwiki.apache.org/SLING/flexible-resource-resolution.html. \
- If unchecking this option, the traditional Resource Resolver is used which uses \
- the mapping configuration defined here.
- 
 resource.resolver.allowDirect.name = Allow Direct Mapping
 resource.resolver.allowDirect.description = Whether to add a direct URL \
  mapping to the front of the mapping list.
@@ -61,22 +53,6 @@
  The default value is [ "/apps", "/libs" ]. If an empty path is specified a \
  single entry path of [ "/" ] is assumed.
 
-resource.resolver.regexps.name = Resource Regexps
-resource.resolver.regexps.description = The list of regexps that will be \
- executed on a path before the resource resolving. Please separate the \
- regexp from the replacement string by using the | (pipe) character. \
- For each regexp you need to specify a regexp doing the opposite conversion.\
- The default value of "/_([^/]+?)_|/$1:" is very important to the system and \
- should never be removed without very good reason. This configuration setting \
- is ignored by the New Resource Resolver.
- 
-resource.resolver.mapregexps.name = Map Regexps
-resource.resolver.mapregexps.description = The list of regexps that will do \
- the opposite conversion as the resource regexps. \
- The default value of "/([^/]+?):([^/]+)|/_$1_$2" is very important to the system and \
- should never be removed without very good reason. This configuration setting \
- is ignored by the New Resource Resolver.
- 
 resource.resolver.manglenamespaces.name = Namespace Mangling
 resource.resolver.manglenamespaces.description = Defines whether namespace \
  prefixes of resource names inside the path (e.g. "jcr:" in "/home/path/jcr:content") \
@@ -88,5 +64,4 @@
  there may be systems out there in the wild which cannot cope with URLs \
  containing colons, even though they are perfectly valid characters in the \
  path part of URI references with a scheme. The default value of this property \
- if no configuration is provided is "true". This configuration setting is only \
- used by the New Resource Resolver.
+ if no configuration is provided is "true".

Modified: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2Test.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2Test.java?rev=771230&r1=771229&r2=771230&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2Test.java (original)
+++ incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2Test.java Mon May  4 07:56:58 2009
@@ -103,12 +103,6 @@
         mappingsField.set(resFac, new Mapping[] { new Mapping("/-/"),
             new Mapping(rootPath + "/-/") });
 
-        // ensure using JcrResourceResolver2
-        Field unrrField = resFac.getClass().getDeclaredField(
-        "useNewResourceResolver");
-        unrrField.setAccessible(true);
-        unrrField.set(resFac, true);
-        
         // ensure namespace mangling
         Field mangeNamespacePrefixesField = resFac.getClass().getDeclaredField(
             "mangleNamespacePrefixes");