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 2021/05/14 11:28:35 UTC

[syncope] branch 2_1_X updated (3c56129 -> 5992c36)

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a change to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git.


    from 3c56129  Mockito
     new 3af858e  Upgrading Tomcat
     new 5992c36  Passing JobExecutionContext to AbstractSchedTaskJobDelegate#doExecute to allow for additional parameters

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../syncope/core/provisioning/api/job/SchedTaskJobDelegate.java  | 8 ++++++++
 .../core/provisioning/java/job/AbstractSchedTaskJobDelegate.java | 6 +++---
 .../core/provisioning/java/job/ExpiredAccessTokenCleanup.java    | 4 ++--
 .../syncope/core/provisioning/java/job/ExpiredBatchCleanup.java  | 3 ++-
 .../java/job/GroupMemberProvisionTaskJobDelegate.java            | 2 +-
 .../java/pushpull/AbstractProvisioningJobDelegate.java           | 9 ++++++---
 .../syncope/core/provisioning/java/pushpull/PullJobDelegate.java | 4 +++-
 .../syncope/core/provisioning/java/pushpull/PushJobDelegate.java | 4 +++-
 .../syncope/core/provisioning/java/job/ElasticsearchReindex.java | 4 +++-
 .../apache/syncope/fit/core/reference/TestSampleJobDelegate.java | 4 ++--
 pom.xml                                                          | 2 +-
 11 files changed, 34 insertions(+), 16 deletions(-)

[syncope] 01/02: Upgrading Tomcat

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 3af858efffde53ae3f9faf1b8498f0357082204d
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Thu May 13 12:12:13 2021 +0200

    Upgrading Tomcat
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 4fc0bfd..9e08eae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -532,7 +532,7 @@ under the License.
     <cargo.log>${log.directory}/cargo.log</cargo.log>
     <cargo.output>${log.directory}/cargo-output.log</cargo.output>
 
-    <tomcat.version>9.0.45</tomcat.version>
+    <tomcat.version>9.0.46</tomcat.version>
 
     <nodejs.version>v8.11.4</nodejs.version>    
     <protractor.version>5.4.0</protractor.version>    

[syncope] 02/02: Passing JobExecutionContext to AbstractSchedTaskJobDelegate#doExecute to allow for additional parameters

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 5992c3647ea518e786ffc4b47e8995e9eb904b94
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri May 14 12:51:51 2021 +0200

    Passing JobExecutionContext to AbstractSchedTaskJobDelegate#doExecute to allow for additional parameters
---
 .../syncope/core/provisioning/api/job/SchedTaskJobDelegate.java  | 8 ++++++++
 .../core/provisioning/java/job/AbstractSchedTaskJobDelegate.java | 6 +++---
 .../core/provisioning/java/job/ExpiredAccessTokenCleanup.java    | 4 ++--
 .../syncope/core/provisioning/java/job/ExpiredBatchCleanup.java  | 3 ++-
 .../java/job/GroupMemberProvisionTaskJobDelegate.java            | 2 +-
 .../java/pushpull/AbstractProvisioningJobDelegate.java           | 9 ++++++---
 .../syncope/core/provisioning/java/pushpull/PullJobDelegate.java | 4 +++-
 .../syncope/core/provisioning/java/pushpull/PushJobDelegate.java | 4 +++-
 .../syncope/core/provisioning/java/job/ElasticsearchReindex.java | 4 +++-
 .../apache/syncope/fit/core/reference/TestSampleJobDelegate.java | 4 ++--
 10 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/SchedTaskJobDelegate.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/SchedTaskJobDelegate.java
