You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:56:18 UTC
[sling-org-apache-sling-nosql-mongodb-resourceprovider] 04/10:
SLING-5024 remove obsolete files
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.nosql.mongodb-resourceprovider-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-nosql-mongodb-resourceprovider.git
commit 80f8506ed60cec6a3c6f974271f12b56b1a58077
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Sep 14 23:08:23 2015 +0000
SLING-5024 remove obsolete files
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/nosql/mongodb-resourceprovider@1703075 13f79535-47bb-0310-9956-ffa450edef68
---
src/main/couchbase-views/ancestorPath.js | 40 -----------
src/main/couchbase-views/ancestorPathTester.html | 84 ----------------------
src/main/couchbase-views/parentPath.js | 37 ----------
src/main/couchbase-views/parentPathTester.html | 82 ---------------------
.../resourceprovider/impl/MongoDBNoSqlAdapter.java | 4 +-
5 files changed, 2 insertions(+), 245 deletions(-)
diff --git a/src/main/couchbase-views/ancestorPath.js b/src/main/couchbase-views/ancestorPath.js
deleted file mode 100644
index f8cd94b..0000000
--- a/src/main/couchbase-views/ancestorPath.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * Emits for each document the all parent paths - allowing to fetch children and their decendants by path.
- * Includes the path of the item itself.
- */
-function(doc, meta) {
-
- // handle only sling resource documents with a valid path
- if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
- return;
- }
- var pathParts = doc.path.split("/");
- if (pathParts.length < 3) {
- return;
- }
-
- while (pathParts.length >= 2) {
- // remove last element to get parent path
- var parentPath = pathParts.join("/");
- emit(parentPath, null);
- pathParts.pop();
- }
-}
diff --git a/src/main/couchbase-views/ancestorPathTester.html b/src/main/couchbase-views/ancestorPathTester.html
deleted file mode 100644
index 9933e6f..0000000
--- a/src/main/couchbase-views/ancestorPathTester.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
- <head>
- <title>Couchbase View Tester</title>
- <style>body { font-family: Courier }</style>
- </head>
- <body>
-
-<script>
-
-var emit = function(key, value) {
- document.write("[" + key + "]" + "<br/>");
-}
-
-var testFunction = function(doc, meta) {
-
- // handle only sling resource documents with a valid path
- if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
- return;
- }
- var pathParts = doc.path.split("/");
- if (pathParts.length < 3) {
- return;
- }
-
- while (pathParts.length >= 2) {
- // remove last element to get parent path
- var parentPath = pathParts.join("/");
- emit(parentPath, null);
- pathParts.pop();
- }
-};
-
-var testInput = [
- null,
- "",
- "abc",
- "/",
- "/content",
- "/content/node1",
- "/content/node1/node2",
- "/content/node1/node2/node3",
- "/content/node1/node2/node3/node4"
-];
-
-</script>
-
- <table border="1">
- <tr>
- <th>Input</th>
- <th>Output</th>
- </tr>
-<script>
-for (var i=0; i < testInput.length; i++) {
- document.write("<tr>")
- document.write("<td>" + testInput[i] + "</td>")
- document.write("<td>")
- testFunction({path: testInput[i], data: {}}, {id: "sling-resource:doc" + i});
- document.write("</td>")
- document.write("</tr>")
-}
-</script>
- </table>
-
- </body>
-</html>
diff --git a/src/main/couchbase-views/parentPath.js b/src/main/couchbase-views/parentPath.js
deleted file mode 100644
index 54c4c1f..0000000
--- a/src/main/couchbase-views/parentPath.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * Emits for each document the direct parent path - allowing to fetch direct children by path.
- */
-function(doc, meta) {
-
- // handle only sling resource documents with a valid path
- if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
- return;
- }
- var pathParts = doc.path.split("/");
- if (pathParts.length < 3) {
- return;
- }
-
- // remove last element to get parent path
- pathParts.pop();
- var parentPath = pathParts.join("/");
- emit(parentPath, null);
-}
diff --git a/src/main/couchbase-views/parentPathTester.html b/src/main/couchbase-views/parentPathTester.html
deleted file mode 100644
index efcc2d1..0000000
--- a/src/main/couchbase-views/parentPathTester.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
- <head>
- <title>Couchbase View Tester</title>
- <style>body { font-family: Courier }</style>
- </head>
- <body>
-
-<script>
-
-var emit = function(key, value) {
- document.write("[" + key + "]" + "<br/>");
-}
-
-var testFunction = function(doc, meta) {
-
- // handle only sling resource documents with a valid path
- if (!(meta.id.indexOf("sling-resource:")==0 && doc.path && doc.data)) {
- return;
- }
- var pathParts = doc.path.split("/");
- if (pathParts.length < 3) {
- return;
- }
-
- // remove last element to get parent path
- pathParts.pop();
- var parentPath = pathParts.join("/");
- emit(parentPath, null);
-};
-
-var testInput = [
- null,
- "",
- "abc",
- "/",
- "/content",
- "/content/node1",
- "/content/node1/node2",
- "/content/node1/node2/node3",
- "/content/node1/node2/node3/node4"
-];
-
-</script>
-
- <table border="1">
- <tr>
- <th>Input</th>
- <th>Output</th>
- </tr>
-<script>
-for (var i=0; i < testInput.length; i++) {
- document.write("<tr>")
- document.write("<td>" + testInput[i] + "</td>")
- document.write("<td>")
- testFunction({path: testInput[i], data: {}}, {id: "sling-resource:doc" + i});
- document.write("</td>")
- document.write("</tr>")
-}
-</script>
- </table>
-
- </body>
-</html>
diff --git a/src/main/java/org/apache/sling/nosql/mongodb/resourceprovider/impl/MongoDBNoSqlAdapter.java b/src/main/java/org/apache/sling/nosql/mongodb/resourceprovider/impl/MongoDBNoSqlAdapter.java
index fe509f2..8e034fc 100644
--- a/src/main/java/org/apache/sling/nosql/mongodb/resourceprovider/impl/MongoDBNoSqlAdapter.java
+++ b/src/main/java/org/apache/sling/nosql/mongodb/resourceprovider/impl/MongoDBNoSqlAdapter.java
@@ -99,8 +99,8 @@ public final class MongoDBNoSqlAdapter extends AbstractNoSqlAdapter {
@Override
public boolean deleteRecursive(String path) {
- Pattern decendantsAndSelf = Pattern.compile("^" + Pattern.quote(path) + "(/.+)?$");
- DeleteResult result = collection.deleteMany(Filters.regex(ID_PROPERTY, decendantsAndSelf));
+ Pattern descendantsAndSelf = Pattern.compile("^" + Pattern.quote(path) + "(/.+)?$");
+ DeleteResult result = collection.deleteMany(Filters.regex(ID_PROPERTY, descendantsAndSelf));
// return true if any document was deleted
return result.getDeletedCount() > 0;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.