Skip to content
Permalink
Browse files

Merge e2cc3a9 into 827311c

  • Loading branch information
benbosman committed Oct 21, 2019
2 parents 827311c + e2cc3a9 commit c1e6e09205e5b2df6d0c5b46ed04df2804f8ebd2
Showing with 3,551 additions and 138 deletions.
  1. +19 −0 dspace-api/src/main/java/org/dspace/content/ProcessStatus.java
  2. +57 −0 dspace-api/src/main/java/org/dspace/content/dao/ProcessDAO.java
  3. +75 −0 dspace-api/src/main/java/org/dspace/content/dao/impl/ProcessDAOImpl.java
  4. +34 −0 dspace-api/src/main/java/org/dspace/content/factory/ProcessServiceFactory.java
  5. +26 −0 dspace-api/src/main/java/org/dspace/content/factory/impl/ProcessServiceFactoryImpl.java
  6. +80 −129 dspace-api/src/main/java/org/dspace/discovery/IndexClient.java
  7. +97 −0 dspace-api/src/main/java/org/dspace/discovery/IndexClientOptions.java
  8. +2 −2 dspace-api/src/main/java/org/dspace/handle/UpdateHandlePrefix.java
  9. +108 −0 dspace-api/src/main/java/org/dspace/scripts/DSpaceCommandLineParameter.java
  10. +156 −0 dspace-api/src/main/java/org/dspace/scripts/DSpaceRunnable.java
  11. +242 −0 dspace-api/src/main/java/org/dspace/scripts/Process.java
  12. +148 −0 dspace-api/src/main/java/org/dspace/scripts/ProcessServiceImpl.java
  13. +81 −0 dspace-api/src/main/java/org/dspace/scripts/handler/DSpaceRunnableHandler.java
  14. +87 −0 dspace-api/src/main/java/org/dspace/scripts/handler/impl/CommandLineDSpaceRunnableHandler.java
  15. +139 −0 dspace-api/src/main/java/org/dspace/scripts/service/ProcessService.java
  16. +40 −0 .../main/resources/org/dspace/storage/rdbms/sqlmigration/h2/V7.0_2019_06_14__scripts-and-process.sql
  17. +40 −0 ...n/resources/org/dspace/storage/rdbms/sqlmigration/oracle/V7.0_2019_06_14__scripts-and-process.sql
  18. +40 −0 ...resources/org/dspace/storage/rdbms/sqlmigration/postgres/V7.0_2019_06_14__scripts-and-process.sql
  19. +16 −0 dspace-api/src/test/data/dspaceFolder/config/spring/api/scripts.xml
  20. +42 −0 dspace-api/src/test/java/org/dspace/scripts/impl/MockDSpaceRunnableScript.java
  21. +117 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/ProcessRestController.java
  22. +63 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/ScriptRestController.java
  23. +34 −0 ...e-server-webapp/src/main/java/org/dspace/app/rest/converter/DSpaceRunnableParameterConverter.java
  24. +40 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/ScriptConverter.java
  25. +43 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/processes/ParameterConverter.java
  26. +51 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/processes/ProcessConverter.java
  27. +18 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/link/process/ProcessHalLinkFactory.java
  28. +44 −0 ...e-server-webapp/src/main/java/org/dspace/app/rest/link/process/ProcessResourceHalLinkFactory.java
  29. +51 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/model/ParameterRest.java
  30. +51 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/model/ParameterValueRest.java
  31. +111 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/model/ProcessRest.java
  32. +1 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RestModel.java
  33. +70 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/model/ScriptRest.java
  34. +22 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/model/hateoas/ProcessResource.java
  35. +22 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/model/hateoas/ScriptResource.java
  36. +87 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ProcessRestRepository.java
  37. +184 −0 dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ScriptRestRepository.java
  38. +218 −0 ...rver-webapp/src/main/java/org/dspace/app/rest/scripts/handler/impl/RestDSpaceRunnableHandler.java
  39. +215 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/ProcessRestRepositoryIT.java
  40. +257 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/ScriptRestRepositoryIT.java
  41. +8 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/builder/AbstractBuilder.java
  42. +76 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/builder/ProcessBuilder.java
  43. +2 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/builder/util/AbstractBuilderCleanupUtil.java
  44. +29 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ParameterMatcher.java
  45. +33 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ParameterValueMatcher.java
  46. +72 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ProcessMatcher.java
  47. +39 −0 dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ScriptMatcher.java
  48. +42 −0 dspace-server-webapp/src/test/java/org/dspace/scripts/impl/MockDSpaceRunnableScript.java
  49. +2 −0 dspace/config/hibernate.cfg.xml
  50. +0 −7 dspace/config/launcher.xml
  51. +2 −0 dspace/config/spring/api/core-dao-services.xml
  52. +1 −0 dspace/config/spring/api/core-factory-services.xml
  53. +4 −0 dspace/config/spring/api/core-services.xml
  54. +13 −0 dspace/config/spring/api/scripts.xml
