sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpet...@apache.org
Subject svn commit: r1637071 - in /sling/trunk/contrib/extensions/replication: core/src/main/java/org/apache/sling/replication/agent/impl/ core/src/main/java/org/apache/sling/replication/component/impl/ core/src/main/java/org/apache/sling/replication/packaging...
Date Thu, 06 Nov 2014 10:45:43 GMT
Author: mpetria
Date: Thu Nov  6 10:45:43 2014
New Revision: 1637071

URL: http://svn.apache.org/r1637071
Log:
SLING-4060: initial refactoring for property parsing

Added:
    sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/SettingsUtilsTest.java
Modified:
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/CoordinatingReplicationAgentFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/GenericReplicationComponentFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/SettingsUtils.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/AgentReplicationPackageExporterFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/LocalReplicationPackageExporterFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/RemoteReplicationPackageExporterFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/LocalReplicationPackageImporterFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/RemoteReplicationPackageImporterFactory.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/RemoteEventReplicationTrigger.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/ScheduledReplicationTrigger.java
    sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactoryTest.java
    sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish-reverse.json
    sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish.json
    sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.publish/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-reverse.json

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/CoordinatingReplicationAgentFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/CoordinatingReplicationAgentFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/CoordinatingReplicationAgentFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/CoordinatingReplicationAgentFactory.java Thu Nov  6 10:45:43 2014
@@ -20,12 +20,9 @@ package org.apache.sling.replication.age
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.felix.scr.annotations.Activate;
@@ -41,6 +38,7 @@ import org.apache.sling.replication.comp
 import org.apache.sling.replication.component.ReplicationComponent;
 import org.apache.sling.replication.component.ReplicationComponentFactory;
 import org.apache.sling.replication.component.ReplicationComponentProvider;
+import org.apache.sling.replication.component.impl.SettingsUtils;
 import org.apache.sling.replication.event.impl.ReplicationEventFactory;
 import org.apache.sling.replication.queue.ReplicationQueueDistributionStrategy;
 import org.apache.sling.replication.queue.ReplicationQueueProvider;
@@ -86,12 +84,18 @@ public class CoordinatingReplicationAgen
     @Property(label = "Service Name")
     public static final String SERVICE_NAME = ReplicationComponentFactory.AGENT_SIMPLE_PROPERTY_SERVICE_NAME;
 
-    @Property(label = "Package Exporter", cardinality = 100)
+    @Property(label = "Request Authorization Strategy Properties", cardinality = 100)
+    public static final String REQUEST_AUTHORIZATION_STRATEGY = ReplicationComponentFactory.COMPONENT_REQUEST_AUTHORIZATION_STRATEGY;
+
+    @Property(label = "Package Exporter Properties", cardinality = 100)
     public static final String PACKAGE_EXPORTER = ReplicationComponentFactory.COMPONENT_PACKAGE_EXPORTER;
 
-    @Property(label = "Package Importer", cardinality = 100)
+    @Property(label = "Package Importer Properties", cardinality = 100)
     public static final String PACKAGE_IMPORTER = ReplicationComponentFactory.COMPONENT_PACKAGE_IMPORTER;
 
+    @Property(label = "Trigger Properties", cardinality = 100)
+    public static final String TRIGGER = ReplicationComponentFactory.COMPONENT_TRIGGER;
+
     @Property(label = "Target TransportAuthenticationProvider", name = TRANSPORT_AUTHENTICATION_PROVIDER_TARGET)
     @Reference(name = "transportAuthenticationProvider")
     private volatile TransportAuthenticationProvider transportAuthenticationProvider;
@@ -130,28 +134,29 @@ public class CoordinatingReplicationAgen
             props.put(NAME, agentName);
 
             if (componentReg == null) {
-                Map<String, Object> properties = new HashMap<String, Object>();
-                properties.putAll(config);
-
-                String[] packageImporterProperties = PropertiesUtil.toStringArray(properties.get(PACKAGE_IMPORTER));
-                String[] packageExporterProperties = PropertiesUtil.toStringArray(properties.get(PACKAGE_EXPORTER));
+                String[] requestAuthProperties = PropertiesUtil.toStringArray(config.get(REQUEST_AUTHORIZATION_STRATEGY), new String[0]);
+                String[] packageImporterProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_IMPORTER), new String[0]);
+                String[] packageExporterProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_EXPORTER), new String[0]);
+                String[] triggerProperties = PropertiesUtil.toStringArray(config.get(TRIGGER), new String[0]);
 
                 if (packageImporterProperties == null || packageExporterProperties == null ||
                         packageImporterProperties.length == 0 || packageExporterProperties.length == 0) {
                     throw new IllegalArgumentException("package exporters and importers cannot be null/empty");
                 }
 
