each class that implements the interface can now have configurations for multiple repositories

This commit is contained in:
Aldo Mihasi 2023-06-21 12:27:11 +03:00
parent e2864d9ff0
commit 17ed24a9ff
1 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,8 @@ package eu.eudat.depositinterface.repository;
import eu.eudat.depositinterface.models.DMPDepositModel; import eu.eudat.depositinterface.models.DMPDepositModel;
import java.util.List;
/** /**
* The RepositoryDeposit interface represents the mechanism of depositing a dmp to any * The RepositoryDeposit interface represents the mechanism of depositing a dmp to any
* repository which mints a persistent digital object identifier (DOI) for each submission, * repository which mints a persistent digital object identifier (DOI) for each submission,
@ -13,6 +15,7 @@ public interface RepositoryDeposit {
* Returns a string representing the persistent digital object identifier (DOI) which * Returns a string representing the persistent digital object identifier (DOI) which
* was created. * was created.
* *
* @param repositoryId the id of the repository
* @param dmpDepositModel dmp structure which is to be deposited * @param dmpDepositModel dmp structure which is to be deposited
* @param repositoryAccessToken access token needed for the authentication to the repository * @param repositoryAccessToken access token needed for the authentication to the repository
* if this is null, another authentication mechanism is used for * if this is null, another authentication mechanism is used for
@ -21,20 +24,21 @@ public interface RepositoryDeposit {
* @return a string representing the persistent digital object identifier (DOI) * @return a string representing the persistent digital object identifier (DOI)
* @throws Exception if an error occurs while trying to deposit the dmp * @throws Exception if an error occurs while trying to deposit the dmp
*/ */
String deposit(DMPDepositModel dmpDepositModel, String repositoryAccessToken) throws Exception; String deposit(String repositoryId, DMPDepositModel dmpDepositModel, String repositoryAccessToken) throws Exception;
/** /**
* Returns the access token from the oauth2 flow. * Returns the access token from the oauth2 flow.
* *
* @param repositoryId the id of the repository
* @param code oauth2 authorization code * @param code oauth2 authorization code
* @return the access token or null if no oauth2 protocol is not supported for that repository * @return the access token or null if no oauth2 protocol is not supported for that repository
*/ */
String authenticate(String code); String authenticate(String repositoryId, String code);
/** /**
* Returns the repository's configuration. * Returns the repository's configuration.
* *
* @return structure representing the configuration of the repository <br> * @return List of structure representing the configuration of the repository <br>
* which includes the following fields: <br> * which includes the following fields: <br>
* depositType - an integer representing how the dmp user can deposit in the repository, * depositType - an integer representing how the dmp user can deposit in the repository,
* 0 stands for system deposition meaning the dmp is deposited using argos credentials to the * 0 stands for system deposition meaning the dmp is deposited using argos credentials to the
@ -51,13 +55,14 @@ public interface RepositoryDeposit {
* repositoryClientSecret - repository's client secret<br> * repositoryClientSecret - repository's client secret<br>
* redirectUri - redirect uri to argos after the oauth2 flow from the repository<br> * redirectUri - redirect uri to argos after the oauth2 flow from the repository<br>
*/ */
RepositoryDepositConfiguration getConfiguration(); List<RepositoryDepositConfiguration> getConfiguration();
/** /**
* Returns the repository's logo if exists. * Returns the repository's logo if exists.
* *
* @param repositoryId the id of the repository
* @return the repository's logo in base64 form * @return the repository's logo in base64 form
* */ * */
String getLogo(); String getLogo(String repositoryId);
} }