This is an automated email from the ASF dual-hosted git repository.

tmaret pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git


The following commit(s) were added to refs/heads/master by this push:
     new 722890c  SLING-8361 - Log subscriber steps to manage consumption status
722890c is described below

commit 722890cd3485eef674f9a9450af21f299e85a352
Author: tmaret <[email protected]>
AuthorDate: Fri Apr 19 00:17:13 2019 +0200

    SLING-8361 - Log subscriber steps to manage consumption status
---
 .../distribution/journal/impl/subscriber/LocalStore.java | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/LocalStore.java
 
b/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/LocalStore.java
index 7332402..8e43e8a 100644
--- 
a/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/LocalStore.java
+++ 
b/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/LocalStore.java
@@ -36,7 +36,9 @@ import javax.annotation.ParametersAreNonnullByDefault;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
+import static java.util.Collections.emptyMap;
 import static java.util.Collections.singletonMap;
 import static java.util.Objects.requireNonNull;
 import static org.apache.sling.api.resource.ResourceResolverFactory.SUBSERVICE;
@@ -89,11 +91,9 @@ public class LocalStore {
         try (ResourceResolver serviceResolver = 
requireNonNull(getBookKeeperServiceResolver())) {
             Resource parent = getParent(serviceResolver);
             Resource store = parent.getChild(storeId);
-            ValueMap map = (store != null)
-                    ? store.getValueMap()
-                    : new ValueMapDecorator(Collections.emptyMap());
-            LOG.debug(String.format("Loaded data %s for storeId %s", 
map.toString(), storeId));
-            return map;
+            Map<String, Object> properties = (store != null) ? 
filterJcrProperties(store.getValueMap()) : emptyMap();
+            LOG.debug(String.format("Loaded data %s for storeId %s", 
properties.toString(), storeId));
+            return new ValueMapDecorator(properties);
         } catch (LoginException e) {
             throw new RuntimeException("Failed to load data from the 
repository." + e.getMessage(), e);
         }
@@ -114,6 +114,12 @@ public class LocalStore {
         }
     }
 
+    private Map filterJcrProperties(ValueMap map) {
+        return map.entrySet().stream()
+                .filter(e -> ! e.getKey().startsWith("jcr:"))
+                .collect(Collectors.toMap(Map.Entry::getKey, 
Map.Entry::getValue));
+    }
+
     private ResourceResolver getBookKeeperServiceResolver() throws 
LoginException {
         return 
resolverFactory.getServiceResourceResolver(singletonMap(SUBSERVICE, 
"bookkeeper"));
     }

Reply via email to