-                List<String> packageImporterPropertiesList = new ArrayList<String>();
-                packageImporterPropertiesList.addAll(Arrays.asList(packageImporterProperties));
-                packageImporterPropertiesList.add("type=remote");
-                packageImporterProperties = packageImporterPropertiesList.toArray(new String[packageImporterPropertiesList.size()]);
-                properties.put(PACKAGE_IMPORTER, packageImporterProperties);
-
-                List<String> packageExporterPropertiesList = new ArrayList<String>();
-                packageExporterPropertiesList.addAll(Arrays.asList(packageExporterProperties));
-                packageExporterPropertiesList.add("type=remote");
-                packageExporterProperties = packageExporterPropertiesList.toArray(new String[packageExporterPropertiesList.size()]);
-                properties.put(PACKAGE_EXPORTER, packageExporterProperties);
+
+                Map<String, Object> properties = new HashMap<String, Object>();
+                properties.putAll(config);
+
+                properties.put(REQUEST_AUTHORIZATION_STRATEGY, SettingsUtils.parseLines(requestAuthProperties));
+                properties.put(PACKAGE_IMPORTER, SettingsUtils.parseLines(packageImporterProperties));
+                properties.put(PACKAGE_EXPORTER, SettingsUtils.parseLines(packageExporterProperties));
+                properties.put(TRIGGER, SettingsUtils.parseLines(triggerProperties));
+
+                // ensure exporter and importer are remote
+                ((Map) properties.get(PACKAGE_EXPORTER)).put("type", "remote");
+                ((Map) properties.get(PACKAGE_IMPORTER)).put("type", "remote");
+
 
                 ReplicationAgent agent = componentFactory.createComponent(ReplicationAgent.class, properties, this);
 

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentFactory.java Thu Nov  6 10:45:43 2014
@@ -20,10 +20,7 @@ package org.apache.sling.replication.age
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Random;
+import java.util.*;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -40,6 +37,7 @@ import org.apache.sling.replication.comp
 import org.apache.sling.replication.component.ReplicationComponent;
 import org.apache.sling.replication.component.ReplicationComponentFactory;
 import org.apache.sling.replication.component.ReplicationComponentProvider;
+import org.apache.sling.replication.component.impl.SettingsUtils;
 import org.apache.sling.replication.event.impl.ReplicationEventFactory;
 import org.apache.sling.replication.queue.ReplicationQueueDistributionStrategy;
 import org.apache.sling.replication.queue.ReplicationQueueProvider;
@@ -90,6 +88,10 @@ public class SimpleReplicationAgentFacto
     @Property(label = "Package Importer Properties", cardinality = 100)
     public static final String PACKAGE_IMPORTER = ReplicationComponentFactory.COMPONENT_PACKAGE_IMPORTER;
 
+    @Property(label = "Trigger Properties", cardinality = 100)
+    public static final String TRIGGER = ReplicationComponentFactory.COMPONENT_TRIGGER;
+
+
     @Property(label = "Service Name")
     public static final String SERVICE_NAME = ReplicationComponentFactory.AGENT_SIMPLE_PROPERTY_SERVICE_NAME;
 
@@ -133,7 +135,27 @@ public class SimpleReplicationAgentFacto
             props.put(NAME, agentName);
 
             if (componentReg == null && componentFactory != null) {
-                ReplicationAgent agent = componentFactory.createComponent(ReplicationAgent.class, config, this);
+
+                String[] requestAuthProperties = PropertiesUtil.toStringArray(config.get(REQUEST_AUTHORIZATION_STRATEGY), new String[0]);
+                String[] packageImporterProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_IMPORTER), new String[0]);
+                String[] packageExporterProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_EXPORTER), new String[0]);
+                String[] triggerProperties = PropertiesUtil.toStringArray(config.get(TRIGGER), new String[0]);
+
+                Map<String, Object> properties = new HashMap<String, Object>();
+                properties.putAll(config);
+
+                properties.put(REQUEST_AUTHORIZATION_STRATEGY, SettingsUtils.parseLines(requestAuthProperties));
+                properties.put(PACKAGE_IMPORTER, SettingsUtils.parseLines(packageImporterProperties));
+                properties.put(PACKAGE_EXPORTER, SettingsUtils.parseLines(packageExporterProperties));
+                properties.put(TRIGGER, SettingsUtils.parseLines(triggerProperties));
+
+                ReplicationAgent agent = null;
+                try {
+                    agent = componentFactory.createComponent(ReplicationAgent.class, properties, this);
+                }
+                catch (IllegalArgumentException e) {
+                    log.warn("cannot create agent", e);
+                }
 
                 log.debug("activated agent {}", agentName);
 

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactory.java Thu Nov  6 10:45:43 2014
@@ -126,20 +126,17 @@ public class DefaultReplicationComponent
         if (componentProvider == null) {
             componentProvider = this;
         }