index bb69b10..ddb6fe4 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/SchedTaskJobDelegate.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/SchedTaskJobDelegate.java
@@ -23,5 +23,13 @@ import org.quartz.JobExecutionException;
 
 public interface SchedTaskJobDelegate extends JobDelegate {
 
+    /**
+     * Executes a Quartz Job to run the given Task.
+     *
+     * @param taskKey Task key to run
+     * @param dryRun indicates if execution shall be simulated with no actual changes
+     * @param context Quartz' execution context, can be used to pass parameters to the job
+     * @throws JobExecutionException if anything goes wrong
+     */
     void execute(String taskKey, boolean dryRun, JobExecutionContext context) throws JobExecutionException;
 }
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java
index 796abc4..f164d09 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java
@@ -119,7 +119,7 @@ public abstract class AbstractSchedTaskJobDelegate implements SchedTaskJobDelega
         AuditElements.Result result;
 
         try {
-            execution.setMessage(doExecute(dryRun));
+            execution.setMessage(doExecute(dryRun, context));
             execution.setStatus(TaskJob.Status.SUCCESS.name());
             result = AuditElements.Result.SUCCESS;
         } catch (JobExecutionException e) {
@@ -163,10 +163,11 @@ public abstract class AbstractSchedTaskJobDelegate implements SchedTaskJobDelega
      * The actual execution, delegated to child classes.
      *
      * @param dryRun whether to actually touch the data
+     * @param context Quartz' execution context, can be used to pass parameters to the job
      * @return the task execution status to be set
      * @throws JobExecutionException if anything goes wrong
      */
-    protected abstract String doExecute(boolean dryRun) throws JobExecutionException;
+    protected abstract String doExecute(boolean dryRun, JobExecutionContext context) throws JobExecutionException;
 
     /**
      * Template method to determine whether this job's task execution has to be persisted or not.
@@ -177,5 +178,4 @@ public abstract class AbstractSchedTaskJobDelegate implements SchedTaskJobDelega
     protected boolean hasToBeRegistered(final TaskExec execution) {
         return false;
     }
-
 }
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredAccessTokenCleanup.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredAccessTokenCleanup.java
index 0a8566c..f292dba 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredAccessTokenCleanup.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredAccessTokenCleanup.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.provisioning.java.job;
 
 import org.apache.syncope.core.persistence.api.dao.AccessTokenDAO;
+import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -28,7 +29,7 @@ public class ExpiredAccessTokenCleanup extends AbstractSchedTaskJobDelegate {
     private AccessTokenDAO accessTokenDAO;
 
     @Override
-    protected String doExecute(final boolean dryRun) throws JobExecutionException {
+    protected String doExecute(final boolean dryRun, final JobExecutionContext context) throws JobExecutionException {
         if (!dryRun) {
             int deleted = accessTokenDAO.deleteExpired();
             LOG.debug("Successfully deleted {} expired access tokens", deleted);
@@ -36,5 +37,4 @@ public class ExpiredAccessTokenCleanup extends AbstractSchedTaskJobDelegate {
 
         return "SUCCESS";
     }
-
 }
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredBatchCleanup.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredBatchCleanup.java
index 9d8e7bc..8917b46 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredBatchCleanup.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ExpiredBatchCleanup.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.provisioning.java.job;
 
 import org.apache.syncope.core.persistence.api.dao.BatchDAO;
+import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -28,7 +29,7 @@ public class ExpiredBatchCleanup extends AbstractSchedTaskJobDelegate {
     private BatchDAO batchDAO;
 
     @Override
-    protected String doExecute(final boolean dryRun) throws JobExecutionException {
+    protected String doExecute(final boolean dryRun, final JobExecutionContext context) throws JobExecutionException {
         if (!dryRun) {
             int deleted = batchDAO.deleteExpired();
             LOG.debug("Successfully deleted {} expired batch requests", deleted);
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/GroupMemberProvisionTaskJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/GroupMemberProvisionTaskJobDelegate.java
index 5573079..ab7598f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/GroupMemberProvisionTaskJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/GroupMemberProvisionTaskJobDelegate.java
@@ -73,7 +73,7 @@ public class GroupMemberProvisionTaskJobDelegate extends AbstractSchedTaskJobDel
     }
 
     @Override
-    protected String doExecute(final boolean dryRun) throws JobExecutionException {
+    protected String doExecute(final boolean dryRun, final JobExecutionContext context) throws JobExecutionException {
         Group group = groupDAO.authFind(groupKey);
 
         StringBuilder result = new StringBuilder("Group ").append(group.getName()).append(" members ");
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractProvisioningJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractProvisioningJobDelegate.java
index 25a85c4..6ae50d2 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractProvisioningJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractProvisioningJobDelegate.java
@@ -40,6 +40,7 @@ import org.apache.syncope.core.provisioning.api.ConnectorFactory;
 import org.apache.syncope.common.lib.to.ProvisioningReport;
 import org.apache.syncope.core.provisioning.java.job.AbstractSchedTaskJobDelegate;
 import org.apache.syncope.core.provisioning.java.job.TaskJob;
+import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -630,7 +631,7 @@ public abstract class AbstractProvisioningJobDelegate<T extends ProvisioningTask
     }
 
     @Override
-    protected String doExecute(final boolean dryRun) throws JobExecutionException {
+    protected String doExecute(final boolean dryRun, final JobExecutionContext context) throws JobExecutionException {
         try {
             Class<T> clazz = getTaskClassReference();
             if (!clazz.isAssignableFrom(task.getClass())) {
@@ -668,14 +669,16 @@ public abstract class AbstractProvisioningJobDelegate<T extends ProvisioningTask
             return doExecuteProvisioning(
                     provisioningTask,
                     connector,
-                    dryRun);
+                    dryRun,
+                    context);
         } catch (Throwable t) {
             LOG.error("While executing provisioning job {}", getClass().getName(), t);
             throw t;
         }
     }
 
-    protected abstract String doExecuteProvisioning(T task, Connector connector, boolean dryRun)
+    protected abstract String doExecuteProvisioning(
+            T task, Connector connector, boolean dryRun, JobExecutionContext context)
             throws JobExecutionException;
 
     @Override
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullJobDelegate.java
index 9e7ff24..22d6c21 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullJobDelegate.java
@@ -66,6 +66,7 @@ import org.identityconnectors.framework.common.objects.SyncToken;
 import org.apache.syncope.core.provisioning.api.pushpull.ReconFilterBuilder;
 import org.apache.syncope.core.provisioning.java.DefaultProvisionSorter;
 import org.apache.syncope.core.spring.ImplementationManager;
+import org.quartz.JobExecutionContext;
 
 public class PullJobDelegate extends AbstractProvisioningJobDelegate<PullTask> implements SyncopePullExecutor {
 
@@ -189,7 +190,8 @@ public class PullJobDelegate extends AbstractProvisioningJobDelegate<PullTask> i
     protected String doExecuteProvisioning(
             final PullTask pullTask,
             final Connector connector,
-            final boolean dryRun) throws JobExecutionException {
+            final boolean dryRun,
+            final JobExecutionContext context) throws JobExecutionException {
 
         LOG.debug("Executing pull on {}", pullTask.getResource());
 
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PushJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PushJobDelegate.java
index 25f20cd..55eee2e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PushJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PushJobDelegate.java
@@ -58,6 +58,7 @@ import org.apache.syncope.core.provisioning.api.pushpull.SyncopePushResultHandle
 import org.apache.syncope.core.provisioning.api.pushpull.UserPushResultHandler;
 import org.apache.syncope.core.provisioning.java.DefaultProvisionSorter;
 import org.apache.syncope.core.spring.ImplementationManager;
+import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.support.AbstractBeanDefinition;
@@ -157,7 +158,8 @@ public class PushJobDelegate extends AbstractProvisioningJobDelegate<PushTask> {
     protected String doExecuteProvisioning(
             final PushTask pushTask,
             final Connector connector,
-            final boolean dryRun) throws JobExecutionException {
+            final boolean dryRun,
+            final JobExecutionContext context) throws JobExecutionException {
 
         LOG.debug("Executing push on {}", pushTask.getResource());
 
diff --git a/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java b/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java
index 27c148c..3e8f87a 100644
--- a/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java
+++ b/ext/elasticsearch/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/ElasticsearchReindex.java
@@ -39,6 +39,7 @@ import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentFactory;
+import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -62,8 +63,9 @@ public class ElasticsearchReindex extends AbstractSchedTaskJobDelegate {
     @Autowired
     private AnyObjectDAO anyObjectDAO;
 
+    @SuppressWarnings("deprecation")
     @Override
-    protected String doExecute(final boolean dryRun) throws JobExecutionException {
+    protected String doExecute(final boolean dryRun, final JobExecutionContext context) throws JobExecutionException {
         if (!dryRun) {
             LOG.debug("Start rebuilding indexes");
 
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSampleJobDelegate.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSampleJobDelegate.java
index ce6d940..1a078d3 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSampleJobDelegate.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSampleJobDelegate.java
@@ -21,6 +21,7 @@ package org.apache.syncope.fit.core.reference;
 import java.util.Date;
 import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
 import org.apache.syncope.core.provisioning.java.job.AbstractSchedTaskJobDelegate;
+import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 
 /**
@@ -29,7 +30,7 @@ import org.quartz.JobExecutionException;
 public class TestSampleJobDelegate extends AbstractSchedTaskJobDelegate {
 
     @Override
-    protected String doExecute(final boolean dryRun) throws JobExecutionException {
+    protected String doExecute(final boolean dryRun, final JobExecutionContext context) throws JobExecutionException {
         for (int i = 0; i < 2; i++) {
             LOG.debug("TestSampleJob#doExecute round {} time {}", i, new Date().toString());
             try {
@@ -61,5 +62,4 @@ public class TestSampleJobDelegate extends AbstractSchedTaskJobDelegate {
     protected boolean hasToBeRegistered(final TaskExec execution) {
         return true;
     }
-
 }