From 8216d864e74f1451d19f56d086b54347e7a905fd Mon Sep 17 00:00:00 2001 From: Mykhaylo Boychuk Date: Thu, 21 Mar 2024 16:05:48 +0100 Subject: [PATCH 1/2] [DSC-725] code adaptation for addon-orchestrator --- .../org/dspace/scripts/DSpaceRunnable.java | 4 ++++ .../impl/RestDSpaceRunnableHandler.java | 20 ++++++++++++++++++- pom.xml | 19 ++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/dspace-api/src/main/java/org/dspace/scripts/DSpaceRunnable.java b/dspace-api/src/main/java/org/dspace/scripts/DSpaceRunnable.java index 2ea0a52d6e34..5f9693fee69b 100644 --- a/dspace-api/src/main/java/org/dspace/scripts/DSpaceRunnable.java +++ b/dspace-api/src/main/java/org/dspace/scripts/DSpaceRunnable.java @@ -64,6 +64,10 @@ private void setHandler(DSpaceRunnableHandler dSpaceRunnableHandler) { this.handler = dSpaceRunnableHandler; } + public DSpaceRunnableHandler getHandler() { + return this.handler; + } + /** * This method sets the appropriate DSpaceRunnableHandler depending on where it was ran from and it parses * the arguments given to the script diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java index 1ad0765a0f8c..adc9d3c51c7c 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java @@ -44,6 +44,8 @@ import org.dspace.scripts.factory.ScriptServiceFactory; import org.dspace.scripts.handler.DSpaceRunnableHandler; import org.dspace.scripts.service.ProcessService; +import org.dspace.services.ConfigurationService; +import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.utils.DSpace; import org.springframework.core.task.TaskExecutor; @@ -54,6 +56,7 @@ public class RestDSpaceRunnableHandler implements DSpaceRunnableHandler { private static final Logger log = org.apache.logging.log4j.LogManager .getLogger(RestDSpaceRunnableHandler.class); + private ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); private BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService(); private ProcessService processService = ScriptServiceFactory.getInstance().getProcessService(); private EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService(); @@ -298,8 +301,10 @@ public Process getProcess(Context context) { * @param script The script to be ran */ public void schedule(DSpaceRunnable script) { + String taskExecutorBeanName = configurationService.getProperty("dspace.task.executor", + "dspaceRunnableThreadExecutor"); TaskExecutor taskExecutor = new DSpace().getServiceManager() - .getServiceByName("dspaceRunnableThreadExecutor", TaskExecutor.class); + .getServiceByName(taskExecutorBeanName, TaskExecutor.class); Context context = new Context(); try { Process process = processService.find(context, processId); @@ -360,4 +365,17 @@ public List getSpecialGroups() { public Locale getLocale() { return this.locale; } + + public Integer getProcessId() { + return processId; + } + + public String getScriptName() { + return scriptName; + } + + public UUID getePersonId() { + return ePersonId; + } + } diff --git a/pom.xml b/pom.xml index 6f8057395379..53b4eb7b2b4f 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,7 @@ [CRIS-7.0-SNAPSHOT,CRIS-8.0-SNAPSHOT) [CRIS-7.0-SNAPSHOT,CRIS-8.0-SNAPSHOT) [CRIS-2023.02-SNAPSHOT,CRIS-2023.03-SNAPSHOT) + [CRIS-2023.02-SNAPSHOT,CRIS-2023.03-SNAPSHOT) UTF-8 @@ -960,6 +961,24 @@ + + + addon-orchestrator + + false + + + + + it.4science.dspace + addon-orchestrator + ${addon-orchestrator.version} + jar + + + + + From 424cba78a3a2ae807b0115c6f6772c180f44556c Mon Sep 17 00:00:00 2001 From: Mykhaylo Boychuk Date: Tue, 26 Mar 2024 12:56:37 +0100 Subject: [PATCH 2/2] [DSC-725] aaded orchestrator profiles to additions and server-webapp --- dspace-server-webapp/pom.xml | 20 ++++++++++++++++++++ dspace/modules/additions/pom.xml | 19 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/dspace-server-webapp/pom.xml b/dspace-server-webapp/pom.xml index 0ba8f40d86ab..52a6cba34f50 100644 --- a/dspace-server-webapp/pom.xml +++ b/dspace-server-webapp/pom.xml @@ -367,6 +367,26 @@ + + + + addon-orchestrator + + + orchestrator.on + + + + + + it.4science.dspace + addon-orchestrator + ${addon-orchestrator.version} + jar + + + + diff --git a/dspace/modules/additions/pom.xml b/dspace/modules/additions/pom.xml index 3077c65c456a..970e170d7a7c 100644 --- a/dspace/modules/additions/pom.xml +++ b/dspace/modules/additions/pom.xml @@ -283,6 +283,25 @@ + + + addon-orchestrator + + + orchestrator.on + + + + + + it.4science.dspace + addon-orchestrator + ${addon-orchestrator.version} + jar + + + +