-        try {
-            if (type.isAssignableFrom(ReplicationAgent.class)) {
-                return (ComponentType) createAgent(properties, componentProvider);
-            } else if (type.isAssignableFrom(ReplicationTrigger.class)) {
-                return (ComponentType) createTrigger(properties, componentProvider);
-            } else if (type.isAssignableFrom(TransportAuthenticationProvider.class)) {
-                return (ComponentType) createTransportAuthenticationProvider(properties, componentProvider);
-            } else if (type.isAssignableFrom(ReplicationPackageImporter.class)) {
-                return (ComponentType) createImporter(properties, componentProvider);
-            } else if (type.isAssignableFrom(ReplicationPackageExporter.class)) {
-                return (ComponentType) createExporter(properties, componentProvider);
-            }
-        } catch (IllegalArgumentException e) {
-            log.warn("Cannot create component {}", new Object[]{type, properties}, e);
+
+        if (type.isAssignableFrom(ReplicationAgent.class)) {
+            return (ComponentType) createAgent(properties, componentProvider);
+        } else if (type.isAssignableFrom(ReplicationTrigger.class)) {
+            return (ComponentType) createTrigger(properties, componentProvider);
+        } else if (type.isAssignableFrom(TransportAuthenticationProvider.class)) {
+            return (ComponentType) createTransportAuthenticationProvider(properties, componentProvider);
+        } else if (type.isAssignableFrom(ReplicationPackageImporter.class)) {
+            return (ComponentType) createImporter(properties, componentProvider);
+        } else if (type.isAssignableFrom(ReplicationPackageExporter.class)) {
+            return (ComponentType) createExporter(properties, componentProvider);
         }
 
         return null;
@@ -388,19 +385,38 @@ public class DefaultReplicationComponent
         return triggers;
     }
 
