[CONF] Apache Sling Replication - HTTP API (proposal)

2014-02-13 Thread Marius Petria (Confluence)














  


Marius Petria created a page:
 


Replication - HTTP API (proposal)   





API Requirements

We need to expose APIs for configuring, commanding and monitoring replication agents.
Configuration API

 Should allow CRUD operations for agent configs 
 Configs need to have a JCR representation (either the default one or a new one) in order to support the following workflow: configure all agents on a author instance and replicate configuration to all publish instances. 

Command API

 Should allow Replicate/Import Package/Export Package 
 Commands might be issued to multiple agents at once (but this not a strong requirement I think) 

Monitoring API

 Should allow inspection to internal queues of replication agents 
 Should allow inspection of commands history 


API endpoints
Configuration API

Create config - POST /system/replication/config
Read config - GET /system/replication/config/publish
Update config - PUT /system/replication/config/publish
Delete config - DELETE /system/replication/config/publish


Command API
For command and monitoring APIs we can have two kind of APIs. We do not need to implement both variants, and I do not think there is a strict requirement for choosing one variant or another.
The flattened APIs can take as parameters multiple agents and the granular APIs can take as parameters just on
Commands API - flattened
Replicate tree - POST /system/replication/all/replicate
Import package - POST /system/replication/all/import
Export package - POST /system/replication/all/export
Commands API - granular
Replicate tree - POST /system/replication/agent/{agentName}/replicate
Import package - POST /system/replication/agent/{agentName}/import
Export package - POST /system/replication/agent/{agentName}/export
Monitoring API
Monitoring APIs - flattened
Replicate tree - GET /system/replication/all/replicate/history?agent={agentName}
Import package - GET 

svn commit: r1568208 - in /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest: VanityPathTest.java util/EventsCounterUtil.java

2014-02-13 Thread fmeschbe
Author: fmeschbe
Date: Fri Feb 14 07:41:59 2014
New Revision: 1568208

URL: http://svn.apache.org/r1568208
Log:
SLING-3391 Don't get stuck if event does not arrive

Timeout is specified in seconds not milliseconds. So asking for 5000 essentially
waits 5000 seconds or almost 1.5h for an event to not arrive

Modified:

sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/VanityPathTest.java

sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java

Modified: 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/VanityPathTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/VanityPathTest.java?rev=1568208r1=1568207r2=1568208view=diff
==
--- 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/VanityPathTest.java
 (original)
+++ 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/VanityPathTest.java
 Fri Feb 14 07:41:59 2014
@@ -39,7 +39,7 @@ public class VanityPathTest extends Http
 private String vanityUrl;
 private int mappingEventCount;
 public static final String MAPPING_UPDATE_TOPIC = 
org/apache/sling/api/resource/ResourceResolverMapping/CHANGED;
-
+
 @Override
 protected void setUp() throws Exception {
 super.setUp();
@@ -168,7 +168,7 @@ public class VanityPathTest extends Http
 
 waitForMapReload();
 resetMappingEventCount();
-
+
 String pathWithExtension = removeHttpBase(createdNodeUrl) + .ext;
 ListNameValuePair moveParams = Arrays.asList(
 new NameValuePair(:dest, pathWithExtension),
@@ -200,6 +200,6 @@ public class VanityPathTest extends Http
  * before making the corresponding content changes.
  */
 private void waitForMapReload() {
-EventsCounterUtil.waitForEvent(this, MAPPING_UPDATE_TOPIC, 5000, 
mappingEventCount);
+EventsCounterUtil.waitForEvent(this, MAPPING_UPDATE_TOPIC, 5, 
mappingEventCount);
 }
 }

Modified: 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java?rev=1568208r1=1568207r2=1568208view=diff
==
--- 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java
 (original)
+++ 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java
 Fri Feb 14 07:41:59 2014
@@ -33,11 +33,11 @@ public class EventsCounterUtil {
 final JSONObject json = new 
JSONObject(b.getContent(HttpTest.HTTP_BASE_URL + /testing/EventsCounter.json, 
HttpTest.CONTENT_TYPE_JSON));
 return json.has(topic) ? json.getInt(topic) : 0;
 }
-
-public static void waitForEvent(final HttpTestBase b, final String topic, 
int timeoutMsec, final int previousCount) {
+
+public static void waitForEvent(final HttpTestBase b, final String topic, 
int timeoutSeconds, final int previousCount) {
 final Condition c = new Condition() {
 public String getDescription() {
-return Wait for OSGi event on topic  + topic; 
+return Wait for OSGi event on topic  + topic;
 }
 
 public boolean isTrue() throws Exception {




svn commit: r1568209 - /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java

2014-02-13 Thread fmeschbe
Author: fmeschbe
Date: Fri Feb 14 07:45:19 2014
New Revision: 1568209

URL: http://svn.apache.org/r1568209
Log:
SLING-3391 And fix the commit

Modified:

sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java

Modified: 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java?rev=1568209r1=1568208r2=1568209view=diff
==
--- 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java
 (original)
+++ 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/EventsCounterUtil.java
 Fri Feb 14 07:45:19 2014
@@ -44,6 +44,6 @@ public class EventsCounterUtil {
 return getEventsCount(b, topic)  previousCount;
 }
 };
-new RetryLoop(c, timeoutMsec, 500);
+new RetryLoop(c, timeoutSeconds, 500);
 }
 }
\ No newline at end of file