You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by to...@apache.org on 2016/11/23 11:07:18 UTC

svn commit: r1770947 - /sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/AbstractDistributionPackageBuilder.java

Author: tommaso
Date: Wed Nov 23 11:07:18 2016
New Revision: 1770947

URL: http://svn.apache.org/viewvc?rev=1770947&view=rev
Log:
SLING-5815 - removed unused code

Modified:
    sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/AbstractDistributionPackageBuilder.java

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/AbstractDistributionPackageBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/AbstractDistributionPackageBuilder.java?rev=1770947&r1=1770946&r2=1770947&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/AbstractDistributionPackageBuilder.java (original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/AbstractDistributionPackageBuilder.java Wed Nov 23 11:07:18 2016
@@ -258,62 +258,4 @@ public abstract class AbstractDistributi
     @CheckForNull
     protected abstract DistributionPackage getPackageInternal(@Nonnull ResourceResolver resourceResolver, @Nonnull String id);
 
-    /**
-     * extract the set of paths of resources that should be included in the package
-     * @param request the request
-     * @param resourceResolver the resource resolver used to browse the resource tree
-     * @return a set of paths
-     */
-    protected Set<String> readPaths(DistributionRequest request, ResourceResolver resourceResolver) {
-        Set<String> paths = new HashSet<String>();
-
-        for (String path : request.getPaths()) {
-            paths.add(path);
-            Resource resource = resourceResolver.getResource(path);
-            if (request.isDeep(path)) {
-                addSubtree(paths, resource);
-            } else {
-                for (Resource child : resource.getChildren()) {
-                    addFilteredPaths(request, child, paths);
-                }
-            }
-        }
-        return paths;
-    }
-
-    private void addFilteredPaths(DistributionRequest request, Resource resource, Set<String> paths) {
-        String path = resource.getPath();
-        if (filtersAllow(request.getFilters(path), path)) {
-            paths.add(path);
-            for (Resource child : resource.getChildren()) {
-                addFilteredPaths(request, child, paths);
-            }
-        }
-    }
-
-    private boolean filtersAllow(String[] filters, String path) {
-        boolean allowed = false;
-        for (String pattern : filters) {
-            if (pattern.startsWith("+")) {
-                if (Pattern.compile(pattern.substring(1)).matcher(path).matches()) {
-                    allowed = true;
-                }
-            } else if (pattern.startsWith("-")) {
-                if (Pattern.compile(pattern.substring(1)).matcher(path).matches()) {
-                    allowed = false;
-                }
-            } else {
-                allowed = Pattern.compile(pattern).matcher(path).matches();
-            }
-        }
-        return allowed;
-    }
-
-    private void addSubtree(Set<String> paths, Resource resource) {
-        for (Resource r : resource.getChildren()) {
-            paths.add(r.getPath());
-            addSubtree(paths, r);
-        }
-    }
-
 }