simplify core api

This commit is contained in:
Eduard Heimbuch
2020-09-09 08:54:38 +02:00
parent 80a822932c
commit 0abe47f666
6 changed files with 25 additions and 33 deletions

View File

@@ -24,14 +24,11 @@
package sonia.scm.repository;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.io.ByteSource;
import sonia.scm.plugin.ExtensionPoint;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
/**
@@ -47,15 +44,6 @@ public interface RepositoryContentInitializer {
*/
void initialize(InitializerContext context) throws IOException;
/**
* returns the class to which the creation context will be mapped
*
* @return the class of the creation context
*/
default Optional<Class<?>> getType() {
return Optional.empty();
}
/**
* Use this {@link InitializerContext} to create new files on repository initialization
* which will be included in the first commit
@@ -76,10 +64,15 @@ public interface RepositoryContentInitializer {
CreateFile create(String path);
/**
* @return creation context of repository which is going to be initialized
* Find the the context object with the given key and unmarshalls it to the given type.
*
* @param key key of the context object
* @param type type of the context object
* @return context object or empty optional
* @since 2.5.0
*/
default Map<String, JsonNode> getCreationContext() {
return Collections.emptyMap();
default <T> Optional<T> getCreationContext(String key, Class<T> type) {
return Optional.empty();
}
}