Deposit
Repository Deposit Base is a Maven package that provides the base interfaces and configuration classes required to implement repository deposit services for the OpenCDMP platform. Each repository deposit service is developed as a separate microservice and can be registered with OpenCDMP to support the deposition of Plans into external repositories for DOI assignment.
Key Interfaces and Classes
The model Plan Model is supported by the Common Models Plugin.
1. DepositClient.java
This interface defines the core operations that any repository deposit service must implement.
public interface DepositClient {
String deposit(PlanDepositModel planDepositModel) throws Exception;
String authenticate(String code);
DepositConfiguration getConfiguration();
String getLogo();
}
- deposit(): Deposits a plan to the repository and returns the DOI.
- authenticate(): Authenticates with the repository using OAuth2 and returns the access token.
- getConfiguration(): Returns the configuration details of the repository.
- getLogo(): Returns the repository’s logo in base64 format, if available.
2. DepositController.java
This interface defines the API endpoints that the repository deposit service must implement to communicate with the OpenCDMP platform.
public interface DepositController {
@PostMapping()
String deposit(@RequestBody PlanDepositModel planDepositModel) throws Exception;
@GetMapping("/authenticate")
String authenticate(@RequestParam("authToken") String code);
@GetMapping("/configuration")
DepositConfiguration getConfiguration();
@GetMapping("/logo")
String getLogo();
}
- deposit(): Deposits a plan to the repository and returns the DOI.
- authenticate(): Authenticates with the repository using OAuth2 and returns the access token.
- getConfiguration(): Returns the repository's configuration details.
- getLogo(): Returns the repository’s logo if available.
3. PlanDepositModel.java
public class PlanDepositModel {
private PlanModel planModel;
private AuthInfo authInfo;
// Getters and Setters
}
Fields
- planModel: contains plan data which is to be deposited
- authInfo: user auth info structure needed for the authentication to the repository.
public class AuthInfo {
private String authToken;
private List<PluginUserFieldModel> authFields;
// Getters and Setters
}
Fields
- authToken: option to user access token if needed or supported
- authFields: contains a list of objects. Option to use different credentials from access token, like username and password. Tou can view
PluginUserFieldModelhere.
4. DepositConfiguration.java
This class contains the configuration details for each repository deposit service, which the OpenCDMP platform reads and registers.
public class DepositConfiguration {
private DepositType depositType;
private String repositoryId;
private String accessToken;
private String repositoryUrl;
private String repositoryAuthorizationUrl;
private String repositoryRecordUrl;
private String repositoryAccessTokenUrl;
private String repositoryClientId;
private String repositoryClientSecret;
private String redirectUri;
private boolean useSharedStorage;
private boolean hasLogo;
private List<ConfigurationField> configurationFields;
private List<ConfigurationUserField> configurationUserFields;
private List<DepositAuthMethod> authMethods;
// Getters and Setters
}
Fields
- depositType: Defines how the plan is deposited (system credentials, user credentials, or both).
- repositoryId: Unique identifier for the repository.
- accessToken: Token used for repository deposits (if applicable).
- repositoryUrl: URL of the repository.
- repositoryAuthorizationUrl: Authorization URL for OAuth2.
- repositoryRecordUrl: URL for the deposited plan records.
- repositoryAccessTokenUrl: Access token URL for OAuth2 flow.
- repositoryClientId: Client ID for OAuth2 flow.
- repositoryClientSecret: Client secret for OAuth2 flow.
- redirectUri: URI to redirect back to OpenCDMP after OAuth2 flow.
- useSharedStorage: Indicates if shared storage is used.
- hasLogo: Indicates if the repository has a logo.
- configurationFields: Fields that contain additional configuration for this deposit. For more information click here.
- configurationUserFields: Fields that provide additional configuration options specific to this file transformer, particularly for user profile settings. For more details, click here.
- authMethods: List of the deposit authentication method types.
PluginDefault: option to use default repository credentialsAuthInfoFromUserProfile: option to use credentials that have stored in OpenCDMP user's profileoAuth2Flow: option to use credentials OAuth2 flow
How to Create a Custom Repository Deposit Service
To implement a custom repository deposit service for OpenCDMP:
-
Create a New Spring Boot Project:
- Use Spring Boot to create a microservice that implements the
DepositClientandDepositControllerinterfaces.
- Use Spring Boot to create a microservice that implements the
-
Define Your Repository Configuration:
- Define the repository-specific configuration in the
DepositConfigurationclass.
- Define the repository-specific configuration in the
-
Use Existing Implementations as Examples:
- You can refer to existing deposit projects that are part of the OpenCDMP platform (is mentioned in supplementary services section) as examples.
-
Register the Service:
- Once your service is implemented and running, register it with the OpenCDMP platform (for more details see Tenant Configuration). It will then be available as a repository deposit option for plans.
License
This package is licensed under the EUPL 1.2 License.
Contact
For questions or support regarding the implementation of repository deposit services, please contact:
- Email: opencdmp at cite.gr
End notes
You can view Repository Deposit Base source code here.