You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2013/04/04 14:00:59 UTC

svn commit: r1464483 - in /syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation: PropagationTaskExecutor.java impl/AbstractPropagationTaskExecutor.java impl/PriorityPropagationTaskExecutor.java

Author: ilgrosso
Date: Thu Apr  4 12:00:59 2013
New Revision: 1464483

URL: http://svn.apache.org/r1464483
Log:
Cleaning up propagation task executor's interface and implementations

Modified:
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationTaskExecutor.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationTaskExecutor.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationTaskExecutor.java?rev=1464483&r1=1464482&r2=1464483&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationTaskExecutor.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationTaskExecutor.java Thu Apr  4 12:00:59 2013
@@ -23,6 +23,11 @@ import java.util.Collection;
 import org.apache.syncope.core.persistence.beans.PropagationTask;
 import org.apache.syncope.core.persistence.beans.TaskExec;
 
+/**
+ * Execute propagation tasks.
+ *
+ * @see PropagationTask
+ */
 public interface PropagationTaskExecutor {
 
     /**
@@ -44,20 +49,18 @@ public interface PropagationTaskExecutor
 
     /**
      * Execute a collection of PropagationTask objects.
+     * The process is interrupted as soon as the result of the communication with a primary resource is in error.
      *
      * @param tasks to be executed
-     * @throws PropagationException if propagation goes wrong: propagation is interrupted as soon as the result of the
-     * communication with a primary resource is in error
      */
-    void execute(Collection<PropagationTask> tasks) throws PropagationException;
+    void execute(Collection<PropagationTask> tasks);
 
     /**
      * Execute a collection of PropagationTask objects and invoke the given handler on each of these.
+     * The process is interrupted as soon as the result of the communication with a primary resource is in error.
      *
      * @param tasks to be execute, in given order
      * @param handler propagation handler
-     * @throws PropagationException if propagation goes wrong: propagation is interrupted as soon as the result of the
-     * communication with a primary resource is in error
      */
-    void execute(Collection<PropagationTask> tasks, PropagationHandler handler) throws PropagationException;
+    void execute(Collection<PropagationTask> tasks, PropagationHandler handler);
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java?rev=1464483&r1=1464482&r2=1464483&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java Thu Apr  4 12:00:59 2013
@@ -40,7 +40,6 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.propagation.ConnectorFactory;
 import org.apache.syncope.core.propagation.DefaultPropagationActions;
 import org.apache.syncope.core.propagation.PropagationActions;
-import org.apache.syncope.core.propagation.PropagationException;
 import org.apache.syncope.core.propagation.PropagationHandler;
 import org.apache.syncope.core.propagation.PropagationTaskExecutor;
 import org.apache.syncope.core.propagation.Connector;
@@ -377,14 +376,12 @@ public abstract class AbstractPropagatio
     }
 
     @Override
-    public void execute(final Collection<PropagationTask> tasks)
-            throws PropagationException {
+    public void execute(final Collection<PropagationTask> tasks) {
         execute(tasks, null);
     }
 
     @Override
-    public abstract void execute(Collection<PropagationTask> tasks, PropagationHandler handler)
-            throws PropagationException;
+    public abstract void execute(Collection<PropagationTask> tasks, PropagationHandler handler);
 
     /**
      * Check whether an execution has to be stored, for a given task.

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java?rev=1464483&r1=1464482&r2=1464483&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java Thu Apr  4 12:00:59 2013
@@ -34,11 +34,10 @@ public class PriorityPropagationTaskExec
 
     /**
      * Sort the given collection by looking at related ExternalResource's priority, then execute.
+     * {@inheritDoc}
      */
     @Override
-    public void execute(final Collection<PropagationTask> tasks, final PropagationHandler handler)
-            throws PropagationException {
-
+    public void execute(final Collection<PropagationTask> tasks, final PropagationHandler handler) {
         final List<PropagationTask> prioritizedTasks = new ArrayList<PropagationTask>(tasks);
         Collections.sort(prioritizedTasks, new PriorityComparator());
 
@@ -64,6 +63,12 @@ public class PriorityPropagationTaskExec
         }
     }
 
+    /**
+     * Compare propagation tasks according to related ExternalResource's priority.
+     *
+     * @see PropagationTask
+     * @see org.apache.syncope.core.persistence.beans.ExternalResource#propagationPriority
+     */
     protected static class PriorityComparator implements Comparator<PropagationTask>, Serializable {
 
         private static final long serialVersionUID = -1969355670784448878L;
@@ -78,10 +83,10 @@ public class PriorityPropagationTaskExec
                     : task2.getResource().getPropagationPriority().intValue();
 
             return prop1 > prop2
-                    ? -1
+                    ? 1
                     : prop1 == prop2
                     ? 0
-                    : 1;
+                    : -1;
         }
     }
 }