incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1547378 [1/5] - in /sling/trunk/contrib/extensions/replication: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/java/org/apache/sling/replication/ src/main/java/org/apa...
Date Tue, 03 Dec 2013 13:19:53 GMT
Author: bdelacretaz
Date: Tue Dec  3 13:19:50 2013
New Revision: 1547378

URL: http://svn.apache.org/r1547378
Log:
SLING-3223 - new replication module, contributed by Tommaso Teofili, thanks!

Added:
    sling/trunk/contrib/extensions/replication/   (with props)
    sling/trunk/contrib/extensions/replication/pom.xml
    sling/trunk/contrib/extensions/replication/src/
    sling/trunk/contrib/extensions/replication/src/main/
    sling/trunk/contrib/extensions/replication/src/main/java/
    sling/trunk/contrib/extensions/replication/src/main/java/org/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentConfigurationException.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentReplicationException.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgent.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfiguration.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfigurationManager.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentsManager.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManager.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentConfigurationResource.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentJobConsumer.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResource.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResourceProvider.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentServiceFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentsManagerImpl.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentImpl.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/communication/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/communication/ReplicationActionType.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/communication/ReplicationAgentHistory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/communication/ReplicationEndpoint.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/communication/ReplicationRequest.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/communication/ReplicationResponse.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/event/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/event/ReplicationEvent.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/event/ReplicationEventFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/event/ReplicationEventType.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/event/impl/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/event/impl/DefaultReplicationEventFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueue.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueDistributionStrategy.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueException.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueItemState.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueProvider.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/AbstractReplicationQueueProvider.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/ErrorAwareQueueDistributionStrategy.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/PriorityPathDistributionStrategy.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/SingleQueueDistributionStrategy.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/JobHandlingReplicationQueue.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/JobHandlingReplicationQueueProvider.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/JobHandlingUtils.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/simple/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/simple/ScheduledReplicationQueueProcessor.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/simple/SimpleReplicationQueue.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/simple/SimpleReplicationQueueProvider.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/rule/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/rule/ReplicationRule.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/rule/ReplicationRuleEngine.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/rule/impl/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/rule/impl/TriggerPathReplicationRule.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/ReplicationPackage.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuilder.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuilderProvider.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuildingException.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/AbstractReplicationPackageBuilder.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/ReplicationPackageAdapterFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/ReplicationPackageBuilderProviderImpl.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/vlt/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackage.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackageBuilder.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/serialization/impl/vlt/VoidReplicationPackage.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/servlet/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/servlet/AggregateReplicationServlet.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/servlet/ReplicationAgentPollServlet.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/servlet/ReplicationAgentPostServlet.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/servlet/ReplicationConfigurationServlet.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/servlet/ReplicationReceiverServlet.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/ReplicationTransportException.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/TransportHandler.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/AuthenticationContext.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/AuthenticationException.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/AuthenticationHandler.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/AuthenticationHandlerFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/AuthenticationHandlerProvider.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/DefaultAuthenticationHandlerManager.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/NopAuthenticationHandler.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/NopAuthenticationHandlerFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/RepositoryAuthenticationHandler.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/RepositoryAuthenticationHandlerFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/UserCredentialsAuthenticationHandler.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/authentication/impl/UserCredentialsAuthenticationHandlerFactory.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/impl/
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/impl/HttpTransportHandler.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/impl/PollingTransportHandler.java
    sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/transport/impl/RepositoryTransportHandler.java
    sling/trunk/contrib/extensions/replication/src/main/resources/
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/sling/
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/sling/replication/
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/sling/replication/agents/
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/sling/replication/agents/org.apache.sling.replication.agent.impl.ReplicationAgentServiceFactory-publish-reverse.json
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/sling/replication/agents/org.apache.sling.replication.agent.impl.ReplicationAgentServiceFactory-publish.json
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/sling/replication/agents/org.apache.sling.replication.agent.impl.ReplicationAgentServiceFactory-reversehttp.json
    sling/trunk/contrib/extensions/replication/src/main/resources/SLING-CONTENT/libs/sling/replication/agents/org.apache.sling.replication.agent.impl.ReplicationAgentServiceFactory-reverserepo.json
    sling/trunk/contrib/extensions/replication/src/test/
    sling/trunk/contrib/extensions/replication/src/test/java/
    sling/trunk/contrib/extensions/replication/src/test/java/org/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/ReplicationAgentConfigurationTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManagerTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/ReplicationAgentJobConsumerTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/ReplicationAgentResourceProviderTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentImplTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/queue/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/queue/impl/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/queue/impl/jobhandling/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/queue/impl/jobhandling/JobHandlingReplicationQueueTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/queue/impl/jobhandling/JobHandlingUtilsTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/queue/impl/simple/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/queue/impl/simple/SimpleReplicationQueueTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/serialization/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/serialization/impl/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/serialization/impl/vlt/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/serialization/impl/vlt/FileVaultReplicationPackageBuilderTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/authentication/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/authentication/impl/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/authentication/impl/NopAuthenticationHandlerTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/authentication/impl/UserCredentialsAuthenticationHandlerTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/impl/
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/impl/HttpTransportHandlerTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/impl/PollingTransportHandlerTest.java
    sling/trunk/contrib/extensions/replication/src/test/java/org/apache/sling/replication/transport/impl/RepositoryTransportHandlerTest.java