-    Map<String, Object> extractMap(String key, Map<String, Object> objectMap) {
-        Map<String, Object> map = SettingsUtils.extractMap(key, objectMap);
-        return map == null ? new HashMap<String, Object>() : map;
+    Map<String, Object> extractMap(String key, Map<String, Object> sourceMap) {
+        sourceMap = sourceMap == null ? new HashMap<String, Object>() : sourceMap;
+
+        Object resultMapObject = sourceMap.get(key);
+
+        Map<String, Object> resultMap = null;
+        if (resultMapObject instanceof Map) {
+            resultMap = (Map) resultMapObject;
+        }
+
+        return resultMap == null ? new HashMap<String, Object>() : resultMap;
     }
 
-    List<Map<String, Object>> extractMapList(String key, Map<String, Object> objectMap) {
+    List<Map<String, Object>> extractMapList(String key, Map<String, Object> sourceMap) {
+
         List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
-        for (String mapKey : objectMap.keySet()) {
-            if (mapKey.startsWith(key)) {
-                result.add(SettingsUtils.extractMap(mapKey, objectMap));
+
+        sourceMap = sourceMap == null ? new HashMap<String, Object>() : sourceMap;
+
+        Object resultMapObject = sourceMap.get(key);
+
+        if (resultMapObject instanceof Map) {
+            Map<String, Object> resultMap = (Map) resultMapObject;
+            for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
+                if (entry.getValue() instanceof Map) {
+                    result.add((Map<String,Object>) entry.getValue());
+                }
             }
         }
+
         return result;
+
     }
 
     public <ComponentType extends ReplicationComponent> ComponentType getComponent(@Nonnull Class<ComponentType> type,

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/GenericReplicationComponentFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/GenericReplicationComponentFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/GenericReplicationComponentFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/GenericReplicationComponentFactory.java Thu Nov  6 10:45:43 2014
@@ -110,7 +110,8 @@ public class GenericReplicationComponent
 
 
             if (componentReg == null) {
-                Map<String, Object> configProperties = SettingsUtils.extractMap(PROPERTIES, config);
+                String[] propertyLines = PropertiesUtil.toStringArray(config.get(PROPERTIES));
+                Map<String, Object> configProperties = SettingsUtils.parseLines(propertyLines);
 
                 Map<String, Object> properties = new HashMap<String, Object>();
                 properties.putAll(config);
@@ -119,17 +120,22 @@ public class GenericReplicationComponent
                 String componentClass = null;
                 Object componentObject = null;
 
-                if (ReplicationComponentFactory.COMPONENT_AGENT.equals(componentType)) {
-                    ReplicationAgent agent = componentFactory.createComponent(ReplicationAgent.class, properties, this);
-                    componentClass = ReplicationAgent.class.getName();
-                    componentObject = agent;
+                try {
+                    if (ReplicationComponentFactory.COMPONENT_AGENT.equals(componentType)) {
+                        ReplicationAgent agent = componentFactory.createComponent(ReplicationAgent.class, properties, this);
+                        componentClass = ReplicationAgent.class.getName();
+                        componentObject = agent;
 
-                } else if (ReplicationComponentFactory.COMPONENT_TRIGGER.equals(componentType)) {
+                    } else if (ReplicationComponentFactory.COMPONENT_TRIGGER.equals(componentType)) {
 
-                    ReplicationTrigger trigger = componentFactory.createComponent(ReplicationTrigger.class, properties, this);
+                        ReplicationTrigger trigger = componentFactory.createComponent(ReplicationTrigger.class, properties, this);
 
-                    componentClass = ReplicationTrigger.class.getName();
-                    componentObject = trigger;
+                        componentClass = ReplicationTrigger.class.getName();
+                        componentObject = trigger;
+                    }
+                }
+                catch (IllegalArgumentException e) {
+                    log.warn("cannot create component", e);
                 }
 
                 if (componentObject != null && componentClass != null) {

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/SettingsUtils.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/SettingsUtils.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/SettingsUtils.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/component/impl/SettingsUtils.java Thu Nov  6 10:45:43 2014
@@ -19,7 +19,6 @@
 package org.apache.sling.replication.component.impl;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -28,23 +27,82 @@ import org.apache.sling.commons.osgi.Pro
 
 public class SettingsUtils {
 
+    private static final String COMPONENT_ROOT = "";
     private static final char COMPONENT_DELIM = '/';
     private static final char COMPONENT_MAP_BEGIN = '[';
     private static final char COMPONENT_MAP_END = ']';
+    private static final char COMPONENT_MAP_DELIM = '=';
 
-    public static Map<String, Object> extractMap(String key, Map<String, Object> objectMap) {
-        Object value = objectMap.get(key);
 
-        if (value instanceof String[]) {
-            return compactMap(SettingsUtils.toMap((String[]) value));
-        } else if (value instanceof String) {
-            return compactMap(SettingsUtils.toMap(((String) value).split(",")));
+    /**
+     * packageExporter/propertyKey=propertyValue
+     * packageExporter/endpoint[flag]=propertyValue
+     *
+     * packageExporter/packageBuilder/propertyKey=propertyValue
+     *
+     * propertyKey=propertyValue
+     * trigger[0]/propertyKey=propertyValue
+     * trigger[0]/propertyKey=propertyValue
+     *
+     * @param lines
+     * @return
+     */
+    public static Map<String, Object> parseLines(String[] lines) {
+        Map<String, Object> result = new HashMap<String, Object>();
+
+        Map<String, List<String>> linesMap = toLinesMap(lines);
+
+        for (Map.Entry<String, List<String>> entry : linesMap.entrySet()) {
+            String componentName = entry.getKey();
+            String[] componentLines = entry.getValue().toArray(new String[0]);
+
+            if (COMPONENT_ROOT.equals(componentName)) {
+                Map<String, String> map = PropertiesUtil.toMap(componentLines, new String [0]);
+                result.putAll(map);
+            }
+            else {
+                Map<String, Object> componentMap = parseLines(componentLines);
+                result.put(componentName, componentMap);
+            }
         }
-        return null;
+
+        result = collapseMap(result);
+        return result;
     }
 
+    public static Map<String, List<String>> toLinesMap(String[] lines) {
+        Map<String, List<String>> result = new HashMap<String, List<String>>();
+
+
+        for (String line : lines) {
+            int firstMapDelim = line.indexOf(COMPONENT_MAP_DELIM);
+            if (firstMapDelim < 0) {
+                continue;
+            }
+
+            int firstDelim = line.substring(0, firstMapDelim).indexOf(COMPONENT_DELIM);
+            String key = COMPONENT_ROOT;
+            String value = line;
+
+            if (firstDelim >= 0) {
+                key = line.substring(0, firstDelim);
+                value = line.substring(firstDelim + 1);
+            }
+
+
+            if (!result.containsKey(key)) {
+                result.put(key, new ArrayList<String>());
+            }
+
+            List<String> exitingLines = result.get(key);
+            exitingLines.add(value);
 
-    public static Map<String, Object> compactMap(Map<String, Object> valueMap) {
+        }
+
+        return result;
+    }
+
+    public static Map<String, Object> collapseMap(Map<String, Object> valueMap) {
 
         Map<String, Object> result = new HashMap<String, Object>();
 
@@ -54,21 +112,27 @@ public class SettingsUtils {
             int beginDelim = key.indexOf(COMPONENT_MAP_BEGIN);
             int endDelim = key.indexOf(COMPONENT_MAP_END);
 
-            if (beginDelim >= 0 && endDelim > beginDelim && value instanceof String) {
+            if (beginDelim >= 0 && endDelim > beginDelim) {
                 String newKey = key.substring(0, beginDelim);
                 String partialKey = key.substring(beginDelim + 1, endDelim);
 
-                String newValue = (String) value;
 
-                try {
-                    Integer.parseInt(partialKey);
-                    // newKey[0] = newValue
-                } catch (NumberFormatException e) {
-                    // newKey[partialKey] = newValue
-                    newValue = partialKey + "=" + newValue;
+                boolean isNumber = isNumber(partialKey);
+
+                if (!result.containsKey(newKey)) {
+                    result.put(newKey, isNumber? new ArrayList<Object>() : new HashMap<String, Object>());
                 }
 
-                addValueInArray(result, newKey, newValue);
+                Object existingObject = result.get(newKey);
+                if (existingObject instanceof Map) {
+                    ((Map) existingObject).put(partialKey, value);
+                }
+                else if (existingObject instanceof List) {
+                    ((List) existingObject).add(value);
+                }
+                else {
+                    // skip if there is already something else in there
+                }
             } else {
                 result.put(key, value);
             }
@@ -78,47 +142,13 @@ public class SettingsUtils {
 
     }
 
-    public static Map<String, Object> toMap(String[] lines) {
-        Map<String, Object> result = new HashMap<String, Object>();
-
-        Map<String, String> valueMap = PropertiesUtil.toMap(lines, new String[0]);
-
-        for (Map.Entry<String, String> entry : valueMap.entrySet()) {
-            String key = entry.getKey();
-            String value = entry.getValue();
-            int firstDelim = key.indexOf(COMPONENT_DELIM);
-            if (firstDelim >= 0) {
-                String newKey = key.substring(0, firstDelim);
-                String newValue = key.substring(firstDelim + 1) + "=" + value;
-
-                addValueInArray(result, newKey, newValue);
-            } else {
-                result.put(key, value);
-            }
-
+    private static boolean isNumber(String value) {
+        try {
+            Integer.parseInt(value);
+            return true;
         }
-
-        return result;
-
-    }
-
-    public static void addValueInArray(Map<String, Object> map, String key, String value) {
-        String[] arayValue;
-
-        if (map.containsKey(key) && map.get(key) instanceof String[]) {
-            String[] existingArray = (String[]) map.get(key);
-
-
-            List<String> newList = new ArrayList<String>();
-            Collections.addAll(newList, existingArray);
-            newList.add(value);
-            arayValue = newList.toArray(new String[newList.size()]);
-        } else {
-            arayValue = new String[]{value};
+        catch (NumberFormatException e) {
+            return false;
         }
-
-        map.put(key, arayValue);
-
     }
-
 }

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/AgentReplicationPackageExporterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/AgentReplicationPackageExporterFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/AgentReplicationPackageExporterFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/AgentReplicationPackageExporterFactory.java Thu Nov  6 10:45:43 2014
@@ -20,6 +20,7 @@ package org.apache.sling.replication.pac
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -31,11 +32,13 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.replication.agent.ReplicationAgent;
 import org.apache.sling.replication.component.ReplicationComponent;
 import org.apache.sling.replication.component.ReplicationComponentFactory;
 import org.apache.sling.replication.component.ReplicationComponentProvider;
 import org.apache.sling.replication.communication.ReplicationRequest;
+import org.apache.sling.replication.component.impl.SettingsUtils;
 import org.apache.sling.replication.packaging.ReplicationPackage;
 import org.apache.sling.replication.packaging.ReplicationPackageExporter;
 import org.apache.sling.replication.serialization.ReplicationPackageBuildingException;
@@ -61,6 +64,10 @@ public class AgentReplicationPackageExpo
     @Reference(name = "ReplicationAgent", policy = ReferencePolicy.STATIC)
     private ReplicationAgent agent;
 
+
+    @Property(label = "Package Builder Properties", cardinality = 100)
+    public static final String PACKAGE_BUILDER = ReplicationComponentFactory.COMPONENT_PACKAGE_BUILDER;
+
     @Reference
     ReplicationComponentFactory replicationComponentFactory;
 
@@ -70,7 +77,12 @@ public class AgentReplicationPackageExpo
     @Activate
     public void activate(Map<String, Object> config) throws Exception {
 
-        packageExporter = replicationComponentFactory.createComponent(ReplicationPackageExporter.class, config, this);
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.putAll(config);
+        String[] packageBuilderProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_BUILDER));
+        properties.put(PACKAGE_BUILDER, SettingsUtils.parseLines(packageBuilderProperties));
+
+        packageExporter = replicationComponentFactory.createComponent(ReplicationPackageExporter.class, properties, this);
     }
 
     @Nonnull

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/LocalReplicationPackageExporterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/LocalReplicationPackageExporterFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/LocalReplicationPackageExporterFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/LocalReplicationPackageExporterFactory.java Thu Nov  6 10:45:43 2014
@@ -19,6 +19,7 @@
 package org.apache.sling.replication.packaging.impl.exporter;
 
 import javax.annotation.Nonnull;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -29,8 +30,10 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.replication.component.ReplicationComponentFactory;
 import org.apache.sling.replication.communication.ReplicationRequest;
+import org.apache.sling.replication.component.impl.SettingsUtils;
 import org.apache.sling.replication.packaging.ReplicationPackage;
 import org.apache.sling.replication.packaging.ReplicationPackageExporter;
 import org.apache.sling.replication.serialization.ReplicationPackageBuildingException;
@@ -57,6 +60,9 @@ public class LocalReplicationPackageExpo
     @Property
     private static final String NAME = ReplicationComponentFactory.COMPONENT_NAME;
 
+    @Property(label = "Package Builder Properties", cardinality = 100)
+    public static final String PACKAGE_BUILDER = ReplicationComponentFactory.COMPONENT_PACKAGE_BUILDER;
+
     @Reference
     ReplicationComponentFactory replicationComponentFactory;
 
@@ -64,7 +70,12 @@ public class LocalReplicationPackageExpo
 
     @Activate
     public void activate(Map<String, Object> config) {
-        exporter = replicationComponentFactory.createComponent(ReplicationPackageExporter.class, config, null);
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.putAll(config);
+        String[] packageBuilderProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_BUILDER));
+        properties.put(PACKAGE_BUILDER, SettingsUtils.parseLines(packageBuilderProperties));
+
+        exporter = replicationComponentFactory.createComponent(ReplicationPackageExporter.class, properties, null);
     }
 
 

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/RemoteReplicationPackageExporterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/RemoteReplicationPackageExporterFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/RemoteReplicationPackageExporterFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/exporter/RemoteReplicationPackageExporterFactory.java Thu Nov  6 10:45:43 2014
@@ -20,6 +20,7 @@ package org.apache.sling.replication.pac
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -33,10 +34,12 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.replication.component.ReplicationComponent;
 import org.apache.sling.replication.component.ReplicationComponentFactory;
 import org.apache.sling.replication.component.ReplicationComponentProvider;
 import org.apache.sling.replication.communication.ReplicationRequest;
+import org.apache.sling.replication.component.impl.SettingsUtils;
 import org.apache.sling.replication.packaging.ReplicationPackage;
 import org.apache.sling.replication.packaging.ReplicationPackageExporter;
 import org.apache.sling.replication.serialization.ReplicationPackageBuildingException;
@@ -87,6 +90,9 @@ public class RemoteReplicationPackageExp
     private static final String ENDPOINT_STRATEGY = ReplicationComponentFactory.PACKAGE_EXPORTER_REMOTE_PROPERTY_ENDPOINTS_STRATEGY;
 
 
+    @Property(label = "Package Builder Properties", cardinality = 100)
+    public static final String PACKAGE_BUILDER = ReplicationComponentFactory.COMPONENT_PACKAGE_BUILDER;
+
     @Reference
     ReplicationComponentFactory replicationComponentFactory;
 
@@ -94,7 +100,12 @@ public class RemoteReplicationPackageExp
 
     @Activate
     protected void activate(Map<String, Object> config) throws Exception {
-        exporter = replicationComponentFactory.createComponent(ReplicationPackageExporter.class, config, this);
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.putAll(config);
+        String[] packageBuilderProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_BUILDER));
+        properties.put(PACKAGE_BUILDER, SettingsUtils.parseLines(packageBuilderProperties));
+
+        exporter = replicationComponentFactory.createComponent(ReplicationPackageExporter.class, properties, this);
     }
 
 

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/LocalReplicationPackageImporterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/LocalReplicationPackageImporterFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/LocalReplicationPackageImporterFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/LocalReplicationPackageImporterFactory.java Thu Nov  6 10:45:43 2014
@@ -20,6 +20,7 @@ package org.apache.sling.replication.pac
 
 import javax.annotation.Nonnull;
 import java.io.InputStream;
+import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.felix.scr.annotations.Activate;
@@ -29,7 +30,9 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.replication.component.ReplicationComponentFactory;
+import org.apache.sling.replication.component.impl.SettingsUtils;
 import org.apache.sling.replication.packaging.ReplicationPackage;
 import org.apache.sling.replication.packaging.ReplicationPackageImportException;
 import org.apache.sling.replication.packaging.ReplicationPackageImporter;
@@ -55,6 +58,10 @@ public class LocalReplicationPackageImpo
     @Property
     private static final String NAME = ReplicationComponentFactory.COMPONENT_NAME;
 
+
+    @Property(label = "Package Builder Properties", cardinality = 100)
+    public static final String PACKAGE_BUILDER = ReplicationComponentFactory.COMPONENT_PACKAGE_BUILDER;
+
     @Reference
     private ReplicationComponentFactory componentFactory;
 
@@ -62,7 +69,12 @@ public class LocalReplicationPackageImpo
 
     @Activate
     public void activate(Map<String, Object> config) {
-        importer = componentFactory.createComponent(ReplicationPackageImporter.class, config, null);
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.putAll(config);
+        String[] packageBuilderProperties = PropertiesUtil.toStringArray(config.get(PACKAGE_BUILDER));
+        properties.put(PACKAGE_BUILDER, SettingsUtils.parseLines(packageBuilderProperties));
+
+        importer = componentFactory.createComponent(ReplicationPackageImporter.class, properties, null);
     }
 
 

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/RemoteReplicationPackageImporterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/RemoteReplicationPackageImporterFactory.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/RemoteReplicationPackageImporterFactory.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/packaging/impl/importer/RemoteReplicationPackageImporterFactory.java Thu Nov  6 10:45:43 2014
@@ -21,6 +21,7 @@ package org.apache.sling.replication.pac
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import java.io.InputStream;
+import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.felix.scr.annotations.Activate;
@@ -32,9 +33,11 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.replication.component.ReplicationComponent;
 import org.apache.sling.replication.component.ReplicationComponentFactory;
 import org.apache.sling.replication.component.ReplicationComponentProvider;
+import org.apache.sling.replication.component.impl.SettingsUtils;
 import org.apache.sling.replication.packaging.ReplicationPackage;
 import org.apache.sling.replication.packaging.ReplicationPackageImportException;
 import org.apache.sling.replication.packaging.ReplicationPackageImporter;
@@ -90,7 +93,10 @@ public class RemoteReplicationPackageImp
     @Activate
     protected void activate(BundleContext context, Map<String, Object> config) throws Exception {
 
-        importer = replicationComponentFactory.createComponent(ReplicationPackageImporter.class, config, this);
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.putAll(config);
+
+        importer = replicationComponentFactory.createComponent(ReplicationPackageImporter.class, properties, this);
 
     }
 

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/RemoteEventReplicationTrigger.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/RemoteEventReplicationTrigger.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/RemoteEventReplicationTrigger.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/RemoteEventReplicationTrigger.java Thu Nov  6 10:45:43 2014
@@ -56,6 +56,7 @@ import org.slf4j.LoggerFactory;
  * on a certain URL
  */
 public class RemoteEventReplicationTrigger implements ReplicationTrigger {
+    private final static String SCHEDULE_NAME = "remoteEventTrigger";
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -89,7 +90,7 @@ public class RemoteEventReplicationTrigg
             log.info("applying remote event replication trigger");
 
             ScheduleOptions options = scheduler.NOW();
-            options.name(requestHandler.toString());
+            options.name(getJobName(requestHandler));
             scheduler.schedule(new EventBasedReplication(requestHandler), options);
         } catch (Exception e) {
             throw new ReplicationTriggerException("unable to register handler " + requestHandler, e);
@@ -101,6 +102,11 @@ public class RemoteEventReplicationTrigg
         if (httpResponseFuture != null) {
             httpResponseFuture.cancel(true);
         }
+        scheduler.unschedule(getJobName(requestHandler));
+    }
+
+    String getJobName(ReplicationRequestHandler requestHandler) {
+        return SCHEDULE_NAME + requestHandler.toString();
     }
 
     private class SSEResponseConsumer extends BasicAsyncResponseConsumer {

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/ScheduledReplicationTrigger.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/ScheduledReplicationTrigger.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/ScheduledReplicationTrigger.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/trigger/impl/ScheduledReplicationTrigger.java Thu Nov  6 10:45:43 2014
@@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory;
  * {@link org.apache.sling.replication.agent.ReplicationAgent}
  */
 public class ScheduledReplicationTrigger implements ReplicationTrigger {
+    private final static String SCHEDULE_NAME = "scheduledEventTrigger";
+
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -55,7 +57,7 @@ public class ScheduledReplicationTrigger
     public void register(@Nonnull ReplicationRequestHandler requestHandler) throws ReplicationTriggerException {
         try {
             ScheduleOptions options = scheduler.NOW(-1, secondsInterval);
-            options.name(requestHandler.toString());
+            options.name(getJobName(requestHandler));
             scheduler.schedule(new ScheduledReplication(requestHandler), options);
         } catch (Exception e) {
             throw new ReplicationTriggerException("unable to register handler " + requestHandler, e);
@@ -63,7 +65,7 @@ public class ScheduledReplicationTrigger
     }
 
     public void unregister(@Nonnull ReplicationRequestHandler requestHandler) throws ReplicationTriggerException {
-        scheduler.unschedule(requestHandler.toString());
+        scheduler.unschedule(getJobName(requestHandler));
     }
 
     private class ScheduledReplication implements Runnable {
@@ -79,4 +81,8 @@ public class ScheduledReplicationTrigger
             requestHandler.handle(new ReplicationRequest(System.currentTimeMillis(), replicationAction, path));
         }
     }
+
+    String getJobName(ReplicationRequestHandler requestHandler) {
+        return SCHEDULE_NAME + requestHandler.toString();
+    }
 }

Modified: sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactoryTest.java?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactoryTest.java (original)
+++ sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/DefaultReplicationComponentFactoryTest.java Thu Nov  6 10:45:43 2014
@@ -33,6 +33,7 @@ import org.junit.Test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -50,8 +51,15 @@ public class DefaultReplicationComponent
         ReplicationComponentProvider provider = mock(ReplicationComponentProvider.class);
         ReplicationAgent agent = mock(ReplicationAgent.class);
         when(provider.getComponent(ReplicationAgent.class, name)).thenReturn(agent);
-        ReplicationAgent component = defaultReplicationComponentFactory.createComponent(ReplicationAgent.class, properties, provider);
-        assertNull(component); // agents cannot be referenced by service name using the factory
+        try {
+            ReplicationAgent component = defaultReplicationComponentFactory.createComponent(ReplicationAgent.class, properties, provider);
+
+            fail("agents cannot be referenced by service name using the factory");
+
+        }
+        catch (IllegalArgumentException e) {
+            // expect to fail
+        }
     }
 
     @Test

Added: sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/SettingsUtilsTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/SettingsUtilsTest.java?rev=1637071&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/SettingsUtilsTest.java (added)
+++ sling/trunk/contrib/extensions/replication/core/src/test/java/org/apache/sling/replication/component/impl/SettingsUtilsTest.java Thu Nov  6 10:45:43 2014
@@ -0,0 +1,63 @@
+package org.apache.sling.replication.component.impl;
+
+import org.junit.Test;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class SettingsUtilsTest {
+
+    @Test
+    public void testParseMap() {
+        String[] lines = new String[] {
+                "packageExporter/exporterKey=exporterValue",
+                "packageExporter/exporterMap[key1]=mapvalue1",
+                "packageExporter/exporterBuilder/builderKey=builderValue",
+                "packageExporter/endpointsArray[0]=http://abc.com",
+
+                "mainKey=mainValue",
+                "trigger[0]/propertyKey1=propertyValue1",
+                "trigger[0]/propertyKey2=propertyValue2",
+                "slashKey=http://aaa.com"
+        };
+        Map<String, Object> result = SettingsUtils.parseLines(lines);
+
+        assertEquals("result map size", 4, result.size());
+
+        assertTrue(result.containsKey("packageExporter"));
+        Object packageExporterProperties = result.get("packageExporter");
+        assertTrue(packageExporterProperties instanceof Map);
+        Map<String, Object> packageExporterMap = (Map) packageExporterProperties;
+
+        assertTrue(packageExporterMap.containsKey("exporterKey"));
+        assertEquals("exporterValue", packageExporterMap.get("exporterKey"));
+        assertTrue(packageExporterMap.containsKey("exporterBuilder"));
+        assertTrue(packageExporterMap.get("exporterBuilder") instanceof Map);
+        Map exporterBuilderMap = (Map) packageExporterMap.get("exporterBuilder");
+        assertEquals("builderValue", exporterBuilderMap.get("builderKey"));
+        assertTrue(packageExporterMap.containsKey("exporterMap"));
+        assertTrue(packageExporterMap.get("exporterMap") instanceof Map);
+        Map exporterMap =  (Map) packageExporterMap.get("exporterMap");
+        assertEquals("mapvalue1", exporterMap.get("key1"));
+
+        assertTrue(packageExporterMap.containsKey("endpointsArray"));
+        assertTrue(packageExporterMap.get("endpointsArray") instanceof List);
+        assertEquals("http://abc.com", ((List)packageExporterMap.get("endpointsArray")).get(0));
+
+        assertTrue(result.containsKey("mainKey"));
+
+        assertTrue(result.containsKey("trigger"));
+        assertTrue(result.get("trigger") instanceof List);
+
+        List<Map> triggersList = (List<Map>) result.get("trigger");
+        assertTrue(triggersList.get(0) instanceof Map);
+        Map trigger0Map = triggersList.get(0);
+        assertEquals("propertyValue1", trigger0Map.get("propertyKey1"));
+        assertEquals("propertyValue2", trigger0Map.get("propertyKey2"));
+
+        assertTrue(result.containsKey("slashKey"));
+    }
+}

Modified: sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish-reverse.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish-reverse.json?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish-reverse.json (original)
+++ sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish-reverse.json Thu Nov  6 10:45:43 2014
@@ -24,22 +24,16 @@
         "packageBuilder/type=vlt"
     ],
 
-    "trigger0": [
-        "type=scheduledEvent",
-        "action=poll",
-        "seconds=30"
-    ],
+    "trigger": [
+        "scheduledTrigger/type=scheduledEvent",
+        "scheduledTrigger/action=poll",
+        "scheduledTrigger/seconds=30",
 
-    "trigger1": [
-        "type=remoteEvent",
-        "endpoint=http://localhost:4503/libs/sling/replication/services/triggers/content-changed.event"
+        "remoteTrigger/type=remoteEvent",
+        "remoteTrigger/endpoint=http://localhost:4503/libs/sling/replication/services/triggers/content-changed.event"
     ],
 
 
-    "queueProvider.target" : "(name=sjh)",
-
-    "queueDistributionStrategy.target": "(name=error)",
-
     "transportAuthenticationProvider.target" : "(name=publishAdmin)"
 
 }
\ No newline at end of file

Modified: sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish.json?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish.json (original)
+++ sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.author/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-publish.json Thu Nov  6 10:45:43 2014
@@ -23,9 +23,5 @@
         "packageBuilder/type=vlt"
     ],
 
-    "queueProvider.target" : "(name=sjh)",
-
-    "queueDistributionStrategy.target": "(name=error)",
-
     "transportAuthenticationProvider.target" : "(name=publishAdmin)"
 }
\ No newline at end of file

Modified: sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.publish/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-reverse.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.publish/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-reverse.json?rev=1637071&r1=1637070&r2=1637071&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.publish/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-reverse.json (original)
+++ sling/trunk/contrib/extensions/replication/sample/src/main/resources/SLING-CONTENT/libs/sling/replication/install.publish/org.apache.sling.replication.agent.impl.SimpleReplicationAgentFactory-reverse.json Thu Nov  6 10:45:43 2014
@@ -25,9 +25,9 @@
 
     "queueDistributionStrategy": "(name=single)",
 
-    "trigger0": [
-        "type=jcrEvent",
-        "path=/content/usergenerated",
-        "servicename=replicationService"
+    "trigger": [
+        "userGeneratedTrigger/type=jcrEvent",
+        "userGeneratedTrigger/path=/content/usergenerated",
+        "userGeneratedTrigger/servicename=replicationService"
     ]
 }



Mime
View raw message