Skip to content

Commit

Permalink
Merged in DSC-725-orchestrator-addon (pull request DSpace#1930)
Browse files Browse the repository at this point in the history
DSC-725 orchestrator addon

Approved-by: Andrea Bollini
  • Loading branch information
Micheleboychuk authored and abollini committed Mar 26, 2024
2 parents f4ca922 + 424cba7 commit 872e4fd
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions dspace-server-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,26 @@
</dependency>
</dependencies>
</profile>

<!-- Builds Orchestrator addon for DSpace -->
<profile>
<id>addon-orchestrator</id>
<activation>
<property>
<name>orchestrator.on</name>
</property>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-orchestrator</artifactId>
<version>${addon-orchestrator.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -360,4 +365,17 @@ public List<UUID> getSpecialGroups() {
public Locale getLocale() {
return this.locale;
}

public Integer getProcessId() {
return processId;
}

public String getScriptName() {
return scriptName;
}

public UUID getePersonId() {
return ePersonId;
}

}
19 changes: 19 additions & 0 deletions dspace/modules/additions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,25 @@
</dependencies>
</profile>

<!-- Builds Orchestrator addon for DSpace -->
<profile>
<id>addon-orchestrator</id>
<activation>
<property>
<name>orchestrator.on</name>
</property>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-orchestrator</artifactId>
<version>${addon-orchestrator.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>

<!--
Expand Down
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<addon-docviewer.version>[CRIS-7.0-SNAPSHOT,CRIS-8.0-SNAPSHOT)</addon-docviewer.version>
<addon-analytics.version>[CRIS-7.0-SNAPSHOT,CRIS-8.0-SNAPSHOT)</addon-analytics.version>
<addon-dataquality.version>[CRIS-2023.02-SNAPSHOT,CRIS-2023.03-SNAPSHOT)</addon-dataquality.version>
<addon-orchestrator.version>[CRIS-2023.02-SNAPSHOT,CRIS-2023.03-SNAPSHOT)</addon-orchestrator.version>

<!--=== MAVEN SETTINGS ===-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -960,6 +961,24 @@
</dependencyManagement>
</profile>

<!-- Builds Orchestrator addon for DSpace -->
<profile>
<id>addon-orchestrator</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>it.4science.dspace</groupId>
<artifactId>addon-orchestrator</artifactId>
<version>${addon-orchestrator.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</dependencyManagement>
</profile>

<!-- REST Jersey (Deprecated REST API from DSpace 6.x or below) -->
<!-- As this module is deprecated, it only builds if you activate it via -Pdspace-rest -->
<profile>
Expand Down

0 comments on commit 872e4fd

Please sign in to comment.