change NamespaceStrategy signature to createNamespace(Repository)

This change allows us to implement NamespaceStrategies, such as by type (git, hg, svn) or manual defined.
The DefaultNamespaceStrategy accepts now a predefined namespace and only if no namespace was set the username of the currently logged in user is used.
This commit is contained in:
Sebastian Sdorra
2018-08-01 09:43:49 +02:00
parent 6ee0e05e0c
commit ea17e536f1
5 changed files with 36 additions and 11 deletions

View File

@@ -2,7 +2,18 @@ package sonia.scm.repository;
import sonia.scm.plugin.ExtensionPoint;
/**
* Strategy to create a namespace for the new repository. Namespaces are used to order and identify repositories.
*/
@ExtensionPoint
public interface NamespaceStrategy {
String getNamespace();
/**
* Create new namespace for the given repository.
*
* @param repository repository
*
* @return namespace
*/
String createNamespace(Repository repository);
}