mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
Merge with 2.0.0-m3
This commit is contained in:
@@ -35,6 +35,7 @@ package sonia.scm;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.repository.RepositoryType;
|
||||
import sonia.scm.security.PermissionDescriptor;
|
||||
import sonia.scm.user.User;
|
||||
|
||||
@@ -82,9 +83,9 @@ public final class ScmState
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public ScmState(String version, User user, Collection<String> groups,
|
||||
String token, Collection<Type> repositoryTypes, String defaultUserType,
|
||||
ScmClientConfig clientConfig, List<String> assignedPermission,
|
||||
List<PermissionDescriptor> availablePermissions)
|
||||
String token, Collection<RepositoryType> repositoryTypes, String defaultUserType,
|
||||
ScmClientConfig clientConfig, List<String> assignedPermission,
|
||||
List<PermissionDescriptor> availablePermissions)
|
||||
{
|
||||
this.version = version;
|
||||
this.user = user;
|
||||
@@ -165,7 +166,7 @@ public final class ScmState
|
||||
*
|
||||
* @return all available repository types
|
||||
*/
|
||||
public Collection<Type> getRepositoryTypes()
|
||||
public Collection<RepositoryType> getRepositoryTypes()
|
||||
{
|
||||
return repositoryTypes;
|
||||
}
|
||||
@@ -244,7 +245,7 @@ public final class ScmState
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "repositoryTypes")
|
||||
private Collection<Type> repositoryTypes;
|
||||
private Collection<RepositoryType> repositoryTypes;
|
||||
|
||||
/** Field description */
|
||||
private User user;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.google.common.base.Strings;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NamespaceAndName {
|
||||
public class NamespaceAndName implements Comparable<NamespaceAndName> {
|
||||
|
||||
private final String namespace;
|
||||
private final String name;
|
||||
@@ -47,4 +47,13 @@ public class NamespaceAndName {
|
||||
public int hashCode() {
|
||||
return Objects.hash(namespace, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(NamespaceAndName o) {
|
||||
int result = namespace.compareTo(o.namespace);
|
||||
if (result == 0) {
|
||||
return name.compareTo(o.name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -82,4 +82,7 @@ public interface RepositoryHandler
|
||||
* @since 1.15
|
||||
*/
|
||||
public String getVersionInformation();
|
||||
|
||||
@Override
|
||||
RepositoryType getType();
|
||||
}
|
||||
|
||||
@@ -38,51 +38,11 @@ package sonia.scm.repository;
|
||||
*
|
||||
* @since 1.14
|
||||
*/
|
||||
public class RepositoryIsNotArchivedException extends RepositoryException
|
||||
{
|
||||
public class RepositoryIsNotArchivedException extends RepositoryException {
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = 7728748133123987511L;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public RepositoryIsNotArchivedException() {}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public RepositoryIsNotArchivedException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param cause
|
||||
*/
|
||||
public RepositoryIsNotArchivedException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public RepositoryIsNotArchivedException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
public RepositoryIsNotArchivedException() {
|
||||
super("Repository could not be deleted, because it is not archived.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,13 +35,11 @@ package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.TypeManager;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -100,7 +98,7 @@ public interface RepositoryManager
|
||||
*
|
||||
* @return all configured repository types
|
||||
*/
|
||||
public Collection<Type> getConfiguredTypes();
|
||||
public Collection<RepositoryType> getConfiguredTypes();
|
||||
|
||||
/**
|
||||
* Returns the {@link Repository} associated to the request uri.
|
||||
@@ -135,11 +133,4 @@ public interface RepositoryManager
|
||||
*/
|
||||
@Override
|
||||
public RepositoryHandler getHandler(String type);
|
||||
|
||||
default Optional<Repository> getByNamespace(String namespace, String name) {
|
||||
return getAll()
|
||||
.stream()
|
||||
.filter(r -> r.getName().equals(name) && r.getNamespace().equals(namespace))
|
||||
.findFirst();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class RepositoryManagerDecorator
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Collection<Type> getConfiguredTypes()
|
||||
public Collection<RepositoryType> getConfiguredTypes()
|
||||
{
|
||||
return decorated.getConfiguredTypes();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import javax.ws.rs.core.MediaType;
|
||||
* Vendor media types used by SCMM.
|
||||
*/
|
||||
public class VndMediaType {
|
||||
|
||||
private static final String VERSION = "2";
|
||||
private static final String TYPE = "application";
|
||||
private static final String SUBTYPE_PREFIX = "vnd.scmm-";
|
||||
@@ -20,8 +21,10 @@ public class VndMediaType {
|
||||
public static final String GROUP_COLLECTION = PREFIX + "groupCollection" + SUFFIX;
|
||||
public static final String REPOSITORY_COLLECTION = PREFIX + "repositoryCollection" + SUFFIX;
|
||||
public static final String BRANCH_COLLECTION = PREFIX + "branchCollection" + SUFFIX;
|
||||
|
||||
public static final String CONFIG = PREFIX + "config" + SUFFIX;
|
||||
public static final String REPOSITORY_TYPE_COLLECTION = PREFIX + "repositoryTypeCollection" + SUFFIX;
|
||||
public static final String REPOSITORY_TYPE = PREFIX + "repositoryType" + SUFFIX;
|
||||
public static final String ME = PREFIX + "me" + SUFFIX;
|
||||
|
||||
private VndMediaType() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user