@@ -0,0 +1,19 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content;

/**
* This Enum holds a representation of all the possible states that a Process can be in
*/
public enum ProcessStatus {
SCHEDULED,
RUNNING,
COMPLETED,
FAILED

}
@@ -0,0 +1,57 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content.dao;

import java.sql.SQLException;
import java.util.List;

import org.dspace.core.Context;
import org.dspace.core.GenericDAO;
import org.dspace.scripts.Process;

/**
* This is the Data Access Object for the {@link Process} object
*/
public interface ProcessDAO extends GenericDAO<Process> {

/**
* This method will return all the Process objects in the database in a list and it'll be sorted by script name
* @param context The relevant DSpace context
* @return The list of all Process objects in the database sorted on scriptname
* @throws SQLException If something goes wrong
*/
public List<Process> findAllSortByScript(Context context) throws SQLException;

/**
* This method will return all the Process objects in the database in a list and it'll be sorted by start time.
* The most recent one will be shown first
* @param context The relevant DSpace context
* @return The list of all Process objects in the database sorted by starttime
* @throws SQLException If something goes wrong
*/
public List<Process> findAllSortByStartTime(Context context) throws SQLException;

/**
* Returns a list of all Process objects in the database
* @param context The relevant DSpace context
* @param limit The limit for the amount of Processes returned
* @param offset The offset for the Processes to be returned
* @return The list of all Process objects in the Database
* @throws SQLException If something goes wrong
*/
List<Process> findAll(Context context, int limit, int offset) throws SQLException;

/**
* Returns the total amount of Process objects in the dataase
* @param context The relevant DSpace context
* @return An integer that describes the amount of Process objects in the database
* @throws SQLException If something goes wrong
*/
int countRows(Context context) throws SQLException;

}
@@ -0,0 +1,75 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content.dao.impl;

import java.sql.SQLException;
import java.util.List;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

import org.dspace.content.dao.ProcessDAO;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
import org.dspace.scripts.Process;
import org.dspace.scripts.Process_;

/**
* Implementation class for {@link ProcessDAO}
*/
public class ProcessDAOImpl extends AbstractHibernateDAO<Process> implements ProcessDAO {

@Override
public List<Process> findAllSortByScript(Context context) throws SQLException {

CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Process.class);
Root<Process> processRoot = criteriaQuery.from(Process.class);
criteriaQuery.select(processRoot);
criteriaQuery.orderBy(criteriaBuilder.asc(processRoot.get(Process_.name)));

return list(context, criteriaQuery, false, Process.class, -1, -1);

}

@Override
public List<Process> findAllSortByStartTime(Context context) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Process.class);
Root<Process> processRoot = criteriaQuery.from(Process.class);
criteriaQuery.select(processRoot);
criteriaQuery.orderBy(criteriaBuilder.desc(processRoot.get(Process_.startTime)),
criteriaBuilder.desc(processRoot.get(Process_.processId)));

return list(context, criteriaQuery, false, Process.class, -1, -1);
}

@Override
public List<Process> findAll(Context context, int limit, int offset) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Process.class);
Root<Process> processRoot = criteriaQuery.from(Process.class);
criteriaQuery.select(processRoot);

return list(context, criteriaQuery, false, Process.class, limit, offset);
}

@Override
public int countRows(Context context) throws SQLException {

CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Process.class);
Root<Process> processRoot = criteriaQuery.from(Process.class);
criteriaQuery.select(processRoot);

return count(context, criteriaQuery, criteriaBuilder, processRoot);

}
}


@@ -0,0 +1,34 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content.factory;

import org.dspace.scripts.service.ProcessService;
import org.dspace.services.factory.DSpaceServicesFactory;

/**
* Abstract factory to get services for the Process workload, use ProcessServiceFactory.getInstance() to retrieve an
* implementation
*
*/
public abstract class ProcessServiceFactory {

/**
* This method will return an instance of the ProcessService
* @return An instance of the ProcessService
*/
public abstract ProcessService getProcessService();

/**
* Use this method to retrieve an implementation of the ProcessServiceFactory to use to retrieve the different beans
* @return An implementation of the ProcessServiceFactory
*/
public static ProcessServiceFactory getInstance() {
return DSpaceServicesFactory.getInstance().getServiceManager()
.getServiceByName("processServiceFactory", ProcessServiceFactory.class);
}
}
@@ -0,0 +1,26 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content.factory.impl;

import org.dspace.content.factory.ProcessServiceFactory;
import org.dspace.scripts.service.ProcessService;
import org.springframework.beans.factory.annotation.Autowired;

/**
* The implementation for the {@link ProcessServiceFactory}
*/
public class ProcessServiceFactoryImpl extends ProcessServiceFactory {

@Autowired(required = true)
private ProcessService processService;

@Override
public ProcessService getProcessService() {
return processService;
}
}

0 comments on commit c1e6e09

Please sign in to comment.
You can’t perform that action at this time.