sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1615625 - in /sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication: serialization/ serialization/impl/exporter/ serialization/impl/importer/ transport/impl/exporter/
Date Mon, 04 Aug 2014 15:47:42 GMT
Author: tommaso
Date: Mon Aug  4 15:47:41 2014
New Revision: 1615625

URL: http://svn.apache.org/r1615625
Log:
SLING-3816 - changed default exporter/importer to local exporter/importer

Added:
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/LocalReplicationPackageExporter.java
      - copied, changed from r1615605, sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/DefaultReplicationPackageExporter.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/LocalReplicationPackageImporter.java
      - copied, changed from r1615605, sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/DefaultReplicationPackageImporter.java
Removed:
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/DefaultReplicationPackageExporter.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/DefaultReplicationPackageImporter.java
Modified:
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuilder.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageImporter.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/AgentReplicationPackageExporter.java
    sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/transport/impl/exporter/RemoteReplicationPackageExporter.java

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuilder.java?rev=1615625&r1=1615624&r2=1615625&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuilder.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageBuilder.java
Mon Aug  4 15:47:41 2014
@@ -26,23 +26,22 @@ import org.apache.sling.replication.comm
  * A builder for {@link ReplicationPackage}s
  */
 public interface ReplicationPackageBuilder {
+
     /**
      * creates a {@link ReplicationPackage} for a specific {@link ReplicationRequest}
      *
      * @param request the {@link ReplicationRequest} to create the package for
      * @return a {@link ReplicationPackage}
      * @throws ReplicationPackageBuildingException
-     *
      */
     ReplicationPackage createPackage(ReplicationRequest request) throws ReplicationPackageBuildingException;
 
     /**
      * reads a stream and tries to convert it to a {@link ReplicationPackage} this provider
can read and install
      *
-     * @param stream  the {@link InputStream} of the package to read
+     * @param stream the {@link InputStream} of the package to read
      * @return a {@link ReplicationPackage} if it can read it from the stream
-     * @throws ReplicationPackageReadingException
-     *          when the stream cannot be read as a {@link ReplicationPackage}
+     * @throws ReplicationPackageReadingException when the stream cannot be read as a {@link
ReplicationPackage}
      */
     ReplicationPackage readPackage(InputStream stream) throws ReplicationPackageReadingException;
 
@@ -56,6 +55,7 @@ public interface ReplicationPackageBuild
 
     /**
      * Installs the given replicationPackage into the repository
+     *
      * @param replicationPackage
      * @return
      * @throws ReplicationPackageReadingException

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageImporter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageImporter.java?rev=1615625&r1=1615624&r2=1615625&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageImporter.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/ReplicationPackageImporter.java
Mon Aug  4 15:47:41 2014
@@ -27,7 +27,7 @@ public interface ReplicationPackageImpor
     /**
      * Imports the given replication package
      * @param replicationPackage - the package to be imported
-     * @return
+     * @return <code>true</code> if the import succeeded, <code>false</code>
otherwise
      */
     boolean importPackage(ReplicationPackage replicationPackage) throws ReplicationPackageReadingException;
 

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/AgentReplicationPackageExporter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/AgentReplicationPackageExporter.java?rev=1615625&r1=1615624&r2=1615625&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/AgentReplicationPackageExporter.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/AgentReplicationPackageExporter.java
Mon Aug  4 15:47:41 2014
@@ -18,13 +18,9 @@
  */
 package org.apache.sling.replication.serialization.impl.exporter;
 
+import java.util.Map;
 
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferencePolicy;
-import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.scr.annotations.*;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.replication.agent.ReplicationAgent;
 import org.apache.sling.replication.communication.ReplicationRequest;
@@ -35,8 +31,6 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Map;
-
 @Component(label = "Agent Based Replication Package Exporter")
 @Service(value = ReplicationPackageExporter.class)
 @Property(name = "name", value = AgentReplicationPackageExporter.NAME)
@@ -56,28 +50,26 @@ public class AgentReplicationPackageExpo
     @Reference(name = "ReplicationPackageBuilder", target = "(name=vlt)", policy = ReferencePolicy.STATIC)
     private ReplicationPackageBuilder replicationPackageBuilder;
 
-
     private String queueName;
 
-
-
     @Activate
-    public void activate(BundleContext context, Map<String, ?> config) throws Exception
{
+    public void activate(Map<String, ?> config) throws Exception {
         queueName = PropertiesUtil.toString(config.get(QUEUE_NAME), "");
     }
 
-
     public ReplicationPackage exportPackage(ReplicationRequest replicationRequest) {
 
         try {
-            log.info("getting item from queue {}", queueName);
+            if (log.isInfoEnabled()) {
+                log.info("getting item from queue {}", queueName);
+            }
 
             // get first item
-            ReplicationPackage head = agent.removeHead(queueName);
-            return head;
-        }
-        catch (Exception ex) {
-            log.error("Error exporting package", ex);
+            return agent.removeHead(queueName);
+        } catch (Exception ex) {
+            if (log.isErrorEnabled()) {
+                log.error("Error exporting package", ex);
+            }
         }
 
         return null;

Copied: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/LocalReplicationPackageExporter.java
(from r1615605, sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/DefaultReplicationPackageExporter.java)
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/LocalReplicationPackageExporter.java?p2=sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/LocalReplicationPackageExporter.java&p1=sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/DefaultReplicationPackageExporter.java&r1=1615605&r2=1615625&rev=1615625&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/DefaultReplicationPackageExporter.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/exporter/LocalReplicationPackageExporter.java
Mon Aug  4 15:47:41 2014
@@ -18,46 +18,35 @@
  */
 package org.apache.sling.replication.serialization.impl.exporter;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferencePolicy;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.felix.scr.annotations.*;
 import org.apache.sling.replication.communication.ReplicationRequest;
-import org.apache.sling.replication.event.ReplicationEventFactory;
-import org.apache.sling.replication.event.ReplicationEventType;
 import org.apache.sling.replication.serialization.ReplicationPackage;
 import org.apache.sling.replication.serialization.ReplicationPackageBuilder;
-import org.apache.sling.replication.serialization.ReplicationPackageBuilderProvider;
 import org.apache.sling.replication.serialization.ReplicationPackageBuildingException;
 import org.apache.sling.replication.serialization.ReplicationPackageExporter;
-import org.apache.sling.replication.serialization.ReplicationPackageImporter;
+import org.apache.sling.replication.serialization.impl.vlt.FileVaultReplicationPackageBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
 /**
- * Default implementation of {@link org.apache.sling.replication.serialization.ReplicationPackageExporter}
+ * {@link org.apache.sling.replication.serialization.ReplicationPackageExporter} implementation
which creates a FileVault based
+ * {@link org.apache.sling.replication.serialization.ReplicationPackage} locally.
  */
-@Component(label = "Default Replication Package Exporter")
+@Component(label = "Local Replication Package Exporter")
 @Service(value = ReplicationPackageExporter.class)
-@Property(name = "name", value = DefaultReplicationPackageExporter.NAME)
-public class DefaultReplicationPackageExporter implements ReplicationPackageExporter {
+@Property(name = "name", value = LocalReplicationPackageExporter.NAME)
+public class LocalReplicationPackageExporter implements ReplicationPackageExporter {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Property(label = "Name")
-    public static final String NAME = "default";
+    public static final String NAME = "local";
 
-    @Reference(name = "ReplicationPackageBuilder", target = "(name=vlt)", policy = ReferencePolicy.STATIC)
+    @Reference(name = "ReplicationPackageBuilder", target = "(name=" + FileVaultReplicationPackageBuilder.NAME
+ ")",
+            policy = ReferencePolicy.STATIC)
     private ReplicationPackageBuilder packageBuilder;
 
-    public ReplicationPackage exportPackage(ReplicationRequest replicationRequest) throws
ReplicationPackageBuildingException{
+    public ReplicationPackage exportPackage(ReplicationRequest replicationRequest) throws
ReplicationPackageBuildingException {
         return packageBuilder.createPackage(replicationRequest);
     }
 

Copied: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/LocalReplicationPackageImporter.java
(from r1615605, sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/DefaultReplicationPackageImporter.java)
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/LocalReplicationPackageImporter.java?p2=sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/LocalReplicationPackageImporter.java&p1=sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/DefaultReplicationPackageImporter.java&r1=1615605&r2=1615625&rev=1615625&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/DefaultReplicationPackageImporter.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/serialization/impl/importer/LocalReplicationPackageImporter.java
Mon Aug  4 15:47:41 2014
@@ -26,20 +26,24 @@ import java.util.Hashtable;
 import org.apache.felix.scr.annotations.*;
 import org.apache.sling.replication.event.ReplicationEventFactory;
 import org.apache.sling.replication.event.ReplicationEventType;
-import org.apache.sling.replication.serialization.*;
+import org.apache.sling.replication.serialization.ReplicationPackage;
+import org.apache.sling.replication.serialization.ReplicationPackageBuilder;
+import org.apache.sling.replication.serialization.ReplicationPackageImporter;
+import org.apache.sling.replication.serialization.ReplicationPackageReadingException;
 import org.apache.sling.replication.serialization.impl.vlt.FileVaultReplicationPackageBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Default implementation of {@link org.apache.sling.replication.serialization.ReplicationPackageImporter}
+ * {@link org.apache.sling.replication.serialization.ReplicationPackageImporter} implementation
which imports a FileVault
+ * based {@link ReplicationPackage} locally.
  */
 @Component(label = "Default Replication Package Importer")
 @Service(value = ReplicationPackageImporter.class)
-@Property(name = "name", value = DefaultReplicationPackageImporter.NAME)
-public class DefaultReplicationPackageImporter implements ReplicationPackageImporter {
+@Property(name = "name", value = LocalReplicationPackageImporter.NAME)
+public class LocalReplicationPackageImporter implements ReplicationPackageImporter {
 
-    public static final String NAME = "default";
+    public static final String NAME = "local";
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -77,11 +81,7 @@ public class DefaultReplicationPackageIm
 
     public ReplicationPackage readPackage(InputStream stream) throws ReplicationPackageReadingException
{
         try {
-            ReplicationPackage replicationPackage = replicationPackageBuilder.readPackage(stream);
-
-            return replicationPackage;
-
-
+            return replicationPackageBuilder.readPackage(stream);
         } catch (Exception e) {
             log.error("cannot read a package from the given stream");
         }

Modified: sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/transport/impl/exporter/RemoteReplicationPackageExporter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/transport/impl/exporter/RemoteReplicationPackageExporter.java?rev=1615625&r1=1615624&r2=1615625&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/transport/impl/exporter/RemoteReplicationPackageExporter.java
(original)
+++ sling/trunk/contrib/extensions/replication/core/src/main/java/org/apache/sling/replication/transport/impl/exporter/RemoteReplicationPackageExporter.java
Mon Aug  4 15:47:41 2014
@@ -82,7 +82,6 @@ public class RemoteReplicationPackageExp
 
 
     public ReplicationPackage exportPackage(ReplicationRequest replicationRequest) throws
ReplicationPackageBuildingException {
-
         try {
             return pollPackageFromEndpoint(replicationRequest, replicationEndpoint);
         } catch (Exception e) {



Mime
View raw message