Propchange: sling/trunk/contrib/extensions/replication/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Dec  3 13:19:50 2013
@@ -0,0 +1,13 @@
+target
+bin
+*.iml
+*.ipr
+*.iws
+.settings
+.project
+.classpath
+.externalToolBuilders
+maven-eclipse.xml
+
+
+

Added: sling/trunk/contrib/extensions/replication/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/pom.xml?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/pom.xml (added)
+++ sling/trunk/contrib/extensions/replication/pom.xml Tue Dec  3 13:19:50 2013
@@ -0,0 +1,190 @@
+<?xml version="1.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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <!-- ======================================================================= -->
+    <!-- P A R E N T   P R O J E C T                                             -->
+    <!-- ======================================================================= -->
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>17</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+    <!-- ======================================================================= -->
+    <!-- P R O J E C T                                                           -->
+    <!-- ======================================================================= -->
+    <groupId>org.apache.sling</groupId>
+    <artifactId>org.apache.sling.replication</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Apache Sling Replication</name>
+    <description>
+        The Apache Sling Replication bundle provides a set of utilities to replicate content from / to other Sling instances.
+    </description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/replication</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/replication</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication</url>
+    </scm>
+
+    <!-- ======================================================================= -->
+    <!-- B U I L D                                                               -->
+    <!-- ======================================================================= -->
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-sling-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+              <configuration>
+                <instructions>
+                  <Bundle-SymbolicName>org.apache.sling.replication</Bundle-SymbolicName>
+                  <Sling-Initial-Content>SLING-CONTENT/libs/sling/replication/agents;path:=/apps/system/config;overwrite:=true</Sling-Initial-Content>
+                  <Export-Package>
+                    org.apache.sling.replication.agent,
+                    org.apache.sling.replication.transport.authentication,
+                    org.apache.sling.replication.transport,
+                    org.apache.sling.replication.communication,
+                    org.apache.sling.replication.event,
+                    org.apache.sling.replication.queue,
+                    org.apache.sling.replication.rule,
+                    org.apache.sling.replication.serialization,
+                  </Export-Package>
+                </instructions>
+              </configuration>
+            </plugin>
+	        <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <!-- ======================================================================= -->
+    <!-- D E P E N D E N C I E S                                                 -->
+    <!-- ======================================================================= -->
+  <dependencies>
+    <!-- TESTING -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>1.9.5</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- SLING -->
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.api</artifactId>
+      <version>2.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.commons.osgi</artifactId>
+      <version>2.2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.jcr.api</artifactId>
+      <version>2.1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.event</artifactId>
+      <version>3.3.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- LOGGING -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <!-- SPECs -->
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+    </dependency>
+    <!-- FILEVAULT -->
+    <dependency>
+      <groupId>org.apache.jackrabbit.vault</groupId>
+      <artifactId>org.apache.jackrabbit.vault</artifactId>
+      <version>3.0.0</version>
+    </dependency>
+    <!-- HTTP -->
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>fluent-hc</artifactId>
+      <version>4.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore-osgi</artifactId>
+      <version>4.2</version>
+    </dependency>
+    <!-- JACKRABBIT -->
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-commons</artifactId>
+      <version>2.6.2</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- COMMONS -->
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentConfigurationException.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentConfigurationException.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentConfigurationException.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentConfigurationException.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent;
+
+/**
+ * represents error happened during agent configuration
+ */
+@SuppressWarnings("serial")
+public class AgentConfigurationException extends Exception {
+
+    public AgentConfigurationException(Exception e) {
+        super(e);
+    }
+
+    public AgentConfigurationException(String string) {
+        super(string);
+    }
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentReplicationException.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentReplicationException.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentReplicationException.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/AgentReplicationException.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent;
+
+/**
+ * Represents errors happened while {@link ReplicationAgent}s do replications.
+ */
+@SuppressWarnings("serial")
+public class AgentReplicationException extends Exception {
+
+    public AgentReplicationException(Exception e) {
+        super(e);
+    }
+
+    public AgentReplicationException(String string) {
+        super(string);
+    }
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgent.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgent.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgent.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgent.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent;
+
+import org.apache.sling.replication.communication.ReplicationRequest;
+import org.apache.sling.replication.communication.ReplicationResponse;
+import org.apache.sling.replication.queue.ReplicationQueue;
+import org.apache.sling.replication.queue.ReplicationQueueException;
+import org.apache.sling.replication.serialization.ReplicationPackage;
+
+/**
+ * A replication agent
+ */
+public interface ReplicationAgent {
+
+    String getName();
+
+    ReplicationQueue getQueue(String name) throws ReplicationQueueException;
+
+    ReplicationResponse execute(ReplicationRequest replicationRequest)
+                    throws AgentReplicationException;
+
+    void send(ReplicationRequest replicationRequest) throws AgentReplicationException;
+
+    boolean process(ReplicationPackage item) throws AgentReplicationException;
+
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfiguration.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfiguration.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfiguration.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent;
+
+import java.util.Arrays;
+import java.util.Dictionary;
+
+import org.apache.sling.commons.osgi.PropertiesUtil;
+
+/**
+ * configuration for {@link ReplicationAgent}s
+ */
+public class ReplicationAgentConfiguration {
+
+    public static final String TRANSPORT = "TransportHandler.target";
+
+    public static final String AUTHENTICATION_FACTORY = "AuthenticationHandlerFactory.target";
+
+    public static final String QUEUEPROVIDER = "ReplicationQueueProvider.target";
+
+    public static final String PACKAGING = "ReplicationPackageBuilder.target";
+
+    public static final String NAME = "name";
+
+    public static final String ENDPOINT = "endpoint";
+
+    public static final String AUTHENTICATION_PROPERTIES = "authentication.properties";
+
+    public static final String DISTRIBUTION = "ReplicationQueueDistributionStrategy.target";
+
+    private final String name;
+
+    private final String endpoint;
+
+    private final String targetTransportHandler;
+
+    private final String targetReplicationBuilder;
+
+    private final String targetReplicationQueueProvider;
+
+    private final String targetAuthenticationHandlerFactory;
+
+    private final String[] authenticationProperties;
+
+    public ReplicationAgentConfiguration(Dictionary<?, ?> dictionary) {
+        this.name = PropertiesUtil.toString(dictionary.get(NAME), "");
+        this.endpoint = PropertiesUtil.toString(dictionary.get(ENDPOINT), "");
+        this.targetAuthenticationHandlerFactory = PropertiesUtil.toString(
+                        dictionary.get(AUTHENTICATION_FACTORY), "");
+        this.targetReplicationBuilder = PropertiesUtil.toString(dictionary.get(PACKAGING), "");
+        this.targetReplicationQueueProvider = PropertiesUtil.toString(
+                        dictionary.get(QUEUEPROVIDER), "");
+        this.targetTransportHandler = PropertiesUtil.toString(dictionary.get(TRANSPORT), "");
+        String[] ap = PropertiesUtil.toStringArray(dictionary.get(AUTHENTICATION_PROPERTIES));
+        this.authenticationProperties = ap != null ? ap : new String[0];
+    }
+
+    public String[] getAuthenticationProperties() {
+        return authenticationProperties;
+    }
+
+    public String getEndpoint() {
+        return endpoint;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getTargetAuthenticationHandlerFactory() {
+        return targetAuthenticationHandlerFactory;
+    }
+
+    public String getTargetReplicationBuilder() {
+        return targetReplicationBuilder;
+    }
+
+    public String getTargetReplicationQueueProvider() {
+        return targetReplicationQueueProvider;
+    }
+
+    public String getTargetTransportHandler() {
+        return targetTransportHandler;
+    }
+
+    @Override
+    public String toString() {
+        return "{\"name\":\"" + name + "\", \"endpoint\":\"" + endpoint + "\", \"targetTransportHandler\":\""
+                        + targetTransportHandler + "\", \"targetReplicationBuilder\":\""
+                        + targetReplicationBuilder + "\", \"targetReplicationQueueProvider\":\""
+                        + targetReplicationQueueProvider + "\", \"targetAuthenticationHandlerFactory\":\""
+                        + targetAuthenticationHandlerFactory + "\", \"authenticationProperties\":\""
+                        + Arrays.toString(authenticationProperties) + "\"}";
+    }
+
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfigurationManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfigurationManager.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfigurationManager.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentConfigurationManager.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent;
+
+import java.util.Map;
+
+/**
+ * Facade class for dealing with {@link ReplicationAgent}'s {@link ReplicationConfiguration}s
+ */
+public interface ReplicationAgentConfigurationManager {
+
+    ReplicationAgentConfiguration getConfiguration(ReplicationAgent replicationAgent)
+                    throws AgentConfigurationException;
+
+    ReplicationAgentConfiguration updateConfiguration(ReplicationAgent agent,
+                    Map<String, Object> properties) throws AgentConfigurationException;
+
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentsManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentsManager.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentsManager.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/ReplicationAgentsManager.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent;
+
+import java.util.SortedSet;
+
+import org.apache.sling.replication.communication.ReplicationActionType;
+
+/**
+ * A manager for {@link ReplicationAgent}s
+ */
+public interface ReplicationAgentsManager {
+
+    SortedSet<ReplicationAgent> getAgentsFor(ReplicationActionType action, String... paths);
+
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManager.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManager.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/DefaultReplicationAgentConfigurationManager.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import java.util.Dictionary;
+import java.util.Map;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.sling.replication.agent.AgentConfigurationException;
+import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.sling.replication.agent.ReplicationAgentConfiguration;
+import org.apache.sling.replication.agent.ReplicationAgentConfigurationManager;
+
+/**
+ * Default implementation of {@link ReplicationAgentConfigurationManager}
+ */
+@Component(immediate = true)
+@Service(value = ReplicationAgentConfigurationManager.class)
+public class DefaultReplicationAgentConfigurationManager implements
+                ReplicationAgentConfigurationManager {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference
+    private ConfigurationAdmin configAdmin;
+
+    public ReplicationAgentConfiguration getConfiguration(ReplicationAgent replicationAgent)
+                    throws AgentConfigurationException {
+        if (log.isInfoEnabled()) {
+            log.info("retrieving configuration for agent ", replicationAgent);
+        }
+        try {
+            Configuration configuration = getOsgiConfiguration(replicationAgent);
+            return new ReplicationAgentConfiguration(configuration.getProperties());
+
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("configuration for agent {} cannot be found", replicationAgent.getName());
+            }
+            throw new AgentConfigurationException(e);
+        }
+    }
+
+    private Configuration getOsgiConfiguration(ReplicationAgent replicationAgent) throws Exception {
+        String filter = new StringBuilder("(name=").append(replicationAgent.getName()).append(")")
+                        .toString();
+        Configuration[] configurations = configAdmin.listConfigurations(filter);
+        if (configurations == null) {
+          throw new Exception("no configuration found");
+        } else if (configurations.length == 1) {
+            if (log.isInfoEnabled()) {
+                log.info("found configuration {} for agent {}", configurations[0],
+                                replicationAgent.getName());
+            }
+            return configurations[0];
+        } else {
+            if (log.isErrorEnabled()) {
+                log.error("{} configurations for agent {} found", configurations.length,
+                                replicationAgent.getName());
+            }
+            throw new Exception("too many configurations found");
+        }
+    }
+
+    public ReplicationAgentConfiguration updateConfiguration(ReplicationAgent replicationAgent,
+                    Map<String, Object> updateProperties) throws AgentConfigurationException {
+        try {
+            Configuration configuration = getOsgiConfiguration(replicationAgent);
+            @SuppressWarnings("unchecked")
+            Dictionary<String, Object> configurationProperties = configuration.getProperties();
+            for (Map.Entry<String, Object> entry : updateProperties.entrySet()) {
+                configurationProperties.put(entry.getKey(), entry.getValue());
+            }
+            configuration.update(configurationProperties);
+            return new ReplicationAgentConfiguration(configuration.getProperties());
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("configuration for agent {} was not found", replicationAgent.getName());
+            }
+            throw new AgentConfigurationException(e);
+        }
+
+    }
+
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentConfigurationResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentConfigurationResource.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentConfigurationResource.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentConfigurationResource.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import org.apache.sling.api.resource.AbstractResource;
+import org.apache.sling.api.resource.ResourceMetadata;
+import org.apache.sling.api.resource.ResourceResolver;
+
+import org.apache.sling.replication.agent.ReplicationAgentConfiguration;
+
+/**
+ * a {@Resource} for a {@link ReplicationAgentConfiguration}
+ */
+public class ReplicationAgentConfigurationResource extends AbstractResource {
+
+    public static final String RESOURCE_TYPE = "sling/replication/agent/configuration";
+
+    private ReplicationAgentConfiguration replicationAgentConfiguration;
+
+    private ResourceResolver resourceResolver;
+
+    public ReplicationAgentConfigurationResource(
+                    ReplicationAgentConfiguration replicationAgentConfiguration,
+                    ResourceResolver resourceResolver) {
+        this.replicationAgentConfiguration = replicationAgentConfiguration;
+        this.resourceResolver = resourceResolver;
+    }
+
+    public String getPath() {
+        return new StringBuilder(ReplicationAgentResource.BASE_PATH).append('/')
+                        .append(replicationAgentConfiguration.getName()).append("/configuration")
+                        .toString();
+    }
+
+    public String getResourceType() {
+        return RESOURCE_TYPE;
+    }
+
+    public String getResourceSuperType() {
+        return null;
+    }
+
+    public ResourceMetadata getResourceMetadata() {
+        ResourceMetadata metadata = new ResourceMetadata();
+        metadata.setResolutionPath(new StringBuilder(ReplicationAgentResource.BASE_PATH)
+                        .append('/').append(replicationAgentConfiguration.getName()).toString());
+        return metadata;
+    }
+
+    public ResourceResolver getResourceResolver() {
+        return resourceResolver;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
+        if (ReplicationAgentConfiguration.class == type) {
+            return (AdapterType) replicationAgentConfiguration;
+        } else {
+            return super.adaptTo(type);
+        }
+    }
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentJobConsumer.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentJobConsumer.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentJobConsumer.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentJobConsumer.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import org.apache.sling.event.jobs.Job;
+import org.apache.sling.event.jobs.consumer.JobConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.sling.replication.agent.AgentReplicationException;
+import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.sling.replication.queue.impl.jobhandling.JobHandlingUtils;
+import org.apache.sling.replication.serialization.ReplicationPackage;
+import org.apache.sling.replication.serialization.ReplicationPackageBuilder;
+
+/**
+ * {@JobConsumer} for {@link ReplicationAgent}s using {@link org.apache.sling.replication.queue.impl.jobhandling.JobHandlingReplicationQueue}
+ */
+public class ReplicationAgentJobConsumer implements JobConsumer {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private ReplicationAgent agent;
+
+    private ReplicationPackageBuilder packageBuilder;
+
+    public ReplicationAgentJobConsumer(ReplicationAgent agent,
+                    ReplicationPackageBuilder packageBuilder) {
+        this.agent = agent;
+        this.packageBuilder = packageBuilder;
+    }
+
+    public JobResult process(Job job) {
+        try {
+            if (log.isInfoEnabled()) {
+                log.info("processing job {}", job.getId());
+            }
+            ReplicationPackage item = JobHandlingUtils.getPackage(packageBuilder, job);
+            if (item != null) {
+                if (log.isInfoEnabled()) {
+                    log.info("processing item {} ", item);
+                }
+                boolean processingResult = agent.process(item);
+                JobResult jobResult = processingResult ? JobResult.OK : JobResult.FAILED;
+                if (log.isInfoEnabled()) {
+                    log.info("item {} processed {} ", item, jobResult);
+                }
+                return jobResult;
+            } else {
+                if (log.isInfoEnabled()) {
+                    log.info("cannot get a replication package from job with id {}", job.getId());
+                }
+                return JobResult.FAILED;
+            }
+        } catch (AgentReplicationException e) {
+            if (log.isErrorEnabled()) {
+                log.error("agent failed processing job", e);
+            }
+            return JobResult.FAILED;
+        }
+    }
+
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResource.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResource.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResource.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import org.apache.sling.api.resource.AbstractResource;
+import org.apache.sling.api.resource.ResourceMetadata;
+import org.apache.sling.api.resource.ResourceResolver;
+
+import org.apache.sling.replication.agent.ReplicationAgent;
+
+/**
+ * a {@link ReplicationAgent} {@link org.apache.sling.api.resource.Resource}
+ */
+public class ReplicationAgentResource extends AbstractResource {
+
+    public static final String BASE_PATH = "/system/replication/agent";
+
+    public static final String RESOURCE_TYPE = "sling/replication/agent";
+
+    private ReplicationAgent replicationAgent;
+
+    private ResourceResolver resourceResolver;
+
+    public ReplicationAgentResource(ReplicationAgent replicationAgent,
+                    ResourceResolver resourceResolver) {
+        this.replicationAgent = replicationAgent;
+        this.resourceResolver = resourceResolver;
+    }
+
+    public String getPath() {
+        return new StringBuilder(BASE_PATH).append('/').append(replicationAgent.getName())
+                        .toString();
+    }
+
+    public String getResourceType() {
+        return RESOURCE_TYPE;
+    }
+
+    public String getResourceSuperType() {
+        return null;
+    }
+
+    public ResourceMetadata getResourceMetadata() {
+        ResourceMetadata metadata = new ResourceMetadata();
+        metadata.setResolutionPath(BASE_PATH);
+        return metadata;
+    }
+
+    public ResourceResolver getResourceResolver() {
+        return resourceResolver;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
+        if (type == ReplicationAgent.class) {
+            return (AdapterType) replicationAgent;
+        }
+        else {
+            return super.adaptTo(type);
+        }
+    }
+
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResourceProvider.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResourceProvider.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentResourceProvider.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceProvider;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.sling.replication.agent.AgentConfigurationException;
+import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.sling.replication.agent.ReplicationAgentConfiguration;
+import org.apache.sling.replication.agent.ReplicationAgentConfigurationManager;
+
+/**
+ * {@link ResourceProvider} for {@link ReplicationAgent}s
+ */
+@Component(metatype = false)
+@Service(value = ResourceProvider.class)
+@Property(name = ResourceProvider.ROOTS, value = ReplicationAgentResource.BASE_PATH)
+public class ReplicationAgentResourceProvider implements ResourceProvider {
+
+    private static final String CONFIGURATION_PATH = "/configuration";
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private BundleContext context;
+
+    @Activate
+    protected void activate(BundleContext context) {
+        this.context = context;
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        this.context = null;
+    }
+
+    @Deprecated
+    public Resource getResource(ResourceResolver resourceResolver, HttpServletRequest request,
+                    String path) {
+        return getResource(resourceResolver, path);
+    }
+
+    public Resource getResource(ResourceResolver resourceResolver, String path) {
+
+        Resource resource = null;
+        if (path.endsWith(CONFIGURATION_PATH)) {
+            String agentPath = path.substring(0, path.lastIndexOf(CONFIGURATION_PATH));
+            if (log.isInfoEnabled()) {
+                log.info("resolving configuration for agent {}", agentPath);
+            }
+            ReplicationAgent replicationAgent = getAgentAtPath(agentPath);
+            ServiceReference configurationManagerServiceReference = context
+                            .getServiceReference(ReplicationAgentConfigurationManager.class
+                                            .getName());
+            if (configurationManagerServiceReference != null) {
+                ReplicationAgentConfigurationManager agentConfigurationManager = (ReplicationAgentConfigurationManager) context
+                                .getService(configurationManagerServiceReference);
+                ReplicationAgentConfiguration configuration;
+                try {
+                    configuration = agentConfigurationManager
+                                    .getConfiguration(replicationAgent);
+                    resource = new ReplicationAgentConfigurationResource(configuration,
+                                    resourceResolver);
+                } catch (AgentConfigurationException e) {
+                    if (log.isWarnEnabled()) {
+                        log.warn("could not find a configuration", e);
+                    }
+                }
+            } else {
+                if (log.isWarnEnabled()) {
+                    log.warn("could not find a configuration manager service");
+                }
+            }
+        } else {
+            if (log.isInfoEnabled()) {
+                log.info("resolving agent with path {}", path);
+            }
+            ReplicationAgent replicationAgent = getAgentAtPath(path);
+            resource = replicationAgent != null ? new ReplicationAgentResource(replicationAgent,
+                            resourceResolver) : null;
+        }
+        if (log.isInfoEnabled()) {
+            log.info("resource found: {}", resource != null ? resource.getPath() : "none");
+        }
+        return resource;
+    }
+
+    private ReplicationAgent getAgentAtPath(String path) {
+        ReplicationAgent replicationAgent = null;
+        String agentName = path.substring(path.lastIndexOf('/') + 1);
+        if (log.isDebugEnabled()) {
+            log.debug("resolving agent {} at {}", agentName, path);
+        }
+        ServiceReference[] replicationAgentReferences;
+        try {
+            replicationAgentReferences = context.getServiceReferences(
+                            ReplicationAgent.class.getName(),
+                            new StringBuilder("(name=").append(agentName).append(")").toString());
+            if (replicationAgentReferences != null && replicationAgentReferences.length == 1) {
+                replicationAgent = (ReplicationAgent) context
+                                .getService(replicationAgentReferences[0]);
+                if (log.isDebugEnabled()) {
+                    log.debug("replication agent found: {}", replicationAgent);
+                }
+            } else {
+                log.warn("could not find a replication agent with name {}", agentName);
+            }
+        } catch (InvalidSyntaxException e) {
+            if (log.isWarnEnabled()) {
+                log.warn("there was a syntax problem while getting agent service {}", e);
+            }
+        }
+        return replicationAgent;
+    }
+
+    public Iterator<Resource> listChildren(Resource parent) {
+        return null;
+    }
+
+}
\ No newline at end of file

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentServiceFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentServiceFactory.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentServiceFactory.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentServiceFactory.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.event.jobs.consumer.JobConsumer;
+import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.sling.replication.agent.ReplicationAgentConfiguration;
+import org.apache.sling.replication.queue.ReplicationQueueDistributionStrategy;
+import org.apache.sling.replication.queue.ReplicationQueueProvider;
+import org.apache.sling.replication.queue.impl.SingleQueueDistributionStrategy;
+import org.apache.sling.replication.queue.impl.jobhandling.JobHandlingReplicationQueue;
+import org.apache.sling.replication.queue.impl.jobhandling.JobHandlingReplicationQueueProvider;
+import org.apache.sling.replication.serialization.ReplicationPackageBuilder;
+import org.apache.sling.replication.serialization.impl.vlt.FileVaultReplicationPackageBuilder;
+import org.apache.sling.replication.transport.TransportHandler;
+import org.apache.sling.replication.transport.authentication.AuthenticationHandler;
+import org.apache.sling.replication.transport.authentication.AuthenticationHandlerFactory;
+import org.apache.sling.replication.transport.authentication.impl.UserCredentialsAuthenticationHandlerFactory;
+import org.apache.sling.replication.transport.impl.HttpTransportHandler;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An OSGi service factory for {@link ReplicationAgent}s
+ */
+@Component(metatype = true, 
+    label = "Replication Agents Factory",
+    description = "OSGi configuration based ReplicationAgent service factory",
+    name = ReplicationAgentServiceFactory.SERVICE_PID, 
+    configurationFactory = true, 
+    specVersion = "1.1", 
+    policy = ConfigurationPolicy.REQUIRE
+)
+public class ReplicationAgentServiceFactory {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    static final String SERVICE_PID = "org.apache.sling.replication.agent.impl.ReplicationAgentServiceFactory";
+
+    private static final String TRANSPORT = ReplicationAgentConfiguration.TRANSPORT;
+
+    private static final String AUTHENTICATION_FACTORY = ReplicationAgentConfiguration.AUTHENTICATION_FACTORY;
+
+    private static final String QUEUEPROVIDER = ReplicationAgentConfiguration.QUEUEPROVIDER;
+
+    private static final String PACKAGING = ReplicationAgentConfiguration.PACKAGING;
+
+    private static final String DISTRIBUTION = ReplicationAgentConfiguration.DISTRIBUTION;
+
+    private static final String DEFAULT_TRANSPORT = "(name=" + HttpTransportHandler.NAME + ")";
+
+    private static final String DEFAULT_AUTHENTICATION_FACTORY = "(name=" + UserCredentialsAuthenticationHandlerFactory.TYPE + ")";
+
+    private static final String DEFAULT_ENDPOINT = "http://localhost:4503/system/replication/receive";
+
+    private static final String DEFAULT_PACKAGING = "(name="
+                    + FileVaultReplicationPackageBuilder.NAME + ")";
+
+    private static final String DEFAULT_QUEUEPROVIDER = "(name="
+                    + JobHandlingReplicationQueueProvider.NAME + ")";
+
+    private static final String DEFAULT_DISTRIBUTION = "(name="
+                    + SingleQueueDistributionStrategy.NAME + ")";
+
+    @Property
+    private static final String NAME = ReplicationAgentConfiguration.NAME;
+
+    @Property
+    private static final String ENDPOINT = ReplicationAgentConfiguration.ENDPOINT;
+
+    @Property
+    private static final String AUTHENTICATION_PROPERTIES = ReplicationAgentConfiguration.AUTHENTICATION_PROPERTIES;
+
+    @Property(name = TRANSPORT, value = DEFAULT_TRANSPORT)
+    @Reference(name = "TransportHandler", target = DEFAULT_TRANSPORT, policy = ReferencePolicy.DYNAMIC)
+    private TransportHandler transportHandler;
+
+    @Property(name = PACKAGING, value = DEFAULT_PACKAGING)
+    @Reference(name = "ReplicationPackageBuilder", target = DEFAULT_PACKAGING, policy = ReferencePolicy.DYNAMIC)
+    private ReplicationPackageBuilder packageBuilder;
+
+    @Property(name = QUEUEPROVIDER, value = DEFAULT_QUEUEPROVIDER)
+    @Reference(name = "ReplicationQueueProvider", target = DEFAULT_QUEUEPROVIDER, policy = ReferencePolicy.DYNAMIC)
+    private ReplicationQueueProvider queueProvider;
+
+    @Property(name = AUTHENTICATION_FACTORY, value = DEFAULT_AUTHENTICATION_FACTORY)
+    @Reference(name = "AuthenticationHandlerFactory", target = DEFAULT_AUTHENTICATION_FACTORY, policy = ReferencePolicy.DYNAMIC)
+    private AuthenticationHandlerFactory authenticationHandlerFactory;
+
+    @Property(name = DISTRIBUTION, value = DEFAULT_DISTRIBUTION)
+    @Reference(name = "ReplicationQueueDistributionStrategy", target = DEFAULT_DISTRIBUTION, policy = ReferencePolicy.DYNAMIC)
+    private ReplicationQueueDistributionStrategy queueDistributionStrategy;
+    
+    private ServiceRegistration agentReg;
+
+    private ServiceRegistration jobReg;
+
+    @Activate
+    public void activate(BundleContext context, Map<String, ?> config) throws Exception {
+        // inject configuration
+        Dictionary<String, Object> props = new Hashtable<String, Object>();
+
+        String name = PropertiesUtil
+                        .toString(config.get(NAME), String.valueOf(new Random().nextInt(1000)));
+        props.put(NAME, name);
+
+        String endpoint = PropertiesUtil.toString(config.get(ENDPOINT), DEFAULT_ENDPOINT);
+        props.put(ENDPOINT, endpoint);
+
+        String transport = PropertiesUtil.toString(config.get(TRANSPORT), DEFAULT_TRANSPORT);
+        props.put(TRANSPORT, transport);
+
+        String packaging = PropertiesUtil.toString(config.get(PACKAGING), DEFAULT_PACKAGING);
+        props.put(PACKAGING, packaging);
+
+        String queue = PropertiesUtil.toString(config.get(QUEUEPROVIDER), DEFAULT_QUEUEPROVIDER);
+        props.put(QUEUEPROVIDER, queue);
+
+        String distribution = PropertiesUtil.toString(config.get(DISTRIBUTION), DEFAULT_DISTRIBUTION);
+        props.put(DISTRIBUTION, distribution);
+
+        Map<String, String> authenticationProperties = PropertiesUtil.toMap(config.get(AUTHENTICATION_PROPERTIES), new String[0]);
+        props.put(AUTHENTICATION_PROPERTIES, authenticationProperties);
+
+        String af = PropertiesUtil.toString(config.get(AUTHENTICATION_FACTORY), DEFAULT_AUTHENTICATION_FACTORY);
+        props.put(AUTHENTICATION_FACTORY, af);
+
+        AuthenticationHandler<?, ?> authenticationHandler = authenticationHandlerFactory.createAuthenticationHandler(authenticationProperties);
+        
+        if (!transportHandler.supportsAuthenticationHandler(authenticationHandler)) {
+            throw new Exception("authentication handler " + authenticationHandler
+                            + " not supported by transport handler " + transportHandler);
+        }
+        
+
+        if (log.isInfoEnabled()) {
+            log.info("bound services for {} :  {} - {} - {} - {} - {}", new Object[] { name,
+                    transportHandler, endpoint, packageBuilder, queueProvider, authenticationHandler });
+        }
+
+        ReplicationAgent agent = new SimpleReplicationAgentImpl(name, endpoint, transportHandler, packageBuilder, queueProvider, authenticationHandler, queueDistributionStrategy);
+
+        // register agent service
+        agentReg = context.registerService(ReplicationAgent.class.getName(), agent, props);
+
+        // eventually register job consumer for sling job handling based queues
+        if (DEFAULT_QUEUEPROVIDER.equals(queue)){
+            Dictionary<String, Object> jobProps = new Hashtable<String, Object>();
+            String topic = new StringBuilder(JobHandlingReplicationQueue.REPLICATION_QUEUE_TOPIC).append('/')
+                            .append(name).toString();
+            String childTopic = topic+"/*";
+            jobProps.put(JobConsumer.PROPERTY_TOPICS, new String[]{topic, childTopic});
+            jobReg = context.registerService(JobConsumer.class.getName(), new ReplicationAgentJobConsumer(agent, packageBuilder), jobProps);
+        }
+    }
+
+    @Deactivate
+    private void deactivate() {
+        if (agentReg != null) {
+            agentReg.unregister();
+        }
+
+        if (jobReg != null) {
+            jobReg.unregister();
+        }
+    }
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentsManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentsManagerImpl.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentsManagerImpl.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentsManagerImpl.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.References;
+import org.apache.felix.scr.annotations.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.sling.replication.agent.ReplicationAgentsManager;
+import org.apache.sling.replication.communication.ReplicationActionType;
+
+/**
+ * Default implementation of {@link ReplicationAgentsManager}
+ */
+@Component
+@References({ 
+    @Reference(name = "replicationAgent", 
+               referenceInterface = ReplicationAgent.class, 
+               cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, 
+               policy = ReferencePolicy.DYNAMIC,
+               bind = "bindReplicationAgent", 
+               unbind = "unbindReplicationAgent")
+    })
+@Service(value = ReplicationAgentsManager.class)
+public class ReplicationAgentsManagerImpl implements ReplicationAgentsManager {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private SortedSet<ReplicationAgent> replicationAgents = new TreeSet<ReplicationAgent>(new ReplicationAgentComparator());
+
+    public SortedSet<ReplicationAgent> getAgentsFor(ReplicationActionType action, String... paths) {
+        // TODO : implement the filtering based on rules here
+        return Collections.unmodifiableSortedSet(replicationAgents);
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        replicationAgents.clear();
+    }
+
+    protected void bindReplicationAgent(final ReplicationAgent replicationAgent,
+                    Map<String, Object> properties) {
+        synchronized (replicationAgents) {
+            replicationAgents.add(replicationAgent);
+        }
+        log.debug("Registering replication agent {} ", replicationAgent);
+    }
+
+    protected void unbindReplicationAgent(final ReplicationAgent replicationAgent,
+                    Map<String, Object> properties) {
+        synchronized (replicationAgents) {
+            replicationAgents.remove(replicationAgent);
+        }
+        log.debug("Unregistering replication agent {} ", replicationAgent);
+    }
+
+    private final class ReplicationAgentComparator implements Comparator<ReplicationAgent> {
+        public int compare(ReplicationAgent o1, ReplicationAgent o2) {
+            return o1.getName().compareTo(o2.getName());
+        }
+    }
+}

Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentImpl.java?rev=1547378&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentImpl.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/SimpleReplicationAgentImpl.java Tue Dec  3 13:19:50 2013
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ */
+package org.apache.sling.replication.agent.impl;
+
+import org.apache.sling.replication.agent.AgentReplicationException;
+import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.sling.replication.communication.ReplicationEndpoint;
+import org.apache.sling.replication.communication.ReplicationRequest;
+import org.apache.sling.replication.communication.ReplicationResponse;
+import org.apache.sling.replication.queue.ReplicationQueue;
+import org.apache.sling.replication.queue.ReplicationQueueDistributionStrategy;
+import org.apache.sling.replication.queue.ReplicationQueueException;
+import org.apache.sling.replication.queue.ReplicationQueueItemState;
+import org.apache.sling.replication.queue.ReplicationQueueProvider;
+import org.apache.sling.replication.serialization.ReplicationPackage;
+import org.apache.sling.replication.serialization.ReplicationPackageBuilder;
+import org.apache.sling.replication.serialization.ReplicationPackageBuildingException;
+import org.apache.sling.replication.transport.ReplicationTransportException;
+import org.apache.sling.replication.transport.TransportHandler;
+import org.apache.sling.replication.transport.authentication.AuthenticationHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Basic implementation of a {@link ReplicationAgent}
+ */
+public class SimpleReplicationAgentImpl implements ReplicationAgent {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private ReplicationPackageBuilder packageBuilder;
+
+    private ReplicationQueueProvider queueProvider;
+
+    private TransportHandler transportHandler;
+
+    private AuthenticationHandler<?, ?> authenticationHandler;
+
+    private ReplicationQueueDistributionStrategy queueDistributionStrategy;
+
+    private String name;
+
+    private String endpoint;
+
+    public SimpleReplicationAgentImpl(String name, String endpoint,
+                    TransportHandler transportHandler, ReplicationPackageBuilder packageBuilder,
+                    ReplicationQueueProvider queueProvider,
+                    AuthenticationHandler<?, ?> authenticationHandler,
+                    ReplicationQueueDistributionStrategy queueDistributionHandler) {
+        this.name = name;
+        this.endpoint = endpoint;
+        this.transportHandler = transportHandler;
+        this.packageBuilder = packageBuilder;
+        this.queueProvider = queueProvider;
+        this.authenticationHandler = authenticationHandler;
+        this.queueDistributionStrategy = queueDistributionHandler;
+    }
+
+    public ReplicationResponse execute(ReplicationRequest replicationRequest)
+                    throws AgentReplicationException {
+
+        // create package from request
+        ReplicationPackage replicationPackage;
+        try {
+            replicationPackage = packageBuilder.createPackage(replicationRequest);
+        } catch (ReplicationPackageBuildingException e) {
+            throw new AgentReplicationException(e);
+        }
+
+        ReplicationResponse replicationResponse = new ReplicationResponse();
+
+        // send the replication package to the queue distribution handler
+        try {
+            ReplicationQueueItemState state = queueDistributionStrategy.add(replicationPackage,
+                            this, queueProvider);
+            replicationResponse.setStatus(state.getItemState().toString());
+            replicationResponse.setSuccessfull(state.isSuccessfull());
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error("an error happened during queue processing", e);
+            }
+            replicationResponse.setSuccessfull(false);
+        }
+
+        return replicationResponse;
+    }
+
+    public void send(ReplicationRequest replicationRequest) throws AgentReplicationException {
+        // create package from request
+        ReplicationPackage replicationPackage;
+        try {
+            replicationPackage = packageBuilder.createPackage(replicationRequest);
+        } catch (ReplicationPackageBuildingException e) {
+            throw new AgentReplicationException(e);
+        }
+        try {
+            queueDistributionStrategy.offer(replicationPackage, this, queueProvider);
+        } catch (ReplicationQueueException e) {
+            throw new AgentReplicationException(e);
+        }
+    }
+
+    public boolean process(ReplicationPackage item) throws AgentReplicationException {
+        try {
+            if (transportHandler != null) {
+                transportHandler.transport(item, new ReplicationEndpoint(endpoint),
+                                authenticationHandler);
+                return true;
+            } else {
+                if (log.isWarnEnabled()) {
+                    log.warn("could not process an item as a transport handler is not bound to agent {}",
+                                    name);
+                }
+                return false;
+            }
+        } catch (ReplicationTransportException e) {
+            throw new AgentReplicationException(e);
+        }
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ReplicationQueue getQueue(String name) throws ReplicationQueueException {
+        ReplicationQueue queue;
+        if (name != null) {
+            queue = queueProvider.getOrCreateQueue(this, name);
+        } else {
+            queue = queueProvider.getOrCreateDefaultQueue(this);
+        }
+        return queue;
+    }
+
+}



Mime
View raw message